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
|
---|---|---|---|---|---|
7e1140e20adb9d9b65a13c7ad380c4c692c98b12 | diff --git a/src/WorkerPool.php b/src/WorkerPool.php
index <HASH>..<HASH> 100644
--- a/src/WorkerPool.php
+++ b/src/WorkerPool.php
@@ -531,13 +531,17 @@ class WorkerPool implements \Iterator, \Countable {
$result = $socket->receive();
$possibleArrayKeys = array('data', 'poolException', 'workerException');
- if (is_array($result) && count(array_intersect(array_keys($result), $possibleArrayKeys)) === 1) {
+ if (is_array($result) && count(($resultTypes = array_intersect(array_keys($result), $possibleArrayKeys))) === 1) {
// If the result has the expected format, free the worker and store the result.
// Otherwise, the worker may be abnormally terminated (fatal error, exit(), ...) and will
// fall in the reapers arms.
$this->workerProcesses->registerFreeProcessId($processId);
$result['pid'] = $processId;
- array_push($this->results, $result);
+ $resultType = reset($resultTypes);
+ // Do not store NULL
+ if ($resultType !== 'data' || $result['data'] !== NULL) {
+ array_push($this->results, $result);
+ }
}
}
// dispatch signals | Do not store worker result NULL. | qxsch_WorkerPool | train | php |
dae67acaffd3cc03b740a5e14fba34a225801008 | diff --git a/spec/sprinkle/verify_spec.rb b/spec/sprinkle/verify_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/sprinkle/verify_spec.rb
+++ b/spec/sprinkle/verify_spec.rb
@@ -91,8 +91,8 @@ describe Sprinkle::Verify do
@verification.commands.should include("test `version` == \"one\"")
end
- it 'should use id to check for user in group' do
- @verification.commands.should include("id -G alf | xargs -n1 echo | grep alien")
+ it 'should use to check for user in group' do
+ @verification.commands.should include("id -nG alf | xargs -n1 echo | grep alien")
end
it 'should use id to check for user' do | update verify test for the new group detection command | sprinkle-tool_sprinkle | train | rb |
e9946c3f6cc38e73c9c5585816e5856634798294 | diff --git a/test/api/connectivity_test.js b/test/api/connectivity_test.js
index <HASH>..<HASH> 100644
--- a/test/api/connectivity_test.js
+++ b/test/api/connectivity_test.js
@@ -76,10 +76,12 @@ describe('Reconnection', function() {
});
});
after(function() {
+ client.close();
server1.forceShutdown();
server2.forceShutdown();
});
it('Should end with either OK or UNAVAILABLE when querying a server that is shutting down', function(done) {
+ this.timeout(10000);
let pendingCalls = 0;
let testDone = false;
let callInterval;
@@ -94,7 +96,8 @@ describe('Reconnection', function() {
server2.bindAsync(`localhost:${port}`, serverCreds, (err) => {
assert.ifError(err);
server2.start();
- client.unary({}, (err, data) => {
+ const metadata = new clientGrpc.Metadata({ waitForReady: true });
+ client.unary({}, metadata, (err, data) => {
assert.ifError(err);
clearInterval(callInterval);
testDone = true;
@@ -103,6 +106,7 @@ describe('Reconnection', function() {
});
});
callInterval = setInterval(() => {
+ assert.strictEqual(testDone, false);
pendingCalls += 1;
client.unary({}, (err, data) => {
pendingCalls -= 1; | test: make connctivity test more robust
The key change here is forcing the final unary call to
wait for the server to be ready. The native client was
making the RPC, but didn't appear to have a valid
connection at the time. | grpc_grpc-node | train | js |
f60bc08300c5e246298e9a34f3e55148c4dd7e0c | diff --git a/Kwf/Controller/Action/Cli/Web/ClearCacheWatcherController.php b/Kwf/Controller/Action/Cli/Web/ClearCacheWatcherController.php
index <HASH>..<HASH> 100644
--- a/Kwf/Controller/Action/Cli/Web/ClearCacheWatcherController.php
+++ b/Kwf/Controller/Action/Cli/Web/ClearCacheWatcherController.php
@@ -82,7 +82,7 @@ class Kwf_Controller_Action_Cli_Web_ClearCacheWatcherController extends Kwf_Cont
}
}
- $cmd = "inotifywait -e modify -e create -e delete -e move -e moved_to -e moved_from -r --monitor --exclude 'magick|\.nfs|\.git|.*\.kate-swp|~|cache|log|temp|data/index' ".implode(' ', $watchPaths);
+ $cmd = "inotifywait -e modify -e create -e delete -e move -e moved_to -e moved_from -r --monitor --exclude 'magick|\.nfs|\.git|.*\.kate-swp|~|cache|log|temp/|data/index' ".implode(' ', $watchPaths);
echo $cmd."\n";
$descriptorspec = array(
1 => array("pipe", "w"), | don't disable ccw in template web | koala-framework_koala-framework | train | php |
558017dcf0e041688d8f096302647fd8041ebde2 | diff --git a/src/core/components/pubsub.js b/src/core/components/pubsub.js
index <HASH>..<HASH> 100644
--- a/src/core/components/pubsub.js
+++ b/src/core/components/pubsub.js
@@ -24,7 +24,7 @@ module.exports = function pubsub (self) {
}
self._pubsub.on(topic, handler)
- setImmediate(() => callback())
+ setImmediate(cb)
}
if (!callback) { | fix(pubsub): subscribe promises (#<I>) | ipfs_js-ipfs | train | js |
5386dc5c9d39175cc91fa05ce96948b7b670d326 | diff --git a/src/main/java/org/jfrog/hudson/ArtifactsDeployer.java b/src/main/java/org/jfrog/hudson/ArtifactsDeployer.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/jfrog/hudson/ArtifactsDeployer.java
+++ b/src/main/java/org/jfrog/hudson/ArtifactsDeployer.java
@@ -89,7 +89,7 @@ public class ArtifactsDeployer {
.addProperty("build.parentNumber", parent.getUpstreamBuild() + "");
}
EnvVars envVars = mavenBuild.getEnvironment(listener);
- String revision = envVars.get("SVN_REVISION");
+ String revision = mavenModuleSetBuild.getEnvironment(listener).get("SVN_REVISION");
if (StringUtils.isNotBlank(revision)) {
builder.addProperty(BuildInfoProperties.PROP_VCS_REVISION, revision);
} | HAP-<I> - Should send vcs.Revision like Gradle artifactory plugin | jenkinsci_artifactory-plugin | train | java |
ae5e3669296a96b3519595a198d48ec65bea2ed3 | diff --git a/app/helpers/staypuft/deployments_helper.rb b/app/helpers/staypuft/deployments_helper.rb
index <HASH>..<HASH> 100644
--- a/app/helpers/staypuft/deployments_helper.rb
+++ b/app/helpers/staypuft/deployments_helper.rb
@@ -54,8 +54,7 @@ module Staypuft
def host_disks(host)
hosts_facts = FactValue.joins(:fact_name).where(host_id: host.id)
- blockdevices = host.blockdevices.nil? ? [] : host.blockdevices
- blockdevices.collect do |blockdevice|
+ host.blockdevices.collect do |blockdevice|
disk_size = hosts_facts.
where(fact_names: { name: 'blockdevice_#{blockdevice}_size'}).first.try(:value)
"#{blockdevice}: #{disk_size or 'Unknown'}"
diff --git a/app/models/staypuft/concerns/host_details_helper.rb b/app/models/staypuft/concerns/host_details_helper.rb
index <HASH>..<HASH> 100644
--- a/app/models/staypuft/concerns/host_details_helper.rb
+++ b/app/models/staypuft/concerns/host_details_helper.rb
@@ -57,7 +57,7 @@ module Staypuft
if self.facts_hash["blockdevices"]
self.facts_hash["blockdevices"].split(",")
else
- nil
+ []
end
end
end | Remove the need for explicit nil check on blockdevices | theforeman_staypuft | train | rb,rb |
42d2b696d14856803190b42954a3e3152c99b1c5 | diff --git a/src/JMS/Serializer/SerializerBuilder.php b/src/JMS/Serializer/SerializerBuilder.php
index <HASH>..<HASH> 100644
--- a/src/JMS/Serializer/SerializerBuilder.php
+++ b/src/JMS/Serializer/SerializerBuilder.php
@@ -464,7 +464,7 @@ class SerializerBuilder
return;
}
- if (false === @mkdir($dir, 0777, true)) {
+ if (false === @mkdir($dir, 0777, true) && false === is_dir($dir)) {
throw new RuntimeException(sprintf('Could not create directory "%s".', $dir));
}
} | check that cache directory was not created somewhere else before throwing exception
In heavy load environment each deploy without warmed up cache triggers cache directory to be created. Due to race conditions some of the requests will win, others lose. To avoid <I> errors for others it makes sense to check one more time that directory was not actually created | schmittjoh_serializer | train | php |
f0720fc6c29851ae876c4e0da6cd7bfec611ac29 | diff --git a/src/WP_CLI/CommandWithUpgrade.php b/src/WP_CLI/CommandWithUpgrade.php
index <HASH>..<HASH> 100755
--- a/src/WP_CLI/CommandWithUpgrade.php
+++ b/src/WP_CLI/CommandWithUpgrade.php
@@ -16,6 +16,9 @@ abstract class CommandWithUpgrade extends \WP_CLI_Command {
protected $chained_command = false;
+ // Invalid version message.
+ const INVALID_VERSION_MESSAGE = 'version higher than expected';
+
public function __construct() {
// Do not automatically check translations updates after updating plugins/themes. | Revert removal of invalid version message constant | wp-cli_extension-command | train | php |
f9adf049f7ce11c6ba769572708bfca0fb772c3b | diff --git a/generators/server/templates/src/main/java/package/config/_WebConfigurer.java b/generators/server/templates/src/main/java/package/config/_WebConfigurer.java
index <HASH>..<HASH> 100644
--- a/generators/server/templates/src/main/java/package/config/_WebConfigurer.java
+++ b/generators/server/templates/src/main/java/package/config/_WebConfigurer.java
@@ -202,6 +202,9 @@ public class WebConfigurer implements ServletContextInitializer, EmbeddedServlet
source.registerCorsConfiguration("/api/**", config);
source.registerCorsConfiguration("/v2/api-docs", config);
source.registerCorsConfiguration("/oauth/**", config);
+ <%_ if (applicationType == 'gateway') { _%>
+ source.registerCorsConfiguration("/*/api/**", config);
+ <%_ } _%>
return new CorsFilter(source);
}<% if (devDatabaseType == 'h2Disk' || devDatabaseType == 'h2Memory') { %> | Add URL CORS filter to gateway (#<I>)
Add URL CORS filter that mappings to microservices in gateway | jhipster_generator-jhipster | train | java |
8eb82c5c33b725c75751b7ca96494107bf401a8c | diff --git a/Writer/CSV.php b/Writer/CSV.php
index <HASH>..<HASH> 100644
--- a/Writer/CSV.php
+++ b/Writer/CSV.php
@@ -34,7 +34,8 @@ class CSV extends AbstractWriter
//
ini_set("default_charset", 'UTF-8');
- if (version_compare(PHP_VERSION, '5.6.0', '<')) {
+
+ if (PHP_VERSION_ID < 50600) {
iconv_set_encoding('internal_encoding', 'UTF-8');
}
/* | Updated for PHP <I> compat | belgattitude_soluble-flexstore | train | php |
0c6b7c73e21392d19e76a28f591617ebbe99ce94 | diff --git a/python/microcontroller/esp8266.py b/python/microcontroller/esp8266.py
index <HASH>..<HASH> 100644
--- a/python/microcontroller/esp8266.py
+++ b/python/microcontroller/esp8266.py
@@ -1,4 +1,4 @@
-from mcp import Pin as pin
+from microcontroller import Pin as pin
pin.GPIO0=pin(0)
pin.GPIO1=pin(1)
diff --git a/python/microcontroller/stm32.py b/python/microcontroller/stm32.py
index <HASH>..<HASH> 100644
--- a/python/microcontroller/stm32.py
+++ b/python/microcontroller/stm32.py
@@ -1,4 +1,4 @@
-from mcp import Pin as pin
+from microcontroller import Pin as pin
pin.A0=pin('A0')
pin.A1=pin('A1') | Moved Pin definition back so that __module__ properly rendered by repr(). Fear of circular dependency was red herring - was just too many levels of recursion. | adafruit_Adafruit_Blinka | train | py,py |
3fee74cfbce6569bb81ade8e813ff7fdf7a32ab7 | diff --git a/tests/classes/Gems/Controller/OrganizationControllerTest.php b/tests/classes/Gems/Controller/OrganizationControllerTest.php
index <HASH>..<HASH> 100644
--- a/tests/classes/Gems/Controller/OrganizationControllerTest.php
+++ b/tests/classes/Gems/Controller/OrganizationControllerTest.php
@@ -92,6 +92,9 @@ class OrganizationControllerTest extends ControllerTestAbstract
$expected = file_get_contents($this->getPath() . '/' . $expectedFile);
$datasetName = $this->getDataSetAsString(false);
+ // Make sure there is exactly one exported file
+ $this->assertEquals(1, $iterator->count(), sprintf('Number of files does not match expected.', $iterator->count()));
+
foreach ($iterator as $fileName => $fileInfo) {
if ($type == "StreamingExcelExport") {
// We extract the sheet1 and compare that to the saved (expected) sheet1 | Make test fail if no file is exported - triggered by undetected bug introduced in 5b4da2fccd6bd<I>a1a8b<I>d<I>c<I>b<I> | GemsTracker_gemstracker-library | train | php |
9c52b11e2a92a2c5f78d18ae95ba8d79b149d9e2 | diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go
index <HASH>..<HASH> 100644
--- a/integration-cli/docker_cli_daemon_test.go
+++ b/integration-cli/docker_cli_daemon_test.go
@@ -1587,9 +1587,8 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterGracefulShutdown(c *check.C) {
// Send SIGINT and daemon should clean up
c.Assert(s.d.cmd.Process.Signal(os.Interrupt), check.IsNil)
-
- // Wait a bit for the daemon to handle cleanups.
- time.Sleep(3 * time.Second)
+ // Wait for the daemon to stop.
+ c.Assert(<-s.d.wait, checker.IsNil)
mountOut, err := ioutil.ReadFile("/proc/self/mountinfo")
c.Assert(err, check.IsNil, check.Commentf("Output: %s", mountOut)) | TestCleanupMountsAfterGracefulShutdown wait for daemon exit | moby_moby | train | go |
4f92b3430119e734dea39ab4f4636e64d2c26903 | diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index <HASH>..<HASH> 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -1565,14 +1565,12 @@ jQuery.extend({
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + s + wrap[2];
while ( wrap[0]-- ) div = div.firstChild;
-
- // Have to loop through the childNodes here to
- // prevent a Safari crash with text nodes and /n characters
- for ( var j = 0; j < div.childNodes.length; j++ )
- r.push( div.childNodes[j] );
+ arg = div.childNodes;
}
- else if ( arg.length != undefined && !arg.nodeType ) // Handles Array, jQuery, DOM NodeList collections
- for ( var n = 0; n < arg.length; n++ )
+
+
+ if ( arg.length != undefined && ( (jQuery.browser.safari && typeof arg == 'function') || !arg.nodeType ) ) // Safari reports typeof on a DOM NodeList to be a function
+ for ( var n = 0; n < arg.length; n++ ) // Handles Array, jQuery, DOM NodeList collections
r.push(arg[n]);
else
r.push( arg.nodeType ? arg : document.createTextNode(arg.toString()) ); | Fix jQuery.clean to work with Safari and DOM NodeLists | jquery_jquery | train | js |
1e1491d05efefb07dc3da66dee9057110851eaf9 | diff --git a/demands/__init__.py b/demands/__init__.py
index <HASH>..<HASH> 100644
--- a/demands/__init__.py
+++ b/demands/__init__.py
@@ -134,8 +134,11 @@ class HTTPServiceClient(Session):
expected_codes = request_params.get('expected_response_codes', [])
response.is_ok = response.status_code < 300
if not (response.is_ok or response.status_code in expected_codes):
- log.error(
- 'Unexpected response from %s: url: %s, code: %s, details: %s',
- self.__class__.__name__, response.url, response.status_code,
- response.content)
- raise HTTPServiceError(response)
+ self.log_and_raise_error(response)
+
+ def log_and_raise_error(self, response):
+ log.error(
+ 'Unexpected response from %s: url: %s, code: %s, details: %s',
+ self.__class__.__name__, response.url, response.status_code,
+ response.content)
+ raise HTTPServiceError(response) | Refactor error handling to allow use by custom post_send | yola_demands | train | py |
e32aaa28a69b7165d2e34e166a890bca39805003 | diff --git a/src/Twig/Runtime/RecordRuntime.php b/src/Twig/Runtime/RecordRuntime.php
index <HASH>..<HASH> 100644
--- a/src/Twig/Runtime/RecordRuntime.php
+++ b/src/Twig/Runtime/RecordRuntime.php
@@ -198,9 +198,7 @@ class RecordRuntime
$finder = $this->templatesDir->find()
->files()
->notName('/^_/')
- ->exclude('node_modules')
- ->exclude('bower_components')
- ->exclude('.sass-cache')
+ ->exclude(['node_modules', 'bower_components', '.sass-cache'])
->depth('<4')
->path($name)
->sortByName() | Keep excludes together.
#<I> | bolt_bolt | train | php |
3c54a9b168bd46eb8c96b94c7a7a25785c38027d | diff --git a/scvelo/tools/dynamical_model_utils.py b/scvelo/tools/dynamical_model_utils.py
index <HASH>..<HASH> 100644
--- a/scvelo/tools/dynamical_model_utils.py
+++ b/scvelo/tools/dynamical_model_utils.py
@@ -663,8 +663,8 @@ def curve_dists(
class BaseDynamics:
def __init__(
self,
- adata=None,
- gene=None,
+ adata,
+ gene,
u=None,
s=None,
use_raw=False, | Update BaseDynamics default keywords
Instantiating `BaseDynamics` without specifying any keywords fails. At
least `adata` and `gene` need to be specified. | theislab_scvelo | train | py |
7c70db859e2f3c07e6a4e78fe4357b6fbbfd0338 | diff --git a/ui/src/utils/escape-key.js b/ui/src/utils/escape-key.js
index <HASH>..<HASH> 100644
--- a/ui/src/utils/escape-key.js
+++ b/ui/src/utils/escape-key.js
@@ -1,13 +1,24 @@
import { isKeyCode } from './key-composition.js'
let handlers = []
+let escDown = false
export default {
__install () {
this.__installed = true
+ window.addEventListener('keydown', evt => {
+ escDown = evt.keyCode === 27
+ })
+ window.addEventListener('blur', () => {
+ escDown === true && (escDown = false)
+ })
window.addEventListener('keyup', evt => {
- if (handlers.length !== 0 && isKeyCode(evt, 27) === true) {
- handlers[handlers.length - 1].fn(evt)
+ if (escDown === true) {
+ escDown = false
+
+ if (handlers.length !== 0 && isKeyCode(evt, 27) === true) {
+ handlers[handlers.length - 1].fn(evt)
+ }
}
})
}, | feat(EscapeKey): Only accept ESC key if it was pressed while the app had focus #<I> (#<I>) | quasarframework_quasar | train | js |
43746c9f04c5eaf89c0d32a3536705ef1bfd997a | diff --git a/lib/podio/models/application.rb b/lib/podio/models/application.rb
index <HASH>..<HASH> 100644
--- a/lib/podio/models/application.rb
+++ b/lib/podio/models/application.rb
@@ -15,6 +15,7 @@ class Podio::Application < ActivePodio::Base
property :link, :string
property :url_add, :string
property :token, :string
+ property :url_label, :string
# When app is returned as part of large collection (e.g. for stream), some config properties is moved to the main object
property :name, :string | Added missing url_label property to application model. Fixes #<I> | podio_podio-rb | train | rb |
0042193612e587d02b98015eed2048cbb793a4b7 | diff --git a/leaflet.wms.js b/leaflet.wms.js
index <HASH>..<HASH> 100644
--- a/leaflet.wms.js
+++ b/leaflet.wms.js
@@ -52,16 +52,15 @@ L.WMS.Source = L.Layer.extend({
}
},
- 'onAdd': function(map) {
- if (this.options.identify) {
- map.on('click', this.identify, this);
- }
+ 'onAdd': function() {
this.refreshOverlay();
},
- 'onRemove': function(map) {
+ 'getEvents': function() {
if (this.options.identify) {
- map.off('click', this.identify);
+ return {'click': this.identify};
+ } else {
+ return {};
}
},
@@ -283,8 +282,7 @@ L.WMS.Overlay = L.Layer.extend({
return this.options.attribution;
},
- 'onAdd': function(map) {
- this._map = map;
+ 'onAdd': function() {
this.update();
}, | use getEvents to register click handler | heigeo_leaflet.wms | train | js |
82b23f37c7d550ef845528b69e46f07e0e09ae9a | diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Database/Schema/Blueprint.php
+++ b/src/Illuminate/Database/Schema/Blueprint.php
@@ -639,11 +639,11 @@ class Blueprint {
/**
* Add a "deleted at" timestamp for the table.
*
- * @return void
+ * @return \Illuminate\Support\Fluent
*/
public function softDeletes()
{
- $this->timestamp('deleted_at')->nullable();
+ return $this->timestamp('deleted_at')->nullable();
}
/**
@@ -675,11 +675,11 @@ class Blueprint {
/**
* Adds the `remember_token` column to the table.
*
- * @return void
+ * @return \Illuminate\Support\Fluent
*/
public function rememberToken()
{
- $this->string('remember_token', 100)->nullable();
+ return $this->string('remember_token', 100)->nullable();
}
/** | Return Illuminate\Support\Fluent when possible, this allow developer to further chain additional command such as ->after() etc. | laravel_framework | train | php |
f90250099015aa3e1260ea08b14c785e7975eda0 | diff --git a/tests/python/pants_test/base/test_exception_sink_integration.py b/tests/python/pants_test/base/test_exception_sink_integration.py
index <HASH>..<HASH> 100644
--- a/tests/python/pants_test/base/test_exception_sink_integration.py
+++ b/tests/python/pants_test/base/test_exception_sink_integration.py
@@ -7,6 +7,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
import os
import signal
import time
+import unittest
from contextlib import contextmanager
from pants.base.build_environment import get_buildroot
@@ -101,6 +102,7 @@ Signal {signum} was raised\\. Exiting with failure\\. \\(backtrace omitted\\)
# Return the (failed) pants execution result.
yield (workdir, waiter_run)
+ @unittest.skip('Flaky: https://github.com/pantsbuild/pants/issues/6708')
def test_dumps_logs_on_terminate(self):
# Send a SIGTERM to the local pants process.
with self._send_signal_to_waiter_handle(signal.SIGTERM) as (workdir, waiter_run): | Skip a flaky test. (#<I>) | pantsbuild_pants | train | py |
416756b2b445fed501d87da2c2311c6deb63a61f | diff --git a/src/test/java/org/dita/dost/IntegrationTest.java b/src/test/java/org/dita/dost/IntegrationTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/org/dita/dost/IntegrationTest.java
+++ b/src/test/java/org/dita/dost/IntegrationTest.java
@@ -451,6 +451,17 @@ public class IntegrationTest extends AbstractIntegrationTest {
.input(Paths.get("conrefbreaksxref.dita"))
.test();
}
+
+ @Test
+ public void testconrefmissingfile() throws Throwable {
+ builder().name("conrefmissingfile")
+ .transtype(preprocess)
+ .input(Paths.get("badconref.dita"))
+ .put("validate", "false")
+ .warnCount(1)
+ .errorCount(3)
+ .test();
+ }
@Test
public void testcontrolValueFile1() throws Throwable { | Run integration test case for #b<I>eea | dita-ot_dita-ot | train | java |
e4e943eaf8df5a1f077bff0695a8eac06acbf14c | diff --git a/norduniclient/testing.py b/norduniclient/testing.py
index <HASH>..<HASH> 100644
--- a/norduniclient/testing.py
+++ b/norduniclient/testing.py
@@ -127,10 +127,10 @@ class Neo4jTemporaryInstance(object):
time.sleep(1)
con = http.HTTPConnection('{!s}:{!s}'.format(self.host, self.http_port), timeout=10)
try:
- con.request('GET', 'http://{!s}:{!s}/user/{!s}'.format(self.host, self.http_port, self.DEFAULT_USERNAME),
- headers=headers)
+ con.request('GET', 'http://{!s}:{!s}/user/{!s}'.format(self.host, self.http_port,
+ self.DEFAULT_USERNAME), headers=headers)
response = json.loads(con.getresponse().read().decode('utf-8'))
- except ValueError:
+ except (ValueError, http.HTTPException):
con.close()
retry += 1
if retry > 10: | Retry to connect to db for HTTPExceptions also | NORDUnet_python-norduniclient | train | py |
8648fd4d1fffb90b5a4b28562fa2d69ada888ec4 | diff --git a/base.php b/base.php
index <HASH>..<HASH> 100644
--- a/base.php
+++ b/base.php
@@ -346,7 +346,7 @@ final class Base extends Prefab implements ArrayAccess {
* @param $ttl int
**/
function set($key,$val,$ttl=0) {
- $time=$this->hive['TIME'];
+ $time=(int)$this->hive['TIME'];
if (preg_match('/^(GET|POST|COOKIE)\b(.+)/',$key,$expr)) {
$this->set('REQUEST'.$expr[2],$val);
if ($expr[1]=='COOKIE') { | Fixed setcookie $expire variable type (#<I>) | bcosca_fatfree-core | train | php |
6ad608c128cba933c7c46906d257ea817edb9d6d | diff --git a/rimraf.js b/rimraf.js
index <HASH>..<HASH> 100644
--- a/rimraf.js
+++ b/rimraf.js
@@ -11,7 +11,7 @@ try {
fs = require("fs")
}
-var lstat = fs.lstat ? "lstat" : "stat"
+var lstat = process.platform === "win32" ? "stat" : "lstat"
, lstatSync = lstat + "Sync"
// for EMFILE handling | require('fs') lies about lstat support | isaacs_rimraf | train | js |
568ae222afa855402b94744112434833313f44fd | diff --git a/railties/test/application/route_inspect_test.rb b/railties/test/application/route_inspect_test.rb
index <HASH>..<HASH> 100644
--- a/railties/test/application/route_inspect_test.rb
+++ b/railties/test/application/route_inspect_test.rb
@@ -13,6 +13,7 @@ module ApplicationTests
app.config.assets = ActiveSupport::OrderedOptions.new
app.config.assets.prefix = '/sprockets'
Rails.stubs(:application).returns(app)
+ Rails.stubs(:env).returns("development")
end
def test_displaying_routes_for_engines | Fix missing Rails.env in route inspect tests | rails_rails | train | rb |
448b1a1962916aa01be62c6ace4a5c2efd282b8a | diff --git a/azurerm/config.go b/azurerm/config.go
index <HASH>..<HASH> 100644
--- a/azurerm/config.go
+++ b/azurerm/config.go
@@ -503,7 +503,6 @@ func (c *ArmClient) registerAPIManagementClients(endpoint, subscriptionId string
loggerClient := apimanagement.NewLoggerClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&loggerClient.Client, auth)
- c.apimgmt.LoggerClient = loggerClient
policyClient := apimanagement.NewPolicyClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&policyClient.Client, auth)
@@ -552,6 +551,7 @@ func (c *ArmClient) registerAPIManagementClients(endpoint, subscriptionId string
CertificatesClient: certificatesClient,
GroupClient: groupsClient,
GroupUsersClient: groupUsersClient,
+ LoggerClient: loggerClient,
PolicyClient: policyClient,
ServiceClient: serviceClient,
SignInClient: signInClient, | Fix the crash point for APIM client registration (#<I>) | terraform-providers_terraform-provider-azurerm | train | go |
3bc18cda548ea257d21d94477af95d895ca6f65a | diff --git a/adapters/epics.py b/adapters/epics.py
index <HASH>..<HASH> 100644
--- a/adapters/epics.py
+++ b/adapters/epics.py
@@ -107,6 +107,6 @@ class EpicsAdapter(Adapter):
count += 1
timer += delta
if timer >= 1.0:
- #print("Running at %d cycles per second (%.3f ms per cycle)" % (count, 1000.0 / count))
+ print("Running at %d cycles per second (%.3f ms per cycle)" % (count, 1000.0 / count))
count = 0
timer = 0.0 | Revert commenting out print statement from epics adapter | DMSC-Instrument-Data_lewis | train | py |
2923cd335dda7b41e5857685de3996987af5781b | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -236,21 +236,27 @@ function getFileInfo (path, cb) {
}
function traversePath (path, fn, cb) {
- fs.readdir(path, function (err, entries) {
- if (err && err.code === 'ENOTDIR') {
- // this is a file
- fn(path, cb)
- } else if (err) {
+ fs.stat(path, function (err, stats) {
+ if (err) {
// real error
cb(err)
- } else {
+ } else if (stats.isDirectory()) {
// this is a folder
- parallel(entries.filter(notHidden).filter(junk.not).map(function (entry) {
- return function (cb) {
- traversePath(corePath.join(path, entry), fn, cb)
+ fs.readdir(path, function (err, entries) {
+ if (err) {
+ cb(err) // real error
+ } else {
+ parallel(entries.filter(notHidden).filter(junk.not).map(function (entry) {
+ return function (cb) {
+ traversePath(corePath.join(path, entry), fn, cb)
+ }
+ }), cb)
}
- }), cb)
+ })
+ } else if (stats.isFile()) {
+ fn(path, cb)
}
+ // ignore anything else (which is not a file, neither a directory)
})
} | Allow to read from a Windows file share.
Fixed fs.readdir throwing "ENOTSUP" (and not the expected "ENOTDIR") if path argument of traversePath is pointing to a file.
Replaced this mechanism with fs.stat for a more compliant way of determining the file/folder type. | webtorrent_create-torrent | train | js |
8695ae7bd96ff18a216303f93fa6096962324fdb | diff --git a/hotdoc/core/extension.py b/hotdoc/core/extension.py
index <HASH>..<HASH> 100644
--- a/hotdoc/core/extension.py
+++ b/hotdoc/core/extension.py
@@ -203,6 +203,9 @@ class Extension(Configurable):
return page
+ def get_toplevel_comments(self):
+ return self.__toplevel_comments
+
def make_pages(self):
# All symbol names that no longer need to be assigned to a page
dispatched_symbol_names = set()
@@ -221,7 +224,7 @@ class Extension(Configurable):
# First we make one page per toplevel comment (eg. SECTION comment)
# This is the highest priority mechanism for sorting symbols
- for comment in self.__toplevel_comments:
+ for comment in self.get_toplevel_comments():
assert(comment.name)
symbol_names = comment.meta.pop('symbols', [])
private_symbol_names = comment.meta.pop('private-symbols', []) | extension: Add a get_toplevel_comments method to be overridable | hotdoc_hotdoc | train | py |
797334f312a8e09f4803848d1b10be4a3706a449 | diff --git a/bin/spm-client-diagnostics.js b/bin/spm-client-diagnostics.js
index <HASH>..<HASH> 100755
--- a/bin/spm-client-diagnostics.js
+++ b/bin/spm-client-diagnostics.js
@@ -28,5 +28,5 @@ zip.folder(config.logger.dir)
var archFileName = path.join(os.tmpdir(), 'spm-diagnose.zip')
zip.writeToFile(archFileName)
console.log('SPM diagnostics info is in ' + archFileName)
-console.log('Please e-mail the file to [email protected]')
+console.log('Please e-mail the file to [email protected]')
fs.unlink(cfgDumpFileName, function () {}) | spm-support@ ==> support@ | sematext_spm-agent-nodejs | train | js |
1edb990a2d32413bf98d0fffbefe54410dbac8e1 | diff --git a/coremodules/core/src/main/java/org/treetank/io/file/FileReader.java b/coremodules/core/src/main/java/org/treetank/io/file/FileReader.java
index <HASH>..<HASH> 100644
--- a/coremodules/core/src/main/java/org/treetank/io/file/FileReader.java
+++ b/coremodules/core/src/main/java/org/treetank/io/file/FileReader.java
@@ -57,9 +57,6 @@ public final class FileReader implements IReader {
/** Inflater to decompress. */
private transient final CryptoJavaImpl mDecompressor;
- /** Temporary data buffer. */
- private transient ByteBufferSinkAndSource mBuffer;
-
/**
* Constructor.
*
@@ -77,7 +74,6 @@ public final class FileReader implements IReader {
mFile = new RandomAccessFile(mConcreteStorage, IConstants.READ_ONLY);
mDecompressor = new CryptoJavaImpl();
- mBuffer = new ByteBufferSinkAndSource();
} catch (final IOException exc) {
throw new TTIOException(exc);
}
@@ -94,6 +90,8 @@ public final class FileReader implements IReader {
*/
public IPage read(final IKey pKey) throws TTIOException {
+ final ByteBufferSinkAndSource mBuffer = new ByteBufferSinkAndSource();
+
if (pKey == null) {
return null;
} | [MOD] ByteBuffer now only in method where needed within FileReader
git-svn-id: <URL> | sebastiangraf_treetank | train | java |
3d4844da485512e47fe8a15c8ff04c32170a8162 | diff --git a/symphony/lib/toolkit/trait.databasewheredefinition.php b/symphony/lib/toolkit/trait.databasewheredefinition.php
index <HASH>..<HASH> 100644
--- a/symphony/lib/toolkit/trait.databasewheredefinition.php
+++ b/symphony/lib/toolkit/trait.databasewheredefinition.php
@@ -179,7 +179,7 @@ trait DatabaseWhereDefinition
$c = $c[$vk];
}
if (!$op) {
- throw new DatabaseStatementException("Operation `$k` not valid");
+ throw new DatabaseStatementException("Operation `$vk` not valid");
}
}
if (!is_string($k)) { | Output good invalid operation in error message (#<I>)
The operation failing here is the $vk variable, not the $k variable.
Picked from <I>bbcca1
Picked from <I>e8f<I>cbe | symphonycms_symphony-2 | train | php |
f22e04d0a9e6e1a9dac12c5b52b4652d8e0ea2ca | diff --git a/src/kff.ServiceContainer.js b/src/kff.ServiceContainer.js
index <HASH>..<HASH> 100644
--- a/src/kff.ServiceContainer.js
+++ b/src/kff.ServiceContainer.js
@@ -303,6 +303,14 @@ kff.ServiceContainer = kff.createClass(
*/
loadService: function(serviceName)
{
+ if(typeof serviceName === 'string')
+ {
+ var match = serviceName.match(/^[^\s#]*/);
+ if(match)
+ {
+ serviceName = match[0];
+ }
+ }
return kff.evalObjectPath(serviceName);
}
});
diff --git a/test/kff.ServiceContainer.test.js b/test/kff.ServiceContainer.test.js
index <HASH>..<HASH> 100644
--- a/test/kff.ServiceContainer.test.js
+++ b/test/kff.ServiceContainer.test.js
@@ -24,6 +24,9 @@ describe('kff.ServiceContainer', function()
'construct': Service1,
'args': ['%kocka%', 'haf']
},
+ 'Service7 #1':
+ {
+ },
'service2':
{
'construct': Service2,
@@ -163,6 +166,11 @@ describe('kff.ServiceContainer', function()
container.createService('Service7').should.equal(Service7);
});
+ it('should create object service with space', function()
+ {
+ container.createService('Service7 #1').should.equal(Service7);
+ });
+
});
describe('#getService', function() | feat(ServiceContainer): allow service name to contain spaces
If service name contains space (or # character), strip first non-spaced segment of the string and use it as object path to find a service symbol. This allows for different services to be resolved to the same symbol but with different configuration. | karfcz_kff | train | js,js |
b368b76de13df2b4bd4ae8df21493f367a68437b | diff --git a/lib/ronin/network/http/http.rb b/lib/ronin/network/http/http.rb
index <HASH>..<HASH> 100644
--- a/lib/ronin/network/http/http.rb
+++ b/lib/ronin/network/http/http.rb
@@ -314,7 +314,13 @@ module Ronin
request = Net::HTTP.const_get(name).new(path,headers)
if options[:form_data]
- request.set_form_data(options[:form_data])
+ case options[:form_data]
+ when String
+ request.content_type = 'application/x-www-form-urlencoded'
+ request.body = options[:form_data]
+ else
+ request.set_form_data(options[:form_data])
+ end
elsif options[:body]
request.body = options[:body]
end | Allow :form_data to be a String. | ronin-ruby_ronin-support | train | rb |
1a9fea26802e96a7d52c1c038c661f132f77de8e | diff --git a/holoviews/plotting/bokeh/renderer.py b/holoviews/plotting/bokeh/renderer.py
index <HASH>..<HASH> 100644
--- a/holoviews/plotting/bokeh/renderer.py
+++ b/holoviews/plotting/bokeh/renderer.py
@@ -32,13 +32,12 @@ class BokehRenderer(Renderer):
html = '<center>%s</center>' % html
return html, {'file-ext':fmt, 'mime_type':MIME_TYPES[fmt]}
elif fmt == 'json':
- datasources = obj.state.select({'type': PlotObject})
+ plotobjects = obj.state.select({'type': PlotObject})
data = {}
- for src in datasources:
- id = src.ref['id']
- mode = src.ref['type']
- json = src.vm_serialize(changed_only=True)
- data[id] = {'mode': mode, 'data': json}
+ for plotobj in plotobjects:
+ json = plotobj.vm_serialize(changed_only=True)
+ data[plotobj.ref['id']] = {'mode': plotobj.ref['type'],
+ 'data': json}
return serialize_json(data), {'file-ext':json, 'mime_type':MIME_TYPES[fmt]} | Simplified the __call__ method of BokehRenderer | pyviz_holoviews | train | py |
383e21bc7ba1119979bae1fc711dd2e1e13a443e | diff --git a/salt/modules/ssh.py b/salt/modules/ssh.py
index <HASH>..<HASH> 100644
--- a/salt/modules/ssh.py
+++ b/salt/modules/ssh.py
@@ -249,7 +249,7 @@ def host_keys(keydir=None):
for fn_ in os.listdir(keydir):
if fn_.startswith('ssh_host_'):
top = fn_.split('.')
- comps = fn_.split('_')
+ comps = top[0].split('_')
kname = comps[2]
if len(top) > 1:
kname += '.{0}'.format(top[1]) | fix #<I> - ssh_host_key.pub should return as key.pub not key.pub.pub | saltstack_salt | train | py |
5eb942bf1e9a5e81cd435354f97ff5f197c67936 | diff --git a/resources/assets/js/util/form/transform-fields.js b/resources/assets/js/util/form/transform-fields.js
index <HASH>..<HASH> 100644
--- a/resources/assets/js/util/form/transform-fields.js
+++ b/resources/assets/js/util/form/transform-fields.js
@@ -26,7 +26,7 @@ export function transformFields(fields, data) {
resolvedEmptyAttributes,
} = transformAttributes(field, field.dynamicAttributes, serializedData);
- const readOnly = resolvedEmptyAttributes.length > 0;
+ const readOnly = attributes.readOnly || resolvedEmptyAttributes.length > 0;
return {
...res, | Fix readOnly attribute not taken in account | code16_sharp | train | js |
7ff648f9c77d8e0cdb6aa2637734ece73e2c6e98 | diff --git a/src/Router.php b/src/Router.php
index <HASH>..<HASH> 100644
--- a/src/Router.php
+++ b/src/Router.php
@@ -196,14 +196,20 @@ final class Router implements Responder, ServerObserver {
);
}
- if (!empty($middlewares)) {
- $responder = Middleware\stack($responder, ...$middlewares);
- }
-
if ($responder instanceof ServerObserver) {
$this->observers->attach($responder);
}
+ if (!empty($middlewares)) {
+ foreach ($middlewares as $middleware) {
+ if ($middleware instanceof ServerObserver) {
+ $this->observers->attach($middleware);
+ }
+ }
+
+ $responder = Middleware\stack($responder, ...$middlewares);
+ }
+
$uri = "/" . \ltrim($uri, "/");
// Special-case, otherwise we redirect just to the same URI again
@@ -270,6 +276,10 @@ final class Router implements Responder, ServerObserver {
}
public function onStart(Server $server): Promise {
+ if ($this->running) {
+ return new Failure(new \Error("Router already started"));
+ }
+
if (empty($this->routes)) {
return new Failure(new \Error(
"Router start failure: no routes registered" | Fix potential duplicate calls to onStart | amphp_http-server-router | train | php |
7b1b47ea0a5e7ef7f85e4bc63b0f013130950cb8 | diff --git a/lib/rubocop/formatter/simple_text_formatter.rb b/lib/rubocop/formatter/simple_text_formatter.rb
index <HASH>..<HASH> 100644
--- a/lib/rubocop/formatter/simple_text_formatter.rb
+++ b/lib/rubocop/formatter/simple_text_formatter.rb
@@ -89,9 +89,13 @@ module Rubocop
colorize(offense.severity.code, color)
end
+ def annotate_message(msg)
+ msg.gsub(/`(.*?)`/, Rainbow('\1').yellow)
+ end
+
def message(offense)
message = offense.corrected? ? green('[Corrected] ') : ''
- message << offense.message
+ message << annotate_message(offense.message)
end
def pluralize(number, thing, options = {}) | Enhance cop message presentation
Portions of the message within `` (usually keyword, class, method and variable
names) will be displayed in a more prominent
color to improve the readability of the message. | rubocop-hq_rubocop | train | rb |
ac79607dc0b99e6d103b916fbe87e524648e7c32 | diff --git a/src/utils/rewritePaths.js b/src/utils/rewritePaths.js
index <HASH>..<HASH> 100644
--- a/src/utils/rewritePaths.js
+++ b/src/utils/rewritePaths.js
@@ -24,7 +24,7 @@ export default function rewritePaths(error, file, contents, moduleContext, callb
const rewritten = contents.replace(useRegexp, (entire, importer, single, double, unquoted) => {
// Don't rewrite imports from built-ins
- if (single.indexOf('sass:') === 0) {
+ if (single && single.indexOf('sass:') === 0) {
return entire;
} | Check `single` before using it (#<I>) | shakacode_sass-resources-loader | train | js |
bbfd49d739dc600c0b96846f7834338376e95013 | diff --git a/jsmart.js b/jsmart.js
index <HASH>..<HASH> 100644
--- a/jsmart.js
+++ b/jsmart.js
@@ -228,7 +228,7 @@
try {
return obj.apply(this, args);
} catch (e) {
- throw new Error(e.message + ' in \n' + code);
+ throw new Error(e.message);
}
} | Fix undefined code error since the function does not contain such variable | umakantp_jsmart | train | js |
cbc93c14a54aabb085fad6a292bac95a732b82ad | diff --git a/security/subsystem/src/main/java/org/jboss/as/security/realm/DomainContextRealm.java b/security/subsystem/src/main/java/org/jboss/as/security/realm/DomainContextRealm.java
index <HASH>..<HASH> 100644
--- a/security/subsystem/src/main/java/org/jboss/as/security/realm/DomainContextRealm.java
+++ b/security/subsystem/src/main/java/org/jboss/as/security/realm/DomainContextRealm.java
@@ -104,11 +104,6 @@ public class DomainContextRealm implements SecurityRealm {
}
@Override
- public String getName() {
- return this.identityName;
- }
-
- @Override
public CredentialSupport getCredentialSupport(final Class<?> credentialType, final String algorithmName) throws RealmUnavailableException {
return DomainContextRealm.this.getCredentialSupport(credentialType, algorithmName);
} | Minor update to DomainContextRealm to remove the getName() method from the RealmIdentity. | wildfly_wildfly | train | java |
e4607502bf9adecabd50de33f26c1077ff3375ca | diff --git a/mod/workshop/version.php b/mod/workshop/version.php
index <HASH>..<HASH> 100644
--- a/mod/workshop/version.php
+++ b/mod/workshop/version.php
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2017111300; // The current module version (YYYYMMDDXX)
+$plugin->version = 2018010600; // The current module version (YYYYMMDDXX)
$plugin->requires = 2017110800; // Requires this Moodle version.
$plugin->component = 'mod_workshop';
$plugin->cron = 60; // Give as a chance every minute. | NOBUG: Keep mod_workshop higher version after reverting MDL-<I> | moodle_moodle | train | php |
b0e536cb6077868a74e1ae655c86541f26c0d4bc | diff --git a/components/LibComponent.rb b/components/LibComponent.rb
index <HASH>..<HASH> 100644
--- a/components/LibComponent.rb
+++ b/components/LibComponent.rb
@@ -298,7 +298,7 @@ module LibComponent
class LibError
def self.raise(str_)
puts str_
- exit(0)
+ exit(255)
end
end | Error function must exit with an error code | openplacos_openplacos | train | rb |
bcc56e4452a73c9c1761563d8e221108c405d242 | diff --git a/utils/Sfile_util.py b/utils/Sfile_util.py
index <HASH>..<HASH> 100644
--- a/utils/Sfile_util.py
+++ b/utils/Sfile_util.py
@@ -141,7 +141,7 @@ def readheader(sfilename):
sfilename_header.time=UTCDateTime(int(topline[1:5]),int(topline[6:8]),
int(topline[8:10]),int(topline[11:13]),
int(topline[13:15]),sfile_seconds
- ,int(topline[19:20])*10)+add_seconds
+ ,int(topline[19:20])*100000)+add_seconds
except:
warnings.warn("Couldn't read a date from sfile: "+sfilename)
sfilename_header.time=UTCDateTime(0) | Correct timing in header
Former-commit-id: <I>b<I>f1c<I>ae3fa<I>de6e<I>fc<I>e | eqcorrscan_EQcorrscan | train | py |
b693358a5db161426f550e0dcb265db554fac946 | diff --git a/src/diamond/collector.py b/src/diamond/collector.py
index <HASH>..<HASH> 100644
--- a/src/diamond/collector.py
+++ b/src/diamond/collector.py
@@ -10,6 +10,7 @@ import platform
import logging
import configobj
import traceback
+import time
from diamond.metric import Metric
@@ -136,6 +137,7 @@ class Collector(object):
return {
'enabled': 'Enable collecting these metrics',
'byte_unit': 'Default numeric output(s)',
+ 'measure_collector_time': 'Collect the collector run time in ms',
}
def get_default_config(self):
@@ -179,6 +181,9 @@ class Collector(object):
# Default numeric output
'byte_unit': 'byte',
+
+ # Collect the collector run time in ms
+ 'measure_collector_time': False,
}
def get_stats_for_upload(self, config=None):
@@ -318,8 +323,19 @@ class Collector(object):
self.log.debug("Collecting data from: %s" % self.__class__.__name__)
try:
try:
+ start_time = time.time()
+
# Collect Data
self.collect()
+
+ end_time = time.time()
+
+ if 'measure_collector_time' in self.config:
+ if self.config['measure_collector_time']:
+ metric_name = 'collector_time_ms'
+ metric_value = int((end_time - start_time) * 1000)
+ self.publish(metric_name, metric_value)
+
except Exception:
# Log Error
self.log.error(traceback.format_exc()) | Add in a option to collect the run time of the collect() call | python-diamond_Diamond | train | py |
42b6043e3d214808acd184ca4498ae827b8d178a | diff --git a/MicroTokenizer/MicroTokenizer.py b/MicroTokenizer/MicroTokenizer.py
index <HASH>..<HASH> 100644
--- a/MicroTokenizer/MicroTokenizer.py
+++ b/MicroTokenizer/MicroTokenizer.py
@@ -164,7 +164,7 @@ class MicroTokenizer(object):
# always treat single char as symbol
current_node_id = "{}-{}".format(offset, next_offset)
- # TODO: need deal with OOV
+ # FIXME: need deal with OOV
current_node_weight = self.dict_data[token]
self.G.add_node(current_node_id, label=token) | Change TODO to FIXME, because it's a big issue | howl-anderson_MicroTokenizer | train | py |
4a0d019887cba6618b8f73f1f581b3255abc169f | diff --git a/lib/argus/at_commander.rb b/lib/argus/at_commander.rb
index <HASH>..<HASH> 100644
--- a/lib/argus/at_commander.rb
+++ b/lib/argus/at_commander.rb
@@ -62,11 +62,12 @@ module Argus
end
end
- def reset_watchdog
+ def comwdg
@mutex.synchronize do
command("COMWDG")
end
end
+ alias reset_watchdog comwdg # For backward compatibility
def ctrl(mode)
@mutex.synchronize do | Add alias reset_watchdog for backward compatibility
I want the AT Commander methods to more closely reflect the low level
commands going to the drone. | jimweirich_argus | train | rb |
aa975252e1e2cc3ef17168eedac16d987d1306f6 | diff --git a/leveldb/db/db.go b/leveldb/db/db.go
index <HASH>..<HASH> 100644
--- a/leveldb/db/db.go
+++ b/leveldb/db/db.go
@@ -524,7 +524,10 @@ func (d *DB) Close() error {
}
d.s.tops.purgeCache()
- d.s.o.GetBlockCache().Purge(nil)
+ cache := d.s.o.GetBlockCache()
+ if cache != nil {
+ cache.Purge(nil)
+ }
if d.logw != nil {
d.logw.Close() | db: check if it's not nil before purging block cache | syndtr_goleveldb | train | go |
72da42f78e9ec3dd915aeb2a9429f56ef08bd323 | diff --git a/src/sap.m/src/sap/m/Select.js b/src/sap.m/src/sap/m/Select.js
index <HASH>..<HASH> 100644
--- a/src/sap.m/src/sap/m/Select.js
+++ b/src/sap.m/src/sap/m/Select.js
@@ -1424,6 +1424,16 @@ function(
};
/**
+ * Handles the keydown event for SPACE on which we have to prevent the browser scrolling.
+ *
+ * @param {jQuery.Event} oEvent The event object.
+ * @private
+ */
+ Select.prototype.onsapspace = function(oEvent) {
+ oEvent.preventDefault();
+ };
+
+ /**
* Handles the keyup event for SPACE.
*
* @param {jQuery.Event} oEvent The event object. | [FIX] sap.m.Select: Prevented scrolling on SPACE key pressed
BCP: <I>
-with a previous change the Select action is now triggered on keyup, not
keydown, however we should prevent the default behavior on keydown also
Change-Id: Idf7fdd7f<I>b<I>f5e0be<I>fb8eaf<I>f3b8 | SAP_openui5 | train | js |
d1c3e6eaf892a36527b5f3a2178f37f816356207 | diff --git a/client/state/plugins/premium/actions.js b/client/state/plugins/premium/actions.js
index <HASH>..<HASH> 100644
--- a/client/state/plugins/premium/actions.js
+++ b/client/state/plugins/premium/actions.js
@@ -213,7 +213,7 @@ function configure( site, plugin, dispatch ) {
const saveOption = () => {
return site.setOption( { option_name: option, option_value: optionValue }, ( error, data ) => {
- if ( ( 'vaultpress' === plugin.slug ) && versionCompare( plugin.version, '1.8.3', '>' ) ) {
+ if ( ( ! error ) && ( 'vaultpress' === plugin.slug ) && versionCompare( plugin.version, '1.8.3', '>' ) ) {
const response = JSON.parse( data.option_value );
if ( 'response' === response.action && 'broken' === response.status ) {
error = new Error( response.error ); | Autoconfig: Check whether VaultPress has an error response before trying to work with `data` (#<I>) | Automattic_wp-calypso | train | js |
82383585358d50d71db5664dc6711b929f6b504d | diff --git a/notifications.go b/notifications.go
index <HASH>..<HASH> 100644
--- a/notifications.go
+++ b/notifications.go
@@ -11,8 +11,8 @@ import (
// NotificationMechanismData holds a single public facing mechanism data
// integation.
type NotificationMechanismData struct {
- Name string `json:"id"`
- ID string `json:"name"`
+ Name string `json:"name"`
+ ID string `json:"id"`
}
// NotificationMechanismIntegrations is a list of all the integrations of a | Fix json field name for notification mechanisms data | cloudflare_cloudflare-go | train | go |
01169a956c0cfeae6e379996e50912b72327e7ec | diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java
index <HASH>..<HASH> 100644
--- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java
+++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java
@@ -338,6 +338,7 @@ public class SmackIntegrationTestFramework {
if (beforeClassMethods.size() == 1) {
Method beforeClassMethod = beforeClassMethods.iterator().next();
+ LOGGER.info("Executing @BeforeClass method of " + testClass);
try {
beforeClassMethod.invoke(null);
}
@@ -414,6 +415,7 @@ public class SmackIntegrationTestFramework {
if (afterClassMethods.size() == 1) {
Method afterClassMethod = afterClassMethods.iterator().next();
+ LOGGER.info("Executing @AfterClass method of " + testClass);
try {
afterClassMethod.invoke(null);
} | Log when executing (Before|After) class sinttest methods | igniterealtime_Smack | train | java |
80df24002911b7f84e15f8efaf8a40d108739694 | diff --git a/sk/validation.php b/sk/validation.php
index <HASH>..<HASH> 100644
--- a/sk/validation.php
+++ b/sk/validation.php
@@ -32,7 +32,7 @@ return array(
"date_format" => ":attribute sa nezhoduje s formátom :format.",
"different" => ":attribute a :other musia byť odlišné.",
"digits" => ":attribute musí mať :digits číslic.",
- "digits_between" => ":attribute musí mať rozsah :min až :max číslic.",1
+ "digits_between" => ":attribute musí mať rozsah :min až :max číslic.",
"email" => ":attribute má neplatný formát.",
"exists" => "označený :attribute je neplatný.",
"image" => ":attribute musí byť obrázok.", | fixed typo in sk\validation.php | caouecs_Laravel-lang | train | php |
74dfa0b8055ed55406916142ec1a49869c348e14 | diff --git a/phonopy/phonon/band_structure.py b/phonopy/phonon/band_structure.py
index <HASH>..<HASH> 100644
--- a/phonopy/phonon/band_structure.py
+++ b/phonopy/phonon/band_structure.py
@@ -647,7 +647,7 @@ class BandStructure(object):
elif compression == 'gzip':
if filename is None:
_filename = "band.yaml.gz"
- with gzip.open(_filename + ".gz", 'wb') as w:
+ with gzip.open(_filename, 'wb') as w:
self._write_yaml(w, comment, is_binary=True)
elif compression == 'lzma':
try:
@@ -657,7 +657,7 @@ class BandStructure(object):
"by this python version.")
if filename is None:
_filename = "band.yaml.xz"
- with lzma.open(_filename + ".xz", 'w') as w:
+ with lzma.open(_filename, 'w') as w:
self._write_yaml(w, comment, is_binary=True)
def _write_yaml(self, w, comment, is_binary=False): | Minor fix of filename extension for band structure yaml with compression | atztogo_phonopy | train | py |
66860c76955dbef4ad60ea40c5ce77572133fd4b | diff --git a/indra/sources/reach/api.py b/indra/sources/reach/api.py
index <HASH>..<HASH> 100644
--- a/indra/sources/reach/api.py
+++ b/indra/sources/reach/api.py
@@ -492,7 +492,7 @@ def _read_text_service(text, url=reach_text_url, timeout=None):
def _read_nxml_file_service_old(nxml_file, url=reach_nxml_url):
- with open(nxml_file, 'r') as fh:
+ with open(nxml_file, 'r', encoding='utf8') as fh:
nxml_str = fh.read()
return _read_nxml_str_service_old(nxml_str, url=url) | explicitly specify utf-8 for reach read service
In case utf-8 is not the system default encoding, a reach read file service would throw a UnicodeDecodeError | sorgerlab_indra | train | py |
968c17a357eeb40a1450bb625d129e8d2c67a28d | diff --git a/i3pystatus/scores/__init__.py b/i3pystatus/scores/__init__.py
index <HASH>..<HASH> 100644
--- a/i3pystatus/scores/__init__.py
+++ b/i3pystatus/scores/__init__.py
@@ -76,7 +76,7 @@ class ScoresBackend(SettingsBase):
exc.code, exc.reason, exc.url,
)
return {}
- except URLError as exc:
+ except (ConnectionResetError, URLError) as exc:
self.logger.critical('Error making request to %s: %s', url, exc)
return {} | Catch ConnectionResetError when making API request
Caught this traceback in the log when an update failed to complete. Also
added a generic Exception catch-all. | enkore_i3pystatus | train | py |
d0f867582fb9330025e61bc6ad141884c1d1ee68 | diff --git a/src/Payum/Offline/Action/CaptureAction.php b/src/Payum/Offline/Action/CaptureAction.php
index <HASH>..<HASH> 100644
--- a/src/Payum/Offline/Action/CaptureAction.php
+++ b/src/Payum/Offline/Action/CaptureAction.php
@@ -21,7 +21,7 @@ class CaptureAction implements ActionInterface
/** @var \ArrayAccess $model */
$model = $request->getModel();
- if ($model[Constants::FIELD_PAID]) {
+ if (isset($model[Constants::FIELD_PAID])) {
$model[Constants::FIELD_STATUS] = Constants::STATUS_SUCCESS;
} else {
$model[Constants::FIELD_STATUS] = Constants::STATUS_PENDING;
@@ -38,4 +38,4 @@ class CaptureAction implements ActionInterface
$request->getModel() instanceof \ArrayAccess
;
}
-}
\ No newline at end of file
+} | Fixing Notice: Undefined index: paid in ... | Payum_Payum | train | php |
05e022ee5efe2e480ec56fc6305954811ac0f001 | diff --git a/lib/inventory_refresh/inventory_collection/scanner.rb b/lib/inventory_refresh/inventory_collection/scanner.rb
index <HASH>..<HASH> 100644
--- a/lib/inventory_refresh/inventory_collection/scanner.rb
+++ b/lib/inventory_refresh/inventory_collection/scanner.rb
@@ -130,7 +130,7 @@ module InventoryRefresh
def supports_building_inventory_collection?
# Don't try to introspect ICs with custom query or saving code
- return if arel.present? || custom_save_block.present?
+ return if !arel.nil? || custom_save_block.present?
# We support :parent_inventory_collections only for targeted mode, where all ICs are present
return unless targeted? | Calling present? on arel actually does the query | ManageIQ_inventory_refresh | train | rb |
0c4e07a556d64753082ff1c487905281d0300b26 | diff --git a/src/AbstractKernel.php b/src/AbstractKernel.php
index <HASH>..<HASH> 100644
--- a/src/AbstractKernel.php
+++ b/src/AbstractKernel.php
@@ -102,10 +102,8 @@ abstract class AbstractKernel implements KernelInterface
$handleErrors
);
- $core->container->bindSingleton(
- EnvironmentInterface::class,
- $environment ?? new Environment()
- );
+ $environment = $environment ?? new Environment();
+ $core->container->bindSingleton(EnvironmentInterface::class, $environment);
return $core->run($environment);
} | Fixes problem with using env variables in console commands | spiral_boot | train | php |
aa55c913959067c88a5af6d8e769b450ce46f9ec | diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/file_serving/base.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/file_serving/base.rb
+++ b/lib/puppet/file_serving/base.rb
@@ -22,10 +22,10 @@ class Puppet::FileServing::Base
# Return the full path to our file. Fails if there's no path set.
def full_path(dummy_argument=:work_arround_for_ruby_GC_bug)
(if relative_path.nil? or relative_path == "" or relative_path == "."
- path
- else
- File.join(path, relative_path)
- end).gsub(%r{/+}, "/")
+ path
+ else
+ File.join(path, relative_path)
+ end).gsub(%r{//+}, "/")
end
def initialize(path, options = {}) | file_serving: avoid rewriting paths if possible.
A trivial change - only rewrite from '//' to '/', rather than from '/+' -
means that we can reduce the garbage generation in this
function substantially. Most paths now pass through unmodified. | puppetlabs_puppet | train | rb |
729f83b3d409c703b1c28efabfc3927be3878de8 | diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php
index <HASH>..<HASH> 100644
--- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php
+++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php
@@ -272,7 +272,7 @@ trait ParsedownGravTrait
if (isset($url['query'])) {
$actions = array_reduce(explode('&', $url['query']), function ($carry, $item) {
$parts = explode('=', $item, 2);
- $value = isset($parts[1]) ? $parts[1] : null;
+ $value = isset($parts[1]) ? $parts[1] : true;
$carry[$parts[0]] = $value;
return $carry; | Fix regression in image parameters handling introduced in <URL> were not applied any more) | getgrav_grav | train | php |
726c9735f01a89465e931b51d2a8a66ad02599e5 | diff --git a/src/Form/ThirdPartyServicesForm.php b/src/Form/ThirdPartyServicesForm.php
index <HASH>..<HASH> 100644
--- a/src/Form/ThirdPartyServicesForm.php
+++ b/src/Form/ThirdPartyServicesForm.php
@@ -30,7 +30,7 @@ class ThirdPartyServicesForm extends FormBase {
'#type' => 'textfield',
'#title' => $this->t('Google Maps API key'),
'#default_value' => $config->get('google_map_api_key'),
- '#description' => $this->t('For help see the <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#key">Google Maps API documentation</a>.'),
+ '#description' => $this->t('Google Maps requires users to use a valid API key. Using the <a href="https://console.developers.google.com/apis" target="_blank">Google API Manager</a>, you can enable the <em>Google Maps JavaScript API</em>. That will create (or reuse) a <em>Browser key</em> which you can paste here.'),
];
$form['actions'] = [ | [OYPD-<I>] Update install google maps api key description to match with contrib module. | ymcatwincities_openy | train | php |
b7c48bedb7e5cb918becc1803cfcf7d21ab1a9dd | diff --git a/test/helper.rb b/test/helper.rb
index <HASH>..<HASH> 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -1,7 +1,7 @@
require 'rubygems'
require 'bundler'
begin
- Bundler.setup(:default, :development)
+ Bundler.setup(:default, :development, :test)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems" | Add test enviroment to bundler setup on tests
This made possible to run individual tests with something like:
ruby -Itest/ test/test_spinning_cursor.rb -v -n "/allow you to change the banner/"
Necessary to faster repeating individual tests. | prydonius_spinning_cursor | train | rb |
f03bb5ff548a29e853938e05cd585cc8798aed21 | diff --git a/pyuntl/untl_structure.py b/pyuntl/untl_structure.py
index <HASH>..<HASH> 100644
--- a/pyuntl/untl_structure.py
+++ b/pyuntl/untl_structure.py
@@ -1,11 +1,11 @@
from builtins import str
from builtins import object
import socket
+import json
import urllib.request
import urllib.error
import urllib.parse
from lxml.etree import Element, SubElement, tostring
-
from pyuntl import UNTL_XML_ORDER, VOCABULARIES_URL
from pyuntl.form_logic import UNTL_FORM_DISPATCH, UNTL_GROUP_DISPATCH
from pyuntl.metadata_generator import py2dict
@@ -333,9 +333,11 @@ class FormGenerator(object):
socket.setdefaulttimeout(timeout)
# Create the ordered vocabulary URL.
vocab_url = VOCABULARIES_URL.replace('all', 'all-verbose')
+ # vocab_url = 'http://libdigidev02.library.unt.edu:92/vocabularies/all-verbose.json'
# Request the vocabularies dictionary.
try:
- vocab_dict = urllib.request.urlopen(vocab_url).read()
+ vocab_data = (urllib.request.urlopen(vocab_url).read()).decode('utf-8')
+ vocab_dict = json.loads(vocab_data)
except:
raise UNTLStructureException('Could not retrieve the vocabularies')
return vocab_dict | Return vocabularies as dictionary in get_vocabularies() function. | unt-libraries_pyuntl | train | py |
d4cf1b6d9ac9d30bee69c09437a29908edffe9b6 | diff --git a/tests/Test/Connector/UnixSocketConnectorTest.php b/tests/Test/Connector/UnixSocketConnectorTest.php
index <HASH>..<HASH> 100644
--- a/tests/Test/Connector/UnixSocketConnectorTest.php
+++ b/tests/Test/Connector/UnixSocketConnectorTest.php
@@ -11,9 +11,9 @@ class UnixSocketConnectorTest extends SocketConnectorTest
{
public function setUp()
{
- $this->connector = new UnixSocketConnector($GLOBALS['socket']);
-
- if (!$this->connector->isConnected()) {
+ try {
+ $this->connector = new UnixSocketConnector($GLOBALS['socket']);
+ } catch (\RuntimeException $e) {
$this->markTestSkipped(
'Supervisor is not available.'
); | Make sure there is a connection before testing | supervisorphp_supervisor | train | php |
307a5cab2b1ad80a7132ea5e80a7c6271a3a9532 | diff --git a/src/android/BLE.java b/src/android/BLE.java
index <HASH>..<HASH> 100644
--- a/src/android/BLE.java
+++ b/src/android/BLE.java
@@ -517,7 +517,14 @@ public class BLE
// Each device connection has a GattHandler, which handles the events the can happen to the connection.
// The implementation of the GattHandler class is found at the end of this file.
GattHandler gh = new GattHandler(mNextGattHandle, callbackContext);
- gh.mGatt = adapter.getRemoteDevice(args.getString(0)).connectGatt(mContext, true, gh);
+ // Note: We set autoConnect to false since setting
+ // it to true breaks the plugin logic. If support for
+ // auto connect is needed, that should be designed
+ // with updated plugin logic. (Problem is that BLE device
+ // is removed when disconnect occurs, and device resources
+ // are deallocated, therefore true cannot work at present.)
+ boolean autoConnect = false;
+ gh.mGatt = adapter.getRemoteDevice(args.getString(0)).connectGatt(mContext, autoConnect, gh);
// Note that gh.mGatt and this.mGatt are different object and have different types.
// --> Renamed this.mGatt to mConnectedDevices to avoid confusion. | Removed autoConnect from Android plugin, this caused bugs when disconnecting from devices and should not be used. | evothings_cordova-ble | train | java |
b102da21ab9e996e1d4d53ac5b5c401f218f4e16 | diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Database/Eloquent/Model.php
+++ b/src/Illuminate/Database/Eloquent/Model.php
@@ -2244,7 +2244,7 @@ abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa
// fields on the database, while still supporting Carbonized conversion.
elseif (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $value))
{
- return Carbon::createFromFormat('Y-m-d', $value);
+ return Carbon::createFromFormat('Y-m-d', $value)->startOfDay();
}
// Finally, we will just assume this date is in the format used by default on | Update Model.php function asDateTime: startofDay(<I>:<I>:<I>) if from Y-m-d timestamp (DateAccessor)
As the pull request <URL> was only inserted in the function fromDateTime, this pull request adds startOfDay() also to the accessor function (asDateTime), so you can compare two dates without the automatically added incorrect time of the current moment. | laravel_framework | train | php |
ca3e5da920f738e50016eb1183e78fb75ecde7f5 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -200,6 +200,8 @@ html_favicon = 'theme/static/img/favicon.ico'
html_last_updated_fmt = '%Y/%m/%d'
+html_copy_source = False
+
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder. | Added code to remove _sources (#<I>) | Qiskit_qiskit | train | py |
509da932670f68e4e6a5336d4ef8f62665396948 | diff --git a/main.py b/main.py
index <HASH>..<HASH> 100644
--- a/main.py
+++ b/main.py
@@ -9,7 +9,7 @@ import teamnames
import liveapi
BASE_URL = 'http://api.football-data.org/alpha/'
-LIVE_URL = liveapi.LIVE_API
+LIVE_URL = 'http://soccer-cli.appspot.com/'
LEAGUE_IDS = leagueids.LEAGUE_IDS
headers = {
'X-Auth-Token': authtoken.API_TOKEN | added live api to main.py | architv_soccer-cli | train | py |
9f0f89c8e6725008785d77fa03e01ea73aec94a4 | diff --git a/remote-utils.js b/remote-utils.js
index <HASH>..<HASH> 100644
--- a/remote-utils.js
+++ b/remote-utils.js
@@ -203,13 +203,17 @@ define(['q'], function(Q) {
}
output.stderr = remote_stderr;
deferred.resolve(output);
- }).stdout.on('data', function(data) {
+ }).on('data', function(data) {
+ //console.log('GOT STDOUT: ' + data);
remote_stdout += data;
- if (stdoutCB != null)
- stdoutCB(data);
+ if (typeof stdoutCB === 'function' && stdoutCB(data.toString('utf-8'))) {
+ conn.end();
+ deferred.reject(data);
+ }
}).stderr.on('data', function(data) {
+ //console.log('GOT STDERR: ' + data);
remote_stderr += data;
- if (stderrCB(data)) {
+ if (typeof stdoutCB === 'function' && stderrCB(data.toString('utf-8'))) {
conn.end();
deferred.reject(data);
} | updated to allow stdout to kill session for processes who return errors to stdout instead of stderr | finger563_nodejs-remote-utils | train | js |
b22b24491e6edff6ff9dd78ac8e49632037f5f83 | diff --git a/cmd/veneur-emit/main.go b/cmd/veneur-emit/main.go
index <HASH>..<HASH> 100644
--- a/cmd/veneur-emit/main.go
+++ b/cmd/veneur-emit/main.go
@@ -541,6 +541,16 @@ func validateFlagCombinations(passedFlags map[string]flag.Value) {
logrus.Fatalf("Flag %q is only valid with \"-mode %s\"", flagname, fmode)
}
}
+
+ // Sniff for args that were missing a dash.
+ for _, arg := range flag.Args() {
+ if fmode, has := flagModeMappings[arg]; has && (fmode&mode) == mode {
+ if _, has := passedFlags[arg]; !has {
+ logrus.Fatalf("Passed %q as an argument, but it's a parameter name. Did you mean \"-%s\"?", arg, arg)
+ }
+ }
+ }
+
}
func buildEventPacket(passedFlags map[string]flag.Value) (bytes.Buffer, error) { | veneur-emit: Validate args for missing dashes (#<I>) | stripe_veneur | train | go |
ec6340833d35b2d55da4adade7d21916d039f30c | diff --git a/httprunner/v3/runner.py b/httprunner/v3/runner.py
index <HASH>..<HASH> 100644
--- a/httprunner/v3/runner.py
+++ b/httprunner/v3/runner.py
@@ -91,6 +91,10 @@ class TestCaseRunner(object):
raise
finally:
self.validation_results = resp_obj.validation_results
+ # save request & response meta data
+ self.session.meta_data["validators"] = self.validation_results
+ self.session.meta_data["name"] = step.name
+ self.meta_datas.append(self.session.meta_data)
return extract_mapping
@@ -109,10 +113,6 @@ class TestCaseRunner(object):
extract_mapping = self.__run_step(step)
# save extracted variables to session variables
session_variables.update(extract_mapping)
- # save request & response meta data
- self.session.meta_data["validators"] = self.validation_results
- self.session.meta_data["name"] = step.name
- self.meta_datas.append(self.session.meta_data)
return self | fix: log request & response meta data when test failed | HttpRunner_HttpRunner | train | py |
6493222d4213b52b7e9a0745d1a6dc0e18ee10cb | diff --git a/lib/harvester.js b/lib/harvester.js
index <HASH>..<HASH> 100644
--- a/lib/harvester.js
+++ b/lib/harvester.js
@@ -72,6 +72,7 @@ class Harvester extends Readable {
this.client.records(query)
.then(
result => {
+ this.pendingRequests--
debug('returned %d records', result.records.length)
if (result.records.length > 0) successful = true
result.records.forEach(rawRecord => {
@@ -86,6 +87,7 @@ class Harvester extends Readable {
},
err => {
+ this.pendingRequests--
debug('error while fetching records from %d: %s', query.startPosition, err)
const newError = new Error('Error in fetch operation')
newError.err = err
@@ -93,8 +95,6 @@ class Harvester extends Readable {
}
)
.then(() => {
- this.pendingRequests--
-
if (!successful && this.hasMoreRecords()) {
debug('try again')
this.fetchMoreRecords() | Fix harvesting when concurrency=1 | geodatagouv_csw-client | train | js |
ec4f2e1c036227e6c40b1ea8f7a0f727633972d3 | diff --git a/hypertools/datageometry.py b/hypertools/datageometry.py
index <HASH>..<HASH> 100644
--- a/hypertools/datageometry.py
+++ b/hypertools/datageometry.py
@@ -1,6 +1,7 @@
import copy
-import deepdish as dd
-import numpy as np
+import pickle
+import warnings
+
from .tools.normalize import normalize as normalizer
from .tools.reduce import reduce as reducer
from .tools.align import align as aligner
@@ -227,8 +228,9 @@ class DataGeometry(object):
}
# if extension wasn't included, add it
- if fname[-4:]!='.geo':
- fname+='.geo'
+ if not fname.endswith('.geo'):
+ fname += '.geo'
# save
- dd.io.save(fname, geo, compression=compression)
+ with open(fname, 'wb') as f:
+ pickle.dump(geo, f) | switch from deepdish to pickle for save method | ContextLab_hypertools | train | py |
275c3b9b63f16baf395afba6585935a0b4983f4c | diff --git a/code/checkout/OrderProcessor.php b/code/checkout/OrderProcessor.php
index <HASH>..<HASH> 100644
--- a/code/checkout/OrderProcessor.php
+++ b/code/checkout/OrderProcessor.php
@@ -119,6 +119,16 @@ class OrderProcessor{
}
/**
+ * URL to display success message to the user.
+ * Happens after any potential offsite gateway redirects.
+ *
+ * @return String Relative URL
+ */
+ public function getReturnUrl() {
+ return $this->order->Link();
+ }
+
+ /**
* Create a payment model, and provide link to redirect to external gateway,
* or redirect to order link.
* @return string - url for redirection after payment has been made
@@ -131,8 +141,9 @@ class OrderProcessor{
return false;
}
+ // Create a purchase service, and set the user-facing success URL for redirects
$service = PurchaseService::create($payment)
- ->setReturnUrl($this->order->Link());
+ ->setReturnUrl($this->getReturnUrl());
// Process payment, get the result back
$response = $service->purchase($this->getGatewayData($gatewaydata)); | Customizeable returnUrl in OrderProcessor | silvershop_silvershop-core | train | php |
b7f5801c11a2dac5a0c52c0a17ff7fc732c403aa | diff --git a/cnxpublishing/publish.py b/cnxpublishing/publish.py
index <HASH>..<HASH> 100644
--- a/cnxpublishing/publish.py
+++ b/cnxpublishing/publish.py
@@ -9,6 +9,7 @@
Functions used to commit publication works to the archive.
"""
import cnxepub
+import psycopg2
from cnxepub import Document, Binder
from cnxarchive.utils import join_ident_hash, split_ident_hash
@@ -263,7 +264,7 @@ def publish_model(cursor, model, publisher, message):
'module_ident': module_ident,
'filename': 'index.cnxml.html',
'mime_type': 'text/html',
- 'data': model.html.encode('utf-8'),
+ 'data': psycopg2.Binary(model.html.encode('utf-8')),
}
cursor.execute("""\
WITH file_insertion AS ( | Fix the data input from text to binary when inserting content. | openstax_cnx-publishing | train | py |
7da24db294f170ccb6b1d6043117087c660cf24f | diff --git a/src/CognitoClient.php b/src/CognitoClient.php
index <HASH>..<HASH> 100644
--- a/src/CognitoClient.php
+++ b/src/CognitoClient.php
@@ -494,7 +494,7 @@ class CognitoClient
throw new TokenVerificationException('invalid iss');
}
- if ($jwtPayload['token_use'] !== 'access') {
+ if ( !in_array($jwtPayload['token_use'], ['id','access']) ) {
throw new TokenVerificationException('invalid token_use');
}
@@ -502,7 +502,7 @@ class CognitoClient
throw new TokenExpiryException('invalid exp');
}
- return $jwtPayload['username'];
+ return $jwtPayload['username'] ?? $jwtPayload['cognito:username'];
}
/** | Add compatibility with cognito id tokens generated by hosted UI | pmill_aws-cognito | train | php |
6e7e3579c2e1637c8826616f6e541853280bc4c7 | diff --git a/pools.go b/pools.go
index <HASH>..<HASH> 100644
--- a/pools.go
+++ b/pools.go
@@ -423,7 +423,6 @@ func doHTTPRequest(req *http.Request) (*http.Response, error) {
}
if err != nil {
- log.Printf(" HTTP request returned error %v", err)
return nil, err
}
diff --git a/streaming.go b/streaming.go
index <HASH>..<HASH> 100644
--- a/streaming.go
+++ b/streaming.go
@@ -50,7 +50,6 @@ func doHTTPRequestForUpdate(req *http.Request) (*http.Response, error) {
}
if err != nil {
- log.Printf(" HTTP request returned error %v", err)
return nil, err
} | MB-<I> Remove low-level logging of errors. Errors are passed up anyway.
Log messages were unsightly in the client.
Change-Id: Ia4bbe<I>abfbd6db<I>d3e<I>e<I>ae<I>ba
Reviewed-on: <URL> | couchbase_go-couchbase | train | go,go |
080e4efc5f19bc6b79d08ce493dd46a9cd1b3508 | diff --git a/test/unit/command_test.rb b/test/unit/command_test.rb
index <HASH>..<HASH> 100644
--- a/test/unit/command_test.rb
+++ b/test/unit/command_test.rb
@@ -17,6 +17,12 @@ class CommandTest < ActiveSupport::TestCase
assert_equal [%(cap '' deploy)], command.interpolated_arguments
end
+ test '#interpolate_environment_variables escape the variable contents' do
+ malicious_string = '$(echo pwnd)'
+ command = Command.new('echo $FOO', env: {'FOO' => malicious_string}, chdir: '.')
+ assert_equal malicious_string, command.run.chomp
+ end
+
test "#interpolate_environment_variables fallback to ENV" do
command = Command.new('cap $LANG deploy', env: {'ENVIRONMENT' => 'production'}, chdir: '.')
assert_equal [%(cap #{ENV['LANG']} deploy)], command.interpolated_arguments | Add a test to make double sure variable interpolation is safe | Shopify_shipit-engine | train | rb |
0e820057ba1a42d89eaf551e52650602859ee9c8 | diff --git a/after_prepare/uglify.js b/after_prepare/uglify.js
index <HASH>..<HASH> 100755
--- a/after_prepare/uglify.js
+++ b/after_prepare/uglify.js
@@ -5,8 +5,7 @@
// Modules
var fs = require('fs');
var path = require('path');
-var cwd = process.cwd();
-var dependencyPath = path.join(cwd, 'node_modules', 'cordova-uglify', 'node_modules');
+var dependencyPath = path.join(process.cwd(), 'node_modules');
// cordova-uglify module dependencies
var UglifyJS = require(path.join(dependencyPath, 'uglify-js'));
var CleanCSS = require(path.join(dependencyPath, 'clean-css')); | Update how deps are used for npm >= 3 | rossmartin_cordova-uglify | train | js |
d78d2a777797943bc366c72dcfc59f9996880693 | diff --git a/qualysapi/api_objects.py b/qualysapi/api_objects.py
index <HASH>..<HASH> 100644
--- a/qualysapi/api_objects.py
+++ b/qualysapi/api_objects.py
@@ -19,7 +19,7 @@ class Host(object):
self.os = str(os)
self.tracking_method = str(tracking_method)
- def __str__(self):
+ def __repr__(self):
return f"ip: {self.ip}, qualys_id: {self.id}, dns: {self.dns}" | Host object __str__ changed to __repr__
Gives information for individual host objects and host objects
as part of a list. | paragbaxi_qualysapi | train | py |
f62e29631b85ddba827853bebbb8be82a1f718c2 | diff --git a/topologies/server.js b/topologies/server.js
index <HASH>..<HASH> 100644
--- a/topologies/server.js
+++ b/topologies/server.js
@@ -1114,6 +1114,7 @@ var executeSingleOperation = function(self, ns, cmd, queryOptions, options, onAl
// Execute multiple queries
if(onAll) {
+ console.log("!!!!!!!!!! on All")
var connections = self.s.pool.getAll();
var total = connections.length;
// We have an error
@@ -1150,6 +1151,9 @@ var executeSingleOperation = function(self, ns, cmd, queryOptions, options, onAl
commandCallback.raw = true;
}
+ // Increment the request Id
+ query.incRequestId();
+
// Add promote long
commandCallback.promoteLongs = promoteLongs;
@@ -1163,7 +1167,6 @@ var executeSingleOperation = function(self, ns, cmd, queryOptions, options, onAl
self.s.callbacks.register(query.requestId, commandCallback(connections[i]));
try {
- query.incRequestId();
connections[i].write(query.toBin());
} catch(err) {
// Unregister the command callback | Small fix for sending command to all connections | mongodb_node-mongodb-native | train | js |
1230153f1c2d840503549491ae494f67a6e85f19 | diff --git a/openquake/logs.py b/openquake/logs.py
index <HASH>..<HASH> 100644
--- a/openquake/logs.py
+++ b/openquake/logs.py
@@ -45,8 +45,7 @@ LEVELS = {'debug': logging.DEBUG,
flags.DEFINE_string('logfile', '',
'Path to the log file. Leave empty to log to stderr.')
-RISK_LOG = logging.getLogger("risk")
-HAZARD_LOG = logging.getLogger("hazard")
+# TODO: get rid of this
LOG = logging.getLogger()
LOGGING_AMQP_FORMAT = '%(asctime)s %(loglevel)-5s %(processName)s' \
@@ -101,8 +100,6 @@ def init_logs_stdout(level):
LOG.addHandler(hdlr)
LOG.setLevel(logging_level)
- RISK_LOG.setLevel(logging_level)
- HAZARD_LOG.setLevel(logging_level)
# capture java logging (this is what celeryd does with the workers, we use
# exactly the same system for bin/openquakes and the likes)
@@ -129,8 +126,6 @@ def init_logs_amqp(level):
# initialize Python logging
LOG.setLevel(logging_level)
- RISK_LOG.setLevel(logging_level)
- HAZARD_LOG.setLevel(logging_level)
class AMQPHandler(logging.Handler): # pylint: disable=R0902 | RISK_LOG and HAZARD_LOG are removed, LOG is deprecated
and will be removed once logging configuration is ready
Former-commit-id: 1dfa<I>ed4e<I>e<I>ddc1b2fe<I>bcf<I> | gem_oq-engine | train | py |
639bb6fd46390f34b5444236136d15e669797ced | diff --git a/src/Data/WpErrorChannel.php b/src/Data/WpErrorChannel.php
index <HASH>..<HASH> 100644
--- a/src/Data/WpErrorChannel.php
+++ b/src/Data/WpErrorChannel.php
@@ -41,7 +41,7 @@ class WpErrorChannel {
$instance = new static;
$instance->error = $error;
- $channel and $instance->channel = apply_filters( 'wonolog.wp-error-channel', $channel, $error );
+ $channel and $instance->channel = $channel;
return $instance;
} | Don't trigger wonolog.wp-error-channel filter twice
See #<I> | inpsyde_Wonolog | train | php |
dfc23e4cc5f5553991369fba01d8fb101490d986 | diff --git a/bcbio/qc/multiqc.py b/bcbio/qc/multiqc.py
index <HASH>..<HASH> 100644
--- a/bcbio/qc/multiqc.py
+++ b/bcbio/qc/multiqc.py
@@ -230,6 +230,9 @@ def _create_config_file(out_dir, samples):
if any(("qualimap" in dd.get_tools_on(d) or "qualimap_full" in dd.get_tools_on(d)) for d in samples):
out["table_columns_visible"]["bcbio"] = {"Average_insert_size": False}
out["table_columns_visible"]["FastQC"] = {"percent_gc": False}
+ # Avoid confusing peddy outputs, sticking to ancestry and sex prediction
+ out["table_columns_visible"]["Peddy"] = {"family_id": False, "sex_het_ratio": False,
+ "error_sex_check": False}
# Setting the module order
module_order = [] | MultiQC: hide problematic peddy columns from main table
Focus on ancestry and sex predictions avoiding other information. | bcbio_bcbio-nextgen | train | py |
d9a494b8cf1b82e3f4598659e8968c18b48ae875 | diff --git a/flashpolicy/tests.py b/flashpolicy/tests.py
index <HASH>..<HASH> 100644
--- a/flashpolicy/tests.py
+++ b/flashpolicy/tests.py
@@ -65,6 +65,7 @@ class PolicyGeneratorTestCase(TestCase):
"""
domains = ['media.example.com', 'api.example.com']
policy = policies.simple_policy(domains)
+ self.assertEqual(len(policy.documentElement.childNodes), 2)
self.assertEqual(len(policy.getElementsByTagName('allow-access-from')), 2)
domain_elems = policy.getElementsByTagName('allow-access-from')
for i, domain in enumerate(domains): | Verify that the domains go in the right place. | ubernostrum_django-flashpolicies | train | py |
2914ba6af56fc01bd5b3b51b81c50cb068943a03 | diff --git a/test/startservers.py b/test/startservers.py
index <HASH>..<HASH> 100644
--- a/test/startservers.py
+++ b/test/startservers.py
@@ -47,7 +47,9 @@ def start():
up explicitly by calling stop(), or automatically atexit.
"""
global processes
- ToSServerThread().start()
+ t = ToSServerThread()
+ t.daemon = True
+ t.start()
for prog in [
'cmd/boulder-wfe',
'cmd/boulder-ra', | Fix "main process kept alive forever by ToSServerThread." | letsencrypt_boulder | train | py |
a7907d37b2dcf1067a478bdc02064305461658ef | diff --git a/addon/search/searchcursor.js b/addon/search/searchcursor.js
index <HASH>..<HASH> 100644
--- a/addon/search/searchcursor.js
+++ b/addon/search/searchcursor.js
@@ -159,7 +159,7 @@
for (var i = 1; i < lines.length - 1; i++)
if (fold(doc.getLine(line + i)) != lines[i]) continue search
var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1]
- if (end.slice(0, lastLine.length) != lastLine) continue search
+ if (endString.slice(0, lastLine.length) != lastLine) continue search
return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch),
to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))}
} | [searchcursor addon] Fix bug in case folding | codemirror_CodeMirror | train | js |
73a2a6b9dcfecd1f5219460a4050a7903d6106c1 | diff --git a/tests/amd/middleware.spec.js b/tests/amd/middleware.spec.js
index <HASH>..<HASH> 100644
--- a/tests/amd/middleware.spec.js
+++ b/tests/amd/middleware.spec.js
@@ -261,6 +261,33 @@ define([
server.respond();
});
+
+ it('should not break everything if a middleware breaks', function (done) {
+ // configure response
+ server.respondWith('GET',
+ 'http://example.tld/bar',
+ [200, {'Content-Type': 'application/json'}, '{"result": "ok"}']
+ );
+ var spyMiddleware = sinon.spy(function (req) {
+ throw new Error('boo!');
+ });
+
+ var thenSpy = sinon.spy(function () {});
+
+ api.register('spy', spyMiddleware);
+
+ api.api.foo()
+ .then(thenSpy)
+ .catch(function (err, res) {
+ err.message.should.eql('boo!');
+
+ thenSpy.should.not.have.been.called;
+ spyMiddleware.should.been.called;
+ done();
+ });
+
+ server.respond();
+ });
});
describe('multiple middlewares', function () { | test(middlewares): add test about middleware throwing error | stephanebachelier_superapi | train | js |
3c222a97967aad0c26d563861e84abc0c8166c69 | diff --git a/lib/weary.rb b/lib/weary.rb
index <HASH>..<HASH> 100644
--- a/lib/weary.rb
+++ b/lib/weary.rb
@@ -3,6 +3,7 @@ $:.unshift(File.dirname(__FILE__))
require 'uri'
require 'net/http'
require 'net/https'
+require 'set'
require 'rubygems'
require 'crack'
@@ -22,7 +23,7 @@ require 'weary/httpverb'
module Weary
- Methods = [:get, :post, :put, :delete, :head]
+ Methods = Set[:get, :post, :put, :delete, :head]
ContentTypes = { :json => [:json, 'json', 'application/json', 'text/json', 'application/javascript', 'text/javascript'],
:xml => [:xml, 'xml', 'text/xml', 'application/xml'],
:html => [:html, 'html', 'text/html'], | Weary::Methods is a Set; order is unimportant | mwunsch_weary | train | rb |
2a36b847c5e8fb16b46dbd46d20e05017006ff73 | diff --git a/src/Trackers/SessionTracker.php b/src/Trackers/SessionTracker.php
index <HASH>..<HASH> 100644
--- a/src/Trackers/SessionTracker.php
+++ b/src/Trackers/SessionTracker.php
@@ -250,7 +250,7 @@ class SessionTracker implements SessionTrackerContract
$this->setSessionId($id);
}
else {
- $session = Session::firstOrCreate(Arr::only($this->sessionInfo, ['uuid']), $this->sessionInfo);
+ $session = $this->firstOrCreate(Arr::only($this->sessionInfo, ['uuid']), $this->sessionInfo);
$this->setSessionId($session->id);
$this->storeSession();
}
@@ -258,6 +258,26 @@ class SessionTracker implements SessionTrackerContract
return $known;
}
+ protected function firstOrCreate(array $attributes, array $values = [])
+ {
+ if (version_compare(app()->version(), '5.2.0', '>='))
+ return Session::firstOrCreate($attributes, $values);
+
+ $instance = new Session;
+
+ foreach ($attributes as $key => $value) {
+ $instance = $instance->where($key, $value);
+ }
+
+ if ( ! is_null($first = $instance->first()))
+ return $first;
+
+ $instance = new Session($attributes + $values);
+ $instance->save();
+
+ return $instance;
+ }
+
/**
* Check if the session is known.
* | Fixing the Laravel <I> support | ARCANEDEV_LaravelTracker | train | php |
d673645bbc6ca7707cf852f4cc13f57e8f6deba4 | diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -2132,8 +2132,10 @@ end
# Collect the current prereqs
list.each { |dep|
+ next if dep.nil?
+
# Support them passing objects directly, to save some effort.
- unless dep.is_a? Puppet::Type
+ unless dep.is_a?(Puppet::Type)
# Skip autorelation that we aren't managing
unless dep = rel_catalog.resource(type, dep)
next | (PUP-<I>) Handle autorequire with undef values
Prior to this commit, an autorequire that produced `undef` values would
produce an error:
```
No title provided and :xxx is not a valid resource reference
```
This commit ensures that `undef` entries provided by an autorequire are
skipped over. | puppetlabs_puppet | train | rb |
aa11c16f389524079bf10c4dd22c1a2a1060177e | diff --git a/src/j42/LaravelFirebase/FirebaseClient.php b/src/j42/LaravelFirebase/FirebaseClient.php
index <HASH>..<HASH> 100644
--- a/src/j42/LaravelFirebase/FirebaseClient.php
+++ b/src/j42/LaravelFirebase/FirebaseClient.php
@@ -119,13 +119,16 @@ class FirebaseClient {
// Return: (Guzzle) Firebase Response
- // Args: (string) $path, (Array) $data, (string) $method
- public function write($path, Array $data, $method = 'PUT') {
+ // Args: (string) $path, (Array || Object) $data, (string) $method
+ public function write($path, $data, $method = 'PUT') {
// Sanity Checks
- $json = json_encode($data);
+ if (!is_array($data) && !is_object($data)) throw new \UnexpectedValueException('Invalid input type received');
if ($json === 'null') throw new \UnexpectedValueException('HTTP Error: Invalid request (invalid JSON)');
+ // Typecase Data to JSON
+ $json = json_encode((array) $data);
+
// Process Request
$request = $this->http->createRequest($method, $path, ['body' => $json]);
$request->setHeader('Content-Type', 'application/json'); | Looser typing on write functions (takes Eloquent models with array typecasting instead of forcing arrays in the arguments) | j42_laravel-firebase | train | php |
a906bde272b1af5e92526ae31ed9931ad7bb90bb | diff --git a/test/test_cursors.rb b/test/test_cursors.rb
index <HASH>..<HASH> 100644
--- a/test/test_cursors.rb
+++ b/test/test_cursors.rb
@@ -102,6 +102,11 @@ class TestSpinningCursorCursor < Test::Unit::TestCase
spinner.join
+ $cycle_times.each_cons(2) do |t1, t2|
+ interval = t2-t1
+ assert (interval > delay and interval < (1.5 * delay))
+ end
+
# slight delay to get things started
sleep (delay/3.0)
buffer = (ESC_R_AND_CLR + "|") | Check the cycle intervals
Check to see if intervals is (almost) equal to the given delay.
Interval should be equal of greater than delay (max <I>% of given delay).
This is because the delay time when threading is not <I>% guaranteed. | prydonius_spinning_cursor | train | rb |
4fc2a748133862c11332e9d0a4862bab8eb9d9b1 | diff --git a/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java b/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java
index <HASH>..<HASH> 100755
--- a/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java
@@ -186,7 +186,7 @@ public enum OGlobalConfiguration {
// DATABASE
DB_POOL_MIN("db.pool.min", "Default database pool minimum size", Integer.class, 1),
- DB_POOL_MAX("db.pool.max", "Default database pool maximum size", Integer.class, 20),
+ DB_POOL_MAX("db.pool.max", "Default database pool maximum size", Integer.class, 100),
DB_POOL_IDLE_TIMEOUT("db.pool.idleTimeout", "Default database pool maximum size", Integer.class, 0), | Improved default connection pool max size to <I> | orientechnologies_orientdb | train | java |
3f9719205a9f23b0320fd72e4f3c9da0a6222038 | diff --git a/lib/cursor.js b/lib/cursor.js
index <HASH>..<HASH> 100644
--- a/lib/cursor.js
+++ b/lib/cursor.js
@@ -167,7 +167,7 @@ var execInitialQuery = function(query, cmd, options, cursorState, connection, lo
if(Array.isArray(result.documents) && result.documents.length == 1) {
if(result.documents[0]['$err']
|| result.documents[0]['errmsg']) {
- return callback(new MongoError(result.documents[0]), null);
+ return callback(MongoError.create(result.documents[0]), null);
}
if(result.documents[0].cursor != null
@@ -357,7 +357,7 @@ Cursor.prototype.next = function(callback) {
// We have a dead and killed cursor, attempting to call next should error
if(self.cursorState.dead && self.cursorState.killed) {
- return handleCallback(callback, new MongoError("cursor is dead"));
+ return handleCallback(callback, MongoError.create("cursor is dead"));
}
// We have just started the cursor | fixed issues with MongoError creation on cursor | mongodb-js_mongodb-core | train | js |
Subsets and Splits