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
2d6bb65322f4cd4da76055d137810d7722ae7f4d
diff --git a/ghost/admin/app/components/gh-cm-editor.js b/ghost/admin/app/components/gh-cm-editor.js index <HASH>..<HASH> 100644 --- a/ghost/admin/app/components/gh-cm-editor.js +++ b/ghost/admin/app/components/gh-cm-editor.js @@ -55,9 +55,14 @@ const CmEditorComponent = Component.extend(InvokeActionMixin, { willDestroyElement() { this._super(...arguments); - let editor = this._editor.getWrapperElement(); - editor.parentNode.removeChild(editor); - this._editor = null; + // Ensure the editor exists before trying to destroy it. This fixes + // an error that occurs if codemirror hasn't finished loading before + // the component is destroyed. + if (this._editor) { + let editor = this._editor.getWrapperElement(); + editor.parentNode.removeChild(editor); + this._editor = null; + } } });
:bug: don't destroy codemirror editor if it doesn't exist (#<I>) closes TryGhost/Ghost#<I> - check if codemirror has been initialized before trying to destroy it
TryGhost_Ghost
train
js
8cbd9b8fb10d2881ab7c15436a339e7992174c27
diff --git a/src/transformers/dependency_versions_table.py b/src/transformers/dependency_versions_table.py index <HASH>..<HASH> 100644 --- a/src/transformers/dependency_versions_table.py +++ b/src/transformers/dependency_versions_table.py @@ -5,7 +5,7 @@ deps = { "Pillow": "Pillow", "black": "black~=22.0", "codecarbon": "codecarbon==1.2.0", - "cookiecutter": "cookiecutter==1.7.2", + "cookiecutter": "cookiecutter==1.7.3", "dataclasses": "dataclasses", "datasets": "datasets", "deepspeed": "deepspeed>=0.6.0",
Fix style (#<I>)
huggingface_pytorch-pretrained-BERT
train
py
27871dbfef3be445169eafe2c66f0333d3090579
diff --git a/rows/plugins/postgresql.py b/rows/plugins/postgresql.py index <HASH>..<HASH> 100644 --- a/rows/plugins/postgresql.py +++ b/rows/plugins/postgresql.py @@ -414,6 +414,7 @@ class PostgresCopy: field_names = list(schema.keys()) if not set(csv_field_names).issubset(set(field_names)): raise ValueError("CSV field names are not a subset of schema field names") + field_names = [field for field in csv_field_names if field in field_names] if create_table: # If we need to create the table, it creates based on schema
[pgimport] Force field ordering based on CSV's header
turicas_rows
train
py
ca1fc6efcda640000a9a4354026e49e7d8aa2a4b
diff --git a/girder/constants.py b/girder/constants.py index <HASH>..<HASH> 100644 --- a/girder/constants.py +++ b/girder/constants.py @@ -23,6 +23,9 @@ Constants should be defined here. import os import json +# let's break python +(╯°□°)╯︵ ┻━┻ + PACKAGE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(PACKAGE_DIR) LOG_ROOT = os.path.join(os.path.expanduser('~'), '.girder', 'logs')
Testing new cmake on failed tests
girder_girder
train
py
38daff70570eabe0204f2bb4cd1e73e9e6a446a6
diff --git a/lib/article.js b/lib/article.js index <HASH>..<HASH> 100644 --- a/lib/article.js +++ b/lib/article.js @@ -18,6 +18,8 @@ var regex = { }; var load = function(source, callback){ + var extname = path.extname(source); + async.waterfall([ function(next){ file.read(source, function(err, result){ @@ -34,7 +36,7 @@ var load = function(source, callback){ meta.date = _.isDate(meta.date) ? moment(meta.date) : moment(meta.date, 'YYYY-MM-DD HH:mm:ss'); meta.updated = moment(stats.mtime); - render.render(meta._content, 'md', function(err, result){ + render.render(meta._content, extname, function(err, result){ if (err) throw err; var result = swig.compile(result)(); @@ -59,13 +61,15 @@ exports.loadPost = function(source, category, callback){ filename = path.basename(source, extname); load(source, function(meta){ - if (meta.tags){ + if (_.isArray(meta.tags)){ meta.tags = _.map(meta.tags, function(item){ return { name: item, permalink: config.tag_dir + '/' + item + '/' }; }); + } else if (_.isString(meta.tags)){ + meta.tags = [{name: meta.tags, permalink: config.tag_dir + '/' + meta.tags + '/'}]; } if (category){
Fixed bug when tag is not an array
hexojs_hexo
train
js
4951231a7c93ac10c760eee7017dd46263587753
diff --git a/discord/app_commands/commands.py b/discord/app_commands/commands.py index <HASH>..<HASH> 100644 --- a/discord/app_commands/commands.py +++ b/discord/app_commands/commands.py @@ -556,10 +556,10 @@ class Command(Generic[GroupT, P, T]): parent = self.parent if parent is not None: - await parent.on_error(interaction, self, error) + await parent.on_error(interaction, error) if parent.parent is not None: - await parent.parent.on_error(interaction, self, error) + await parent.parent.on_error(interaction, error) def _has_any_error_handlers(self) -> bool: if self.on_error is not None: @@ -1159,19 +1159,19 @@ class Group: if isinstance(command, Group): yield from command.walk_commands() - async def on_error(self, interaction: Interaction, command: Command[Any, ..., Any], error: AppCommandError) -> None: + async def on_error(self, interaction: Interaction, error: AppCommandError) -> None: """|coro| A callback that is called when a child's command raises an :exc:`AppCommandError`. + To get the command that failed, :attr:`discord.Interaction.command` should be used. + The default implementation does nothing. Parameters ----------- interaction: :class:`~discord.Interaction` The interaction that is being handled. - command: :class:`~discord.app_commands.Command` - The command that failed. error: :exc:`AppCommandError` The exception that was raised. """
Remove command parameter from Group.on_error callback Similar to the CommandTree.on_error removal, this one can be retrieved using Interaction.command
Rapptz_discord.py
train
py
07cf0bd057b65ead6d16a5e0c9e8f9d9d3968f87
diff --git a/test/integration/advanced.js b/test/integration/advanced.js index <HASH>..<HASH> 100644 --- a/test/integration/advanced.js +++ b/test/integration/advanced.js @@ -21,7 +21,7 @@ describe('bitcoinjs-lib (advanced)', function () { assert(bitcoin.message.verify(address, signature, message)) }) - it('can create an OP_RETURN transaction', function (done) { + it('can create a transaction using OP_RETURN', function (done) { this.timeout(30000) var network = bitcoin.networks.testnet @@ -51,8 +51,8 @@ describe('bitcoinjs-lib (advanced)', function () { if (err) return done(err) var actual = bitcoin.Transaction.fromHex(transaction.txHex) - var dataScript2 = actual.outs[0].script - var data2 = bitcoin.script.decompile(dataScript2)[1] + var actualScript = actual.outs[0].script + assert.deepEqual(actualScript, dataScript) assert.deepEqual(dataScript, dataScript2) assert.deepEqual(data, data2)
tests/integration: use actual=expected consistently for asserts
BitGo_bitgo-utxo-lib
train
js
e3875879865100e86cad88050e63f4f0df9671a7
diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index <HASH>..<HASH> 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -471,7 +471,12 @@ def test_load_setuptools_instantiation(monkeypatch, pm): assert num == 1 plugin = pm.get_plugin("myname") assert plugin.x == 42 - assert pm.list_plugin_distinfo() == [(plugin, dist)] + ret = pm.list_plugin_distinfo() + # poor man's `assert ret == [(plugin, mock.ANY)]` + assert len(ret) == 1 + assert len(ret[0]) == 2 + assert ret[0][0] == plugin + assert ret[0][1]._dist == dist num = pm.load_setuptools_entrypoints("hello") assert num == 0 # no plugin loaded by this call
Fix test for DistFacade
pytest-dev_pluggy
train
py
567403c8f8aa446e32656bf48be95ef2dff5d25d
diff --git a/test/unit/core.js b/test/unit/core.js index <HASH>..<HASH> 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -126,7 +126,9 @@ describe('Imager.js', function () { it('should pick the data-width and not the container\'s size (container\'s size smaller than availableWidths)', function(){ expect(imgr.determineAppropriateResolution(imgr.divs[5])).to.equal(640); }); + }); + describe('availableWidths', function () { it('can be a function computing a value for you', function (done) { // this example will always compute sizes 8 pixels by 8 pixels var imgr = new Imager({
Porting `determineAppropriateResolution` to a dedicated section. - splitting the test case for more granularity and TDD conformance
BBC-News_Imager.js
train
js
eb15056d2e8603493966f35d0553ac1e6d43692b
diff --git a/events.py b/events.py index <HASH>..<HASH> 100644 --- a/events.py +++ b/events.py @@ -16,9 +16,10 @@ def _fire_task(event): """Build and send the emails as a celery task.""" # This is outside the Event class because @task doesn't send the `self` arg # implicitly, and there's no sense making it look like it does. - connection = mail.get_connection() - connection.send_messages(event._mails(event._users_watching())) - # TODO: Pass fail_silently or whatever. + connection = mail.get_connection(fail_silently=True) + connection.open() + for m in event._mails(event._users_watching()): + connection.send_messages([m]) class Event(object): @@ -260,7 +261,7 @@ class Event(object): # Subclasses should implement the following: def _mails(self, users): - """Return an iterable of EmailMessages to send to each User.""" + """Return an iterable yielding a EmailMessage to send to each User.""" raise NotImplementedError def _users_watching(self):
[bug <I>] Tolerate any iterables returned from _mails(), and fail silently if mail sending goes wrong (for now).
mozilla_django-tidings
train
py
fe8965efa284b20c241ef3117a50965abee66708
diff --git a/lib/renderer/chrome-api.js b/lib/renderer/chrome-api.js index <HASH>..<HASH> 100644 --- a/lib/renderer/chrome-api.js +++ b/lib/renderer/chrome-api.js @@ -43,12 +43,12 @@ class Port { disconnect () { if (this.disconnected) return - ipcRenderer._sendInternalToAll(this.tabId, `CHROME_PORT_DISCONNECT_${this.portId}`) + ipcRenderer.sendToAll(this.tabId, `CHROME_PORT_DISCONNECT_${this.portId}`) this._onDisconnect() } postMessage (message) { - ipcRenderer._sendInternalToAll(this.tabId, `CHROME_PORT_POSTMESSAGE_${this.portId}`, message) + ipcRenderer.sendToAll(this.tabId, `CHROME_PORT_POSTMESSAGE_${this.portId}`, message) } _onDisconnect () {
fix: use sendToAll method correctly in chrome-api (#<I>)
electron_electron
train
js
2d70ebe66c1b95242543f380f51c7e9a3ea69aa8
diff --git a/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py b/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py index <HASH>..<HASH> 100644 --- a/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py +++ b/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_stock.py @@ -93,6 +93,7 @@ def order_shares(id_or_ins, amount, price=None, style=None): """ if amount == 0: # 如果下单量为0,则认为其并没有发单,则直接返回None + user_system_log.warn(_(u"Order Creation Failed: Order amount is 0.")) return None style = cal_style(price, style) if isinstance(style, LimitOrder):
add warn when amount is 0 in order shares
ricequant_rqalpha
train
py
37ce71b5881e995096ea552c1a82536adff8f25a
diff --git a/src/main/java/com/spotify/docker/client/DefaultDockerClient.java b/src/main/java/com/spotify/docker/client/DefaultDockerClient.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/spotify/docker/client/DefaultDockerClient.java +++ b/src/main/java/com/spotify/docker/client/DefaultDockerClient.java @@ -1218,7 +1218,6 @@ public class DefaultDockerClient implements DockerClient, Closeable { case 500: throw new DockerException(response.readEntity(String.class)); } - System.out.println(response.getStatus()); } private WebTarget resource() {
removed System.out.println
spotify_docker-client
train
java
8d7a9e4c002ef555acb4e64b1322404a4236b431
diff --git a/lib/minicron/cli/commands.rb b/lib/minicron/cli/commands.rb index <HASH>..<HASH> 100644 --- a/lib/minicron/cli/commands.rb +++ b/lib/minicron/cli/commands.rb @@ -132,7 +132,8 @@ module Minicron Minicron.config['client']['path'] ) - # Set up the job and get the jexecution and job ids back from the server + # Set up the job and get the execution and job ids back from the server + # The execution number is also returned but it's only used by the frontend ids = setup_job(args.first, faye) end rescue Exception => e diff --git a/lib/minicron/transport/client.rb b/lib/minicron/transport/client.rb index <HASH>..<HASH> 100644 --- a/lib/minicron/transport/client.rb +++ b/lib/minicron/transport/client.rb @@ -52,7 +52,8 @@ module Minicron # Return them as a hash { :job_id => ids[0], - :execution_id => ids[1] + :execution_id => ids[1], + :number => ids[2] } end
This isn't really needed but just there to avoid future confusion
jamesrwhite_minicron
train
rb,rb
30dbca3307b3800e8849a26a2a2f2d847d91f929
diff --git a/global.go b/global.go index <HASH>..<HASH> 100644 --- a/global.go +++ b/global.go @@ -651,6 +651,7 @@ func newContext() *_runtime { // TODO Is _propertyMode(0) compatible with 3? // _propertyMode(0), + _propertyMode(101), "undefined", UndefinedValue(), "NaN", NaNValue(), "Infinity", positiveInfinityValue(), diff --git a/global_test.go b/global_test.go index <HASH>..<HASH> 100644 --- a/global_test.go +++ b/global_test.go @@ -175,3 +175,17 @@ func Test_decodeURIComponent(t *testing.T) { test(`decodeURIComponent(encodeURI("http://example.com/ Nothing happens."))`, "http://example.com/ Nothing happens.") test(`decodeURIComponent(encodeURI("http://example.com/ _^#"))`, "http://example.com/ _^#") } + +func TestGlobal_notEnumerable(t *testing.T) { + Terst(t) + test := runTest() + test(` + var found = []; + for (var test in this) { + if (test === 'NaN' || test === 'undefined' || test === 'Infinity' ) { + found.push(test) + } + } + found; + `, "") +}
NaN, Infinity, undefined, etc. are not be enumerable
robertkrimen_otto
train
go,go
9d900e645009a22d0f4b5b46ccd85e09a17bcd9c
diff --git a/src/View.js b/src/View.js index <HASH>..<HASH> 100644 --- a/src/View.js +++ b/src/View.js @@ -118,12 +118,13 @@ var View = FC.View = InteractiveDateComponent.extend({ }, + // given func will auto-bind to `this` whenSizeUpdated: function(func) { if (this.renderQueue.isRunning) { - this.renderQueue.one('stop', func); + this.renderQueue.one('stop', func.bind(this)); } else { - func(); + func.call(this); } }, @@ -283,7 +284,7 @@ var View = FC.View = InteractiveDateComponent.extend({ this.on('datesRendered', function() { _this.whenSizeUpdated( - _this.triggerViewRender.bind(_this) + _this.triggerViewRender ); }); @@ -319,7 +320,7 @@ var View = FC.View = InteractiveDateComponent.extend({ this.requestRender(function() { _this.executeEventRender(eventsPayload); _this.whenSizeUpdated( - _this.triggerAfterEventsRendered.bind(_this) + _this.triggerAfterEventsRendered ); }, 'event', 'init'); },
whenSizeUpdated auto-bind to this
fullcalendar_fullcalendar
train
js
488b0c92f747ee354d520c917df91744bf0f9d3f
diff --git a/bcbio/variation/varscan.py b/bcbio/variation/varscan.py index <HASH>..<HASH> 100644 --- a/bcbio/variation/varscan.py +++ b/bcbio/variation/varscan.py @@ -86,6 +86,6 @@ def _varscan_work(align_bams, ref_file, config, target_regions, out_file): want_bcf=False) varscan = sh.Command("java").bake("-jar", varscan_jar, "mpileup2cns", "--min-coverage", "5", - "--p-value", "0.01", + "--p-value", "0.98", "--output-vcf", "--variants", _out=out_handle) varscan(mpileup())
Inclusive varscan p-value that still includes calculation of p-values
bcbio_bcbio-nextgen
train
py
95de57b8ac92ca4f4b4785986c2ed0ef5bb8d99a
diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index <HASH>..<HASH> 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -1054,14 +1054,14 @@ function quiz_reset_userdata($data) { * Checks whether the current user is allowed to view a file uploaded in a quiz. * Teachers can view any from their courses, students can only view their own. * - * @param int $attemptid int attempt id + * @param int $attemptuniqueid int attempt id * @param int $questionid int question id * @return boolean to indicate access granted or denied */ -function quiz_check_file_access($attemptid, $questionid) { +function quiz_check_file_access($attemptuniqueid, $questionid) { global $USER; - $attempt = get_record("quiz_attempts", 'id', $attemptid); + $attempt = get_record("quiz_attempts", 'uniqueid', $attemptid); $quiz = get_record("quiz", 'id', $attempt->quiz); $context = get_context_instance(CONTEXT_COURSE, $quiz->course);
Inconsistency between quiz attempt->id and attempt.uniqueid
moodle_moodle
train
php
0c664260de5ddc1ec8aa8e8230567736652fbf8a
diff --git a/tests/BarcodeValidatorTest.php b/tests/BarcodeValidatorTest.php index <HASH>..<HASH> 100644 --- a/tests/BarcodeValidatorTest.php +++ b/tests/BarcodeValidatorTest.php @@ -4,7 +4,12 @@ namespace violuke\Barcodes\Tests; use violuke\Barcodes\BarcodeValidator; -class BarcodeValidatorTest extends \PHPUnit\Framework\TestCase +// Nasty work around for testing over multiple PHPUnit versions +if (!class_exists('PHPUnit_Framework_TestCase')) { + class PHPUnit_Framework_TestCase extends \PHPUnit\Framework\TestCase {} +} + +class BarcodeValidatorTest extends \PHPUnit_Framework_TestCase { public function testInit()
Nasty work around for testing over multiple PHPUnit versions
violuke_php-barcodes
train
php
a8e997794af0e9e87c105d863d1aac26bca0c184
diff --git a/scripts/update/Updater.php b/scripts/update/Updater.php index <HASH>..<HASH> 100644 --- a/scripts/update/Updater.php +++ b/scripts/update/Updater.php @@ -1959,9 +1959,9 @@ class Updater extends \common_ext_ExtensionUpdater $this->setVersion('35.6.0'); } - $this->skip('35.6.0', '35.10.2'); + $this->skip('35.6.0', '35.10.3'); - if ($this->isVersion('35.10.2')) { + if ($this->isVersion('35.10.3')) { $this->getServiceManager()->register(QtiTestUtils::SERVICE_ID, new QtiTestUtils([])); $this->setVersion('35.11.0'); }
Fix updater after applying hotfix on version <I>
oat-sa_extension-tao-testqti
train
php
6dc2b49a6194baae58f674a1f9c4d60fa126b3d6
diff --git a/test/index.js b/test/index.js index <HASH>..<HASH> 100644 --- a/test/index.js +++ b/test/index.js @@ -1338,6 +1338,26 @@ describe('Horseman', function() { horseman.open(serverUrl).then(function() {}) .should.have.properties(Object.keys(actions)); }); + + it('should call close after rejection', function(done) { + // Record if close gets called + var close = horseman.close; + var called = false; + horseman.close = function() { + called = true; + return close.apply(this, arguments); + } + + horseman.open(serverUrl) + .then(function() { + throw new Error('Intentional Rejection'); + }) + .close() + .finally(function() { + called.should.equal(true); + }) + .nodeify(done); + }); }); });
Add test for close being called after a rejection
johntitus_node-horseman
train
js
0931a300c22302e4eeeae4e7b8189b63b60e46cb
diff --git a/core-bundle/src/Resources/contao/config/config.php b/core-bundle/src/Resources/contao/config/config.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/Resources/contao/config/config.php +++ b/core-bundle/src/Resources/contao/config/config.php @@ -377,7 +377,8 @@ $GLOBALS['TL_CRON'] = array array('Automator', 'rotateLogs'), array('Automator', 'checkForUpdates') ), - 'hourly' => array() + 'hourly' => array(), + 'minutely' => array() );
[Core] Added support for minutely cron jobs (see #<I>)
contao_contao
train
php
f80b055324b2577748570683fcb67e0c1ab7e3bb
diff --git a/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php b/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php +++ b/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php @@ -10,8 +10,7 @@ use PDOException; /** * PDO Oracle driver. * - * WARNING: This driver gives us segfaults in our testsuites on CLOB and other - * stuff. PDO Oracle is not maintained by Oracle or anyone in the PHP community, + * WARNING: PDO Oracle is not maintained by Oracle or anyone in the PHP community, * which leads us to the recommendation to use the "oci8" driver to connect * to Oracle instead. *
Remove segfault comment from PDOOracle driver
doctrine_dbal
train
php
215eb20f85a93c3193b8f6e008413d8139607fcb
diff --git a/lib/steam/community/GameLeaderboardEntry.php b/lib/steam/community/GameLeaderboardEntry.php index <HASH>..<HASH> 100644 --- a/lib/steam/community/GameLeaderboardEntry.php +++ b/lib/steam/community/GameLeaderboardEntry.php @@ -42,15 +42,15 @@ class GameLeaderboardEntry { * @param SimpleXMLElement $entryData The entry data from Steam Community * @param GameLeaderboard $leaderboard The parent leaderboard that this entry belongs to */ - $this->steamId64 = (string) $entryData->steamid; public function __construct($entryData, $leaderboard) { + $this->steamId64 = SteamId::create((string) $entryData->steamid, false); $this->score = (int) $entryData->score; $this->rank = (int) $entryData->rank; $this->leaderboard = $leaderboard; } /** - * @return String + * @return SteamId */ public function getSteamId64() { return $this->steamId64;
PHP: Save a SteamId instead of just a string in GameLeaderboardEntry
koraktor_steam-condenser-php
train
php
a57e998c45bd3868ef7fa689db7b3bb6e330dbb8
diff --git a/lib/mongo_mapper/document.rb b/lib/mongo_mapper/document.rb index <HASH>..<HASH> 100644 --- a/lib/mongo_mapper/document.rb +++ b/lib/mongo_mapper/document.rb @@ -40,14 +40,8 @@ module MongoMapper super end - def ensure_index(name_or_array, options={}) - keys_to_index = if name_or_array.is_a?(Array) - name_or_array.map { |pair| [pair[0], pair[1]] } - else - name_or_array - end - - collection.create_index(keys_to_index, options[:unique]) + def ensure_index(spec, options={}) + collection.create_index(spec, options) end def find(*args)
No longer need fanciness in MM for indexes as driver understands more.
mongomapper_mongomapper
train
rb
1bbe1d0058a8554b9b94e9a3318108f684e54ab7
diff --git a/lib/plan_executor/app.rb b/lib/plan_executor/app.rb index <HASH>..<HASH> 100644 --- a/lib/plan_executor/app.rb +++ b/lib/plan_executor/app.rb @@ -92,9 +92,15 @@ module PlanExecutor error = validate_schema(@schema, body) return [400, error.to_json] unless error.nil? name = body['plan_name'] - # Errors if plan is not found - @pal.get_plan_info(name) - + # We need to wrap all calls to @pal (not just plan_run) in a future + # to ensure that the process always uses the SingleThreadExecutor + # worker and forces one call to @pal at a time regardless of the number + # of concurrent calls to POST /plan_run + result = Concurrent::Future.execute(executor: @worker) do + @pal.get_plan_info(name) + end + # .value! will fail if the internal process of the thread fails + result.value! executor = PlanExecutor::Executor.new(body['job_id'], @http_client) applicator = PlanExecutor::Applicator.new(@inventory, executor, nil) params = body['params'] @@ -104,7 +110,6 @@ module PlanExecutor executor.finish_plan(pal_result) pal_result end - [200, { status: 'running' }.to_json] end
(ORCH-<I>) Update plan executor to be thread safe This commit updates the ruby app.rb code to fix code meant to limit concurrent calls to the bolt PAL to a single thread. The call to "pal.get_plan_info" has been wrapped in a future so it will also use the SingleThreadExecutor and be forced to use one thread
puppetlabs_bolt
train
rb
47582f1136ad97443bbfb980a2017172dc185ee0
diff --git a/multiqc/modules/pbmarkdup/pbmarkdup.py b/multiqc/modules/pbmarkdup/pbmarkdup.py index <HASH>..<HASH> 100755 --- a/multiqc/modules/pbmarkdup/pbmarkdup.py +++ b/multiqc/modules/pbmarkdup/pbmarkdup.py @@ -35,8 +35,10 @@ class MultiqcModule(BaseMultiqcModule): self.pbmarkdup = dict() for logfile in self.find_log_files("pbmarkdup", filehandles=True): - self.pbmarkdup[logfile["s_name"]] = self.parse_logfile(logfile) - self.add_data_source(logfile) + data = self.parse_logfile(logfile) + if data: + self.pbmarkdup[logfile["s_name"]] = data + self.add_data_source(logfile) # Filter to strip out ignored sample names self.pbmarkdup = self.ignore_samples(self.pbmarkdup)
Only add entry for sample when data is returned
ewels_MultiQC
train
py
702d3a2eed412118651004d6c7c03739ac33dfd4
diff --git a/ignite/engine/events.py b/ignite/engine/events.py index <HASH>..<HASH> 100644 --- a/ignite/engine/events.py +++ b/ignite/engine/events.py @@ -344,7 +344,7 @@ class State: state.dataloader # data passed to engine state.epoch_length # optional length of an epoch state.max_epochs # number of epochs to run - state.max_iter # number of iterations to run + state.max_iters # number of iterations to run state.batch # batch passed to `process_function` state.output # output of `process_function` after a single iteration state.metrics # dictionary with defined metrics if any
Update events.py (#<I>)
pytorch_ignite
train
py
13f3100d077c6f097cbdbfd56e943686fa2d6b76
diff --git a/code/administrator/components/com_default/templates/helpers/paginator.php b/code/administrator/components/com_default/templates/helpers/paginator.php index <HASH>..<HASH> 100644 --- a/code/administrator/components/com_default/templates/helpers/paginator.php +++ b/code/administrator/components/com_default/templates/helpers/paginator.php @@ -50,13 +50,13 @@ class ComDefaultTemplateHelperPaginator extends KTemplateHelperPaginator // Get the paginator data $list = $paginator->getList(); - $html = '<del class="container">'; + $html = '<div class="container">'; $html = '<div class="pagination">'; $html .= '<div class="limit">'.JText::_('Display NUM').' '.$this->limit($config->toArray()).'</div>'; $html .= $this->_pages($list); $html .= '<div class="limit"> '.JText::_('Page').' '.$paginator->current.' '.JText::_('of').' '.$paginator->count.'</div>'; $html .= '</div>'; - $html .= '</del>'; + $html .= '</div>'; return $html; }
Changed <del> to <div>
joomlatools_joomlatools-framework
train
php
972b3101ef69fc2a035d552d28b2a97f60ad50fa
diff --git a/image-bundle/setup.py b/image-bundle/setup.py index <HASH>..<HASH> 100755 --- a/image-bundle/setup.py +++ b/image-bundle/setup.py @@ -41,7 +41,7 @@ setup( long_description=Read('README.md'), zip_safe=False, classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators',
Set setup.py development status to Stable for Image Bundle.
GoogleCloudPlatform_compute-image-packages
train
py
1762178e1614eeab8f3f0a7f9242f142d7c18e94
diff --git a/test/Clever/DistrictTest.php b/test/Clever/DistrictTest.php index <HASH>..<HASH> 100644 --- a/test/Clever/DistrictTest.php +++ b/test/Clever/DistrictTest.php @@ -20,11 +20,18 @@ class CleverDistrictTest extends UnitTestCase } } + public function testAllLimit() + { + authorizeFromEnv(); + $districts = CleverDistrict::all(array("limit"=>1)); + $this->assertEqual(count($districts),1); + } + public function testSecondLevel() { $districts = CleverDistrict::all(array('limit'=>1)); $district = $districts[0]; - $secondLevelTests = array('schools' => 'CleverSchool', + $secondLevelTests = array('schools' => 'CleverSchool', 'teachers' => 'CleverTeacher', 'students' => 'CleverStudent', 'sections' => 'CleverSection');
adds a CleverDistrict test for limits (for uniformity)
Clever_clever-php
train
php
a4607b97bfc2016e6feced5c04eb8259504b2efe
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -219,7 +219,7 @@ if (!PLATFORM.global.System || !PLATFORM.global.System.import) { }; DefaultLoader.prototype.map = function(id, source) { - System.map[id] = source; + System.config({ map: { [id]: source } }); }; DefaultLoader.prototype.normalizeSync = function(moduleId, relativeTo) {
fix(DefaultLoader): use config API for map This changes makes the loader compatible with SystemJS <I>-rc<I>
aurelia_loader-default
train
js
7157cdd5841063134bf6cdb02b8353631d10bb99
diff --git a/src/Rhumsaa/Uuid/Uuid.php b/src/Rhumsaa/Uuid/Uuid.php index <HASH>..<HASH> 100644 --- a/src/Rhumsaa/Uuid/Uuid.php +++ b/src/Rhumsaa/Uuid/Uuid.php @@ -1098,12 +1098,22 @@ final class Uuid */ protected static function getIfconfig() { - // If we're on Windows, use ipconfig; otherwise use ifconfig - if (strtoupper(substr(php_uname('a'), 0, 3)) == 'WIN') { - return `ipconfig /all 2>&1`; + $ifconfig = ''; + + switch (strtoupper(substr(php_uname('a'), 0, 3))) { + case 'WIN': + $ifconfig = `ipconfig /all 2>&1`; + break; + case 'DAR': + $ifconfig = `ifconfig 2>&1`; + break; + case 'LIN': + default: + $ifconfig = `netstat -ie 2>&1`; + break; } - return `ifconfig 2>&1`; + return $ifconfig; } /**
Using netstat for Linux, since ifconfig is not always in the path
ramsey_rhumsaa-uuid
train
php
0132b15279105d7bd35a080a7d427f0d848c7ad4
diff --git a/cf/cmd/cmd.go b/cf/cmd/cmd.go index <HASH>..<HASH> 100644 --- a/cf/cmd/cmd.go +++ b/cf/cmd/cmd.go @@ -98,6 +98,7 @@ func Main(traceEnv string, args []string) { if err != nil { usage := cmdRegistry.CommandUsage(cmdName) deps.UI.Failed(T("Incorrect Usage") + "\n\n" + err.Error() + "\n\n" + usage) + os.Exit(1) } cmd = cmd.SetDependency(deps, false)
cf push exits 1 immediately on flag parsing errors [finishes #<I>]
cloudfoundry_cli
train
go
d757a83c7422245e5c771f50acd3711115ccba0c
diff --git a/lxc/image_alias.go b/lxc/image_alias.go index <HASH>..<HASH> 100644 --- a/lxc/image_alias.go +++ b/lxc/image_alias.go @@ -218,13 +218,18 @@ func (c *cmdImageAliasList) Run(cmd *cobra.Command, args []string) error { continue } - data = append(data, []string{alias.Name, alias.Target[0:12], alias.Description}) + if alias.Type == "" { + alias.Type = "container" + } + + data = append(data, []string{alias.Name, alias.Target[0:12], strings.ToUpper(alias.Type), alias.Description}) } sort.Sort(stringList(data)) header := []string{ i18n.G("ALIAS"), i18n.G("FINGERPRINT"), + i18n.G("TYPE"), i18n.G("DESCRIPTION"), }
lxc/image: Show alias types
lxc_lxd
train
go
09a87a1908ac0607b76e2ee07525b828e0e78215
diff --git a/revapi/src/main/java/org/revapi/configuration/XmlToJson.java b/revapi/src/main/java/org/revapi/configuration/XmlToJson.java index <HASH>..<HASH> 100644 --- a/revapi/src/main/java/org/revapi/configuration/XmlToJson.java +++ b/revapi/src/main/java/org/revapi/configuration/XmlToJson.java @@ -224,6 +224,9 @@ public final class XmlToJson<Xml> { throw new IllegalArgumentException( "No schema found for items of a list. Cannot continue with XML-to-JSON conversion."); } + if (getValue.apply( configuration ) != null) { + throw new IllegalArgumentException("Array is not allowed to have a text node"); + } ModelNode list = new ModelNode(); list.setEmptyList(); for (Xml childConfig : getChildren.apply(configuration)) {
Don't allow arrays to have text nodes in XML to JSON converter
revapi_revapi
train
java
dc2e00a12327cc96c0478fc5a4368d2eb47cb7cd
diff --git a/packages/eslint-config-godaddy-react/index.js b/packages/eslint-config-godaddy-react/index.js index <HASH>..<HASH> 100644 --- a/packages/eslint-config-godaddy-react/index.js +++ b/packages/eslint-config-godaddy-react/index.js @@ -8,6 +8,7 @@ module.exports = { }, rules: { 'react/display-name': 0, + 'react/jsx-pascal-case': 2, 'react/jsx-uses-react': 1, 'react/prefer-es6-class': 2, //
[fix] Turn on "react/jsx-pascal-case" as an error. Fixes #<I>.
godaddy_javascript
train
js
ef89d4fb339dda33739f648b9fa99a50d40653e2
diff --git a/search_queries_terms_set.go b/search_queries_terms_set.go index <HASH>..<HASH> 100644 --- a/search_queries_terms_set.go +++ b/search_queries_terms_set.go @@ -25,7 +25,8 @@ type TermsSetQuery struct { // NewTermsSetQuery creates and initializes a new TermsSetQuery. func NewTermsSetQuery(name string, values ...interface{}) *TermsSetQuery { q := &TermsSetQuery{ - name: name, + name: name, + values: make([]interface{}, 0), } if len(values) > 0 { q.values = append(q.values, values...)
Initialize TermsSetQuery values If `values` is not initialized, and no values are provided, this attempts to send a `null` to ES instead of `[]`, resulting in an error. Matches existing functionality from `TermsQuery` and `IdsQuery`
olivere_elastic
train
go
9d80a765b99ac87a39799d9bf89d37cb1273eea8
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py index <HASH>..<HASH> 100644 --- a/OpenSSL/SSL.py +++ b/OpenSSL/SSL.py @@ -400,6 +400,10 @@ def SSLeay_version(type): def _requires_alpn(func): + """ + Wraps any function that requires ALPN support in OpenSSL, ensuring that + NotImplementedError is raised if ALPN support is not present. + """ @wraps(func) def wrapper(*args, **kwargs): if not _lib.Cryptography_HAS_ALPN:
ALPN required decorator docstring.
pyca_pyopenssl
train
py
899e7ab2f8b6d6bf6a16691f4ccb3906b8e8a019
diff --git a/lib/synapse/haproxy.rb b/lib/synapse/haproxy.rb index <HASH>..<HASH> 100644 --- a/lib/synapse/haproxy.rb +++ b/lib/synapse/haproxy.rb @@ -27,10 +27,8 @@ module Synapse # generates the global and defaults sections of the config file def generate_base_config - base_config = <<-EOC - # auto-generated by synapse at #{Time.now} - # this config needs haproxy-1.1.28 or haproxy-1.2.1 - EOC + base_config = "# auto-generated by synapse at #{Time.now}\n" + base_config << "# this config needs haproxy-1.1.28 or haproxy-1.2.1\n" %w{global defaults}.each do |section| base_config << "\n#{section}\n" @@ -56,7 +54,7 @@ module Synapse end watcher.backends.each do |backend| - stanza << "\tserver #{backend[:name]}:#{backend[:port]} #{watcher.server_options}\n" + stanza << "\tserver #{backend['name']} #{backend['host']}:#{backend['port']} #{watcher.server_options}\n" end return stanza
change bin opt to reload_command
airbnb_synapse
train
rb
309fbe568175699a1813d31d42e0ab363ebf07c2
diff --git a/backup/backup_version.php b/backup/backup_version.php index <HASH>..<HASH> 100644 --- a/backup/backup_version.php +++ b/backup/backup_version.php @@ -5,6 +5,6 @@ // database (backup_version) to determine whether upgrades should // be performed (see db/backup_*.php) -$backup_version = 2003070700; // The current version is a date (YYYYMMDDXX) +$backup_version = 2003071900; // The current version is a date (YYYYMMDDXX) -$backup_release = "0.8.2 alpha"; // User-friendly version number +$backup_release = "0.8.3 alpha"; // User-friendly version number
Numerical questions included in backup/restore. Up a bit.
moodle_moodle
train
php
d7476f7a37a0e3fa5e94a0a9fb87aaaf94cd6d33
diff --git a/pymc/diagnostics.py b/pymc/diagnostics.py index <HASH>..<HASH> 100644 --- a/pymc/diagnostics.py +++ b/pymc/diagnostics.py @@ -4,7 +4,6 @@ __all__ = ['geweke', 'gelman_rubin', 'raftery_lewis', 'validate'] import numpy as np -import scipy as sp import pymc from copy import copy import pdb @@ -93,8 +92,12 @@ def validate(sampler, replicates=20, iterations=10000, burn=5000, thin=1, determ stats : dict Return a dictionary containing tuples with the chi-square statistic and associated p-value for each data stochastic. + + Notes + ----- + This function requires SciPy. """ - + import scipy as sp # Set verbosity for models to zero sampler.verbose = 0
placed the scipy import into the function to avoid failing tests due to import errors.
pymc-devs_pymc
train
py
3d7238c26eee7f2b8a5e522ac15b460b68668796
diff --git a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/datamovement/functionaltests/QueryBatcherJobReportTest.java b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/datamovement/functionaltests/QueryBatcherJobReportTest.java index <HASH>..<HASH> 100644 --- a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/datamovement/functionaltests/QueryBatcherJobReportTest.java +++ b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/datamovement/functionaltests/QueryBatcherJobReportTest.java @@ -573,8 +573,9 @@ public class QueryBatcherJobReportTest extends BasicJavaClientREST { System.out.println("stopTransformJobTest: Success: " + successBatch.size()); System.out.println("stopTransformJobTest: Skipped: " + skippedBatch.size()); System.out.println("stopTransformJobTest : count " + count); - Assert.assertEquals(2000 - count.get(), successBatch.size()); - Assert.assertEquals(2000 - count.get(), successCount.get()); + + System.out.println("stopTransformJobTest : successCount.get() " + successCount.get()); + Assert.assertEquals(successCount.get(), successBatch.size()); } }
No Task - Test corrected to have asserts on count and batch size. Verify that these counts are available.
marklogic_java-client-api
train
java
4731cc3ab5bdde50e451506e3b5781142aeddbeb
diff --git a/test/__init__.py b/test/__init__.py index <HASH>..<HASH> 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -38,4 +38,4 @@ class Runner(DiscoverRunner): def suite_result(self, suite, result, **kwargs): write_results(result) - super(Runner, self).suite_result(suite, result, **kwargs) + return super(Runner, self).suite_result(suite, result, **kwargs)
test: fix detection of test failures in custom test runner That missing `return` was causing the test process to return 0 even when some tests failed.
Linaro_squad
train
py
6954e1a61bb0e2b7114bd3db16166bd77c0915ae
diff --git a/src/java/com/samskivert/util/ObjectUtil.java b/src/java/com/samskivert/util/ObjectUtil.java index <HASH>..<HASH> 100644 --- a/src/java/com/samskivert/util/ObjectUtil.java +++ b/src/java/com/samskivert/util/ObjectUtil.java @@ -56,7 +56,7 @@ public class ObjectUtil */ public static <T extends Comparable<? super T>> int compareTo (T left, T right) { - if (left == null && right == null) { + if (left == right) { // instances are both null or both the same instance return 0; } else if (left == null) { return -1;
Optimization suggested by Ray. git-svn-id: <URL>
samskivert_samskivert
train
java
cee22f75bf2f7ec4f9df8da487d39a1cd285a61e
diff --git a/AuthManager.php b/AuthManager.php index <HASH>..<HASH> 100755 --- a/AuthManager.php +++ b/AuthManager.php @@ -62,6 +62,8 @@ class AuthManager implements FactoryContract * * @param string $name * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard + * + * @throws \InvalidArgumentException */ protected function resolve($name) { diff --git a/Passwords/PasswordBrokerManager.php b/Passwords/PasswordBrokerManager.php index <HASH>..<HASH> 100644 --- a/Passwords/PasswordBrokerManager.php +++ b/Passwords/PasswordBrokerManager.php @@ -55,6 +55,8 @@ class PasswordBrokerManager implements FactoryContract * * @param string $name * @return \Illuminate\Contracts\Auth\PasswordBroker + * + * @throws \InvalidArgumentException */ protected function resolve($name) {
Add missing throws docblocks.
illuminate_auth
train
php,php
2e7980053dbbb3e32c34d5f42841351350c9a128
diff --git a/concrete/blocks/document_library/controller.php b/concrete/blocks/document_library/controller.php index <HASH>..<HASH> 100644 --- a/concrete/blocks/document_library/controller.php +++ b/concrete/blocks/document_library/controller.php @@ -548,6 +548,8 @@ class Controller extends BlockController $file = $file->getTreeNodeFileObject(); } elseif ($file instanceof FileFolder) { return $this->getFolderColumnValue($key, $file); + } else { + return false; } switch ($key) {
Fix document library block error when file node type is other than File or FileFolder
concrete5_concrete5
train
php
670b745147eb6cd7a07b6f8a29fa109c30fc3a2f
diff --git a/src/DatabaseTestHelper.php b/src/DatabaseTestHelper.php index <HASH>..<HASH> 100644 --- a/src/DatabaseTestHelper.php +++ b/src/DatabaseTestHelper.php @@ -52,7 +52,7 @@ trait DatabaseTestHelper return $this->seeders; } - return [$this->defaultSeeder]; + return [$this->getDefaultSeeder()]; } /**
Call the get default seeder method and not the defaultSeeder prop
erikgall_eloquent-phpunit
train
php
f53c1526b4e2fb0b2ac761b46afba53f1ef38e98
diff --git a/android/src/main/java/com/smixx/fabric/SMXCrashlytics.java b/android/src/main/java/com/smixx/fabric/SMXCrashlytics.java index <HASH>..<HASH> 100644 --- a/android/src/main/java/com/smixx/fabric/SMXCrashlytics.java +++ b/android/src/main/java/com/smixx/fabric/SMXCrashlytics.java @@ -91,7 +91,7 @@ public class SMXCrashlytics extends ReactContextBaseJavaModule { StackTraceElement stack = new StackTraceElement("", functionName, map.getString("fileName"), map.getInt("lineNumber")); stackTrace[i] = stack; } - Exception e = new Exception(); + Exception e = new Exception(name + "\n" + reason); e.setStackTrace(stackTrace); Crashlytics.logException(e); } @@ -118,4 +118,4 @@ public class SMXCrashlytics extends ReactContextBaseJavaModule { } return number; } -} \ No newline at end of file +}
add error name and reason to logException in recordCustomExceptionName
corymsmith_react-native-fabric
train
java
7a3a11817ecafbec83e4729fc16059dbdb792f85
diff --git a/stampit.js b/stampit.js index <HASH>..<HASH> 100644 --- a/stampit.js +++ b/stampit.js @@ -103,6 +103,7 @@ function compose(factories) { * @param {Object} [options.refs] A map of property names and values to be mixed into each new object. * @param {Object} [options.init] A closure (function) used to create private data and privileged methods. * @param {Object} [options.props] An object to be deeply cloned into each newly stamped object. + * @param {Object} [options.static] An object to be mixed into each `this` and derived stamps (not objects!). * @return {Function} factory A factory to produce objectss. * @return {Function} factory.create Just like calling the factory function. * @return {Object} factory.fixed An object map containing the stamp components. @@ -110,6 +111,7 @@ function compose(factories) { * @return {Function} factory.refs Add references to the stamp. Chainable. * @return {Function} factory.init Add a closure which called on object instantiation. Chainable. * @return {Function} factory.props Add deeply cloned properties to the produced objects. Chainable. + * @return {Function} factory.static Add properties to the stamp (not objects!). Chainable. * @return {Function} factory.compose Combine several stamps into single. Chainable. */ stampit = function stampit(options) {
Document (JSDoc) the static stuff of stampit and factories.
stampit-org_stampit
train
js
e5d10efa7691e04cc4b3283bbfb8b1a16fab83fb
diff --git a/flow/feature.py b/flow/feature.py index <HASH>..<HASH> 100644 --- a/flow/feature.py +++ b/flow/feature.py @@ -202,13 +202,14 @@ class JSONFeature(Feature): needs = None, store = False, key = None, + encoder = JSONEncoder, **extractor_args): super(JSONFeature,self).__init__(\ extractor, needs = needs, store = store, - encoder = JSONEncoder, + encoder = encoder, decoder = JSONDecoder(), key = key, **extractor_args)
JSONFeature now has a configurable encoder
JohnVinyard_featureflow
train
py
70907d18c919ea14400a85ab1eb03659dd38b665
diff --git a/tests/TestCase.php b/tests/TestCase.php index <HASH>..<HASH> 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -31,7 +31,9 @@ class TestCase extends BaseTestCase public function setUp() { parent::setUp(); - + + $adminConfig = require __DIR__.'/config/admin.php'; + $this->app['config']->set('database.default', 'mysql'); $this->app['config']->set('database.connections.mysql.host', env('MYSQL_HOST', 'localhost')); $this->app['config']->set('database.connections.mysql.database', 'laravel_admin');
Update TestCase.php
daimakuai_daimakuai
train
php
60a3d17ef6ff44ed67bc28c001744c75b038997b
diff --git a/morpfw/cli.py b/morpfw/cli.py index <HASH>..<HASH> 100644 --- a/morpfw/cli.py +++ b/morpfw/cli.py @@ -140,6 +140,15 @@ def shell(ctx): from morepath.authentication import Identity param = load(ctx.obj['app'], ctx.obj['settings']) app = create_app(param['app_cls'], param['settings']) + + while not isinstance(app, morepath.App): + wrapped = getattr(app, 'app', None) + if wrapped: + app = wrapped + else: + raise ValueError( + 'Unable to locate app object from middleware') + settings = param['settings'] server_url = settings.get('server', {}).get(
fix shell issue when using wsgi middleware
morpframework_morpfw
train
py
8437cd4fdf6109981055b9b5fec605462fdedc02
diff --git a/addon/services/tour.js b/addon/services/tour.js index <HASH>..<HASH> 100644 --- a/addon/services/tour.js +++ b/addon/services/tour.js @@ -366,12 +366,13 @@ export default Service.extend(Evented, { if (this.get('modal')) { currentElement.style.pointerEvents = 'none'; - $('.shepherd-modal').removeClass('shepherd-modal'); - $(currentElement).addClass('shepherd-modal'); - } - if (step.options.copyStyles) { - this.createHighlightOverlay(step); + if (step.options.copyStyles) { + this.createHighlightOverlay(step); + } else { + $('.shepherd-modal').removeClass('shepherd-modal'); + $(currentElement).addClass('shepherd-modal'); + } } } },
Only `createHighlightOverlay` in modal branch `createHighlightOverlay` is now exclusive with the `.shepherd-modal` class application, returning to the logical structure before the changes in b<I>dc<I>a<I>ac.
shipshapecode_ember-shepherd
train
js
742d1eeab3172f3256b79d8ba9e355481eaf463f
diff --git a/src/CCaptcha.php b/src/CCaptcha.php index <HASH>..<HASH> 100644 --- a/src/CCaptcha.php +++ b/src/CCaptcha.php @@ -16,6 +16,13 @@ class CCaptcha // ... const ARR_SUPPORTED_IMAGE_TYPE = [ IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG ]; + // + // captcha code will be checked as valid at least in 3 seconds before its created, + // and in 1800 seconds after its created + // + const DEFAULT_DELAY_MIN = 3; // min value of delay + const DEFAULT_DELAY_MAX = 1800; // max value of delay, 30 minutes = 30 * 60 seconds = 1800 + public function __construct( $sCryptSeed ) { @@ -140,7 +147,14 @@ class CCaptcha // // Check if the input code is a valid captcha // - public function Check( $sInputCode, $sEncryptedGen, $bCaseSensitive = false, $nMinDelay = 0, $nMaxDelay = 0 ) + public function Check + ( + $sInputCode, + $sEncryptedGen, + $bCaseSensitive = false, + $nMinDelay = self::DEFAULT_DELAY_MIN, + $nMaxDelay = self::DEFAULT_DELAY_MAX + ) { if ( ! CLib::IsExistingString( $sInputCode ) || ! CLib::IsExistingString( $sEncryptedGen ) ) {
Added DEFAULT_DELAY_MIN, DEFAULT_DELAY_MAX
dekuan_decaptcha
train
php
8586f976150bb534666e777a66ef750ed8dfa3ab
diff --git a/lib/discordrb/api.rb b/lib/discordrb/api.rb index <HASH>..<HASH> 100644 --- a/lib/discordrb/api.rb +++ b/lib/discordrb/api.rb @@ -8,6 +8,9 @@ module Discordrb::API # The base URL of the Discord REST API. APIBASE = 'https://discordapp.com/api'.freeze + # The base URL of the Discord image CDN + CDNBASE = 'https://cdn.discordapp.com'.freeze + module_function # @return [String] the bot name, previously specified using #bot_name=.
Create a constant for the Discord image CDN to be used for avatars and server icons
meew0_discordrb
train
rb
e6e3035bd8ee2db92b94da681604139d5ec0a503
diff --git a/IDBStore.js b/IDBStore.js index <HASH>..<HASH> 100644 --- a/IDBStore.js +++ b/IDBStore.js @@ -26,12 +26,26 @@ }; IDBStore = function(kwArgs, onStoreReady){ + function fixupConstants(object, constants) { + for (var prop in constants) { + if (!(prop in object)) + object[prop] = constants[prop]; + } + } + mixin(this, defaults); mixin(this, kwArgs); onStoreReady && (this.onStoreReady = onStoreReady); this.idb = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB; this.consts = window.IDBTransaction || window.webkitIDBTransaction; + fixupConstants(this.consts, {'READ_ONLY': 'readonly', + 'READ_WRITE': 'readwrite', + 'VERSION_CHANGE': 'versionchange'}); this.cursor = window.IDBCursor || window.webkitIDBCursor; + fixupConstants(this.cursor, {'NEXT': 'next', + 'NEXT_NO_DUPLICATE': 'nextunique', + 'PREV': 'prev', + 'PREV_NO_DUPLICATE': 'prevunique'}); this.openDB(); };
Add shim layer for deprecated constants that will eventually disappear.
jensarps_IDBWrapper
train
js
5480f5a020dfe416887abb52b74a1449ca2f9952
diff --git a/app/controllers/admin/welcome_controller.rb b/app/controllers/admin/welcome_controller.rb index <HASH>..<HASH> 100644 --- a/app/controllers/admin/welcome_controller.rb +++ b/app/controllers/admin/welcome_controller.rb @@ -24,7 +24,7 @@ class Admin::WelcomeController < ApplicationController def logout cookies[:session_token] = { :expires => 1.day.ago } - self.current_user.forget_me + self.current_user.forget_me if self.current_user self.current_user = nil announce_logged_out redirect_to login_url diff --git a/spec/controllers/admin/welcome_controller_spec.rb b/spec/controllers/admin/welcome_controller_spec.rb index <HASH>..<HASH> 100644 --- a/spec/controllers/admin/welcome_controller_spec.rb +++ b/spec/controllers/admin/welcome_controller_spec.rb @@ -86,4 +86,13 @@ describe Admin::WelcomeController do end end end + + describe "without a user" do + it "should gracefully handle logout" do + controller.stub!(:current_member).and_return(nil) + get :logout + response.should redirect_to(login_url) + end + end + end \ No newline at end of file
Don't raise exception on unauthenticated request to /admin/logout
radiant_radiant
train
rb,rb
048a2ab3cdfb5bd653addb64ed19125d9d583f12
diff --git a/src/main/java/org/jdbdt/Table.java b/src/main/java/org/jdbdt/Table.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jdbdt/Table.java +++ b/src/main/java/org/jdbdt/Table.java @@ -124,6 +124,14 @@ public class Table extends DataSource { checkIfNotBound(); connection = conn; compileQuery(); + if (columnNames == null) { + MetaData md = getMetaData(); + int nCols = md.getColumnCount(); + columnNames = new String[nCols]; + for (int i = 0; i < nCols; i++) { + columnNames[i] = md.getLabel(i); + } + } return this; }
Table: fixed issue in boundTo()
JDBDT_jdbdt
train
java
4482549b7e5fca430d2674a1bcac8780b8d6cbd6
diff --git a/apps/full-site-editing/full-site-editing-plugin/block-patterns/class-block-patterns.php b/apps/full-site-editing/full-site-editing-plugin/block-patterns/class-block-patterns.php index <HASH>..<HASH> 100644 --- a/apps/full-site-editing/full-site-editing-plugin/block-patterns/class-block-patterns.php +++ b/apps/full-site-editing/full-site-editing-plugin/block-patterns/class-block-patterns.php @@ -56,7 +56,9 @@ class Block_Patterns { // The 'Two Columns of Text' pattern is in the 'columns' and 'text' categories. // Removing 'columns' so it doesn't appear as a category with only a single item. - unregister_block_pattern_category( 'columns' ); + if ( \WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( 'columns' ) ) { + unregister_block_pattern_category( 'columns' ); + } } if ( class_exists( 'WP_Block_Patterns_Registry' ) ) {
Block patterns: call unregister on the columns category if it is currently set (#<I>)
Automattic_wp-calypso
train
php
e5e7c19e8808c8ff77250dfa4844240f7c4b5c27
diff --git a/sling.go b/sling.go index <HASH>..<HASH> 100644 --- a/sling.go +++ b/sling.go @@ -351,7 +351,14 @@ func (s *Sling) Do(req *http.Request, successV, failureV interface{}) (*http.Res } // when err is nil, resp contains a non-nil resp.Body which must be closed defer resp.Body.Close() - if successV != nil || failureV != nil { + + // Don't try to decode on 204s + if resp.StatusCode == 204 { + return resp, nil + } + + // Decode from json + if successV != nil || failureV != nil) { err = decodeResponseJSON(resp, successV, failureV) } return resp, err
Don't try to decode on <I>s (no content)
dghubble_sling
train
go
9de339e284a2770a0f92141b5602a605ec238f3b
diff --git a/app/models/effective/order_item.rb b/app/models/effective/order_item.rb index <HASH>..<HASH> 100644 --- a/app/models/effective/order_item.rb +++ b/app/models/effective/order_item.rb @@ -16,7 +16,7 @@ module Effective timestamps end - validates_associated :purchasable + # validates_associated :purchasable validates_presence_of :purchasable accepts_nested_attributes_for :purchasable, :allow_destroy => false, :reject_if => :all_blank, :update_only => true
commented out the :purchasable in order_item.rb
code-and-effect_effective_orders
train
rb
d22c00e6032176b3212520b6d83602fc41f3af2a
diff --git a/src/main/com/mongodb/Mongo.java b/src/main/com/mongodb/Mongo.java index <HASH>..<HASH> 100644 --- a/src/main/com/mongodb/Mongo.java +++ b/src/main/com/mongodb/Mongo.java @@ -264,6 +264,7 @@ public class Mongo { _options = options; _applyMongoOptions(); _connector = new DBTCPConnector( this , _addrs ); + _connector.start(); _cleaner = new DBCleanerThread(); _cleaner.start();
JAVA-<I>: Connector does not get started in one of the constructor, so replica set thread is not activated
mongodb_mongo-java-driver
train
java
36886ba9dbfd78bc85f5455a236e148b20519c88
diff --git a/lib/sandstorm/records/instance_methods.rb b/lib/sandstorm/records/instance_methods.rb index <HASH>..<HASH> 100644 --- a/lib/sandstorm/records/instance_methods.rb +++ b/lib/sandstorm/records/instance_methods.rb @@ -76,7 +76,7 @@ module Sandstorm end def save - return unless self.changed? + return unless @is_new || self.changed? return false unless valid? run_callbacks( (self.persisted? ? :update : :create) ) do
save unchanged record if new (no id)
flapjack_zermelo
train
rb
f89e3134291f3eabf67265b4683b56777c160f27
diff --git a/lib/resque_unit.rb b/lib/resque_unit.rb index <HASH>..<HASH> 100644 --- a/lib/resque_unit.rb +++ b/lib/resque_unit.rb @@ -7,12 +7,12 @@ rescue LoadError require 'json' end -require 'test/unit' +require 'test/unit/testcase' require 'resque_unit/helpers' require 'resque_unit/resque' require 'resque_unit/errors' require 'resque_unit/assertions' -require 'resque_unit/plugin' +require 'resque_unit/plugin' Test::Unit::TestCase.send(:include, ResqueUnit::Assertions)
don't require test/unit to avoid the at_exit hook test/unit.rb registers an at_exit hook that causing problems because rake doesn't remove processed args from ARGV: <URL>
justinweiss_resque_unit
train
rb
f6892877c15267f591acb2fbd28f3a88dbf594f7
diff --git a/application/Espo/Core/Upgrades/Actions/Extension/Install.php b/application/Espo/Core/Upgrades/Actions/Extension/Install.php index <HASH>..<HASH> 100644 --- a/application/Espo/Core/Upgrades/Actions/Extension/Install.php +++ b/application/Espo/Core/Upgrades/Actions/Extension/Install.php @@ -160,7 +160,7 @@ class Install extends \Espo\Core\Upgrades\Actions\Base\Install $extensionEntity = $this->getExtensionEntity(); if (isset($extensionEntity)) { - $comparedVersion = version_compare($manifest['version'], $extensionEntity->get('version')); + $comparedVersion = version_compare($manifest['version'], $extensionEntity->get('version'), '>='); if ($comparedVersion <= 0) { $this->throwErrorAndRemovePackage('You cannot install an older version of this extension.'); }
Extension can be installed with the same version
espocrm_espocrm
train
php
26750f5d710dd40fb6ce0a8367d870649973171b
diff --git a/tinycontent/templatetags/tinycontent_tags.py b/tinycontent/templatetags/tinycontent_tags.py index <HASH>..<HASH> 100644 --- a/tinycontent/templatetags/tinycontent_tags.py +++ b/tinycontent/templatetags/tinycontent_tags.py @@ -16,7 +16,7 @@ class TinyContentNode(template.Node): try: return context[self.content_name] except KeyError: - return '' + raise TinyContent.DoesNotExist if self.content_name[0] == '"' and self.content_name[-1] == '"': return self.content_name[1:-1]
Fail faster if the context variable does not exist We're always going to fail if this happens - let's just avoid doing a database query.
dominicrodger_django-tinycontent
train
py
5bad2012446ce1b0c9d4932ead69685db6d1eafc
diff --git a/src/Logger/Handler/SystemHandler.php b/src/Logger/Handler/SystemHandler.php index <HASH>..<HASH> 100644 --- a/src/Logger/Handler/SystemHandler.php +++ b/src/Logger/Handler/SystemHandler.php @@ -73,8 +73,8 @@ class SystemHandler extends AbstractProcessingHandler [ 'file' => $e->getFile(), 'line' => $e->getLine(), - 'class' => $trace['class'], - 'function' => $trace['function'], + 'class' => isset($trace['class']) ? $trace['class'] : '', + 'function' => isset($trace['function']) ? $trace['function'] : '', 'message' => $e->getMessage() ] );
Don't access array keys if they don't exist
bolt_bolt
train
php
5689b2f1f4ad6045e741b8d25e65707d1ecfb8d3
diff --git a/bika/lims/jsonapi/update.py b/bika/lims/jsonapi/update.py index <HASH>..<HASH> 100644 --- a/bika/lims/jsonapi/update.py +++ b/bika/lims/jsonapi/update.py @@ -104,7 +104,10 @@ class Update(object): self.used("obj_path") site_path = request['PATH_INFO'].replace("/@@API/update", "") - obj = context.restrictedTraverse(str(site_path + obj_path)) + # HACK to prevent traverse failing due to proxies + path = str(site_path + obj_path) + path = path.replace('VirtualHost/', '') + obj = context.restrictedTraverse(path) try: fields = set_fields_from_request(obj, request)
Fix JSON update due to virtual host
senaite_senaite.core
train
py
665f0a5182a98c806b3d8b5bce5014b74b2fdc98
diff --git a/integration-tests/test_s3.py b/integration-tests/test_s3.py index <HASH>..<HASH> 100644 --- a/integration-tests/test_s3.py +++ b/integration-tests/test_s3.py @@ -15,8 +15,8 @@ def initialize_bucket(): subprocess.check_call(['aws', 's3', 'rm', '--recursive', _S3_URL]) -def write_read(key, content, write_mode, read_mode, encoding=None, **kwargs): - with smart_open.smart_open(key, write_mode, encoding=encoding, **kwargs) as fout: +def write_read(key, content, write_mode, read_mode, encoding=None, s3_upload=None, **kwargs): + with smart_open.smart_open(key, write_mode, encoding=encoding, s3_upload=s3_upload, **kwargs) as fout: fout.write(content) with smart_open.smart_open(key, read_mode, encoding=encoding, **kwargs) as fin: actual = fin.read()
attempt to fix integration test from @eschwartz
RaRe-Technologies_smart_open
train
py
0de6baf2bd6a41bfacf0be532b954e23305fb6b4
diff --git a/python_modules/dagster-graphql/dagster_graphql_tests/graphql/execution_queries.py b/python_modules/dagster-graphql/dagster_graphql_tests/graphql/execution_queries.py index <HASH>..<HASH> 100644 --- a/python_modules/dagster-graphql/dagster_graphql_tests/graphql/execution_queries.py +++ b/python_modules/dagster-graphql/dagster_graphql_tests/graphql/execution_queries.py @@ -224,6 +224,11 @@ START_PIPELINE_EXECUTION_FOR_CREATED_RUN_RESULT_FRAGMENT = ''' } ... on PythonError { message + stack + cause { + message + stack + } } ... on PipelineRunNotFoundError { message
Improve debuggability Summary: Return more error information from queries. Test Plan: Unit Reviewers: alangenfeld, prha, nate, yuhan, schrockn Reviewed By: prha Differential Revision: <URL>
dagster-io_dagster
train
py
fd5ee2a9ea987a8a604bb77c07ba56e27c00744f
diff --git a/cmd/hyperkube/kube-proxy.go b/cmd/hyperkube/kube-proxy.go index <HASH>..<HASH> 100644 --- a/cmd/hyperkube/kube-proxy.go +++ b/cmd/hyperkube/kube-proxy.go @@ -19,9 +19,6 @@ limitations under the License. package main import ( - "fmt" - "os" - kubeproxy "k8s.io/kubernetes/cmd/kube-proxy/app" ) @@ -39,13 +36,13 @@ func NewKubeProxy() *Server { } config.AddFlags(hks.Flags()) - s, err := kubeproxy.NewProxyServerDefault(config) - if err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) - os.Exit(1) - } hks.Run = func(_ *Server, args []string) error { + s, err := kubeproxy.NewProxyServerDefault(config) + if err != nil { + return err + } + return s.Run(args) }
Fix broken hypercube due to too early proxy intitialization This was introduced in 1c<I>c2cd<I>d<I>d<I>e3dc<I>aff7db.
kubernetes_kubernetes
train
go
63e2726469d27886cb3a828a677af129e27236f7
diff --git a/plugins/CoreHome/angularjs/common/services/periods.js b/plugins/CoreHome/angularjs/common/services/periods.js index <HASH>..<HASH> 100644 --- a/plugins/CoreHome/angularjs/common/services/periods.js +++ b/plugins/CoreHome/angularjs/common/services/periods.js @@ -348,7 +348,8 @@ // apply piwik site timezone (if it exists) date.setHours((piwik.timezoneOffset || 0) / 3600); - // get rid of minutes/seconds/etc. + // get rid of hours/minutes/seconds/etc. + date.setHours(0); date.setMinutes(0); date.setSeconds(0); date.setMilliseconds(0);
Always set hours to 0 for periods.getToday (#<I>)
matomo-org_matomo
train
js
340eb96a6fb3e248c147533fe42e5ee5a154aa8d
diff --git a/source/interface/createStream.js b/source/interface/createStream.js index <HASH>..<HASH> 100644 --- a/source/interface/createStream.js +++ b/source/interface/createStream.js @@ -29,7 +29,8 @@ function createWriteStream(filePath, options, callback = NOOP) { url: joinURL(options.remoteURL, encodePath(filePath)), method: "PUT", headers, - data: writeStream + data: writeStream, + maxRedirects: 0 }; prepareRequestOptions(requestOptions, options); request(requestOptions)
Fix unnecessary excessive memory usage when uploading big files When uploading a file the complete contents of the file is loaded in memory just in case the request ends up with a redirect response and the request has to be resent. see <URL>
perry-mitchell_webdav-client
train
js
77fbc2e589875a0fc26a976710b4676c51901f61
diff --git a/generators/generator-constants.js b/generators/generator-constants.js index <HASH>..<HASH> 100644 --- a/generators/generator-constants.js +++ b/generators/generator-constants.js @@ -40,7 +40,7 @@ const JHIPSTER_DEPENDENCIES_VERSION = '7.8.1'; const SPRING_BOOT_VERSION = '2.6.7'; const LIQUIBASE_VERSION = '4.6.1'; const LIQUIBASE_DTD_VERSION = LIQUIBASE_VERSION.split('.', 3).slice(0, 2).join('.'); -const HIBERNATE_VERSION = '5.6.7.Final'; +const HIBERNATE_VERSION = '5.6.8.Final'; const JACOCO_VERSION = '0.8.7'; const KAFKA_VERSION = '5.5.7';
Update hibernate version to <I>.Final
jhipster_generator-jhipster
train
js
4e47683c6cee10b638732e93f73272b73eeed274
diff --git a/src/core/registry.js b/src/core/registry.js index <HASH>..<HASH> 100644 --- a/src/core/registry.js +++ b/src/core/registry.js @@ -1,9 +1,21 @@ "use strict"; +/** + * @constructor + * + * Reference: + * https://github.com/gulpjs/undertaker-registry/blob/master/index.js + * + */ function Registry() { - this._tasks = []; + this._tasks = {}; } +Registry.prototype.init = function (gulp) { + // NOTE: gulp 4.0 task are called on undefined context. So we need gulp reference here. + this.gulp = gulp; +}; + Registry.prototype.get = function (name) { return this._tasks[name]; }; @@ -12,13 +24,13 @@ Registry.prototype.set = function (name, task) { return (this._tasks[name] = task); }; -Registry.prototype.init = function (gulp) { - // NOTE: gulp 4.0 task are called on undefined context. So we need gulp reference here. - this.gulp = gulp; -}; - Registry.prototype.tasks = function () { - return this._tasks; + var self = this; + + return Object.keys(this._tasks).reduce(function(tasks, name) { + tasks[name] = self.get(name); + return tasks; + }, {}); }; module.exports = Registry;
rewrite registry referring undertaker-registry
gulp-cookery_gulp-chef
train
js
93f73231311de7058761ca9f0c6d0124cc890604
diff --git a/snakebacon/records.py b/snakebacon/records.py index <HASH>..<HASH> 100644 --- a/snakebacon/records.py +++ b/snakebacon/records.py @@ -19,7 +19,7 @@ def read_14c(fl): c14age=indata['c14age'], error=indata['error'], delta14c=indata['delta14c'], - sigma='sigma') + sigma=indata['sigma']) return outcurve
Corrected bad sigma refernce in read_<I>c.
brews_snakebacon
train
py
548e209e086f7d00e3e1419532104a19a8ac0c60
diff --git a/test/start-simple-container-test.js b/test/start-simple-container-test.js index <HASH>..<HASH> 100644 --- a/test/start-simple-container-test.js +++ b/test/start-simple-container-test.js @@ -1,5 +1,6 @@ var commands = require('../lib/commands'), - expect = require('chai').expect + expect = require('chai').expect, + exec = require('child_process').exec describe('starting a simple container', function() { var container = { @@ -26,6 +27,16 @@ describe('starting a simple container', function() { it('executes the given command', function() { expect(stdout).to.eql('Hello, world!\n') }) + + it('removes the container afterwards (uses --rm)', function(done) { + exec('docker inspect test-container', function(err) { + if (err) { + done() + } else { + throw new Error('test-container was not removed from docker') + } + }) + }) }) function captureStdout(onData, block) {
Test that non-daemon containers get removed after they finish executing
mnylen_pig
train
js
c42ad4ea435c501f158fbdf97e38814f99820eeb
diff --git a/sample/Archiving/src/main/java/com/example/ArchivingServer.java b/sample/Archiving/src/main/java/com/example/ArchivingServer.java index <HASH>..<HASH> 100644 --- a/sample/Archiving/src/main/java/com/example/ArchivingServer.java +++ b/sample/Archiving/src/main/java/com/example/ArchivingServer.java @@ -2,10 +2,7 @@ package com.example; import static spark.Spark.*; -import com.opentok.OpenTok; -import com.opentok.Role; -import com.opentok.TokenOptions; -import com.opentok.Archive; +import com.opentok.*; import spark.*; import java.util.Map; @@ -30,7 +27,10 @@ public class ArchivingServer { opentok = new OpenTok(Integer.parseInt(apiKey), apiSecret); - sessionId = opentok.createSession().getSessionId(); + sessionId = opentok.createSession(new SessionProperties.Builder() + .mediaMode(MediaMode.ROUTED) + .build()) + .getSessionId(); externalStaticFileLocation("./public");
adjusts archiving sample for mediaMode change
opentok_Opentok-Java-SDK
train
java
d8d0eed0cb1fbfccb2b983b6710c8689bc0532da
diff --git a/Classes/Core/Functional/Framework/DataHandling/ActionService.php b/Classes/Core/Functional/Framework/DataHandling/ActionService.php index <HASH>..<HASH> 100644 --- a/Classes/Core/Functional/Framework/DataHandling/ActionService.php +++ b/Classes/Core/Functional/Framework/DataHandling/ActionService.php @@ -421,6 +421,18 @@ class ActionService } /** + * @param array $dataMap + * @param array $commandMap + */ + public function invoke(array $dataMap, array $commandMap) + { + $this->createDataHandler(); + $this->dataHandler->start($dataMap, $commandMap); + $this->dataHandler->process_datamap(); + $this->dataHandler->process_cmdmap(); + } + + /** * @param array $recordData * @param NULL|string|int $previousUid * @return array
[TASK] Add direct DataHandler invocation to ActionService Resolves: #<I> Releases: master, <I>
TYPO3_testing-framework
train
php
5e322171572f57fbe45fc4b526b8000128f478db
diff --git a/src/Offline/Settings/SettingsServiceProvider.php b/src/Offline/Settings/SettingsServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Offline/Settings/SettingsServiceProvider.php +++ b/src/Offline/Settings/SettingsServiceProvider.php @@ -19,15 +19,12 @@ class SettingsServiceProvider extends ServiceProvider */ public function boot() { - $this->mergeConfigFrom( - __DIR__ . '/../../config/config.php', 'settings' - ); $this->publishes([ - __DIR__ . '/../../config/config.php', config_path('settings.php') - ], 'config'); + __DIR__ . '/../../config/config.php' => config_path('settings.php') + ]); $this->publishes([ __DIR__ . '/../../migrations/' => base_path('/database/migrations') - ], 'migrations'); + ]); } /** @@ -37,6 +34,9 @@ class SettingsServiceProvider extends ServiceProvider */ public function register() { + $this->mergeConfigFrom( + __DIR__ . '/../../config/config.php', 'settings' + ); $this->app['settings'] = $this->app->share(function ($app) { $config = $app->config->get('settings', [
Fixed publishing and merging of config file
OFFLINE-GmbH_persistent-settings
train
php
3dabe2c3af64751b246a50d369aabb0913f5c775
diff --git a/html5lib/tests/test_treewalkers.py b/html5lib/tests/test_treewalkers.py index <HASH>..<HASH> 100644 --- a/html5lib/tests/test_treewalkers.py +++ b/html5lib/tests/test_treewalkers.py @@ -4,6 +4,7 @@ import os import sys import unittest import warnings +from difflib import unified_diff try: unittest.TestCase.assertEqual @@ -280,10 +281,14 @@ def runTreewalkerTest(innerHTML, input, expected, errors, treeClass): output = convertTokens(treeClass["walker"](document)) output = attrlist.sub(sortattrs, output) expected = attrlist.sub(sortattrs, convertExpected(expected)) + diff = "".join(unified_diff([line + "\n" for line in expected.splitlines()], + [line + "\n" for line in output.splitlines()], + "Expected", "Received")) assert expected == output, "\n".join([ "", "Input:", input, "", "Expected:", expected, - "", "Received:", output + "", "Received:", output, + "", "Diff:", diff, ]) except NotImplementedError: pass # Amnesty for those that confess...
Add diff to error messages from treewalker tests. I've spent too long straining to see subtle difference. This helps.
html5lib_html5lib-python
train
py
3311a4cbc638f4e35dc11c4d03f00d884090d02f
diff --git a/test/remote/gateways/remote_beanstream_test.rb b/test/remote/gateways/remote_beanstream_test.rb index <HASH>..<HASH> 100644 --- a/test/remote/gateways/remote_beanstream_test.rb +++ b/test/remote/gateways/remote_beanstream_test.rb @@ -17,7 +17,7 @@ class RemoteBeanstreamTest < Test::Unit::TestCase @mastercard = credit_card('5100000010001004') @declined_mastercard = credit_card('5100000020002000') - @amex = credit_card('371100001000131') + @amex = credit_card('371100001000131', {:verification_value => 1234}) @declined_amex = credit_card('342400001000180') # Canadian EFT
Fix incorrect test card numbers for beanstream amex.
activemerchant_active_merchant
train
rb
32f2a856f5225a480085bb283a49192b26173e4f
diff --git a/cbamf/comp/objs.py b/cbamf/comp/objs.py index <HASH>..<HASH> 100644 --- a/cbamf/comp/objs.py +++ b/cbamf/comp/objs.py @@ -21,7 +21,7 @@ def sphere_triangle_cdf(r, r0, alpha): p1 = 1*(r>r0)-(r0+alpha-r)**2/(2*alpha**2)*(r0<r)*(r<r0+alpha) return (1-np.clip(p0+p1, 0, 1)) -def sphere_analytical_gaussian_exact(r, r0, alpha=0.2765): +def sphere_analytical_gaussian(r, r0, alpha=0.2765): """ Analytically calculate the sphere's functional form by convolving the Heavyside function with first order approximation to the sinc, a Gaussian. @@ -189,7 +189,7 @@ class SphereCollectionRealSpace(object): 'lerp': sphere_lerp, 'logistic': sphere_logistic, 'triangle': sphere_triangle_cdf, - 'exact-gaussian': sphere_analytical_gaussian_exact, + 'exact-gaussian': sphere_analytical_gaussian, 'exact-gaussian-trim': sphere_analytical_gaussian_trim, 'exact-gaussian-fast': sphere_analytical_gaussian_fast, 'constrained-cubic': sphere_constrained_cubic
changing name of analytical gaussian exact for compatibility
peri-source_peri
train
py
833c7929d39c65506b43879405099fba55b966ed
diff --git a/lib/conceptql/scope.rb b/lib/conceptql/scope.rb index <HASH>..<HASH> 100644 --- a/lib/conceptql/scope.rb +++ b/lib/conceptql/scope.rb @@ -138,8 +138,10 @@ module ConceptQL # columns to still work, send the columns request to the # underlying operator. op = fetch_operator(label) - (class << ds; self; end).send(:define_method, :columns) do - (@main_op ||= op.evaluate(db)).columns + ds = ds.with_extend do + define_method(:columns) do + (@main_op ||= op.evaluate(db)).columns + end end end
Make CONCEPTQL_CHECK_COLUMNS work on Sequel 5 In Sequel 5, datasets are frozen, so you can't modify the singleton class of a dataset. You can use with_extend instead, which returns a modified copy. The with_extend block is passed is to Module.new, and the resulting module extends the copy of the dataset.
outcomesinsights_conceptql
train
rb
fe5cd199e1b807b6ac4ede365d537878299b3f45
diff --git a/test/associated-model.js b/test/associated-model.js index <HASH>..<HASH> 100644 --- a/test/associated-model.js +++ b/test/associated-model.js @@ -1810,6 +1810,33 @@ $(document).ready(function () { equal(foo._events.all.length, 1); }); + test('Issue #117', 4, function() { + var Foo = Backbone.AssociatedModel.extend({}); + + var Bar = Backbone.AssociatedModel.extend({ + relations: [ + { + type: Backbone.One, + key: 'rel', + relatedModel: Foo + } + ], + }); + + var foo = new Foo; + + var bar1 = new Bar({rel: foo}); + var bar2 = new Bar({rel: foo}); + + equal(foo.parents.length, 2); + equal(foo._events.all.length, 2); + + bar2.cleanup(); + + equal(foo.parents.length, 1); + equal(foo._events.all.length, 1); + }); + test("transform from store", 16, function () { emp.set('works_for', 99); ok(emp.get('works_for').get('name') == "sales", "Mapped id to dept instance");
test case ( Issue #<I> )
dhruvaray_backbone-associations
train
js
2bc133186d1255146eb1877702b258a856d39fa9
diff --git a/zappa/wsgi.py b/zappa/wsgi.py index <HASH>..<HASH> 100644 --- a/zappa/wsgi.py +++ b/zappa/wsgi.py @@ -81,8 +81,15 @@ def create_wsgi_request(event_info, server_name='zappa', script_name=None, # Multipart forms are Base64 encoded through API Gateway if 'multipart/form-data;' in event_info["headers"]['Content-Type']: + + # Unfortunately, this only works for text data, + # not binary data. Yet. + # See: + # https://github.com/Miserlou/Zappa/issues/80 + # https://forums.aws.amazon.com/thread.jspa?threadID=231371&tstart=0 body = base64.b64decode(body) + environ['wsgi.input'] = StringIO(body) environ['CONTENT_LENGTH'] = str(len(body))
add explanatory comment related to issue <I>
Miserlou_Zappa
train
py
50b97abc768e1d1d95b5179009f6665600dd7a56
diff --git a/modules/@apostrophecms/schema/index.js b/modules/@apostrophecms/schema/index.js index <HASH>..<HASH> 100644 --- a/modules/@apostrophecms/schema/index.js +++ b/modules/@apostrophecms/schema/index.js @@ -1722,6 +1722,7 @@ module.exports = { } // Allow options to the getter to be specified in the schema, // notably editable: true + await self.fieldTypes[_relationship.type].relate(req, _relationship, _objects, options); _.each(_objects, function (object) { if (object[subname]) { diff --git a/modules/@apostrophecms/user/index.js b/modules/@apostrophecms/user/index.js index <HASH>..<HASH> 100644 --- a/modules/@apostrophecms/user/index.js +++ b/modules/@apostrophecms/user/index.js @@ -119,7 +119,8 @@ module.exports = { _groups: { type: 'relationship', label: 'Groups', - withType: '@apostrophecms/group' + idsStorage: 'groupIds', + withType: '@apostrophecms/group', } } )
fix storage of group ids so apostrophe works without hardcoded groups
apostrophecms_apostrophe
train
js,js
a7fb8b7674414438db00f9fef20656b2cec3d361
diff --git a/resources/lang/pt-BR/cachet.php b/resources/lang/pt-BR/cachet.php index <HASH>..<HASH> 100644 --- a/resources/lang/pt-BR/cachet.php +++ b/resources/lang/pt-BR/cachet.php @@ -117,9 +117,18 @@ return [ ], ], + // Meta descriptions + 'meta' => [ + 'description' => [ + 'incident' => 'Details and updates about the :name incident that occurred on :date', + 'schedule' => 'Details about the scheduled maintenance period :name starting :startDate', + 'subscribe' => 'Subscribe to :app in order to receive updates of incidents and scheduled maintenance periods', + 'overview' => 'Mantenha-se atualizado com as últimas atualizações de serviço de: app.', + ], + ], + // Other 'home' => 'Início', - 'description' => 'Mantenha-se atualizado com as últimas atualizações de serviço de: app.', 'powered_by' => 'Desenvolvido por <a href="https://cachethq.io" class="links">Cachet</a>.', 'timezone' => 'Horários são exibidos em :timezone.', 'about_this_site' => 'Sobre este Site',
New translations cachet.php (Portuguese, Brazilian)
CachetHQ_Cachet
train
php
a2f84c54d46804ebb6b6565228769b406e3bef93
diff --git a/py3status/modules/transmission.py b/py3status/modules/transmission.py index <HASH>..<HASH> 100644 --- a/py3status/modules/transmission.py +++ b/py3status/modules/transmission.py @@ -161,11 +161,11 @@ class Py3status: thresholds = [] def post_config_hook(self): - self.command = 'transmission-remote' + self.command = 'transmission-remote --list' if not self.py3.check_commands(self.command): raise Exception(STRING_NOT_INSTALLED) if self.arguments: - self.command = '%s %s %s' % (self.command, self.arguments, '--list') + self.command = '%s %s' % (self.command, self.arguments) self.init_summary = self.py3.format_contains( self.format, ['up', 'down', 'have']) self.id = 0
transmission: use --list when no aditional arguments are given (#<I>)
ultrabug_py3status
train
py
a9904b01099420db90d4c2a069aa87283a56a201
diff --git a/src/controllers/authenticate.js b/src/controllers/authenticate.js index <HASH>..<HASH> 100644 --- a/src/controllers/authenticate.js +++ b/src/controllers/authenticate.js @@ -4,7 +4,14 @@ import { sign as jwtSignCallback } from 'jsonwebtoken'; import crypto from 'crypto'; import debug from 'debug'; -import { APIError, NotFoundError, PasswordError, TokenError } from '../errors'; +import { + APIError, + NotFoundError, + PasswordError, + PermissionError, + TokenError +} from '../errors'; +import { isBanned as isUserBanned } from './bans'; const PASS_LENGTH = 256; const PASS_ITERATIONS = 2048; @@ -88,6 +95,10 @@ export async function login(uw, email, password, options) { throw new PasswordError('password is incorrect'); } + if (await isUserBanned(uw, auth.user)) { + throw new PermissionError('You have been banned'); + } + const token = await jwtSign( { id: auth.user.id, role: auth.user.role }, options.secret,
auth: prevent banned users from logging in
u-wave_http-api
train
js
c69c33d2347c25a7f181879206f21952edf4d048
diff --git a/src/main/com/mongodb/ByteDecoder.java b/src/main/com/mongodb/ByteDecoder.java index <HASH>..<HASH> 100644 --- a/src/main/com/mongodb/ByteDecoder.java +++ b/src/main/com/mongodb/ByteDecoder.java @@ -302,7 +302,12 @@ public class ByteDecoder extends Bytes { break; _namebuf[pos++] = b; } - return new String( _namebuf , 0 , pos ); + try { + return new String( _namebuf , 0 , pos , "UTF-8" ); + } + catch ( java.io.UnsupportedEncodingException use ){ + throw new MongoInternalException( "impossible" ); + } } int getInt(){
allow utf-8 for field names
mongodb_mongo-java-driver
train
java
d5f4fa41d67724ec4ae169a8bd4f20bdbbce1817
diff --git a/src/main/java/com/hubspot/jinjava/interpret/Context.java b/src/main/java/com/hubspot/jinjava/interpret/Context.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/hubspot/jinjava/interpret/Context.java +++ b/src/main/java/com/hubspot/jinjava/interpret/Context.java @@ -174,6 +174,9 @@ public class Context extends ScopeMap<String, Object> { public void addResolvedExpression(String expression) { resolvedExpressions.add(expression); + if (getParent() != null) { + getParent().addResolvedExpression(expression); + } } public Set<String> getResolvedExpressions() {
Recursively apply resolved expressions to parents
HubSpot_jinjava
train
java
5c7c5148774da78e9e43360ecec68bee3fd65be4
diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index <HASH>..<HASH> 100755 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -59,7 +59,7 @@ class BackendController extends ActionController * * @param ViewInterface $view */ - protected function initializeView(ViewInterface $view): void + protected function initializeView($view): void { // Hand over flash message queue to module template $moduleTemplate = $this->moduleTemplateFactory->create($this->request);
[BUGFIX] Avoid contravariance issue in initializeView() Deprecated extbase ActionController->initializeView($view) type hints deprecated extbase ViewInterface. To stay compatible with <I> and <I>, the type hint in inheriting BackendController->initializeView() is removed to avoid a PHP contravariance issue.
TYPO3_styleguide
train
php
9e6fb3eca0cc855358d1f9c3180aff838e2246c2
diff --git a/test/client/docs_test.rb b/test/client/docs_test.rb index <HASH>..<HASH> 100644 --- a/test/client/docs_test.rb +++ b/test/client/docs_test.rb @@ -404,6 +404,8 @@ describe Elastomer::Client::Docs do end it 'provides access to term vector statistics' do + next unless es_version_1_x? + populate! response = @docs.term_vector :type => 'doc2', :id => 1, :fields => 'title'
skip term vector tests on ES < <I>
github_elastomer-client
train
rb
59fee5ac1644df202f2f79c35bd266340cc90a3c
diff --git a/app/templates/src/main/java/package/web/rest/util/_PaginationUtil.java b/app/templates/src/main/java/package/web/rest/util/_PaginationUtil.java index <HASH>..<HASH> 100644 --- a/app/templates/src/main/java/package/web/rest/util/_PaginationUtil.java +++ b/app/templates/src/main/java/package/web/rest/util/_PaginationUtil.java @@ -19,12 +19,14 @@ public class PaginationUtil { public static final int DEFAULT_OFFSET = 1; + public static final int MIN_OFFSET = 1; + public static final int DEFAULT_LIMIT = 20; public static final int MAX_LIMIT = 100; public static PageRequest generatePageRequest(Integer offset, Integer limit) { - if (offset == null) { + if (offset == null || offset < MIN_OFFSET) { offset = DEFAULT_OFFSET; } if (limit == null || limit > MAX_LIMIT) { @@ -36,7 +38,7 @@ public class PaginationUtil { public static HttpHeaders generatePaginationHttpHeaders(Page page, String baseUrl, Integer offset, Integer limit) throws URISyntaxException { - if (offset == null) { + if (offset == null || offset < MIN_OFFSET) { offset = DEFAULT_OFFSET; } if (limit == null || limit > MAX_LIMIT) {
Added test when offset is < 1
jhipster_generator-jhipster
train
java
9a386e7336ba9445bd0162baa852fb287a80c83c
diff --git a/components/date-picker/__tests__/showTime.test.js b/components/date-picker/__tests__/showTime.test.js index <HASH>..<HASH> 100644 --- a/components/date-picker/__tests__/showTime.test.js +++ b/components/date-picker/__tests__/showTime.test.js @@ -1,5 +1,6 @@ import React from 'react'; import { mount } from 'enzyme'; +import moment from 'moment'; import DatePicker from '..'; const { RangePicker } = DatePicker; @@ -38,6 +39,7 @@ describe('DatePicker with showTime', () => { onChange={onChangeFn} onOk={onOkFn} onOpenChange={onOpenChangeFn} + defaultValue={moment()} />, );
update test case, OK button under calendar should not clickable
ant-design_ant-design
train
js
53f9bf3afc89b25d1c72d1bb7f985694b1ff2328
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -107,7 +107,13 @@ Pagelet.extend({ */ render: function render() { var framework = this._bigpipe._framework - , bootstrap = this; + , bootstrap = this + , data; + + data = this.keys.reduce(function reduce(memo, key) { + memo[key] = bootstrap[key]; + return memo; + }, {}); // // Adds initial HTML headers to the queue. The first flush will @@ -119,10 +125,13 @@ Pagelet.extend({ this.debug('Queueing initial headers'); this._queue.push({ name: this.name, - view: framework.get('bootstrap', this.keys.reduce(function reduce(memo, key) { - memo[key] = bootstrap[key]; - return memo; - }, {})) + view: framework.get('bootstrap', { + name: this.name, + template: '', + id: this.id, + data: data, + state: {} + }) }); return this;
[fix] Follow the same data structure as pagelets as this is still a pagelet
bigpipe_bootstrap-pagelet
train
js
8fa8c386db31dcc20e5331386dd22f010782cb80
diff --git a/spec/branch_cover/exceptions.rb b/spec/branch_cover/exceptions.rb index <HASH>..<HASH> 100644 --- a/spec/branch_cover/exceptions.rb +++ b/spec/branch_cover/exceptions.rb @@ -44,6 +44,23 @@ #>X end +### With assignment, but no exception list + + begin + raise + "foo" +#>X + rescue => foo + "here" + end + +#### Without raise + begin + :dont_raise + rescue => foo +#>X + end + ### With assigned exception list begin raise
Test cases for rescue => e
deep-cover_deep-cover
train
rb
a196bd0128f2923fcf0e4bdee2b40c1d017bc4a4
diff --git a/src/pybel/struct/filters/edge_filters.py b/src/pybel/struct/filters/edge_filters.py index <HASH>..<HASH> 100644 --- a/src/pybel/struct/filters/edge_filters.py +++ b/src/pybel/struct/filters/edge_filters.py @@ -85,7 +85,7 @@ def filter_edges(graph, edge_predicates=None): :param BELGraph graph: A BEL graph :param edge_predicates: A predicate or list of predicates - :type edge_predicates: None or (pybel.BELGraph, tuple, tuple, int) -> bool or iter[(pybel.BELGraph, tuple, tuple, int) -> bool] + :type edge_predicates: None or ((pybel.BELGraph, tuple, tuple, int) -> bool) or iter[(pybel.BELGraph, tuple, tuple, int) -> bool] :return: An iterable of edges that pass all predicates :rtype: iter[tuple,tuple,int] """
Update documentation [skip ci] This helps pycharm recognize it better
pybel_pybel
train
py