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
ff652bb13e87aa7ae78c171d926a1864145167d2
diff --git a/src/Signature.php b/src/Signature.php index <HASH>..<HASH> 100644 --- a/src/Signature.php +++ b/src/Signature.php @@ -268,7 +268,12 @@ final class Signature * A signature is valid if r is congruent to x1 (mod n) * or in other words, if r - x1 is an integer multiple of n. */ - return (bool)($this->Compare($r, $Z['x']) == 0); + if ($this->Compare($r, $Z['x']) == 0) { + return true; + } else { + throw new \Exception('The signature is invalid! Value used for $r was "' . var_export($r, true) . '" and the calculated $x parameter was "' . var_export($Z['x'], true) . '".'); + } + } catch (\Exception $e) { throw $e; }
Added exception to Verify() function
ionux_phactor
train
php
31be5d674855667f512fa97dacf96eb4aad65fec
diff --git a/lib/resources/setup.js b/lib/resources/setup.js index <HASH>..<HASH> 100644 --- a/lib/resources/setup.js +++ b/lib/resources/setup.js @@ -55,7 +55,7 @@ function tableCreation(req, res, next) { oncomplete: function(err) { if(err) return next(err); - res.end(); + res.end('data: ' + JSON.stringify({done: true}) + '\n\n'); }, onprogress: function(script) {
Send done message when all tables are created
shinuza_captain-core
train
js
5afeb94b09f1d4044c734b97ed88a6bbe7d5ccf9
diff --git a/common/src/main/java/tachyon/security/authentication/AuthenticationUtils.java b/common/src/main/java/tachyon/security/authentication/AuthenticationUtils.java index <HASH>..<HASH> 100644 --- a/common/src/main/java/tachyon/security/authentication/AuthenticationUtils.java +++ b/common/src/main/java/tachyon/security/authentication/AuthenticationUtils.java @@ -102,7 +102,9 @@ public final class AuthenticationUtils { * @return An unconnected socket */ public static TSocket createTSocket(InetSocketAddress address) { - return new TSocket(NetworkAddressUtils.getFqdnHost(address), address.getPort()); + // TODO: make the timeout configurable. + return new TSocket(NetworkAddressUtils.getFqdnHost(address), address.getPort(), + 30 * Constants.SECOND_MS); } private AuthenticationUtils() {} // prevent instantiation
Use timeout for thrift RPCs
Alluxio_alluxio
train
java
cf8251e17a3fbd63307fca3d7acd7ed41d8c110e
diff --git a/src/graph/Plot.java b/src/graph/Plot.java index <HASH>..<HASH> 100644 --- a/src/graph/Plot.java +++ b/src/graph/Plot.java @@ -199,7 +199,7 @@ public final class Plot { final PrintWriter datafile = new PrintWriter(datafiles[i]); try { for (final DataPoint d : datapoints.get(i)) { - final long ts = d.timestamp(); + final long ts = d.timestamp() / 1000; if (ts >= (start_time & UNSIGNED) && ts <= (end_time & UNSIGNED)) { npoints++; }
Modify Plot to convert the ms timestamps back to seconds
OpenTSDB_opentsdb
train
java
6c8dab298930250b3dd276643892b5d8eff64862
diff --git a/handler.go b/handler.go index <HASH>..<HASH> 100644 --- a/handler.go +++ b/handler.go @@ -47,7 +47,7 @@ func HandlerLoggerRouter(fn Handler) httprouter.Handle { } func handlerLogger(fn Handler, w http.ResponseWriter, r *http.Request, p httprouter.Params) { - l := newHandlerLogEntry(r) + l := NewHandlerLogEntry(r) l.Info("New request") starttime := time.Now() @@ -90,7 +90,7 @@ func handlerError(w http.ResponseWriter, r *http.Request, e *HandlerError) { http.Error(w, scode+" - "+e.Error.Error(), e.Code) } -func newHandlerLogEntry(r *http.Request) *log.Entry { +func NewHandlerLogEntry(r *http.Request) *log.Entry { remote, _, err := net.SplitHostPort(r.RemoteAddr) if err != nil { log.WithFields(log.Fields{
Exported NewHandlerLogEntry.
AlexanderThaller_httphelper
train
go
d59ddd276c70b437d674843a4134422c7464da77
diff --git a/lib/danger/danger_core/dangerfile.rb b/lib/danger/danger_core/dangerfile.rb index <HASH>..<HASH> 100644 --- a/lib/danger/danger_core/dangerfile.rb +++ b/lib/danger/danger_core/dangerfile.rb @@ -250,7 +250,7 @@ module Danger danger_id: danger_id } - if env.request_source.respond_to?(:update_pr_by_line!) + if env.request_source.respond_to?(:update_pr_by_line!) && ENV["DANGER_MESSAGE_AGGREGATION"] env.request_source.update_pr_by_line!(messages: MessageAggregator.aggregate(**report)) else env.request_source.update_pull_request!(
Prevent message aggregation unless DANGER_MESSAGE_AGGREGATION environment variable is set
danger_danger
train
rb
8222305e15875fceb1e7a9d236d227d061dc7604
diff --git a/pydbus/bus.py b/pydbus/bus.py index <HASH>..<HASH> 100644 --- a/pydbus/bus.py +++ b/pydbus/bus.py @@ -53,15 +53,6 @@ class Bus(OwnMixin, WatchMixin): return self def __exit__(self, exc_type, exc_value, traceback): - if self.con: - self.close() - - def __del__(self): - if self.con: - self.close() - - def close(self): - self.con.close_sync(None) self.con = None def SystemBus(): diff --git a/pydbus/tests/context.py b/pydbus/tests/context.py index <HASH>..<HASH> 100644 --- a/pydbus/tests/context.py +++ b/pydbus/tests/context.py @@ -5,3 +5,9 @@ with SessionBus() as bus: assert(notifications.Notify) assert(bus.con is None) + +with SessionBus() as bus: + notifications = bus.get('.Notifications') + assert(notifications.Notify) + +assert(bus.con is None)
Drop bus.close(), as it does an unexpected thing. In __init__ we obtain a reference to a singleton object, and do not create it. Therefore we shouldn't close it on exit.
LEW21_pydbus
train
py,py
c581b20785e33035d2692b87d72449c7a81cd47b
diff --git a/features/eolearn/features/interpolation.py b/features/eolearn/features/interpolation.py index <HASH>..<HASH> 100644 --- a/features/eolearn/features/interpolation.py +++ b/features/eolearn/features/interpolation.py @@ -128,7 +128,8 @@ class InterpolationTask(EOTask): if self.feature_name not in eopatch.data: raise ValueError('Feature {} not found in EOPatch.data.'.format(self.feature_name)) - feature_data = eopatch.data[self.feature_name] + # Make a copy not to change original numpy array + feature_data = eopatch.data[self.feature_name].copy() time_num, height, width, band_num = eopatch.data[self.feature_name].shape # Prepare mask of valid data @@ -149,6 +150,10 @@ class InterpolationTask(EOTask): total_diff = int((new_eopatch.timestamp[0].date() - start_time.date()).total_seconds()) resampled_times = new_eopatch.time_series() + total_diff + # Add BBox to eopatch if it was created anew + if new_eopatch.bbox is None: + new_eopatch.bbox = eopatch.bbox + # Interpolate feature_data = self.interpolate_data(feature_data, times, resampled_times)
minor fixes * copy data array when setting invalid data to nans * adding bbox to newly created eopatch
sentinel-hub_eo-learn
train
py
5fbf250160adbce0c76e9aa1f032bae885358130
diff --git a/tests/GeometryTest.php b/tests/GeometryTest.php index <HASH>..<HASH> 100644 --- a/tests/GeometryTest.php +++ b/tests/GeometryTest.php @@ -319,7 +319,7 @@ class GeometryTest extends AbstractTestCase * @param string $geometry The WKT of the geometry to test. * @param string $envelope The WKT of the expected envelope. */ - public function envelope($geometry, $envelope) + public function testEnvelope($geometry, $envelope) { $this->assertSame($envelope, Geometry::fromText($geometry)->envelope()->asText()); }
Fix test not running due to incorrect method name
brick_geo
train
php
a71d39436c548bd4f197c80a60725b609a39b651
diff --git a/lib/ruby-lint/definitions/core/env.rb b/lib/ruby-lint/definitions/core/env.rb index <HASH>..<HASH> 100644 --- a/lib/ruby-lint/definitions/core/env.rb +++ b/lib/ruby-lint/definitions/core/env.rb @@ -4,6 +4,7 @@ # Platform: rbx 2.0.0.rc1 # RubyLint::GlobalScope.definitions.define_constant('ENV') do |klass| + klass.inherits(RubyLint::GlobalScope.constant_proxy('Hash')) end -RubyLint::GlobalScope.definitions.lookup(:const, 'ENV').deep_freeze \ No newline at end of file +RubyLint::GlobalScope.definitions.lookup(:const, 'ENV').deep_freeze
ENV should inherit from Hash. Although technically not true the class of ENV is "undefined" between Ruby implementations. Since it behaves like a Hash this the closest and easiest solution.
YorickPeterse_ruby-lint
train
rb
b45b84392b6c9572b41a2a9347b05bef5f63b19d
diff --git a/example/rcnn/rcnn/dataset/pascal_voc_eval.py b/example/rcnn/rcnn/dataset/pascal_voc_eval.py index <HASH>..<HASH> 100644 --- a/example/rcnn/rcnn/dataset/pascal_voc_eval.py +++ b/example/rcnn/rcnn/dataset/pascal_voc_eval.py @@ -48,8 +48,8 @@ def voc_ap(rec, prec, use_07_metric=False): ap += p / 11. else: # append sentinel values at both ends - mrec = np.concatenate([0.], rec, [1.]) - mpre = np.concatenate([0.], prec, [0.]) + mrec = np.concatenate(([0.], rec, [1.])) + mpre = np.concatenate(([0.], prec, [0.])) # compute precision integration ladder for i in range(mpre.size - 1, 0, -1):
Fix voc_ap issue in rcnn test path. (#<I>) * Fixes mxnet additonal deps: python-matplotlib is an apt package, not a pip package, and the pip package for scimage is scikit-image * Fixes issue in voc_ap where np.concatenate expects a tuple.
apache_incubator-mxnet
train
py
2ddc3f6699c55498d31cba93e720545455a28f07
diff --git a/src/frontend/org/voltdb/dbmonitor/js/voltdb.sqlquery.ui.js b/src/frontend/org/voltdb/dbmonitor/js/voltdb.sqlquery.ui.js index <HASH>..<HASH> 100644 --- a/src/frontend/org/voltdb/dbmonitor/js/voltdb.sqlquery.ui.js +++ b/src/frontend/org/voltdb/dbmonitor/js/voltdb.sqlquery.ui.js @@ -1,5 +1,13 @@ $(document).ready(function () { - + if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { + shortcut.add("f6", function () { + $("#runBTn").button().click(); + }); + } else { + shortcut.add("f5", function () { + $("#runBTn").button().click(); + }); + } //Default Action $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); //Activate first tab @@ -224,6 +232,4 @@ function loadPage(serverName, portid) { $('#clearQuery').click(function () { $('#theQueryText').val(''); }); - - shortcut.add("F5", function () { $("#runBTn").button().click(); }); }
Modified code to use 'F6' key to execute query in studio in case of Safari browser.
VoltDB_voltdb
train
js
2cbfe96c67d740ffdaf4a79ebbcd7618cd3fb58c
diff --git a/qingstor/sdk/unpack.py b/qingstor/sdk/unpack.py index <HASH>..<HASH> 100644 --- a/qingstor/sdk/unpack.py +++ b/qingstor/sdk/unpack.py @@ -51,7 +51,7 @@ class Unpacker(dict): # In other situations, body should not be unpacked for possibly large memory usage if not ( self.res.ok and - self.res.headers["Content-Type"] != "application/json" + self.res.headers.get("Content-Type") != "application/json" ): try: data = self.res.json()
Fix key error while delete not return content-type
yunify_qingstor-sdk-python
train
py
58b521e81e93e9bf68ddc8c64abd04e2cd7ca32d
diff --git a/addon/utils/first-load-offline-objects.js b/addon/utils/first-load-offline-objects.js index <HASH>..<HASH> 100644 --- a/addon/utils/first-load-offline-objects.js +++ b/addon/utils/first-load-offline-objects.js @@ -57,7 +57,9 @@ export function firstLoadOfflineObjects(dexieDB, odataPath, functionName, modelN } }); - dexieDB.table(modelName).bulkAdd(objArray).then(() => resolve(), () => reject()); + dexieDB.table(modelName).bulkPut(objArray).then(() => resolve(), () => reject()); + }).fail(function() { + return reject(modelName); }); }); }
Add rejected model to firstLoadOfflineObjects function
Flexberry_ember-flexberry-data
train
js
10311f2bb052b41f0894db9415c08323f326bccb
diff --git a/stream.js b/stream.js index <HASH>..<HASH> 100644 --- a/stream.js +++ b/stream.js @@ -35,6 +35,8 @@ Stream.prototype._ready = function () { else this.cursor = ltgt.lowerBound(this.opts, 0) + if(this.cursor < 0) this.cursor = 0 + var self = this this.blocks.getBlock(~~(this.cursor/self.blocks.block), function (err, buffer) { self._buffer = buffer @@ -153,3 +155,8 @@ Stream.prototype.abort = function (err) { Stream.prototype.pipe = require('push-stream/pipe') + + + + +
accept -1 as a lower bound, compat with flumelog
dominictarr_flumelog-aligned-offset
train
js
c053d2dff1e09e79c4ee869ba3e8c4eee2bc0ac8
diff --git a/lib/celluloid/zmq.rb b/lib/celluloid/zmq.rb index <HASH>..<HASH> 100644 --- a/lib/celluloid/zmq.rb +++ b/lib/celluloid/zmq.rb @@ -6,6 +6,8 @@ require 'celluloid/zmq/reactor' module Celluloid # Actors which run alongside 0MQ operations + # This is a temporary hack (hopefully) until ffi-rzmq exposes IO objects for + # 0MQ sockets that can be used with Celluloid::IO module ZMQ def self.included(klass) klass.send :include, ::Celluloid
A note on Celluloid::ZMQ's hopefully ephemeral nature
celluloid_dcell
train
rb
d8ec65d3d45b7fcc2ea6e77dda238b58832bab1d
diff --git a/keyring/backend.py b/keyring/backend.py index <HASH>..<HASH> 100644 --- a/keyring/backend.py +++ b/keyring/backend.py @@ -232,9 +232,9 @@ class SchemeSelectable: KeypassXC=dict(username='UserName', service='Title'), ) - def _query(self, service, username): + def _query(self, service, username=None, **base): scheme = self.schemes[self.scheme] - return ( + return dict( { scheme['username']: username, scheme['service']: service, @@ -242,5 +242,6 @@ class SchemeSelectable: if username else { scheme['service']: service, - } + }, + **base, ) diff --git a/keyring/backends/SecretService.py b/keyring/backends/SecretService.py index <HASH>..<HASH> 100644 --- a/keyring/backends/SecretService.py +++ b/keyring/backends/SecretService.py @@ -86,10 +86,7 @@ class Keyring(backend.SchemeSelectable, KeyringBackend): def set_password(self, service, username, password): """Set password for the username of the service""" collection = self.get_preferred_collection() - attributes = dict( - self._query(service, username), - application=self.appid, - ) + attributes = self._query(service, username, application=self.appid) label = "Password for '{}' on '{}'".format(username, service) with closing(collection.connection): collection.create_item(label, attributes, password, replace=True)
Allow _query to include other keys
jaraco_keyring
train
py,py
0e922a2dd5106baa3c85880a40e1840e55e5052d
diff --git a/sprd/model/Order.js b/sprd/model/Order.js index <HASH>..<HASH> 100644 --- a/sprd/model/Order.js +++ b/sprd/model/Order.js @@ -20,7 +20,11 @@ define(["sprd/data/SprdModel", "sprd/model/Shop", "sprd/model/OrderItem", "js/da billing: Delivery.Billing, shipping: Shipping, repayable: Boolean, - priceTotal: Price + priceTotal: Price, + user: { + type: Object, + required: false + } }, totalItemsCount: function() {
DEV-<I> - added user into Order model
spreadshirt_rAppid.js-sprd
train
js
678c67622d89a75ccd7d65c3a160572b3eb8b811
diff --git a/src/js/ripple/remote.js b/src/js/ripple/remote.js index <HASH>..<HASH> 100644 --- a/src/js/ripple/remote.js +++ b/src/js/ripple/remote.js @@ -2036,7 +2036,7 @@ Remote.prepareCurrencies = function(currency) { } if (currency.hasOwnProperty('currency')) { - newCurrency.currency = Currency.json_rewrite(currency.currency); + newCurrency.currency = Currency.json_rewrite(currency.currency, {force_hex:true}); } return newCurrency;
[FIX] Cannot use demmurage currencies in path_find Use hex format instead of json for currencies.
ChainSQL_chainsql-lib
train
js
3663d1d4fe497492fabfc7fd14281d1559efbdff
diff --git a/packages/react-bootstrap-table2/src/bootstrap-table.js b/packages/react-bootstrap-table2/src/bootstrap-table.js index <HASH>..<HASH> 100644 --- a/packages/react-bootstrap-table2/src/bootstrap-table.js +++ b/packages/react-bootstrap-table2/src/bootstrap-table.js @@ -170,7 +170,7 @@ BootstrapTable.propTypes = { }), onRowExpand: PropTypes.func, onAllRowExpand: PropTypes.func, - isAnyExpands: PropTypes.func, + isAnyExpands: PropTypes.bool, rowStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.func]), rowEvents: PropTypes.object, rowClasses: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
fix Warning: Failed prop type: Invalid prop of type supplied to , expected
react-bootstrap-table_react-bootstrap-table2
train
js
ddaf37266463eefc2c9efa9f7129c90ae3a55b0e
diff --git a/addon/models/user.js b/addon/models/user.js index <HASH>..<HASH> 100644 --- a/addon/models/user.js +++ b/addon/models/user.js @@ -3,10 +3,10 @@ import DS from 'ember-data'; import OsfModel from 'ember-osf/models/base'; export default OsfModel.extend({ - full_name: DS.attr('string'), - given_name: DS.attr('string'), - middle_names: DS.attr(), - family_name: DS.attr('string'), + fullName: DS.attr('string'), + givenName: DS.attr('string'), + middleNames: DS.attr(), + familyName: DS.attr('string'), nodes: DS.hasMany('nodes') });
CamelCase user model fields
CenterForOpenScience_ember-osf
train
js
5f0e741b5a355c49051e0d5e402c72746b30ed8b
diff --git a/python/ccxt/async_support/base/exchange.py b/python/ccxt/async_support/base/exchange.py index <HASH>..<HASH> 100644 --- a/python/ccxt/async_support/base/exchange.py +++ b/python/ccxt/async_support/base/exchange.py @@ -74,12 +74,8 @@ class Exchange(BaseExchange): def open(self): if self.own_session and self.session is None: - context = None - if self.verify: - # Create our SSL context object with our CA cert file - context = ssl.create_default_context(cafile=self.cafile) - else: - context = self.verify + # Create our SSL context object with our CA cert file + context = ssl.create_default_context(cafile=self.cafile) if self.verify else self.verify # Pass this SSL context to aiohttp and create a TCPConnector connector = aiohttp.TCPConnector(ssl=context, loop=self.asyncio_loop) self.session = aiohttp.ClientSession(loop=self.asyncio_loop, connector=connector, trust_env=self.aiohttp_trust_env)
async_support/base/exchange.py minor simplifications #<I>
ccxt_ccxt
train
py
f689808797bf515a6b219e281797613581a7df54
diff --git a/pyramid_webassets/tests/test_webassets.py b/pyramid_webassets/tests/test_webassets.py index <HASH>..<HASH> 100644 --- a/pyramid_webassets/tests/test_webassets.py +++ b/pyramid_webassets/tests/test_webassets.py @@ -776,7 +776,13 @@ class TestBaseUrlBehavior(object): # Work a bit the resolve output (o.css will activate the output=o.css) ('mypkg:static', 'manual', 'mypkg:static/t.css', - 'http://example.com/static/o.css')], + 'http://example.com/static/o.css'), + + # Test the string joins when using a package root as the asset spec + # The expected output is relative until/unless Pyramid merges + # https://github.com/Pylons/pyramid/pull/1377 + # As such, this is not really a recommended setup. + ('mypkg:', 'automatic', 'mypkg:static/t.css', '/static/o.css')], ) def test_url(self, base_dir, static_view, webasset, expected): """
Test package root asset spec base directory
sontek_pyramid_webassets
train
py
fa927a8f0a53704d113b73519c7f830e0c9ed5b1
diff --git a/taskcluster/aio/asyncclient.py b/taskcluster/aio/asyncclient.py index <HASH>..<HASH> 100644 --- a/taskcluster/aio/asyncclient.py +++ b/taskcluster/aio/asyncclient.py @@ -221,7 +221,7 @@ class AsyncBaseClient(BaseClient): try: await response.release() return await response.json() - except ValueError: + except (ValueError, aiohttp.client_exceptions.ContentTypeError): return {"response": response} # This code-path should be unreachable
The exception raised by async .json() call has changed.
taskcluster_taskcluster-client.py
train
py
cc843812e61f9c884c9e08bc98584db27976b5af
diff --git a/packages/cozy-client/src/models/accounts.js b/packages/cozy-client/src/models/accounts.js index <HASH>..<HASH> 100644 --- a/packages/cozy-client/src/models/accounts.js +++ b/packages/cozy-client/src/models/accounts.js @@ -5,7 +5,7 @@ import get from 'lodash/get' * * @param {object} account io.cozy.accounts * - * @returns {Array} AN array of errors with a `type` and `mutedAt` field + * @returns {Array} An array of errors with a `type` and `mutedAt` field */ export const getMutedErrors = account => get(account, 'mutedErrors', [])
Update packages/cozy-client/src/models/accounts.js
cozy_cozy-client
train
js
a5e87b4a6c5f696b443ab6ccef2b2af1e67d40bf
diff --git a/circuits.js b/circuits.js index <HASH>..<HASH> 100644 --- a/circuits.js +++ b/circuits.js @@ -165,12 +165,12 @@ Circuits.prototype.handleRequest = function handleRequest(req, buildRes, nextHan var arg1 = String(req.arg1); var circuit = self.getCircuit(callerName, serviceName, arg1); - if (circuit.state.shouldRequest()) { - buildRes = circuit.monitorRequest(req, buildRes); - return nextHandler.handleRequest(req, buildRes); - } else { + if (!circuit.state.shouldRequest()) { return buildRes().sendError('Declined', 'Service is not healthy'); } + + buildRes = circuit.monitorRequest(req, buildRes); + return nextHandler.handleRequest(req, buildRes); }; // Called upon membership change to collect services that the corresponding
Circuits: normalize declined path in #handleRequest
uber_tchannel-node
train
js
565f2b28ef2db15bdf7ea176b690b63bc1d6ba94
diff --git a/src/js/modules/metrics.js b/src/js/modules/metrics.js index <HASH>..<HASH> 100644 --- a/src/js/modules/metrics.js +++ b/src/js/modules/metrics.js @@ -1,6 +1,6 @@ import {apiUri} from '../../../config' -import {checkFetchStatus} from './utilities' import fetch from 'isomorphic-fetch' +import {checkFetchStatus, defaultFetchOptions} from './utilities' export const FAILURE = 'safe-app/metrics/FAILURE' export const REQUEST = 'safe-app/metrics/REQUEST' @@ -27,6 +27,7 @@ export const sendMetrics = (data) => return fetch(`${apiUri}/metrics`, { + ...defaultFetchOptions, method: 'POST', headers: { 'Accept': 'application/json',
Closes #<I>. Fixed user session issue
jeffshaver_safe-app
train
js
da51cdcb81087449714e0d2b4b2188bd6118de47
diff --git a/addon/components/sl-chart.js b/addon/components/sl-chart.js index <HASH>..<HASH> 100755 --- a/addon/components/sl-chart.js +++ b/addon/components/sl-chart.js @@ -162,8 +162,6 @@ export default Ember.Component.extend({ function() { const chartStyle = { fontFamily: [ - '"Benton Sans"', - '"Helvetica Neue"', 'Helvetica', 'Arial', 'sans-serif'
Remove font family entries in sl-chart
softlayer_sl-ember-components
train
js
a0fb164149939fc7034ef84c86b194ac003196e5
diff --git a/src/main/groovy/util/logging/Log4j2.java b/src/main/groovy/util/logging/Log4j2.java index <HASH>..<HASH> 100644 --- a/src/main/groovy/util/logging/Log4j2.java +++ b/src/main/groovy/util/logging/Log4j2.java @@ -53,7 +53,7 @@ import org.objectweb.asm.Opcodes; * If the expression exp is a constant or only a variable access the method call will * not be transformed. But this will still cause a call on the injected logger. * - * @since 2.3.0 + * @since 2.2.0 */ @java.lang.annotation.Documented @Retention(RetentionPolicy.SOURCE)
set since version to <I>
apache_groovy
train
java
b131b209e9711d1d3cbf69deb87718e94cb31e1b
diff --git a/spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb b/spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb index <HASH>..<HASH> 100644 --- a/spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb +++ b/spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb @@ -41,7 +41,7 @@ describe 'format, content_type' do { 'declared_params' => declared(params) } end - desc 'This uses produces for produces', + desc 'This uses consumes for consumes', failure: [{ code: 400, model: Entities::ApiError }], consumes: ['application/www_url_encoded'], entity: Entities::UseResponse
Spec: rename an it clause to match test - this text edit fixes #<I>
ruby-grape_grape-swagger
train
rb
79a64df691754119f1bc69cd73369267a5d82b28
diff --git a/js/huobipro.js b/js/huobipro.js index <HASH>..<HASH> 100644 --- a/js/huobipro.js +++ b/js/huobipro.js @@ -791,9 +791,9 @@ module.exports = class huobipro extends Exchange { await this.loadMarkets (); await this.loadAccounts (); const market = this.market (symbol); - - let requestAmount = ((type === 'market') && (side === 'buy')) ? this.valueToPrecision (symbol, amount) : this.amountToPrecision (symbol, amount); - + // market buy order need to use the value precision. + // market order buy amount means the amount of base currency. amount-precision is applied on quote currency + const requestAmount = ((type === 'market') && (side === 'buy')) ? this.valueToPrecision (symbol, amount) : this.amountToPrecision (symbol, amount); const request = { 'account-id': this.accounts[0]['id'], 'amount': requestAmount,
fix the huobipro market buy order amount issue
ccxt_ccxt
train
js
bf02ceb76b110df728b63cc2d31838f5f8de26fe
diff --git a/src/main/java/au/com/southsky/jfreesane/FrameInputStream.java b/src/main/java/au/com/southsky/jfreesane/FrameInputStream.java index <HASH>..<HASH> 100644 --- a/src/main/java/au/com/southsky/jfreesane/FrameInputStream.java +++ b/src/main/java/au/com/southsky/jfreesane/FrameInputStream.java @@ -46,12 +46,11 @@ class FrameInputStream extends InputStream { while (readRecord(bigArray) >= 0); if (imageSize > 0 && bigArray.size() < imageSize) { + int difference = imageSize - bigArray.size(); log.log(Level.WARNING, "truncated read (got {0}, expected {1} bytes)", new Object[] { bigArray.size(), imageSize }); - for (int i = 0; i < imageSize - bigArray.size(); i++) { - bigArray.write(0); - } - log.log(Level.WARNING, "padded image with {0} null bytes", imageSize - bigArray.size()); + bigArray.write(new byte[difference]); + log.log(Level.WARNING, "padded image with {0} null bytes", difference); } // Now, if necessary, put the bytes in the correct order according
Write a byte array rather than individual bytes
sjamesr_jfreesane
train
java
39e4ff51a4cbe1557bbe70477c0b0346552dd426
diff --git a/jwcrypto/jwa.py b/jwcrypto/jwa.py index <HASH>..<HASH> 100644 --- a/jwcrypto/jwa.py +++ b/jwcrypto/jwa.py @@ -828,7 +828,7 @@ class _EcdhEsAes192Kw(_EcdhEs): class _EcdhEsAes256Kw(_EcdhEs): name = 'ECDH-ES+A256KW' - description = 'ECDH-ES using Concat KDF and "A128KW" wrapping' + description = 'ECDH-ES using Concat KDF and "A256KW" wrapping' keysize = 256 algorithm_usage_location = 'alg' algorithm_use = 'kex'
Fixing "A<I>KW" under "_EcdhEsAes<I>Kw" There was a typo in the "_EcdhEsAes<I>Kw" class. I have changed "A<I>KW" in the description for the class to become "A<I>KW" in accordance with the algorithm.
latchset_jwcrypto
train
py
773950fd207bbf27555778ead93c0e275b93614b
diff --git a/pusher/sync.py b/pusher/sync.py index <HASH>..<HASH> 100644 --- a/pusher/sync.py +++ b/pusher/sync.py @@ -19,9 +19,6 @@ class SynchronousBackend(object): self.config = config self.timeout = timeout if config.ssl: - if sys.version_info < (3,4): - raise NotImplementedError("SSL requires python >= 3.4, earlier versions don't support certificate validation") - ctx = ssl.create_default_context() self.http = http_client.HTTPSConnection(self.config.host, self.config.port, timeout=self.timeout, context=ctx) else:
Remove artificial restriction on sync+SSL
pusher_pusher-http-python
train
py
b587107276e8ff548ab8f65cf504bb4906f2fd83
diff --git a/OpenSSL/test/test_crypto.py b/OpenSSL/test/test_crypto.py index <HASH>..<HASH> 100644 --- a/OpenSSL/test/test_crypto.py +++ b/OpenSSL/test/test_crypto.py @@ -2603,7 +2603,7 @@ class CRLTests(TestCase): def test_export_invalid(self): """ If :py:obj:`CRL.export` is used with an uninitialized :py:obj:`X509` - instance, :py:obj:`ValueError` is raised. + instance, :py:obj:`OpenSSL.crypto.Error` is raised. """ crl = CRL() self.assertRaises(Error, crl.export, X509(), PKey())
Fix an incorrect exception name in a test method docstring.
pyca_pyopenssl
train
py
4240cc0e6fb552d3ca91082fe3173cb26b273ac0
diff --git a/lib/svtplay_dl/service/dplay.py b/lib/svtplay_dl/service/dplay.py index <HASH>..<HASH> 100644 --- a/lib/svtplay_dl/service/dplay.py +++ b/lib/svtplay_dl/service/dplay.py @@ -17,7 +17,7 @@ from svtplay_dl.utils import filenamify from svtplay_dl.log import log class Dplay(Service): - supported_domains = ['dplay.se'] + supported_domains = ['dplay.se', 'dplay.dk', "it.dplay.com"] def get(self, options): data = self.get_urldata()
dplay: support for dplay.dk and it.dplay.com
spaam_svtplay-dl
train
py
14ce2dac2d9e45b71ed6152e2750b27d647e1a37
diff --git a/src/requirementslib/models/utils.py b/src/requirementslib/models/utils.py index <HASH>..<HASH> 100644 --- a/src/requirementslib/models/utils.py +++ b/src/requirementslib/models/utils.py @@ -120,7 +120,6 @@ def validate_vcs(instance, attr_, value): def validate_path(instance, attr_, value): - return True if not os.path.exists(value): raise ValueError("Invalid path {0!r}", format(value)) diff --git a/src/requirementslib/utils.py b/src/requirementslib/utils.py index <HASH>..<HASH> 100644 --- a/src/requirementslib/utils.py +++ b/src/requirementslib/utils.py @@ -64,7 +64,11 @@ def is_vcs(pipfile_entry): def get_converted_relative_path(path, relative_to=os.curdir): """Given a vague relative path, return the path relative to the given location""" - start = Path(relative_to).resolve() + start = Path(relative_to) + try: + start = start.resolve() + except OSError: + start = start.absolute() path = start.joinpath('.', path).relative_to(start) # Normalize these to use forward slashes even on windows if os.name == 'nt':
Fix a bug related to ramdisks and pathlib resolve
sarugaku_requirementslib
train
py,py
a3da3d7e3f6380331f20283b36d6e6b9780c874b
diff --git a/tests/CarbonPeriod/SettersTest.php b/tests/CarbonPeriod/SettersTest.php index <HASH>..<HASH> 100644 --- a/tests/CarbonPeriod/SettersTest.php +++ b/tests/CarbonPeriod/SettersTest.php @@ -460,13 +460,13 @@ class SettersTest extends AbstractTestCase $this->assertSame('2018-03-25 12:00 Europe/Oslo', $period->getEndDate()->format('Y-m-d H:i e')); $period = CarbonPeriod::create( - '2018-03-25 00:00 America/Toronto', + '2018-03-26 00:00 America/Toronto', 'PT1H', 5 )->shiftTimezone('Europe/Oslo'); - $this->assertSame('2018-03-25 00:00 Europe/Oslo', $period->getStartDate()->format('Y-m-d H:i e')); + $this->assertSame('2018-03-26 00:00 Europe/Oslo', $period->getStartDate()->format('Y-m-d H:i e')); $this->assertNull($period->getEndDate()); - $this->assertSame('2018-03-25 04:00 Europe/Oslo', $period->calculateEnd()->format('Y-m-d H:i e')); + $this->assertSame('2018-03-26 04:00 Europe/Oslo', $period->calculateEnd()->format('Y-m-d H:i e')); } }
Avoid DST as it change in PHP <I>
briannesbitt_Carbon
train
php
fceb2b9ed239b65eb52b61b2d0ae74280373901e
diff --git a/widgets/SimpleNav.php b/widgets/SimpleNav.php index <HASH>..<HASH> 100644 --- a/widgets/SimpleNav.php +++ b/widgets/SimpleNav.php @@ -66,7 +66,7 @@ class SimpleNav extends \yii\bootstrap\Widget Html::addCssClass($this->options, 'nav'); //activate parents if desired - if ($this->activateParents) { + if ($this->activateItems) { foreach ($this->items as &$item) { $this->activateItems($item); }
bugfix with using old varname in SimpleNav-widget
asinfotrack_yii2-toolbox
train
php
0c289fbe3a3c6626035b5f7d692684912a27b577
diff --git a/lib/Widget/Validator.php b/lib/Widget/Validator.php index <HASH>..<HASH> 100644 --- a/lib/Widget/Validator.php +++ b/lib/Widget/Validator.php @@ -9,6 +9,7 @@ namespace Widget; use Widget\Validator\AbstractValidator; +use Widget\Validator\ValidatorInterface; /** * Validator @@ -172,7 +173,7 @@ class Validator extends AbstractValidator */ if (is_string($rules)) { $rules = array($rules => true); - } elseif ($rules instanceof AbstractValidator) { + } elseif ($rules instanceof ValidatorInterface) { $rules = array($rules); } elseif (!is_array($rules)) { throw new UnexpectedTypeException($rules, 'array, string or instance of AbstractValidator');
used interface for instanceof instead of abstract class
twinh_wei
train
php
2b6f47fc4afae77d00d35e6089e8ea0ce1479a09
diff --git a/server/src/main/java/io/atomix/copycat/server/state/ServerSessionContext.java b/server/src/main/java/io/atomix/copycat/server/state/ServerSessionContext.java index <HASH>..<HASH> 100644 --- a/server/src/main/java/io/atomix/copycat/server/state/ServerSessionContext.java +++ b/server/src/main/java/io/atomix/copycat/server/state/ServerSessionContext.java @@ -640,7 +640,7 @@ class ServerSessionContext implements ServerSession { PublishRequest request = PublishRequest.builder() .withSession(id()) .withEventIndex(event.eventIndex) - .withPreviousIndex(event.previousIndex) + .withPreviousIndex(Math.max(event.previousIndex, completeIndex)) .withEvents(event.events) .build();
Ensure EventHolder previousIndex is >= completeIndex
atomix_copycat
train
java
a30f5a487eed1d6c2074191b689614e9169bb46c
diff --git a/php/test/test.php b/php/test/test.php index <HASH>..<HASH> 100644 --- a/php/test/test.php +++ b/php/test/test.php @@ -114,7 +114,7 @@ function test_trades($exchange, $symbol) { function test_symbol($exchange, $symbol) { test_ticker($exchange, $symbol); - if ('coinmarketcap' == $exchange->id) { + if ($exchange->id === 'coinmarketcap') { dump(var_export($exchange->fetchGlobal())); } else { test_order_book($exchange, $symbol); @@ -193,7 +193,7 @@ function test_exchange($exchange) { } } - if (false === strpos($symbol, '.d')) { + if (strpos($symbol, '.d') === false) { dump(green('SYMBOL:'), green($symbol)); test_symbol($exchange, $symbol);
test.php l-val ←→ r-val in `if` clauses
ccxt_ccxt
train
php
47741275269ea8bfd898287cf912924fa81e3de6
diff --git a/src/main/java/azkaban/utils/PropsUtils.java b/src/main/java/azkaban/utils/PropsUtils.java index <HASH>..<HASH> 100644 --- a/src/main/java/azkaban/utils/PropsUtils.java +++ b/src/main/java/azkaban/utils/PropsUtils.java @@ -269,7 +269,6 @@ public class PropsUtils { } String newValue = value.substring(0, lastIndex) + result.toString() + value.substring(nextClosed + 1); - System.out.println("Value " + newValue); return resolveVariableExpression(newValue, lastIndex, jexl); }
Removing errant Sys out statement
azkaban_azkaban
train
java
a5a41b2c6dbac98b79d6d160df1bafbd37147305
diff --git a/src/model/specials/GlobalModel.js b/src/model/specials/GlobalModel.js index <HASH>..<HASH> 100644 --- a/src/model/specials/GlobalModel.js +++ b/src/model/specials/GlobalModel.js @@ -10,6 +10,10 @@ class GlobalModel extends Model { this.adaptors = []; this.changes = {}; } + + getKeypath() { + return '@global'; + } } export default new GlobalModel(); diff --git a/src/model/specials/RactiveModel.js b/src/model/specials/RactiveModel.js index <HASH>..<HASH> 100644 --- a/src/model/specials/RactiveModel.js +++ b/src/model/specials/RactiveModel.js @@ -10,4 +10,8 @@ export default class RactiveModel extends Model { this.ractive = ractive; this.changes = {}; } + + getKeypath() { + return '@ractive'; + } }
return appropriate keypath for ractive and global special models
ractivejs_ractive
train
js,js
c78deb72c3fb37cf47d2e6e8ecb6706faf5dde92
diff --git a/lib/ore/versions/version_constant.rb b/lib/ore/versions/version_constant.rb index <HASH>..<HASH> 100644 --- a/lib/ore/versions/version_constant.rb +++ b/lib/ore/versions/version_constant.rb @@ -52,7 +52,9 @@ module Ore file.each_line do |line| unless line =~ /^\s*#/ # skip commented lines if line =~ /(VERSION|Version)\s*=\s*/ - return self.parse(extract_version(line)) + version = extract_version(line) + + return self.parse(version) if version elsif line =~ /(MAJOR|Major)\s*=\s*/ major ||= extract_number(line) elsif line =~ /(MINOR|Minor)\s*=\s*/
Be more careful when extracting version constants.
ruby-ore_ore
train
rb
56e21bbf7662d190027d2188afd802043ff4edaa
diff --git a/rest_registration/__init__.py b/rest_registration/__init__.py index <HASH>..<HASH> 100644 --- a/rest_registration/__init__.py +++ b/rest_registration/__init__.py @@ -1,2 +1,2 @@ -__version__ = "0.5.3" +__version__ = "0.5.4" default_app_config = 'rest_registration.apps.RestRegistrationConfig'
Version <I> Changes: * Re-enable Django <I> and DRF <I> support (issue #<I>) * Put the code for sending the register verification email in separate `send_register_verification_email_notification` (issue #<I>)
apragacz_django-rest-registration
train
py
b7d403f106d9339819b40618629f9de30d9f573d
diff --git a/src/ocrmypdf/leptonica.py b/src/ocrmypdf/leptonica.py index <HASH>..<HASH> 100644 --- a/src/ocrmypdf/leptonica.py +++ b/src/ocrmypdf/leptonica.py @@ -24,6 +24,7 @@ import argparse import sys import os import logging +import warnings from tempfile import TemporaryFile from ctypes.util import find_library from .lib._leptonica import ffi @@ -217,11 +218,12 @@ class Pix: return 'P' @classmethod - def open(cls, path): - return cls.read(path) + def read(cls, path): + warnings.warn('Use Pix.open() instead', DeprecationWarning) + return cls.open(path) @classmethod - def read(cls, path): + def open(cls, path): """Load an image file into a PIX object. Leptonica can load TIFF, PNM (PBM, PGM, PPM), PNG, and JPEG. If
Deprecate Pix.read() behaving as an open function
jbarlow83_OCRmyPDF
train
py
60ef7f679c113cfd8d62c89205f32f0ca0d90170
diff --git a/lib/rbgccxml/node_cache.rb b/lib/rbgccxml/node_cache.rb index <HASH>..<HASH> 100644 --- a/lib/rbgccxml/node_cache.rb +++ b/lib/rbgccxml/node_cache.rb @@ -29,11 +29,16 @@ module RbGCCXML @index_list[id] end + # Given an array of ids return an array of nodes that match + def find_by_ids(ids) + QueryResult.new(ids.map {|id| @index_list[id] }) + end + # Look through the DOM under +node+ for +type+ nodes. # +type+ must be the string name of an existing Node subclass. # # Returns a QueryResult with the findings. - def find_children_of_type(node, type, matcher) + def find_children_of_type(node, type, matcher = nil) results = QueryResult.new(self.select_nodes_of_type(node.children, type)) results = results.find(:name => matcher) if matcher results
Can find a set of nodes given a set of ids
jasonroelofs_rbgccxml
train
rb
96c43c842f2edde9c5dd9d9196052096bd34e7f4
diff --git a/src/Co.php b/src/Co.php index <HASH>..<HASH> 100644 --- a/src/Co.php +++ b/src/Co.php @@ -8,7 +8,6 @@ use Swoole\Coroutine; /** * Class Co * @since 2.0 - * @package Swoft */ class Co { @@ -59,11 +58,11 @@ class Co { $tid = self::tid(); - // return coroutine ID for created. + // Return coroutine ID on created. return \go(function () use ($callable, $tid) { try { $id = Coroutine::getCid(); - + // Storage fd self::$mapping[$id] = $tid; PhpHelper::call($callable); } catch (\Throwable $e) {
update some logic for ws server
swoft-cloud_swoft-framework
train
php
cbb0fee071e8eadf2a7aa399f6a2029ad39d49c7
diff --git a/user/index.php b/user/index.php index <HASH>..<HASH> 100644 --- a/user/index.php +++ b/user/index.php @@ -68,6 +68,9 @@ foreach ($students as $student) { print_user($student, $course, $string); } + } else if ($numstudents > $USER_HUGE_CLASS) { + print_heading(get_string("toomanytoshow")); + } else { // Print one big table with abbreviated info $columns = array("name", "city", "country", "lastaccess"); diff --git a/user/lib.php b/user/lib.php index <HASH>..<HASH> 100644 --- a/user/lib.php +++ b/user/lib.php @@ -2,6 +2,7 @@ $USER_SMALL_CLASS = 20; // Below this is considered small $USER_LARGE_CLASS = 200; // Above this is considered large +$USER_HUGE_CLASS = 500; // Above this is considered too many to display /// FUNCTIONS ///////////////////////////////////////////////////////////
For very large classes don't even try to show all the participants
moodle_moodle
train
php,php
db062010244913cebc4d53d90591265e11f0a4f7
diff --git a/alerta/app/webhooks/views.py b/alerta/app/webhooks/views.py index <HASH>..<HASH> 100644 --- a/alerta/app/webhooks/views.py +++ b/alerta/app/webhooks/views.py @@ -372,16 +372,19 @@ def parse_stackdriver(notification): try: alert = db.get_alerts(query={'attributes.incidentId': incident['incident_id']}, limit=1)[0] except IndexError: - raise + raise ValueError('unknown Stackdriver Incident ID: %s' % incident['incident_id']) return state, alert else: if state == 'open': severity = 'critical' + create_time = datetime.datetime.fromtimestamp(incident['started_at']) elif state == 'closed': severity = 'ok' + create_time = datetime.datetime.fromtimestamp(incident['ended_at']) else: severity = 'indeterminate' + create_time = None return state, Alert( resource=incident['resource_name'], @@ -398,7 +401,8 @@ def parse_stackdriver(notification): }, origin='Stackdriver', event_type='stackdriverAlert', - raw_data=notification, + create_time=create_time, + raw_data=notification )
Add create time and catch unknown incident IDs
alerta_alerta
train
py
060bfff47116218eccdba06a8eb2990093616d8a
diff --git a/Exedra/Application/Map/Convenient/Group.php b/Exedra/Application/Map/Convenient/Group.php index <HASH>..<HASH> 100644 --- a/Exedra/Application/Map/Convenient/Group.php +++ b/Exedra/Application/Map/Convenient/Group.php @@ -11,7 +11,9 @@ class Group extends \Exedra\Application\Map\Level */ public function add($method = null, $path = null, $params = null) { - $parameters = array('uri' => $path); + $parameters = array(); + + $parameters['uri'] = $path === null ? '' : $path; if($method) $parameters['method'] = $method; diff --git a/Exedra/Application/Map/Route.php b/Exedra/Application/Map/Route.php index <HASH>..<HASH> 100644 --- a/Exedra/Application/Map/Route.php +++ b/Exedra/Application/Map/Route.php @@ -303,7 +303,7 @@ class Route { $continue = true; - $routeURI = $this->getParameter('uri'); + $routeURI = ltrim($this->getParameter('uri'), '/'); if($routeURI === false) return false; @@ -537,6 +537,13 @@ class Route return isset($this->parameters['execute']); } + public function setName($name) + { + $this->name = $name; + + return $this; + } + public function setBase($baseRoute) { $this->setParameter('base', $baseRoute);
Convenient Routing : empty uri on passed default - and added setName on Map\Route for renaming capability - ltrim / from each uri on validation
Rosengate_exedra
train
php,php
d14e7a681f0a3e5b55007b4e6b0d46c3c55ef86d
diff --git a/i3ipc/aio/connection.py b/i3ipc/aio/connection.py index <HASH>..<HASH> 100644 --- a/i3ipc/aio/connection.py +++ b/i3ipc/aio/connection.py @@ -459,7 +459,16 @@ class Connection: assert magic == _MAGIC try: - message = await self._loop.sock_recv(self._cmd_socket, message_length) + message = b'' + remaining_length = message_length + while remaining_length: + buf = await self._loop.sock_recv(self._cmd_socket, remaining_length) + if not buf: + logger.error('premature ending while reading message (%s bytes remaining)', + remaining_length) + break + message += buf + remaining_length -= len(buf) except ConnectionError as e: if self._auto_reconnect: ensure_future(self._reconnect())
aio: Read all message_length bytes from message response `sock_recv` reads up to the specified amount of bytes, and can in some situations return less than the requested amount. Make sure we read all `message_length` bytes of the response before returning.
acrisci_i3ipc-python
train
py
da1d8e925f1ae80bfc6923e7745166292e2b71ae
diff --git a/Classes/Backend/LayoutSetup.php b/Classes/Backend/LayoutSetup.php index <HASH>..<HASH> 100644 --- a/Classes/Backend/LayoutSetup.php +++ b/Classes/Backend/LayoutSetup.php @@ -74,6 +74,10 @@ class LayoutSetup $this->setDatabaseConnection($GLOBALS['TYPO3_DB']); $this->setLanguageService($GLOBALS['LANG']); $pageId = (strpos($pageId, 'NEW') === 0) ? 0 : (int)$pageId; + if ($pageId < 0) { + $pidRecord = BackendUtility::getRecord('tt_content', abs($pageId), 'pid'); + $pageId = is_array($pidRecord) ? (int)$pidRecord['pid'] : 0; + } $this->loadLayoutSetup($pageId); foreach ($this->layoutSetup as $key => $setup) { $columns = $this->getLayoutColumns($key);
[BUGFIX] Get correct PID since negative IDs point to content records Change-Id: Ide<I>a<I>e4af<I>d<I>a<I>f<I>df<I> Resolves: #<I> Releases: master, 7-0 Reviewed-on: <URL>
TYPO3-extensions_gridelements
train
php
0f5b10aaa674f172248d91b5b273b1a05f8f7ce2
diff --git a/spec/RequestSpec.php b/spec/RequestSpec.php index <HASH>..<HASH> 100644 --- a/spec/RequestSpec.php +++ b/spec/RequestSpec.php @@ -87,6 +87,13 @@ class RequestSpec extends ObjectBehavior $request->getPaginationType()->shouldReturn(Request::CURSOR_PAGINATION); } + public function it_can_set_included_resources_returning_a_new_request_object() + { + $request = $this->withIncludedResources('resources'); + $request->shouldHaveType(Request::class); + $request->getIncludedResources()->shouldReturn('resources'); + } + public function it_returns_empty_array_when_no_offset_limit_is_set() { $this->getOffsetLimit()->shouldReturn([]); diff --git a/src/Request.php b/src/Request.php index <HASH>..<HASH> 100644 --- a/src/Request.php +++ b/src/Request.php @@ -337,4 +337,12 @@ class Request extends ServerRequest { return $this->afterCursor; } + + public function withIncludedResources($includedResources) + { + $new = clone $this; + $new->includedResources = $includedResources; + + return $new; + } }
Add ability to set included resources immutably
refinery29_piston
train
php,php
98112815b50f167eccf51507e10785c8cd2f83bf
diff --git a/lib/commands/travis-visual-acceptance.js b/lib/commands/travis-visual-acceptance.js index <HASH>..<HASH> 100644 --- a/lib/commands/travis-visual-acceptance.js +++ b/lib/commands/travis-visual-acceptance.js @@ -101,13 +101,11 @@ module.exports = { var prNumber = process.env.TRAVIS_PULL_REQUEST - if (prNumber !== false && prNumber !== 'false' && process.env.VISUAL_ACCEPTANCE_TOKEN) { + if (prNumber !== false && prNumber !== 'false' && process.env.VISUAL_ACCEPTANCE_TOKEN && options.msgOn === options.msgVar) { return runCommand(this, 'br').then(buildReport, function (params) { - if (options.msgOn === options.msgVar) { - return buildReport(params).then(function (params) { - throw new Error('Exit 1') - }) - } + return buildReport(params).then(function (params) { + throw new Error('Exit 1') + }) }) } else if (prNumber === false || prNumber === 'false') { return runCommand(this, 'new-baseline', [
Wrap the creation of the repo with condition
ciena-blueplanet_ember-cli-visual-acceptance
train
js
cc00443c0be478ca535d64ee9f24344e11ed5a37
diff --git a/Testing/Fakes/EventFake.php b/Testing/Fakes/EventFake.php index <HASH>..<HASH> 100644 --- a/Testing/Fakes/EventFake.php +++ b/Testing/Fakes/EventFake.php @@ -135,7 +135,7 @@ class EventFake implements Dispatcher */ public function listen($events, $listener) { - // + $this->dispatcher->listen($events, $listener); } /** @@ -146,7 +146,7 @@ class EventFake implements Dispatcher */ public function hasListeners($eventName) { - // + return $this->dispatcher->hasListeners($eventName); } /** @@ -169,7 +169,7 @@ class EventFake implements Dispatcher */ public function subscribe($subscriber) { - // + $this->dispatcher->subscribe($subscriber); } /**
Non faked events should be properly dispatched (#<I>)
illuminate_support
train
php
98905f2240308f8e7c30a2ced5d1d9a068cf6015
diff --git a/lib/flapjack/utility.rb b/lib/flapjack/utility.rb index <HASH>..<HASH> 100644 --- a/lib/flapjack/utility.rb +++ b/lib/flapjack/utility.rb @@ -7,10 +7,10 @@ module Flapjack period_mm, period_ss = period.divmod(60) period_hh, period_mm = period_mm.divmod(60) period_dd, period_hh = period_hh.divmod(24) - ["#{period_dd} days", - "#{period_hh} hours", - "#{period_mm} minutes", - "#{period_ss} seconds"].reject {|s| s =~ /^0 /}.join(', ') + ["#{period_dd} day#{plural_s(period_dd)}", + "#{period_hh} hour#{plural_s(period_hh)}", + "#{period_mm} minute#{plural_s(period_mm)}", + "#{period_ss} second#{plural_s(period_ss)}"].reject {|s| s =~ /^0 /}.join(', ') end # Returns relative time in words referencing the given date @@ -68,5 +68,11 @@ module Flapjack Hash[ *( key_value_pairs.flatten(1) )] end + private + + def plural_s(value) + (value == 1) ? '' : 's' + end + end end
don't pluralise singular time periods
flapjack_flapjack
train
rb
b06aa6018c2ce836ab019d2b9f0c03913e9f67ee
diff --git a/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php b/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php index <HASH>..<HASH> 100644 --- a/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php +++ b/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php @@ -61,6 +61,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderProxy implements Swift_Mime_Cont public function charsetChanged($charset) { $this->charset = $charset; + $this->safeEncoder->charsetChanged($charset); } /**
Pass charsetChanged() call to the safeEncoder
swiftmailer_swiftmailer
train
php
81cab8a7bb86ce3e7d8d00f601db692ed01f7606
diff --git a/server/src/main/java/io/druid/query/lookup/LookupModule.java b/server/src/main/java/io/druid/query/lookup/LookupModule.java index <HASH>..<HASH> 100644 --- a/server/src/main/java/io/druid/query/lookup/LookupModule.java +++ b/server/src/main/java/io/druid/query/lookup/LookupModule.java @@ -118,7 +118,8 @@ class LookupListeningResource extends ListenerResource for (final String name : lookups.keySet()) { final LookupExtractorFactory factory = lookups.get(name); try { - if (!manager.updateIfNew(name, factory)) { + // Only fail if it should have updated but didn't. + if (!manager.updateIfNew(name, factory) && factory.replaces(manager.get(name))) { failedUpdates.put(name, factory); } }
Make lookups more idempotent on update requests. (#<I>) * No longer fails if an update fails but it shouldn't have replaced it
apache_incubator-druid
train
java
806e1aaea92bf86518a70fbc9a4eb081e78c60d2
diff --git a/build/populate.js b/build/populate.js index <HASH>..<HASH> 100644 --- a/build/populate.js +++ b/build/populate.js @@ -26,7 +26,9 @@ var populateBin = function (ownerBin, done) { if (err) return done(err); ownerBin.summary = utils.titleForBin(sandboxBin); - ownerBin.date = ownerBin.last_updated; + + if (!ownerBin.last_updated || isNaN(ownerBin.last_updated.getTime())) ownerBin.date = new Date('2012-07-23 00:00:00'); + store.touchOwnership(ownerBin, done); }); };
Fixed Tom's code. Duh
jsbin_jsbin
train
js
608984b244fc566c5179cd12a5d23a149cce94ae
diff --git a/mlbgame/game.py b/mlbgame/game.py index <HASH>..<HASH> 100644 --- a/mlbgame/game.py +++ b/mlbgame/game.py @@ -252,4 +252,35 @@ def get_stats(game_id): elif not home: away_batting.append(stats) output = {'home_pitching':home_pitching, 'away_pitching':away_pitching, 'home_batting':home_batting, 'away_batting':away_batting} - return output \ No newline at end of file + return output + +class GameStats(): + ''' + Holds stat object for all players in a game + ''' + pass + +class PitcherStats(object): + ''' + Holds stats information for a pitcher + ''' + def __init__(self, data): + ''' + Creates a pitcher object that matches the corresponding stats in `data` + + `data` should be a dictionary for a single pitcher that comes from `get_stats()` + ''' + for x in data: + try: + setattr(self, x, int(data[x])) + except ValueError: + setattr(self, x, data[x]) + + def nice_output(self): + ''' + Prints basic player stats in a nice way + ''' + return "%s - %i Earned Runs, %i Strikouts, %i Hits" % (self.name, self.er, self.so, self.h) + + def __str__(self): + return self.nice_output() \ No newline at end of file
Better printing and store numbers as ints
panzarino_mlbgame
train
py
8372df83c626388fb6a2064b53aafdfd16dab5ca
diff --git a/indra/preassembler/grounding_mapper.py b/indra/preassembler/grounding_mapper.py index <HASH>..<HASH> 100644 --- a/indra/preassembler/grounding_mapper.py +++ b/indra/preassembler/grounding_mapper.py @@ -53,7 +53,7 @@ class GroundingMapper(object): up_id = map_db_refs.get('UP') hgnc_sym = map_db_refs.get('HGNC') if up_id and not hgnc_sym: - gene_name = uniprot_client.get_gene_name(up_id) + gene_name = uniprot_client.get_gene_name(up_id, False) if gene_name: hgnc_id = hgnc_client.get_hgnc_id(gene_name) if hgnc_id:
Don't force web fallback for gene name lookup
sorgerlab_indra
train
py
241fd0824d41b3b48c0669fafc1ab9c64d0bc643
diff --git a/src/main/java/com/samskivert/net/MailUtil.java b/src/main/java/com/samskivert/net/MailUtil.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/samskivert/net/MailUtil.java +++ b/src/main/java/com/samskivert/net/MailUtil.java @@ -136,7 +136,7 @@ public class MailUtil } message.saveChanges(); Address[] recips = message.getAllRecipients(); - if (recips.length == 0) { + if (recips == null || recips.length == 0) { log.info("Not sending mail to zero recipients", "subject", subject, "message", message); return;
Protect from stupid null usage by javax.mail. If you add no addresses to a message, getting the recipient array returns null rather than an empty array. So fucking dumb.
samskivert_samskivert
train
java
4eb31a87de85d4e0725efbe50631c8a09841d48e
diff --git a/spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb b/spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb index <HASH>..<HASH> 100644 --- a/spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb +++ b/spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb @@ -156,6 +156,21 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do end context "helper_method" do + it "should remove unused methods when helper method is not called" do + content = <<-EOF + class PostsController < ApplicationController + helper_method :helper_post + protected + def helper_post; end + end + EOF + runner.prepare('app/controllers/posts_controller.rb', content) + runner.review('app/controllers/posts_controller.rb', content) + runner.on_complete + runner.should have(1).errors + runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:4 - remove unused methods (PostsController#helper_post)" + end + it "should not remove unused methods when call helper method in views" do content = <<-EOF class PostsController < ApplicationController
remove unused method in controllers if it is a helper method but not called
flyerhzm_rails_best_practices
train
rb
41bc87ba9b62b14b5149db27fd91e41cae408317
diff --git a/b2handle/tests/main_test_script.py b/b2handle/tests/main_test_script.py index <HASH>..<HASH> 100644 --- a/b2handle/tests/main_test_script.py +++ b/b2handle/tests/main_test_script.py @@ -90,9 +90,9 @@ if __name__ == '__main__': numtests += n print 'Number of tests for client (no access required):\t\t\t\t'+str(n) - noaccess = unittest.TestLoader().loadTestsFromTestCase(EUDATHandleConnectorNoaccessTestCase) - tests_to_run.append(noaccess) - n = noaccess.countTestCases() + noaccess_connector = unittest.TestLoader().loadTestsFromTestCase(EUDATHandleConnectorNoaccessTestCase) + tests_to_run.append(noaccess_connector) + n = noaccess_connector.countTestCases() numtests += n print 'Number of tests for handle system connector (no access required):\t\t\t\t'+str(n)
Bugfix: Changed name of test file.
EUDAT-B2SAFE_B2HANDLE
train
py
c581f56372ea15cc9db13fa761482e00b23a505d
diff --git a/src/loader/loader.js b/src/loader/loader.js index <HASH>..<HASH> 100644 --- a/src/loader/loader.js +++ b/src/loader/loader.js @@ -195,7 +195,7 @@ var httpReq = new XMLHttpRequest(); // load our file - httpReq.open("GET", data.src + obj.nocache, false); + httpReq.open("GET", data.src + obj.nocache, true); httpReq.responseType = "arraybuffer"; httpReq.onerror = onerror; httpReq.onload = function(event){ @@ -203,11 +203,10 @@ if (arrayBuffer) { var byteArray = new Uint8Array(arrayBuffer); var buffer = []; - binList[data.name] = new dataType(); for (var i = 0; i < byteArray.byteLength; i++) { buffer[i] = String.fromCharCode(byteArray[i]); } - binList[data.name].data = buffer.join(""); + binList[data.name] = buffer.join(""); // callback onload(); }
set binary load to async, and removed the usage of dataType
melonjs_melonJS
train
js
e906cab27f1850de152f9d722f26aa44b7f1c6f4
diff --git a/core/common/src/main/java/alluxio/RuntimeConstants.java b/core/common/src/main/java/alluxio/RuntimeConstants.java index <HASH>..<HASH> 100644 --- a/core/common/src/main/java/alluxio/RuntimeConstants.java +++ b/core/common/src/main/java/alluxio/RuntimeConstants.java @@ -19,11 +19,12 @@ import javax.annotation.concurrent.ThreadSafe; @ThreadSafe public final class RuntimeConstants { static { - VERSION = Configuration.get(PropertyKey.VERSION); - if (Configuration.get(PropertyKey.VERSION).endsWith("SNAPSHOT")) { + String version = Configuration.get(PropertyKey.VERSION); + VERSION = version; + if (version.endsWith("SNAPSHOT")) { ALLUXIO_DOCS_URL = "http://www.alluxio.org/docs/master"; } else { - String[] majorMinor = Configuration.get(PropertyKey.VERSION).split("\\."); + String[] majorMinor = version.split("\\."); ALLUXIO_DOCS_URL = String.format( "http://www.alluxio.org/docs/%s.%s", majorMinor[0], majorMinor[1]); }
Do not get the same property value repeatedly in the same block.
Alluxio_alluxio
train
java
6c70ef8293b6c56164fcd2e3136d99b0d1b6e926
diff --git a/CachedImage.js b/CachedImage.js index <HASH>..<HASH> 100644 --- a/CachedImage.js +++ b/CachedImage.js @@ -87,7 +87,7 @@ const CachedImage = React.createClass({ componentWillMount() { this._isMounted = true; - NetInfo.isConnected.addEventListener('change', this.handleConnectivityChange); + NetInfo.isConnected.addEventListener('connectionChange', this.handleConnectivityChange); // initial NetInfo.isConnected.fetch() .then(isConnected => { @@ -101,7 +101,7 @@ const CachedImage = React.createClass({ componentWillUnmount() { this._isMounted = false; - NetInfo.isConnected.removeEventListener('change', this.handleConnectivityChange); + NetInfo.isConnected.removeEventListener('connectionChange', this.handleConnectivityChange); }, componentWillReceiveProps(nextProps) {
Listen NetInfo connectionChange event (change deprecated)
kfiroo_react-native-cached-image
train
js
b9dfb02e04a5d06132c28224c9beacfafe88686e
diff --git a/pysat/constellations/single_test.py b/pysat/constellations/single_test.py index <HASH>..<HASH> 100644 --- a/pysat/constellations/single_test.py +++ b/pysat/constellations/single_test.py @@ -1,5 +1,11 @@ """ Create a constellation with one testing instrument + +Attributes +---------- +instruments : list + List of pysat.Instrument objects + """ import pysat diff --git a/pysat/constellations/testing.py b/pysat/constellations/testing.py index <HASH>..<HASH> 100644 --- a/pysat/constellations/testing.py +++ b/pysat/constellations/testing.py @@ -1,5 +1,11 @@ """ Creates a constellation with 5 testing instruments + +Attributes +---------- +instruments : list + List of pysat.Instrument objects + """ import pysat diff --git a/pysat/constellations/testing_empty.py b/pysat/constellations/testing_empty.py index <HASH>..<HASH> 100644 --- a/pysat/constellations/testing_empty.py +++ b/pysat/constellations/testing_empty.py @@ -1,5 +1,11 @@ """ Creates an empty constellation for testing + +Attributes +---------- +instruments : list + List of pysat.Instrument objects + """ instruments = []
DOC: updated docstrings Updated constellation testing docstrings.
rstoneback_pysat
train
py,py,py
47a7aaccd89d5ec5a2bbee8ac6895cddd7a079f1
diff --git a/bucky/statsd.py b/bucky/statsd.py index <HASH>..<HASH> 100644 --- a/bucky/statsd.py +++ b/bucky/statsd.py @@ -91,7 +91,6 @@ class StatsDHandler(threading.Thread): for k, v in self.gauges.iteritems(): stat = "stats.gauges.%s" % k self.enqueue(stat, v, stime) - self.gauges[k] = 0 ret += 1 return ret
Gauges are constant until overwritten, and not reset at flush time.
trbs_bucky
train
py
3292cee318bc28bb828b734c0a893caf16e4695b
diff --git a/test/matcher.js b/test/matcher.js index <HASH>..<HASH> 100644 --- a/test/matcher.js +++ b/test/matcher.js @@ -16,6 +16,10 @@ class EventMatcher { return this.fixture.watch(...args, (err, events) => { this.errors.push(err) this.events.push(...events) + + if (process.env.VERBOSE) { + console.log(events) + } }) }
When VERBOSE is set, dump the received events
atom_watcher
train
js
9934587af234f780041cd03ba1b35381b9ce0574
diff --git a/aws/resource_aws_rds_cluster.go b/aws/resource_aws_rds_cluster.go index <HASH>..<HASH> 100644 --- a/aws/resource_aws_rds_cluster.go +++ b/aws/resource_aws_rds_cluster.go @@ -353,7 +353,6 @@ func resourceAwsRDSCluster() *schema.Resource { Type: schema.TypeInt, Optional: true, Computed: true, - ForceNew: true, }, // apply_immediately is used to determine when the update modifications @@ -1154,6 +1153,11 @@ func resourceAwsRDSClusterUpdate(d *schema.ResourceData, meta interface{}) error requestUpdate = true } + if d.HasChange("port") { + req.Port = aws.Int64(int64(d.Get("port").(int))) + requestUpdate = true + } + if d.HasChange("preferred_backup_window") { req.PreferredBackupWindow = aws.String(d.Get("preferred_backup_window").(string)) requestUpdate = true
Changes RDS cluster port change to in-place modify.
terraform-providers_terraform-provider-aws
train
go
283440844727bcadb6c155f967526f928f064e4a
diff --git a/pymacaron/__init__.py b/pymacaron/__init__.py index <HASH>..<HASH> 100644 --- a/pymacaron/__init__.py +++ b/pymacaron/__init__.py @@ -221,7 +221,8 @@ class API(object): serve.append('ping') # Add ping hooks if any - add_ping_hook(self.ping_hook) + if self.ping_hook: + add_ping_hook(self.ping_hook) # Let's compress returned data when possible compress = Compress()
Bugfix: ping hook may be None
pymacaron_pymacaron
train
py
0b657e74c6b2dd25c1aab66d5b709b799cadeb3e
diff --git a/tensorflow_datasets/image/imagenet.py b/tensorflow_datasets/image/imagenet.py index <HASH>..<HASH> 100644 --- a/tensorflow_datasets/image/imagenet.py +++ b/tensorflow_datasets/image/imagenet.py @@ -35,6 +35,9 @@ ImageNet, we aim to provide on average 1000 images to illustrate each synset. Images of each concept are quality-controlled and human-annotated. In its completion, we hope ImageNet will offer tens of millions of cleanly sorted images for most of the concepts in the WordNet hierarchy. + +Note that labels were never publicly released for the test set, so we only +include splits for the training and validation sets here. ''' # Web-site is asking to cite paper from 2015. @@ -145,6 +148,8 @@ class Imagenet2012(tfds.core.GeneratorBasedBuilder): train_path, val_path = dl_manager.download([ '%s/ILSVRC2012_img_train.tar' % _URL_PREFIX, '%s/ILSVRC2012_img_val.tar' % _URL_PREFIX, + # We don't import the original test split, as it doesn't include labels. + # These were never publicly released. ]) if not tf.io.gfile.exists(train_path) or not tf.io.gfile.exists(val_path): msg = 'You must download the dataset files manually and place them in: '
Document why the imagenet test set is not available in Imagenet<I>. PiperOrigin-RevId: <I>
tensorflow_datasets
train
py
313fe585ee19e8f4277279ad62075a285c4dc56e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,14 @@ setup( ], keywords='cli', packages=find_packages(exclude=['docs', 'tests*']), - install_requires=['docopt'], + install_requires=['docopt', + 'numpy', + 'astropy', + 'scipy', + 'GetDist', + 'pymultinest', + 'sklearn', + ], extras_require={ 'test': ['coverage', 'pytest', 'pytest-cov'], },
added install_requires to setup
Jammy2211_PyAutoLens
train
py
f176790ed85c7ea2a4a73c94fee580d756935ca4
diff --git a/src/Ratchet/WebSocket/Version/RFC6455.php b/src/Ratchet/WebSocket/Version/RFC6455.php index <HASH>..<HASH> 100644 --- a/src/Ratchet/WebSocket/Version/RFC6455.php +++ b/src/Ratchet/WebSocket/Version/RFC6455.php @@ -146,6 +146,10 @@ class RFC6455 implements VersionInterface { $parsed = $from->WebSocket->message->getPayload(); unset($from->WebSocket->message); + if (!mb_check_encoding($parsed, 'UTF-8')) { + return $from->close(Frame::CLOSE_BAD_PAYLOAD); + } + $from->WebSocket->coalescedCallback->onMessage($from, $parsed); }
[WebSocket] RFC compliance Close connection if payload is not UTF-8 Fixed several AB 6.* tests Refs #<I>
ratchetphp_Ratchet
train
php
819d8f9fd0c98c7096358006b8afbbcb20f6def1
diff --git a/lib/timezone/lookup/geonames.rb b/lib/timezone/lookup/geonames.rb index <HASH>..<HASH> 100644 --- a/lib/timezone/lookup/geonames.rb +++ b/lib/timezone/lookup/geonames.rb @@ -40,7 +40,8 @@ module Timezone query = URI.encode_www_form( 'lat' => lat, 'lng' => long, - 'username' => config.username) + 'username' => config.username + ) "/timezoneJSON?#{query}" end end diff --git a/lib/timezone/lookup/google.rb b/lib/timezone/lookup/google.rb index <HASH>..<HASH> 100644 --- a/lib/timezone/lookup/google.rb +++ b/lib/timezone/lookup/google.rb @@ -64,7 +64,8 @@ module Timezone def url(lat, long) query = URI.encode_www_form( 'location' => "#{lat},#{long}", - 'timestamp' => Time.now.to_i) + 'timestamp' => Time.now.to_i + ) authorize("/maps/api/timezone/json?#{query}") end
Fix RuboCop Exceptions New version of RuboCop required adjusting two methods calls.
panthomakos_timezone
train
rb,rb
12e969119aff23e17068fa36f6a83d8655ced81e
diff --git a/src/extensions/scratch3_boost/index.js b/src/extensions/scratch3_boost/index.js index <HASH>..<HASH> 100644 --- a/src/extensions/scratch3_boost/index.js +++ b/src/extensions/scratch3_boost/index.js @@ -1696,7 +1696,7 @@ class Scratch3BoostBlocks { const motor = this._peripheral.motor(portID); if (motor) { // to avoid a hanging block if power is 0, return an immediately resolving promise. - if (motor.power === 0) return new Promise(resolve => resolve()); + if (motor.power === 0) return Promise.resolve(); return new Promise(resolve => { motor.turnOnForDegrees(degrees, sign); motor.pendingPromiseFunction = resolve;
Simplified the return value for when power is 0 in motorOnForRotation()
LLK_scratch-vm
train
js
005bf8e65affe263492753742f02c58f36670205
diff --git a/cookies.py b/cookies.py index <HASH>..<HASH> 100644 --- a/cookies.py +++ b/cookies.py @@ -721,20 +721,24 @@ class Cookie(object): The main difference between this and Cookie(name, value, **kwargs) is that the values in the argument to this method are parsed. + + If ignore_bad_attributes=True (default), values which did not parse + are set to '' in order to avoid passing bad data. """ def parse(key): value = cookie_dict.get(key) parser = cls.attribute_parsers.get(key) if parser: try: - value = parser(value) + parsed_value = parser(value) except Exception as e: reason = "did not parse with %s: %s" % (repr(parser), repr(e)) if not ignore_bad_attributes: raise InvalidCookieAttributeError( key, value, reason) _report_invalid_attribute(key, value, reason) - return value + parsed_value = '' + return parsed_value name, value = parse('name'), parse('value') cookie = Cookie(name, value)
fix: don't pass unparsed value strings as-is!
sashahart_cookies
train
py
43aed989ace1495fc4a3902c0f24e6716e659e5a
diff --git a/consensus/wal.go b/consensus/wal.go index <HASH>..<HASH> 100644 --- a/consensus/wal.go +++ b/consensus/wal.go @@ -20,7 +20,10 @@ import ( const ( // amino overhead + time.Time + max consensus msg size - // TODO: Can we clarify better where 24 comes from precisely? + // + // q: where 24 bytes are coming from? + // a: cdc.MustMarshalBinaryBare(empty consensus part msg) = 14 bytes. +10 + // bytes just in case amino will require more space in the future. maxMsgSizeBytes = maxMsgSize + 24 // how often the WAL should be sync'd during period sync'ing
cs: clarify where <I> comes from in maxMsgSizeBytes (wal.go)
tendermint_tendermint
train
go
e19b8a052a8370d6ce75eb61ff5f05aa84c6f2af
diff --git a/tests/Laravel7ExceptionHandler.php b/tests/Laravel7ExceptionHandler.php index <HASH>..<HASH> 100644 --- a/tests/Laravel7ExceptionHandler.php +++ b/tests/Laravel7ExceptionHandler.php @@ -19,7 +19,7 @@ class Laravel7ExceptionHandler implements ExceptionHandler public function renderForConsole($output, Throwable $e) { - // + throw $e; } public function shouldReport(Throwable $e) diff --git a/tests/PreLaravel7ExceptionHandler.php b/tests/PreLaravel7ExceptionHandler.php index <HASH>..<HASH> 100644 --- a/tests/PreLaravel7ExceptionHandler.php +++ b/tests/PreLaravel7ExceptionHandler.php @@ -19,7 +19,7 @@ class PreLaravel7ExceptionHandler implements ExceptionHandler public function renderForConsole($output, Exception $e) { - // + throw $e; } public function shouldReport(Exception $e)
Surface exceptions when mixing tests and benchmarks (#<I>)
nuwave_lighthouse
train
php,php
42a160cdd9c3089225afbfeac23480981a425faf
diff --git a/tags/constructor.js b/tags/constructor.js index <HASH>..<HASH> 100644 --- a/tags/constructor.js +++ b/tags/constructor.js @@ -4,8 +4,10 @@ steal.then(function() { * @tag documentation * @parent DocumentJS.Tags * Documents javascript constructor classes typically created like: new MyContructor(args). + * * A constructor can be described by putting @constructor as the first declaritive. - * To describe the construction function, write that after init. Example: + * + * ###Example: * * @codestart * /* @constructor
Cleaned up contructor tag documentation.
bitovi_documentjs
train
js
b83863a4df1ce1a2f2d265c316c5a64816020ae2
diff --git a/src/FormHandler.php b/src/FormHandler.php index <HASH>..<HASH> 100644 --- a/src/FormHandler.php +++ b/src/FormHandler.php @@ -766,6 +766,22 @@ class FormHandler } /** + * Add a custom error to the form + * + * @param $param + * @param $message + * @param bool|false $translate + * @param array $translationParams + */ + public function addCustomError($param, $message, $translate = false, $translationParams = array()) + { + $this->errors[] = new FormError($param, $message, $translate, $translationParams); + + // Call isValid to update valid status in restore data handlers + $this->isValid(); + } + + /** * Add custom errors to the form. Must be an array of FormError objects * * @param $errors FormError[]
Add method to the form handler for quickly adding a single custom error
andyvenus_form
train
php
07fc230a8c3e78d0735dccdc918f4e321bfbd499
diff --git a/src/model/User/UserData.php b/src/model/User/UserData.php index <HASH>..<HASH> 100644 --- a/src/model/User/UserData.php +++ b/src/model/User/UserData.php @@ -36,12 +36,6 @@ class UserData } $this->userDataStorage->multiStore($tokensString, Json::encode($userDataContent)); } - - public function refreshUserToken($userId, $token) - { - $userDataContent = $this->userDataRegistrator->generate($userId); - $this->userDataStorage->store($token, Json::encode($userDataContent)); - } public function getUserToken($token) {
Sales funnel related changes to access_token usage - Creation of new user within sales funnel does not create new access token. It was never used as sales funnel never actually logs user in before the payment is confirmed. - `ReturnPresenter` now always refreshes all user payment user tokens to contain fresh info about latest subscriptions. remp<I>/crm-payments-module#<I>
remp2020_crm-users-module
train
php
290466ef1a45d5e9ba9abc22540bb96469bb89b2
diff --git a/Source/com/drew/metadata/exif/ExifTiffHandler.java b/Source/com/drew/metadata/exif/ExifTiffHandler.java index <HASH>..<HASH> 100644 --- a/Source/com/drew/metadata/exif/ExifTiffHandler.java +++ b/Source/com/drew/metadata/exif/ExifTiffHandler.java @@ -84,6 +84,11 @@ public class ExifTiffHandler extends DirectoryTiffHandler pushDirectory(ExifThumbnailDirectory.class); return true; } + + // The Canon EOS 7D (CR2) has three chained/following thumbnail IFDs + if (_currentDirectory instanceof ExifThumbnailDirectory) + return true; + // This should not happen, as Exif doesn't use follower IFDs apart from that above. // NOTE have seen the CanonMakernoteDirectory IFD have a follower pointer, but it points to invalid data. return false;
Fix regression in Canon EOS 7D (CR2) where 3 thumbnail IFDs are chained.
drewnoakes_metadata-extractor
train
java
2d5864d3c1d790e627aa1a735625fd77c3f1b39a
diff --git a/src/Krystal/Application/View/PluginBag.php b/src/Krystal/Application/View/PluginBag.php index <HASH>..<HASH> 100644 --- a/src/Krystal/Application/View/PluginBag.php +++ b/src/Krystal/Application/View/PluginBag.php @@ -42,7 +42,10 @@ final class PluginBag implements PluginBagInterface */ private function normalizeAssetPath($path) { - return preg_replace('~@(\w+)~', '/module/$1/Assets', $path); + $pattern = '~@(\w+)~'; + $replacement = sprintf('/%s/$1/%s', ViewManager::TEMPLATE_PARAM_MODULES_DIR, ViewManager::TEMPLATE_PARAM_ASSETS_DIR); + + return preg_replace($pattern, $replacement, $path); } /**
Replaced hard-coded paths with constants
krystal-framework_krystal.framework
train
php
22cd6bbecbd0d6a644448473db1145cb6d238aae
diff --git a/tests/Unit/Suites/KeyValue/KeyValueStoreKeyGeneratorTest.php b/tests/Unit/Suites/KeyValue/KeyValueStoreKeyGeneratorTest.php index <HASH>..<HASH> 100644 --- a/tests/Unit/Suites/KeyValue/KeyValueStoreKeyGeneratorTest.php +++ b/tests/Unit/Suites/KeyValue/KeyValueStoreKeyGeneratorTest.php @@ -79,7 +79,8 @@ class KeyValueStoreKeyGeneratorTest extends \PHPUnit_Framework_TestCase $url = HttpUrl::fromString('http://example.com/path'); $key = $this->keyGenerator->createPoCProductSeoUrlToIdKey($url); - $this->assertNotContains(DIRECTORY_SEPARATOR, $key); + $this->assertNotContains('/', $key); + $this->assertNotContains('\\', $key); } /**
Issue #<I>: Test key/value keys against both forward and backslashes
lizards-and-pumpkins_catalog
train
php
01da164bfed209bc95a1ebd7b0e16aa2b9dfb01d
diff --git a/lib/workflow_kit/version.rb b/lib/workflow_kit/version.rb index <HASH>..<HASH> 100644 --- a/lib/workflow_kit/version.rb +++ b/lib/workflow_kit/version.rb @@ -1,3 +1,3 @@ module WorkflowKit - VERSION = "0.0.3.alpha" + VERSION = "0.0.4.alpha" end
bump to <I>.alpha
fiedl_workflow_kit
train
rb
0afc478224999dd58d8a9ca18ac59a4a88e68e52
diff --git a/plugins/TestRunner/Commands/TestsSetupFixture.php b/plugins/TestRunner/Commands/TestsSetupFixture.php index <HASH>..<HASH> 100644 --- a/plugins/TestRunner/Commands/TestsSetupFixture.php +++ b/plugins/TestRunner/Commands/TestsSetupFixture.php @@ -124,7 +124,6 @@ class TestsSetupFixture extends ConsoleCommand // perform setup and/or teardown if ($input->getOption('teardown')) { - exit; $fixture->getTestEnvironment()->save(); $fixture->performTearDown(); } else {
Remove exit; in TestsSetupFixture.php. Wonder how that got there...
matomo-org_matomo
train
php
7d46bdfffae15b7fa0a90aecbf90832df449f757
diff --git a/devices.js b/devices.js index <HASH>..<HASH> 100755 --- a/devices.js +++ b/devices.js @@ -14843,6 +14843,15 @@ const devices = [ }, exposes: [e.power(), e.current(), e.voltage(), e.switch()], }, + + // Prolight + { + zigbeeModel: ['PROLIGHT E27 WHITE AND COLOUR'], + model: '5412748727388', + vendor: 'Prolight', + description: 'E27 white and colour bulb', + extend: preset.light_onoff_brightness_colortemp_colorxy, + }, ]; module.exports = devices.map((device) => {
Added support for Prolight E<I> RGB <I> (#<I>) * Added support for Prolight E<I> RGB * Update devices.js
Koenkk_zigbee-shepherd-converters
train
js
39576c8db56e0bbb66b3e7307400f63ace12d383
diff --git a/packages/react-dnd-html5-backend/src/HTML5Backend.js b/packages/react-dnd-html5-backend/src/HTML5Backend.js index <HASH>..<HASH> 100644 --- a/packages/react-dnd-html5-backend/src/HTML5Backend.js +++ b/packages/react-dnd-html5-backend/src/HTML5Backend.js @@ -19,6 +19,15 @@ export default class HTML5Backend { this.sourceNodeOptions = {}; this.enterLeaveCounter = new EnterLeaveCounter(); + this.dragStartSourceIds = []; + this.dropTargetIds = []; + this.dragEnterTargetIds = []; + this.currentNativeSource = null; + this.currentNativeHandle = null; + this.currentDragSourceNode = null; + this.currentDragSourceNodeOffset = null; + this.currentDragSourceNodeOffsetChanged = false; + this.getSourceClientOffset = this.getSourceClientOffset.bind(this); this.handleTopDragStart = this.handleTopDragStart.bind(this); this.handleTopDragStartCapture = this.handleTopDragStartCapture.bind(this);
Initializing class state in the Backend Constructor (#<I>)
react-dnd_react-dnd
train
js
a58fd9710d1e82adeff8f96bd8d3b91e859575d4
diff --git a/question/behaviour/rendererbase.php b/question/behaviour/rendererbase.php index <HASH>..<HASH> 100644 --- a/question/behaviour/rendererbase.php +++ b/question/behaviour/rendererbase.php @@ -234,7 +234,7 @@ abstract class qbehaviour_renderer extends plugin_renderer_base { 'id' => $qa->get_behaviour_field_name('submit'), 'name' => $qa->get_behaviour_field_name('submit'), 'value' => get_string('check', 'question'), - 'class' => 'submit btn', + 'class' => 'submit btn btn-default', ); if ($options->readonly) { $attributes['disabled'] = 'disabled';
MDL-<I> qbehaviour: Correct "Check" button styling.
moodle_moodle
train
php
abc290536e2f0763ae817534bed52bf29cb87ade
diff --git a/salt/output/key.py b/salt/output/key.py index <HASH>..<HASH> 100644 --- a/salt/output/key.py +++ b/salt/output/key.py @@ -13,8 +13,7 @@ def output(data): Read in the dict structure generated by the salt key api methods and print the structure. ''' - color = salt.utils.get_colors( - not bool(__opts__.get('no_color', False))) + color = salt.utils.get_colors(__opts__.get('color')) cmap = {'minions_pre': color['RED'], 'minions': color['GREEN'],
Cleanup getting the colored output logic.
saltstack_salt
train
py
3f16103daf330a067454dd2ae324d8d238ac5ba3
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -280,15 +280,9 @@ module ActiveRecord end def reverse_sql_order(order_query) - order_query.join(', ').split(',').collect { |s| - if s.match(/\s(asc|ASC)$/) - s.gsub(/\s(asc|ASC)$/, ' DESC') - elsif s.match(/\s(desc|DESC)$/) - s.gsub(/\s(desc|DESC)$/, ' ASC') - else - s + ' DESC' - end - } + order_query.join(', ').split(',').collect do |s| + s.gsub!(/\sasc\Z/i, ' DESC') || s.gsub!(/\sdesc\Z/i, ' ASC') || s.concat(' DESC') + end end def array_of_strings?(o)
performance improvement based on discussion at <URL>
rails_rails
train
rb
d04143f1e3defd27f9c9a9dbf90d3b6c5af44aec
diff --git a/huey/contrib/mini.py b/huey/contrib/mini.py index <HASH>..<HASH> 100644 --- a/huey/contrib/mini.py +++ b/huey/contrib/mini.py @@ -90,6 +90,7 @@ class MiniHuey(object): ret = fn(*args, **kwargs) except Exception as exc: logger.exception('task %s failed' % fn.__name__) + async_result.set_exception(exc) raise else: duration = time.time() - start
Add exception call to AsyncResult after task failing
coleifer_huey
train
py
40334a650377476cf17aa372eaa9e1084cacee6d
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -102,7 +102,7 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the
sphinx theme changed to read the docs
backtrader_backtrader
train
py
de7855554f73df9ae000a6102a78bf355ca2571d
diff --git a/storage/storage_image.go b/storage/storage_image.go index <HASH>..<HASH> 100644 --- a/storage/storage_image.go +++ b/storage/storage_image.go @@ -446,6 +446,11 @@ func (s *storageImageDestination) computeNextBlobCacheFile() string { return filepath.Join(s.directory, fmt.Sprintf("%d", atomic.AddInt32(&s.nextTempFileID, 1))) } +// HasThreadSafePutBlob indicates whether PutBlob can be executed concurrently. +func (s *storageImageDestination) HasThreadSafePutBlob() bool { + return true +} + // PutBlobWithOptions writes contents of stream and returns data representing the result. // inputInfo.Digest can be optionally provided if known; if provided, and stream is read to the end without error, the digest MUST match the stream contents. // inputInfo.Size is the expected length of stream, if known. @@ -466,11 +471,6 @@ func (s *storageImageDestination) PutBlobWithOptions(ctx context.Context, stream return info, s.queueOrCommit(ctx, info, *options.LayerIndex, options.EmptyLayer) } -// HasThreadSafePutBlob indicates whether PutBlob can be executed concurrently. -func (s *storageImageDestination) HasThreadSafePutBlob() bool { - return true -} - // PutBlob writes contents of stream and returns data representing the result. // inputInfo.Digest can be optionally provided if known; if provided, and stream is read to the end without error, the digest MUST match the stream contents. // inputInfo.Size is the expected length of stream, if known.
Move storageImageDestination.HasThreadSafePutBlob ... so that it isn't in the middle of the PutBlob implementation. Should not change behavior.
containers_image
train
go
60c24e7e6a98af0476d20f4692581e5be90e0376
diff --git a/lib/gitter/table.rb b/lib/gitter/table.rb index <HASH>..<HASH> 100644 --- a/lib/gitter/table.rb +++ b/lib/gitter/table.rb @@ -90,12 +90,12 @@ module Gitter end end - def html + def html opts = {} @html ||= begin h = rows.map do |row| - Table.tag :tr, (row.map{|cell| cell.html} * "\n") + Table.tag :tr, (row.map{|cell| cell.html} * "\n"), (opts[:tr_html]||{}) end * "\n" - Table.tag :table, h + Table.tag :table, h, (opts[:table_html]||{}) end end
added html_opts to table
tsonntag_gitter
train
rb
f3b5ccfd79a16ee5462020c2ef4a42f8278d0464
diff --git a/src/Salts/Salts.php b/src/Salts/Salts.php index <HASH>..<HASH> 100644 --- a/src/Salts/Salts.php +++ b/src/Salts/Salts.php @@ -49,7 +49,7 @@ class Salts // read in each line as an array $response = file($this->source); - $parsed = (array) $this->parse_php_to_array($response); + $parsed = (array) $this->parse_salts_from_php($response); if (! array_filter($parsed)) { throw new Exception('There was a problem fetching salts from the WordPress generator service.'); @@ -65,7 +65,7 @@ class Salts * * @return array */ - protected function parse_php_to_array(array $php) + protected function parse_salts_from_php(array $php) { return array_map(function ($line) { // capture everything between single quotes
rename non-public method in Salts
aaemnnosttv_wp-cli-dotenv-command
train
php