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 |
|---|---|---|---|---|---|
865366379519e095a68bfc6b5c087193e75fcaf3 | diff --git a/src/feat/extern/log/log.py b/src/feat/extern/log/log.py
index <HASH>..<HASH> 100644
--- a/src/feat/extern/log/log.py
+++ b/src/feat/extern/log/log.py
@@ -20,6 +20,7 @@ Maintainer: U{Thomas Vander Stichele <thomas at apestaart dot org>}
import errno
import sys
import os
+import shutil
import fnmatch
import time
import types
@@ -710,8 +711,8 @@ def moveLogFiles(out_filename, err_filename):
def doMove(src, dst):
try:
- os.rename(src, dst)
- except OSError as e:
+ shutil.move(src, dst)
+ except IOError as e:
error('log', 'Error moving file %s -> %s. Error: %r',
src, dst, e)
@@ -721,6 +722,7 @@ def moveLogFiles(out_filename, err_filename):
_stdout = out_filename
_stderr = err_filename
+ reopenOutputFiles()
def outputToFiles(stdout=None, stderr=None): | Avoid cross-device link errors renaming file over 2 filesystems | f3at_feat | train | py |
49dcc24195d262437cc35997a811eb724d65b48b | diff --git a/spec/unit/util/network_device/transport/ssh_spec.rb b/spec/unit/util/network_device/transport/ssh_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/util/network_device/transport/ssh_spec.rb
+++ b/spec/unit/util/network_device/transport/ssh_spec.rb
@@ -4,8 +4,7 @@ require File.dirname(__FILE__) + '/../../../../spec_helper'
require 'puppet/util/network_device/transport/ssh'
-describe Puppet::Util::NetworkDevice::Transport::Ssh do
- confine "Missing net/ssh" => Puppet.features.ssh?
+describe Puppet::Util::NetworkDevice::Transport::Ssh, :if => Puppet.features.ssh? do
before(:each) do
@transport = Puppet::Util::NetworkDevice::Transport::Ssh.new()
@@ -209,4 +208,4 @@ describe Puppet::Util::NetworkDevice::Transport::Ssh do
end
end
-end
\ No newline at end of file
+end | Updated confine in Spec test for RSpec 2 | puppetlabs_puppet | train | rb |
dcf4781fb25b9f814716e333ea94ea8c6e8f5053 | diff --git a/registry/tokentransport.go b/registry/tokentransport.go
index <HASH>..<HASH> 100644
--- a/registry/tokentransport.go
+++ b/registry/tokentransport.go
@@ -69,7 +69,7 @@ func (t *TokenTransport) auth(authService *authService) (string, *http.Response,
}
func (t *TokenTransport) retry(req *http.Request, token string) (*http.Response, error) {
- req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))
+ req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
resp, err := t.Transport.RoundTrip(req)
return resp, err
} | Replace basic auth with bearer
I found that this was necessary to get it to work with registry-1.docker.io.
Otherwise it sends two Authorization headers, one Basic and one Bearer, and I think the server only looks at the first. | heroku_docker-registry-client | train | go |
1c6033c11e94438049085361bd1287e00ffcaa52 | diff --git a/classes/Boom/Model/Asset.php b/classes/Boom/Model/Asset.php
index <HASH>..<HASH> 100644
--- a/classes/Boom/Model/Asset.php
+++ b/classes/Boom/Model/Asset.php
@@ -206,7 +206,7 @@ class Boom_Model_Asset extends Model_Taggable
{
// Add files for previous versions of the asset.
// Wrap the glob in array_reverse() so that we end up with an array with the most recent first.
- foreach (array_reverse(glob($this->directory().".*.bak")) as $file)
+ foreach (array_reverse(glob($this->path().".*.bak")) as $file)
{
// Get the version ID out of the filename.
preg_match('/' . $this->id . '.(\d+).bak$/', $file, $matches); | Fixed viewing an asset's previous files | boomcms_boom-core | train | php |
9ef17322be414bfb89cd8b7a1b74a61dc036434f | diff --git a/lib/config/config.go b/lib/config/config.go
index <HASH>..<HASH> 100644
--- a/lib/config/config.go
+++ b/lib/config/config.go
@@ -135,8 +135,9 @@ func NewWithFreePorts(myID protocol.DeviceID) (Configuration, error) {
cfg.Options.RawListenAddresses = []string{"default"}
} else {
cfg.Options.RawListenAddresses = []string{
- fmt.Sprintf("tcp://%s", net.JoinHostPort("0.0.0.0", strconv.Itoa(port))),
+ util.Address("tcp", net.JoinHostPort("0.0.0.0", strconv.Itoa(port))),
"dynamic+https://relays.syncthing.net/endpoint",
+ util.Address("quic", net.JoinHostPort("0.0.0.0", strconv.Itoa(port))),
}
} | lib/config: Add missing quic address in case of non-default port (fixes #<I>) (#<I>)
* Add quic listener on instance of port blockage
* Update lib/config/config.go | syncthing_syncthing | train | go |
1ba578ef59c7a0d837988261b6078119c4815872 | diff --git a/jfoenix/src/main/java/com/jfoenix/controls/JFXDecorator.java b/jfoenix/src/main/java/com/jfoenix/controls/JFXDecorator.java
index <HASH>..<HASH> 100644
--- a/jfoenix/src/main/java/com/jfoenix/controls/JFXDecorator.java
+++ b/jfoenix/src/main/java/com/jfoenix/controls/JFXDecorator.java
@@ -322,6 +322,7 @@ public class JFXDecorator extends VBox {
return; // maximized mode does not support resize
}
if (!primaryStage.isResizable()) {
+ updateInitMouseValues(mouseEvent);
return;
}
double x = mouseEvent.getX(); | fixed #<I> moving JFXDecorator window causes it to get snapped to mouse pointer if stage is not re-sizable | jfoenixadmin_JFoenix | train | java |
86db24db6f202f5f689283ab95be02ed1945bb65 | diff --git a/tests/legacy/background-events.js b/tests/legacy/background-events.js
index <HASH>..<HASH> 100644
--- a/tests/legacy/background-events.js
+++ b/tests/legacy/background-events.js
@@ -686,6 +686,21 @@ describe('background events', function() {
$('#cal').fullCalendar(options);
});
});
+
+ describe('when out of view range', function() {
+ it('should still render', function(done) {
+ options.events = [ {
+ start: '2014-01-01T01:00:00',
+ end: '2014-01-01T05:00:00',
+ rendering: 'inverse-background'
+ } ];
+ options.eventAfterAllRender = function() {
+ expect($('.fc-bgevent').length).toBe(7);
+ done();
+ };
+ $('#cal').fullCalendar(options);
+ });
+ });
});
it('can have custom Event Object color', function(done) { | added test for out of range inverse-background events | fullcalendar_fullcalendar | train | js |
cc7a920847285ce3206a1db9f1e02dfd44fb6a1a | diff --git a/lib/itamae/recipe.rb b/lib/itamae/recipe.rb
index <HASH>..<HASH> 100644
--- a/lib/itamae/recipe.rb
+++ b/lib/itamae/recipe.rb
@@ -49,10 +49,15 @@ module Itamae
false
end
- def method_missing(method, name, &block)
+ def method_missing(*args, &block)
+ super unless args.size == 2
+
+ method, name = args
klass = Resource.get_resource_class(method)
resource = klass.new(self, name, &block)
@children << resource
+ rescue
+ super
end
def include_recipe(recipe) | method_missing should accepts any num of args. | itamae-kitchen_itamae | train | rb |
c2b57107a699d280ac002216f786490066f8c9b2 | diff --git a/tourney.js b/tourney.js
index <HASH>..<HASH> 100644
--- a/tourney.js
+++ b/tourney.js
@@ -45,9 +45,12 @@ Tourney.inherit = function (Klass, Initial) {
// ignore inherited `sub`, `inherit`, and `from` for now for sanity
};
-Tourney.sub = function (name, init, Initial) {
- // Preserve Tournament API. This ultimately calls (Initial || Tourney).inherit
- Tournament.sub(name, init, Initial || Tourney);
+Tourney.defaults = Tournament.defaults;
+Tourney.invalid = Tournament.invalid;
+
+Tourney.sub = function (name, init) {
+ // Preserve Tournament API. This ultimately calls Tourney.inherit
+ return Tournament.sub(name, init, Tourney);
};
// TODO: Tourney.from should be almost identical to Tournament's | make sub work properly and implement Initial defaults and invalid | clux_tourney | train | js |
9fd3339e79a2b78d984c8d4bf7c22a2f3aa65f37 | diff --git a/connector.go b/connector.go
index <HASH>..<HASH> 100644
--- a/connector.go
+++ b/connector.go
@@ -26,7 +26,7 @@ type HostConfig struct {
type TransportConfig struct {
SslVerify bool
certPool *x509.CertPool
- HttpRequestTimeout int // in seconds
+ HttpRequestTimeout time.Duration // in seconds
HttpPoolConnections int
}
@@ -127,7 +127,7 @@ func (whr *WapiHttpRequestor) Init(cfg TransportConfig) {
TLSClientConfig: &tls.Config{InsecureSkipVerify: !cfg.SslVerify,
RootCAs: cfg.certPool},
MaxIdleConnsPerHost: cfg.HttpPoolConnections,
- ResponseHeaderTimeout: time.Duration(cfg.HttpRequestTimeout * 1000000000), // ResponseHeaderTimeout is in nanoseconds
+ ResponseHeaderTimeout: cfg.HttpRequestTimeout * time.Second,
}
whr.client = http.Client{Transport: tr} | Replace hardcoded <I> with time.Second.
While here declare HttpRequestTimeout as a time.Duration so there is no
need for a type conversion. | infobloxopen_infoblox-go-client | train | go |
924bf628b8a4bee74e8157ca631d40d5d8451573 | diff --git a/lib/rules/security/not-rely-on-time.js b/lib/rules/security/not-rely-on-time.js
index <HASH>..<HASH> 100644
--- a/lib/rules/security/not-rely-on-time.js
+++ b/lib/rules/security/not-rely-on-time.js
@@ -28,7 +28,7 @@ class NotRelyOnTimeChecker extends BaseChecker {
}
MemberAccess(node) {
- if (node.memberName === 'timestamp' && node.expression.name === 'block') {
+ if (node.expression.name === 'block' && node.memberName === 'timestamp') {
this._warn(node)
}
} | Update lib/rules/security/not-rely-on-time.js | protofire_solhint | train | js |
3fa8cf3c2ea70bb81fb94a36c3f4e0ca664164c4 | diff --git a/bika/lims/exportimport/setupdata/__init__.py b/bika/lims/exportimport/setupdata/__init__.py
index <HASH>..<HASH> 100644
--- a/bika/lims/exportimport/setupdata/__init__.py
+++ b/bika/lims/exportimport/setupdata/__init__.py
@@ -399,7 +399,7 @@ class Lab_Products(WorksheetImporter):
# Iterate through the rows
for row in self.get_rows(3):
# Check for required columns
- check_for_required_columns('SRTemplate', row, [
+ check_for_required_columns('LabProduct', row, [
'title', 'volume', 'unit', 'price'
])
# Create the SRTemplate object | SRTemplate should be LabProduct in Lab_Products importer | senaite_senaite.core | train | py |
e55e8801d3ac6c7c6d96f0ee399f51ff8ff1ac45 | diff --git a/tests/test_web_runner.py b/tests/test_web_runner.py
index <HASH>..<HASH> 100644
--- a/tests/test_web_runner.py
+++ b/tests/test_web_runner.py
@@ -55,9 +55,10 @@ async def test_runner_setup_without_signal_handling(make_runner) -> None:
async def test_site_double_added(make_runner) -> None:
+ _sock = get_unused_port_socket('127.0.0.1')
runner = make_runner()
await runner.setup()
- site = web.TCPSite(runner)
+ site = web.SockSite(runner, _sock)
await site.start()
with pytest.raises(RuntimeError):
await site.start() | Fix test_site_double_added to use ephemeral port | aio-libs_aiohttp | train | py |
5da8ef1439f3352280f938ade8631e6b6a73f62e | diff --git a/lib/flor/core/executor.rb b/lib/flor/core/executor.rb
index <HASH>..<HASH> 100644
--- a/lib/flor/core/executor.rb
+++ b/lib/flor/core/executor.rb
@@ -404,6 +404,11 @@ module Flor
def process(message)
+ fail ArgumentError.new("incoming message has non nil or Hash payload") \
+ unless message['payload'] == nil || message['payload'].is_a?(Hash)
+ #
+ # weed out messages with non-conforming payloads
+
begin
message['m'] = counter_next('msgs') # number messages | Fail early on messages with non nil/Hash payloads | floraison_flor | train | rb |
19453933562e191e88c51708ca1d47b34ca51f24 | diff --git a/modules/orionode/server.js b/modules/orionode/server.js
index <HASH>..<HASH> 100644
--- a/modules/orionode/server.js
+++ b/modules/orionode/server.js
@@ -16,6 +16,7 @@ var auth = require('./lib/middleware/auth'),
fs = require('fs'),
mkdirp = require('mkdirp'),
os = require('os'),
+ constants = require('constants'),
log4js = require('log4js'),
compression = require('compression'),
path = require('path'),
@@ -103,6 +104,7 @@ function startServer(cb) {
var app = express();
if (configParams.get("orion.https.key") && configParams.get("orion.https.cert")) {
server = https.createServer({
+ secureOptions: constants.SSL_OP_NO_TLSv1,
key: fs.readFileSync(configParams.get("orion.https.key")),
cert: fs.readFileSync(configParams.get("orion.https.cert"))
}, app); | [vulnerability] Disable TLS <I> in orion servers in public org-ids/web-ide-issues#<I> | eclipse_orion.client | train | js |
787bc7a637290ebb2461c1da1f4418de08cbc82e | diff --git a/coaster/views/classview.py b/coaster/views/classview.py
index <HASH>..<HASH> 100644
--- a/coaster/views/classview.py
+++ b/coaster/views/classview.py
@@ -181,8 +181,6 @@ class ViewDecorator(object):
use_options.update(class_options)
endpoint = use_options.pop('endpoint', self.endpoint)
self.endpoints.add(endpoint)
- # If there are multiple rules with custom endpoint names, the last route's prevails here
- self.endpoint = endpoint
use_rule = rulejoin(class_rule, method_rule)
app.add_url_rule(use_rule, endpoint, view_func, **use_options)
if callback: | We broke endpoints. Unbreak. | hasgeek_coaster | train | py |
96d9674ccddb84a1b38bad5a7516b7b7e790bb6b | diff --git a/mousedb/data/views.py b/mousedb/data/views.py
index <HASH>..<HASH> 100644
--- a/mousedb/data/views.py
+++ b/mousedb/data/views.py
@@ -230,17 +230,19 @@ def experiment_details_csv(request, pk):
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=experiment.csv'
writer = csv.writer(response)
- writer.writerow(["Animal","Cage", "Strain", "Genotype", "Age", "Assay", "Values", "Feeding", "Treatment"])
+ writer.writerow(["Animal","Cage", "Strain", "Genotype", "Gender","Age", "Assay", "Values", "Feeding", "Experiment Date", "Treatment"])
for measurement in experiment.measurement_set.iterator():
writer.writerow([
measurement.animal,
measurement.animal.Cage,
measurement.animal.Strain,
measurement.animal.Genotype,
+ measurement.animal.Gender,
measurement.age(),
measurement.assay,
measurement.values,
measurement.experiment.feeding_state,
+ measurement.experiment.date,
measurement.animal.treatment_set.all()
])
return response | Added Gender and Date to Experiment csv file. Closes #<I> | davebridges_mousedb | train | py |
3c7f7ec3c849328fa91c206825a87dc1ba497193 | diff --git a/netpyne/sim/utils.py b/netpyne/sim/utils.py
index <HASH>..<HASH> 100644
--- a/netpyne/sim/utils.py
+++ b/netpyne/sim/utils.py
@@ -897,6 +897,7 @@ def clearAll():
matplotlib.pyplot.close('all')
# clean rxd components
+ '''
if hasattr(sim.net, 'rxd'):
sim.clearObj(sim.net.rxd)
@@ -928,9 +929,10 @@ def clearAll():
rxd.species._has_3d = False
rxd.rxd._zero_volume_indices = np.ndarray(0, dtype=np.int_)
rxd.set_solve_type(dimension=1)
- print('cleared all')
+
#except:
# pass
+ '''
if hasattr(sim, 'net'):
del sim.net | remove rxd clearing until fixed | Neurosim-lab_netpyne | train | py |
3abeaaa17b020ab05e815e53eba01ddf7c2f6f75 | diff --git a/lib/steam/java.rb b/lib/steam/java.rb
index <HASH>..<HASH> 100644
--- a/lib/steam/java.rb
+++ b/lib/steam/java.rb
@@ -28,6 +28,7 @@ module Steam
import('java.util.Arrays', :Arrays)
import('java.util.ArrayList', :ArrayList)
import('org.apache.commons.httpclient.NameValuePair', :NameValuePair)
+ # import('com.gargoylesoftware.htmlunit.util.NameValuePair', :NameValuePair) # HtmlUnit 2.7
end
def set_classpath! | import statement as needed from htmlunit <I> on | svenfuchs_steam | train | rb |
b3f01666af151eb27dba79db8daba54b90fe1fec | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -18,7 +18,7 @@ module.exports = function (grunt) {
* Some basic information e.g. to create a banner
*/
basicInformation: {
- author: 'Michael Raith <Bruce17@users.noreply.github.com>',
+ author: 'Michael Raith <mia87@web.de>',
url: 'https://github.com/Bruce17',
date: '<%= grunt.template.today("yyyy-mm-dd hh:MM:ss") %>'
}, | Gruntfile: changed e-mail | Bruce17_node-redis-rpc | train | js |
5b98fc85dd55ed1f572bd6e8277fc9968e841a9f | diff --git a/tools/lbd_lock_test/testrunner.py b/tools/lbd_lock_test/testrunner.py
index <HASH>..<HASH> 100755
--- a/tools/lbd_lock_test/testrunner.py
+++ b/tools/lbd_lock_test/testrunner.py
@@ -83,13 +83,12 @@ def runTest(i):
prevnow = now
sys.stdout.write(" %d seconds " % ((now - start).seconds))
- # if no dots read in 10 seconds, then we assume the java proc has hung
- if (now - lastdotprinted).seconds > 20:
- print("\nSorry, this platfrom may have reproduced the issue. If you do not see more dots, it's sadness time.")
- possiblyFailed = True
+ # if no dots read in 10 seconds, then we assume the java proc has hung
+ if (now - lastdotprinted).seconds > 20:
+ print("\nSorry, this platfrom may have reproduced the issue. If you do not see more dots, it's sadness time.")
+ possiblyFailed = True
- # if all's gone well for DURATION_IN_SECONDS, we kill the proc and return true
- if possiblyFailed == False:
+ # if all's gone well for DURATION_IN_SECONDS, we kill the proc and return true
if (now - start).seconds > DURATION_IN_SECONDS:
print("\nThis run (%d) did not reproduce the issue." % (i))
killProcess(p) | Updating test runner so it won't print out the error message ad nauseam. | VoltDB_voltdb | train | py |
4d0f432a43bd6380143f67624418970f0588253c | diff --git a/cardinal_pythonlib/tests/dogpile_cache_tests.py b/cardinal_pythonlib/tests/dogpile_cache_tests.py
index <HASH>..<HASH> 100644
--- a/cardinal_pythonlib/tests/dogpile_cache_tests.py
+++ b/cardinal_pythonlib/tests/dogpile_cache_tests.py
@@ -52,6 +52,7 @@ log = logging.getLogger(__name__)
class DogpileCacheTests(unittest.TestCase):
+ @pytest.mark.xfail(reason="Needs investigating")
def test_dogpile_cache(self) -> None:
"""
Test our extensions to dogpile.cache. | xfail dogpile cache tests for now | RudolfCardinal_pythonlib | train | py |
9993516b09335422621063d75e32465a0d5e662a | diff --git a/src/Task/Common/DisplayException.php b/src/Task/Common/DisplayException.php
index <HASH>..<HASH> 100644
--- a/src/Task/Common/DisplayException.php
+++ b/src/Task/Common/DisplayException.php
@@ -24,7 +24,7 @@
$div->append(Tag::h2('File'), Tag::pre($exception->getFile())->append(':', $exception->getLine())->setSeparator(''));
// shorten Trace
- $trace = String::cast($exception->getTraceAsString())->replace(getcwd(), '');
+ $trace = String::cast($exception->getTraceAsString())->replace(getcwd() . '/', '');
$div->append(Tag::h2('Trace'), Tag::pre($trace)); | Remove leading '/' in relative paths of exception trace in DisplayException | objective-php_application | train | php |
c0afc42d4e4e229b786d1ba5e81e35df7ff5822e | diff --git a/model/execution/Counter/DeliveryExecutionCounterService.php b/model/execution/Counter/DeliveryExecutionCounterService.php
index <HASH>..<HASH> 100644
--- a/model/execution/Counter/DeliveryExecutionCounterService.php
+++ b/model/execution/Counter/DeliveryExecutionCounterService.php
@@ -55,14 +55,15 @@ class DeliveryExecutionCounterService extends ConfigurableService implements Del
$toStatusKey = $this->getStatusKey($event->getState());
$persistence = $this->getPersistence();
- if ($this->count($event->getPreviousState()) > 0) {
+ if ($persistence->exists($fromStatusKey) && $persistence->get($fromStatusKey) > 0) {
$persistence->decr($fromStatusKey);
}
- if ($persistence->get($toStatusKey) === false) {
- $persistence->set($toStatusKey, 0);
+ if (!$persistence->exists($toStatusKey)) {
+ $persistence->set($toStatusKey, 1);
+ } else {
+ $persistence->incr($toStatusKey);
}
- $persistence->incr($toStatusKey);
}
/** | ckeck existence of key in KV storage in DeliveryExecutionCounterService | oat-sa_extension-tao-delivery | train | php |
1228725eade2c4ab9987076c3d573fc31a623b56 | 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
@@ -2636,7 +2636,7 @@ def get_nearest_terms_in_bibrec(p, f, n_below, n_above):
col = 'modification_date'
res_above = run_sql("""SELECT DATE_FORMAT(%s,'%%%%Y-%%%%m-%%%%d %%%%H:%%%%i:%%%%s')
FROM bibrec WHERE %s < %%s
- ORDER BY %s ASC LIMIT %%s""" % (col, col, col),
+ ORDER BY %s DESC LIMIT %%s""" % (col, col, col),
(p, n_above))
res_below = run_sql("""SELECT DATE_FORMAT(%s,'%%%%Y-%%%%m-%%%%d %%%%H:%%%%i:%%%%s')
FROM bibrec WHERE %s > %%s
@@ -2647,7 +2647,9 @@ def get_nearest_terms_in_bibrec(p, f, n_below, n_above):
out.add(row[0])
for row in res_below:
out.add(row[0])
- return list(out)
+ out_list = list(out)
+ out_list.sort()
+ return list(out_list)
def get_nbhits_in_bibrec(term, f):
"""Return number of hits in bibrec table. term is usually a date, | WebSearch: fix nearest terms offer for date search
* Fix nearest terms offer for datecreated/datemodified searches.
(closes #<I>) | inveniosoftware_invenio-records | train | py |
e02d5fc1cf2f6fe81a40cb1ff832d95246d002a7 | diff --git a/docroot/modules/custom/ymca_camp_du_nord/modules/ymca_cdn_product/src/CdnPrsProductRepository.php b/docroot/modules/custom/ymca_camp_du_nord/modules/ymca_cdn_product/src/CdnPrsProductRepository.php
index <HASH>..<HASH> 100644
--- a/docroot/modules/custom/ymca_camp_du_nord/modules/ymca_cdn_product/src/CdnPrsProductRepository.php
+++ b/docroot/modules/custom/ymca_camp_du_nord/modules/ymca_cdn_product/src/CdnPrsProductRepository.php
@@ -109,6 +109,9 @@ class CdnPrsProductRepository implements CdnPrsProductRepositoryInterface {
'field_cdn_prd_id' => $product['ProductID'],
'field_cdn_prd_object' => serialize($product),
'field_cdn_prd_start_date' => $dateTime->format(DATETIME_DATETIME_STORAGE_FORMAT),
+ 'field_cdn_prd_cabin_id' => substr($product['ProductCode'], 6, 4),
+ 'field_cdn_prd_capacity' => abs(substr($product['ProductCode'], 11, 2)),
+ 'field_cdn_prd_cabin_number' => abs(substr($product['ProductCode'], 7, 4)),
];
foreach ($popsToSave as $fieldName => $fieldValue) { | [YTCD-6] Fill product fields while sync | ymcatwincities_openy | train | php |
44f0f7337bb138f5118cc8e9b3717cf4949a3424 | diff --git a/src/App.php b/src/App.php
index <HASH>..<HASH> 100644
--- a/src/App.php
+++ b/src/App.php
@@ -481,7 +481,7 @@ class App
if (!$this->html) {
throw new Exception(['App does not know how to add style']);
}
- $this->html->template->appendHTML('HEAD', $this->getTag('style', $style));
+ $this->html->template->appendHTML('HEAD', $this->getTag('style', null, $style, false));
}
/**
@@ -882,10 +882,11 @@ class App
* @param string|array $tag
* @param string $attr
* @param string|array $value
+ * @param bool $encodeValue
*
* @return string
*/
- public function getTag($tag = null, $attr = null, $value = null)
+ public function getTag($tag = null, $attr = null, $value = null, bool $encodeValue = true)
{
if ($tag === null) {
$tag = 'div';
@@ -928,7 +929,7 @@ class App
}
if (is_string($value)) {
- $value = $this->encodeHTML($value);
+ $value = $this->encodeHTML($encodeValue ? $value : strip_tags($value));
} elseif (is_array($value)) {
$result = [];
foreach ($value as $v) { | App::addStyle should not encode value (#<I>)
* fix #<I>
* as fallback use strip_tags anyway to avoid attacks | atk4_ui | train | php |
50339dba18d50cdd5fecbc4219475fd3a0cb0f9a | diff --git a/eZ/Publish/Core/Repository/ObjectStateService.php b/eZ/Publish/Core/Repository/ObjectStateService.php
index <HASH>..<HASH> 100644
--- a/eZ/Publish/Core/Repository/ObjectStateService.php
+++ b/eZ/Publish/Core/Repository/ObjectStateService.php
@@ -440,7 +440,7 @@ class ObjectStateService implements ObjectStateServiceInterface
*/
public function setObjectState( ContentInfo $contentInfo, APIObjectStateGroup $objectStateGroup, APIObjectState $objectState )
{
- if ( $this->repository->hasAccess( 'state', 'assign' ) !== true )
+ if ( $this->repository->canUser( 'state', 'assign', $contentInfo, $objectState ) !== true )
throw new UnauthorizedException( 'state', 'assign' );
if ( !is_numeric( $contentInfo->id ) ) | Fixed: state/assign permission function has limitations | ezsystems_ezpublish-kernel | train | php |
99c51f6fea6f9d873834dd7bfd37a139f2b12b3c | diff --git a/src/test/java/picocli/CommandLineTest.java b/src/test/java/picocli/CommandLineTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/picocli/CommandLineTest.java
+++ b/src/test/java/picocli/CommandLineTest.java
@@ -2804,7 +2804,7 @@ public class CommandLineTest {
@Test
public void testAtFileSimplifiedWithQuotesTrimmed() {
- System.setProperty("picocli.useSimplifiedAtFiles", "true");
+ System.setProperty("picocli.useSimplifiedAtFiles", "");
System.setProperty("picocli.trimQuotes", "true");
class App {
@Option(names = "--quotedArg") | #<I> added Interpreter tests - simplified at files with empty sysprop | remkop_picocli | train | java |
37824e73f9de89519ed7f405b83c577cd6383217 | diff --git a/lib/outputlib.php b/lib/outputlib.php
index <HASH>..<HASH> 100644
--- a/lib/outputlib.php
+++ b/lib/outputlib.php
@@ -1016,7 +1016,7 @@ class theme_config {
*/
public function post_process($css) {
// now resolve all image locations
- if (preg_match_all('/\[\[pix:([a-z_]+\|)?([^\]]+)\]\]/', $css, $matches, PREG_SET_ORDER)) {
+ if (preg_match_all('/\[\[pix:([a-z0-9_]+\|)?([^\]]+)\]\]/', $css, $matches, PREG_SET_ORDER)) {
$replaced = array();
foreach ($matches as $match) {
if (isset($replaced[$match[0]])) {
@@ -1033,7 +1033,7 @@ class theme_config {
}
// Now resolve all font locations.
- if (preg_match_all('/\[\[font:([a-z_]+\|)?([^\]]+)\]\]/', $css, $matches, PREG_SET_ORDER)) {
+ if (preg_match_all('/\[\[font:([a-z0-9_]+\|)?([^\]]+)\]\]/', $css, $matches, PREG_SET_ORDER)) {
$replaced = array();
foreach ($matches as $match) {
if (isset($replaced[$match[0]])) { | MDL-<I> allow numbers in components used in CSS placeholders | moodle_moodle | train | php |
9b2b4a9c44ac488befc79c2ba6e95dd0124a38b7 | diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/resource/windows_firewall_rule.rb
+++ b/lib/chef/resource/windows_firewall_rule.rb
@@ -43,11 +43,11 @@ class Chef
```ruby
windows_firewall_rule 'MyRule' do
- description "testing out remote address arrays"
+ description 'Testing out remote address arrays'
enabled false
local_port 1434
remote_address %w(10.17.3.101 172.7.7.53)
- protocol "TCP"
+ protocol 'TCP'
action :create
end
```
@@ -111,6 +111,7 @@ class Chef
description: "The local port the firewall rule applies to."
property :remote_address, [String, Array],
+ coerce: proc { |d| d.is_a?(String) ? d.split(/\s*,\s*/).sort : Array(d).sort.map(&:to_s) },
description: "The remote address(es) the firewall rule applies to."
property :remote_port, [String, Integer, Array], | Updated the firewall rule resource to allow for multiple remote addresses, updated the spec file to account for the change in data types | chef_chef | train | rb |
41275523b49e4365d039b5e92995a98a3efb7403 | diff --git a/benchexec/tablegenerator/__init__.py b/benchexec/tablegenerator/__init__.py
index <HASH>..<HASH> 100755
--- a/benchexec/tablegenerator/__init__.py
+++ b/benchexec/tablegenerator/__init__.py
@@ -972,9 +972,13 @@ def create_tables(name, runSetResults, filenames, rows, rowsDiff, outputPath, ou
# read template
Template = tempita.HTMLTemplate if format == 'html' else tempita.Template
- template = Template.from_filename(TEMPLATE_FILE_NAME.format(format=format),
- namespace=templateNamespace,
- encoding=TEMPLATE_ENCODING)
+ template_file = TEMPLATE_FILE_NAME.format(format=format)
+ try:
+ template_content = __loader__.get_data(template_file).decode(TEMPLATE_ENCODING)
+ except NameError:
+ with open(template_file, mode='r') as f:
+ template_content = f.read()
+ template = Template(template_content, namespace=templateNamespace)
# write file
with open(outfile, 'w') as file: | Let tablegenerator find its templates even when packaged inside an Egg. | sosy-lab_benchexec | train | py |
84286a823bd1969366b5ff4abb22a2c3c5bf8ca4 | diff --git a/lib/recharge/http_request.rb b/lib/recharge/http_request.rb
index <HASH>..<HASH> 100644
--- a/lib/recharge/http_request.rb
+++ b/lib/recharge/http_request.rb
@@ -66,7 +66,8 @@ module Recharge
connection.start do |http|
res = http.request(req)
- data = res["Content-Type"] == "application/json" ? parse_json(res.body) : {}
+ # API returns 204 but content-type header is set to application/json so check body
+ data = res.body && res["Content-Type"] == "application/json" ? parse_json(res.body) : {}
data["meta"] = { "id" => res["X-Request-Id"], "limit" => res["X-Recharge-Limit"] }
return data if res.code[0] == "2" && !data["warning"] && !data["error"] | Don't parse <I>s even when content type is present | ScreenStaring_recharge-api | train | rb |
47456b35a7065b1363d95603b145bb847e59f84e | diff --git a/test/test_persistence.py b/test/test_persistence.py
index <HASH>..<HASH> 100644
--- a/test/test_persistence.py
+++ b/test/test_persistence.py
@@ -249,7 +249,7 @@ class TableTestCase(unittest.TestCase):
tbl = self.tbl
tbl.create_column('foo', FLOAT)
assert 'foo' in tbl.table.c, tbl.table.c
- assert FLOAT == type(tbl.table.c['foo'].type), tbl.table.c['foo'].type
+ assert isinstance(tbl.table.c['foo'].type, FLOAT), tbl.table.c['foo'].type
assert 'foo' in tbl.columns, tbl.columns
def test_key_order(self): | Fix type comparison to isinstance check | pudo_dataset | train | py |
fd80b1541d40a7172053354b9a815e8574deb4b8 | diff --git a/test/validators.js b/test/validators.js
index <HASH>..<HASH> 100644
--- a/test/validators.js
+++ b/test/validators.js
@@ -1,4 +1,4 @@
-var validator = require('../index'),
+var validator = require('../index'),
format = require('util').format,
assert = require('assert'),
path = require('path'), | Remove U+FEFF from the begin of file.
orz | chriso_validator.js | train | js |
4c4a2398f16b2747a28253bec8b42aa441497670 | diff --git a/lib/icedfrisby.js b/lib/icedfrisby.js
index <HASH>..<HASH> 100644
--- a/lib/icedfrisby.js
+++ b/lib/icedfrisby.js
@@ -801,6 +801,8 @@ Frisby.prototype.toss = function(retry) {
failedCount: 0
};
+ it.request = self.current.outgoing;
+
// launch request
// repeat request for self.current.retry times if request does not respond with self._timeout ms (except for POST requests)
var tries = 0;
@@ -850,6 +852,7 @@ Frisby.prototype.toss = function(retry) {
// called from makeRequest if request has finished successfully
function assert() {
var i;
+ it.response = self.current.response;
self.current.expectsFailed = true;
// if you have no expects, they can't fail | Add contextual information to be used in mocha reporters | IcedFrisby_IcedFrisby | train | js |
ad6aee11868fa447844cb695ef5ba3a0181419ca | diff --git a/compliance/autobahn/server.py b/compliance/autobahn/server.py
index <HASH>..<HASH> 100644
--- a/compliance/autobahn/server.py
+++ b/compliance/autobahn/server.py
@@ -22,6 +22,11 @@ class App:
'bytes': event['bytes'],
'text': event['text'],
})
+ elif event['type'] == 'lifespan.startup':
+ await send({'type': 'lifespan.startup.complete'})
+ elif event['type'] == 'lifespan.shutdown':
+ await send({'type': 'lifespan.shutdown.complete'})
+ break
if __name__ == '__main__':
diff --git a/compliance/h2spec/server.py b/compliance/h2spec/server.py
index <HASH>..<HASH> 100644
--- a/compliance/h2spec/server.py
+++ b/compliance/h2spec/server.py
@@ -17,6 +17,11 @@ class App:
elif event['type'] == 'http.request' and not event.get('more_body', False):
await self.send_data(send)
break
+ elif event['type'] == 'lifespan.startup':
+ await send({'type': 'lifespan.startup.complete'})
+ elif event['type'] == 'lifespan.shutdown':
+ await send({'type': 'lifespan.shutdown.complete'})
+ break
async def send_data(self, send):
await send({ | Bugfix support the lifespan protocol in the compliance servers
This allows the compliance tests to proceed, and ideally pass... | pgjones_hypercorn | train | py,py |
9fe5a3dd92c50ed1bb7c0bf2c4a5969655a8d0d6 | diff --git a/duke-core/src/main/java/no/priv/garshol/duke/CompactRecord.java b/duke-core/src/main/java/no/priv/garshol/duke/CompactRecord.java
index <HASH>..<HASH> 100644
--- a/duke-core/src/main/java/no/priv/garshol/duke/CompactRecord.java
+++ b/duke-core/src/main/java/no/priv/garshol/duke/CompactRecord.java
@@ -1,10 +1,10 @@
package no.priv.garshol.duke;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Collection;
-
import java.io.Serializable;
/**
@@ -73,4 +73,14 @@ public class CompactRecord implements ModifiableRecord, Serializable {
public String[] getArray() {
return s;
}
+
+ public String toString() {
+ StringBuilder builder = new StringBuilder("{");
+ for (int ix = 0; ix < free; ix += 2) {
+ if (ix > 0) builder.append(", ");
+ builder.append(s[ix]).append("=[").append(s[ix + 1]).append(']');
+ }
+ builder.append("}");
+ return "[CompactRecord " + builder + "]";
+ }
}
\ No newline at end of file | minor: added toString() method to CompactRecord | larsga_Duke | train | java |
37c62a25dfe9b994bca7a59972d915e99eba8990 | diff --git a/src/createApp.js b/src/createApp.js
index <HASH>..<HASH> 100644
--- a/src/createApp.js
+++ b/src/createApp.js
@@ -53,11 +53,7 @@ function createApp (views) {
var view = views[key];
if (!view) return this.getViewNotFound();
- var givenProps = this.state[key + '_props'];
- var props = xtend({
- key: key,
- app: this
- }, givenProps);
+ var props = xtend({ key: key, app: this }, this.state.currentViewProps);
if (this.getViewProps) {
xtend(props, this.getViewProps());
@@ -96,12 +92,11 @@ function createApp (views) {
var newState = {
currentView: key,
+ currentViewProps: props || {},
previousView: this.state.currentView,
viewTransition: this.getCSSTransition(transition)
};
- newState[key + '_props'] = props || {};
-
xtend(newState, state);
this.setState(newState); | createApp: don't store view props longer than necessary | touchstonejs_touchstonejs | train | js |
8c310d9ce8f648e83811ad9527c3a0167c1a5f64 | diff --git a/.importjs.js b/.importjs.js
index <HASH>..<HASH> 100644
--- a/.importjs.js
+++ b/.importjs.js
@@ -1,6 +1,7 @@
module.exports = {
environments: ['node'],
ignorePackagePrefixes: ['lodash.'],
+ declarationKeyword: 'import',
logLevel: 'debug',
excludes: [
'./build/**', | Use `declarationKeyword: 'import'` locally
With version <I> of import-js, node projects now get `const` as the
default declarationKeyword. We use babel here, so we don't want the
default. | Galooshi_import-js | train | js |
269cd957214cc3eba3fe816a4cbf17fc48af8f6b | diff --git a/tests/test_channels.py b/tests/test_channels.py
index <HASH>..<HASH> 100644
--- a/tests/test_channels.py
+++ b/tests/test_channels.py
@@ -161,3 +161,28 @@ class BufferedChannelTests(BaseTests, ChanTestMixin):
self.assertEqual(markers, [1])
chan.send(2)
self.assertEqual(markers, [1, 2])
+
+
+class BackendChannelSenderReceiverPriorityTest(BaseTests):
+ """
+ Tests if the current backend channel implementation has the correct
+ sender/receiver priority (aka preference in stackless).
+ Current implementations of goless channels depend on receiver having the execution priotity!
+ """
+
+ def test_be_has_correct_sender_receiver_priority(self):
+ c = be.channel()
+ r = []
+ def do_send():
+ r.append("s1")
+ c.send(None)
+ r.append("s2")
+ def do_receive():
+ r.append("r1")
+ c.receive()
+ r.append("r2")
+
+ be.run(do_receive)
+ be.run(do_send)
+ be.yield_()
+ self.assertEqual(["r1", "s1", "r2", "s2"], r)
\ No newline at end of file | New test to check for the correct backend channel sender/receiver priority | rgalanakis_goless | train | py |
68284a4525885fbfa2cea9bcf8aa2b6dfc6ca22c | diff --git a/coursera/coursera_dl.py b/coursera/coursera_dl.py
index <HASH>..<HASH> 100755
--- a/coursera/coursera_dl.py
+++ b/coursera/coursera_dl.py
@@ -396,6 +396,7 @@ def download_lectures(wget_bin,
lecture_filter=None,
path='',
verbose_dirs=False,
+ hooks=[]
):
"""
Downloads lecture resources described by sections.
@@ -440,6 +441,8 @@ def download_lectures(wget_bin,
open(lecfn, 'w').close() # touch
else:
logging.info('%s already downloaded', lecfn)
+ for hook in hooks:
+ os.system("cd \"%s\"; %s" % (sec, hook))
def download_file(url,
@@ -701,6 +704,11 @@ def parseArgs():
action='store_true',
default=False,
help='download sections in reverse order')
+ parser.add_argument('--hook',
+ dest='hooks',
+ action='append',
+ default=[],
+ help='hooks to run when finished')
args = parser.parse_args()
@@ -771,6 +779,7 @@ def download_class(args, class_name):
args.lecture_filter,
args.path,
args.verbose_dirs,
+ args.hooks
)
if not args.cookies_file: | Added hooks for post-processing | coursera-dl_coursera-dl | train | py |
854a7c5c1cdb0b0a78abe3b282010aa1285db20e | diff --git a/safesql.go b/safesql.go
index <HASH>..<HASH> 100644
--- a/safesql.go
+++ b/safesql.go
@@ -43,7 +43,7 @@ func main() {
os.Exit(2)
}
s := ssautil.CreateProgram(p, 0)
- s.BuildAll()
+ s.Build()
qms := FindQueryMethods(p.Package("database/sql").Pkg, s)
if verbose { | Update usage of go tools ssa
In particular, use Build, renamed from BuildAll in
golang/tools@afcda<I>b<I>c7af<I>a<I>f0b6bdb9c<I>a<I> | stripe_safesql | train | go |
8107bbcf93341a7e049557691bd6d0045dd40983 | diff --git a/elasticsearch/connection/http_urllib3.py b/elasticsearch/connection/http_urllib3.py
index <HASH>..<HASH> 100644
--- a/elasticsearch/connection/http_urllib3.py
+++ b/elasticsearch/connection/http_urllib3.py
@@ -50,13 +50,17 @@ class Urllib3HttpConnection(Connection):
ssl_assert_fingerprint=None, maxsize=10, headers=None, **kwargs):
super(Urllib3HttpConnection, self).__init__(host=host, port=port, use_ssl=use_ssl, **kwargs)
- self.headers = headers.copy() if headers else {}
- self.headers.update(urllib3.make_headers(keep_alive=True))
+ self.headers = urllib3.make_headers(keep_alive=True)
if http_auth is not None:
if isinstance(http_auth, (tuple, list)):
http_auth = ':'.join(http_auth)
self.headers.update(urllib3.make_headers(basic_auth=http_auth))
+ # update headers in lowercase to allow overriding of auth headers
+ if headers:
+ for k in headers:
+ self.headers[k.lower()] = headers[k]
+
ca_certs = CA_CERTS if ca_certs is None else ca_certs
pool_class = urllib3.HTTPConnectionPool
kw = {} | update headers in lowercase to allow overriding of auth headers | elastic_elasticsearch-py | train | py |
649d0ba9a51f3cba6a1476f788ea2004501086db | diff --git a/spec/Suite/Http/ResponseSpec.php b/spec/Suite/Http/ResponseSpec.php
index <HASH>..<HASH> 100644
--- a/spec/Suite/Http/ResponseSpec.php
+++ b/spec/Suite/Http/ResponseSpec.php
@@ -250,6 +250,10 @@ EOD;
it("creates a response with some set-cookies", function() {
+ Monkey::patch('time', function() {
+ return strtotime('24 Dec 2015');
+ });
+
$message = join("\r\n", [
'HTTP/1.1 200 OK',
'Connection: close', | Fixes a spec depending on a timestamp. | crysalead_net | train | php |
79179dc85b5c56d9ea45cd4c7dab823e66b213bd | diff --git a/rest_framework_swagger/views.py b/rest_framework_swagger/views.py
index <HASH>..<HASH> 100644
--- a/rest_framework_swagger/views.py
+++ b/rest_framework_swagger/views.py
@@ -92,19 +92,12 @@ class SwaggerResourcesView(APIDocView):
'basePath': self.host.rstrip('/'),
'apis': apis,
'info': SWAGGER_SETTINGS.get('info', {
- 'contact': 'apiteam@wordnik.com',
- 'description': 'This is a sample server Petstore server. '
- 'You can find out more about Swagger at '
- '<a href="http://swagger.wordnik.com">'
- 'http://swagger.wordnik.com</a> '
- 'or on irc.freenode.net, #swagger. '
- 'For this sample, you can use the api key '
- '"special-key" to test '
- 'the authorization filters',
- 'license': 'Apache 2.0',
- 'licenseUrl': 'http://www.apache.org/licenses/LICENSE-2.0.html',
- 'termsOfServiceUrl': 'http://helloreverb.com/terms/',
- 'title': 'Swagger Sample App',
+ 'contact': '',
+ 'description': '',
+ 'license': '',
+ 'licenseUrl': '',
+ 'termsOfServiceUrl': '',
+ 'title': '',
}),
}) | Default to empty strings instead of Petstore example for backwards compatibility.
The title and description are "required", so we should probably provide them instead of an empty dictionary as suggested earlier.
Thanks @ariovistus
<URL> | marcgibbons_django-rest-swagger | train | py |
da1f6e06f3a3bb5aef06a4dcfa4cf6cb81b0c93f | diff --git a/wdiffhtml/__init__.py b/wdiffhtml/__init__.py
index <HASH>..<HASH> 100644
--- a/wdiffhtml/__init__.py
+++ b/wdiffhtml/__init__.py
@@ -46,7 +46,7 @@ def wdiff(settings, wrap_with_html=False, fold_breaks=False):
`<br />` tags.
"""
- diff = generate_wdiff(settings.org_file, settings.new_file)
+ diff = generate_wdiff(settings.org_file, settings.new_file, fold_breaks)
if wrap_with_html:
return wrap_content(diff, settings, fold_breaks)
else: | fix: `generate_wdiff` call | brutus_wdiffhtml | train | py |
10cc07e9a898583eaa1eb56246bf427e37ae1e44 | diff --git a/src/python/dxpy/exceptions.py b/src/python/dxpy/exceptions.py
index <HASH>..<HASH> 100644
--- a/src/python/dxpy/exceptions.py
+++ b/src/python/dxpy/exceptions.py
@@ -45,7 +45,11 @@ class DXJobFailureError(DXError):
'''Exception produced by :class:`dxpy.bindings.dxjob.DXJob` when a job fails.'''
pass
-class AppError(DXError):
+class ProgramError(DXError):
+ '''Deprecated. Use :class:`AppError` instead.'''
+ pass
+
+class AppError(ProgramError):
'''
Base class for fatal exceptions to be raised while using :mod:`dxpy` inside
DNAnexus execution containers.
@@ -58,10 +62,6 @@ class AppError(DXError):
'''
pass
-class ProgramError(AppError):
- '''Deprecated. Use :class:`AppError` instead.'''
- pass
-
class AppInternalError(DXError):
'''
Base class for fatal exceptions to be raised while using :mod:`dxpy` inside | Reverse dependency order of AppError-ProgramError
Make AppError temporarily depend on (deprecated) ProgramError to work around try..catch logic in python<I>_template that was not updated and tries to catch ProgramError. This results in apps that use the old template with AppError throwing AppInternalError instead. | dnanexus_dx-toolkit | train | py |
146a24ea7e10be3626c86b4e2fe1ebb05cd26a84 | diff --git a/utils/compiler/src/Command/DowngradePathsCommand.php b/utils/compiler/src/Command/DowngradePathsCommand.php
index <HASH>..<HASH> 100644
--- a/utils/compiler/src/Command/DowngradePathsCommand.php
+++ b/utils/compiler/src/Command/DowngradePathsCommand.php
@@ -59,8 +59,8 @@ final class DowngradePathsCommand extends Command
$downgradePaths = array_merge([
// must be separated to cover container get() trait + psr container contract get()
- 'vendor/symfony/dependency-injection vendor/symfony/service-contracts vendor/psr/container',
- 'vendor/symplify vendor/symfony vendor/nikic vendor/psr bin src packages rector.php',
+ 'vendor/symfony vendor/psr',
+ 'vendor/symplify vendor/nikic bin src packages rector.php',
], $downgradePaths);
$downgradePaths = array_values($downgradePaths); | [prefixed] re-order paths | rectorphp_rector | train | php |
816d3cc9a3acc8ab0e1643064710d0e7d68fb2d0 | diff --git a/cli/api/daemon.go b/cli/api/daemon.go
index <HASH>..<HASH> 100644
--- a/cli/api/daemon.go
+++ b/cli/api/daemon.go
@@ -843,7 +843,7 @@ func (d *daemon) startAgent() error {
err = masterClient.UpdateHost(updatedHost)
if err != nil {
log.WithError(err).Warn("Unable to update master with delegate host information. Retrying silently")
- go func(masterClient *master.Client, updatedHost host.Host) {
+ go func(masterClient *master.Client, myHost *host.Host) {
err := errors.New("")
for err != nil {
select {
@@ -852,10 +852,13 @@ func (d *daemon) startAgent() error {
default:
time.Sleep(5 * time.Second)
}
- err = masterClient.UpdateHost(updatedHost)
+ updatedHost, err = host.UpdateHostInfo(*myHost)
+ if err == nil {
+ err = masterClient.UpdateHost(updatedHost)
+ }
}
log.Info("Updated master with delegate host information")
- }(masterClient, updatedHost)
+ }(masterClient, myHost)
}
return poolID
}() | pull the latest host object into retry loop | control-center_serviced | train | go |
639f4cc4434fffd915b09f492784bcb16344d3c7 | diff --git a/heron/tools/ui/src/python/handlers/topology.py b/heron/tools/ui/src/python/handlers/topology.py
index <HASH>..<HASH> 100644
--- a/heron/tools/ui/src/python/handlers/topology.py
+++ b/heron/tools/ui/src/python/handlers/topology.py
@@ -260,9 +260,6 @@ class ContainerFileDownloadHandler(base.BaseHandler):
def initialize(self, baseUrl):
self.baseUrl = baseUrl
- def initialize(self, baseUrl):
- self.baseUrl = baseUrl
-
@tornado.gen.coroutine
def get(self, cluster, environ, topology, container):
''' | Remove extra initialize method from ContainerFileDownloadHandler. (#<I>) | apache_incubator-heron | train | py |
d39826ca0eeaa9345e370ec31d34727f27c1d35c | diff --git a/bin/runner.js b/bin/runner.js
index <HASH>..<HASH> 100755
--- a/bin/runner.js
+++ b/bin/runner.js
@@ -136,7 +136,7 @@ function launchBrowser(browser, url) {
});
}
-function launchBrowsers(config, browser) {
+var launchBrowsers = function(config, browser) {
setTimeout(function () {
if(Object.prototype.toString.call(config.test_path) === '[object Array]'){
config.test_path.forEach(function(path){ | minor fix, 1 more ogging | browserstack_browserstack-runner | train | js |
f28b0c7819f7cd5a240f2fcc5dc13353f7174bd9 | diff --git a/core/runtime.js b/core/runtime.js
index <HASH>..<HASH> 100644
--- a/core/runtime.js
+++ b/core/runtime.js
@@ -195,9 +195,11 @@ var boot_class = function(superklass, constructor) {
ctor.prototype = superklass.prototype;
constructor.prototype = new ctor();
+ var prototype = constructor.prototype;
- constructor.prototype._klass = constructor;
- constructor.prototype._real = constructor;
+ prototype._klass = constructor;
+ prototype._real = constructor;
+ prototype.constructor = constructor;
constructor._included_in = [];
constructor._isClass = true; | Make sure class prototypes have the right constructor | opal_opal | train | js |
704afb55e13e79a056fbe4d972c3c3bab5ed948b | diff --git a/src/Controller/SavedSearchesController.php b/src/Controller/SavedSearchesController.php
index <HASH>..<HASH> 100644
--- a/src/Controller/SavedSearchesController.php
+++ b/src/Controller/SavedSearchesController.php
@@ -33,6 +33,7 @@ class SavedSearchesController extends AppController
$query = $this->SavedSearches->find('all')
->where(['name IS NOT' => null])
+ ->where(['name !=' => ''])
->where($this->request->getQueryParams());
$entities = $this->paginate($query); | Exclude saved searches with empty name (task #<I>) | QoboLtd_cakephp-search | train | php |
ec5b9d3a00420c0dafcd0bca5c6a5127b812b6da | diff --git a/gruntfile.js b/gruntfile.js
index <HASH>..<HASH> 100644
--- a/gruntfile.js
+++ b/gruntfile.js
@@ -16,8 +16,7 @@ module.exports = function(grunt) {
jshint: {
all: [
'Gruntfile.js',
- 'tasks/*.js',
- '<%= nodeunit.tests %>'
+ 'tasks/*.js'
],
options: {
jshintrc: '.jshintrc' | chore: Remoe bad jshint files | iVantage_grunt-ivantage-svn-release | train | js |
0fd86896a38b0353b0578b2d2c7bb7ce232e78d8 | diff --git a/python/rosette/api.py b/python/rosette/api.py
index <HASH>..<HASH> 100644
--- a/python/rosette/api.py
+++ b/python/rosette/api.py
@@ -16,7 +16,6 @@ with `restricted rights' as those terms are defined in DAR and ASPR
_ACCEPTABLE_SERVER_VERSION = "0.5"
_GZIP_KEY = [0x1F, 0x8b, 0x08]
N_RETRIES = 3
-RETRY_DELAY = 5
import sys
_IsPy3 = sys.version_info[0] == 3 | RCB-<I> Remove dead line | rosette-api_java | train | py |
36c63700ebb163b75b3209f2c0b49f97fbd7d95a | diff --git a/atomic_reactor/utils/retries.py b/atomic_reactor/utils/retries.py
index <HASH>..<HASH> 100644
--- a/atomic_reactor/utils/retries.py
+++ b/atomic_reactor/utils/retries.py
@@ -50,7 +50,10 @@ def hook_log_error_response_content(response, *args, **kwargs):
:type response: requests.Response
"""
if 400 <= response.status_code <= 599:
- logger.error('Error response from %s: %s', response.url, response.content)
+ logger.debug(
+ 'HTTP %d response from %s: %s',
+ response.status_code, response.url, response.content
+ )
def get_retrying_requests_session(client_statuses=HTTP_CLIENT_STATUS_RETRY,
diff --git a/tests/utils/test_retries.py b/tests/utils/test_retries.py
index <HASH>..<HASH> 100644
--- a/tests/utils/test_retries.py
+++ b/tests/utils/test_retries.py
@@ -84,7 +84,7 @@ def test_log_error_response(http_code, caplog):
session.get(api_url)
content = json.dumps(json_data).encode()
- expected = f"Error response from {api_url}: {content}"
+ expected = f"HTTP {http_code} response from {api_url}: {content}"
if 400 <= http_code <= 599:
assert expected in caplog.text
else: | Do not log error responses from retries as errors
Sometimes error code is expected and shouldn't be treated as error. In
fact everything logged from retries should be just DEBUG.
Many errors in logs scary users.
Removing "Error" from log string and replacing it with http status code.
CLOUDBLD-<I> | projectatomic_atomic-reactor | train | py,py |
0009a0345480b96886ac9aec19d36ae23d14f5b6 | diff --git a/issue.py b/issue.py
index <HASH>..<HASH> 100755
--- a/issue.py
+++ b/issue.py
@@ -65,7 +65,9 @@ def list_issues(flags, tag):
print(str(issue["number"]).ljust(lens["number"] + padding), end='')
print(issue["tag"].ljust(lens["tag"] + padding), end='')
print(issue["date"].ljust(lens["date"] + padding), end='')
- print(issue["description"].ljust(lens["description"] + padding), end='')
+ desc = issue["description"].ljust(lens["description"])
+ desc = desc.splitlines()[0]
+ print(desc, end='')
print()
def edit_issue(number, message="", tag="", close=False, reopen=False): | Only print first line of each issue on issue listing | boarpig_issue | train | py |
50f3dcb7025eabd4e993983285d4394335de2104 | diff --git a/src/Resource/Sync/Repository.php b/src/Resource/Sync/Repository.php
index <HASH>..<HASH> 100644
--- a/src/Resource/Sync/Repository.php
+++ b/src/Resource/Sync/Repository.php
@@ -27,6 +27,11 @@ class Repository extends BaseRepository
return $this->wait($this->observableToPromise($this->callAsync('commits')->toArray()));
}
+ public function isActive(): bool
+ {
+ return $this->wait($this->callAsync('isActive'));
+ }
+
public function enable(): Repository
{
return $this->wait($this->callAsync('enable')); | Added isActive method to sync repo | php-api-clients_client-services | train | php |
7d67515565c109df02cf2bbf1c90cd44f0ca04c1 | diff --git a/torf/_magnet.py b/torf/_magnet.py
index <HASH>..<HASH> 100644
--- a/torf/_magnet.py
+++ b/torf/_magnet.py
@@ -45,6 +45,7 @@ class Magnet():
| https://en.wikipedia.org/wiki/Magnet_URL
| http://magnet-uri.sourceforge.net/magnet-draft-overview.txt
| https://wiki.theory.org/index.php/BitTorrent_Magnet-URI_Webseeding
+ | http://shareaza.sourceforge.net/mediawiki/index.php/Magnet_URI_scheme
"""
_INFOHASH_REGEX = re.compile(r'^[0-9a-f]{40}|[a-z2-7]{32}$', flags=re.IGNORECASE) | Magnet: Add reference to docstring | rndusr_torf | train | py |
ebccd02aba4c3f8b04602cb659a1fd43d2e73059 | diff --git a/src/EventExport/Format/HTML/PDFWebArchiveFileWriter.php b/src/EventExport/Format/HTML/PDFWebArchiveFileWriter.php
index <HASH>..<HASH> 100644
--- a/src/EventExport/Format/HTML/PDFWebArchiveFileWriter.php
+++ b/src/EventExport/Format/HTML/PDFWebArchiveFileWriter.php
@@ -34,7 +34,13 @@ class PDFWebArchiveFileWriter extends WebArchiveFileWriter
$originDirectory = $this->createWebArchiveDirectory($events);
$originFile = $this->expandTmpPath($originDirectory) . '/index.html';
- $this->prince->convert_file_to_file($originFile, $filePath);
+ $messages = array();
+ $result = $this->prince->convert_file_to_file($originFile, $filePath, $messages);
+
+ if (!$result) {
+ $message = implode(PHP_EOL, $messages);
+ throw new \RuntimeException($message);
+ }
$this->removeTemporaryArchiveDirectory($originDirectory);
} | III-<I>: Rudimentary error handling when converting to PDF. | cultuurnet_udb3-php | train | php |
73687b128f2efe3247adce66974081fcc4478f85 | diff --git a/test/type.js b/test/type.js
index <HASH>..<HASH> 100644
--- a/test/type.js
+++ b/test/type.js
@@ -12,7 +12,7 @@ describe('type', function() {
, ['undefined', void 0]
].forEach(function(test) {
describe('when called with ' + test[1], function() {
- it('should return `' + test[0] + '`', function() {
+ it('should return \'' + test[0] + '\'', function() {
expect(type(test[1])).to.equal(test[0])
})
}) | Changed from backticks to single quote | mstade_funkis | train | js |
8232fcf66544c3f0c6d892a75fffedcabf5b2871 | diff --git a/test/endtoend/create-react-app/test.js b/test/endtoend/create-react-app/test.js
index <HASH>..<HASH> 100644
--- a/test/endtoend/create-react-app/test.js
+++ b/test/endtoend/create-react-app/test.js
@@ -34,20 +34,20 @@ describe('React: Dashboard', () => {
// close
browser.click('#inline-dashboard-toggle')
- browser.pause(50)
+ browser.pause(250)
// open
browser.click('#inline-dashboard-toggle')
- browser.pause(50)
+ browser.pause(250)
// close
browser.click('#inline-dashboard-toggle')
- browser.pause(50)
+ browser.pause(250)
// open
browser.click('#inline-dashboard-toggle')
- browser.pause(50)
+ browser.pause(250)
// open GDrive panel
browser.click('.uppy-DashboardTab:nth-child(2) button')
- browser.pause(50)
+ browser.pause(500)
// side effecting property access, not a function!
// eslint-disable-next-line no-unused-expressions | Wait a bit longer between dashboard toggling | transloadit_uppy | train | js |
7f0682ff46d85732c1bf353d8f8953262b8b0164 | diff --git a/src/tests/acceptance/AdminCest.php b/src/tests/acceptance/AdminCest.php
index <HASH>..<HASH> 100644
--- a/src/tests/acceptance/AdminCest.php
+++ b/src/tests/acceptance/AdminCest.php
@@ -20,7 +20,8 @@ class AdminCest extends BaseAcceptance {
public function tryToGotoAdminIndex(AcceptanceTester $I) {
$I->amOnPage ( "/Admin/index" );
$I->seeInCurrentUrl ( "Admin/index" );
- $I->see ( 'Used to perform CRUD operations on data', [ 'css' => 'body' ] );
+ $this->waitAndclick ( $I, '#validate-btn' );
+ $I->waitForText ( 'Used to perform CRUD operations on data', [ 'css' => 'body' ] );
}
private function gotoAdminModule(string $url, AcceptanceTester $I) { | [ci-tests] fix config not created pb | phpMv_ubiquity | train | php |
55432d45f24f1a5efe75d6d945e54ec070887a3b | diff --git a/core/src/main/java/org/springframework/ldap/pool/factory/PoolingContextSource.java b/core/src/main/java/org/springframework/ldap/pool/factory/PoolingContextSource.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/org/springframework/ldap/pool/factory/PoolingContextSource.java
+++ b/core/src/main/java/org/springframework/ldap/pool/factory/PoolingContextSource.java
@@ -138,7 +138,6 @@ import org.springframework.ldap.pool.validation.DirContextValidator;
* </tr>
* </table>
*
- *
* @author Eric Dalquist
*/
public class PoolingContextSource implements ContextSource, DisposableBean {
@@ -363,7 +362,7 @@ public class PoolingContextSource implements ContextSource, DisposableBean {
/**
* @param contextSource the contextSource to set
- * @Required
+ * Required
*/
public void setContextSource(ContextSource contextSource) {
this.dirContextPoolableObjectFactory.setContextSource(contextSource);
@@ -371,7 +370,7 @@ public class PoolingContextSource implements ContextSource, DisposableBean {
/**
* @param dirContextValidator the dirContextValidator to set
- * @Required
+ * Required
*/
public void setDirContextValidator(DirContextValidator dirContextValidator) {
this.dirContextPoolableObjectFactory.setDirContextValidator(dirContextValidator); | Got rid of javadoc warning. | spring-projects_spring-ldap | train | java |
38ffcaa085a3e5797d9b69f78f5da58f64834784 | diff --git a/src/Element.php b/src/Element.php
index <HASH>..<HASH> 100644
--- a/src/Element.php
+++ b/src/Element.php
@@ -33,6 +33,8 @@ use DOMElement;
class Element extends DOMElement implements PropertyAttribute {
use LiveProperty, NonDocumentTypeChildNode, ChildNode, ParentNode;
+ const VALUE_ELEMENTS = ["BUTTON", "INPUT", "METER", "OPTION", "PROGRESS", "PARAM"];
+
/** @var TokenList */
protected $liveProperty_classList;
/** @var StringMap */
@@ -121,14 +123,20 @@ class Element extends DOMElement implements PropertyAttribute {
return $this->$methodName();
}
- return $this->getAttribute("value");
+ if(in_array(strtoupper($this->tagName), self::VALUE_ELEMENTS)) {
+ return $this->nodeValue;
+ }
+
+ return null;
}
public function prop_set_value(string $newValue) {
- $methodName = 'value_set_' . strtolower($this->tagName);
+ $methodName = 'value_set_' . $this->tagName;
if(method_exists($this, $methodName)) {
return $this->$methodName($newValue);
}
+
+ $this->nodeValue = $newValue;
}
public function prop_get_id():?string { | Default value getter/setter property (#<I>)
* Provide mechanism for getting/setting default Element value property
* Only set value attribute for whitelist of element types | PhpGt_Dom | train | php |
f4366f6e639fb3763a8397dc65a04600348c3209 | diff --git a/controls/js/src/kirki.js b/controls/js/src/kirki.js
index <HASH>..<HASH> 100644
--- a/controls/js/src/kirki.js
+++ b/controls/js/src/kirki.js
@@ -49,7 +49,7 @@ var kirki = {
'data-palette': control.params.palette,
'data-default-color': control.params['default'],
'data-alpha': control.params.choices.alpha,
- value: control.setting._value
+ value: kirki.setting.get( control.id )
} ) );
}
},
@@ -96,7 +96,7 @@ var kirki = {
'data-id': control.id,
inputAttrs: control.params.inputAttrs,
choices: control.params.choices,
- value: control.setting._value
+ value: kirki.setting.get( control.id )
};
if ( ! _.isUndefined( control.params ) && ! _.isUndefined( control.params.choices ) && ! _.isUndefined( control.params.choices.element ) && 'textarea' === control.params.choices.element ) { | Use kirki.setting.get() method | aristath_kirki | train | js |
ba2420cb7a9632b62fb6fc9dfd22fa93e2ae9588 | diff --git a/lib/app.js b/lib/app.js
index <HASH>..<HASH> 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -87,7 +87,7 @@ var makeApp = function(configBase, callback) {
res: Logger.stdSerializers.res,
err: function(err) {
var obj = Logger.stdSerializers.err(err);
- // only show properties without an initial lodash
+ // only show properties without an initial underscore
return _.pickBy(obj, _.filter(_.keys(obj), function(key) { return key[0] !== "_"; }));
},
principal: function(principal) { | Fix accidental commnt rewrite | pump-io_pump.io | train | js |
7f0d3625c18573e9ee049334da86d2d843c582e5 | diff --git a/spec/em/em_spec.rb b/spec/em/em_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/em/em_spec.rb
+++ b/spec/em/em_spec.rb
@@ -121,13 +121,13 @@ begin
callbacks_run << :errback
end
EM.add_timer(0.1) do
+ callbacks_run.should == [:callback]
lambda {
client.close
}.should_not raise_error(/invalid binding to detach/)
EM.stop_event_loop
end
end
- callbacks_run.should == [:callback]
end
end
rescue LoadError | match callbacks_run inside event loop | brianmario_mysql2 | train | rb |
8544aa3bdd22dbe0d89fb2570f58ca33b02bfc70 | diff --git a/lib/reporters/markdown.js b/lib/reporters/markdown.js
index <HASH>..<HASH> 100644
--- a/lib/reporters/markdown.js
+++ b/lib/reporters/markdown.js
@@ -23,7 +23,6 @@ function Markdown(runner) {
var self = this
, stats = this.stats
- , total = runner.total
, level = 0
, buf = ''; | Remove dead code
total variable in markdown wasn't ever used | mochajs_mocha | train | js |
41694787042413973157f29c0a93f6854176a9f7 | diff --git a/spec/mongo/server/monitor_spec.rb b/spec/mongo/server/monitor_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/mongo/server/monitor_spec.rb
+++ b/spec/mongo/server/monitor_spec.rb
@@ -22,7 +22,7 @@ describe Mongo::Server::Monitor do
start = Time.now
monitor.scan!
monitor.scan!
- expect(Time.now - start).to be > 0.5
+ expect(Time.now - start).to be >= 0.5
end
end | Scans are throttled to exactly <I>ms on JRuby sometimes | mongodb_mongo-ruby-driver | train | rb |
166cd1a7955cb3e2ea48a79e44985f510f183fb6 | diff --git a/test/feidee_utils/mixins/type_test.rb b/test/feidee_utils/mixins/type_test.rb
index <HASH>..<HASH> 100644
--- a/test/feidee_utils/mixins/type_test.rb
+++ b/test/feidee_utils/mixins/type_test.rb
@@ -1,4 +1,4 @@
-require "feidee_utils/mixins/parent_and_path"
+require "feidee_utils/mixins/type"
require 'minitest/autorun'
class FeideeUtils::Mixins::TypeTest < MiniTest::Test | Fix a wrong copy-paste in mixins/type test. | muyiliqing_feidee_utils | train | rb |
34222f27e4020ad5bd59e23ee8aa87e5f1899f1e | diff --git a/karma.conf.js b/karma.conf.js
index <HASH>..<HASH> 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -58,7 +58,7 @@ module.exports = function(config) {
customLaunchers.SL_Safari8 = createCustomLauncher('safari', 8);
customLaunchers.SL_Safari9 = createCustomLauncher('safari', 9);
}
-/*
+
// Opera
if (runAll || process.env.SAUCE_OPERA) {
// customLaunchers.SL_Opera11 = createCustomLauncher('opera', 11, 'Windows XP');
@@ -78,7 +78,7 @@ module.exports = function(config) {
if (runAll || process.env.SAUCE_EDGE) {
customLaunchers.SL_Edge = createCustomLauncher('microsoftedge', null, 'Windows 10');
}
-
+/*
// IOS
if (runAll || process.env.SAUCE_IOS) {
// customLaunchers.SL_IOS7 = createCustomLauncher('iphone', '7.1', 'OS X 10.10'); | Adding IE and Edge to Saucelabs | axios_axios | train | js |
4f9359f5aaf8ed539b3db42dd299918afdf14521 | diff --git a/pronto/ontology.py b/pronto/ontology.py
index <HASH>..<HASH> 100644
--- a/pronto/ontology.py
+++ b/pronto/ontology.py
@@ -128,11 +128,14 @@ class Ontology(object):
def obo(self):
"""Returns the ontology serialized in obo format.
"""
+ meta = self._obo_meta().decode('utf-8')
+ meta = [meta] if meta else []
try:
- return "\n\n".join( self._obo_meta() + [t.obo for t in self if t.id.startswith(self.meta['namespace'][0])])
+ return "\n\n".join( meta + [t.obo.decode('utf-8') for t in self if t.id.startswith(self.meta['namespace'][0])])
except KeyError:
- return "\n\n".join(self._obo_meta() + [t.obo for t in self])
-
+ return "\n\n".join( meta + [t.obo.decode('utf-8') for t in self])
+
+ @output_bytes
def _obo_meta(self):
"""Generates the obo metadata header
@@ -167,7 +170,7 @@ class Ontology(object):
)
- return [obo_meta] if obo_meta else []
+ return obo_meta
def reference(self):
"""Make relationships point to classes of ontology instead of ontology id | Attempt fixing obo export with utf-8 chars in Py2 | althonos_pronto | train | py |
de09bffd84fc2299eeca50c05998706eeef633ac | diff --git a/control/Controller.php b/control/Controller.php
index <HASH>..<HASH> 100644
--- a/control/Controller.php
+++ b/control/Controller.php
@@ -173,6 +173,8 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
* If $Action isn't given, it will use "index" as a default.
*/
protected function handleAction($request, $action) {
+ $this->extend('beforeCallActionHandler', $request, $action);
+
foreach($request->latestParams() as $k => $v) {
if($v || !isset($this->urlParams[$k])) $this->urlParams[$k] = $v;
} | Update Controller to allow extension in handleAction()
Controller's parent class (RequestHandler) has two extensions in its handleAction() method that are obscured by Controller's implementation. | silverstripe_silverstripe-framework | train | php |
ca92cd92ce4209a7259164e5283207f17da0d067 | diff --git a/js/forum/src/main.js b/js/forum/src/main.js
index <HASH>..<HASH> 100644
--- a/js/forum/src/main.js
+++ b/js/forum/src/main.js
@@ -7,7 +7,7 @@ import SignUpModal from 'flarum/components/SignUpModal';
// import LogInModal from 'flarum/components/LogInModal';
app.initializers.add('sijad-recaptcha', () => {
- const isAvail = () => typeof grecaptcha !== 'undefined';
+ const isAvail = () => typeof grecaptcha !== 'undefined' && typeof grecaptcha.render === 'function';
const recaptchaValue = m.prop();
const recaptchaID = m.prop(); | Fix "grecaptcha.render is not a function"
This is very similar to <URL> | sijad_flarum-ext-recaptcha | train | js |
10b73c3caa04b4c430e056e3adb4233c161ef5e7 | diff --git a/src/actions/update.js b/src/actions/update.js
index <HASH>..<HASH> 100644
--- a/src/actions/update.js
+++ b/src/actions/update.js
@@ -9,7 +9,7 @@ const registerDependencyIOS = require('../ios/registerNativeModule');
const getProjectDependencies = () => {
const pjson = require(path.join(process.cwd(), './package.json'));
- return Object.keys(pjson.dependencies);
+ return Object.keys(pjson.dependencies).filter(name => name !== 'react-native');
};
/** | Blacklist react-native from dependencies | rnpm_rnpm | train | js |
58aa5481ab2b5b8caefcf1001acc51e5a87ab0d6 | diff --git a/driver/src/test/java/org/neo4j/driver/util/cc/ClusterMemberRoleDiscoveryFactory.java b/driver/src/test/java/org/neo4j/driver/util/cc/ClusterMemberRoleDiscoveryFactory.java
index <HASH>..<HASH> 100644
--- a/driver/src/test/java/org/neo4j/driver/util/cc/ClusterMemberRoleDiscoveryFactory.java
+++ b/driver/src/test/java/org/neo4j/driver/util/cc/ClusterMemberRoleDiscoveryFactory.java
@@ -74,7 +74,7 @@ public class ClusterMemberRoleDiscoveryFactory
@Override
public Map<BoltServerAddress,ClusterMemberRole> findClusterOverview( Driver driver )
{
- try ( Session session = driver.session( builder().withDefaultAccessMode( AccessMode.READ ).build() ) )
+ try ( Session session = driver.session( builder().withDefaultAccessMode( AccessMode.WRITE ).build() ) )
{
StatementResult result = session.run( "CALL dbms.cluster.overview()" );
Map<BoltServerAddress,ClusterMemberRole> overview = new HashMap<>(); | <I> server only have overview procedure on core members | neo4j_neo4j-java-driver | train | java |
6ca51169b1856311ac8ccccd743d64ac322515fa | diff --git a/authomatic/providers/openid.py b/authomatic/providers/openid.py
index <HASH>..<HASH> 100644
--- a/authomatic/providers/openid.py
+++ b/authomatic/providers/openid.py
@@ -95,7 +95,7 @@ class SessionWrapper(object):
val = self.session.get(key)
if val and val.startswith(self.prefix):
split = val.split(self.prefix)[1]
- unpickled = pickle.loads(split)
+ unpickled = pickle.loads(str(split))
return unpickled
else: | Fixed a bug when openid session wrapper could not unpickle value
in python <I>. | authomatic_authomatic | train | py |
e1069fa5a037c1eb5ef9079c9c15053df6fbdda6 | diff --git a/lib/metc/cli.rb b/lib/metc/cli.rb
index <HASH>..<HASH> 100644
--- a/lib/metc/cli.rb
+++ b/lib/metc/cli.rb
@@ -33,20 +33,20 @@ module Metc
if File.exists?("site.sqlite3")
puts "Warning: All index data will be lost!".red
- reply = agree("database already exists, overwrite?".red) {
+ reply = agree("Database already exists, overwrite?".red) {
|q| q.default = "n" }
if reply
FileUtils.cp( f, Dir.pwd )
- puts "database re-initialized".green
+ puts "Database re-initialized".green
else
- puts "database not initialized".red
+ puts "Database not initialized".red
end
else
FileUtils.cp( f, Dir.pwd )
- puts "database initialized".green
+ puts "Database initialized".green
end
@@ -57,7 +57,14 @@ module Metc
config = File.join( File.dirname(__FILE__), "../../config/config.ru" )
- FileUtils.cp( config, Dir.pwd )
+ if File.exists?("config.ru")
+ puts "Environment has already been staged, no action taken.".yellow
+ else
+
+ FileUtils.cp( config, Dir.pwd )
+ puts "Run 'rackup' to start testing.".green
+
+ end
end | don't overwrite staging files. | stephenhu_meta | train | rb |
da9799659c002a321e196dc8e70e13024ea06d9b | diff --git a/samples/helloworld/helloworld.go b/samples/helloworld/helloworld.go
index <HASH>..<HASH> 100644
--- a/samples/helloworld/helloworld.go
+++ b/samples/helloworld/helloworld.go
@@ -46,10 +46,12 @@ func Draw(gc draw2d.GraphicContext, text string) {
gc.Save()
gc.SetFillColor(color.NRGBA{0xFF, 0x33, 0x33, 0xFF})
+ gc.SetStrokeColor(color.NRGBA{0xFF, 0x33, 0x33, 0xFF})
gc.Translate(145, 85)
gc.StrokeStringAt(text, -50, 0)
gc.Rotate(math.Pi / 4)
gc.SetFillColor(color.NRGBA{0x33, 0x33, 0xFF, 0xFF})
+ gc.SetStrokeColor(color.NRGBA{0x33, 0x33, 0xFF, 0xFF})
gc.StrokeString(text)
gc.Restore()
} | fix colors for stroke font in helloworld | llgcode_draw2d | train | go |
44127f25b84f0c840fd4bf11ddabea6e47d7df39 | diff --git a/client/my-sites/checkout/composite-checkout/contact-validation.js b/client/my-sites/checkout/composite-checkout/contact-validation.js
index <HASH>..<HASH> 100644
--- a/client/my-sites/checkout/composite-checkout/contact-validation.js
+++ b/client/my-sites/checkout/composite-checkout/contact-validation.js
@@ -45,18 +45,18 @@ export default function createContactValidationCallback( {
'There was an error validating your contact information. Please contact support.'
)
);
- resolve( false );
- return;
}
- if ( data.messages ) {
+ if ( data && data.messages ) {
showErrorMessage(
translate(
'We could not validate your contact information. Please review and update all the highlighted fields.'
)
);
}
- applyDomainContactValidationResults( { ...data.messages } );
- resolve( ! ( data.success && areRequiredFieldsNotEmpty( decoratedContactDetails ) ) );
+ applyDomainContactValidationResults( data?.messages ?? {} );
+ resolve(
+ ! ( data && data.success && areRequiredFieldsNotEmpty( decoratedContactDetails ) )
+ );
} );
} );
}; | Composite checkout: Do not validate contact details if the endpoint call fails (#<I>)
Adjust the logic in the contact validation callback in composite checkout to ensure that if the request to the endpoint fails, we do not allow checkout to proceed. | Automattic_wp-calypso | train | js |
c147d5a48c8e5b1f705f6f3aca274233a1d6c7a4 | diff --git a/lib/mongodb_fulltext_search/mixins.rb b/lib/mongodb_fulltext_search/mixins.rb
index <HASH>..<HASH> 100644
--- a/lib/mongodb_fulltext_search/mixins.rb
+++ b/lib/mongodb_fulltext_search/mixins.rb
@@ -9,6 +9,16 @@ module MongodbFulltextSearch::Mixins
module ClassMethods
+ def create_indexes
+ if MongodbFulltextSearch.mongoid?
+ fulltext_search_options.values.each do |options|
+ if options[:model].respond_to? :create_indexes
+ options[:model].send :create_indexes
+ end
+ end
+ end
+ end
+
def fulltext_search_in(*args)
options = args.last.is_a?(Hash) ? args.pop : {} | Added feature to support manual index creation via Mongoid | chrisfuller_mongodb_fulltext_search | train | rb |
bcb7ffd44b569d1ec5d7976ab35c3221d8095db8 | diff --git a/Generator/PHPFunction.php b/Generator/PHPFunction.php
index <HASH>..<HASH> 100644
--- a/Generator/PHPFunction.php
+++ b/Generator/PHPFunction.php
@@ -71,16 +71,6 @@ class PHPFunction extends BaseGenerator {
}
/**
- * Return a unique ID for this component.
- *
- * @return
- * The unique ID
- */
- public function getUniqueID() {
- return implode(':', [$this->type, $this->name]);
- }
-
- /**
* Return this component's parent in the component tree.
*/
function containingComponent() { | Removed unneeded override of getUniqueID(). | drupal-code-builder_drupal-code-builder | train | php |
f71140d26475a4dbded1e14239f27373b5d12832 | diff --git a/mackup/main.py b/mackup/main.py
index <HASH>..<HASH> 100644
--- a/mackup/main.py
+++ b/mackup/main.py
@@ -58,10 +58,16 @@ def main():
app_db.get_files(MACKUP_APP_NAME))
mackup_app.restore()
+ # Initialize again the apps db, as the Mackup config might have changed
+ # it
+ mckp = Mackup()
+ app_db = ApplicationsDatabase()
+
# Restore the rest of the app configs, using the restored Mackup config
app_names = mckp.get_apps_to_backup()
# Mackup has already been done
app_names.remove(MACKUP_APP_NAME)
+
for app_name in app_names:
app = ApplicationProfile(mckp, app_db.get_files(app_name))
app.restore() | Initialize again the apps db, as the Mackup config might have changed it | lra_mackup | train | py |
f557f7c6bba3c2f35a4c4c4c1ec066552d8c5cda | diff --git a/salt/states/file.py b/salt/states/file.py
index <HASH>..<HASH> 100644
--- a/salt/states/file.py
+++ b/salt/states/file.py
@@ -2060,8 +2060,15 @@ def directory(name,
return _error(
ret, 'Specified file {0} is not an absolute path'.format(name))
+ # checkng if bad symlink and force is applied
+ bad_link = False
+ log.debug(allow_symlink)
+ if os.path.islink(name) and force:
+ if not os.path.exists(os.readlink(name)):
+ bad_link = True
+
# Check for existing file or symlink
- if os.path.isfile(name) or (not allow_symlink and os.path.islink(name)):
+ if os.path.isfile(name) or (not allow_symlink and os.path.islink(name)) or bad_link:
# Was a backupname specified
if backupname is not None:
# Make a backup first | Added fix for issue <I> | saltstack_salt | train | py |
c8cd4650b7c714ff204bd2bb63f8083e44e1a02d | diff --git a/src/main/java/com/assertthat/selenium_shutterbug/core/Snapshot.java b/src/main/java/com/assertthat/selenium_shutterbug/core/Snapshot.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/assertthat/selenium_shutterbug/core/Snapshot.java
+++ b/src/main/java/com/assertthat/selenium_shutterbug/core/Snapshot.java
@@ -224,7 +224,6 @@ public abstract class Snapshot<T extends Snapshot> {
if (title != null && !title.isEmpty()) {
image = ImageProcessor.addTitle(image, title, Color.red, new Font("Serif", Font.BOLD, 20));
}
- driver.switchTo().defaultContent();
FileUtil.writeImage(image, EXTENSION, screenshotFile);
} | Do not switch to default content after frame screenshot. Leave it to the user | assertthat_selenium-shutterbug | train | java |
d9b6fcf5985559243e8163d6dfaab3f55158a501 | diff --git a/jaraco/windows/filesystem.py b/jaraco/windows/filesystem.py
index <HASH>..<HASH> 100644
--- a/jaraco/windows/filesystem.py
+++ b/jaraco/windows/filesystem.py
@@ -63,11 +63,13 @@ CreateFile.restype = HANDLE
FILE_SHARE_READ = 1
FILE_SHARE_WRITE = 2
FILE_SHARE_DELETE = 4
+FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
FILE_FLAG_BACKUP_SEMANTICS = 0x2000000
NULL = 0
OPEN_EXISTING = 3
FILE_ATTRIBUTE_NORMAL = 0x80
GENERIC_READ = 0x80000000
+FILE_READ_ATTRIBUTES = 0x80
INVALID_HANDLE_VALUE = HANDLE(-1).value
CloseHandle = windll.kernel32.CloseHandle
@@ -199,7 +201,7 @@ def GetFinalPath(path):
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, # share mode
LPSECURITY_ATTRIBUTES(), # NULL pointer
OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS,
+ FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS,
NULL,
) | Started working toward a symlink target that will work in all cases | jaraco_jaraco.windows | train | py |
4c550f5370862cb3ed3b02dad346ce2fff71aeb3 | diff --git a/src/saml2/client.py b/src/saml2/client.py
index <HASH>..<HASH> 100644
--- a/src/saml2/client.py
+++ b/src/saml2/client.py
@@ -280,6 +280,7 @@ class Saml2Client(Base):
except KeyError:
session_indexes = None
+ sign = sign if sign is not None else self.logout_requests_signed
sign_post = False if binding == BINDING_HTTP_REDIRECT else sign
sign_redirect = False if binding == BINDING_HTTP_POST and sign else sign
diff --git a/src/saml2/entity.py b/src/saml2/entity.py
index <HASH>..<HASH> 100644
--- a/src/saml2/entity.py
+++ b/src/saml2/entity.py
@@ -241,7 +241,11 @@ class Entity(HTTPBase):
:return: A dictionary
"""
- # XXX sig-allowed should be configurable
+ # XXX SIG_ALLOWED_ALG should be configurable
+ # XXX should_sign stems from authn_requests_signed and sign_response
+ # XXX based on the type of the entity
+ # XXX but should also take into account the type of message (Authn/Logout/etc)
+ # XXX should_sign should be split and the exact config options should be checked
sign = sign if sign is not None else self.should_sign
sign_alg = sigalg or self.signing_algorithm
if sign_alg not in [long_name for short_name, long_name in SIG_ALLOWED_ALG]: | Sign logout requests according to logout_requests_signed config option | IdentityPython_pysaml2 | train | py,py |
6356fba58a1d29408e44d54cf045856f5d1ccd84 | diff --git a/test/model_test.js b/test/model_test.js
index <HASH>..<HASH> 100644
--- a/test/model_test.js
+++ b/test/model_test.js
@@ -276,9 +276,9 @@ describe('Seraph Model', function() {
food.save({name:"Pinnekjøtt"}, function(err, meat) {
assert(!err);
beer.read(meat.id, function(err, nothing) {
- assert(err);
+ assert(!nothing);
food.read(beer.id, function(err, nothing) {
- assert(err);
+ assert(!nothing);
done();
});
}); | Changed expected result from failing read call | brikteknologier_seraph-model | train | js |
64e20d572344792913a50f78e88ee69f64b115ed | diff --git a/bench/graph_viewer/base/js/plot-benchmarks.js b/bench/graph_viewer/base/js/plot-benchmarks.js
index <HASH>..<HASH> 100644
--- a/bench/graph_viewer/base/js/plot-benchmarks.js
+++ b/bench/graph_viewer/base/js/plot-benchmarks.js
@@ -45,7 +45,7 @@ $(document).ready(function() {
plot_bm.options = {
series: {
- shadowSize: 6,
+ shadowSize: 0,
},
grid: {
clickable: true,
@@ -558,4 +558,4 @@ plot_bm.assign_overview_actions = function() {
yaxis:{}
}));
});
-};
\ No newline at end of file
+}; | Turn off shadows in graph viewer. | rethinkdb_rethinkdb | train | js |
6f8a5941ebce1b889fdce59e7f5f422439b94f89 | diff --git a/samples/DatePickerSample.js b/samples/DatePickerSample.js
index <HASH>..<HASH> 100644
--- a/samples/DatePickerSample.js
+++ b/samples/DatePickerSample.js
@@ -10,7 +10,7 @@ enyo.kind({
{kind: "FittableColumns", style: "padding: 10px", components:[
{components: [
{content:$L("Choose Locale:"), classes:"onyx-sample-divider"},
- {kind: "onyx.PickerDecorator", style:"padding:10px;", onSelect: "pickerHandler", components: [
+ {kind: "onyx.PickerDecorator", style:"padding:10px;", onSelect: "localeChanged", components: [
{content: "Pick One...", style: "width: 200px"},
{kind: "onyx.Picker", name: "localePicker", components: [
{content: "en-US", active:true},
@@ -71,12 +71,12 @@ enyo.kind({
],
rendered: function() {
this.inherited(arguments);
- this.pickerHandler();
+ this.localeChanged();
},
initComponents: function() {
this.inherited(arguments);
},
- pickerHandler: function(){
+ localeChanged: function(){
this.formatDate();
return true;
}, | ENYO-<I>: Updated name of change handler.
Enyo-DCO-<I>- | enyojs_onyx | train | js |
c30c2faf7a5100bbac6294548f4e66b127ac95dd | diff --git a/treeinterpreter/treeinterpreter.py b/treeinterpreter/treeinterpreter.py
index <HASH>..<HASH> 100644
--- a/treeinterpreter/treeinterpreter.py
+++ b/treeinterpreter/treeinterpreter.py
@@ -91,8 +91,10 @@ def _predict_tree(model, X, joint_contribution=False):
return direct_prediction, biases, contributions
else:
-
- for row, leaf in enumerate(leaves):
+ unique_leaves = np.unique(leaves)
+ unique_contributions = {}
+
+ for row, leaf in enumerate(unique_leaves):
for path in paths:
if leaf == path[-1]:
break
@@ -103,8 +105,11 @@ def _predict_tree(model, X, joint_contribution=False):
contrib = values_list[path[i+1]] - \
values_list[path[i]]
contribs[feature_index[path[i]]] += contrib
- contributions.append(contribs)
-
+ unique_contributions[leaf] = contribs
+
+ for row, leaf in enumerate(leaves):
+ contributions.append(unique_contributions[leaf])
+
return direct_prediction, biases, np.array(contributions) | improve the efficiency of tree leaf contribution calculation | andosa_treeinterpreter | train | py |
701d85072d1ea5c35c7d05acf19bccdef626ba3c | diff --git a/access_error.go b/access_error.go
index <HASH>..<HASH> 100644
--- a/access_error.go
+++ b/access_error.go
@@ -28,7 +28,7 @@ func writeJsonError(rw http.ResponseWriter, err error) {
rw.Header().Set("Content-Type", "application/json;charset=UTF-8")
rfcerr := ErrorToRFC6749Error(err)
- js, err := json.Marshal(err)
+ js, err := json.Marshal(rfcerr)
if err != nil {
http.Error(rw, fmt.Sprintf(`{"error": "%s"}`, err.Error()), http.StatusInternalServerError)
return | Makes use of rfcerr in access error endpoint writer explicit | ory_fosite | train | go |
236f4096cdfd6d8ba32dc40fdde6f1383b15cf04 | diff --git a/lib/rjr/dispatcher.rb b/lib/rjr/dispatcher.rb
index <HASH>..<HASH> 100644
--- a/lib/rjr/dispatcher.rb
+++ b/lib/rjr/dispatcher.rb
@@ -74,21 +74,12 @@ class Dispatcher
@@handlers[method] = handler
end
- # register a callback to the specified method.
- # a callback is the same as a handler except it takes an additional argument
- # specifying the node callback instance to use to send data back to client
- def self.add_callback(method, &handler)
- @@callbacks ||= {}
- @@callbacks[method] = handler
- end
-
# Helper to handle request messages
def self.dispatch_request(args = {})
method = args[:method]
@@handlers ||= {}
- @@callbacks ||= {}
- handler = @@handlers[method] || @@callbacks[method]
+ handler = @@handlers[method]
if !handler.nil?
begin | remove callbacks as distinction from handlers is no longer necessary | movitto_rjr | train | rb |
ea07a5986688a53a88d5f8ab8caf3acdc859bce3 | diff --git a/java/backend-services/capabilities-directory/src/main/java/io/joynr/capabilities/GlobalDiscoveryEntryPersisted.java b/java/backend-services/capabilities-directory/src/main/java/io/joynr/capabilities/GlobalDiscoveryEntryPersisted.java
index <HASH>..<HASH> 100644
--- a/java/backend-services/capabilities-directory/src/main/java/io/joynr/capabilities/GlobalDiscoveryEntryPersisted.java
+++ b/java/backend-services/capabilities-directory/src/main/java/io/joynr/capabilities/GlobalDiscoveryEntryPersisted.java
@@ -178,6 +178,17 @@ public class GlobalDiscoveryEntryPersisted extends GlobalDiscoveryEntry {
this.clusterControllerId = clusterControllerId;
}
+ /**
+ * Stringifies the class
+ *
+ * @return stringified class content
+ */
+ @Override
+ public String toString() {
+ return "GlobalDiscoveryEntryPersisted [" + super.toString() + ", " + "providerQosPersisted="
+ + providerQosPersisted + ", clusterControllerId=" + clusterControllerId + ", gbid=" + gbid + "]";
+ }
+
@Override
public int hashCode() {
final int prime = 31; | [JEE] Add toString method to GlobalDiscoveryEntryPersisted | bmwcarit_joynr | train | java |
6f03ed7b16593858afcd5853fd75f01dd496f630 | diff --git a/lib/falkorlib/version.rb b/lib/falkorlib/version.rb
index <HASH>..<HASH> 100644
--- a/lib/falkorlib/version.rb
+++ b/lib/falkorlib/version.rb
@@ -19,7 +19,7 @@ module FalkorLib #:nodoc:
# MAJOR: Defines the major version
# MINOR: Defines the minor version
# PATCH: Defines the patch version
- MAJOR, MINOR, PATCH = 0, 3, 10
+ MAJOR, MINOR, PATCH = 0, 3, 11
module_function | bump to version '<I>' | Falkor_falkorlib | train | rb |
e450fd0879592664a4ab0785c578a4506e6d4ac9 | diff --git a/printf.go b/printf.go
index <HASH>..<HASH> 100644
--- a/printf.go
+++ b/printf.go
@@ -45,11 +45,12 @@ var (
)
var (
- force bool
+ force *bool
)
func ForceColor(c bool) {
- force = c
+ tf := c
+ force = &tf
}
func strip(s string) string {
@@ -87,7 +88,10 @@ func CanColorize(out io.Writer) bool {
}
func ShouldColorize(out io.Writer) bool {
- return force || CanColorize(out)
+ if force != nil {
+ return *force
+ }
+ return CanColorize(out)
}
func Printf(format string, a ...interface{}) (int, error) { | Allow ForceColor() to force color off
Previously, it just forced it on, and there was no way to unambiguously
remove colorization. | jhunt_go-ansi | train | go |
183510ebf28d6e73d17b70e735e1de29bef51458 | diff --git a/src/Repository/Storage/QueryableStorageInterface.php b/src/Repository/Storage/QueryableStorageInterface.php
index <HASH>..<HASH> 100644
--- a/src/Repository/Storage/QueryableStorageInterface.php
+++ b/src/Repository/Storage/QueryableStorageInterface.php
@@ -7,7 +7,7 @@ use Systream\Repository\Model\ModelInterface;
use Systream\Repository\ModelList\ModelListInterface;
use Systream\Repository\Storage\Query\QueryInterface;
-interface QueryableStorageInterface
+interface QueryableStorageInterface extends StorageInterface
{
/**
* @param QueryInterface $query | Queryable storage interface extends Storage interface | systream_repository | train | php |
7ed213165b1364d8ddbf9b0b91903f3844c09deb | diff --git a/src/de/mrapp/android/preference/PreferenceActivity.java b/src/de/mrapp/android/preference/PreferenceActivity.java
index <HASH>..<HASH> 100644
--- a/src/de/mrapp/android/preference/PreferenceActivity.java
+++ b/src/de/mrapp/android/preference/PreferenceActivity.java
@@ -23,6 +23,7 @@ import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
+import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
@@ -266,6 +267,17 @@ public abstract class PreferenceActivity extends Activity implements
}
@Override
+ public final boolean onKeyDown(final int keyCode, final KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_BACK && !isSplitScreen()
+ && currentlyShownFragment != null) {
+ showPreferenceHeaders();
+ return true;
+ }
+
+ return super.onKeyDown(keyCode, event);
+ }
+
+ @Override
protected final void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.preference_activity); | The behavior of the device's back button is now overridden. | michael-rapp_AndroidPreferenceActivity | train | java |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.