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
|
---|---|---|---|---|---|
796cdf7b2c65cf5ec1b6c21aec235aa9a516bfbb | diff --git a/upload/catalog/model/affiliate/affiliate.php b/upload/catalog/model/affiliate/affiliate.php
index <HASH>..<HASH> 100644
--- a/upload/catalog/model/affiliate/affiliate.php
+++ b/upload/catalog/model/affiliate/affiliate.php
@@ -10,7 +10,6 @@ class ModelAffiliateAffiliate extends Model {
$subject = sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
$message = sprintf($this->language->get('text_welcome'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')) . "\n\n";
- $message .= $this->language->get('text_approval') . "\n";
if (!$this->config->get('config_affiliate_approval')) {
$message .= $this->language->get('text_login') . "\n"; | Wrong/double approval text in affiliate mail close #<I> | opencart_opencart | train | php |
e3846cd7dac0da9d4bc85969aa5a509d0824ff17 | diff --git a/tests/Unit/AuditableTest.php b/tests/Unit/AuditableTest.php
index <HASH>..<HASH> 100644
--- a/tests/Unit/AuditableTest.php
+++ b/tests/Unit/AuditableTest.php
@@ -978,9 +978,16 @@ class AuditableTest extends AuditingTestCase
{
$model = factory(Article::class)->create();
+ // Key depends on type
+ if ($model->getKeyType() == 'string') {
+ $key = (string)$model->id;
+ } else {
+ $key = (int)$model->id;
+ }
+
$audit = factory(Audit::class)->create([
'auditable_type' => Article::class,
- 'auditable_id' => (string) $model->id,
+ 'auditable_id' => $key,
]);
$this->assertInstanceOf(Auditable::class, $model->transitionTo($audit)); | Don't cast id to string in every case, check the key type of the eloquent model | owen-it_laravel-auditing | train | php |
09bb8fea48d184073746e1c5bbd41be9a02fd441 | diff --git a/lib/service/util.js b/lib/service/util.js
index <HASH>..<HASH> 100644
--- a/lib/service/util.js
+++ b/lib/service/util.js
@@ -6,7 +6,6 @@ var wsParser = require('ws-parser');
var CRLF = Buffer.from('\r\n');
var TYPE_RE = /(request|response)-length:/i;
-var noop = function() {};
var frameIndex = 100000;
var TYPES = ['whistle', 'Fiddler'];
@@ -371,10 +370,15 @@ function resolveFrames(res, frames, callback) {
res.headers = res.headers || {};
var receiver = wsParser.getReceiver(res);
var execCallback = function() {
- receiver.onData = noop;
- callback(result);
+ if (receiver) {
+ receiver = null;
+ callback(result);
+ }
};
var index = 0;
+ receiver.onerror = execCallback;
+ receiver.onData = execCallback;
+ receiver.onclose = execCallback;
receiver.onData = function(chunk, opts) {
var frame = frames[index];
++index;
@@ -393,7 +397,7 @@ function resolveFrames(res, frames, callback) {
setImmediate(execCallback);
}
};
- setTimeout(execCallback, 1600);
+ setTimeout(execCallback, 2000);
frames.forEach((frame) => {
receiver.add(frame.bin);
}); | feat: extract websocket frames from saz file | avwo_whistle | train | js |
6dbd54888d29b2746f31e5d0ce076b6002fa7e96 | diff --git a/tests/test_process.py b/tests/test_process.py
index <HASH>..<HASH> 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -345,7 +345,8 @@ def test_diet_complains_if_passed_filename_is_not_file():
def test_diet_creates_a_backup_file_if_backup_is_enabled(config_copy):
- filename = join(TEST_FILES_DIR, 'nature.png')
+ add_fake_pipeline_to_config(BALLOON_CMD, config_copy)
+ filename = join(TEST_FILES_DIR, 'config.yaml')
backup_filename = ".".join([filename, 'back'])
config_copy['backup'] = 'back'
@@ -356,7 +357,8 @@ def test_diet_creates_a_backup_file_if_backup_is_enabled(config_copy):
def test_diet_removes_all_backup_files_if_backup_is_disabled(config_copy):
- filename = join(TEST_FILES_DIR, 'nature.png')
+ add_fake_pipeline_to_config(BALLOON_CMD, config_copy)
+ filename = join(TEST_FILES_DIR, 'config.yaml')
backup_filename = ".".join([filename, 'back'])
internal_filename = ".".join([filename, 'diet_internal']) | Speed up tests
Avoid running external compression tools because they are slow except on
one tests to make sure it works. | samastur_pyimagediet | train | py |
c875432f6585e4ab246320c4fd9f307f0ad7cdc3 | diff --git a/tests.py b/tests.py
index <HASH>..<HASH> 100644
--- a/tests.py
+++ b/tests.py
@@ -569,6 +569,16 @@ class BasicTest(object):
result = self.repo.ls(self.main_branch, '/a', directory=True)
correct = [{'type':'f'}]
self.assertEqual(normalize_ls(result), normalize_ls(correct))
+
+ def test_ls11(self):
+ result = self.repo.ls(self.main_branch, '/c/d', directory=True)
+ correct = [{'type':'d'}]
+ self.assertEqual(normalize_ls(result), normalize_ls(correct))
+
+ def test_ls12(self):
+ result = self.repo.ls(self.main_branch, '/c/d/', directory=True)
+ correct = [{'type':'d'}]
+ self.assertEqual(normalize_ls(result), normalize_ls(correct))
def test_ls_error1(self):
self.assertRaises(PathDoesNotExist, self.repo.ls, self.main_branch, '/z') | add two `ls` test cases which show a fault in HgRepo
HgRepo.ls appears to have trouble with the `directory` flag. In at least the
case where the desired directory is one dir deep, it lists the contents of
the directory rather than returning [{'type': 'd'}]
GitRepo and SvnRepo pass this test case. | ScottDuckworth_python-anyvcs | train | py |
3d6d873f1abe7233b37cb3b6fa0f788b77249cb9 | diff --git a/treeherder/etl/job_loader.py b/treeherder/etl/job_loader.py
index <HASH>..<HASH> 100644
--- a/treeherder/etl/job_loader.py
+++ b/treeherder/etl/job_loader.py
@@ -66,6 +66,10 @@ class JobLoader:
newrelic.agent.add_custom_parameter("project", project)
repository = Repository.objects.get(name=project)
+ if repository.active_status != 'active':
+ (real_task_id, _) = task_and_retry_ids(pulse_job["taskId"])
+ logger.debug("Task %s belongs to a repository that is not active.", real_task_id)
+ return
if repository.tc_root_url != root_url:
logger.warning("Skipping job for %s with incorrect root_url %s", | Do not process tasks that are associated to an 'onhold' repository
This will prevent raising MissingPushException which causes celery tasks to be retried | mozilla_treeherder | train | py |
d29ba4fe7ef8be0a88c17a675f18e04bef75acf8 | diff --git a/basher.go b/basher.go
index <HASH>..<HASH> 100644
--- a/basher.go
+++ b/basher.go
@@ -85,7 +85,9 @@ func ApplicationWithPath(
}
for _, script := range scripts {
- bash.Source(script, loader)
+ if err := bash.Source(script, loader); err != nil {
+ log.Fatal(err)
+ }
}
if copyEnv {
bash.CopyEnv() | fix: error when unable to source script | progrium_go-basher | train | go |
f2d16cfcafe0f1617092c9c50300b4f6e01a736d | diff --git a/luigi/parameter.py b/luigi/parameter.py
index <HASH>..<HASH> 100644
--- a/luigi/parameter.py
+++ b/luigi/parameter.py
@@ -299,9 +299,6 @@ class Parameter(object):
else:
return self.parse(x)
- def serialize_to_input(self, x):
- return self.serialize(x)
-
def parser_dest(self, param_name, task_name, glob=False, is_without_section=False):
if is_without_section:
if glob: | parameter.py: Remove Parameter.serialize_to_input
I couldn't find any place it was referenced from. Not even from anywhere
in Spotify's internal code base. | spotify_luigi | train | py |
80cf31dd48d872200e22199d04862fd95a5c6ca1 | diff --git a/openprocurement_client/tests/tests.py b/openprocurement_client/tests/tests.py
index <HASH>..<HASH> 100644
--- a/openprocurement_client/tests/tests.py
+++ b/openprocurement_client/tests/tests.py
@@ -379,6 +379,7 @@ class UserTestCase(unittest.TestCase):
setup_routing(self.app, routs=['tender_patch_credentials'])
tender = self.client.patch_credentials(self.tender.data.id, self.tender.access['token'])
self.assertTrue(tender['access']['token'])
+ self.assertTrue(tender['data'])
###########################################################################
# DOCUMENTS FILE TEST | check 'data' key in response | openprocurement_openprocurement.client.python | train | py |
05b2f6edff66dbc2f1eca275480ae5581e6bdc5d | diff --git a/lib/search_engine.py b/lib/search_engine.py
index <HASH>..<HASH> 100644
--- a/lib/search_engine.py
+++ b/lib/search_engine.py
@@ -1822,8 +1822,6 @@ def get_nearest_terms_in_bibxxx(p, f, n_below, n_above):
## determine browse field:
if not f and string.find(p, ":") > 0: # does 'p' contain ':'?
f, p = split(p, ":", 1)
- ## wash 'p' argument:
- p = sre_quotes.sub("", p)
## We are going to take max(n_below, n_above) as the number of
## values to ferch from bibXXx. This is needed to work around
## MySQL UTF-8 sorting troubles in 4.0.x. Proper solution is to
@@ -1903,8 +1901,6 @@ def get_nbhits_in_bibxxx(p, f):
## determine browse field:
if not f and string.find(p, ":") > 0: # does 'p' contain ':'?
f, p = split(p, ":", 1)
- ## wash 'p' argument:
- p = sre_quotes.sub("", p)
## construct 'tl' which defines the tag list (MARC tags) to search in:
tl = []
if str(f[0]).isdigit() and str(f[1]).isdigit(): | Do not remove quotes from the search pattern when getting nearest
terms and the number of hits in phrase indexes, fixing browsing
problems for author names such as O'Shea. | inveniosoftware_invenio-records | train | py |
36ee3d34545274338551199324141c9408919526 | diff --git a/lib/format_data.js b/lib/format_data.js
index <HASH>..<HASH> 100644
--- a/lib/format_data.js
+++ b/lib/format_data.js
@@ -73,8 +73,8 @@ HipChatFormatter.prototype.formatData = function(data) {
HipChatFormatter.prototype.formatRecepient = function(recepient) {
var robot_name = env.HUBOT_HIPCHAT_JID.split("_")[0];
- // harcode for now. This most likely requires some investiagtion.
- var hipchat_domain = 'conf.hipchat.com';
+ var hipchat_domain = (env.HUBOT_HIPCHAT_XMPP_DOMAIN == 'btf.hipchat.com') ?
+ 'conf.btf.hipchat.com' : 'conf.hipchat.com';
return util.format('%s_%s@%s', robot_name, recepient, hipchat_domain);
}; | Use a different domain for HipChat Server | StackStorm_hubot-stackstorm | train | js |
d8c0b16d7ec5cffe17ad14e2197ce5aa91268e2c | diff --git a/lib/timeline-window.js b/lib/timeline-window.js
index <HASH>..<HASH> 100644
--- a/lib/timeline-window.js
+++ b/lib/timeline-window.js
@@ -234,7 +234,7 @@ TimelineWindow.prototype.paginate = function(direction, size, makeRequest,
// remove some events from the other end, if necessary
var excess = this._eventCount - this._windowLimit;
if (excess > 0) {
- this._unpaginate(excess, direction != EventTimeline.BACKWARDS);
+ this.unpaginate(excess, direction != EventTimeline.BACKWARDS);
}
return q(true);
}
@@ -292,10 +292,8 @@ TimelineWindow.prototype.paginate = function(direction, size, makeRequest,
* @param {number} delta number of events to remove from the timeline
* @param {boolean} startOfTimeline if events should be removed from the start
* of the timeline.
- *
- * @private
*/
-TimelineWindow.prototype._unpaginate = function(delta, startOfTimeline) {
+TimelineWindow.prototype.unpaginate = function(delta, startOfTimeline) {
var tl = startOfTimeline ? this._start : this._end;
// sanity-check the delta | Make timeline-window _unpaginate public and remove _ | matrix-org_matrix-js-sdk | train | js |
2961f7063a8a2427ba16224301e6be143d6f3fa1 | diff --git a/lib/device_curator.js b/lib/device_curator.js
index <HASH>..<HASH> 100644
--- a/lib/device_curator.js
+++ b/lib/device_curator.js
@@ -870,6 +870,15 @@ function device(useMockDevice) {
.then(defered.resolve, defered.reject);
return defered.promise;
};
+
+ this.deviceTemporarilyClosed = false;
+ this.temporarilyDisconnect = function() {
+ console.log('I am in the "temporarilyDisconnect" function');
+ };
+ this.resumeConnection = function() {
+ console.log('I am in the "resumeConnection" function');
+ };
+
this.simpleOpen = function(deviceType, connectionType, identifier) {
var defered = q.defer();
var getOnError = function(msg) { | Started adding functionality to allow users to temporarily disconnect and
then re-connect to a device. This will enable users to more easily
disconnect from their device in Kipling to switch to a new program and
then come back to the device in Kipling. | chrisJohn404_ljswitchboard-ljm_device_curator | train | js |
d2e750cc744a81398f56d1efd8840e38dac21a15 | diff --git a/test/test_site.rb b/test/test_site.rb
index <HASH>..<HASH> 100644
--- a/test/test_site.rb
+++ b/test/test_site.rb
@@ -240,7 +240,6 @@ class TestSite < Test::Unit::TestCase
assert File.exist?(dest_dir('.svn'))
assert File.exist?(dest_dir('.svn/HEAD'))
end
-
end
context 'with an invalid markdown processor in the configuration' do | removed extraneous whitespace in test_site.rb | jekyll_jekyll | train | rb |
ac5b01ba6e0575b507ab7d17c8c2f51d41824422 | diff --git a/src/Foundation/Fetcher.php b/src/Foundation/Fetcher.php
index <HASH>..<HASH> 100644
--- a/src/Foundation/Fetcher.php
+++ b/src/Foundation/Fetcher.php
@@ -3,6 +3,7 @@
namespace Vinala\Kernel\Foundation;
use Vinala\Kernel\Router\Routes;
+use Vinala\Kernel\Events\Event;
/**
* this class help the framework to get all
@@ -29,6 +30,7 @@ class Fetcher
self::setFrameworkPath();
//
self::exception();
+ self::events();
self::model();
self::controller();
self::link();
@@ -36,6 +38,7 @@ class Fetcher
self::filtes();
self::routes($routes);
self::commands();
+
}
@@ -139,5 +142,16 @@ class Fetcher
foreach (self::fetch("support/lumos" , false) as $file)
Connector::need($file);
}
+
+ /**
+ * Require files of Console
+ */
+ protected static function events()
+ {
+ foreach (self::fetch("app/events" , false) as $file)
+ Connector::need($file);
+ //
+ Event::register();
+ }
}
\ No newline at end of file | fetch user events from app/events | vinala_kernel | train | php |
b566b0ee13fb4ee6470c5763b5dcd5fabd046821 | diff --git a/test/unit/plugins/providers/docker/driver_test.rb b/test/unit/plugins/providers/docker/driver_test.rb
index <HASH>..<HASH> 100644
--- a/test/unit/plugins/providers/docker/driver_test.rb
+++ b/test/unit/plugins/providers/docker/driver_test.rb
@@ -389,7 +389,7 @@ describe VagrantPlugins::DockerProvider::Driver do
end
end
- context 'image is being used' do
+ context 'image is being used by running container' do
before { allow(subject).to receive(:execute).and_raise("image is being used by running container") }
it 'does not remove the image' do
@@ -398,6 +398,15 @@ describe VagrantPlugins::DockerProvider::Driver do
end
end
+ context 'image is being used by stopped container' do
+ before { allow(subject).to receive(:execute).and_raise("image is being used by stopped container") }
+
+ it 'does not remove the image' do
+ expect(subject.rmi(id)).to eq(false)
+ subject.rmi(id)
+ end
+ end
+
context 'container is using it' do
before { allow(subject).to receive(:execute).and_raise("container is using it") } | rmi docker provider tests: May also be in use by a stopped container | hashicorp_vagrant | train | rb |
d5c7f81837456b90a66a03f62ace46f395553f34 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -14,14 +14,14 @@ from setuptools import setup, find_packages
tests_require = [
'blinker>=1.1',
'celery',
- 'Django>=1.2,<1.5',
+ 'Django>=1.2,<1.4',
'django-celery',
'django-nose',
'Flask>=0.8',
'logbook',
'nose',
'mock',
- 'sentry>=4.0.7',
+ 'sentry>=4.0.17',
'unittest2',
'webob',
] | setup.py require Django < <I> and sentry >= <I> | elastic_apm-agent-python | train | py |
fb6a313924a238abfa99d481ecdf2c4a13caee77 | diff --git a/Log/file.php b/Log/file.php
index <HASH>..<HASH> 100644
--- a/Log/file.php
+++ b/Log/file.php
@@ -1,6 +1,6 @@
<?php
// +-----------------------------------------------------------------------+
-// | Copyright (c) 2002 Richard Heyes |
+// | Copyright (c) 2002-2003 Richard Heyes |
// | All rights reserved. |
// | |
// | Redistribution and use in source and binary forms, with or without | | * Update copyright year to <I>. | pear_Log | train | php |
c8b50e62c214ada0074d356f2130fa95d0dbd85f | diff --git a/lib/nodefs-handler.js b/lib/nodefs-handler.js
index <HASH>..<HASH> 100644
--- a/lib/nodefs-handler.js
+++ b/lib/nodefs-handler.js
@@ -398,8 +398,8 @@ _handleDir(dir, stats, initialAdd, depth, target, wh, callback) {
directory = sysPath.join(directory, '');
if (!wh.hasGlob) {
- throttler = this.fsw._throttle('readdir', directory, 1000);
- if (!throttler) return;
+ // throttler = this.fsw._throttle('readdir', directory, 1000);
+ // if (!throttler) return;
}
const previous = this.fsw._getWatchedDir(wh.path); | Fuck readdir throttling. | paulmillr_chokidar | train | js |
23642a6ae4a1641e7a888acec5ae6b228cd87282 | diff --git a/azurerm/resource_arm_mssql_elasticpool.go b/azurerm/resource_arm_mssql_elasticpool.go
index <HASH>..<HASH> 100644
--- a/azurerm/resource_arm_mssql_elasticpool.go
+++ b/azurerm/resource_arm_mssql_elasticpool.go
@@ -60,7 +60,7 @@ func resourceArmMsSqlElasticPool() *schema.Resource {
"BC_Gen4",
"BC_Gen5",
}, true),
- DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
+ DiffSuppressFunc: suppress.CaseDifference,
},
"capacity": { | Update azurerm/resource_arm_mssql_elasticpool.go | terraform-providers_terraform-provider-azurerm | train | go |
3b6bb4664f102e4c852fe830e4de45a8d0587f41 | diff --git a/activesupport/test/memoizable_test.rb b/activesupport/test/memoizable_test.rb
index <HASH>..<HASH> 100644
--- a/activesupport/test/memoizable_test.rb
+++ b/activesupport/test/memoizable_test.rb
@@ -124,16 +124,6 @@ class MemoizableTest < ActiveSupport::TestCase
assert_equal 1, @person.age_calls
end
- def test_memorized_results_are_immutable
- # This is purely a performance enhancement that we can revisit once the rest of
- # the code is in place. Ideally, we'd be able to do memoization in a freeze-friendly
- # way without amc hacks
- pending do
- assert_equal "Josh", @person.name
- assert_raise(ActiveSupport::FrozenObjectError) { @person.name.gsub!("Josh", "Gosh") }
- end
- end
-
def test_reloadable
counter = @calculator.counter
assert_equal 1, @calculator.counter | Forget about old memoize immutable behavior | rails_rails | train | rb |
a434e27368eeb5b87d41459d76712c2fd1e9a027 | diff --git a/commands/themebuider.js b/commands/themebuider.js
index <HASH>..<HASH> 100644
--- a/commands/themebuider.js
+++ b/commands/themebuider.js
@@ -127,11 +127,15 @@ const installThemeBuilder = async version => {
const getDevExtremeVersion = () => {
const lockFileName = path.join(process.cwd(), 'package-lock.json');
+ const installedDevExtremePackageJson = path.join(process.cwd(), 'node_modules', 'devextreme', 'package.json');
+
if(fs.existsSync(lockFileName)) {
const dependencies = require(lockFileName).dependencies;
if(dependencies && dependencies.devextreme) {
return dependencies.devextreme.version;
}
+ } else if(fs.existsSync(installedDevExtremePackageJson)) {
+ return require(installedDevExtremePackageJson).version;
}
return; | Return version detection with node_modules (#<I>) | DevExpress_devextreme-cli | train | js |
380c434dd73254ae1c1d60e098f01cf133a68f8c | diff --git a/bin/pastebin.js b/bin/pastebin.js
index <HASH>..<HASH> 100644
--- a/bin/pastebin.js
+++ b/bin/pastebin.js
@@ -1,7 +1,7 @@
var _ = require('underscore'),
fs = require('fs'),
xml2js = require('xml2js'),
- Q = require('Q'),
+ Q = require('q'),
method = require('../lib/methods'),
conf = require('../lib/config');
@@ -460,4 +460,4 @@ Pastebin.prototype._postApi = function (path, params) {
return deferred.promise;
};
-module.exports = Pastebin;
\ No newline at end of file
+module.exports = Pastebin;
diff --git a/lib/methods.js b/lib/methods.js
index <HASH>..<HASH> 100644
--- a/lib/methods.js
+++ b/lib/methods.js
@@ -1,6 +1,6 @@
var request = require('request'),
config = require('./config'),
- Q = require('Q'),
+ Q = require('q'),
TIMEOUT = 4000,
HEADERS = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36', | Fixed Q library require having wrong casing
On case insensitive systems, an error was generated because module 'Q' could
not be found. Changed Q to lowercase | j3lte_pastebin-js | train | js,js |
aa6075737bfd565f092c8cdff953a74dad704251 | diff --git a/org.openbel.framework.api/src/main/java/org/openbel/framework/api/KAMStoreImpl.java b/org.openbel.framework.api/src/main/java/org/openbel/framework/api/KAMStoreImpl.java
index <HASH>..<HASH> 100644
--- a/org.openbel.framework.api/src/main/java/org/openbel/framework/api/KAMStoreImpl.java
+++ b/org.openbel.framework.api/src/main/java/org/openbel/framework/api/KAMStoreImpl.java
@@ -593,7 +593,9 @@ public final class KAMStoreImpl implements KAMStore {
function, uuid);
List<KamNode> kamNodeList = new ArrayList<KamNode>();
for (Integer kamNodeId : ids) {
- kamNodeList.add(k.findNode(kamNodeId));
+ KamNode kn = k.findNode(kamNodeId);
+ if (kn != null)
+ kamNodeList.add(kn);
}
return kamNodeList;
} catch (SQLException e) { | do not include null refs when finding by uuid | OpenBEL_openbel-framework | train | java |
800cd7408d621f4f22f187b5bcc75b41f4b0ace1 | diff --git a/tests/phpunit/unit/Library/BoltLibraryTest.php b/tests/phpunit/unit/Library/BoltLibraryTest.php
index <HASH>..<HASH> 100644
--- a/tests/phpunit/unit/Library/BoltLibraryTest.php
+++ b/tests/phpunit/unit/Library/BoltLibraryTest.php
@@ -1,7 +1,6 @@
<?php
namespace Bolt\Tests\Library;
-use Bolt\Exception\LowlevelException;
use Bolt\Library;
use Bolt\Tests\BoltUnitTest;
use Symfony\Component\HttpFoundation\Request;
@@ -16,9 +15,6 @@ class BoltLibraryTest extends BoltUnitTest
protected function tearDown()
{
parent::tearDown();
- // Clear the queue of LowlevelExceptions or they get needlessly reported at the end of the test run.
- // @deprcated remove with new error handling.
- LowlevelException::$screen = null;
}
public function testFormatFilesize() | [Tests] Remove clean for LLE | bolt_bolt | train | php |
44dc57275afbf702082b460a6b462684a7a90be0 | diff --git a/contrib/externs/angular-1.3-q_templated.js b/contrib/externs/angular-1.3-q_templated.js
index <HASH>..<HASH> 100644
--- a/contrib/externs/angular-1.3-q_templated.js
+++ b/contrib/externs/angular-1.3-q_templated.js
@@ -35,7 +35,7 @@ angular.$q;
/**
* @constructor
* @template T
- * @extends {IThenable.<T>}
+ * @implements {IThenable<T>}
*/
angular.$q.Promise;
diff --git a/externs/w3c_dom3.js b/externs/w3c_dom3.js
index <HASH>..<HASH> 100644
--- a/externs/w3c_dom3.js
+++ b/externs/w3c_dom3.js
@@ -400,7 +400,7 @@ Node.prototype.lookupNamespaceURI = function(prefix) {};
Node.prototype.lookupPrefix = function(namespaceURI) {};
/**
- * @return undefined
+ * @return {undefined}
* @see http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-normalize
*/
Node.prototype.normalize = function() {}; | Fix a couple of incorrect externs.
-------------
Created by MOE: <URL> | google_closure-compiler | train | js,js |
df8676946b3acc4f9bfddba43ac0322b132cdcaf | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ setup(
package_dir = {"":"src"},
scripts = ["src/db-migrate"],
- #install_requires = ["mysql==1.2.2"], #TODO: install mysql as dependency
+ install_requires = ["mysql==1.2.2"],
author = "Guilherme Chapiewski",
author_email = "[email protected]", | Declared mysql-python <I> as a dependency. | guilhermechapiewski_simple-db-migrate | train | py |
fd4161e2feacc89dae9fa08850acca423774495d | diff --git a/doc/source/generate_doc.py b/doc/source/generate_doc.py
index <HASH>..<HASH> 100644
--- a/doc/source/generate_doc.py
+++ b/doc/source/generate_doc.py
@@ -54,7 +54,8 @@ def import_submodules(package, recursive=True):
if isinstance(package, str):
package = importlib.import_module(package)
results = {}
- for loader, name, is_pkg in pkgutil.walk_packages(package.__path__):
+ for loader, name, is_pkg in pkgutil.walk_packages(package.__path__,
+ onerror=lambda x: None):
full_name = package.__name__ + '.' + name
results[full_name] = importlib.import_module(full_name)
if recursive and is_pkg: | DOC: add onerror to walk_packages in generate_doc | odlgroup_odl | train | py |
13aa7638002afede3a83009410aedd51a0e276b2 | diff --git a/tripleohelper/ssh.py b/tripleohelper/ssh.py
index <HASH>..<HASH> 100644
--- a/tripleohelper/ssh.py
+++ b/tripleohelper/ssh.py
@@ -112,6 +112,7 @@ class SshClient(object):
self.description = '[%s@%s]' % (self._user,
self._hostname)
+ exception = None
for i in range(60):
try:
self._client.connect(
@@ -125,17 +126,20 @@ class SshClient(object):
except (OSError,
TypeError,
ssh_exception.SSHException,
- ssh_exception.NoValidConnectionsError):
- LOG.info('%s waiting for %s' % (self.description, connect_to))
- # LOG.debug("exception: '%s'" % str(e))
+ ssh_exception.NoValidConnectionsError) as e:
+ exception = e
+ LOG.info('%s waiting for %s: %s' %
+ (self.description, connect_to, str(exception)))
time.sleep(1)
else:
LOG.debug('%s connected' % self.description)
self._started = True
return
- _error = ("unable to connect to ssh service on '%s'" % self._hostname)
+
+ _error = ("unable to connect to ssh service on '%s': %s" %
+ (self._hostname, str(exception)))
LOG.error(_error)
- raise ssh_exception.SSHException(_error)
+ raise exception
def _check_started(self):
if not self._started: | SshClient: Re-raise the exception from paramiko
Re-raise the latest exception from paramiko instead of a generic
SSHException to be able to filter on different cases
(SSHAuthenticationError for example) in the calling code.
Change-Id: Ica1d<I>fa5a2c<I>b<I>cc5aa<I>da<I>bbaa<I> | redhat-openstack_python-tripleo-helper | train | py |
63410491b724c4f2404153a640a53e2bfbb44178 | diff --git a/cmd/telegraf/telegraf.go b/cmd/telegraf/telegraf.go
index <HASH>..<HASH> 100644
--- a/cmd/telegraf/telegraf.go
+++ b/cmd/telegraf/telegraf.go
@@ -32,7 +32,7 @@ var fPidfile = flag.String("pidfile", "", "file to write our pid to")
var fInputFilters = flag.String("input-filter", "",
"filter the inputs to enable, separator is :")
var fInputList = flag.Bool("input-list", false,
- "print available output plugins.")
+ "print available input plugins.")
var fOutputFilters = flag.String("output-filter", "",
"filter the outputs to enable, separator is :")
var fOutputList = flag.Bool("output-list", false, | Fix typo, should be input instead of output. | influxdata_telegraf | train | go |
3263e5f091bbfac345581379bd8dbd9a04f39adc | diff --git a/pipenv/cli.py b/pipenv/cli.py
index <HASH>..<HASH> 100644
--- a/pipenv/cli.py
+++ b/pipenv/cli.py
@@ -64,7 +64,9 @@ def do_where(virtualenv=False, bare=True):
if not virtualenv:
location = project.pipfile_location
- if not bare:
+ if not location:
+ click.echo('No Pipfile present at project home. Consider running {0} first to automatically generate a Pipfile for you.'.format(crayons.green('`pipenv install`')))
+ elif not bare:
click.echo('Pipfile found at {0}. Considering this to be the project home.'.format(crayons.green(location)))
else:
click.echo(location) | Better output for where command when no Pipfile
Presently when there is no Pipfile inside a directory, running
`pip --where` gives
`Pipfile found at None. Considering this to be the project home.`.
This seems ambiguous and I've changed it to
```
$ pipenv --where
No Pipfile present at project home. Consider running `pipenv install`
first to automatically generate a Pipfile for you.
$
``` | pypa_pipenv | train | py |
03cb5dcf4ffecd6563cb44961f802a02319ef364 | diff --git a/src/CoandaCMS/Coanda/Core/Attributes/Types/Image.php b/src/CoandaCMS/Coanda/Core/Attributes/Types/Image.php
index <HASH>..<HASH> 100644
--- a/src/CoandaCMS/Coanda/Core/Attributes/Types/Image.php
+++ b/src/CoandaCMS/Coanda/Core/Attributes/Types/Image.php
@@ -72,6 +72,14 @@ class Image extends AttributeType {
*/
public function data($data, $parameters = [])
{
- return Coanda::module('media')->getMedia($data);
+ $media_id = (int)$data;
+
+ if ($media_id)
+ {
+ return Coanda::module('media')->getMedia($media_id);
+ }
+
+ return false;
+
}
}
\ No newline at end of file | Bugfix - only try to fetch media if we have an id. | CoandaCMS_coanda-core | train | php |
b18c6eab6f1afa273bb1506b25d4c6a6b0d68293 | diff --git a/graphdb/src/test/java/com/orientechnologies/orient/graph/gremlin/TestLoadGraph.java b/graphdb/src/test/java/com/orientechnologies/orient/graph/gremlin/TestLoadGraph.java
index <HASH>..<HASH> 100644
--- a/graphdb/src/test/java/com/orientechnologies/orient/graph/gremlin/TestLoadGraph.java
+++ b/graphdb/src/test/java/com/orientechnologies/orient/graph/gremlin/TestLoadGraph.java
@@ -9,7 +9,7 @@ import org.testng.annotations.Test;
import com.orientechnologies.orient.client.db.ODatabaseHelper;
import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.db.graph.OGraphDatabase;
-import com.tinkerpop.blueprints.impls.orient.OrientBatchGraph;
+import com.tinkerpop.blueprints.impls.orient.batch.OrientBatchGraph;
import com.tinkerpop.blueprints.util.io.graphml.GraphMLReader;
public class TestLoadGraph { | Update path of OrientBatchGraph after BP refactoring | orientechnologies_orientdb | train | java |
4556d58449cd0ec9c7322caca279e0021b0ea9ab | diff --git a/beprof/curve.py b/beprof/curve.py
index <HASH>..<HASH> 100644
--- a/beprof/curve.py
+++ b/beprof/curve.py
@@ -109,17 +109,17 @@ class Curve(np.ndarray):
:param fixp: fixed point one of the points in new domain
:return: new Curve object with domain specified by step and fixp parameters
'''
- section = (np.min(self.x), np.max(self.x))
- count_start = (abs(fixp - section[0]) / step)
- count_stop = (abs(fixp - section[1]) / step)
+ a, b = (np.min(self.x), np.max(self.x))
+ count_start = (abs(fixp - a) / step)
+ count_stop = (abs(fixp - b) / step)
# depending on position of fixp with respect to the orginal domain
# may be 1 of 3 cases:
- if fixp < section[0]:
+ if fixp < a:
count_start = (math.ceil(count_start))
count_stop = (math.floor(count_stop))
- elif fixp > section[1]:
+ elif fixp > b:
count_start = -(math.floor(count_start))
count_stop = -(math.ceil(count_stop))
else: | Changed a small fragment to more Python-like
According to your comment, now it is
a, b = (np.min(self.x), np.max(self.x))
instead of this C-like section[X] calls | DataMedSci_beprof | train | py |
e90e1c5d9a11af17e61417cec81cd7c35dd64f40 | diff --git a/all.go b/all.go
index <HASH>..<HASH> 100644
--- a/all.go
+++ b/all.go
@@ -16,6 +16,11 @@ func (n *Node) AllByIndex(fieldName string, to interface{}) error {
}
typ := reflect.Indirect(ref).Type().Elem()
+
+ if typ.Kind() == reflect.Ptr {
+ typ = typ.Elem()
+ }
+
newElem := reflect.New(typ)
info, err := extract(newElem.Interface())
diff --git a/all_test.go b/all_test.go
index <HASH>..<HASH> 100644
--- a/all_test.go
+++ b/all_test.go
@@ -34,6 +34,14 @@ func TestAllByIndex(t *testing.T) {
assert.Equal(t, 1, users[0].ID)
assert.Equal(t, 100, users[99].ID)
+ var users2 []*User
+
+ err = db.All(&users2)
+ assert.NoError(t, err)
+ assert.Len(t, users2, 100)
+ assert.Equal(t, 1, users2[0].ID)
+ assert.Equal(t, 100, users2[99].ID)
+
err = db.AllByIndex("DateOfBirth", &users)
assert.NoError(t, err)
assert.Len(t, users, 100) | Add support for slice of pointers in All | asdine_storm | train | go,go |
74e60e1d960823db469a146143eee4a75a169f63 | diff --git a/test/test_validation_with_errors.rb b/test/test_validation_with_errors.rb
index <HASH>..<HASH> 100644
--- a/test/test_validation_with_errors.rb
+++ b/test/test_validation_with_errors.rb
@@ -12,11 +12,11 @@ describe "validation errors" do
assert_equal(errors.size, test_case["errors"].size, "Expected #{test_case["errors"].size} errors, got #{errors.size} errors")
errors.zip(test_case["errors"]).each do |error, expected_error|
- assert_equal(error.schema, expected_error["schema"])
- assert_equal(error.schema_uri, expected_error["schema_uri"])
- assert_equal(error.schema_attribute, expected_error["schema_attribute"])
- assert_equal(error.value, expected_error["value"])
- # assert_equal(error.value_path, expected_error["value_path"]) TODO
+ assert_equal(expected_error["schema"], error.schema)
+ assert_equal(expected_error["schema_uri"], error.schema_uri)
+ assert_equal(expected_error["schema_attribute"], error.schema_attribute)
+ assert_equal(expected_error["value"], error.value)
+ # assert_equal(expected_error["value_path"], error.value_path) TODO
end
end
end | Put arguments to assert_equal in correct order | inglesp_json_validation | train | rb |
a7d3bcf6a6431c5748c2ef08ab978bb6f98b8a15 | diff --git a/peri/comp/ilms.py b/peri/comp/ilms.py
index <HASH>..<HASH> 100644
--- a/peri/comp/ilms.py
+++ b/peri/comp/ilms.py
@@ -813,8 +813,8 @@ class BarnesXYLegPolyZ(BarnesPoly):
def _setup_barnes_params(self):
barnes_params = []
barnes_values = []
- for i in range(npts[0]):
- for j in range(npts[1]):
+ for i in range(self.npts[0]):
+ for j in range(self.npts[1]):
barnes_params.append(self.category+'-b-%i-%i' % (i, j))
barnes_values.append(0.0)
return barnes_params, barnes_params, barnes_values | npts -> self.npts typo in ilms | peri-source_peri | train | py |
0170a173a1d6a1699b4a897e78fdd17dd3395636 | diff --git a/bcbio/pipeline/run_info.py b/bcbio/pipeline/run_info.py
index <HASH>..<HASH> 100644
--- a/bcbio/pipeline/run_info.py
+++ b/bcbio/pipeline/run_info.py
@@ -17,6 +17,7 @@ from bcbio.log import logger
from bcbio.distributed import objectstore
from bcbio.illumina import flowcell
from bcbio.pipeline import alignment, config_utils, genome
+from bcbio.pipeline import datadict as dd
from bcbio.provenance import diagnostics, programs, versioncheck
from bcbio.variation import effects, genotype, population, joint, vcfutils
from bcbio.variation.cortex import get_sample_name
@@ -143,12 +144,18 @@ def add_reference_resources(data):
def _clean_metadata(data):
batches = tz.get_in(("metadata", "batch"), data)
+ # Ensure batches are strings
if batches:
if isinstance(batches, (list, tuple)):
batches = [str(x) for x in batches]
else:
batches = str(batches)
data["metadata"]["batch"] = batches
+ # If we have jointcalling, add a single batch if not present
+ elif tz.get_in(["algorithm", "jointcaller"], data):
+ if "metadata" not in data:
+ data["metadata"] = {}
+ data["metadata"]["batch"] = "%s-joint" % dd.get_sample_name(data)
return data
def _clean_algorithm(data): | Allow jointcalling to work with single samples without batches for gVCF output. Thanks to Mick Watson | bcbio_bcbio-nextgen | train | py |
1888516c880e6ef51b16a15888b200a1e6752ecc | diff --git a/examples/with-co.js b/examples/with-co.js
index <HASH>..<HASH> 100644
--- a/examples/with-co.js
+++ b/examples/with-co.js
@@ -10,11 +10,6 @@
var co = require('co');
var prompt = require('../index');
-function catched(err) {
- console.log('error:', err);
- prompt.end();
-}
-
co(function * prompting() {
var confirm = prompt.confirm;
var password = prompt.password;
@@ -29,6 +24,4 @@ co(function * prompting() {
})
.then(function fulfilled(val) {
console.log('response:', val);
- prompt.end();
-})
-.catch(catched);
+});
\ No newline at end of file
diff --git a/examples/without-co.js b/examples/without-co.js
index <HASH>..<HASH> 100644
--- a/examples/without-co.js
+++ b/examples/without-co.js
@@ -27,9 +27,4 @@ prompt('username: ')
.then(function confirmResponse(val) {
console.log('response:', result);
console.log('Done! :)');
- prompt.end();
-})
-.catch(function errorHandler(err) {
- console.log('error:', err);
- prompt.end();
}); | update examples, there`s no way to throw to .catch | tunnckoCore_prompt-promise | train | js,js |
9bf0f1da53a1f8876723094f6df8b81785a12dc7 | diff --git a/src/scout_apm/core/__init__.py b/src/scout_apm/core/__init__.py
index <HASH>..<HASH> 100644
--- a/src/scout_apm/core/__init__.py
+++ b/src/scout_apm/core/__init__.py
@@ -64,7 +64,7 @@ def shutdown():
def apm_callback(queue_size):
if scout_config.value("shutdown_message_enabled"):
- print( # noqa: T001
+ print( # noqa: T001,T201
(
"Scout draining {queue_size} event{s} for up to"
+ " {timeout_seconds} seconds"
@@ -78,7 +78,7 @@ def shutdown():
def error_callback(queue_size):
if scout_config.value("shutdown_message_enabled"):
- print( # noqa: T001
+ print( # noqa: T001,T201
(
"Scout draining {queue_size} error{s} for up to"
+ " {timeout_seconds} seconds" | Ignore print line with new flake type | scoutapp_scout_apm_python | train | py |
62d12c4358a1912af2df7e670a9638f6b4273b18 | diff --git a/pandas/tools/pivot.py b/pandas/tools/pivot.py
index <HASH>..<HASH> 100644
--- a/pandas/tools/pivot.py
+++ b/pandas/tools/pivot.py
@@ -128,7 +128,10 @@ def _add_margins(table, data, values, rows=None, cols=None, aggfunc=np.mean):
grand_margin = {}
for k, v in data[values].iteritems():
try:
- grand_margin[k] = aggfunc(v)
+ if isinstance(aggfunc, basestring):
+ grand_margin[k] = getattr(v, aggfunc)()
+ else:
+ grand_margin[k] = aggfunc(v)
except TypeError:
pass | BUG: passing a string to aggfunc like 'mean' won't break _add_margins, GH #<I> | pandas-dev_pandas | train | py |
faef449d9482d027cea6c76f6d27418392c65251 | diff --git a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/OrderedChildResourcesTestCase.java b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/OrderedChildResourcesTestCase.java
index <HASH>..<HASH> 100644
--- a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/OrderedChildResourcesTestCase.java
+++ b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/OrderedChildResourcesTestCase.java
@@ -78,8 +78,8 @@ public class OrderedChildResourcesTestCase extends BuildConfigurationTestBase {
originalSlaveStack.protect();
Assert.assertEquals(originalMasterStack, originalSlaveStack);
- //FD is normally in the middle somewhere
- final String protocolName = "FD";
+ //FD_ALL is normally in the middle somewhere
+ final String protocolName = "FD_ALL";
int index = -1;
ModelNode value = null;
Iterator<Property> it = originalMasterStack.get(PROTOCOL).asPropertyList().iterator(); | Change FD reference to FD_ALL. | wildfly_wildfly | train | java |
edfdf80c3e512c55c3cfc7dc08d3f149c3e84063 | diff --git a/config/bootstrap.php b/config/bootstrap.php
index <HASH>..<HASH> 100644
--- a/config/bootstrap.php
+++ b/config/bootstrap.php
@@ -7,14 +7,12 @@ use WyriHaximus\TwigView\Event;
EventManager::instance()->attach(new Event\ExtensionsListener());
EventManager::instance()->attach(new Event\TokenParsersListener());
-// Debug kit profiler
if (Configure::read('debug')) {
- // Disabling the panel until it is more solid, it causes errors atm the moment
- /*Configure::write('DebugKit.panels', array_merge(
+ Configure::write('DebugKit.panels', array_merge(
(array)Configure::read('DebugKit.panels'),
[
'WyriHaximus/TwigView.Twig',
]
- ));*/
+ ));
EventManager::instance()->attach(new Event\ProfilerListener());
} | Enabling the panel again :<I>: | WyriHaximus_TwigView | train | php |
0c979b479ce8b5d0b8d3262b5ff94bc3356774b1 | diff --git a/src/js/sortable-table.js b/src/js/sortable-table.js
index <HASH>..<HASH> 100644
--- a/src/js/sortable-table.js
+++ b/src/js/sortable-table.js
@@ -133,7 +133,7 @@
});
$(document).on('keyup.sui.sortableTable.data-api', '[data-toggle=sort]', function(e) {
- if (e.keyCode == 13 || e.keyCode == 32) {
+ if (e.keyCode == 13 || e.keyCode == 32) { //enter or space
callPlugin(e);
}
}); | Added comment to hint what keys the used keycodes represent | visionappscz_bootstrap-ui | train | js |
05e89e1208995336baf126f8c3c379467b0d7937 | diff --git a/pysra/site.py b/pysra/site.py
index <HASH>..<HASH> 100644
--- a/pysra/site.py
+++ b/pysra/site.py
@@ -936,7 +936,7 @@ class Profile(collections.abc.Container):
"""
layers = []
- for row in df.itertuples(index=False):
+ for _, row in df.iterrows():
layers.append(
Layer(
SoilType( | Changed back to iterrows(). | arkottke_pysra | train | py |
459e343cf2ab0cfb5f6309f4f0e0adbe304f2be0 | diff --git a/lib/config/dependencies.js b/lib/config/dependencies.js
index <HASH>..<HASH> 100644
--- a/lib/config/dependencies.js
+++ b/lib/config/dependencies.js
@@ -3,14 +3,10 @@
const { execSync: exec } = require('child_process');
const { error, print, strong } = require('../utils/cnsl');
const { resolve } = require('../dependency-resolver');
+const fs = require('fs');
const path = require('path');
-let useNPM = true;
-
-try {
- exec('yarn help');
- useNPM = false;
-} catch (err) { /* yarn not installed */}
+const useNPM = !fs.existsSync(path.resolve('yarn.lock'));
module.exports = {
find, | only use yarn if yarn.lock file exists | popeindustries_buddy | train | js |
5b57db074f894b88afffea7fa012de0a1efccb3e | diff --git a/lib/puppet/pops/types/types.rb b/lib/puppet/pops/types/types.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/pops/types/types.rb
+++ b/lib/puppet/pops/types/types.rb
@@ -1480,7 +1480,7 @@ class PStructType < PAnyType
include Enumerable
def initialize(elements)
- @elements = elements.sort.freeze
+ @elements = elements.freeze
end
def accept(visitor, guard) | (maint) Remove sort of Struct members
This commit removes the existing sort of the Struct members since there
is no reason to sort them. The order is irrelevant when assignability is
computed. It is however relevant to retain the order when a Struct is
used to describe named parameters of a function and the unnamed
parameter tuple is inferred from that Struct. | puppetlabs_puppet | train | rb |
fc0d421884f8e6c99bbb195f31bea8492f1e2e04 | diff --git a/aws/internal/service/glue/waiter/waiter.go b/aws/internal/service/glue/waiter/waiter.go
index <HASH>..<HASH> 100644
--- a/aws/internal/service/glue/waiter/waiter.go
+++ b/aws/internal/service/glue/waiter/waiter.go
@@ -14,8 +14,8 @@ const (
SchemaAvailableTimeout = 2 * time.Minute
SchemaDeleteTimeout = 2 * time.Minute
SchemaVersionAvailableTimeout = 2 * time.Minute
- TriggerCreateTimeout = 2 * time.Minute
- TriggerDeleteTimeout = 2 * time.Minute
+ TriggerCreateTimeout = 5 * time.Minute
+ TriggerDeleteTimeout = 5 * time.Minute
)
// MLTransformDeleted waits for an MLTransform to return Deleted | Adjust default Glue timeouts to be aligned with documentation of the resource. | terraform-providers_terraform-provider-aws | train | go |
c2680b04dd83941af50413241440ef29a623224c | diff --git a/src/project/ProjectManager.js b/src/project/ProjectManager.js
index <HASH>..<HASH> 100644
--- a/src/project/ProjectManager.js
+++ b/src/project/ProjectManager.js
@@ -1840,7 +1840,7 @@ define(function (require, exports, module) {
}
// Directory contents removed
- if (removed) {
+ if (removed.length > 0) {
_fileTreeChangeQueue.add(function () {
return Async.doSequentially(removed, function (removedEntry) {
return _deleteTreeNode(removedEntry);
@@ -1849,7 +1849,7 @@ define(function (require, exports, module) {
}
// Directory contents added
- if (added) {
+ if (added.length > 0) {
_fileTreeChangeQueue.add(function () {
// Find parent node to add to. Use shallowSearch=true to
// skip adding a child if it's parent is not visible | fix check for added and removed files in fs change event handler | adobe_brackets | train | js |
d983768165a2c3cb15c92a561b79c4386c38dc6a | diff --git a/code/GridFieldOrderableRows.php b/code/GridFieldOrderableRows.php
index <HASH>..<HASH> 100755
--- a/code/GridFieldOrderableRows.php
+++ b/code/GridFieldOrderableRows.php
@@ -278,9 +278,11 @@ class GridFieldOrderableRows extends RequestHandler implements
if($list instanceof ManyManyList) {
$extra = $list->getExtraFields();
$key = $list->getLocalKey();
+ $foreignKey = $list->getForeignKey();
+ $foreignID = '= ' . (int) $list->getForeignID();
if(array_key_exists($this->getSortField(), $extra)) {
- return sprintf('"%s" %s', $key, $value);
+ return sprintf('"%s" %s AND "%s" %s', $key, $value, $foreignKey, $foreignID);
}
} | fixed many many ordering so that other many many lists with the same relation aren't affected | symbiote_silverstripe-gridfieldextensions | train | php |
7288dfc620230ca117cda353f5bf7ae45453b4bd | diff --git a/src/Psalm/Internal/InternalTaintSinkMap.php b/src/Psalm/Internal/InternalTaintSinkMap.php
index <HASH>..<HASH> 100644
--- a/src/Psalm/Internal/InternalTaintSinkMap.php
+++ b/src/Psalm/Internal/InternalTaintSinkMap.php
@@ -8,6 +8,7 @@ return [
'file_put_contents' => [['shell']],
'fopen' => [['shell']],
'header' => [['text']],
+'igbinary_unserialize' => [['text']],
'ldap_search' => [['text']],
'mysqli_query' => [[], ['sql']],
'passthru' => [['shell']],
@@ -19,4 +20,5 @@ return [
'setcookie' => [['text'], ['text']],
'shell_exec' => [['shell']],
'system' => [['shell']],
+'unserialize' => [['text']],
]; | Fix #<I> - unserialize is a taint sink | vimeo_psalm | train | php |
c5e0990189cd4a6ac2683474ca7331fbe17f6891 | diff --git a/src/Core/TypedCollectionTrait.php b/src/Core/TypedCollectionTrait.php
index <HASH>..<HASH> 100644
--- a/src/Core/TypedCollectionTrait.php
+++ b/src/Core/TypedCollectionTrait.php
@@ -29,7 +29,7 @@ trait TypedCollectionTrait
$type = static::getType();
if (class_exists($type) || interface_exists($type)) {
- return $strict ? ($type == get_class($value)) : ($value instanceof $type);
+ return is_object($value) && ( $strict ? ($type == get_class($value)) : ($value instanceof $type) );
}
switch (gettype($value)) { | + Strict type check in TypedCollection is added | RunnMe_Core | train | php |
3a15b9323ff09e2b5092398bef7f3dd39b076caa | diff --git a/src/python/pants/backend/core/tasks/list_goals.py b/src/python/pants/backend/core/tasks/list_goals.py
index <HASH>..<HASH> 100644
--- a/src/python/pants/backend/core/tasks/list_goals.py
+++ b/src/python/pants/backend/core/tasks/list_goals.py
@@ -25,8 +25,10 @@ class ListGoals(ConsoleTask):
undocumented = []
max_width = 0
for goal in Goal.all():
- if goal.description:
- documented_rows.append((goal.name, goal.description))
+ desc = goal.description
+ if desc:
+ first_sentence = desc.partition('\n')[0]
+ documented_rows.append((goal.name, first_sentence))
max_width = max(max_width, len(goal.name))
elif self.get_options().all:
undocumented.append(goal.name) | Make goal listing use only the first sentence of the description.
Now that the description can be inferred from a task docstring,
this is pertinent.
Testing Done:
Manual testing before and after. Ran the list_goals tests.
Bugs closed: <I>
Reviewed at <URL> | pantsbuild_pants | train | py |
ac508291621eaaca811fdcb56d923f4c037f2806 | diff --git a/src/bootstrap-table.js b/src/bootstrap-table.js
index <HASH>..<HASH> 100644
--- a/src/bootstrap-table.js
+++ b/src/bootstrap-table.js
@@ -3112,7 +3112,9 @@ class BootstrapTable {
resetSearch (text) {
const $search = Utils.getSearchInput(this)
- $search.val(text || '')
+ const textToUse = text || ''
+ $search.val(textToUse)
+ this.searchText = textToUse
this.onSearch({ currentTarget: $search }, false)
} | Reset also the searchText value | wenzhixin_bootstrap-table | train | js |
cf2afe85a25313f0e458c41b9a89fa6843c56ba5 | diff --git a/python/setup.py b/python/setup.py
index <HASH>..<HASH> 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -109,7 +109,7 @@ if platform.system() == 'Darwin':
setup(
name='neuroglancer',
- version='2.16',
+ version='2.17',
description='Python data backend for neuroglancer, a WebGL-based viewer for volumetric data',
author='Jeremy Maitin-Shepard, Jan Funke',
author_email='[email protected], [email protected]', | chore: bump python package version to <I> | google_neuroglancer | train | py |
92d4a6bab41e18d542788926779dcd628d08b216 | diff --git a/tests/test_serializer.py b/tests/test_serializer.py
index <HASH>..<HASH> 100644
--- a/tests/test_serializer.py
+++ b/tests/test_serializer.py
@@ -26,7 +26,8 @@ class SerializerTest(unittest.TestCase) :
{u"distinct":[
(dedupe.core.frozendict(OrderedDict(((u'bar',
frozenset([u'barë'])),
- (u'foo', u'baz')))),
+ ('baz', (1,2)),
+ (u'foo', u'baz')))),
dedupe.core.frozendict({u'foo' : u'baz'}))],
u"match" : []}) | test for reading and writing tuples to json | dedupeio_dedupe | train | py |
c443bacc9890ea0ba0ac0ecd6a6a8b958f52970d | diff --git a/go/vt/vtctl/reparentutil/emergency_reparenter.go b/go/vt/vtctl/reparentutil/emergency_reparenter.go
index <HASH>..<HASH> 100644
--- a/go/vt/vtctl/reparentutil/emergency_reparenter.go
+++ b/go/vt/vtctl/reparentutil/emergency_reparenter.go
@@ -449,7 +449,7 @@ func (erp *EmergencyReparenter) reparentReplicas(
replicaMutex sync.Mutex
)
- replCtx, replCancel := context.WithTimeout(ctx, opts.WaitReplicasTimeout)
+ replCtx, replCancel := context.WithTimeout(context.Background(), opts.WaitReplicasTimeout)
event.DispatchUpdate(ev, "reparenting all tablets") | feat: fix the bug by not using the parent context when creating a context for the RPCs to run | vitessio_vitess | train | go |
47455adc8d88293ae570022c61722cb07da73bf0 | diff --git a/src/Filter/Expression.php b/src/Filter/Expression.php
index <HASH>..<HASH> 100644
--- a/src/Filter/Expression.php
+++ b/src/Filter/Expression.php
@@ -58,6 +58,8 @@ class Expression
case '$ne':
$isMatch = $value !== $this->operand;
break;
+ default:
+ $isMatch = false;
}
return $isMatch; | Added default clause to switch block in Expression. | alexanderduring_php-ember-db | train | php |
ce762577cbd55b7431607a3031cd4a9a1460248f | diff --git a/internal/common/lexer_test.go b/internal/common/lexer_test.go
index <HASH>..<HASH> 100644
--- a/internal/common/lexer_test.go
+++ b/internal/common/lexer_test.go
@@ -18,10 +18,11 @@ var consumeTests = []consumeTestCase{{
# Comment line 1
# Comment line 2
+,,,,,, # Commas are insignificant
type Hello {
-world: String!
+ world: String!
}`,
- expected: "Comment line 1\nComment line 2",
+ expected: "Comment line 1\nComment line 2\nCommas are insignificant",
}}
func TestConsume(t *testing.T) {
@@ -35,7 +36,7 @@ func TestConsume(t *testing.T) {
}
if test.expected != lex.DescComment() {
- t.Errorf("wanted: %q\ngot: %q", test.expected, lex.DescComment())
+ t.Errorf("wrong description value:\nwant: %q\ngot : %q", test.expected, lex.DescComment())
}
})
} | lexer.Consume(): Add test for insignificant comma | graph-gophers_graphql-go | train | go |
34ba813a738abef18da4123b5675b739de662f0f | diff --git a/worker.go b/worker.go
index <HASH>..<HASH> 100644
--- a/worker.go
+++ b/worker.go
@@ -95,7 +95,7 @@ type WorkerConfig struct {
WorkerCount int
PollInterval time.Duration
StopTimeout time.Duration
- ReportError func(error, *Job) // TODO: pass in a stack trace for context
+ ReportError func(error, *Job)
// worker id -> job mapping
work map[string]*Job
@@ -349,7 +349,6 @@ func (w *WorkerConfig) worker(id string) {
func() {
defer func() {
if r := recover(); r != nil {
- // TODO: log stack trace
err = panicToError(r)
}
}() | Remove unnecessary TODOs for stack traces | cupcake_gokiq | train | go |
906771ba16c6e62bd27756d39cef86e82a16abf8 | diff --git a/features.go b/features.go
index <HASH>..<HASH> 100644
--- a/features.go
+++ b/features.go
@@ -29,4 +29,8 @@ var localFeatures = lnwire.NewFeatureVector([]lnwire.Feature{
Name: "sphinx-payload",
Flag: lnwire.RequiredFlag,
},
+ {
+ Name: "htlc-dust-accounting",
+ Flag: lnwire.RequiredFlag,
+ },
}) | features: add temporary feature for proper HTLC dust accounting | lightningnetwork_lnd | train | go |
962fe34c4f35bbc56aa3baf9317ac158e8069460 | diff --git a/lib/ps_utilities/connection.rb b/lib/ps_utilities/connection.rb
index <HASH>..<HASH> 100644
--- a/lib/ps_utilities/connection.rb
+++ b/lib/ps_utilities/connection.rb
@@ -40,7 +40,6 @@ module PsUtilities
def authenticate
@credentials[:access_token] = get_token()
@options[:headers].merge!('Authorization' => 'Bearer ' + @credentials[:access_token])
- pp credentials
raise AuthenticationError.new("Could not authenticate") unless @credentials[:access_token]
@authenticated = true
end | removed extraneous pp commands | LAS-IT_ps_utilities | train | rb |
40ce91a6bc1307e4a706fd266693a64799dfa77b | diff --git a/session_security/static/session_security/script.js b/session_security/static/session_security/script.js
index <HASH>..<HASH> 100644
--- a/session_security/static/session_security/script.js
+++ b/session_security/static/session_security/script.js
@@ -1,6 +1,6 @@
// Simple function that adds a number of seconds to a Date object.
//
-// Example usage, to add two seconds to a date::
+// Example usage, to add two seconds to a date:
//
// d = new Date();
// addSeconds(d, 120);
@@ -11,7 +11,7 @@ function addSeconds(date, seconds) {
}
// An global instance of SessionSecurity is instanciated as such by the default
-// setup (all.html)::
+// setup (all.html):
//
// sessionSecurity = new SessionSecurity();
// sessionSecurity = $.extend(SessionSecurity, {
@@ -113,7 +113,7 @@ var SessionSecurity = function() {
}
this.initialize = function() {
- // precalculate WARN_BEFORE.
+ // Precalculate WARN_BEFORE.
this.WARN_BEFORE = this.EXPIRE_AFTER - this.WARN_AFTER;
// Initiate this.lastActivity. | Corrections in javascript docstrings | yourlabs_django-session-security | train | js |
30be4a2d2476cdc3c2e0c01826c79478f7cc35bc | diff --git a/vertx-sql-client/src/main/java/io/vertx/sqlclient/impl/pool/ConnectionPool.java b/vertx-sql-client/src/main/java/io/vertx/sqlclient/impl/pool/ConnectionPool.java
index <HASH>..<HASH> 100644
--- a/vertx-sql-client/src/main/java/io/vertx/sqlclient/impl/pool/ConnectionPool.java
+++ b/vertx-sql-client/src/main/java/io/vertx/sqlclient/impl/pool/ConnectionPool.java
@@ -242,6 +242,10 @@ public class ConnectionPool {
while (waiters.size() > 0) {
if (available.size() > 0) {
PooledConnection proxy = available.poll();
+ if (proxy == null) {
+ // available is empty?
+ return;
+ }
Handler<AsyncResult<Connection>> waiter = waiters.poll();
waiter.handle(Future.succeededFuture(proxy));
} else { | fix polling null from the available pooled connections | reactiverse_reactive-pg-client | train | java |
d9873914bfaa2b6a0fe14a32200c8bb2c4ee1020 | diff --git a/UWG/UWG.py b/UWG/UWG.py
index <HASH>..<HASH> 100644
--- a/UWG/UWG.py
+++ b/UWG/UWG.py
@@ -73,7 +73,7 @@ class UWG(object):
cpv = 1846.1 #
b = 9.4 # Coefficients derived by Louis (1979)
cm = 7.4 #
- colburn = math.pow((0.713/0.621), (2/3)) # (Pr/Sc)^(2/3) for Colburn analogy in water evaporation
+ colburn = math.pow((0.713/0.621), (2/3.)) # (Pr/Sc)^(2/3) for Colburn analogy in water evaporation
# Site-specific parameters
wgmax = 0.005 # maximum film water depth on horizontal surfaces (m) | integer division mistake, change to float | ladybug-tools_uwg | train | py |
56d9eefac18632aa583b8c1dd5744ef7cc6807e1 | diff --git a/aws/data_source_aws_rds_cluster.go b/aws/data_source_aws_rds_cluster.go
index <HASH>..<HASH> 100644
--- a/aws/data_source_aws_rds_cluster.go
+++ b/aws/data_source_aws_rds_cluster.go
@@ -58,6 +58,12 @@ func dataSourceAwsRdsCluster() *schema.Resource {
Computed: true,
},
+ "enabled_cloudwatch_logs_exports": {
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: &schema.Schema{Type: schema.TypeString},
+ },
+
"endpoint": {
Type: schema.TypeString,
Computed: true, | data-source/aws_rds_cluster: Prevent panic when CloudWatch logs are enabled | terraform-providers_terraform-provider-aws | train | go |
282143d7df90188a78147a38714f4ecda3b1a0ec | diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py
index <HASH>..<HASH> 100644
--- a/tests/integration/__init__.py
+++ b/tests/integration/__init__.py
@@ -209,6 +209,8 @@ def use_cluster(cluster_name, nodes, ipformat=None, start=True):
CCM_CLUSTER.set_configuration_options({'start_native_transport': True})
if CASSANDRA_VERSION >= '2.2':
CCM_CLUSTER.set_configuration_options({'enable_user_defined_functions': True})
+ if CASSANDRA_VERSION >= '3.0':
+ CCM_CLUSTER.set_configuration_options({'enable_scripted_user_defined_functions': True})
common.switch_cluster(path, cluster_name)
CCM_CLUSTER.populate(nodes, ipformat=ipformat)
try: | test: Another UDF config option introduced in C* <I> | datastax_python-driver | train | py |
9f0bbbed30f2fd4e00b7cf5ea5df26ed23bb475c | diff --git a/Kwc/Basic/LinkTag/News/Admin.php b/Kwc/Basic/LinkTag/News/Admin.php
index <HASH>..<HASH> 100644
--- a/Kwc/Basic/LinkTag/News/Admin.php
+++ b/Kwc/Basic/LinkTag/News/Admin.php
@@ -33,9 +33,7 @@ class Kwc_Basic_LinkTag_News_Admin extends Kwc_Basic_LinkTag_Abstract_Admin
$c = Kwf_Component_Data_Root::getInstance()
->getComponentByDbId($linkingRow->component_id);
//$c kann null sein wenn es nicht online ist
- if ($c &&
- is_instance_of($c->componentClass, 'Kwc_Basic_LinkTag_News_Component')
- ) {
+ if ($c && $c->componentClass == $this->_class) {
$ret[] = $c;
}
} | improvement for getComponentsDependingOnRow-fix on linkTag_News | koala-framework_koala-framework | train | php |
7af8efcfb917329810aee150bae454f1bdea1e64 | diff --git a/main_test.go b/main_test.go
index <HASH>..<HASH> 100644
--- a/main_test.go
+++ b/main_test.go
@@ -1092,6 +1092,7 @@ var _ = Describe("Router Integration", func() {
routesUri := fmt.Sprintf("http://%s:%s@%s:%d/routes", config.Status.User, config.Status.Pass, localIP, statusPort)
Eventually(func() bool { return appRegistered(routesUri, runningApp1) }).Should(BeTrue())
+ runningApp1.VerifyAppStatus(200)
heartbeatInterval := 200 * time.Millisecond
runningTicker := time.NewTicker(heartbeatInterval) | Verify app is running before proceeding in test
- the appRegistered call is not sufficient to guarantee that an app is
running
[#<I>] | cloudfoundry_gorouter | train | go |
ac57d6f0ecd78d8ebf6c57b6c37a95945d368127 | diff --git a/datalab/utils/commands/_utils.py b/datalab/utils/commands/_utils.py
index <HASH>..<HASH> 100644
--- a/datalab/utils/commands/_utils.py
+++ b/datalab/utils/commands/_utils.py
@@ -38,6 +38,8 @@ import datalab.data
import datalab.bigquery
import datalab.storage
import datalab.utils
+import google.datalab.bigquery
+import google.datalab.utils
from . import _html
@@ -230,6 +232,10 @@ def get_data(source, fields='*', env=None, first_row=0, count=-1, schema=None):
raise Exception("To get tabular data from a list it must contain dictionaries or lists.")
elif isinstance(source, pandas.DataFrame):
return _get_data_from_dataframe(source, fields, first_row, count, schema)
+ elif (isinstance(source, google.datalab.bigquery.Query) or
+ isinstance(source, google.datalab.bigquery.Table)):
+ return google.datalab.utils.commands._utils.get_data(
+ source, fields, env, first_row, count, schema)
elif isinstance(source, datalab.bigquery.Query):
return _get_data_from_table(source.results(), fields, first_row, count, schema)
elif isinstance(source, datalab.bigquery.Table): | Making old chart magic forward compatible with google.datalab (#<I>)
* Fixing old call to Datasets that wasn't using context.
* Making old chart magic forward compatible with google.datalab. | googledatalab_pydatalab | train | py |
88c0436fa1f21fceea95f8b4c192419dd9bdeaa1 | diff --git a/horizon/forms/fields.py b/horizon/forms/fields.py
index <HASH>..<HASH> 100644
--- a/horizon/forms/fields.py
+++ b/horizon/forms/fields.py
@@ -37,7 +37,7 @@ class DynamicSelectWidget(widgets.Select):
try:
if self.add_item_link_args:
return urlresolvers.reverse(self.add_item_link,
- args=[self.add_item_link_args])
+ args=self.add_item_link_args)
else:
return urlresolvers.reverse(self.add_item_link)
except urlresolvers.NoReverseMatch: | Fix DynamicSelectWidget.get_add_item_url() method.
Do not wrap self.add_item_link_args in an additional list because it
makes impossible to pass more than one arg (i.e. tuple or list of
args) to url resolver.
Change-Id: Idf6d5d1f<I>c<I>f1de<I>a<I>e0f1abbae5ee<I>
Closes-Bug: #<I> | openstack_horizon | train | py |
43829a7d5850957582c6075dbb4a7a17a75e4d5a | diff --git a/tests/build/test_build_request.py b/tests/build/test_build_request.py
index <HASH>..<HASH> 100644
--- a/tests/build/test_build_request.py
+++ b/tests/build/test_build_request.py
@@ -688,7 +688,7 @@ class TestBuildRequest(object):
def test_with_sendmail_plugin(self):
bm = BuildManager(INPUTS_PATH)
build_request = bm.get_build_request_by_type(PROD_BUILD_TYPE)
- build_request.set_openshift_required_version([1, 0, 6])
+ build_request.set_openshift_required_version(parse_version('1.0.6'))
secret_name = 'foo'
kwargs = {
'git_uri': TEST_GIT_URI, | Fix setting openshift version in sendmail plugin test on Python 3 | projectatomic_osbs-client | train | py |
771d78d5d07511ff573805c57a36b123c41dde4c | diff --git a/misuzu/app.py b/misuzu/app.py
index <HASH>..<HASH> 100644
--- a/misuzu/app.py
+++ b/misuzu/app.py
@@ -1,5 +1,7 @@
import asyncio
import logging
+import signal
+from functools import partial
from .router import Router, Param
from .protocol import HttpProtocol
from .test_client import TestClient
@@ -41,14 +43,19 @@ class Misuzu(object):
if debug:
logging.basicConfig(level=logging.DEBUG)
- server_coroutine = loop.create_server(lambda: HttpProtocol(loop=loop, app=self), host, port)
+ def ask_exit():
+ loop.stop()
+
+ for signame in ('SIGINT', 'SIGTERM'):
+ loop.add_signal_handler(getattr(signal, signame), ask_exit)
+
+ server_coroutine = loop.create_server(partial(HttpProtocol, loop=loop, app=self), host, port)
server_loop = loop.run_until_complete(server_coroutine)
try:
- print("run forever")
+ print("server http://{}:{} is running, press Ctrl+C to interrupt.".format(host, port))
loop.run_forever()
- except KeyboardInterrupt:
- print("ctrl+c")
- server_loop.close()
+ finally:
+ server_coroutine.close()
loop.close()
def stop(self): | signal supported, but it seems out of work. | Riparo_nougat | train | py |
24cc4afff65361aa441682c735a0f6d83b70858b | diff --git a/jmetal-core/src/main/java/org/uma/jmetal/core/Algorithm.java b/jmetal-core/src/main/java/org/uma/jmetal/core/Algorithm.java
index <HASH>..<HASH> 100755
--- a/jmetal-core/src/main/java/org/uma/jmetal/core/Algorithm.java
+++ b/jmetal-core/src/main/java/org/uma/jmetal/core/Algorithm.java
@@ -44,9 +44,6 @@ public abstract class Algorithm implements Serializable {
/** Executes the algorithm */
public abstract SolutionSet execute() throws JMetalException, ClassNotFoundException, IOException;
- public Problem getProblem() {
- return problem;
- }
public void setProblem(Problem problem) {
this.problem = problem;
} | Ready to convert jmetal.core.Algorithm into an interface | jMetal_jMetal | train | java |
699aca0b67553b1b72dfc6c98a50ce8081c67372 | diff --git a/src/main/java/org/jpmml/sparkml/ClassificationModelConverter.java b/src/main/java/org/jpmml/sparkml/ClassificationModelConverter.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/jpmml/sparkml/ClassificationModelConverter.java
+++ b/src/main/java/org/jpmml/sparkml/ClassificationModelConverter.java
@@ -73,7 +73,7 @@ public class ClassificationModelConverter<T extends PredictionModel<Vector, T> &
String predictionCol = hasPredictionCol.getPredictionCol();
- OutputField pmmlPredictedField = ModelUtil.createPredictedField(FieldName.create("pmml(" + predictionCol + ")"), DataType.STRING, OpType.CATEGORICAL);
+ OutputField pmmlPredictedField = ModelUtil.createPredictedField(FieldName.create("pmml(" + predictionCol + ")"), categoricalLabel.getDataType(), OpType.CATEGORICAL);
List<String> categories = new ArrayList<>(); | Fixed the data type of the prediction output field | jpmml_jpmml-sparkml | train | java |
f2cfbaa66d60a2df1a126ba286058329a788367e | diff --git a/src/main/java/org/mariadb/jdbc/internal/util/Utils.java b/src/main/java/org/mariadb/jdbc/internal/util/Utils.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/mariadb/jdbc/internal/util/Utils.java
+++ b/src/main/java/org/mariadb/jdbc/internal/util/Utils.java
@@ -133,7 +133,7 @@ public class Utils {
if (socketFactoryClass != null) {
Constructor<? extends SocketFactory> constructor = socketFactoryClass.getConstructor();
socketFactory = constructor.newInstance();
- if (socketFactoryClass.isInstance(ConfigurableSocketFactory.class)) {
+ if (ConfigurableSocketFactory.class.isInstance(socketFactory)) {
((ConfigurableSocketFactory) socketFactory).setConfiguration(options, host);
}
return socketFactory.createSocket(); | Fix - setConfiguration not being called on classes that extend ConfigurableSocketFactory | MariaDB_mariadb-connector-j | train | java |
e0e1f3eeb24cc4d5555cb5ff45a9f6894c283df8 | diff --git a/concrete/src/Entity/Calendar/CalendarEventOccurrence.php b/concrete/src/Entity/Calendar/CalendarEventOccurrence.php
index <HASH>..<HASH> 100644
--- a/concrete/src/Entity/Calendar/CalendarEventOccurrence.php
+++ b/concrete/src/Entity/Calendar/CalendarEventOccurrence.php
@@ -2,6 +2,7 @@
namespace Concrete\Core\Entity\Calendar;
use Doctrine\ORM\Mapping as ORM;
+use Carbon\Carbon;
/**
* @ORM\Entity
@@ -119,8 +120,9 @@ class CalendarEventOccurrence
public function isAllDay()
{
+ $dayDuration = Carbon::create($occurrence->getStart())->startOfDay()->secondsUntilEndOfDay();
$diff = $this->getEnd() - $this->getStart();
- if ($diff == 86399) {
+ if ($diff == $dayDuration) {
return true;
} | Update CalendarEventOccurrence.php
determine dayDuration dynamically in order to make it work properly on DST changing days. | concrete5_concrete5 | train | php |
338713fc7302532902e21fe06240bb0a6b5aa867 | diff --git a/lib/reporters/junit/index.js b/lib/reporters/junit/index.js
index <HASH>..<HASH> 100644
--- a/lib/reporters/junit/index.js
+++ b/lib/reporters/junit/index.js
@@ -20,7 +20,6 @@ JunitReporter = function (newman, reporterOptions) {
root,
testSuitesExecutionTime = 0,
executionTime = 0,
- date,
timestamp;
if (!report) {
@@ -36,8 +35,7 @@ JunitReporter = function (newman, reporterOptions) {
accumulator[execution.id].push(execution);
}, {});
- date = new Date(_.get(newman, 'summary.run.timings.started'));
- timestamp = date.toISOString();
+ timestamp = new Date(_.get(newman, 'summary.run.timings.started')).toISOString();
_.forEach(cache, function (executions, itemId) {
var suite = root.ele('testsuite'), | Removed not needed variable (PR feedback) | postmanlabs_newman | train | js |
98e406657164b053bb045eaaa2a11cc23f2e965f | diff --git a/src/Command/InfectionCommand.php b/src/Command/InfectionCommand.php
index <HASH>..<HASH> 100644
--- a/src/Command/InfectionCommand.php
+++ b/src/Command/InfectionCommand.php
@@ -241,10 +241,10 @@ final class InfectionCommand extends BaseCommand
if (!$constraintChecker->hasTestRunPassedConstraints()) {
$this->consoleOutput->logBadMsiErrorMessage(
- $metricsCalculator,
- $constraintChecker->getMinRequiredValue(),
- $constraintChecker->getErrorType()
- );
+ $metricsCalculator,
+ $constraintChecker->getMinRequiredValue(),
+ $constraintChecker->getErrorType()
+ );
return 1;
} | Fix: Indentation (#<I>) | infection_infection | train | php |
8a5be79ed2a672e57168a9d10a4bbf2c8583c213 | diff --git a/src/controllers/BaseNode.js b/src/controllers/BaseNode.js
index <HASH>..<HASH> 100644
--- a/src/controllers/BaseNode.js
+++ b/src/controllers/BaseNode.js
@@ -271,7 +271,7 @@ class BaseNode {
case 'lte':
return actualValue <= cValue;
case 'starts_with':
- return actualValue.startsWith(cValue);
+ return actualValue && actualValue.startsWith(cValue);
case 'in_group': {
const ent = this.homeAssistant.getStates(cValue);
const groupEntities = | fix(get-entities): Check if property exists before seeing if it starts with something
Fixes #<I> | zachowj_node-red-contrib-home-assistant-websocket | train | js |
3a7add4dce18dc532b7f22652a037cc6156a59b0 | diff --git a/more_itertools/more.py b/more_itertools/more.py
index <HASH>..<HASH> 100644
--- a/more_itertools/more.py
+++ b/more_itertools/more.py
@@ -107,13 +107,16 @@ class peekable(object):
def __iter__(self):
return self
- def __nonzero__(self):
+ def __bool__(self):
try:
self.peek()
except StopIteration:
return False
return True
+ def __nonzero__(self):
+ return self.__bool__()
+
def peek(self, default=_marker):
"""Return the item that will be next returned from ``next()``. | Support __bool__ and __nonzero__ | erikrose_more-itertools | train | py |
43ab8a95149c2e5f2e675a6c393d6c35ed9889c0 | diff --git a/src/test/java/org/elasticsearch/river/twitter/test/Twitter4JThreadFilter.java b/src/test/java/org/elasticsearch/river/twitter/test/Twitter4JThreadFilter.java
index <HASH>..<HASH> 100644
--- a/src/test/java/org/elasticsearch/river/twitter/test/Twitter4JThreadFilter.java
+++ b/src/test/java/org/elasticsearch/river/twitter/test/Twitter4JThreadFilter.java
@@ -39,6 +39,10 @@ public class Twitter4JThreadFilter implements ThreadFilter {
return true;
}
+ if (threadName.contains("riverClusterService#updateTask")) {
+ return true;
+ }
+
return false;
}
} | [test] test does not close properly
`RiverClusterService` `updateTask` method seems to take some time.
For now, let's hide this thread in the thread filter.
(cherry picked from commit <I>fccd0)
(cherry picked from commit <I>c6b<I>) | elastic_elasticsearch-river-twitter | train | java |
d5ee332de78b4ff267a7314840ced02f0b8b737a | diff --git a/lib/suite.js b/lib/suite.js
index <HASH>..<HASH> 100644
--- a/lib/suite.js
+++ b/lib/suite.js
@@ -253,7 +253,7 @@ Suite.prototype.total = function(){
*
* @param {Function} fn
* @return {Suite}
- * @api public
+ * @api private
*/
Suite.prototype.eachTest = function(fn){
@@ -263,4 +263,3 @@ Suite.prototype.eachTest = function(fn){
});
return this;
};
- | make Suite#eachTest() private | mochajs_mocha | train | js |
d371c3e35e5fbd3b5b71cd3187e6d12979bf5ee2 | diff --git a/system/HTTP/URI.php b/system/HTTP/URI.php
index <HASH>..<HASH> 100644
--- a/system/HTTP/URI.php
+++ b/system/HTTP/URI.php
@@ -466,7 +466,7 @@ class URI
throw new \InvalidArgumentException('Request URI segment is our of range.');
}
- return $this->segments[$number];
+ return $this->segments[$number] ?? '';
}
//-------------------------------------------------------------------- | fixed `getSegment`
fixed issue with returning error which the segment is not the one been checked. instead returns just empty | codeigniter4_CodeIgniter4 | train | php |
d3a5cd90cc51eec222dff3d7b19154301e59cad4 | diff --git a/lib/statistrano/deployment/base.rb b/lib/statistrano/deployment/base.rb
index <HASH>..<HASH> 100644
--- a/lib/statistrano/deployment/base.rb
+++ b/lib/statistrano/deployment/base.rb
@@ -93,7 +93,7 @@ module Statistrano
# @return [Void]
def rsync_to_remote remote_path
LOG.msg "Syncing files to remote"
- if system "rsync -aqz --delete-after -e ssh #{local_path}/ #{host_connection}:#{remote_path}/"
+ if system "rsync #{rsync_options} -e ssh #{local_path}/ #{host_connection}:#{remote_path}/"
LOG.success "Files synced to remote"
else
LOG.error "Error syncing files to remote"
@@ -101,6 +101,10 @@ module Statistrano
end
end
+ def rsync_options
+ "-aqz --delete-after"
+ end
+
# gives the host connection for ssh based on config settings
# @return [String]
def host_connection | move rsync options to a method (easier to override) | mailchimp_statistrano | train | rb |
70c24b273f674afe3850e9efb868d29b6aa97c59 | diff --git a/src/models/StripePaymentForm.php b/src/models/StripePaymentForm.php
index <HASH>..<HASH> 100644
--- a/src/models/StripePaymentForm.php
+++ b/src/models/StripePaymentForm.php
@@ -2,7 +2,7 @@
namespace craft\commerce\stripe\models;
-use craft\commerce\models\payments\BasePaymentForm;
+use craft\commerce\models\payments\CreditCardPaymentForm;
use craft\commerce\models\PaymentSource;
use craft\commerce\stripe\Plugin;
@@ -12,7 +12,7 @@ use craft\commerce\stripe\Plugin;
* @author Pixel & Tonic, Inc. <[email protected]>
* @since 1.0
*/
-class StripePaymentForm extends BasePaymentForm
+class StripePaymentForm extends CreditCardPaymentForm
{
/**
@@ -20,11 +20,6 @@ class StripePaymentForm extends BasePaymentForm
*/
public $customer;
- /**
- * @var string Token
- */
- public $token;
-
// Public methods
// =========================================================================
/** | Well, they are, actually. So stupid. | craftcms_commerce-stripe | train | php |
dea7e4f6404b3746141f64310dbcd627a458c3c2 | diff --git a/Qt.py b/Qt.py
index <HASH>..<HASH> 100644
--- a/Qt.py
+++ b/Qt.py
@@ -874,3 +874,7 @@ del(_QtWidgets)
del(_bindings)
del(_binding)
del(_found_binding)
+
+# Enable command-line interface
+if __name__ == "__main__":
+ _cli(sys.argv[1:])
diff --git a/tests.py b/tests.py
index <HASH>..<HASH> 100644
--- a/tests.py
+++ b/tests.py
@@ -303,6 +303,15 @@ def test_strict():
assert not hasattr(QtGui, "QWidget")
+def test_cli():
+ """Qt.py is available from the command-line"""
+ os.environ.pop("QT_VERBOSE")
+ popen = subprocess.Popen([sys.executable, "Qt.py", "--help"],
+ stdout=subprocess.PIPE)
+ out, err = popen.communicate()
+ assert out.startswith("usage: Qt.py")
+
+
if binding("PyQt4"):
def test_preferred_pyqt4():
"""QT_PREFERRED_BINDING = PyQt4 properly forces the binding""" | Re-enable command-line interface. | mottosso_Qt.py | train | py,py |
6e6cb8f56c6840034a1f711d28907cbc7e5fa81f | diff --git a/lib/puppet/type/notify.rb b/lib/puppet/type/notify.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/type/notify.rb
+++ b/lib/puppet/type/notify.rb
@@ -13,7 +13,7 @@ module Puppet
when :true:
log(self.should)
else
- Puppet::info(self.should)
+ Puppet.send(@parent[:loglevel], self.should)
end
return
end
@@ -29,9 +29,7 @@ module Puppet
end
newparam(:withpath) do
- desc "Whether to not to show the full object path. If true, the message
- will be sent to the client at the current loglevel. If false,
- the message will be sent to the client at the info level."
+ desc "Whether to not to show the full object path. Sends the message at the current loglevel."
defaultto :true
newvalues(:true, :false)
end | Messages will now be at current loglevel, regardless of whether the object path is displayed.
git-svn-id: <URL> | puppetlabs_puppet | train | rb |
f5a3f9630fe369b922dde75fb9eaf1e7a71ad0f9 | diff --git a/src/mg/Ding/Aspect/Interceptor/DispatcherImpl.php b/src/mg/Ding/Aspect/Interceptor/DispatcherImpl.php
index <HASH>..<HASH> 100644
--- a/src/mg/Ding/Aspect/Interceptor/DispatcherImpl.php
+++ b/src/mg/Ding/Aspect/Interceptor/DispatcherImpl.php
@@ -174,8 +174,10 @@ class DispatcherImpl implements IDispatcher
public function invokeException(MethodInvocation $invocation)
{
$interceptors = $this->getExceptionInterceptors($method = $invocation->getMethod());
- if ($interceptors != false) {
+ if ($interceptors != false && !empty($interceptors)) {
return $this->_callInterceptors($invocation, $interceptors);
+ } else {
+ throw $invocation->getException();
}
return $invocation->proceed();
} | fix for throwing an exception inside an aspect | marcelog_Ding | train | php |
5b1fcb1d706717e6f5da543a0118914a78097de2 | diff --git a/collision.go b/collision.go
index <HASH>..<HASH> 100644
--- a/collision.go
+++ b/collision.go
@@ -16,6 +16,16 @@ type SpaceComponent struct {
Height float32
}
+// Center positions the space component according to its center instead of its
+// top-left point (this avoids doing the same math each time in your systems)
+func (sc *SpaceComponent) Center(p Point) {
+ xDelta := sc.Width / 2
+ yDelta := sc.Height / 2
+ // update position according to point being used as our center
+ sc.Position.X = p.X - xDelta
+ sc.Position.Y = p.Y - yDelta
+}
+
func (*SpaceComponent) Type() string {
return "SpaceComponent"
} | Adding a convenience method to center a SpaceComponent on a point | EngoEngine_engo | train | go |
4db26c659d9b35159f6f115320c0d56153a307d4 | diff --git a/phylopandas/seqio/read.py b/phylopandas/seqio/read.py
index <HASH>..<HASH> 100644
--- a/phylopandas/seqio/read.py
+++ b/phylopandas/seqio/read.py
@@ -164,7 +164,11 @@ def read_blast_xml(filename, **kwargs):
'title': [],
'length': [],
'e_value': [],
- 'sequence': []}
+ 'sequence': [],
+ 'subject_start': [],
+ 'subject_end':[],
+ 'query_start':[],
+ 'query_end':[]}
# Get alignments from blast result.
for i, s in enumerate(blast_record.alignments):
@@ -175,6 +179,10 @@ def read_blast_xml(filename, **kwargs):
data['length'].append(s.length)
data['e_value'].append(s.hsps[0].expect)
data['sequence'].append(s.hsps[0].sbjct)
+ data['subject_start'].append(s.hsps[0].sbjct_start)
+ data['subject_end'].append(s.hsps[0].sbjct_end)
+ data['query_start'].append(s.hsps[0].query_start)
+ data['query_end'].append(s.hsps[0].query_end)
# Port to DataFrame.
return pd.DataFrame(data) | read more information from blast xml file | Zsailer_phylopandas | train | py |
aa3541727eceae2abe2d6bb07a579ff584282750 | diff --git a/openfisca_core/taxbenefitsystems.py b/openfisca_core/taxbenefitsystems.py
index <HASH>..<HASH> 100644
--- a/openfisca_core/taxbenefitsystems.py
+++ b/openfisca_core/taxbenefitsystems.py
@@ -8,6 +8,8 @@ from os import path
from imp import find_module, load_module
import importlib
import logging
+import inspect
+import pkg_resources
from setuptools import find_packages
@@ -274,3 +276,11 @@ class TaxBenefitSystem(object):
if self._legislation_json is None:
self.compute_legislation(with_source_file_infos = with_source_file_infos)
return self._legislation_json
+
+
+ @classmethod
+ def get_package_metadata(cls):
+ package_name = inspect.getmodule(cls).__package__
+ distribution = pkg_resources.get_distribution(package_name)
+
+ return distribution.key, distribution.version | Introduce tax_benefit_system.get_package_metadata | openfisca_openfisca-core | train | py |
b4c1588d9759f5e46e629088a51492806cfd7518 | diff --git a/lib/proxy/mobproxy.js b/lib/proxy/mobproxy.js
index <HASH>..<HASH> 100644
--- a/lib/proxy/mobproxy.js
+++ b/lib/proxy/mobproxy.js
@@ -180,9 +180,11 @@ Proxy.prototype.saveHar = function(filename, data, cb) {
for (var i = 0; i < theHar.log.pages.length; i++) {
theHar.log.pages[i].comment = data.url;
theHar.log.pages[i].title = data.url + '_' + i; // get the title in the future
+ if (data.data[i]) {
theHar.log.pages[i].pageTimings.onContentLoad = data.data[i].timings.domContentLoadedTime;
theHar.log.pages[i].pageTimings.onLoad = data.data[i].timings.pageLoadTime;
}
+ }
fs.writeFile(filename, JSON.stringify(theHar), function(err) {
return cb(err);
}); | catching har without timings for pages that times out, part 1 | sitespeedio_browsertime | train | js |
e72cf20c323b4167862ec03abf5bf4814726bc9a | diff --git a/spec/support/example_server/servlet.rb b/spec/support/example_server/servlet.rb
index <HASH>..<HASH> 100644
--- a/spec/support/example_server/servlet.rb
+++ b/spec/support/example_server/servlet.rb
@@ -7,12 +7,12 @@ class ExampleServer
res.body = 'Not Found'
end
+ def self.handlers
+ @handlers ||= {}
+ end
+
%w(get post head).each do |method|
class_eval <<-RUBY, __FILE__, __LINE__
- def self.handlers
- @handlers ||= {}
- end
-
def self.#{method}(path, &block)
handlers["#{method}:\#{path}"] = block
end | Fix example server servlet multiple re-defining of handlers getter | httprb_http | train | rb |
ae077d0f8c3a57d30bbc3828925381e24e13d8e2 | diff --git a/lib/cadmus/page.rb b/lib/cadmus/page.rb
index <HASH>..<HASH> 100644
--- a/lib/cadmus/page.rb
+++ b/lib/cadmus/page.rb
@@ -13,7 +13,7 @@ module Cadmus
belongs_to :parent, :polymorphic => true
validates_presence_of name_field
- validates_uniqueness_of slug_field, :within => [:parent_id, :parent_type]
+ validates_uniqueness_of slug_field, :scope => [:parent_id, :parent_type]
validates_exclusion_of slug_field, :in => %w(pages edit)
scope :global, :conditions => { :parent_id => nil, :parent_type => nil } | it's :scope, not :within | gively_cadmus | train | rb |
3205dab29e0b9d04d1771d88c6d240a67eaa7ee7 | diff --git a/sizedwaitgroup.go b/sizedwaitgroup.go
index <HASH>..<HASH> 100644
--- a/sizedwaitgroup.go
+++ b/sizedwaitgroup.go
@@ -46,15 +46,15 @@ func New(limit int) SizedWaitGroup {
//
// See sync.WaitGroup documentation for more information.
func (s *SizedWaitGroup) Add() {
- s.wg.Add(1)
s.current <- true
+ s.wg.Add(1)
}
// Done decrements the SizedWaitGroup counter.
// See sync.WaitGroup documentation for more information.
func (s *SizedWaitGroup) Done() {
- s.wg.Done()
<-s.current
+ s.wg.Done()
}
// Wait blocks until the SizedWaitGroup counter is zero. | sizedwaitgroup: notify the wg after having blocked. | remeh_sizedwaitgroup | train | go |
1ddbe3735f46ba3961e458c489b4c3c0f62ced0f | diff --git a/lib/Thelia/Handler/ExportHandler.php b/lib/Thelia/Handler/ExportHandler.php
index <HASH>..<HASH> 100644
--- a/lib/Thelia/Handler/ExportHandler.php
+++ b/lib/Thelia/Handler/ExportHandler.php
@@ -179,9 +179,13 @@ class ExportHandler
$rangeDate['end'] = \DateTime::createFromFormat(
'Y-m-d H:i:s',
$endYear.'-'.$endMonth.'-1 23:59:59'
- )
- ->add(new \DateInterval('P1M'))
- ->sub(new \DateInterval('P1D'));
+ );
+
+ if ($rangeDate instanceof \DateTime) {
+ $rangeDate
+ ->add(new \DateInterval('P1M'))
+ ->sub(new \DateInterval('P1D'));
+ }
}
$instance->setRangeDate($rangeDate); | Fix export with no date (#<I>) | thelia_core | train | php |
2c168da0cbde3b021b17d5b9a74ace444d2770e3 | diff --git a/validator/webapp.py b/validator/webapp.py
index <HASH>..<HASH> 100644
--- a/validator/webapp.py
+++ b/validator/webapp.py
@@ -192,7 +192,8 @@ def test_webapp(err, webapp, current_valid_keys, required=True):
err.get_resource("listed")):
err.error(
err_id=("webapp", "detect", "iaf_no_amo"),
- error="Webapp: Webapps must list AMO for inclusion.",
+ error=("Apps: App must allow installs from Firefox Market"
+ " for inclusion."),
description="To be included on %s, a webapp needs to "
"include %s as an element in the "
"'installs_allowed_from' property." % | Better summary for app manifests that don't list the market (bug <I>) | mozilla_amo-validator | train | py |
b87b684b36cf5adbe4dca208aed0c69c44fc44c4 | diff --git a/xarray/backends/api.py b/xarray/backends/api.py
index <HASH>..<HASH> 100644
--- a/xarray/backends/api.py
+++ b/xarray/backends/api.py
@@ -806,7 +806,7 @@ def save_mfdataset(datasets, paths, mode='w', format=None, groups=None,
for obj in datasets:
if not isinstance(obj, Dataset):
raise TypeError('save_mfdataset only supports writing Dataset '
- 'objects, recieved type %s' % type(obj))
+ 'objects, received type %s' % type(obj))
if groups is None:
groups = [None] * len(datasets)
diff --git a/xarray/core/missing.py b/xarray/core/missing.py
index <HASH>..<HASH> 100644
--- a/xarray/core/missing.py
+++ b/xarray/core/missing.py
@@ -57,7 +57,7 @@ class NumpyInterpolator(BaseInterpolator):
if self.cons_kwargs:
raise ValueError(
- 'recieved invalid kwargs: %r' % self.cons_kwargs.keys())
+ 'received invalid kwargs: %r' % self.cons_kwargs.keys())
if fill_value is None:
self._left = np.nan | Fix spelling -- change recieved to received (#<I>) | pydata_xarray | train | py,py |
d87f045a69fbe025bda01320da500f367e0a17a8 | diff --git a/webhooks.go b/webhooks.go
index <HASH>..<HASH> 100644
--- a/webhooks.go
+++ b/webhooks.go
@@ -13,6 +13,7 @@ var formDecoder *schema.Decoder
func init() {
formDecoder = schema.NewDecoder()
formDecoder.SetAliasTag("form")
+ formDecoder.IgnoreUnknownKeys(true)
}
func DecodeWebhook(data url.Values, out interface{}) error { | Form decoder: ignore unknown keys
The twilio API adds new fields frequently, which isn't a breaking change. However, the decoder currently throws an error if it encounters a key in the data that doesn't match a key in the struct. This change insructs the decoder to ignore unknown keys. | sfreiberg_gotwilio | train | go |
Subsets and Splits