content_type stringclasses 8
values | main_lang stringclasses 7
values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Java | Java | improve error message for missing request body | 13403d51e589a3612f8359c8f3e4d2c21947af81 | <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java
<ide> protected <T> Object readWithMessageConverters(NativeWebRequest webRequest, Meth
<ide> Object arg = readWithMessageConverters(inputMessage, methodParam, paramType);
<ide> if (arg == null) {
<ide> if (methodParam.getParameterAnnotation(RequestBody.class).required()) {
<del> throw new HttpMessageNotReadableException("Required request body is missing: " + methodParam);
<add> throw new HttpMessageNotReadableException("Required request body is missing: " +
<add> methodParam.getMethod().toGenericString());
<ide> }
<ide> }
<ide> | 1 |
Javascript | Javascript | create handlebars environment through proper means | 8086179d596376becc2819bf1be0c878378a6d68 | <ide><path>packages/ember-handlebars-compiler/lib/main.js
<ide> Ember.assert("Ember Handlebars requires Handlebars version 1.0 or 1.1, " +
<ide> @class Handlebars
<ide> @namespace Ember
<ide> */
<del>var EmberHandlebars = Ember.Handlebars = objectCreate(Handlebars);
<add>var EmberHandlebars = Ember.Handlebars = Handlebars.create();
<ide>
<ide> /**
<ide> Register a bound helper or custom view helper. | 1 |
Text | Text | fix minor typo | 72e66e4d67955ca2c6abe33593e693cf7b5478e7 | <ide><path>docs/api-guide/generic-views.md
<ide> The following attributes control the basic view behavior.
<ide>
<ide> * `queryset` - The queryset that should be used for returning objects from this view. Typically, you must either set this attribute, or override the `get_queryset()` method. If you are overriding a view method, it is important that you call `get_queryset()` instead of accessing this property directly, as `queryset` will get evaluated once, and those results will be cached for all subsequent requests.
<ide> * `serializer_class` - The serializer class that should be used for validating and deserializing input, and for serializing output. Typically, you must either set this attribute, or override the `get_serializer_class()` method.
<del>* `lookup_field` - The model field that should be used to for performing object lookup of individual model instances. Defaults to `'pk'`. Note that when using hyperlinked APIs you'll need to ensure that *both* the API views *and* the serializer classes set the lookup fields if you need to use a custom value.
<add>* `lookup_field` - The model field that should be used for performing object lookup of individual model instances. Defaults to `'pk'`. Note that when using hyperlinked APIs you'll need to ensure that *both* the API views *and* the serializer classes set the lookup fields if you need to use a custom value.
<ide> * `lookup_url_kwarg` - The URL keyword argument that should be used for object lookup. The URL conf should include a keyword argument corresponding to this value. If unset this defaults to using the same value as `lookup_field`.
<ide>
<ide> **Pagination**:
<ide> If the request data provided for creating the object was invalid, a `400 Bad Req
<ide>
<ide> Provides a `.retrieve(request, *args, **kwargs)` method, that implements returning an existing model instance in a response.
<ide>
<del>If an object can be retrieved this returns a `200 OK` response, with a serialized representation of the object as the body of the response. Otherwise it will return a `404 Not Found`.
<add>If an object can be retrieved this returns a `200 OK` response, with a serialized representation of the object as the body of the response. Otherwise, it will return a `404 Not Found`.
<ide>
<ide> ## UpdateModelMixin
<ide>
<ide> The following third party packages provide additional generic view implementatio
<ide> [UpdateModelMixin]: #updatemodelmixin
<ide> [DestroyModelMixin]: #destroymodelmixin
<ide> [django-rest-multiple-models]: https://github.com/MattBroach/DjangoRestMultipleModels
<del>[django-docs-select-related]: https://docs.djangoproject.com/en/3.1/ref/models/querysets/#django.db.models.query.QuerySet.select_related
<ide>\ No newline at end of file
<add>[django-docs-select-related]: https://docs.djangoproject.com/en/3.1/ref/models/querysets/#django.db.models.query.QuerySet.select_related | 1 |
Javascript | Javascript | hide react routes | cd9dcc6953624f294dda95ef68db17f246668d69 | <ide><path>server/boot/a-react.js
<ide> const debug = debugFactory('freecc:react-server');
<ide> // add routes here as they slowly get reactified
<ide> // remove their individual controllers
<ide> const routes = [
<del> '/hikes',
<del> '/hikes/*',
<del> '/jobs'
<add> // '/hikes',
<add> // '/hikes/*',
<add> // '/jobs'
<ide> ];
<ide>
<ide> export default function reactSubRouter(app) { | 1 |
Text | Text | add invoke test_unit to files table [ci skip] | 72985ba949058167a342af546c7a1a6a02e1b9fa | <ide><path>guides/source/getting_started.md
<ide> invoke test_unit
<ide> create test/controllers/welcome_controller_test.rb
<ide> invoke helper
<ide> create app/helpers/welcome_helper.rb
<add>invoke test_unit
<ide> invoke assets
<ide> invoke coffee
<ide> create app/assets/javascripts/welcome.coffee | 1 |
PHP | PHP | add status to redirect helper | 4d2ffeef8d27980f556b7ad51c2cc68e039e5064 | <ide><path>src/Illuminate/Foundation/helpers.php
<ide> function public_path($path = '')
<ide> * Get an instance of the redirector.
<ide> *
<ide> * @param string|null $to
<add> * @param int $status
<ide> * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
<ide> */
<del> function redirect($to = null)
<add> function redirect($to = null, $status = 302)
<ide> {
<ide> if ( ! is_null($to))
<ide> {
<del> return app('redirect')->to($to);
<add> return app('redirect')->to($to, $status);
<ide> }
<ide> else
<ide> { | 1 |
Javascript | Javascript | fix many tests for streams2 net refactor | 695abba5ac3365792c17ae3b83ba1272fb34ba5a | <ide><path>test/simple/test-child-process-disconnect.js
<ide> if (process.argv[2] === 'child') {
<ide>
<ide> server.on('connection', function(socket) {
<ide>
<add> socket.resume();
<add>
<ide> process.on('disconnect', function() {
<ide> socket.end((process.connected).toString());
<ide> });
<ide><path>test/simple/test-child-process-fork-net2.js
<ide> var assert = require('assert');
<ide> var common = require('../common');
<ide> var fork = require('child_process').fork;
<ide> var net = require('net');
<add>var count = 12;
<ide>
<ide> if (process.argv[2] === 'child') {
<ide>
<del> var endMe = null;
<add> var needEnd = [];
<ide>
<ide> process.on('message', function(m, socket) {
<ide> if (!socket) return;
<ide>
<add> console.error('got socket', m);
<add>
<ide> // will call .end('end') or .write('write');
<ide> socket[m](m);
<ide>
<add> socket.resume();
<add>
<add> socket.on('data', function() {
<add> console.error('%d socket.data', process.pid, m);
<add> });
<add>
<add> socket.on('end', function() {
<add> console.error('%d socket.end', process.pid, m);
<add> });
<add>
<ide> // store the unfinished socket
<ide> if (m === 'write') {
<del> endMe = socket;
<add> needEnd.push(socket);
<ide> }
<add>
<add> socket.on('close', function() {
<add> console.error('%d socket.close', process.pid, m);
<add> });
<add>
<add> socket.on('finish', function() {
<add> console.error('%d socket finished', process.pid, m);
<add> });
<ide> });
<ide>
<ide> process.on('message', function(m) {
<ide> if (m !== 'close') return;
<del> endMe.end('end');
<del> endMe = null;
<add> console.error('got close message');
<add> needEnd.forEach(function(endMe, i) {
<add> console.error('%d ending %d', process.pid, i);
<add> endMe.end('end');
<add> });
<ide> });
<ide>
<ide> process.on('disconnect', function() {
<del> endMe.end('end');
<add> console.error('%d process disconnect, ending', process.pid);
<add> needEnd.forEach(function(endMe, i) {
<add> console.error('%d ending %d', process.pid, i);
<add> endMe.end('end');
<add> });
<ide> endMe = null;
<ide> });
<ide>
<ide> if (process.argv[2] === 'child') {
<ide>
<ide> var connected = 0;
<ide> server.on('connection', function(socket) {
<del> switch (connected) {
<add> switch (connected % 6) {
<ide> case 0:
<ide> child1.send('end', socket); break;
<ide> case 1:
<ide> if (process.argv[2] === 'child') {
<ide> }
<ide> connected += 1;
<ide>
<del> if (connected === 6) {
<add> if (connected === count) {
<ide> closeServer();
<ide> }
<ide> });
<ide>
<ide> var disconnected = 0;
<ide> server.on('listening', function() {
<ide>
<del> var j = 6, client;
<add> var j = count, client;
<ide> while (j--) {
<ide> client = net.connect(common.PORT, '127.0.0.1');
<ide> client.on('close', function() {
<add> console.error('CLIENT: close event in master');
<ide> disconnected += 1;
<ide> });
<add> // XXX This resume() should be unnecessary.
<add> // a stream high water mark should be enough to keep
<add> // consuming the input.
<add> client.resume();
<ide> }
<ide> });
<ide>
<ide> var closeEmitted = false;
<ide> server.on('close', function() {
<add> console.error('server close');
<ide> closeEmitted = true;
<ide>
<ide> child1.kill();
<ide> if (process.argv[2] === 'child') {
<ide>
<ide> var timeElasped = 0;
<ide> var closeServer = function() {
<add> console.error('closeServer');
<ide> var startTime = Date.now();
<ide> server.on('close', function() {
<add> console.error('emit(close)');
<ide> timeElasped = Date.now() - startTime;
<ide> });
<ide>
<add> console.error('calling server.close');
<ide> server.close();
<ide>
<ide> setTimeout(function() {
<add> console.error('sending close to children');
<ide> child1.send('close');
<ide> child2.send('close');
<ide> child3.disconnect();
<ide> }, 200);
<ide> };
<ide>
<ide> process.on('exit', function() {
<del> assert.equal(disconnected, 6);
<del> assert.equal(connected, 6);
<add> assert.equal(disconnected, count);
<add> assert.equal(connected, count);
<ide> assert.ok(closeEmitted);
<ide> assert.ok(timeElasped >= 190 && timeElasped <= 1000,
<ide> 'timeElasped was not between 190 and 1000 ms');
<ide><path>test/simple/test-cluster-message.js
<ide> else if (cluster.isMaster) {
<ide> var check = function(type, result) {
<ide> checks[type].receive = true;
<ide> checks[type].correct = result;
<add> console.error('check', checks);
<ide>
<ide> var missing = false;
<ide> forEach(checks, function(type) {
<ide> if (type.receive === false) missing = true;
<ide> });
<ide>
<ide> if (missing === false) {
<add> console.error('end client');
<ide> client.end();
<ide> }
<ide> };
<ide><path>test/simple/test-http-1.0-keep-alive.js
<ide> function check(tests) {
<ide> function server(req, res) {
<ide> if (current + 1 === test.responses.length) this.close();
<ide> var ctx = test.responses[current];
<add> console.error('< SERVER SENDING RESPONSE', ctx);
<ide> res.writeHead(200, ctx.headers);
<ide> ctx.chunks.slice(0, -1).forEach(function(chunk) { res.write(chunk) });
<ide> res.end(ctx.chunks[ctx.chunks.length - 1]);
<ide> function check(tests) {
<ide>
<ide> function connected() {
<ide> var ctx = test.requests[current];
<add> console.error(' > CLIENT SENDING REQUEST', ctx);
<ide> conn.setEncoding('utf8');
<ide> conn.write(ctx.data);
<ide>
<ide> function onclose() {
<add> console.error(' > CLIENT CLOSE');
<ide> if (!ctx.expectClose) throw new Error('unexpected close');
<ide> client();
<ide> }
<ide> conn.on('close', onclose);
<ide>
<ide> function ondata(s) {
<add> console.error(' > CLIENT ONDATA %j %j', s.length, s.toString());
<ide> current++;
<ide> if (ctx.expectClose) return;
<ide> conn.removeListener('close', onclose);
<ide><path>test/simple/test-net-after-close.js
<ide> var net = require('net');
<ide> var closed = false;
<ide>
<ide> var server = net.createServer(function(s) {
<add> console.error('SERVER: got connection');
<ide> s.end();
<ide> });
<ide>
<ide> server.listen(common.PORT, function() {
<ide> var c = net.createConnection(common.PORT);
<ide> c.on('close', function() {
<add> console.error('connection closed');
<ide> assert.strictEqual(c._handle, null);
<ide> closed = true;
<ide> assert.doesNotThrow(function() {
<ide><path>test/simple/test-net-binary.js
<ide> for (var i = 255; i >= 0; i--) {
<ide>
<ide> // safe constructor
<ide> var echoServer = net.Server(function(connection) {
<add> // connection._readableState.lowWaterMark = 0;
<add> console.error('SERVER got connection');
<ide> connection.setEncoding('binary');
<ide> connection.on('data', function(chunk) {
<del> common.error('recved: ' + JSON.stringify(chunk));
<add> common.error('SERVER recved: ' + JSON.stringify(chunk));
<ide> connection.write(chunk, 'binary');
<ide> });
<ide> connection.on('end', function() {
<add> console.error('SERVER ending');
<ide> connection.end();
<ide> });
<ide> });
<ide> echoServer.listen(common.PORT);
<ide> var recv = '';
<ide>
<ide> echoServer.on('listening', function() {
<add> console.error('SERVER listening');
<ide> var j = 0;
<del> var c = net.createConnection(common.PORT);
<add> var c = net.createConnection({
<add> port: common.PORT
<add> });
<add>
<add> // c._readableState.lowWaterMark = 0;
<ide>
<ide> c.setEncoding('binary');
<ide> c.on('data', function(chunk) {
<del> if (j < 256) {
<del> common.error('write ' + j);
<add> console.error('CLIENT data %j', chunk);
<add> var n = j + chunk.length;
<add> while (j < n && j < 256) {
<add> common.error('CLIENT write ' + j);
<ide> c.write(String.fromCharCode(j), 'binary');
<ide> j++;
<del> } else {
<add> }
<add> if (j === 256) {
<add> console.error('CLIENT ending');
<ide> c.end();
<ide> }
<ide> recv += chunk;
<ide> });
<ide>
<ide> c.on('connect', function() {
<add> console.error('CLIENT connected, writing');
<ide> c.write(binaryString, 'binary');
<ide> });
<ide>
<ide> c.on('close', function() {
<add> console.error('CLIENT closed');
<ide> console.dir(recv);
<ide> echoServer.close();
<ide> });
<add>
<add> c.on('finish', function() {
<add> console.error('CLIENT finished');
<add> });
<ide> });
<ide>
<ide> process.on('exit', function() {
<ide><path>test/simple/test-net-bytes-stats.js
<ide> var count = 0;
<ide> var tcp = net.Server(function(s) {
<ide> console.log('tcp server connection');
<ide>
<add> // trigger old mode.
<add> s.resume();
<add>
<ide> s.on('end', function() {
<ide> bytesRead += s.bytesRead;
<ide> console.log('tcp socket disconnect #' + count);
<ide> });
<ide> });
<ide>
<del>tcp.listen(common.PORT, function() {
<add>tcp.listen(common.PORT, function doTest() {
<add> console.error('listening');
<ide> var socket = net.createConnection(tcpPort);
<ide>
<ide> socket.on('connect', function() {
<ide> count++;
<del> console.log('tcp client connection #' + count);
<add> console.error('CLIENT connect #%d', count);
<ide>
<ide> socket.write('foo', function() {
<add> console.error('CLIENT: write cb');
<ide> socket.end('bar');
<ide> });
<ide> });
<ide>
<del> socket.on('end', function() {
<add> socket.on('finish', function() {
<ide> bytesWritten += socket.bytesWritten;
<del> console.log('tcp client disconnect #' + count);
<add> console.error('CLIENT end event #%d', count);
<ide> });
<ide>
<ide> socket.on('close', function() {
<add> console.error('CLIENT close event #%d', count);
<ide> console.log('Bytes read: ' + bytesRead);
<ide> console.log('Bytes written: ' + bytesWritten);
<ide> if (count < 2) {
<add> console.error('RECONNECTING');
<ide> socket.connect(tcpPort);
<ide> } else {
<ide> tcp.close();
<ide><path>test/simple/test-net-can-reset-timeout.js
<ide> var timeoutCount = 0;
<ide> var server = net.createServer(function(stream) {
<ide> stream.setTimeout(100);
<ide>
<add> stream.resume();
<add>
<ide> stream.on('timeout', function() {
<ide> console.log('timeout');
<ide> // try to reset the timeout.
<ide><path>test/simple/test-net-connect-buffer.js
<ide> var tcp = net.Server(function(s) {
<ide> });
<ide>
<ide> s.on('end', function() {
<add> console.error('SERVER: end', buf.toString());
<ide> assert.equal(buf, "L'État, c'est moi");
<ide> console.log('tcp socket disconnect');
<ide> s.end();
<ide> var tcp = net.Server(function(s) {
<ide> });
<ide>
<ide> tcp.listen(common.PORT, function() {
<del> var socket = net.Stream();
<add> var socket = net.Stream({ highWaterMark: 0 });
<ide>
<ide> console.log('Connecting to socket ');
<ide>
<ide> tcp.listen(common.PORT, function() {
<ide> {}
<ide> ].forEach(function(v) {
<ide> function f() {
<add> console.error('write', v);
<ide> socket.write(v);
<ide> }
<ide> assert.throws(f, TypeError);
<ide> tcp.listen(common.PORT, function() {
<ide> // We're still connecting at this point so the datagram is first pushed onto
<ide> // the connect queue. Make sure that it's not added to `bytesWritten` again
<ide> // when the actual write happens.
<del> var r = socket.write(a, function() {
<add> var r = socket.write(a, function(er) {
<add> console.error('write cb');
<ide> dataWritten = true;
<ide> assert.ok(connectHappened);
<del> assert.equal(socket.bytesWritten, Buffer(a + b).length);
<add> console.error('socket.bytesWritten', socket.bytesWritten);
<add> //assert.equal(socket.bytesWritten, Buffer(a + b).length);
<ide> console.error('data written');
<ide> });
<add> console.error('socket.bytesWritten', socket.bytesWritten);
<add> console.error('write returned', r);
<add>
<ide> assert.equal(socket.bytesWritten, Buffer(a).length);
<ide>
<ide> assert.equal(false, r);
<ide><path>test/simple/test-net-connect-options.js
<ide> var serverGotEnd = false;
<ide> var clientGotEnd = false;
<ide>
<ide> var server = net.createServer({allowHalfOpen: true}, function(socket) {
<add> socket.resume();
<ide> socket.on('end', function() {
<ide> serverGotEnd = true;
<ide> });
<ide> server.listen(common.PORT, function() {
<ide> port: common.PORT,
<ide> allowHalfOpen: true
<ide> }, function() {
<add> console.error('client connect cb');
<add> client.resume();
<ide> client.on('end', function() {
<ide> clientGotEnd = true;
<ide> setTimeout(function() {
<ide> server.listen(common.PORT, function() {
<ide> });
<ide>
<ide> process.on('exit', function() {
<add> console.error('exit', serverGotEnd, clientGotEnd);
<ide> assert(serverGotEnd);
<ide> assert(clientGotEnd);
<ide> });
<ide><path>test/simple/test-net-pingpong.js
<ide> function pingPongTest(port, host) {
<ide> });
<ide>
<ide> socket.on('end', function() {
<add> console.error(socket);
<add> assert.equal(true, socket.allowHalfOpen);
<ide> assert.equal(true, socket.writable); // because allowHalfOpen
<ide> assert.equal(false, socket.readable);
<ide> socket.end();
<ide> function pingPongTest(port, host) {
<ide> }
<ide>
<ide> /* All are run at once, so run on different ports */
<add>console.log(common.PIPE);
<ide> pingPongTest(common.PIPE);
<del>pingPongTest(20988);
<del>pingPongTest(20989, 'localhost');
<del>pingPongTest(20997, '::1');
<add>pingPongTest(common.PORT);
<add>pingPongTest(common.PORT + 1, 'localhost');
<add>pingPongTest(common.PORT + 2, '::1');
<ide>
<ide> process.on('exit', function() {
<ide> assert.equal(4, tests_run);
<ide><path>test/simple/test-net-reconnect.js
<ide> var client_recv_count = 0;
<ide> var disconnect_count = 0;
<ide>
<ide> var server = net.createServer(function(socket) {
<add> console.error('SERVER: got socket connection');
<add> socket.resume();
<add>
<ide> socket.on('connect', function() {
<add> console.error('SERVER connect, writing');
<ide> socket.write('hello\r\n');
<ide> });
<ide>
<ide> socket.on('end', function() {
<add> console.error('SERVER socket end, calling end()');
<ide> socket.end();
<ide> });
<ide>
<ide> socket.on('close', function(had_error) {
<del> //console.log('server had_error: ' + JSON.stringify(had_error));
<add> console.log('SERVER had_error: ' + JSON.stringify(had_error));
<ide> assert.equal(false, had_error);
<ide> });
<ide> });
<ide>
<ide> server.listen(common.PORT, function() {
<del> console.log('listening');
<add> console.log('SERVER listening');
<ide> var client = net.createConnection(common.PORT);
<ide>
<ide> client.setEncoding('UTF8');
<ide>
<ide> client.on('connect', function() {
<del> console.log('client connected.');
<add> console.error('CLIENT connected', client._writableState);
<ide> });
<ide>
<ide> client.on('data', function(chunk) {
<ide> client_recv_count += 1;
<ide> console.log('client_recv_count ' + client_recv_count);
<ide> assert.equal('hello\r\n', chunk);
<add> console.error('CLIENT: calling end', client._writableState);
<ide> client.end();
<ide> });
<ide>
<add> client.on('end', function() {
<add> console.error('CLIENT end');
<add> });
<add>
<ide> client.on('close', function(had_error) {
<del> console.log('disconnect');
<add> console.log('CLIENT disconnect');
<ide> assert.equal(false, had_error);
<ide> if (disconnect_count++ < N)
<ide> client.connect(common.PORT); // reconnect
<ide><path>test/simple/test-net-remote-address-port.js
<ide> var server = net.createServer(function(socket) {
<ide> socket.on('end', function() {
<ide> if (++conns_closed == 2) server.close();
<ide> });
<add> socket.resume();
<ide> });
<ide>
<ide> server.listen(common.PORT, 'localhost', function() {
<ide><path>test/simple/test-net-write-after-close.js
<ide> process.on('exit', function() {
<ide> });
<ide>
<ide> var server = net.createServer(function(socket) {
<add> socket.resume();
<add>
<ide> socket.on('error', function(error) {
<add> console.error('got error, closing server', error);
<ide> server.close();
<ide> gotError = true;
<ide> });
<ide>
<ide> setTimeout(function() {
<add> console.error('about to try to write');
<ide> socket.write('test', function(e) {
<ide> gotWriteCB = true;
<ide> });
<ide><path>test/simple/test-pipe-file-to-http.js
<ide> var clientReqComplete = false;
<ide> var count = 0;
<ide>
<ide> var server = http.createServer(function(req, res) {
<add> console.error('SERVER request');
<ide> var timeoutId;
<ide> assert.equal('POST', req.method);
<ide> req.pause();
<ide> server.on('listening', function() {
<ide>
<ide> cp.exec(cmd, function(err, stdout, stderr) {
<ide> if (err) throw err;
<add> console.error('EXEC returned successfully stdout=%d stderr=%d',
<add> stdout.length, stderr.length);
<ide> makeRequest();
<ide> });
<ide> });
<ide> function makeRequest() {
<ide> });
<ide>
<ide> common.error('pipe!');
<add>
<ide> var s = fs.ReadStream(filename);
<ide> s.pipe(req);
<add> s.on('data', function(chunk) {
<add> console.error('FS data chunk=%d', chunk.length);
<add> });
<add> s.on('end', function() {
<add> console.error('FS end');
<add> });
<ide> s.on('close', function(err) {
<ide> if (err) throw err;
<ide> clientReqComplete = true;
<ide> common.error('client finished sending request');
<ide> });
<ide>
<ide> req.on('response', function(res) {
<add> console.error('RESPONSE', res.statusCode, res.headers);
<add> res.resume();
<ide> res.on('end', function() {
<add> console.error('RESPONSE end');
<ide> server.close();
<ide> });
<ide> });
<ide><path>test/simple/test-pipe.js
<ide> function startClient() {
<ide> });
<ide> req.write(buffer);
<ide> req.end();
<add> console.error('ended request', req);
<ide> }
<ide>
<ide> process.on('exit', function() {
<ide><path>test/simple/test-tcp-wrap-connect.js
<ide> var shutdownCount = 0;
<ide> var server = require('net').Server(function(s) {
<ide> console.log('got connection');
<ide> connectCount++;
<add> s.resume();
<ide> s.on('end', function() {
<ide> console.log('got eof');
<ide> endCount++;
<ide><path>test/simple/test-zlib-random-byte-pipes.js
<ide> var inp = new RandomReadStream({ total: 1024, block: 256, jitter: 16 });
<ide> var out = new HashStream();
<ide> var gzip = zlib.createGzip();
<ide> var gunz = zlib.createGunzip();
<add>
<ide> inp.pipe(gzip).pipe(gunz).pipe(out);
<ide>
<add>inp.on('data', function(c) {
<add> console.error('inp data', c.length);
<add>});
<add>
<add>gzip.on('data', function(c) {
<add> console.error('gzip data', c.length);
<add>});
<add>
<add>gunz.on('data', function(c) {
<add> console.error('gunz data', c.length);
<add>});
<add>
<add>out.on('data', function(c) {
<add> console.error('out data', c.length);
<add>});
<add>
<ide> var didSomething = false;
<ide> out.on('data', function(c) {
<ide> didSomething = true; | 18 |
Javascript | Javascript | allow dom nodes in immutableobject | 669f4b867f09cb47e603fe58e3d0174d31053769 | <ide><path>src/utils/ImmutableObject.js
<ide> "use strict";
<ide>
<ide> var invariant = require('invariant');
<add>var isDOMNode = require('isDOMNode');
<ide> var merge = require('merge');
<ide> var mergeInto = require('mergeInto');
<ide> var mergeHelpers = require('mergeHelpers');
<ide> if (__DEV__) {
<ide> * @param {*} object The object to freeze.
<ide> */
<ide> var deepFreeze = function(object) {
<add> if (isDOMNode(object)) {
<add> return; // Don't try to freeze DOM nodes.
<add> }
<ide> Object.freeze(object); // First freeze the object.
<ide> for (var prop in object) {
<ide> var field = object[prop];
<ide><path>src/utils/__tests__/ImmutableObject-test.js
<ide> describe('ImmutableObject', function() {
<ide> }).not.toThrow();
<ide> });
<ide>
<add> testDev('should not exceed maximum call stack size with nodes', function() {
<add> var node = document.createElement('div');
<add> var object = new ImmutableObject({node: node});
<add> expect(object.node).toBe(node);
<add> });
<add>
<ide> testDevAndProd('should not throw when not mutating directly', function() {
<ide> var io = new ImmutableObject({oldField: 'asdf'});
<ide> expect(function() {
<ide><path>src/vendor/core/dom/isDOMNode.js
<add>/**
<add> * Copyright 2013 Facebook, Inc.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> *
<add> * @providesModule isDOMNode
<add> * @typechecks
<add> */
<add>
<add>/**
<add> * @param {*} object The object to check.
<add> * @return {boolean} Whether or not the object is a DOM node.
<add> */
<add>function isDOMNode(object) {
<add> return !!(object && (
<add> typeof Node !== 'undefined' ? object instanceof Node :
<add> typeof object === 'object' &&
<add> typeof object.nodeType === 'number' &&
<add> typeof object.nodeName === 'string'
<add> ));
<add>}
<add>
<add>module.exports = isDOMNode; | 3 |
Javascript | Javascript | fix bug in setproctitle test | 2f8596ee107261f12fc226fc70c0bcc4da535f44 | <ide><path>test/simple/test-setproctitle.js
<ide> assert.equal(process.title, title);
<ide> exec('ps -p ' + process.pid + ' -o args=', function(error, stdout, stderr) {
<ide> assert.equal(error, null);
<ide> assert.equal(stderr, '');
<del> // omitting trailing \n
<del> assert.equal(stdout.substring(0, stdout.length - 1), title);
<add> // omitting trailing whitespace and \n
<add> assert.equal(stdout.replace(/\s+$/, ''), title);
<ide> }); | 1 |
Ruby | Ruby | improve taploader and tapformulaunavailableerror | 140f8e3df780cee9d69c7d314d62ca0abe4a42de | <ide><path>Library/Homebrew/exceptions.rb
<ide> def to_s
<ide> end
<ide>
<ide> class TapFormulaUnavailableError < FormulaUnavailableError
<del> attr_reader :user, :repo, :shortname
<add> attr_reader :tap
<ide>
<del> def initialize name
<del> super
<del> @user, @repo, @shortname = name.split("/", 3)
<add> def initialize tap, name
<add> @tap = tap
<add> super "#{tap}/#{name}"
<ide> end
<ide>
<del> def to_s; <<-EOS.undent
<del> No available formula for #{shortname} #{dependent_s}
<del> Please tap it and then try again: brew tap #{user}/#{repo}
<del> EOS
<add> def to_s
<add> s = super
<add> s += "\nPlease tap it and then try again: brew tap #{tap}" unless tap.installed?
<add> s
<ide> end
<ide> end
<ide>
<ide><path>Library/Homebrew/formulary.rb
<ide> def load_file
<ide>
<ide> # Loads tapped formulae.
<ide> class TapLoader < FormulaLoader
<del> attr_reader :tapped_name
<add> attr_reader :tap
<ide>
<ide> def initialize tapped_name
<del> @tapped_name = tapped_name
<ide> user, repo, name = tapped_name.split("/", 3).map(&:downcase)
<del> tap = Tap.new user, repo
<del> path = tap.formula_files.detect { |file| file.basename(".rb").to_s == name }
<del> path ||= tap.path/"#{name}.rb"
<add> @tap = Tap.new user, repo.sub(/^homebrew-/, "")
<add> path = @tap.formula_files.detect { |file| file.basename(".rb").to_s == name }
<add> path ||= @tap.path/"#{name}.rb"
<ide>
<ide> super name, path
<ide> end
<ide>
<ide> def get_formula(spec)
<ide> super
<ide> rescue FormulaUnavailableError => e
<del> raise TapFormulaUnavailableError, tapped_name, e.backtrace
<add> raise TapFormulaUnavailableError.new(tap, name), "", e.backtrace
<ide> end
<ide> end
<ide> | 2 |
Ruby | Ruby | push multi-parameter assignement into the types | 631707a572fe14f3bbea2779cc97fcc581048d62 | <ide><path>activerecord/lib/active_record/aggregations.rb
<ide> def writer_method(name, class_name, mapping, allow_nil, converter)
<ide> define_method("#{name}=") do |part|
<ide> klass = class_name.constantize
<ide> if part.is_a?(Hash)
<del> part = klass.new(*part.values)
<add> raise ArgumentError unless part.size == part.keys.max
<add> part = klass.new(*part.sort.map(&:last))
<ide> end
<ide>
<ide> unless part.is_a?(klass) || converter.nil? || part.nil?
<ide><path>activerecord/lib/active_record/attribute_assignment.rb
<ide> def execute_callstack_for_multiparameter_attributes(callstack)
<ide> errors = []
<ide> callstack.each do |name, values_with_empty_parameters|
<ide> begin
<del> send("#{name}=", MultiparameterAttribute.new(self, name, values_with_empty_parameters).read_value)
<add> if values_with_empty_parameters.each_value.all?(&:nil?)
<add> values = nil
<add> else
<add> values = values_with_empty_parameters
<add> end
<add> send("#{name}=", values)
<ide> rescue => ex
<ide> errors << AttributeAssignmentError.new("error on assignment #{values_with_empty_parameters.values.inspect} to #{name} (#{ex.message})", ex, name)
<ide> end
<ide> def type_cast_attribute_value(multiparameter_name, value)
<ide> def find_parameter_position(multiparameter_name)
<ide> multiparameter_name.scan(/\(([0-9]*).*\)/).first.first.to_i
<ide> end
<del>
<del> class MultiparameterAttribute #:nodoc:
<del> attr_reader :object, :name, :values, :cast_type
<del>
<del> def initialize(object, name, values)
<del> @object = object
<del> @name = name
<del> @values = values
<del> end
<del>
<del> def read_value
<del> return if values.values.compact.empty?
<del>
<del> @cast_type = object.type_for_attribute(name)
<del> klass = cast_type.klass
<del>
<del> if klass == Time
<del> read_time
<del> elsif klass == Date
<del> read_date
<del> else
<del> read_other
<del> end
<del> end
<del>
<del> private
<del>
<del> def instantiate_time_object(set_values)
<del> if object.class.send(:create_time_zone_conversion_attribute?, name, cast_type)
<del> Time.zone.local(*set_values)
<del> else
<del> Time.send(object.class.default_timezone, *set_values)
<del> end
<del> end
<del>
<del> def read_time
<del> # If column is a :time (and not :date or :datetime) there is no need to validate if
<del> # there are year/month/day fields
<del> if cast_type.type == :time
<del> # if the column is a time set the values to their defaults as January 1, 1970, but only if they're nil
<del> { 1 => 1970, 2 => 1, 3 => 1 }.each do |key,value|
<del> values[key] ||= value
<del> end
<del> else
<del> # else column is a timestamp, so if Date bits were not provided, error
<del> validate_required_parameters!([1,2,3])
<del>
<del> # If Date bits were provided but blank, then return nil
<del> return if blank_date_parameter?
<del> end
<del>
<del> max_position = extract_max_param(6)
<del> set_values = values.values_at(*(1..max_position))
<del> # If Time bits are not there, then default to 0
<del> (3..5).each { |i| set_values[i] = set_values[i].presence || 0 }
<del> instantiate_time_object(set_values)
<del> end
<del>
<del> def read_date
<del> return if blank_date_parameter?
<del> set_values = values.values_at(1,2,3)
<del> begin
<del> Date.new(*set_values)
<del> rescue ArgumentError # if Date.new raises an exception on an invalid date
<del> instantiate_time_object(set_values).to_date # we instantiate Time object and convert it back to a date thus using Time's logic in handling invalid dates
<del> end
<del> end
<del>
<del> def read_other
<del> max_position = extract_max_param
<del> positions = (1..max_position)
<del> validate_required_parameters!(positions)
<del>
<del> values.slice(*positions)
<del> end
<del>
<del> # Checks whether some blank date parameter exists. Note that this is different
<del> # than the validate_required_parameters! method, since it just checks for blank
<del> # positions instead of missing ones, and does not raise in case one blank position
<del> # exists. The caller is responsible to handle the case of this returning true.
<del> def blank_date_parameter?
<del> (1..3).any? { |position| values[position].blank? }
<del> end
<del>
<del> # If some position is not provided, it errors out a missing parameter exception.
<del> def validate_required_parameters!(positions)
<del> if missing_parameter = positions.detect { |position| !values.key?(position) }
<del> raise ArgumentError.new("Missing Parameter - #{name}(#{missing_parameter})")
<del> end
<del> end
<del>
<del> def extract_max_param(upper_cap = 100)
<del> [values.keys.max, upper_cap].min
<del> end
<del> end
<ide> end
<ide> end
<ide><path>activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
<ide> def type_cast_from_database(value)
<ide> def type_cast_from_user(value)
<ide> if value.is_a?(Array)
<ide> value.map { |v| type_cast_from_user(v) }
<add> elsif value.is_a?(Hash)
<add> set_time_zone_without_conversion(super)
<ide> elsif value.respond_to?(:in_time_zone)
<ide> begin
<ide> user_input_in_time_zone(value) || super
<ide> def type_cast_from_user(value)
<ide> end
<ide> end
<ide>
<add> private
<add>
<ide> def convert_time_to_time_zone(value)
<ide> if value.is_a?(Array)
<ide> value.map { |v| convert_time_to_time_zone(v) }
<ide> def convert_time_to_time_zone(value)
<ide> value
<ide> end
<ide> end
<add>
<add> def set_time_zone_without_conversion(value)
<add> ::Time.zone.local_to_utc(value).in_time_zone
<add> end
<ide> end
<ide>
<ide> extend ActiveSupport::Concern
<ide><path>activerecord/lib/active_record/type.rb
<add>require 'active_record/type/helpers'
<ide> require 'active_record/type/decorator'
<ide> require 'active_record/type/mutable'
<ide> require 'active_record/type/numeric'
<ide><path>activerecord/lib/active_record/type/date.rb
<ide> module ActiveRecord
<ide> module Type
<ide> class Date < Value # :nodoc:
<add> include Helpers::AcceptsMultiparameterTime.new
<add>
<ide> def type
<ide> :date
<ide> end
<ide>
<del> def klass
<del> ::Date
<del> end
<del>
<ide> def type_cast_for_schema(value)
<ide> "'#{value.to_s(:db)}'"
<ide> end
<ide> def new_date(year, mon, mday)
<ide> ::Date.new(year, mon, mday) rescue nil
<ide> end
<ide> end
<add>
<add> def value_from_multiparameter_assignment(*)
<add> time = super
<add> time && time.to_date
<add> end
<ide> end
<ide> end
<ide> end
<ide><path>activerecord/lib/active_record/type/date_time.rb
<ide> module ActiveRecord
<ide> module Type
<ide> class DateTime < Value # :nodoc:
<ide> include TimeValue
<add> include Helpers::AcceptsMultiparameterTime.new(
<add> defaults: { 4 => 0, 5 => 0 }
<add> )
<ide>
<ide> def type
<ide> :datetime
<ide> def fallback_string_to_time(string)
<ide>
<ide> new_time(*time_hash.values_at(:year, :mon, :mday, :hour, :min, :sec, :sec_fraction, :offset))
<ide> end
<add>
<add> def value_from_multiparameter_assignment(values_hash)
<add> missing_parameter = (1..3).detect { |key| !values_hash.key?(key) }
<add> if missing_parameter
<add> raise ArgumentError, missing_parameter
<add> end
<add> super
<add> end
<ide> end
<ide> end
<ide> end
<ide><path>activerecord/lib/active_record/type/helpers.rb
<add>require 'active_record/type/helpers/accepts_multiparameter_time'
<ide><path>activerecord/lib/active_record/type/helpers/accepts_multiparameter_time.rb
<add>module ActiveRecord
<add> module Type
<add> module Helpers
<add> class AcceptsMultiparameterTime < Module
<add> def initialize(defaults: {})
<add> define_method(:type_cast_from_user) do |value|
<add> if value.is_a?(Hash)
<add> value_from_multiparameter_assignment(value)
<add> else
<add> super(value)
<add> end
<add> end
<add>
<add> define_method(:value_from_multiparameter_assignment) do |values_hash|
<add> defaults.each do |k, v|
<add> values_hash[k] ||= v
<add> end
<add> return unless values_hash[1] && values_hash[2] && values_hash[3]
<add> values = values_hash.sort.map(&:last)
<add> ::Time.send(
<add> ActiveRecord::Base.default_timezone,
<add> *values
<add> )
<add> end
<add> private :value_from_multiparameter_assignment
<add> end
<add> end
<add> end
<add> end
<add>end
<ide><path>activerecord/lib/active_record/type/time.rb
<ide> module ActiveRecord
<ide> module Type
<ide> class Time < Value # :nodoc:
<ide> include TimeValue
<add> include Helpers::AcceptsMultiparameterTime.new(
<add> defaults: { 1 => 1970, 2 => 1, 3 => 1, 4 => 0, 5 => 0 }
<add> )
<ide>
<ide> def type
<ide> :time
<ide><path>activerecord/lib/active_record/type/time_value.rb
<ide> module ActiveRecord
<ide> module Type
<ide> module TimeValue # :nodoc:
<del> def klass
<del> ::Time
<del> end
<del>
<ide> def type_cast_for_schema(value)
<ide> "'#{value.to_s(:db)}'"
<ide> end
<ide><path>activerecord/lib/active_record/type/value.rb
<ide> def binary? # :nodoc:
<ide> false
<ide> end
<ide>
<del> def klass # :nodoc:
<del> end
<del>
<ide> # Determines whether a value has changed for dirty checking. +old_value+
<ide> # and +new_value+ will always be type-cast. Types should not need to
<ide> # override this method.
<ide><path>activerecord/test/cases/multiparameter_attributes_test.rb
<ide> def test_multiparameter_attributes_on_time_with_utc
<ide>
<ide> def test_multiparameter_attributes_on_time_with_time_zone_aware_attributes
<ide> with_timezone_config default: :utc, aware_attributes: true, zone: -28800 do
<add> Topic.reset_column_information
<ide> attributes = {
<ide> "written_on(1i)" => "2004", "written_on(2i)" => "6", "written_on(3i)" => "24",
<ide> "written_on(4i)" => "16", "written_on(5i)" => "24", "written_on(6i)" => "00"
<ide> def test_multiparameter_attributes_on_time_with_time_zone_aware_attributes
<ide> assert_equal Time.utc(2004, 6, 24, 16, 24, 0), topic.written_on.time
<ide> assert_equal Time.zone, topic.written_on.time_zone
<ide> end
<add> ensure
<add> Topic.reset_column_information
<ide> end
<ide>
<ide> def test_multiparameter_attributes_on_time_with_time_zone_aware_attributes_false
<ide> def test_multiparameter_attributes_on_time_with_time_zone_aware_attributes_false
<ide> def test_multiparameter_attributes_on_time_with_skip_time_zone_conversion_for_attributes
<ide> with_timezone_config default: :utc, aware_attributes: true, zone: -28800 do
<ide> Topic.skip_time_zone_conversion_for_attributes = [:written_on]
<add> Topic.reset_column_information
<ide> attributes = {
<ide> "written_on(1i)" => "2004", "written_on(2i)" => "6", "written_on(3i)" => "24",
<ide> "written_on(4i)" => "16", "written_on(5i)" => "24", "written_on(6i)" => "00"
<ide> def test_multiparameter_attributes_on_time_with_skip_time_zone_conversion_for_at
<ide> end
<ide> ensure
<ide> Topic.skip_time_zone_conversion_for_attributes = []
<add> Topic.reset_column_information
<ide> end
<ide>
<ide> # Oracle does not have a TIME datatype.
<ide> unless current_adapter?(:OracleAdapter)
<ide> def test_multiparameter_attributes_on_time_only_column_with_time_zone_aware_attributes_does_not_do_time_zone_conversion
<ide> with_timezone_config default: :utc, aware_attributes: true, zone: -28800 do
<add> Topic.reset_column_information
<ide> attributes = {
<ide> "bonus_time(1i)" => "2000", "bonus_time(2i)" => "1", "bonus_time(3i)" => "1",
<ide> "bonus_time(4i)" => "16", "bonus_time(5i)" => "24"
<ide> def test_multiparameter_attributes_on_time_only_column_with_time_zone_aware_attr
<ide> assert_equal Time.zone.local(2000, 1, 1, 16, 24, 0), topic.bonus_time
<ide> assert_not topic.bonus_time.utc?
<ide> end
<add> ensure
<add> Topic.reset_column_information
<ide> end
<ide> end
<ide> | 12 |
Ruby | Ruby | remove tab chars before commands to be run | 34672e669da887b40f9c35bdb49d146f166362f9 | <ide><path>activerecord/lib/active_record/migration.rb
<ide> def initialize(name = nil)
<ide> class PendingMigrationError < MigrationError#:nodoc:
<ide> def initialize(message = nil)
<ide> if !message && defined?(Rails.env)
<del> super("Migrations are pending. To resolve this issue, run:\n\n\tbin/rails db:migrate RAILS_ENV=#{::Rails.env}")
<add> super("Migrations are pending. To resolve this issue, run:\n\n bin/rails db:migrate RAILS_ENV=#{::Rails.env}")
<ide> elsif !message
<del> super("Migrations are pending. To resolve this issue, run:\n\n\tbin/rails db:migrate")
<add> super("Migrations are pending. To resolve this issue, run:\n\n bin/rails db:migrate")
<ide> else
<ide> super
<ide> end
<ide> def initialize(message = DEFAULT_MESSAGE)
<ide>
<ide> class NoEnvironmentInSchemaError < MigrationError #:nodoc:
<ide> def initialize
<del> msg = "Environment data not found in the schema. To resolve this issue, run: \n\n\tbin/rails db:environment:set"
<add> msg = "Environment data not found in the schema. To resolve this issue, run: \n\n bin/rails db:environment:set"
<ide> if defined?(Rails.env)
<ide> super("#{msg} RAILS_ENV=#{::Rails.env}")
<ide> else
<ide> def initialize(current: nil, stored: nil)
<ide> msg = "You are attempting to modify a database that was last run in `#{ stored }` environment.\n"
<ide> msg << "You are running in `#{ current }` environment. "
<ide> msg << "If you are sure you want to continue, first set the environment using:\n\n"
<del> msg << "\tbin/rails db:environment:set"
<add> msg << " bin/rails db:environment:set"
<ide> if defined?(Rails.env)
<ide> super("#{msg} RAILS_ENV=#{::Rails.env}\n\n")
<ide> else | 1 |
Ruby | Ruby | remove redundant var | 6944dfb5d0a292b1187704b88d78d2e07a31324e | <ide><path>activesupport/test/dependencies_test.rb
<ide> def test_const_missing_within_anonymous_module
<ide> m = Module.new
<ide> m.module_eval "def a() CountingLoader; end"
<ide> extend m
<del> kls = nil
<ide> with_autoloading_fixtures do
<ide> kls = nil
<ide> assert_nothing_raised { kls = a } | 1 |
Java | Java | allow parsing of media types with single-quotes | 7cdc53487d729c5ddbd23cde0b2d448db9faafae | <ide><path>spring-web/src/main/java/org/springframework/http/MediaType.java
<ide> else if (!isQuotedString(value)) {
<ide> }
<ide>
<ide> private boolean isQuotedString(String s) {
<del> return s.length() > 1 && s.startsWith("\"") && s.endsWith("\"") ;
<add> if (s.length() < 2) {
<add> return false;
<add> }
<add> else {
<add> return ((s.startsWith("\"") && s.endsWith("\"")) || (s.startsWith("'") && s.endsWith("'")));
<add> }
<ide> }
<ide>
<ide> private String unquote(String s) {
<ide><path>spring-web/src/test/java/org/springframework/http/MediaTypeTests.java
<ide> public void parseMediaTypeQuotedParameterValue() {
<ide> assertEquals("\"v>alue\"", mediaType.getParameter("attr"));
<ide> }
<ide>
<add> // SPR-8917
<add>
<add> @Test
<add> public void parseMediaTypeSingleQuotedParameterValue() {
<add> MediaType mediaType = MediaType.parseMediaType("audio/*;attr='v>alue'");
<add> assertEquals("'v>alue'", mediaType.getParameter("attr"));
<add> }
<add>
<ide> @Test(expected = IllegalArgumentException.class)
<ide> public void parseMediaTypeIllegalQuotedParameterValue() {
<ide> MediaType.parseMediaType("audio/*;attr=\""); | 2 |
PHP | PHP | fix cs errors | ddffdfffac49669efb51b7aadba8d832e595d564 | <ide><path>src/Database/Connection.php
<ide> public function enableSavePoints($enable)
<ide> /**
<ide> * Disables the usage of savepoints.
<ide> *
<del> * @param bool $enable Whether or not save points should be used.
<ide> * @return $this
<ide> */
<ide> public function disableSavePoints()
<ide><path>src/Database/Driver.php
<ide> public function enableAutoQuoting($enable = true)
<ide> *
<ide> * @return $this
<ide> */
<del>
<ide> public function disableAutoQuoting()
<ide> {
<ide> $this->_autoQuoting = false; | 2 |
Text | Text | update error handling operators docs | fba8b61b08f3f11e588ed2e7f7b3c183eb71eab8 | <ide><path>docs/Error-Handling-Operators.md
<del>There are a variety of operators that you can use to react to or recover from `onError` notifications from Observables. For example, you might:
<add>There are a variety of operators that you can use to react to or recover from `onError` notifications from reactive sources, such as `Observable`s. For example, you might:
<ide>
<ide> 1. swallow the error and switch over to a backup Observable to continue the sequence
<ide> 1. swallow the error and emit a default item
<ide> 1. swallow the error and immediately try to restart the failed Observable
<ide> 1. swallow the error and try to restart the failed Observable after some back-off interval
<ide>
<del>The following pages explain these operators.
<add># Outline
<ide>
<del>* [**`onErrorResumeNext( )`**](http://reactivex.io/documentation/operators/catch.html) — instructs an Observable to emit a sequence of items if it encounters an error
<del>* [**`onErrorReturn( )`**](http://reactivex.io/documentation/operators/catch.html) — instructs an Observable to emit a particular item when it encounters an error
<del>* [**`onExceptionResumeNext( )`**](http://reactivex.io/documentation/operators/catch.html) — instructs an Observable to continue emitting items after it encounters an exception (but not another variety of throwable)
<del>* [**`retry( )`**](http://reactivex.io/documentation/operators/retry.html) — if a source Observable emits an error, resubscribe to it in the hopes that it will complete without error
<del>* [**`retryWhen( )`**](http://reactivex.io/documentation/operators/retry.html) — if a source Observable emits an error, pass that error to another Observable to determine whether to resubscribe to the source
<ide>\ No newline at end of file
<add>- [`doOnError`](#doonerror)
<add>- [`onErrorComplete`](#onerrorcomplete)
<add>- [`onErrorResumeNext`](#onerrorresumenext)
<add>- [`onErrorReturn`](#onerrorreturn)
<add>- [`onErrorReturnItem`](#onerrorreturnitem)
<add>- [`onExceptionResumeNext`](#onexceptionresumenext)
<add>- [`retry`](#retry)
<add>- [`retryUntil`](#retryuntil)
<add>- [`retryWhen`](#retrywhen)
<add>
<add>## doOnError
<add>
<add>**Available in:**  `Flowable`,  `Observable`,  `Maybe`,  `Single`,  `Completable`
<add>
<add>**ReactiveX documentation:** [http://reactivex.io/documentation/operators/do.html](http://reactivex.io/documentation/operators/do.html)
<add>
<add>Instructs a reactive type to invoke the given `io.reactivex.functions.Consumer` when it encounters an error.
<add>
<add>### doOnError example
<add>
<add>```java
<add>Observable.error(new IOException("Something went wrong"))
<add> .doOnError(error -> System.err.println("The error message is: " + error.getMessage()))
<add> .subscribe(
<add> x -> System.out.println("onNext should never be printed!"),
<add> Throwable::printStackTrace,
<add> () -> System.out.println("onComplete should never be printed!"));
<add>```
<add>
<add>## onErrorComplete
<add>
<add>**Available in:**  `Flowable`,  `Observable`,  `Maybe`,  `Single`,  `Completable`
<add>
<add>**ReactiveX documentation:** [http://reactivex.io/documentation/operators/catch.html](http://reactivex.io/documentation/operators/catch.html)
<add>
<add>Instructs a reactive type to swallow an error event and replace it by a completion event.
<add>
<add>Optionally, a `io.reactivex.functions.Predicate` can be specified that gives more control over when an error event should be replaced by a completion event, and when not.
<add>
<add>### onErrorComplete example
<add>
<add>```java
<add>Completable.fromAction(() -> {
<add> throw new IOException();
<add>}).onErrorComplete(error -> {
<add> // Only ignore errors of type java.io.IOException.
<add> return error instanceof IOException;
<add>}).subscribe(
<add> () -> System.out.println("IOException was ignored"),
<add> error -> System.err.println("onError should not be printed!"));
<add>```
<add>
<add>## onErrorResumeNext
<add>
<add>**Available in:**  `Flowable`,  `Observable`,  `Maybe`,  `Single`,  `Completable`
<add>
<add>**ReactiveX documentation:** [http://reactivex.io/documentation/operators/catch.html](http://reactivex.io/documentation/operators/catch.html)
<add>
<add>Instructs a reactive type to emit a sequence of items if it encounters an error.
<add>
<add>### onErrorResumeNext example
<add>
<add>```java
<add> Observable<Integer> numbers = Observable.generate(() -> 1, (state, emitter) -> {
<add> emitter.onNext(state);
<add>
<add> return state + 1;
<add>});
<add>
<add>numbers.scan(Math::multiplyExact)
<add> .onErrorResumeNext(Observable.empty())
<add> .subscribe(
<add> System.out::println,
<add> error -> System.err.println("onError should not be printed!"));
<add>
<add>// prints:
<add>// 1
<add>// 2
<add>// 6
<add>// 24
<add>// 120
<add>// 720
<add>// 5040
<add>// 40320
<add>// 362880
<add>// 3628800
<add>// 39916800
<add>// 479001600
<add>```
<add>
<add>## onErrorReturn
<add>
<add>**Available in:**  `Flowable`,  `Observable`,  `Maybe`,  `Single`,  `Completable`
<add>
<add>**ReactiveX documentation:** [http://reactivex.io/documentation/operators/catch.html](http://reactivex.io/documentation/operators/catch.html)
<add>
<add>Instructs a reactive type to emit the item returned by the specified `io.reactivex.functions.Function` when it encounters an error.
<add>
<add>### onErrorReturn example
<add>
<add>```java
<add>Single.just("2A")
<add> .map(v -> Integer.parseInt(v, 10))
<add> .onErrorReturn(error -> {
<add> if (error instanceof NumberFormatException) return 0;
<add> else throw new IllegalArgumentException();
<add> })
<add> .subscribe(
<add> System.out::println,
<add> error -> System.err.println("onError should not be printed!"));
<add>
<add>// prints 0
<add>```
<add>
<add>## onErrorReturnItem
<add>
<add>**Available in:**  `Flowable`,  `Observable`,  `Maybe`,  `Single`,  `Completable`
<add>
<add>**ReactiveX documentation:** [http://reactivex.io/documentation/operators/catch.html](http://reactivex.io/documentation/operators/catch.html)
<add>
<add>Instructs a reactive type to emit a particular item when it encounters an error.
<add>
<add>### onErrorReturnItem example
<add>
<add>```java
<add>Single.just("2A")
<add> .map(v -> Integer.parseInt(v, 10))
<add> .onErrorReturnItem(0)
<add> .subscribe(
<add> System.out::println,
<add> error -> System.err.println("onError should not be printed!"));
<add>
<add>// prints 0
<add>```
<add>
<add>## onExceptionResumeNext
<add>
<add>**Available in:**  `Flowable`,  `Observable`,  `Maybe`,  `Single`,  `Completable`
<add>
<add>**ReactiveX documentation:** [http://reactivex.io/documentation/operators/catch.html](http://reactivex.io/documentation/operators/catch.html)
<add>
<add>Instructs a reactive type to continue emitting items after it encounters an `java.lang.Exception`. Unlike [`onErrorResumeNext`](#onerrorresumenext), this one lets other types of `Throwable` continue through.
<add>
<add>### onExceptionResumeNext example
<add>
<add>```java
<add>Observable<String> exception = Observable.<String>error(IOException::new)
<add> .onExceptionResumeNext(Observable.just("This value will be used to recover from the IOException"));
<add>
<add>Observable<String> error = Observable.<String>error(Error::new)
<add> .onExceptionResumeNext(Observable.just("This value will not be used"));
<add>
<add>Observable.concat(exception, error)
<add> .subscribe(
<add> message -> System.out.println("onNext: " + message),
<add> err -> System.err.println("onError: " + err));
<add>
<add>// prints:
<add>// onNext: This value will be used to recover from the IOException
<add>// onError: java.lang.Error
<add>```
<add>
<add>## retry
<add>
<add>**Available in:**  `Flowable`,  `Observable`,  `Maybe`,  `Single`,  `Completable`
<add>
<add>**ReactiveX documentation:** [http://reactivex.io/documentation/operators/retry.html](http://reactivex.io/documentation/operators/retry.html)
<add>
<add>Instructs a reactive type to resubscribe to the source reactive type if it encounters an error in the hopes that it will complete without error.
<add>
<add>### retry example
<add>
<add>```java
<add>Observable<Long> source = Observable.interval(0, 1, TimeUnit.SECONDS)
<add> .flatMap(x -> {
<add> if (x >= 2) return Observable.error(new IOException("Something went wrong!"));
<add> else return Observable.just(x);
<add> });
<add>
<add>source.retry((retryCount, error) -> retryCount < 3)
<add> .blockingSubscribe(
<add> x -> System.out.println("onNext: " + x),
<add> error -> System.err.println("onError: " + error.getMessage()));
<add>
<add>// prints:
<add>// onNext: 0
<add>// onNext: 1
<add>// onNext: 0
<add>// onNext: 1
<add>// onNext: 0
<add>// onNext: 1
<add>// onError: Something went wrong!
<add>```
<add>
<add>## retryUntil
<add>
<add>**Available in:**  `Flowable`,  `Observable`,  `Maybe`,  `Single`,  `Completable`
<add>
<add>**ReactiveX documentation:** [http://reactivex.io/documentation/operators/retry.html](http://reactivex.io/documentation/operators/retry.html)
<add>
<add>Instructs a reactive type to resubscribe to the source reactive type if it encounters an error until the given `io.reactivex.functions.BooleanSupplier` returns `true`.
<add>
<add>### retryUntil example
<add>
<add>```java
<add>LongAdder errorCounter = new LongAdder();
<add>Observable<Long> source = Observable.interval(0, 1, TimeUnit.SECONDS)
<add> .flatMap(x -> {
<add> if (x >= 2) return Observable.error(new IOException("Something went wrong!"));
<add> else return Observable.just(x);
<add> })
<add> .doOnError((error) -> errorCounter.increment());
<add>
<add>source.retryUntil(() -> errorCounter.intValue() >= 3)
<add> .blockingSubscribe(
<add> x -> System.out.println("onNext: " + x),
<add> error -> System.err.println("onError: " + error.getMessage()));
<add>
<add>// prints:
<add>// onNext: 0
<add>// onNext: 1
<add>// onNext: 0
<add>// onNext: 1
<add>// onNext: 0
<add>// onNext: 1
<add>// onError: Something went wrong!
<add>```
<add>
<add>## retryWhen
<add>
<add>**Available in:**  `Flowable`,  `Observable`,  `Maybe`,  `Single`,  `Completable`
<add>
<add>**ReactiveX documentation:** [http://reactivex.io/documentation/operators/retry.html](http://reactivex.io/documentation/operators/retry.html)
<add>
<add>Instructs a reactive type to pass any error to another `Observable` or `Flowable` to determine whether to resubscribe to the source.
<add>
<add>### retryWhen example
<add>
<add>```java
<add>Observable<Long> source = Observable.interval(0, 1, TimeUnit.SECONDS)
<add> .flatMap(x -> {
<add> if (x >= 2) return Observable.error(new IOException("Something went wrong!"));
<add> else return Observable.just(x);
<add> });
<add>
<add>source.retryWhen(errors -> {
<add> return errors.map(error -> 1)
<add>
<add> // Count the number of errors.
<add> .scan(Math::addExact)
<add>
<add> .doOnNext(errorCount -> System.out.println("No. of errors: " + errorCount))
<add>
<add> // Limit the maximum number of retries.
<add> .takeWhile(errorCount -> errorCount < 3)
<add>
<add> // Signal resubscribe event after some delay.
<add> .flatMapSingle(errorCount -> Single.timer(errorCount, TimeUnit.SECONDS));
<add>}).blockingSubscribe(
<add> x -> System.out.println("onNext: " + x),
<add> Throwable::printStackTrace,
<add> () -> System.out.println("onComplete"));
<add>
<add>// prints:
<add>// onNext: 0
<add>// onNext: 1
<add>// No. of errors: 1
<add>// onNext: 0
<add>// onNext: 1
<add>// No. of errors: 2
<add>// onNext: 0
<add>// onNext: 1
<add>// No. of errors: 3
<add>// onComplete
<add>``` | 1 |
Text | Text | remove reference to assets version option | fba2473a5baae4f70db0290a8d444c6b80586927 | <ide><path>guides/source/configuring.md
<ide> pipeline is enabled. It is set to true by default.
<ide>
<ide> * `config.assets.cache_store` defines the cache store that Sprockets will use. The default is the Rails file store.
<ide>
<del>* `config.assets.version` is an option string that is used in MD5 hash generation. This can be changed to force all files to be recompiled.
<del>
<ide> * `config.assets.compile` is a boolean that can be used to turn on live Sprockets compilation in production.
<ide>
<ide> * `config.assets.logger` accepts a logger conforming to the interface of Log4r or the default Ruby `Logger` class. Defaults to the same configured at `config.logger`. Setting `config.assets.logger` to false will turn off served assets logging. | 1 |
Ruby | Ruby | add flag to reset repository and taps | 857da689bfd513b11ea050102b00c69340a6fa90 | <ide><path>Library/Homebrew/cmd/test-bot.rb
<ide> # --dry-run: Just print commands, don't run them.
<ide> # --fail-fast: Immediately exit on a failing step.
<ide> #
<del># --ci-master: Shortcut for Homebrew master branch CI options.
<del># --ci-pr: Shortcut for Homebrew pull request CI options.
<del># --ci-testing: Shortcut for Homebrew testing CI options.
<del># --ci-upload: Homebrew CI bottle upload.
<add># --ci-master: Shortcut for Homebrew master branch CI options.
<add># --ci-pr: Shortcut for Homebrew pull request CI options.
<add># --ci-testing: Shortcut for Homebrew testing CI options.
<add># --ci-upload: Homebrew CI bottle upload.
<add># --ci-reset-and-update: Homebrew CI repository and tap reset and update.
<ide>
<ide> require 'formula'
<ide> require 'utils'
<ide> def test_bot
<ide> end
<ide> end
<ide>
<add> if ARGV.include? "--ci-reset-and-update"
<add> safe_system "git", "reset", "--hard"
<add> Dir.glob("#{HOMEBREW_LIBRARY}/Taps/*/*") do |tap|
<add> cd tap { safe_system "git", "reset", "--hard" }
<add> end
<add> safe_system "brew", "update"
<add> return
<add> end
<add>
<ide> if ARGV.include? '--ci-upload'
<ide> jenkins = ENV['JENKINS_HOME']
<ide> job = ENV['UPSTREAM_JOB_NAME'] | 1 |
Java | Java | introduce hasjavascriptexceptionmetadata interface | 6fb1690de12741d3f8cbb202d7898e86e62a252c | <ide><path>ReactAndroid/src/main/java/com/facebook/react/common/HasJavascriptExceptionMetadata.java
<add>/**
<add> * Copyright (c) Facebook, Inc. and its affiliates.
<add> *
<add> * <p>This source code is licensed under the MIT license found in the LICENSE file in the root
<add> * directory of this source tree.
<add> */
<add>package com.facebook.react.common;
<add>
<add>import javax.annotation.Nullable;
<add>
<add>/** A JS exception carrying metadata. */
<add>public interface HasJavascriptExceptionMetadata {
<add>
<add> @Nullable
<add> String getExtraDataAsJson();
<add>}
<ide><path>ReactAndroid/src/main/java/com/facebook/react/common/JavascriptException.java
<ide> */
<ide> package com.facebook.react.common;
<ide>
<add>import javax.annotation.Nullable;
<add>
<ide> /**
<ide> * A JS exception that was propagated to native. In debug mode, these exceptions are normally shown
<ide> * to developers in a redbox.
<ide> */
<del>public class JavascriptException extends RuntimeException {
<add>public class JavascriptException extends RuntimeException
<add> implements HasJavascriptExceptionMetadata {
<add>
<add> private @Nullable String extraDataAsJson;
<ide>
<ide> public JavascriptException(String jsStackTrace) {
<ide> super(jsStackTrace);
<ide> }
<add>
<add> public @Nullable String getExtraDataAsJson() {
<add> return this.extraDataAsJson;
<add> }
<add>
<add> public JavascriptException setExtraDataAsJson(@Nullable String extraDataAsJson) {
<add> this.extraDataAsJson = extraDataAsJson;
<add> return this;
<add> }
<ide> } | 2 |
PHP | PHP | remove extra code | 472a93f8710c7783af89ee93b243439e6331eb5c | <ide><path>src/Illuminate/Container/Container.php
<ide> public function when($concrete)
<ide> */
<ide> protected function resolvable($abstract)
<ide> {
<del> return $this->bound($abstract) || $this->isAlias($abstract);
<add> return $this->bound($abstract);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | cover cluster error during dgram socket bind | d3be0f88181b4904f5ceddb88043ef589d777c45 | <ide><path>test/parallel/test-dgram-cluster-bind-error.js
<add>'use strict';
<add>const common = require('../common');
<add>const assert = require('assert');
<add>const cluster = require('cluster');
<add>const dgram = require('dgram');
<add>const { UV_UNKNOWN } = process.binding('uv');
<add>
<add>if (cluster.isMaster) {
<add> cluster.fork();
<add>} else {
<add> // When the socket attempts to bind, it requests a handle from the cluster.
<add> // Force the cluster to send back an error code.
<add> cluster._getServer = function(self, options, callback) {
<add> callback(UV_UNKNOWN);
<add> };
<add>
<add> const socket = dgram.createSocket('udp4');
<add>
<add> socket.on('error', common.mustCall((err) => {
<add> assert(/^Error: bind UNKNOWN 0.0.0.0$/.test(err.toString()));
<add> process.nextTick(common.mustCall(() => {
<add> assert.strictEqual(socket._bindState, 0); // BIND_STATE_UNBOUND
<add> socket.close();
<add> cluster.worker.disconnect();
<add> }));
<add> }));
<add>
<add> socket.bind(common.mustNotCall('Socket should not bind.'));
<add>} | 1 |
PHP | PHP | add fieldnames() to form contexts | 8451e716b62be21ee61ebb6a4d9a70676343e39f | <ide><path>src/View/Form/ArrayContext.php
<ide> public function isRequired($field) {
<ide> return (bool)$required;
<ide> }
<ide>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function fieldNames() {
<add> $schema = $this->_context['schema'];
<add> unset($schema['_constraints'], $schema['_indexes']);
<add> return array_keys($schema);
<add> }
<add>
<ide> /**
<ide> * Get the abstract field type for a given field name.
<ide> *
<ide><path>src/View/Form/ContextInterface.php
<ide> public function val($field);
<ide> */
<ide> public function isRequired($field);
<ide>
<add>/**
<add> * Get the fieldnames of the top level object in this context.
<add> *
<add> * @return array A list of the field names in the context.
<add> */
<add> public function fieldNames();
<add>
<ide> /**
<ide> * Get the abstract field type for a given field name.
<ide> *
<ide><path>src/View/Form/EntityContext.php
<ide> public function isRequired($field) {
<ide> return $allowed === false;
<ide> }
<ide>
<add>/**
<add> * Get the field names from the top level entity.
<add> *
<add> * If the context is for an array of entities, the 0th index will be used.
<add> *
<add> * @return array Array of fieldnames in the table/entity.
<add> */
<add> public function fieldNames() {
<add> $table = $this->_getTable('0');
<add> return $table->schema()->columns();
<add> }
<add>
<ide> /**
<ide> * Get the validator associated to an entity based on naming
<ide> * conventions.
<ide><path>src/View/Form/NullContext.php
<ide> public function isRequired($field) {
<ide> return false;
<ide> }
<ide>
<add>/**
<add> * {@inheritDoc}
<add> */
<add> public function fieldNames() {
<add> return [];
<add> }
<add>
<ide> /**
<ide> * {@inheritDoc}
<ide> */
<ide><path>tests/TestCase/View/Form/EntityContextTest.php
<ide> protected function _setupTables() {
<ide> $comments->validator('custom', $validator);
<ide> }
<ide>
<add>/**
<add> * Test the fieldnames method.
<add> *
<add> * @return void
<add> */
<add> public function testFieldNames() {
<add> $context = new EntityContext($this->request, [
<add> 'entity' => new Entity(),
<add> 'table' => 'Articles',
<add> ]);
<add> $articles = TableRegistry::get('Articles');
<add> $this->assertEquals($articles->schema()->columns(), $context->fieldNames());
<add> }
<add>
<ide> } | 5 |
Javascript | Javascript | remove unused function | 5cc1428d5f7a8c72e12d7346488b87390f995a5d | <ide><path>src/node.js
<ide> var module = (function () {
<ide> };
<ide>
<ide>
<del> function cat (id) {
<del> requireNative('fs').readFile(id, 'utf8');
<del> }
<del>
<del>
<ide> // Returns exception if any
<ide> Module.prototype._compile = function (content, filename) {
<ide> var self = this; | 1 |
Python | Python | remove httplib wrapper and start on requests | b2f5b22622c6fde7c3085afd2e339bdb2eb69f81 | <ide><path>libcloud/httplib_ssl.py
<ide> verification, depending on libcloud.security settings.
<ide> """
<ide> import os
<del>import sys
<ide> import socket
<del>import ssl
<ide> import base64
<ide> import warnings
<ide>
<add>import requests
<add>
<ide> import libcloud.security
<ide> from libcloud.utils.py3 import b
<ide> from libcloud.utils.py3 import httplib
<ide> from libcloud.utils.py3 import urlparse
<ide> from libcloud.utils.py3 import urlunquote
<del>from libcloud.utils.py3 import match_hostname
<del>from libcloud.utils.py3 import CertificateError
<ide>
<ide>
<ide> __all__ = [
<ide> def _set_hostport(self, host, port):
<ide> self.port = port
<ide>
<ide>
<del>class LibcloudHTTPConnection(httplib.HTTPConnection, LibcloudBaseConnection):
<add>class LibcloudHTTPConnection(LibcloudBaseConnection):
<ide> def __init__(self, *args, **kwargs):
<ide> # Support for HTTP proxy
<ide> proxy_url_env = os.environ.get(HTTP_PROXY_ENV_VARIABLE_NAME, None)
<ide> def __init__(self, *args, **kwargs):
<ide> if proxy_url:
<ide> self.set_http_proxy(proxy_url=proxy_url)
<ide>
<add> def connect():
<add> pass
<add>
<add> def request(method, url, body=None, headers=None):
<add> method = method.lower()
<add> if method == 'get':
<add> response = requests.get(url, headers=headers)
<add> elif method == 'post':
<add> response = requests.post(url, data=body, headers=headers)
<add> elif method == 'head':
<add> response = requests.head(url, headers=headers)
<add> return response
<add>
<ide>
<del>class LibcloudHTTPSConnection(httplib.HTTPSConnection, LibcloudBaseConnection):
<add>class LibcloudHTTPSConnection(LibcloudBaseConnection):
<ide> """
<ide> LibcloudHTTPSConnection
<ide>
<ide> def _setup_ca_cert(self):
<ide> libcloud.security.CA_CERTS_UNAVAILABLE_ERROR_MSG)
<ide>
<ide> def connect(self):
<del> """
<del> Connect
<del>
<del> Checks if verification is toggled; if not, just call
<del> httplib.HTTPSConnection's connect
<del> """
<del> if not self.verify:
<del> return httplib.HTTPSConnection.connect(self)
<del>
<del> # otherwise, create a connection and verify the hostname
<del> # use socket.create_connection (in 2.6+) if possible
<del> if getattr(socket, 'create_connection', None):
<del> sock = socket.create_connection((self.host, self.port),
<del> self.timeout)
<del> else:
<del> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
<del> sock.connect((self.host, self.port))
<del>
<del> # Activate the HTTP proxy
<del> if self.http_proxy_used:
<del> self._activate_http_proxy(sock=sock)
<del>
<del> ssl_version = libcloud.security.SSL_VERSION
<del>
<del> try:
<del> self.sock = ssl.wrap_socket(
<del> sock,
<del> self.key_file,
<del> self.cert_file,
<del> cert_reqs=ssl.CERT_REQUIRED,
<del> ca_certs=self.ca_cert,
<del> ssl_version=ssl_version)
<del> except socket.error:
<del> exc = sys.exc_info()[1]
<del> # Re-throw an exception with a more friendly error message
<del> exc = get_socket_error_exception(ssl_version=ssl_version, exc=exc)
<del> raise exc
<del>
<del> cert = self.sock.getpeercert()
<del> try:
<del> match_hostname(cert, self.host)
<del> except CertificateError:
<del> e = sys.exc_info()[1]
<del> raise ssl.SSLError('Failed to verify hostname: %s' % (str(e)))
<add> pass
<add>
<add> def request(method, url, body=None, headers=None):
<add> method = method.lower()
<add> if method == 'get':
<add> response = requests.get(url, headers=headers)
<add> elif method == 'post':
<add> response = requests.post(url, data=body, headers=headers)
<add> elif method == 'head':
<add> response = requests.head(url, headers=headers)
<add> return response
<ide>
<ide>
<ide> def get_socket_error_exception(ssl_version, exc): | 1 |
Python | Python | add test_connection method to airbyte hook | 75c91b4acf1ed45d6ccf60a6e1326700233a4f05 | <ide><path>airflow/providers/airbyte/hooks/airbyte.py
<ide> def get_job(self, job_id: int) -> Any:
<ide> json={"id": job_id},
<ide> headers={"accept": "application/json"},
<ide> )
<add>
<add> def test_connection(self):
<add> """Tests the Airbyte connection by hitting the health API"""
<add> self.method = 'GET'
<add> try:
<add> res = self.run(
<add> endpoint=f"api/{self.api_version}/health",
<add> headers={"accept": "application/json"},
<add> extra_options={'check_response': False},
<add> )
<add>
<add> if res.status_code == 200:
<add> return True, 'Connection successfully tested'
<add> else:
<add> return False, res.text
<add> except Exception as e: # noqa pylint: disable=broad-except
<add> return False, str(e)
<add> finally:
<add> self.method = 'POST'
<ide><path>tests/providers/airbyte/hooks/test_airbyte.py
<ide> class TestAirbyteHook(unittest.TestCase):
<ide> job_id = 1
<ide> sync_connection_endpoint = 'http://test-airbyte:8001/api/v1/connections/sync'
<ide> get_job_endpoint = 'http://test-airbyte:8001/api/v1/jobs/get'
<add> health_endpoint = 'http://test-airbyte:8001/api/v1/health'
<ide> _mock_sync_conn_success_response_body = {'job': {'id': 1}}
<ide> _mock_job_status_success_response_body = {'job': {'status': 'succeeded'}}
<ide>
<ide> def test_wait_for_job_cancelled(self, mock_get_job):
<ide>
<ide> calls = [mock.call(job_id=self.job_id), mock.call(job_id=self.job_id)]
<ide> assert mock_get_job.has_calls(calls)
<add>
<add> @requests_mock.mock()
<add> def test_connection_success(self, m):
<add> m.get(self.health_endpoint, status_code=200,)
<add>
<add> status, msg = self.hook.test_connection()
<add> assert status is True
<add> assert msg == 'Connection successfully tested'
<add>
<add> @requests_mock.mock()
<add> def test_connection_failure(self, m):
<add> m.get(self.health_endpoint, status_code=500, json={"message": "internal server error"})
<add>
<add> status, msg = self.hook.test_connection()
<add> assert status is False
<add> assert msg == '{"message": "internal server error"}' | 2 |
PHP | PHP | fix property declaration | c1a93e93605e1fdfa9947281f30c6ddb0d5eecef | <ide><path>lib/Cake/Network/Http/Cookies.php
<ide> class Cookies {
<ide> *
<ide> * @var array
<ide> */
<del> protected $cookies = [];
<add> protected $_cookies = [];
<ide>
<ide> /**
<ide> * Store the cookies from a response. | 1 |
Text | Text | move instructions out of requirements | f3d36a9726deffa47df4b452ca2cef020b799c40 | <ide><path>docs/build-instructions/windows.md
<ide> * [node.js](http://nodejs.org/download/) v0.10.x
<ide> * [Python](http://www.python.org/download/) v2.7.x
<ide> * [GitHub for Windows](http://windows.github.com/)
<del> * Log in to the GitHub for Windows GUI App
<del> * Open the `Git Shell` app which was installed by GitHub for Windows.
<ide>
<ide> ## Instructions
<ide>
<ide> ```bat
<add> # Use the `Git Shell` app which was installed by GitHub for Windows. Make sure
<add> # you have logged into the GitHub for Windows GUI App.
<ide> git clone https://github.com/atom/atom/
<ide> cd atom
<ide> script\build | 1 |
Javascript | Javascript | use parsecommandline in atom-application-test.js | 52ea92803dec1f457ad38a86089f98a11ee012eb | <ide><path>spec/main-process/atom-application.test.js
<ide> import fs from 'fs-plus'
<ide> import path from 'path'
<ide> import temp from 'temp'
<ide> import AtomApplication from '../../src/main-process/atom-application'
<add>import parseCommandLine from '../../src/main-process/parse-command-line'
<ide>
<ide> const ATOM_RESOURCE_PATH = path.resolve(__dirname, '..', '..')
<ide>
<ide> describe('AtomApplication', function () {
<ide>
<ide> const atomApplication = buildAtomApplication()
<ide>
<del> const window1 = atomApplication.openWithOptions({pathsToOpen: [], urlsToOpen: [], windowDimensions: {x: 0, y: 0, width: 100, height: 100}})
<add> const window1 = atomApplication.openWithOptions(parseCommandLine([]))
<ide> await window1.loadedPromise
<ide> window1.browserWindow.setBounds({width: 400, height: 400, x: 0, y: 0})
<ide>
<del> const window2 = atomApplication.openWithOptions({pathsToOpen: [], urlsToOpen: []})
<add> const window2 = atomApplication.openWithOptions(parseCommandLine([]))
<ide> await window2.loadedPromise
<ide>
<ide> window1Dimensions = window1.getDimensions() | 1 |
Go | Go | add compat 1.8 | 3a610f754f425ea6042c3f8b5452273656a06c90 | <ide><path>api.go
<ide> import (
<ide> )
<ide>
<ide> const (
<del> APIVERSION = 1.8
<add> APIVERSION = 1.9
<ide> DEFAULTHTTPHOST = "127.0.0.1"
<ide> DEFAULTHTTPPORT = 4243
<ide> DEFAULTUNIXSOCKET = "/var/run/docker.sock"
<ide> func getImagesJSON(srv *Server, version float64, w http.ResponseWriter, r *http.
<ide> if err := parseForm(r); err != nil {
<ide> return err
<ide> }
<del> fmt.Printf("getImagesJSON\n")
<ide> job := srv.Eng.Job("images")
<ide> job.Setenv("filter", r.Form.Get("filter"))
<ide> job.Setenv("all", r.Form.Get("all"))
<del> // FIXME: 1.7 clients expect a single json list
<add> job.SetenvBool("list", version <= 1.8)
<ide> job.Stdout.Add(w)
<ide> w.WriteHeader(http.StatusOK)
<del> fmt.Printf("running images job\n")
<ide> if err := job.Run(); err != nil {
<ide> return err
<ide> }
<del> fmt.Printf("job has been run\n")
<ide> return nil
<ide> }
<ide>
<ide><path>commands.go
<ide> func (cli *DockerCli) CmdImages(args ...string) error {
<ide> return err
<ide> }
<ide>
<del> var outs []APIImages
<del> if err := json.Unmarshal(body, &outs); err != nil {
<add> outs := engine.NewTable("Created", 0)
<add>
<add> if _, err := outs.ReadFrom(bytes.NewReader(body)); err != nil {
<ide> return err
<ide> }
<ide>
<ide> var (
<del> printNode func(cli *DockerCli, noTrunc bool, image APIImages, prefix string)
<del> startImage APIImages
<add> printNode func(cli *DockerCli, noTrunc bool, image *engine.Env, prefix string)
<add> startImage *engine.Env
<ide>
<del> roots []APIImages
<del> byParent = make(map[string][]APIImages)
<add> roots = engine.NewTable("Created", outs.Len())
<add> byParent = make(map[string]*engine.Table)
<ide> )
<ide>
<del> for _, image := range outs {
<del> if image.ParentId == "" {
<del> roots = append(roots, image)
<add> for _, image := range outs.Data {
<add> if image.Get("ParentId") == "" {
<add> roots.Add(image)
<ide> } else {
<del> if children, exists := byParent[image.ParentId]; exists {
<del> byParent[image.ParentId] = append(children, image)
<add> if children, exists := byParent[image.Get("ParentId")]; exists {
<add> children.Add(image)
<ide> } else {
<del> byParent[image.ParentId] = []APIImages{image}
<add> byParent[image.Get("ParentId")] = engine.NewTable("Created", 1)
<add> byParent[image.Get("ParentId")].Add(image)
<ide> }
<ide> }
<ide>
<ide> if filter != "" {
<del> if filter == image.ID || filter == utils.TruncateID(image.ID) {
<add> if filter == image.Get("ID") || filter == utils.TruncateID(image.Get("ID")) {
<ide> startImage = image
<ide> }
<ide>
<del> for _, repotag := range image.RepoTags {
<add> for _, repotag := range image.GetList("RepoTags") {
<ide> if repotag == filter {
<ide> startImage = image
<ide> }
<ide> func (cli *DockerCli) CmdImages(args ...string) error {
<ide> printNode = (*DockerCli).printTreeNode
<ide> }
<ide>
<del> if startImage.ID != "" {
<del> cli.WalkTree(*noTrunc, &[]APIImages{startImage}, byParent, "", printNode)
<add> if startImage != nil {
<add> root := engine.NewTable("Created", 1)
<add> root.Add(startImage)
<add> cli.WalkTree(*noTrunc, root, byParent, "", printNode)
<ide> } else if filter == "" {
<del> cli.WalkTree(*noTrunc, &roots, byParent, "", printNode)
<add> cli.WalkTree(*noTrunc, roots, byParent, "", printNode)
<ide> }
<ide> if *flViz {
<ide> fmt.Fprintf(cli.out, " base [style=invisible]\n}\n")
<ide> func (cli *DockerCli) CmdImages(args ...string) error {
<ide> return err
<ide> }
<ide>
<del> var outs []APIImages
<del> err = json.Unmarshal(body, &outs)
<del> if err != nil {
<add> outs := engine.NewTable("Created", 0)
<add> if _, err := outs.ReadFrom(bytes.NewReader(body)); err != nil {
<ide> return err
<ide> }
<ide>
<ide> func (cli *DockerCli) CmdImages(args ...string) error {
<ide> fmt.Fprintln(w, "REPOSITORY\tTAG\tIMAGE ID\tCREATED\tVIRTUAL SIZE")
<ide> }
<ide>
<del> for _, out := range outs {
<del> for _, repotag := range out.RepoTags {
<add> for _, out := range outs.Data {
<add> for _, repotag := range out.GetList("RepoTags") {
<ide>
<ide> repo, tag := utils.ParseRepositoryTag(repotag)
<del>
<add> outID := out.Get("ID")
<ide> if !*noTrunc {
<del> out.ID = utils.TruncateID(out.ID)
<add> outID = utils.TruncateID(outID)
<ide> }
<ide>
<ide> if !*quiet {
<del> fmt.Fprintf(w, "%s\t%s\t%s\t%s ago\t%s\n", repo, tag, out.ID, utils.HumanDuration(time.Now().UTC().Sub(time.Unix(out.Created, 0))), utils.HumanSize(out.VirtualSize))
<add> fmt.Fprintf(w, "%s\t%s\t%s\t%s ago\t%s\n", repo, tag, outID, utils.HumanDuration(time.Now().UTC().Sub(time.Unix(out.GetInt64("Created"), 0))), utils.HumanSize(out.GetInt64("VirtualSize")))
<ide> } else {
<del> fmt.Fprintln(w, out.ID)
<add> fmt.Fprintln(w, outID)
<ide> }
<ide> }
<ide> }
<ide> func (cli *DockerCli) CmdImages(args ...string) error {
<ide> return nil
<ide> }
<ide>
<del>func (cli *DockerCli) WalkTree(noTrunc bool, images *[]APIImages, byParent map[string][]APIImages, prefix string, printNode func(cli *DockerCli, noTrunc bool, image APIImages, prefix string)) {
<del> length := len(*images)
<add>func (cli *DockerCli) WalkTree(noTrunc bool, images *engine.Table, byParent map[string]*engine.Table, prefix string, printNode func(cli *DockerCli, noTrunc bool, image *engine.Env, prefix string)) {
<add> length := images.Len()
<ide> if length > 1 {
<del> for index, image := range *images {
<add> for index, image := range images.Data {
<ide> if index+1 == length {
<ide> printNode(cli, noTrunc, image, prefix+"└─")
<del> if subimages, exists := byParent[image.ID]; exists {
<del> cli.WalkTree(noTrunc, &subimages, byParent, prefix+" ", printNode)
<add> if subimages, exists := byParent[image.Get("ID")]; exists {
<add> cli.WalkTree(noTrunc, subimages, byParent, prefix+" ", printNode)
<ide> }
<ide> } else {
<del> printNode(cli, noTrunc, image, prefix+"├─")
<del> if subimages, exists := byParent[image.ID]; exists {
<del> cli.WalkTree(noTrunc, &subimages, byParent, prefix+"│ ", printNode)
<add> printNode(cli, noTrunc, image, prefix+"\u251C─")
<add> if subimages, exists := byParent[image.Get("ID")]; exists {
<add> cli.WalkTree(noTrunc, subimages, byParent, prefix+"\u2502 ", printNode)
<ide> }
<ide> }
<ide> }
<ide> } else {
<del> for _, image := range *images {
<add> for _, image := range images.Data {
<ide> printNode(cli, noTrunc, image, prefix+"└─")
<del> if subimages, exists := byParent[image.ID]; exists {
<del> cli.WalkTree(noTrunc, &subimages, byParent, prefix+" ", printNode)
<add> if subimages, exists := byParent[image.Get("ID")]; exists {
<add> cli.WalkTree(noTrunc, subimages, byParent, prefix+" ", printNode)
<ide> }
<ide> }
<ide> }
<ide> }
<ide>
<del>func (cli *DockerCli) printVizNode(noTrunc bool, image APIImages, prefix string) {
<add>func (cli *DockerCli) printVizNode(noTrunc bool, image *engine.Env, prefix string) {
<ide> var (
<ide> imageID string
<ide> parentID string
<ide> )
<ide> if noTrunc {
<del> imageID = image.ID
<del> parentID = image.ParentId
<add> imageID = image.Get("ID")
<add> parentID = image.Get("ParentId")
<ide> } else {
<del> imageID = utils.TruncateID(image.ID)
<del> parentID = utils.TruncateID(image.ParentId)
<add> imageID = utils.TruncateID(image.Get("ID"))
<add> parentID = utils.TruncateID(image.Get("ParentId"))
<ide> }
<del> if image.ParentId == "" {
<add> if parentID == "" {
<ide> fmt.Fprintf(cli.out, " base -> \"%s\" [style=invis]\n", imageID)
<ide> } else {
<ide> fmt.Fprintf(cli.out, " \"%s\" -> \"%s\"\n", parentID, imageID)
<ide> }
<del> if image.RepoTags[0] != "<none>:<none>" {
<add> if image.GetList("RepoTags")[0] != "<none>:<none>" {
<ide> fmt.Fprintf(cli.out, " \"%s\" [label=\"%s\\n%s\",shape=box,fillcolor=\"paleturquoise\",style=\"filled,rounded\"];\n",
<del> imageID, imageID, strings.Join(image.RepoTags, "\\n"))
<add> imageID, imageID, strings.Join(image.GetList("RepoTags"), "\\n"))
<ide> }
<ide> }
<ide>
<del>func (cli *DockerCli) printTreeNode(noTrunc bool, image APIImages, prefix string) {
<add>func (cli *DockerCli) printTreeNode(noTrunc bool, image *engine.Env, prefix string) {
<ide> var imageID string
<ide> if noTrunc {
<del> imageID = image.ID
<add> imageID = image.Get("ID")
<ide> } else {
<del> imageID = utils.TruncateID(image.ID)
<add> imageID = utils.TruncateID(image.Get("ID"))
<ide> }
<ide>
<del> fmt.Fprintf(cli.out, "%s%s Virtual Size: %s", prefix, imageID, utils.HumanSize(image.VirtualSize))
<del> if image.RepoTags[0] != "<none>:<none>" {
<del> fmt.Fprintf(cli.out, " Tags: %s\n", strings.Join(image.RepoTags, ", "))
<add> fmt.Fprintf(cli.out, "%s%s Virtual Size: %s", prefix, imageID, utils.HumanSize(image.GetInt64("VirtualSize")))
<add> if image.GetList("RepoTags")[0] != "<none>:<none>" {
<add> fmt.Fprintf(cli.out, " Tags: %s\n", strings.Join(image.GetList("RepoTags"), ", "))
<ide> } else {
<ide> fmt.Fprint(cli.out, "\n")
<ide> }
<ide><path>engine/env.go
<ide> func (env *Env) Map() map[string]string {
<ide> type Table struct {
<ide> Data []*Env
<ide> sortKey string
<add> Chan chan *Env
<ide> }
<ide>
<ide> func NewTable(sortKey string, sizeHint int) *Table {
<ide> return &Table{
<ide> make([]*Env, 0, sizeHint),
<ide> sortKey,
<add> make(chan *Env),
<ide> }
<ide> }
<ide>
<add>func (t *Table) SetKey(sortKey string) {
<add> t.sortKey = sortKey
<add>}
<add>
<ide> func (t *Table) Add(env *Env) {
<ide> t.Data = append(t.Data, env)
<ide> }
<ide> func (t *Table) Sort() {
<ide> sort.Sort(t)
<ide> }
<ide>
<del>func (t *Table) WriteTo(dst io.Writer) (n int64, err error) {
<del> for _, env := range t.Data {
<add>func (t *Table) ReverseSort() {
<add> sort.Sort(sort.Reverse(t))
<add>}
<add>
<add>func (t *Table) WriteListTo(dst io.Writer) (n int64, err error) {
<add> if _, err := dst.Write([]byte{'['}); err != nil {
<add> return -1, err
<add> }
<add> n = 1
<add> for i, env := range t.Data {
<ide> bytes, err := env.WriteTo(dst)
<ide> if err != nil {
<ide> return -1, err
<ide> }
<del> if _, err := dst.Write([]byte{'\n'}); err != nil {
<add> n += bytes
<add> if i != len(t.Data)-1 {
<add> if _, err := dst.Write([]byte{','}); err != nil {
<add> return -1, err
<add> }
<add> n += 1
<add> }
<add> }
<add> if _, err := dst.Write([]byte{']'}); err != nil {
<add> return -1, err
<add> }
<add> return n + 1, nil
<add>}
<add>
<add>func (t *Table) WriteTo(dst io.Writer) (n int64, err error) {
<add> for _, env := range t.Data {
<add> bytes, err := env.WriteTo(dst)
<add> if err != nil {
<ide> return -1, err
<ide> }
<del> n += bytes + 1
<add> n += bytes
<ide> }
<ide> return n, nil
<ide> }
<ide><path>integration/api_test.go
<ide> func TestGetImagesJSON(t *testing.T) {
<ide> }
<ide> assertHttpNotError(r2, t)
<ide>
<del> images2 := []docker.APIImages{}
<del> if err := json.Unmarshal(r2.Body.Bytes(), &images2); err != nil {
<add> images2 := engine.NewTable("ID", 0)
<add> if _, err := images2.ReadFrom(r2.Body); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide>
<del> if len(images2) != initialImages.Len() {
<del> t.Errorf("Expected %d image, %d found", initialImages.Len(), len(images2))
<add> if images2.Len() != initialImages.Len() {
<add> t.Errorf("Expected %d image, %d found", initialImages.Len(), images2.Len())
<ide> }
<ide>
<ide> found = false
<del> for _, img := range images2 {
<del> if img.ID == unitTestImageID {
<add> for _, img := range images2.Data {
<add> if img.Get("ID") == unitTestImageID {
<ide> found = true
<ide> break
<ide> }
<ide> func TestGetImagesJSON(t *testing.T) {
<ide> }
<ide> assertHttpNotError(r3, t)
<ide>
<del> images3 := []docker.APIImages{}
<del> if err := json.Unmarshal(r3.Body.Bytes(), &images3); err != nil {
<add> images3 := engine.NewTable("ID", 0)
<add> if _, err := images3.ReadFrom(r3.Body); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide>
<del> if len(images3) != 0 {
<del> t.Errorf("Expected 0 image, %d found", len(images3))
<del> }
<del>
<del> r4 := httptest.NewRecorder()
<del>
<del> // all=foobar
<del> req4, err := http.NewRequest("GET", "/images/json?all=foobar", nil)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> if err := docker.ServeRequest(srv, docker.APIVERSION, r4, req4); err != nil {
<del> t.Fatal(err)
<del> }
<del> // Don't assert against HTTP error since we expect an error
<del> if r4.Code != http.StatusBadRequest {
<del> t.Fatalf("%d Bad Request expected, received %d\n", http.StatusBadRequest, r4.Code)
<add> if images3.Len() != 0 {
<add> t.Errorf("Expected 0 image, %d found", images3.Len())
<ide> }
<ide> }
<ide>
<ide> func TestDeleteImages(t *testing.T) {
<ide>
<ide> images := getImages(eng, t, true, "")
<ide>
<del> if images.Len() != initialImages.Len()+1 {
<del> t.Errorf("Expected %d images, %d found", initialImages.Len()+1, images.Len())
<add> if len(images.Data[0].GetList("RepoTags")) != len(initialImages.Data[0].GetList("RepoTags"))+1 {
<add> t.Errorf("Expected %d images, %d found", len(initialImages.Data[0].GetList("RepoTags"))+1, len(images.Data[0].GetList("RepoTags")))
<ide> }
<ide>
<ide> req, err := http.NewRequest("DELETE", "/images/"+unitTestImageID, nil)
<ide><path>integration/server_test.go
<ide> func TestImagesFilter(t *testing.T) {
<ide> eng := NewTestEngine(t)
<ide> defer nuke(mkRuntimeFromEngine(eng, t))
<ide>
<del> srv := mkServerFromEngine(eng, t)
<del>
<ide> if err := eng.Job("tag", unitTestImageName, "utest", "tag1").Run(); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide><path>integration/sorter_test.go
<ide> func TestServerListOrderedImagesByCreationDateAndTag(t *testing.T) {
<ide>
<ide> images := getImages(eng, t, true, "")
<ide>
<del> if images.Data[0].GetList("RepoTags")[0] != "repo:zed" && images.Data[0].GetList("RepoTags")[0] != "repo:bar" {
<del> t.Errorf("Expected []APIImges to be ordered by most recent creation date. %s", images)
<add> if repoTags := images.Data[0].GetList("RepoTags"); repoTags[0] != "repo:zed" && repoTags[0] != "repo:bar" {
<add> t.Errorf("Expected Images to be ordered by most recent creation date.")
<ide> }
<ide> }
<ide>
<ide><path>server.go
<ide> func (srv *Server) ImagesViz(out io.Writer) error {
<ide> }
<ide>
<ide> func (srv *Server) Images(job *engine.Job) engine.Status {
<del> fmt.Printf("Images()\n")
<del> srv.Eng.Job("version").Run()
<ide> var (
<ide> allImages map[string]*Image
<ide> err error
<ide> func (srv *Server) Images(job *engine.Job) engine.Status {
<ide> }
<ide> }
<ide>
<del> outs.Sort()
<del> job.Logf("Sending %d images to stdout", outs.Len())
<del> if n, err := outs.WriteTo(job.Stdout); err != nil {
<add> outs.ReverseSort()
<add> if job.GetenvBool("list") {
<add> if _, err := outs.WriteListTo(job.Stdout); err != nil {
<add> job.Errorf("%s", err)
<add> return engine.StatusErr
<add> }
<add> } else if _, err := outs.WriteTo(job.Stdout); err != nil {
<ide> job.Errorf("%s", err)
<ide> return engine.StatusErr
<del> } else {
<del> job.Logf("%d bytes sent", n)
<ide> }
<ide> return engine.StatusOK
<ide> } | 7 |
Python | Python | add connection arguments in s3tosnowflakeoperator | dbf751112f3f978b1e21ffb91d696035c5e0109c | <ide><path>airflow/providers/snowflake/transfers/s3_to_snowflake.py
<ide> class S3ToSnowflakeOperator(BaseOperator):
<ide> :type s3_keys: list
<ide> :param table: reference to a specific table in snowflake database
<ide> :type table: str
<del> :param stage: reference to a specific snowflake stage
<add> :param schema: name of schema (will overwrite schema defined in
<add> connection)
<add> :type schema: str
<add> :param stage: reference to a specific snowflake stage. If the stage's schema is not the same as the
<add> table one, it must be specified
<ide> :type stage: str
<ide> :param file_format: reference to a specific file format
<ide> :type file_format: str
<del> :param schema: reference to a specific schema in snowflake database
<del> :type schema: str
<add> :param warehouse: name of warehouse (will overwrite any warehouse
<add> defined in the connection's extra JSON)
<add> :type warehouse: str
<add> :param database: reference to a specific database in Snowflake connection
<add> :type database: str
<ide> :param columns_array: reference to a specific columns array in snowflake database
<ide> :type columns_array: list
<del> :param snowflake_conn_id: reference to a specific snowflake database
<add> :param snowflake_conn_id: reference to a specific snowflake connection
<ide> :type snowflake_conn_id: str
<add> :param role: name of role (will overwrite any role defined in
<add> connection's extra JSON)
<add> :type role: str
<add> :param authenticator: authenticator for Snowflake.
<add> 'snowflake' (default) to use the internal Snowflake authenticator
<add> 'externalbrowser' to authenticate using your web browser and
<add> Okta, ADFS or any other SAML 2.0-compliant identify provider
<add> (IdP) that has been defined for your account
<add> 'https://<your_okta_account_name>.okta.com' to authenticate
<add> through native Okta.
<add> :type authenticator: str
<add> :param session_parameters: You can set session-level parameters at
<add> the time you connect to Snowflake
<add> :type session_parameters: dict
<ide> """
<ide>
<ide> @apply_defaults
<ide> def __init__(
<ide> file_format: str,
<ide> schema: str, # TODO: shouldn't be required, rely on session/user defaults
<ide> columns_array: Optional[list] = None,
<add> warehouse: Optional[str] = None,
<add> database: Optional[str] = None,
<ide> autocommit: bool = True,
<ide> snowflake_conn_id: str = 'snowflake_default',
<add> role: Optional[str] = None,
<add> authenticator: Optional[str] = None,
<add> session_parameters: Optional[dict] = None,
<ide> **kwargs,
<ide> ) -> None:
<ide> super().__init__(**kwargs)
<ide> self.s3_keys = s3_keys
<ide> self.table = table
<add> self.warehouse = warehouse
<add> self.database = database
<ide> self.stage = stage
<ide> self.file_format = file_format
<ide> self.schema = schema
<ide> self.columns_array = columns_array
<ide> self.autocommit = autocommit
<ide> self.snowflake_conn_id = snowflake_conn_id
<add> self.role = role
<add> self.authenticator = authenticator
<add> self.session_parameters = session_parameters
<ide>
<ide> def execute(self, context: Any) -> None:
<del> snowflake_hook = SnowflakeHook(snowflake_conn_id=self.snowflake_conn_id)
<add> snowflake_hook = SnowflakeHook(
<add> snowflake_conn_id=self.snowflake_conn_id,
<add> warehouse=self.warehouse,
<add> database=self.database,
<add> role=self.role,
<add> schema=self.schema,
<add> authenticator=self.authenticator,
<add> session_parameters=self.session_parameters,
<add> )
<ide>
<ide> # Snowflake won't accept list of files it has to be tuple only.
<ide> # but in python tuple([1]) = (1,) => which is invalid for snowflake | 1 |
Javascript | Javascript | fix minor typos on documentation | 79e33078f288f07bd9dfbbbeda0c2deb924786cd | <ide><path>Libraries/Components/TextInput/TextInput.js
<ide> var TextInput = React.createClass({
<ide> autoFocus: PropTypes.bool,
<ide> /**
<ide> * Set the position of the cursor from where editing will begin.
<del> * @platorm android
<add> * @platform android
<ide> */
<ide> textAlign: PropTypes.oneOf([
<ide> 'start', | 1 |
Javascript | Javascript | add util.format benchmark | 735e0df8e4e8f79256b10959110aa35b466e0cb3 | <ide><path>benchmark/util/format.js
<add>'use strict';
<add>
<add>const util = require('util');
<add>const common = require('../common');
<add>const v8 = require('v8');
<add>const bench = common.createBenchmark(main, {
<add> n: [1e6]
<add>, type: ['string',
<add> 'number',
<add> 'object',
<add> 'unknown',
<add> 'no-replace']
<add>});
<add>
<add>const inputs = {
<add> 'string': ['Hello, my name is %s', 'fred'],
<add> 'number': ['Hi, I was born in %d', 1942],
<add> 'object': ['An error occurred %j', {msg: 'This is an error', code: 'ERR'}],
<add> 'unknown': ['hello %a', 'test'],
<add> 'no-replace': [1, 2]
<add>};
<add>
<add>function main(conf) {
<add> const n = conf.n | 0;
<add> const type = conf.type;
<add>
<add> const input = inputs[type];
<add>
<add> v8.setFlagsFromString('--allow_natives_syntax');
<add>
<add> util.format(input[0], input[1]);
<add> eval('%OptimizeFunctionOnNextCall(util.format)');
<add> util.format(input[0], input[1]);
<add>
<add> bench.start();
<add> for (var i = 0; i < n; i++) {
<add> util.format(input[0], input[1]);
<add> }
<add> bench.end(n);
<add>} | 1 |
Javascript | Javascript | remove alertexample from rntester in ios | 803480aef5d3f9a2a261d043d77ef03a721b326f | <ide><path>RNTester/js/RNTesterList.ios.js
<ide> const APIExamples: Array<RNTesterExample> = [
<ide> module: require('./ActionSheetIOSExample'),
<ide> supportsTVOS: true,
<ide> },
<del> {
<del> key: 'AlertExample',
<del> module: require('./AlertExample').AlertExample,
<del> supportsTVOS: true,
<del> },
<ide> {
<ide> key: 'AlertIOSExample',
<ide> module: require('./AlertIOSExample'), | 1 |
PHP | PHP | apply fixes from styleci | 20541a6a62af1ed2f44fdee51043ffb4b739bdb8 | <ide><path>src/Illuminate/Queue/Jobs/Job.php
<ide>
<ide> namespace Illuminate\Queue\Jobs;
<ide>
<del>use Illuminate\Support\Arr;
<ide> use Illuminate\Queue\CalculatesDelays;
<ide>
<ide> abstract class Job
<ide><path>src/Illuminate/Queue/Queue.php
<ide> namespace Illuminate\Queue;
<ide>
<ide> use Illuminate\Support\Arr;
<del>use InvalidArgumentException;
<ide> use Illuminate\Container\Container;
<ide>
<ide> abstract class Queue | 2 |
Go | Go | remove run from the add instruction | d0084ce5f23453fbc008f5a2c5dd147b0df890e7 | <ide><path>buildfile.go
<ide> func (b *buildFile) CmdAdd(args string) error {
<ide>
<ide> cmd := b.config.Cmd
<ide> b.config.Cmd = []string{"/bin/sh", "-c", fmt.Sprintf("#(nop) ADD %s in %s", orig, dest)}
<del> cid, err := b.run()
<add>
<add> // Create the container and start it
<add> c, err := b.builder.Create(b.config)
<ide> if err != nil {
<ide> return err
<ide> }
<add> b.tmpContainers[c.ID] = struct{}{}
<ide>
<del> container := b.runtime.Get(cid)
<add> container := b.runtime.Get(c.ID)
<ide> if container == nil {
<ide> return fmt.Errorf("Error while creating the container (CmdAdd)")
<ide> }
<ide> func (b *buildFile) CmdAdd(args string) error {
<ide> }
<ide> }
<ide>
<del> if err := b.commit(cid, cmd, fmt.Sprintf("ADD %s in %s", orig, dest)); err != nil {
<add> if err := b.commit(c.ID, cmd, fmt.Sprintf("ADD %s in %s", orig, dest)); err != nil {
<ide> return err
<ide> }
<ide> b.config.Cmd = cmd | 1 |
Python | Python | add test that einsum multiplies scalars fine | 610faef24ae57bfb9e9e7f95179e1e405f4c9f0d | <ide><path>numpy/core/tests/test_einsum.py
<ide> def check_einsum_sums(self, dtype):
<ide> assert_equal(np.einsum(a, [0,0]), np.trace(a).astype(dtype))
<ide>
<ide> # multiply(a, b)
<add> assert_equal(np.einsum("..., ...", 3, 4), 12) # scalar case
<ide> for n in range(1,17):
<ide> a = np.arange(3*n, dtype=dtype).reshape(3,n)
<ide> b = np.arange(2*3*n, dtype=dtype).reshape(2,3,n) | 1 |
Text | Text | add psmarshall to collaborators | 53be304614509d12be024fd8a24b6449c4b90bbf | <ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> **Minqi Pan** <pmq2001@gmail.com>
<ide> * [princejwesley](https://github.com/princejwesley) -
<ide> **Prince John Wesley** <princejohnwesley@gmail.com>
<add>* [psmarshall](https://github.com/psmarshall) -
<add>**Peter Marshall** <petermarshall@chromium.org> (he/him)
<ide> * [Qard](https://github.com/Qard) -
<ide> **Stephen Belanger** <admin@stephenbelanger.com> (he/him)
<ide> * [refack](https://github.com/refack) - | 1 |
Text | Text | add wisr to inthewild.md | 59c67203a76709fffa9a314d77501d877055ca39 | <ide><path>INTHEWILD.md
<ide> Currently, **officially** using Airflow:
<ide> 1. [Whistle Labs](http://www.whistle.com) [[@ananya77041](https://github.com/ananya77041)]
<ide> 1. [Wildlifestudios](https://wildlifestudios.com/)
<ide> 1. [WiseBanyan](https://wisebanyan.com/)
<add>1. [Wisr](https://wisr.com.au/) [[@fsodano](https://github.com/fsodano) & [@vincyf1](https://github.com/vincyf1)]
<ide> 1. [WixAnswers](https://www.wixanswers.com/) [[@eladkal](https://github.com/eladkal)]
<ide> 1. [Wix](https://www.wix.com/) [[@eladkal](https://github.com/eladkal)]
<ide> 1. [Wooga](https://www.wooga.com/) | 1 |
Javascript | Javascript | change logging level for e2e tests to info | e1ec5c7963a3f19700f951104959cffd2ed41caa | <ide><path>karma-e2e.conf.js
<ide> files = ['build/angular-scenario.js', ANGULAR_SCENARIO_ADAPTER, 'build/docs/docs
<ide>
<ide> autoWatch = false;
<ide> singleRun = true;
<del>logLevel = LOG_DEBUG;
<add>logLevel = LOG_INFO;
<ide> logColors = true;
<ide> browsers = ['Chrome'];
<ide> | 1 |
PHP | PHP | use relation setter | 8031ca04f8c39a3650a84abc109db5fe8880c75f | <ide><path>src/Illuminate/Database/Eloquent/Model.php
<ide> protected function getRelationshipFromMethod($method)
<ide> .'Illuminate\Database\Eloquent\Relations\Relation');
<ide> }
<ide>
<del> return $this->relations[$method] = $relations->getResults();
<add> $this->setRelation($method, $results = $relations->getResults());
<add>
<add> return $results;
<ide> }
<ide>
<ide> /** | 1 |
Python | Python | use time.time() if task has a none timestamp | 9a6a60479ef1f866b076af1c92c1b2ca8832de87 | <ide><path>celery/bin/celeryev.py
<ide> def draw(self):
<ide> attr = curses.A_NORMAL
<ide> if task.uuid == self.selected_task:
<ide> attr = curses.A_STANDOUT
<del> timestamp = datetime.fromtimestamp(task.timestamp)
<add> timestamp = datetime.fromtimestamp(task.timestamp or time.time())
<ide> timef = timestamp.strftime("%H:%M:%S")
<ide> line = self.format_row(uuid, task.name,
<ide> task.worker.hostname, | 1 |
PHP | PHP | add getjsonoptions to jsonresponse | 0fd87284daff20f4d674a2498e266ce5fc832f50 | <ide><path>src/Illuminate/Http/JsonResponse.php
<ide> public function setJsonOptions($options)
<ide> return $this->setData($this->getData());
<ide> }
<ide>
<add> /**
<add> * Get the JSON encoding options.
<add> *
<add> * @return int
<add> */
<add> public function getJsonOptions()
<add> {
<add> return $this->jsonOptions;
<add> }
<add>
<ide> }
<ide><path>tests/Http/HttpJsonResponseTest.php
<ide> public function testSetAndRetrieveData()
<ide> $this->assertEquals('bar', $data->foo);
<ide> }
<ide>
<add> public function testSetAndRetrieveOptions()
<add> {
<add> $response = new Illuminate\Http\JsonResponse(['foo' => 'bar']);
<add> $response->setJsonOptions(JSON_PRETTY_PRINT);
<add> $this->assertSame(JSON_PRETTY_PRINT, $response->getJsonOptions());
<add> }
<add>
<ide> } | 2 |
Java | Java | create turbomodulemanager earlier | e6f28bb4f7982fc2518e3699e708cfabd313e1cf | <ide><path>ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java
<ide> import com.facebook.react.bridge.CatalystInstanceImpl;
<ide> import com.facebook.react.bridge.JSBundleLoader;
<ide> import com.facebook.react.bridge.JSIModulePackage;
<add>import com.facebook.react.bridge.JSIModuleType;
<ide> import com.facebook.react.bridge.JavaJSExecutor;
<ide> import com.facebook.react.bridge.JavaScriptExecutor;
<ide> import com.facebook.react.bridge.JavaScriptExecutorFactory;
<ide> import com.facebook.react.common.LifecycleState;
<ide> import com.facebook.react.common.ReactConstants;
<ide> import com.facebook.react.common.annotations.VisibleForTesting;
<add>import com.facebook.react.config.ReactFeatureFlags;
<ide> import com.facebook.react.devsupport.DevSupportManagerFactory;
<ide> import com.facebook.react.devsupport.ReactInstanceManagerDevHelper;
<ide> import com.facebook.react.devsupport.RedBoxHandler;
<ide> private void setupReactContext(final ReactApplicationContext reactContext) {
<ide> Assertions.assertNotNull(reactContext.getCatalystInstance());
<ide>
<ide> catalystInstance.initialize();
<add>
<add> if (ReactFeatureFlags.useTurboModules) {
<add> catalystInstance.setTurboModuleManager(catalystInstance.getJSIModule(JSIModuleType.TurboModuleManager));
<add> }
<add>
<ide> mDevSupportManager.onNewReactContextCreated(reactContext);
<ide> mMemoryPressureRouter.addMemoryPressureListener(catalystInstance);
<ide> moveReactContextToCurrentLifecycleState();
<ide> private ReactApplicationContext createReactContext(
<ide> catalystInstance.addJSIModules(mJSIModulePackage
<ide> .getJSIModules(reactContext, catalystInstance.getJavaScriptContextHolder()));
<ide> }
<del>
<ide> if (mBridgeIdleDebugListener != null) {
<ide> catalystInstance.addBridgeIdleDebugListener(mBridgeIdleDebugListener);
<ide> }
<ide> private ReactApplicationContext createReactContext(
<ide>
<ide> reactContext.initializeWithInstance(catalystInstance);
<ide>
<del>
<ide> return reactContext;
<ide> }
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java
<ide> void callFunction(
<ide> * to CatalystInstance so that getNativeModule, hasNativeModule, and
<ide> * getNativeModules can also return TurboModules.
<ide> */
<del> void setTurboModuleRegistry(TurboModuleRegistry getter);
<add> void setTurboModuleManager(JSIModule getter);
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java
<ide> public void run() {
<ide> }
<ide> }
<ide>
<del> public void setTurboModuleRegistry(TurboModuleRegistry getter) {
<del> mTurboModuleRegistry = getter;
<add> public void setTurboModuleManager(JSIModule getter) {
<add> mTurboModuleRegistry = (TurboModuleRegistry)getter;
<ide> }
<ide>
<ide> private void decrementPendingJSCalls() { | 3 |
Python | Python | fix broken import in the test file | 8c31ebdd175fa928e0507fc3b07373506afcc96d | <ide><path>libcloud/test/compute/test_dimensiondata.py
<ide> from libcloud.utils.py3 import httplib
<ide>
<ide> from libcloud.common.types import InvalidCredsError
<add>from libcloud.common.dimensiondata import DimensionDataAPIException
<ide> from libcloud.compute.drivers.dimensiondata import DimensionDataNodeDriver as DimensionData
<del>from libcloud.compute.drivers.dimensiondata import DimensionDataAPIException
<ide> from libcloud.compute.base import Node, NodeAuthPassword, NodeLocation
<ide>
<ide> from libcloud.test import MockHttp | 1 |
Javascript | Javascript | add test for query param bug | e56a6add8de788baa6bee2865c469e6f7bdc1fb9 | <ide><path>test/integration/link-with-encoding/pages/index.js
<ide> const Home = () => (
<ide> >
<ide> <a id="single-colon">Single: :</a>
<ide> </Link>
<add> <br />
<add> <Link href="/query?id=http://example.com/">
<add> <a id="url-param">Url query param</a>
<add> </Link>
<ide> </div>
<ide> )
<ide>
<ide><path>test/integration/link-with-encoding/pages/query.js
<add>export function getServerSideProps({ query }) {
<add> return { props: query }
<add>}
<add>
<add>export default function Single(props) {
<add> return <pre id="query-content">{JSON.stringify(props)}</pre>
<add>}
<ide><path>test/integration/link-with-encoding/test/index.test.js
<ide> describe('Link Component with Encoding', () => {
<ide> await browser.close()
<ide> }
<ide> })
<add>
<add> it('should have correct parsing of url query params', async () => {
<add> const browser = await webdriver(appPort, '/')
<add> try {
<add> await browser.waitForElementByCss('#url-param').click()
<add> const content = await browser
<add> .waitForElementByCss('#query-content')
<add> .text()
<add> const query = JSON.parse(content)
<add> expect(query).toHaveProperty('id', 'http://example.com/')
<add> } finally {
<add> await browser.close()
<add> }
<add> })
<ide> })
<ide> }) | 3 |
Python | Python | test taskwrapper on_acknowledgement | 327f0b2af565d80e0ec0b4a9cfc6bfcc7aae2ca1 | <ide><path>celery/tests/test_worker_job.py
<ide> from carrot.backends.base import BaseMessage
<ide> import simplejson
<ide>
<add>scratch = {"ACK": False}
<add>
<add>
<add>def on_ack():
<add> scratch["ACK"] = True
<add>
<ide>
<ide> def mytask(i, **kwargs):
<ide> return i ** i
<ide> def test_execute(self):
<ide> self.assertEquals(meta.result, 256)
<ide> self.assertEquals(meta.status, "DONE")
<ide>
<add> def test_execute_ack(self):
<add> tid = gen_unique_id()
<add> tw = TaskWrapper("cu.mytask", tid, mytask, [4], {"f": "x"},
<add> on_acknowledge=on_ack)
<add> self.assertEquals(tw.execute(), 256)
<add> meta = TaskMeta.objects.get(task_id=tid)
<add> self.assertTrue(scratch["ACK"])
<add> self.assertEquals(meta.result, 256)
<add> self.assertEquals(meta.status, "DONE")
<add>
<ide> def test_execute_fail(self):
<ide> tid = gen_unique_id()
<ide> tw = TaskWrapper("cu.mytask-raising", tid, mytask_raising, [4], | 1 |
Text | Text | fix typo `lunix` → `linux` | b508d90449515d8eb892557b6db0e9b57ee444a5 | <ide><path>examples/with-env-from-next-config-js/README.md
<ide> Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut
<ide> > ## Special note
<ide> >
<ide> > `next build` does a hard coded variable substitution into your JavaScript before the final bundle is created. This means
<del>> that if you change your environmental variables outside of your running app, such as in windows with `set` or lunix with `setenv`
<add>> that if you change your environmental variables outside of your running app, such as in windows with `set` or linux with `setenv`
<ide> > those changes will not be reflected in your running application until a build happens again (with `next build`).
<ide>
<ide> ## Discussion regarding this example | 1 |
Python | Python | handle msvc intrisincs in check_func | 1a555279787f77ecd8b26b30ad7edb36d73d5374 | <ide><path>numpy/distutils/command/config.py
<ide> def check_func(self, func,
<ide> body = []
<ide> if decl:
<ide> body.append("int %s ();" % func)
<add> # Handle MSVC intrisincs: force MS compiler to make a function call.
<add> # Useful to test for some functions when built with optimization on, to
<add> # avoid build error because the intrisinc and our 'fake' test
<add> # declaration do not match.
<add> body.append("#ifdef _MSC_VER")
<add> body.append("#define function(%s)" % func)
<add> body.append("#endif")
<ide> body.append("int main (void) {")
<ide> if call:
<ide> if call_args is None: | 1 |
PHP | PHP | fix some typos | 4a30af21e209c57ce2b798b6f38e623f096468de | <ide><path>src/Http/Client/Request.php
<ide> protected function addHeaders(array $headers)
<ide> * @param string $name The name of the cookie to get/set
<ide> * @param string|null $value Either the value or null when getting values.
<ide> * @return mixed Either $this or the cookie value.
<del> * @deprected 3.5.0 No longer used. CookieCollections now add `Cookie` header to the request
<add> * @deprecated 3.5.0 No longer used. CookieCollections now add `Cookie` header to the request
<ide> * before sending. Use Cake\Http\Cookie\CookieCollection::addToRequest() to make adding cookies
<ide> * to a request easier.
<ide> */
<ide><path>src/Http/Response.php
<ide> public function withCharset($charset)
<ide> * Sets the correct headers to instruct the client to not cache the response
<ide> *
<ide> * @return void
<del> * @deprected 3.4.0 Use withDisabledCache() instead.
<add> * @deprecated 3.4.0 Use withDisabledCache() instead.
<ide> */
<ide> public function disableCache()
<ide> {
<ide><path>src/ORM/Association/DependentDeleteTrait.php
<ide> *
<ide> * Included by HasOne and HasMany association classes.
<ide> *
<del> * @deprected 3.5.0 Unused in CakePHP now. This class will be removed in 4.0.0
<add> * @deprecated 3.5.0 Unused in CakePHP now. This class will be removed in 4.0.0
<ide> */
<ide> trait DependentDeleteTrait
<ide> {
<ide><path>tests/TestCase/Http/ResponseTest.php
<ide> public function testCharset()
<ide> }
<ide>
<ide> /**
<del> * Tests getCharset/withCharset methods
<add> * Tests the getCharset/withCharset methods
<ide> *
<ide> * @return void
<ide> */ | 4 |
Javascript | Javascript | add jsdoc details for event and eventtarget | 9d6bd102eed90eb9c50324340c3de05f42a985bd | <ide><path>lib/internal/event_target.js
<ide> function isEvent(value) {
<ide> }
<ide>
<ide> class Event {
<add> /**
<add> * @param {string} type
<add> * @param {{
<add> * bubbles?: boolean,
<add> * cancelable?: boolean,
<add> * composed?: boolean,
<add> * }} [options]
<add> */
<ide> constructor(type, options = null) {
<ide> if (arguments.length === 0)
<ide> throw new ERR_MISSING_ARGS('type');
<ide> class Event {
<ide> this[kDefaultPrevented] = true;
<ide> }
<ide>
<add> /**
<add> * @type {EventTarget}
<add> */
<ide> get target() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kTarget];
<ide> }
<ide>
<add> /**
<add> * @type {EventTarget}
<add> */
<ide> get currentTarget() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kTarget];
<ide> }
<ide>
<add> /**
<add> * @type {EventTarget}
<add> */
<ide> get srcElement() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kTarget];
<ide> }
<ide>
<add> /**
<add> * @type {string}
<add> */
<ide> get type() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kType];
<ide> }
<ide>
<add> /**
<add> * @type {boolean}
<add> */
<ide> get cancelable() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kCancelable];
<ide> }
<ide>
<add> /**
<add> * @type {boolean}
<add> */
<ide> get defaultPrevented() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kCancelable] && this[kDefaultPrevented];
<ide> }
<ide>
<add> /**
<add> * @type {number}
<add> */
<ide> get timeStamp() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> class Event {
<ide> // The following are non-op and unused properties/methods from Web API Event.
<ide> // These are not supported in Node.js and are provided purely for
<ide> // API completeness.
<del>
<add> /**
<add> * @returns {EventTarget[]}
<add> */
<ide> composedPath() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kIsBeingDispatched] ? [this[kTarget]] : [];
<ide> }
<ide>
<add> /**
<add> * @type {boolean}
<add> */
<ide> get returnValue() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return !this.defaultPrevented;
<ide> }
<ide>
<add> /**
<add> * @type {boolean}
<add> */
<ide> get bubbles() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kBubbles];
<ide> }
<ide>
<add> /**
<add> * @type {boolean}
<add> */
<ide> get composed() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kComposed];
<ide> }
<ide>
<add> /**
<add> * @type {number}
<add> */
<ide> get eventPhase() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kIsBeingDispatched] ? Event.AT_TARGET : Event.NONE;
<ide> }
<ide>
<add> /**
<add> * @type {boolean}
<add> */
<ide> get cancelBubble() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> return this[kPropagationStopped];
<ide> }
<ide>
<add> /**
<add> * @type {boolean}
<add> */
<ide> set cancelBubble(value) {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<ide> class EventTarget {
<ide> }
<ide> [kRemoveListener](size, type, listener, capture) {}
<ide>
<add> /**
<add> * @callback EventTargetCallback
<add> * @param {Event} event
<add> * @typedef {{ handleEvent: EventTargetCallback }} EventListener
<add> * @param {string} type
<add> * @param {EventTargetCallback|EventListener} listener
<add> * @param {{
<add> * capture?: boolean,
<add> * once?: boolean,
<add> * passive?: boolean,
<add> * signal?: AbortSignal
<add> * }} [options]
<add> */
<ide> addEventListener(type, listener, options = {}) {
<ide> if (!isEventTarget(this))
<ide> throw new ERR_INVALID_THIS('EventTarget');
<ide> class EventTarget {
<ide> this[kNewListener](root.size, type, listener, once, capture, passive, weak);
<ide> }
<ide>
<add> /**
<add> * @param {string} type
<add> * @param {EventTargetCallback|EventListener} listener
<add> * @param {{
<add> * capture?: boolean,
<add> * }} [options]
<add> */
<ide> removeEventListener(type, listener, options = {}) {
<ide> if (!isEventTarget(this))
<ide> throw new ERR_INVALID_THIS('EventTarget');
<ide> class EventTarget {
<ide> }
<ide> }
<ide>
<add> /**
<add> * @param {Event} event
<add> */
<ide> dispatchEvent(event) {
<ide> if (!isEventTarget(this))
<ide> throw new ERR_INVALID_THIS('EventTarget');
<ide> class NodeEventTarget extends EventTarget {
<ide> initNodeEventTarget(this);
<ide> }
<ide>
<add> /**
<add> * @param {number} n
<add> */
<ide> setMaxListeners(n) {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget');
<ide> EventEmitter.setMaxListeners(n, this);
<ide> }
<ide>
<add> /**
<add> * @returns {number}
<add> */
<ide> getMaxListeners() {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget');
<ide> return this[kMaxEventTargetListeners];
<ide> }
<ide>
<add> /**
<add> * @returns {string[]}
<add> */
<ide> eventNames() {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget');
<ide> return ArrayFrom(this[kEvents].keys());
<ide> }
<ide>
<add> /**
<add> * @param {string} [type]
<add> * @returns {number}
<add> */
<ide> listenerCount(type) {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget');
<ide> const root = this[kEvents].get(String(type));
<ide> return root !== undefined ? root.size : 0;
<ide> }
<ide>
<add> /**
<add> * @param {string} type
<add> * @param {EventTargetCallback|EventListener} listener
<add> * @param {{
<add> * capture?: boolean,
<add> * }} [options]
<add> * @returns {NodeEventTarget}
<add> */
<ide> off(type, listener, options) {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget');
<ide> this.removeEventListener(type, listener, options);
<ide> return this;
<ide> }
<ide>
<add> /**
<add> * @param {string} type
<add> * @param {EventTargetCallback|EventListener} listener
<add> * @param {{
<add> * capture?: boolean,
<add> * }} [options]
<add> * @returns {NodeEventTarget}
<add> */
<ide> removeListener(type, listener, options) {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget');
<ide> this.removeEventListener(type, listener, options);
<ide> return this;
<ide> }
<ide>
<add> /**
<add> * @param {string} type
<add> * @param {EventTargetCallback|EventListener} listener
<add> * @returns {NodeEventTarget}
<add> */
<ide> on(type, listener) {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget');
<ide> this.addEventListener(type, listener, { [kIsNodeStyleListener]: true });
<ide> return this;
<ide> }
<ide>
<add> /**
<add> * @param {string} type
<add> * @param {EventTargetCallback|EventListener} listener
<add> * @returns {NodeEventTarget}
<add> */
<ide> addListener(type, listener) {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget');
<ide> this.addEventListener(type, listener, { [kIsNodeStyleListener]: true });
<ide> return this;
<ide> }
<add>
<add> /**
<add> * @param {string} type
<add> * @param {any} arg
<add> * @returns {boolean}
<add> */
<ide> emit(type, arg) {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget');
<ide> class NodeEventTarget extends EventTarget {
<ide> return hadListeners;
<ide> }
<ide>
<add> /**
<add> * @param {string} type
<add> * @param {EventTargetCallback|EventListener} listener
<add> * @returns {NodeEventTarget}
<add> */
<ide> once(type, listener) {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget');
<ide> class NodeEventTarget extends EventTarget {
<ide> return this;
<ide> }
<ide>
<add> /**
<add> * @param {string} type
<add> * @returns {NodeEventTarget}
<add> */
<ide> removeAllListeners(type) {
<ide> if (!isNodeEventTarget(this))
<ide> throw new ERR_INVALID_THIS('NodeEventTarget'); | 1 |
Python | Python | add clip tokenizer to autotokenizer | 68b69072908b51ddbc93cdc87ca6b566517fcc70 | <ide><path>src/transformers/models/auto/tokenization_auto.py
<ide> "RemBertTokenizerFast" if is_tokenizers_available() else None,
<ide> ),
<ide> ),
<add> (
<add> "clip",
<add> (
<add> "CLIPTokenizer",
<add> "CLIPTokenizerFast" if is_tokenizers_available() else None,
<add> ),
<add> ),
<ide> ]
<ide> )
<ide> | 1 |
Python | Python | fix typo in tile | ba6b099b3d4b97fe933e0ebf5f18ca29f8111855 | <ide><path>numpy/lib/shape_base.py
<ide> def kron(a,b):
<ide> return result
<ide>
<ide> def tile(A, reps):
<del> """Repeat an array the number of times given in the integer tuple, tup.
<add> """Repeat an array the number of times given in the integer tuple, reps.
<ide>
<ide> If reps has length d, the result will have dimension of max(d, A.ndim).
<ide> If reps is scalar it is treated as a 1-tuple. | 1 |
Java | Java | remove obsolete runtimehintsutils | e1c94d7e6b35ec0081ff3ffdc3b112dcbe2245de | <ide><path>spring-core/src/main/java/org/springframework/aot/hint/support/RuntimeHintsUtils.java
<del>/*
<del> * Copyright 2002-2022 the original author or authors.
<del> *
<del> * Licensed under the Apache License, Version 2.0 (the "License");
<del> * you may not use this file except in compliance with the License.
<del> * You may obtain a copy of the License at
<del> *
<del> * https://www.apache.org/licenses/LICENSE-2.0
<del> *
<del> * Unless required by applicable law or agreed to in writing, software
<del> * distributed under the License is distributed on an "AS IS" BASIS,
<del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<del> * See the License for the specific language governing permissions and
<del> * limitations under the License.
<del> */
<del>
<del>package org.springframework.aot.hint.support;
<del>
<del>import java.util.function.Consumer;
<del>
<del>import org.springframework.aot.hint.MemberCategory;
<del>import org.springframework.aot.hint.RuntimeHints;
<del>import org.springframework.aot.hint.TypeHint;
<del>import org.springframework.aot.hint.TypeHint.Builder;
<del>import org.springframework.core.annotation.AliasFor;
<del>import org.springframework.core.annotation.MergedAnnotation;
<del>
<del>/**
<del> * Utility methods for runtime hints support code.
<del> *
<del> * @author Stephane Nicoll
<del> * @author Sam Brannen
<del> * @since 6.0
<del> */
<del>public abstract class RuntimeHintsUtils {
<del>
<del> /**
<del> * A {@link TypeHint} customizer suitable for an annotation. Make sure
<del> * that its attributes are visible.
<del> * @deprecated as annotation attributes are visible without additional hints
<del> */
<del> @Deprecated
<del> public static final Consumer<Builder> ANNOTATION_HINT = hint ->
<del> hint.withMembers(MemberCategory.INVOKE_DECLARED_METHODS);
<del>
<del> /**
<del> * Register the necessary hints so that the specified annotation is visible
<del> * at runtime.
<del> * @param hints the {@link RuntimeHints} instance to use
<del> * @param annotationType the annotation type
<del> * @deprecated For removal prior to Spring Framework 6.0
<del> */
<del> @Deprecated
<del> public static void registerAnnotation(RuntimeHints hints, Class<?> annotationType) {
<del> registerSynthesizedAnnotation(hints, annotationType);
<del> }
<del>
<del> /**
<del> * Register the necessary hints so that the specified annotation can be
<del> * synthesized at runtime if necessary. Such hints are usually required
<del> * if any of the following apply:
<del> * <ul>
<del> * <li>Use {@link AliasFor} for local aliases</li>
<del> * <li>Has a meta-annotation that uses {@link AliasFor} for attribute overrides</li>
<del> * <li>Has nested annotations or arrays of annotations that are synthesizable</li>
<del> * </ul>
<del> * Consider using {@link #registerAnnotationIfNecessary(RuntimeHints, MergedAnnotation)}
<del> * that determines if the hints are required.
<del> * @param hints the {@link RuntimeHints} instance to use
<del> * @param annotationType the annotation type
<del> * @deprecated For removal prior to Spring Framework 6.0
<del> */
<del> @Deprecated
<del> @SuppressWarnings("deprecation")
<del> public static void registerSynthesizedAnnotation(RuntimeHints hints, Class<?> annotationType) {
<del> hints.proxies().registerJdkProxy(annotationType,
<del> org.springframework.core.annotation.SynthesizedAnnotation.class);
<del> }
<del>
<del> /**
<del> * Determine if the specified annotation can be synthesized at runtime, and
<del> * register the necessary hints accordingly.
<del> * @param hints the {@link RuntimeHints} instance to use
<del> * @param annotation the annotation
<del> * @see #registerSynthesizedAnnotation(RuntimeHints, Class)
<del> * @deprecated For removal prior to Spring Framework 6.0
<del> */
<del> @Deprecated
<del> public static void registerAnnotationIfNecessary(RuntimeHints hints, MergedAnnotation<?> annotation) {
<del> if (annotation.isSynthesizable()) {
<del> registerSynthesizedAnnotation(hints, annotation.getType());
<del> }
<del> }
<del>
<del>}
<ide><path>spring-core/src/test/java/org/springframework/aot/hint/support/RuntimeHintsUtilsTests.java
<del>/*
<del> * Copyright 2002-2022 the original author or authors.
<del> *
<del> * Licensed under the Apache License, Version 2.0 (the "License");
<del> * you may not use this file except in compliance with the License.
<del> * You may obtain a copy of the License at
<del> *
<del> * https://www.apache.org/licenses/LICENSE-2.0
<del> *
<del> * Unless required by applicable law or agreed to in writing, software
<del> * distributed under the License is distributed on an "AS IS" BASIS,
<del> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<del> * See the License for the specific language governing permissions and
<del> * limitations under the License.
<del> */
<del>
<del>package org.springframework.aot.hint.support;
<del>
<del>import java.lang.annotation.Retention;
<del>import java.lang.annotation.RetentionPolicy;
<del>import java.util.function.Consumer;
<del>
<del>import org.junit.jupiter.api.Test;
<del>
<del>import org.springframework.aot.hint.JdkProxyHint;
<del>import org.springframework.aot.hint.RuntimeHints;
<del>import org.springframework.aot.hint.TypeReference;
<del>import org.springframework.core.annotation.AliasFor;
<del>import org.springframework.core.annotation.MergedAnnotation;
<del>import org.springframework.core.annotation.MergedAnnotations;
<del>
<del>import static org.assertj.core.api.Assertions.assertThat;
<del>
<del>/**
<del> * Tests for {@link RuntimeHintsUtils}.
<del> *
<del> * @author Stephane Nicoll
<del> * @author Sam Brannen
<del> */
<del>class RuntimeHintsUtilsTests {
<del>
<del> private final RuntimeHints hints = new RuntimeHints();
<del>
<del> @Test
<del> @SuppressWarnings("deprecation")
<del> void registerSynthesizedAnnotation() {
<del> RuntimeHintsUtils.registerSynthesizedAnnotation(this.hints, SampleInvoker.class);
<del> assertThat(this.hints.proxies().jdkProxies()).singleElement()
<del> .satisfies(annotationProxy(SampleInvoker.class));
<del> }
<del>
<del> @Test
<del> @SuppressWarnings("deprecation")
<del> void registerAnnotationIfNecessaryWithNonSynthesizedAnnotation() throws NoSuchFieldException {
<del> MergedAnnotation<SampleInvoker> annotation = MergedAnnotations
<del> .from(TestBean.class.getField("sampleInvoker")).get(SampleInvoker.class);
<del> RuntimeHintsUtils.registerAnnotationIfNecessary(this.hints, annotation);
<del> assertThat(this.hints.proxies().jdkProxies()).isEmpty();
<del> }
<del>
<del> @Test
<del> @SuppressWarnings("deprecation")
<del> void registerAnnotationIfNecessaryWithLocalAliases() throws NoSuchFieldException {
<del> MergedAnnotation<LocalMapping> annotation = MergedAnnotations
<del> .from(TestBean.class.getField("localMapping")).get(LocalMapping.class);
<del> RuntimeHintsUtils.registerAnnotationIfNecessary(this.hints, annotation);
<del> assertThat(this.hints.proxies().jdkProxies()).singleElement()
<del> .satisfies(annotationProxy(LocalMapping.class));
<del> }
<del>
<del> @Test
<del> @SuppressWarnings("deprecation")
<del> void registerAnnotationIfNecessaryWithMetaAttributeOverride() throws NoSuchFieldException {
<del> MergedAnnotation<SampleInvoker> annotation = MergedAnnotations
<del> .from(TestBean.class.getField("retryInvoker")).get(SampleInvoker.class);
<del> RuntimeHintsUtils.registerAnnotationIfNecessary(this.hints, annotation);
<del> assertThat(this.hints.proxies().jdkProxies()).singleElement()
<del> .satisfies(annotationProxy(SampleInvoker.class));
<del> }
<del>
<del> @Test
<del> @SuppressWarnings("deprecation")
<del> void registerAnnotationIfNecessaryWithSynthesizedAttribute() throws NoSuchFieldException {
<del> MergedAnnotation<RetryContainer> annotation = MergedAnnotations
<del> .from(TestBean.class.getField("retryContainer")).get(RetryContainer.class);
<del> RuntimeHintsUtils.registerAnnotationIfNecessary(this.hints, annotation);
<del> assertThat(this.hints.proxies().jdkProxies()).singleElement()
<del> .satisfies(annotationProxy(RetryContainer.class));
<del> }
<del>
<del> @SuppressWarnings("deprecation")
<del> private Consumer<JdkProxyHint> annotationProxy(Class<?> type) {
<del> return jdkProxyHint -> assertThat(jdkProxyHint.getProxiedInterfaces())
<del> .containsExactly(TypeReference.of(type),
<del> TypeReference.of(org.springframework.core.annotation.SynthesizedAnnotation.class));
<del> }
<del>
<del>
<del> static class TestBean {
<del>
<del> @SampleInvoker
<del> public String sampleInvoker;
<del>
<del> @LocalMapping
<del> public String localMapping;
<del>
<del> @RetryInvoker
<del> public String retryInvoker;
<del>
<del> @RetryContainer(retry = @RetryInvoker(3))
<del> public String retryContainer;
<del>
<del> }
<del>
<del> @Retention(RetentionPolicy.RUNTIME)
<del> @interface LocalMapping {
<del>
<del> @AliasFor("retries")
<del> int value() default 0;
<del>
<del> @AliasFor("value")
<del> int retries() default 0;
<del>
<del> }
<del>
<del>
<del> @Retention(RetentionPolicy.RUNTIME)
<del> @interface SampleInvoker {
<del>
<del> int retries() default 0;
<del>
<del> }
<del>
<del> @Retention(RetentionPolicy.RUNTIME)
<del> @SampleInvoker
<del> @interface RetryInvoker {
<del>
<del> @AliasFor(attribute = "retries", annotation = SampleInvoker.class)
<del> int value() default 1;
<del>
<del> }
<del>
<del> @Retention(RetentionPolicy.RUNTIME)
<del> @interface RetryContainer {
<del>
<del> RetryInvoker retry();
<del>
<del> }
<del>
<del>} | 2 |
Javascript | Javascript | add plane.intersectline with unit tests | 3595365f6b45995aa442d1d3039c92e9a91dae5a | <ide><path>src/math/Plane.js
<ide> THREE.Plane.prototype = {
<ide>
<ide> },
<ide>
<add> intersectLine: function ( startPoint, endPoint, optionalTarget ) {
<add>
<add> var result = optionalTarget || new THREE.Vector3();
<add>
<add> var direction = THREE.Plane.__v1.sub( endPoint, startPoint );
<add>
<add> var denominator = this.normal.dot( direction );
<add>
<add> if ( denominator == 0 ) {
<add>
<add> // line is coplanar, return origin
<add> if( this.distanceToPoint( startPoint ) == 0 ) {
<add>
<add> return result.copy( startPoint );
<add>
<add> }
<add>
<add> // Unsure if this is the correct method to handle this case.
<add> return undefined;
<add>
<add> }
<add>
<add> var t = - ( startPoint.dot( this.normal ) + this.constant ) / denominator;
<add>
<add> if( t < 0 || t > 1 ) {
<add>
<add> return undefined;
<add>
<add> }
<add>
<add> return result.copy( direction ).multiplyScalar( t ).addSelf( startPoint );
<add>
<add> },
<add>
<ide> coplanarPoint: function ( optionalTarget ) {
<ide>
<ide> var result = optionalTarget || new THREE.Vector3();
<ide><path>test/unit/math/Plane.js
<ide> test( "distanceToSphere", function() {
<ide> ok( a.distanceToSphere( b ) === -1, "Passed!" );
<ide> });
<ide>
<add>test( "isInterestionLine/intersectLine", function() {
<add> var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
<add>
<add> ok( a.isIntersectionLine( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) ), "Passed!" );
<add> ok( a.intersectLine( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
<add>
<add> a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), -3 );
<add>
<add> ok( a.isIntersectionLine( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) ), "Passed!" );
<add> ok( a.intersectLine( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) ).equals( new THREE.Vector3( 3, 0, 0 ) ), "Passed!" );
<add>
<add>
<add> a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), -11 );
<add>
<add> ok( ! a.isIntersectionLine( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) ), "Passed!" );
<add> ok( a.intersectLine( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) ) === undefined, "Passed!" );
<add>
<add> a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 11 );
<add>
<add> ok( ! a.isIntersectionLine( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) ), "Passed!" );
<add> ok( a.intersectLine( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) ) === undefined, "Passed!" );
<add>
<add>});
<add>
<add>
<ide> test( "projectPoint", function() {
<ide> var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
<ide> | 2 |
Text | Text | add imports in validators docs | 54096dc22f255140f148906e85da5e4be0048f10 | <ide><path>docs/api-guide/validators.md
<ide> It takes a single required argument, and an optional `messages` argument:
<ide>
<ide> This validator should be applied to *serializer fields*, like so:
<ide>
<add> from rest_framework.validators import UniqueValidator
<add>
<ide> slug = SlugField(
<ide> max_length=100,
<ide> validators=[UniqueValidator(queryset=BlogPost.objects.all())]
<ide> It has two required arguments, and a single optional `messages` argument:
<ide>
<ide> The validator should be applied to *serializer classes*, like so:
<ide>
<add> from rest_framework.validators import UniqueTogetherValidator
<add>
<ide> class ExampleSerializer(serializers.Serializer):
<ide> # ...
<ide> class Meta:
<ide> These validators can be used to enforce the `unique_for_date`, `unique_for_month
<ide>
<ide> The validator should be applied to *serializer classes*, like so:
<ide>
<add> from rest_framework.validators import UniqueForYearValidator
<add>
<ide> class ExampleSerializer(serializers.Serializer):
<ide> # ...
<ide> class Meta:
<ide> It takes a single argument, which is the default value or callable that should b
<ide>
<ide> created_at = serializers.DateTimeField(
<ide> read_only=True,
<del> default=CreateOnlyDefault(timezone.now)
<add> default=serializers.CreateOnlyDefault(timezone.now)
<ide> )
<ide>
<ide> --- | 1 |
Python | Python | add missing test | 67a432c273cbd65866b1d2cb1e2c62714b633b6e | <ide><path>tests/keras/utils/np_utils_test.py
<ide> def test_to_categorical():
<ide> expected_shapes = [(3, num_classes),
<ide> (4, 3, num_classes),
<ide> (5, 4, 3, num_classes),
<del> (3, num_classes)]
<add> (3, num_classes),
<add> (3, 2, num_classes)]
<ide> labels = [np.random.randint(0, num_classes, shape) for shape in shapes]
<ide> one_hots = [to_categorical(label, num_classes) for label in labels]
<ide> for label, one_hot, expected_shape in zip(labels, | 1 |
Ruby | Ruby | convert resource test to spec | babc375372df635c023977de9f1279a7689e2453 | <ide><path>Library/Homebrew/test/resource_spec.rb
<add>require "resource"
<add>
<add>describe Resource do
<add> subject { described_class.new("test") }
<add>
<add> describe "#url" do
<add> it "sets the URL" do
<add> subject.url("foo")
<add> expect(subject.url).to eq("foo")
<add> end
<add>
<add> it "can set the URL with specifications" do
<add> subject.url("foo", branch: "master")
<add> expect(subject.url).to eq("foo")
<add> expect(subject.specs).to eq(branch: "master")
<add> end
<add>
<add> it "can set the URL with a custom download strategy class" do
<add> strategy = Class.new(AbstractDownloadStrategy)
<add> subject.url("foo", using: strategy)
<add> expect(subject.url).to eq("foo")
<add> expect(subject.download_strategy).to eq(strategy)
<add> end
<add>
<add> it "can set the URL with specifications and a custom download strategy class" do
<add> strategy = Class.new(AbstractDownloadStrategy)
<add> subject.url("foo", using: strategy, branch: "master")
<add> expect(subject.url).to eq("foo")
<add> expect(subject.specs).to eq(branch: "master")
<add> expect(subject.download_strategy).to eq(strategy)
<add> end
<add>
<add> it "can set the URL with a custom download strategy symbol" do
<add> subject.url("foo", using: :git)
<add> expect(subject.url).to eq("foo")
<add> expect(subject.download_strategy).to eq(GitDownloadStrategy)
<add> end
<add>
<add> it "raises an error if the download strategy class is unkown" do
<add> expect { subject.url("foo", using: Class.new) }.to raise_error(TypeError)
<add> end
<add>
<add> it "does not mutate the specifications hash" do
<add> specs = { using: :git, branch: "master" }
<add> subject.url("foo", specs)
<add> expect(subject.specs).to eq(branch: "master")
<add> expect(subject.using).to eq(:git)
<add> expect(specs).to eq(using: :git, branch: "master")
<add> end
<add> end
<add>
<add> describe "#version" do
<add> it "sets the version" do
<add> subject.version("1.0")
<add> expect(subject.version).to eq(Version.parse("1.0"))
<add> expect(subject.version).not_to be_detected_from_url
<add> end
<add>
<add> it "can detect the version from a URL" do
<add> subject.url("http://example.com/foo-1.0.tar.gz")
<add> expect(subject.version).to eq(Version.parse("1.0"))
<add> expect(subject.version).to be_detected_from_url
<add> end
<add>
<add> it "can set the version with a scheme" do
<add> klass = Class.new(Version)
<add> subject.version klass.new("1.0")
<add> expect(subject.version).to eq(Version.parse("1.0"))
<add> expect(subject.version).to be_a(klass)
<add> end
<add>
<add> it "can set the version from a tag" do
<add> subject.url("http://example.com/foo-1.0.tar.gz", tag: "v1.0.2")
<add> expect(subject.version).to eq(Version.parse("1.0.2"))
<add> expect(subject.version).to be_detected_from_url
<add> end
<add>
<add> it "rejects non-string versions" do
<add> expect { subject.version(1) }.to raise_error(TypeError)
<add> expect { subject.version(2.0) }.to raise_error(TypeError)
<add> expect { subject.version(Object.new) }.to raise_error(TypeError)
<add> end
<add>
<add> it "returns nil if unset" do
<add> expect(subject.version).to be nil
<add> end
<add> end
<add>
<add> describe "#mirrors" do
<add> it "is empty by defaults" do
<add> expect(subject.mirrors).to be_empty
<add> end
<add>
<add> it "returns an array of mirrors added with #mirror" do
<add> subject.mirror("foo")
<add> subject.mirror("bar")
<add> expect(subject.mirrors).to eq(%w[foo bar])
<add> end
<add> end
<add>
<add> describe "#checksum" do
<add> it "returns nil if unset" do
<add> expect(subject.checksum).to be nil
<add> end
<add>
<add> it "returns the checksum set with #sha256" do
<add> subject.sha256(TEST_SHA256)
<add> expect(subject.checksum).to eq(Checksum.new(:sha256, TEST_SHA256))
<add> end
<add> end
<add>
<add> describe "#download_strategy" do
<add> it "returns the download strategy" do
<add> strategy = Object.new
<add> expect(DownloadStrategyDetector)
<add> .to receive(:detect).with("foo", nil).and_return(strategy)
<add> subject.url("foo")
<add> expect(subject.download_strategy).to eq(strategy)
<add> end
<add> end
<add>
<add> specify "#verify_download_integrity_missing" do
<add> fn = Pathname.new("test")
<add>
<add> allow(fn).to receive(:file?).and_return(true)
<add> expect(fn).to receive(:verify_checksum).and_raise(ChecksumMissingError)
<add> expect(fn).to receive(:sha256)
<add>
<add> shutup do
<add> subject.verify_download_integrity(fn)
<add> end
<add> end
<add>
<add> specify "#verify_download_integrity_mismatch" do
<add> fn = double(file?: true)
<add> checksum = subject.sha256(TEST_SHA256)
<add>
<add> expect(fn).to receive(:verify_checksum).with(checksum)
<add> .and_raise(ChecksumMismatchError.new(fn, checksum, Object.new))
<add>
<add> shutup do
<add> expect {
<add> subject.verify_download_integrity(fn)
<add> }.to raise_error(ChecksumMismatchError)
<add> end
<add> end
<add>end
<ide><path>Library/Homebrew/test/resource_test.rb
<del>require "testing_env"
<del>require "resource"
<del>
<del>class ResourceTests < Homebrew::TestCase
<del> def setup
<del> super
<del> @resource = Resource.new("test")
<del> end
<del>
<del> def test_url
<del> @resource.url("foo")
<del> assert_equal "foo", @resource.url
<del> end
<del>
<del> def test_url_with_specs
<del> @resource.url("foo", branch: "master")
<del> assert_equal "foo", @resource.url
<del> assert_equal({ branch: "master" }, @resource.specs)
<del> end
<del>
<del> def test_url_with_custom_download_strategy_class
<del> strategy = Class.new(AbstractDownloadStrategy)
<del> @resource.url("foo", using: strategy)
<del> assert_equal "foo", @resource.url
<del> assert_equal strategy, @resource.download_strategy
<del> end
<del>
<del> def test_url_with_specs_and_download_strategy
<del> strategy = Class.new(AbstractDownloadStrategy)
<del> @resource.url("foo", using: strategy, branch: "master")
<del> assert_equal "foo", @resource.url
<del> assert_equal({ branch: "master" }, @resource.specs)
<del> assert_equal strategy, @resource.download_strategy
<del> end
<del>
<del> def test_url_with_custom_download_strategy_symbol
<del> @resource.url("foo", using: :git)
<del> assert_equal "foo", @resource.url
<del> assert_equal GitDownloadStrategy, @resource.download_strategy
<del> end
<del>
<del> def test_raises_for_unknown_download_strategy_class
<del> assert_raises(TypeError) { @resource.url("foo", using: Class.new) }
<del> end
<del>
<del> def test_does_not_mutate_specs_hash
<del> specs = { using: :git, branch: "master" }
<del> @resource.url("foo", specs)
<del> assert_equal({ branch: "master" }, @resource.specs)
<del> assert_equal(:git, @resource.using)
<del> assert_equal({ using: :git, branch: "master" }, specs)
<del> end
<del>
<del> def test_version
<del> @resource.version("1.0")
<del> assert_version_equal "1.0", @resource.version
<del> refute_predicate @resource.version, :detected_from_url?
<del> end
<del>
<del> def test_version_from_url
<del> @resource.url("http://example.com/foo-1.0.tar.gz")
<del> assert_version_equal "1.0", @resource.version
<del> assert_predicate @resource.version, :detected_from_url?
<del> end
<del>
<del> def test_version_with_scheme
<del> klass = Class.new(Version)
<del> @resource.version klass.new("1.0")
<del> assert_version_equal "1.0", @resource.version
<del> assert_instance_of klass, @resource.version
<del> end
<del>
<del> def test_version_from_tag
<del> @resource.url("http://example.com/foo-1.0.tar.gz", tag: "v1.0.2")
<del> assert_version_equal "1.0.2", @resource.version
<del> assert_predicate @resource.version, :detected_from_url?
<del> end
<del>
<del> def test_rejects_non_string_versions
<del> assert_raises(TypeError) { @resource.version(1) }
<del> assert_raises(TypeError) { @resource.version(2.0) }
<del> assert_raises(TypeError) { @resource.version(Object.new) }
<del> end
<del>
<del> def test_version_when_url_is_not_set
<del> assert_nil @resource.version
<del> end
<del>
<del> def test_mirrors
<del> assert_empty @resource.mirrors
<del> @resource.mirror("foo")
<del> @resource.mirror("bar")
<del> assert_equal %w[foo bar], @resource.mirrors
<del> end
<del>
<del> def test_checksum_setters
<del> assert_nil @resource.checksum
<del> @resource.sha256(TEST_SHA256)
<del> assert_equal Checksum.new(:sha256, TEST_SHA256), @resource.checksum
<del> end
<del>
<del> def test_download_strategy
<del> strategy = Object.new
<del> DownloadStrategyDetector
<del> .expects(:detect).with("foo", nil).returns(strategy)
<del> @resource.url("foo")
<del> assert_equal strategy, @resource.download_strategy
<del> end
<del>
<del> def test_verify_download_integrity_missing
<del> fn = Pathname.new("test")
<del>
<del> fn.stubs(file?: true)
<del> fn.expects(:verify_checksum).raises(ChecksumMissingError)
<del> fn.expects(:sha256)
<del>
<del> shutup { @resource.verify_download_integrity(fn) }
<del> end
<del>
<del> def test_verify_download_integrity_mismatch
<del> fn = stub(file?: true)
<del> checksum = @resource.sha256(TEST_SHA256)
<del>
<del> fn.expects(:verify_checksum).with(checksum)
<del> .raises(ChecksumMismatchError.new(fn, checksum, Object.new))
<del>
<del> shutup do
<del> assert_raises(ChecksumMismatchError) do
<del> @resource.verify_download_integrity(fn)
<del> end
<del> end
<del> end
<del>end | 2 |
Javascript | Javascript | fix failing tests in ie7 by normalizing url | 8267e07a7b054421122f34a73c68c43c8e33204a | <ide><path>packages/ember/tests/helpers/link_to_test.js
<ide> test("The {{linkTo}} helper supports leaving off .index for nested routes", func
<ide> router.handleURL("/about/item");
<ide> });
<ide>
<del> equal(Ember.$('#item a', '#qunit-fixture').attr('href'), '/about');
<add> equal(normalizeUrl(Ember.$('#item a', '#qunit-fixture').attr('href')), '/about');
<ide> });
<ide>
<ide> test("The {{linkTo}} helper supports custom, nested, currentWhen", function() {
<ide> test("The {{linkTo}} helper accepts string arguments", function() {
<ide>
<ide> Ember.run(function() { router.handleURL("/filters/popular"); });
<ide>
<del> equal(Ember.$('#link', '#qunit-fixture').attr('href'), "/filters/unpopular");
<add> equal(normalizeUrl(Ember.$('#link', '#qunit-fixture').attr('href')), "/filters/unpopular");
<ide> });
<ide>
<ide> test("The {{linkTo}} helper unwraps controllers", function() { | 1 |
Ruby | Ruby | fix odd indentation | e0d147fa905eb5cd71797777c69b0aaff0802eb5 | <ide><path>activerecord/lib/arel/visitors/mysql.rb
<ide> def visit_Arel_Nodes_Union(o, collector, suppress_parens = false)
<ide> collector << "( "
<ide> end
<ide>
<del> collector = case o.left
<del> when Arel::Nodes::Union
<del> visit_Arel_Nodes_Union o.left, collector, true
<del> else
<del> visit o.left, collector
<add> case o.left
<add> when Arel::Nodes::Union
<add> visit_Arel_Nodes_Union o.left, collector, true
<add> else
<add> visit o.left, collector
<ide> end
<ide>
<ide> collector << " UNION "
<ide>
<del> collector = case o.right
<del> when Arel::Nodes::Union
<del> visit_Arel_Nodes_Union o.right, collector, true
<del> else
<del> visit o.right, collector
<add> case o.right
<add> when Arel::Nodes::Union
<add> visit_Arel_Nodes_Union o.right, collector, true
<add> else
<add> visit o.right, collector
<ide> end
<ide>
<ide> if suppress_parens | 1 |
Ruby | Ruby | fix gdk-pixbuf module installation | d6851033f9da72746eea1e382e228c4abb311e76 | <ide><path>Library/Homebrew/keg.rb
<ide> def link
<ide> # pkg-config database gets explicitly created
<ide> when 'pkgconfig' then :mkpath
<ide> # lib/language folders also get explicitly created
<add> when /^gdk-pixbuf/ then :mkpath
<ide> when 'ghc' then :mkpath
<ide> when 'lua' then :mkpath
<ide> when 'node' then :mkpath | 1 |
Text | Text | adjust paths in openssl maintenance guide | a1b6ae6ca69a4f43405dbd3de140e54077055b95 | <ide><path>doc/guides/maintaining-openssl.md
<ide> Update all architecture dependent files. Do not forget to git add or remove
<ide> files if they are changed before commit:
<ide> ```sh
<ide> % git add deps/openssl/config/archs
<del>% git add deps/openssl/openssl/crypto/include/internal/bn_conf.h
<del>% git add deps/openssl/openssl/crypto/include/internal/dso_conf.h
<add>% git add deps/openssl/openssl/include/crypto/bn_conf.h
<add>% git add deps/openssl/openssl/include/crypto/dso_conf.h
<ide> % git add deps/openssl/openssl/include/openssl/opensslconf.h
<ide> % git commit
<ide> ```
<ide> The commit message can be (with the openssl version set to the relevant value):
<ide> $ cd deps/openssl/config
<ide> $ make
<ide> $ git add deps/openssl/config/archs
<del> $ git add deps/openssl/openssl/crypto/include/internal/bn_conf.h
<del> $ git add deps/openssl/openssl/crypto/include/internal/dso_conf.h
<add> $ git add deps/openssl/openssl/include/crypto/bn_conf.h
<add> $ git add deps/openssl/openssl/include/crypto/dso_conf.h
<ide> $ git add deps/openssl/openssl/include/openssl/opensslconf.h
<ide> $ git commit
<ide> ``` | 1 |
PHP | PHP | update auth helper | 96cc81037f25b99c4a3e9dc3ff7194277240a9f3 | <ide><path>src/Illuminate/Foundation/helpers.php
<ide> use Illuminate\Support\Str;
<ide> use Illuminate\Support\HtmlString;
<ide> use Illuminate\Container\Container;
<del>use Illuminate\Contracts\Auth\Guard;
<ide> use Illuminate\Contracts\Auth\Access\Gate;
<ide> use Illuminate\Contracts\Routing\UrlGenerator;
<ide> use Illuminate\Contracts\Routing\ResponseFactory;
<add>use Illuminate\Contracts\Auth\Factory as AuthFactory;
<ide> use Illuminate\Contracts\View\Factory as ViewFactory;
<ide> use Illuminate\Contracts\Cookie\Factory as CookieFactory;
<ide> use Illuminate\Database\Eloquent\Factory as EloquentFactory;
<ide> function asset($path, $secure = null)
<ide> /**
<ide> * Get the available auth instance.
<ide> *
<del> * @return \Illuminate\Contracts\Auth\Guard
<add> * @return \Illuminate\Contracts\Auth\Factory
<ide> */
<ide> function auth()
<ide> {
<del> return app(Guard::class);
<add> return app(AuthFactory::class);
<ide> }
<ide> }
<ide> | 1 |
PHP | PHP | add missing methods to repositoryinterface | 683ddea5243eea02cb6aa763d0afa7d843c5b612 | <ide><path>src/Datasource/RepositoryInterface.php
<ide> /**
<ide> * Describes the methods that any class representing a data storage should
<ide> * comply with.
<del> *
<del> * @method $this setAlias($alias)
<del> * @method string getAlias()
<ide> */
<ide> interface RepositoryInterface
<ide> {
<add> /**
<add> * Sets the repository alias.
<add> *
<add> * @param string $alias Table alias
<add> * @return $this
<add> */
<add> public function setAlias($alias);
<add>
<add> /**
<add> * Returns the repository alias.
<add> *
<add> * @return string
<add> */
<add> public function getAlias();
<add>
<ide> /**
<ide> * Test to see if a Repository has a specific field/column.
<ide> *
<ide><path>tests/TestCase/Controller/Component/PaginatorComponentTest.php
<ide> protected function getMockRepository()
<ide> {
<ide> $model = $this->getMockBuilder('Cake\Datasource\RepositoryInterface')
<ide> ->setMethods([
<del> 'getAlias', 'hasField', 'alias', 'find', 'get', 'query', 'updateAll', 'deleteAll',
<add> 'getAlias', 'setAlias', 'hasField', 'find', 'get', 'query', 'updateAll', 'deleteAll',
<ide> 'exists', 'save', 'delete', 'newEntity', 'newEntities', 'patchEntity', 'patchEntities'
<ide> ])
<ide> ->getMock();
<ide><path>tests/TestCase/Datasource/PaginatorTest.php
<ide> protected function getMockRepository()
<ide> {
<ide> $model = $this->getMockBuilder('Cake\Datasource\RepositoryInterface')
<ide> ->setMethods([
<del> 'getAlias', 'hasField', 'alias', 'find', 'get', 'query', 'updateAll', 'deleteAll',
<add> 'getAlias', 'setAlias', 'hasField', 'find', 'get', 'query', 'updateAll', 'deleteAll',
<ide> 'exists', 'save', 'delete', 'newEntity', 'newEntities', 'patchEntity', 'patchEntities'
<ide> ])
<ide> ->getMock(); | 3 |
Ruby | Ruby | allow custom purpose for activestorage signed ids | 8ef5bd9ced351162b673904a0b77c7034ca2bc20 | <ide><path>activestorage/app/models/active_storage/blob.rb
<ide> class << self
<ide> # that was created ahead of the upload itself on form submission.
<ide> #
<ide> # The signed ID is also used to create stable URLs for the blob through the BlobsController.
<del> def find_signed!(id, record: nil)
<del> super(id, purpose: :blob_id)
<add> def find_signed!(id, record: nil, purpose: :blob_id)
<add> super(id, purpose: purpose)
<ide> end
<ide>
<ide> def build_after_upload(io:, filename:, content_type: nil, metadata: nil, service_name: nil, identify: true, record: nil) #:nodoc:
<ide> def signed_id_verifier #:nodoc:
<ide> end
<ide>
<ide> # Returns a signed ID for this blob that's suitable for reference on the client-side without fear of tampering.
<del> def signed_id
<del> super(purpose: :blob_id)
<add> def signed_id(purpose: :blob_id)
<add> super
<ide> end
<ide>
<ide> # Returns the key pointing to the file on the service that's associated with this blob. The key is the
<ide><path>activestorage/test/models/attachment_test.rb
<ide> class ActiveStorage::AttachmentTest < ActiveSupport::TestCase
<ide> assert_equal blob, ActiveStorage::Blob.find_signed!(signed_id)
<ide> end
<ide>
<add> test "getting a signed blob ID from an attachment with a custom purpose" do
<add> blob = create_blob
<add> @user.avatar.attach(blob)
<add>
<add> signed_id = @user.avatar.signed_id(purpose: :custom_purpose)
<add> assert_equal blob, ActiveStorage::Blob.find_signed!(signed_id, purpose: :custom_purpose)
<add> end
<add>
<ide> test "signed blob ID backwards compatibility" do
<ide> blob = create_blob
<ide> @user.avatar.attach(blob) | 2 |
Ruby | Ruby | fix postgresql range tests | f8b4110f009a8d509f0350da4c1388c5a5bb4a2d | <ide><path>activerecord/test/cases/adapters/postgresql/range_test.rb
<ide> def setup
<ide> @connection = ActiveRecord::Base.connection
<ide> begin
<ide> @connection.transaction do
<del> @connection.create_table('json_data_type') do |t|
<add> @connection.create_table('postgresql_ranges') do |t|
<ide> t.daterange :date_range
<ide> t.numrange :num_range
<ide> t.tsrange :ts_range
<ide> def setup
<ide> return skip "do not test on PG without range"
<ide> end
<ide>
<del> insert_range(id: 1,
<add> insert_range(id: 101,
<ide> date_range: "[''2012-01-02'', ''2012-01-04'']",
<ide> num_range: "[0.1, 0.2]",
<ide> ts_range: "[''2010-01-01 14:30'', ''2011-01-01 14:30'']",
<ide> tstz_range: "[''2010-01-01 14:30:00+05'', ''2011-01-01 14:30:00-03'']",
<ide> int4_range: "[1, 10]",
<ide> int8_range: "[10, 100]")
<ide>
<del> insert_range(id: 2,
<add> insert_range(id: 102,
<ide> date_range: "(''2012-01-02'', ''2012-01-04'')",
<ide> num_range: "[0.1, 0.2)",
<ide> ts_range: "[''2010-01-01 14:30'', ''2011-01-01 14:30'')",
<ide> tstz_range: "[''2010-01-01 14:30:00+05'', ''2011-01-01 14:30:00-03'')",
<ide> int4_range: "(1, 10)",
<ide> int8_range: "(10, 100)")
<ide>
<del> insert_range(id: 3,
<add> insert_range(id: 103,
<ide> date_range: "(''2012-01-02'',]",
<ide> num_range: "[0.1,]",
<ide> ts_range: "[''2010-01-01 14:30'',]",
<ide> tstz_range: "[''2010-01-01 14:30:00+05'',]",
<ide> int4_range: "(1,]",
<ide> int8_range: "(10,]")
<ide>
<del> insert_range(id: 4,
<add> insert_range(id: 104,
<ide> date_range: "[,]",
<ide> num_range: "[,]",
<ide> ts_range: "[,]",
<ide> tstz_range: "[,]",
<ide> int4_range: "[,]",
<ide> int8_range: "[,]")
<ide>
<del> insert_range(id: 5,
<add> insert_range(id: 105,
<ide> date_range: "(''2012-01-02'', ''2012-01-02'')",
<ide> num_range: "(0.1, 0.1)",
<ide> ts_range: "(''2010-01-01 14:30'', ''2010-01-01 14:30'')",
<ide> def setup
<ide> int8_range: "(10, 10)")
<ide>
<ide> @new_range = PostgresqlRange.new
<del> @first_range = PostgresqlRange.find(1)
<del> @second_range = PostgresqlRange.find(2)
<del> @third_range = PostgresqlRange.find(3)
<del> @fourth_range = PostgresqlRange.find(4)
<del> @empty_range = PostgresqlRange.find(5)
<add> @first_range = PostgresqlRange.find(101)
<add> @second_range = PostgresqlRange.find(102)
<add> @third_range = PostgresqlRange.find(103)
<add> @fourth_range = PostgresqlRange.find(104)
<add> @empty_range = PostgresqlRange.find(105)
<ide> end
<ide>
<ide> def test_data_type_of_range_types | 1 |
PHP | PHP | add a "where date" statement to the query | 6469e261ec75a415fd626a4b5ab9bb07adddcd43 | <ide><path>src/Illuminate/Database/Query/Builder.php
<ide> public function orWhereNotNull($column)
<ide> {
<ide> return $this->whereNotNull($column, 'or');
<ide> }
<del>
<add>
<add> /**
<add> * Add a "where date" statement to the query.
<add> *
<add> * @param string $column
<add> * @param string $operator
<add> * @param int $value
<add> * @param string $boolean
<add> * @return \Illuminate\Database\Query\Builder|static
<add> */
<add> public function whereDate($column, $operator, $value, $boolean = 'and')
<add> {
<add> return $this->addDateBasedWhere('Date', $column, $operator, $value, $boolean);
<add> }
<add>
<ide> /**
<ide> * Add a "where day" statement to the query.
<ide> * | 1 |
Javascript | Javascript | improve code readability | bd76c7a3ecce17b8bf3004e4cc626f6ec8966e85 | <ide><path>examples/js/loaders/AssimpLoader.js
<ide> THREE.AssimpLoader.prototype = {
<ide>
<ide> }
<ide>
<del> if ( ! key ) return null;
<add> if ( ! key ) {
<add>
<add> return null;
<ide>
<del> if ( key && nextKey ) {
<add> } else if ( nextKey ) {
<ide>
<ide> var dT = nextKey.mTime - key.mTime;
<ide> var T = key.mTime - time;
<ide> var l = T / dT;
<ide>
<ide> return lerp( key.mValue.toTHREE(), nextKey.mValue.toTHREE(), l );
<ide>
<del> }
<add> } else {
<ide>
<del> nextKey = keys[ 0 ].clone();
<del> nextKey.mTime += lne;
<add> nextKey = keys[ 0 ].clone();
<add> nextKey.mTime += lne;
<ide>
<del> var dT = nextKey.mTime - key.mTime;
<del> var T = key.mTime - time;
<del> var l = T / dT;
<add> var dT = nextKey.mTime - key.mTime;
<add> var T = key.mTime - time;
<add> var l = T / dT;
<ide>
<del> return lerp( key.mValue.toTHREE(), nextKey.mValue.toTHREE(), l );
<add> return lerp( key.mValue.toTHREE(), nextKey.mValue.toTHREE(), l );
<add>
<add> }
<ide>
<ide> }
<ide> | 1 |
Javascript | Javascript | add prop() support | 3800d177030d20c5c3d04e3601f892c46e723dc2 | <ide><path>src/jqLite.js
<ide> * - [eq()](http://api.jquery.com/eq/)
<ide> * - [hasClass()](http://api.jquery.com/hasClass/)
<ide> * - [parent()](http://api.jquery.com/parent/)
<add> * - [prop()](http://api.jquery.com/prop/)
<ide> * - [remove()](http://api.jquery.com/remove/)
<ide> * - [removeAttr()](http://api.jquery.com/removeAttr/)
<ide> * - [removeClass()](http://api.jquery.com/removeClass/)
<ide> forEach({
<ide> }
<ide> },
<ide>
<add> prop: function(element, name, value) {
<add> if (isDefined(value)) {
<add> element[name] = value;
<add> } else {
<add> return element[name];
<add> }
<add> },
<add>
<ide> text: extend((msie < 9)
<ide> ? function(element, value) {
<ide> // NodeType == 3 is text node
<ide><path>test/jqLiteSpec.js
<ide> describe('jqLite', function(){
<ide> });
<ide>
<ide>
<add> describe('prop', function() {
<add> it('should read element property', function() {
<add> var elm = jqLite('<div class="foo">a</div>');
<add> expect(elm.prop('className')).toBe('foo');
<add> });
<add>
<add> it('should set element property to a value', function() {
<add> var elm = jqLite('<div class="foo">a</div>');
<add> elm.prop('className', 'bar');
<add> expect(elm[0].className).toBe('bar');
<add> expect(elm.prop('className')).toBe('bar');
<add> });
<add>
<add> it('should set boolean element property', function() {
<add> var elm = jqLite('<input type="checkbox">');
<add> expect(elm.prop('checked')).toBe(false);
<add>
<add> elm.prop('checked', true);
<add> expect(elm.prop('checked')).toBe(true);
<add>
<add> elm.prop('checked', '');
<add> expect(elm.prop('checked')).toBe(false);
<add>
<add> elm.prop('checked', 'lala');
<add> expect(elm.prop('checked')).toBe(true);
<add>
<add> elm.prop('checked', null);
<add> expect(elm.prop('checked')).toBe(false);
<add> });
<add> });
<add>
<add>
<ide> describe('class', function(){
<ide>
<ide> describe('hasClass', function(){ | 2 |
Javascript | Javascript | remove explicit names from initializers | 15c10d5692f7eb3b354334d03a54c4c6a20a388c | <ide><path>blueprints/initializer/files/__root__/initializers/__name__.js
<ide> export function initialize(/* application */) {
<ide> }
<ide>
<ide> export default {
<del> name: '<%= dasherizedModuleName %>',
<ide> initialize
<ide> };
<ide><path>blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js
<ide> export function initialize(/* appInstance */) {
<ide> }
<ide>
<ide> export default {
<del> name: '<%= dasherizedModuleName %>',
<ide> initialize
<ide> };
<ide><path>node-tests/blueprints/initializer-test.js
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide> }));
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide> }));
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide> }));
<ide> describe('Acceptance: ember generate and destroy initializer', function() {
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide> }));
<ide><path>node-tests/blueprints/instance-initializer-test.js
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide>
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide> }));
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide> }));
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide> }));
<ide> describe('Acceptance: ember generate and destroy instance-initializer', function
<ide> "}\n" +
<ide> "\n" +
<ide> "export default {\n" +
<del> " name: 'foo/bar',\n" +
<ide> " initialize\n" +
<ide> "};");
<ide> })); | 4 |
Javascript | Javascript | use href instead of search to remove code uri | fb9c1001b053939b2fce715ba139e41e3374e163 | <ide><path>client/utils/code-uri.js
<ide> export function getCodeUri(location, decodeURIComponent) {
<ide>
<ide> export function removeCodeUri(location, history) {
<ide> if (
<del> typeof location.search.split !== 'function' ||
<add> typeof location.href.split !== 'function' ||
<ide> typeof history.replaceState !== 'function'
<ide> ) {
<ide> return false;
<ide> }
<ide> history.replaceState(
<ide> history.state,
<ide> null,
<del> location.search.split('?')[0]
<add> location.href.split('?')[0]
<ide> );
<ide> return true;
<ide> } | 1 |
Ruby | Ruby | remove unused method | 054e2c42a532d4f160bdb36d2b3864880c16ce4b | <ide><path>activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
<ide> def supports_primary_key?
<ide> false
<ide> end
<ide>
<del> # Does this adapter support using DISTINCT within COUNT?
<del> def supports_count_distinct?
<del> true
<del> end
<del>
<ide> # Does this adapter support DDL rollbacks in transactions? That is, would
<ide> # CREATE TABLE or ALTER TABLE get rolled back by a transaction?
<ide> def supports_ddl_transactions? | 1 |
Ruby | Ruby | add another integration test on macos | 902993afe40aff3a29f94546223a3bbc4de19264 | <ide><path>Library/Homebrew/test/dev-cmd/bottle_spec.rb
<ide> def stub_hash(parameters)
<ide> end
<ide> end
<ide>
<del>describe "brew bottle --merge", :integration_test, :needs_linux do
<add>describe "brew bottle --merge", :integration_test do
<ide> let(:core_tap) { CoreTap.new }
<ide> let(:tarball) do
<ide> if OS.linux? | 1 |
Javascript | Javascript | add methods for formcontroller | 83f445336f80a41f20a83f5b933fccd529cdc9a7 | <ide><path>src/ng/directive/form.js
<ide> var nullFormCtrl = {
<ide> *
<ide> * - keys are validation tokens (error names) — such as `required`, `url` or `email`),
<ide> * - values are arrays of controls or forms that are invalid with given error.
<del> *
<add> *
<ide> * @description
<ide> * `FormController` keeps track of all its controls and nested forms as well as state of them,
<ide> * such as being valid/invalid or dirty/pristine.
<ide> function FormController(element, attrs) {
<ide> addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey);
<ide> }
<ide>
<add> /**
<add> * @ngdoc function
<add> * @name ng.directive:form.FormController#$addControl
<add> * @methodOf ng.directive:form.FormController
<add> *
<add> * @description
<add> * Register a control with the form.
<add> *
<add> * Input elements using ngModelController do this automatically when they are linked.
<add> */
<ide> form.$addControl = function(control) {
<ide> controls.push(control);
<ide>
<ide> function FormController(element, attrs) {
<ide> }
<ide> };
<ide>
<add> /**
<add> * @ngdoc function
<add> * @name ng.directive:form.FormController#$removeControl
<add> * @methodOf ng.directive:form.FormController
<add> *
<add> * @description
<add> * Deregister a control from the form.
<add> *
<add> * Input elements using ngModelController do this automatically when they are destroyed.
<add> */
<ide> form.$removeControl = function(control) {
<ide> if (control.$name && form[control.$name] === control) {
<ide> delete form[control.$name];
<ide> function FormController(element, attrs) {
<ide> arrayRemove(controls, control);
<ide> };
<ide>
<add> /**
<add> * @ngdoc function
<add> * @name ng.directive:form.FormController#$setValidity
<add> * @methodOf ng.directive:form.FormController
<add> *
<add> * @description
<add> * Sets the validity of a form control.
<add> *
<add> * This method will also propagate to parent forms.
<add> */
<ide> form.$setValidity = function(validationToken, isValid, control) {
<ide> var queue = errors[validationToken];
<ide>
<ide> function FormController(element, attrs) {
<ide> }
<ide> };
<ide>
<add> /**
<add> * @ngdoc function
<add> * @name ng.directive:form.FormController#$setDirty
<add> * @methodOf ng.directive:form.FormController
<add> *
<add> * @description
<add> * Sets the form to a dirty state.
<add> *
<add> * This method can be called to add the 'ng-dirty' class and set the form to a dirty
<add> * state (ng-dirty class). This method will also propagate to parent forms.
<add> */
<ide> form.$setDirty = function() {
<ide> element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
<ide> form.$dirty = true; | 1 |
Javascript | Javascript | fix navigator transition | 5189c94a6e876ef5274b22c083034a561ef3d5e8 | <ide><path>Libraries/CustomComponents/Navigator/Navigator.js
<ide> var Navigator = React.createClass({
<ide> },
<ide>
<ide> _transitionTo: function(destIndex, velocity, jumpSpringTo, cb) {
<del> if (
<del> destIndex === this.state.presentedIndex &&
<del> this.state.transitionQueue.length === 0
<del> ) {
<add> if (this.state.presentedIndex === destIndex) {
<add> cb && cb();
<ide> return;
<ide> }
<add>
<ide> if (this.state.transitionFromIndex !== null) {
<add> // Navigation is still transitioning, put the `destIndex` into queue.
<ide> this.state.transitionQueue.push({
<ide> destIndex,
<ide> velocity, | 1 |
PHP | PHP | move property declaration to parent class | 6c9eb4e8e9ddfecd148ba633fdb53b82d018560d | <ide><path>src/Error/BaseErrorHandler.php
<ide> abstract class BaseErrorHandler
<ide> {
<ide>
<add> /**
<add> * Options to use for the Error handling.
<add> *
<add> * @var array
<add> */
<add> protected $_options = [];
<add>
<ide> /**
<ide> * Display an error message in an environment specific way.
<ide> *
<ide><path>src/Error/ErrorHandler.php
<ide> */
<ide> class ErrorHandler extends BaseErrorHandler
<ide> {
<del>
<del> /**
<del> * Options to use for the Error handling.
<del> *
<del> * @var array
<del> */
<del> protected $_options = [];
<del>
<ide> /**
<ide> * Constructor
<ide> * | 2 |
Go | Go | ignore `label` and `label!` prune filters | 62923f29f514fa621e7c31011c11c610cfe33ecd | <ide><path>builder/builder-next/builder.go
<ide> func (b *Builder) Prune(ctx context.Context, opts types.BuildCachePruneOptions)
<ide> validFilters := make(map[string]bool, 1+len(cacheFields))
<ide> validFilters["unused-for"] = true
<ide> validFilters["until"] = true
<add> validFilters["label"] = true // TODO(tiborvass): handle label
<add> validFilters["label!"] = true // TODO(tiborvass): handle label!
<ide> for k, v := range cacheFields {
<ide> validFilters[k] = v
<ide> } | 1 |
Python | Python | remove some more stuff | 7a5d2b998423e4392c6a8a93b1ab5ff5abd70bfe | <ide><path>libcloud/dns/drivers/rackspace.py
<ide> class RackspaceUKDNSDriver(RackspaceDNSDriver):
<ide> name = 'Rackspace DNS (UK)'
<ide> type = Provider.RACKSPACE_UK
<ide> connectionCls = RackspaceUKDNSConnection
<del>
<del>
<del>class RackspaceAUDNSDriver(RackspaceDNSDriver):
<del> name = 'Rackspace DNS (AU)'
<del> type = Provider.RACKSPACE_AU
<del> connectionCls = RackspaceAUDNSConnection
<ide><path>libcloud/dns/providers.py
<ide> ('libcloud.dns.drivers.rackspace', 'RackspaceUSDNSDriver'),
<ide> Provider.RACKSPACE_UK:
<ide> ('libcloud.dns.drivers.rackspace', 'RackspaceUKDNSDriver'),
<del> Provider.RACKSPACE_AU:
<del> ('libcloud.dns.drivers.rackspace', 'RackspaceAUDNSDriver'),
<ide> Provider.HOSTVIRTUAL:
<ide> ('libcloud.dns.drivers.hostvirtual', 'HostVirtualDNSDriver'),
<ide> Provider.ROUTE53:
<ide><path>libcloud/dns/types.py
<ide> class Provider(object):
<ide> ZERIGO = 'zerigo'
<ide> RACKSPACE_US = 'rackspace_us'
<ide> RACKSPACE_UK = 'rackspace_uk'
<del> RACKSPACE_AU = 'rackspace_au'
<ide> ROUTE53 = 'route53'
<ide> HOSTVIRTUAL = 'hostvirtual'
<ide> GANDI = 'gandi'
<ide><path>libcloud/loadbalancer/drivers/rackspace.py
<ide> def _iso_to_datetime(self, isodate):
<ide>
<ide> class RackspaceUKLBDriver(RackspaceLBDriver):
<ide> connectionCls = RackspaceUKConnection
<del>
<del>
<del>class RackspaceAULBDriver(RackspaceLBDriver):
<del> connectionCls = RackspaceAUConnection
<ide><path>libcloud/loadbalancer/providers.py
<ide> ('libcloud.loadbalancer.drivers.rackspace', 'RackspaceLBDriver'),
<ide> Provider.RACKSPACE_UK:
<ide> ('libcloud.loadbalancer.drivers.rackspace', 'RackspaceUKLBDriver'),
<del> Provider.RACKSPACE_AU:
<del> ('libcloud.loadbalancer.drivers.rackspace', 'RackspaceAULBDriver'),
<ide> Provider.GOGRID:
<ide> ('libcloud.loadbalancer.drivers.gogrid', 'GoGridLBDriver'),
<ide> Provider.NINEFOLD:
<ide><path>libcloud/loadbalancer/types.py
<ide> class Provider(object):
<ide> GOGRID = 'gogrid'
<ide> NINEFOLD = 'ninefold'
<ide> RACKSPACE_UK = 'rackspace_uk'
<del> RACKSPACE_AU = 'rackspace_au'
<ide> BRIGHTBOX = 'brightbox'
<ide> ELB = 'elb'
<ide> | 6 |
PHP | PHP | apply fixes from styleci | 656d0af4577d36770831db97df56305ffd65421b | <ide><path>src/Illuminate/Database/Eloquent/Relations/MorphToMany.php
<ide> public function getRelationExistenceQuery(Builder $query, Builder $parentQuery,
<ide> protected function getCurrentlyAttachedPivots()
<ide> {
<ide> return parent::getCurrentlyAttachedPivots()->map(function ($record) {
<del> return $record->setMorphType($this->morphType)
<add> return $record->setMorphType($this->morphType)
<ide> ->setMorphClass($this->morphClass);
<ide> });
<ide> } | 1 |
Python | Python | fix some lint errors | d945e99f666a096ecaf57fd6e2d556444de1dd8a | <ide><path>official/resnet/keras/keras_common.py
<ide> import time
<ide>
<ide> from absl import flags
<del>import numpy as np
<add>import numpy as np # pylint: disable=g-bad-import-order
<ide> import tensorflow as tf # pylint: disable=g-bad-import-order
<ide>
<ide> from tensorflow.python.keras.optimizer_v2 import gradient_descent as gradient_descent_v2
<ide> def input_fn(is_training, data_dir, batch_size, *args, **kwargs):
<ide> return data
<ide>
<ide> return input_fn
<del>
<ide><path>official/resnet/keras/keras_common_test.py
<ide> def _build_history(self, loss, cat_accuracy=None,
<ide> def _build_eval_output(self, top_1, eval_loss):
<ide> eval_output = [np.float64(eval_loss), np.float64(top_1)]
<ide> return eval_output
<del> | 2 |
Javascript | Javascript | clarify the context under which log-file is used | 71526995c29de8d9a13c8b5041b24eaf5ad0c891 | <ide><path>src/main-process/parse-command-line.js
<ide> module.exports = function parseCommandLine(processArgs) {
<ide> options
<ide> .alias('l', 'log-file')
<ide> .string('l')
<del> .describe('l', 'Log all output to file.');
<add> .describe('l', 'Log all output to file when running tests.');
<ide> options
<ide> .alias('n', 'new-window')
<ide> .boolean('n') | 1 |
PHP | PHP | refactor the gate | 5c4541bc43f22b0d99c5cc6db38781060bff836f | <ide><path>src/Illuminate/Auth/Access/Gate.php
<ide> class Gate implements GateContract
<ide> * @param array $afterCallbacks
<ide> * @return void
<ide> */
<del> public function __construct(Container $container, callable $userResolver, array $abilities = [], array $policies = [], array $beforeCallbacks = [], array $afterCallbacks = [])
<add> public function __construct(Container $container, callable $userResolver, array $abilities = [],
<add> array $policies = [], array $beforeCallbacks = [], array $afterCallbacks = [])
<ide> {
<ide> $this->policies = $policies;
<ide> $this->container = $container;
<ide> public function authorize($ability, $arguments = [])
<ide> }
<ide>
<ide> /**
<del> * Get the raw result for the given ability for the current user.
<add> * Get the raw result from the authorization callback.
<ide> *
<ide> * @param string $ability
<ide> * @param array|mixed $arguments
<ide> protected function raw($ability, $arguments = [])
<ide>
<ide> $arguments = is_array($arguments) ? $arguments : [$arguments];
<ide>
<del> if (is_null($result = $this->callBeforeCallbacks($user, $ability, $arguments))) {
<add> // First we will call the "before" callbacks for the Gate. If any of these give
<add> // back a non-null response, we will immediately return that result in order
<add> // to let the developers override all checks for some authorization cases.
<add> $result = $this->callBeforeCallbacks(
<add> $user, $ability, $arguments
<add> );
<add>
<add> if (is_null($result)) {
<ide> $result = $this->callAuthCallback($user, $ability, $arguments);
<ide> }
<ide>
<add> // After calling the authorization callback, we will call the "after" callbacks
<add> // that are registered with the Gate, which allows a developer to do logging
<add> // if that is required for this application. Then we'll return the result.
<ide> $this->callAfterCallbacks(
<ide> $user, $ability, $arguments, $result
<ide> );
<ide> protected function callAfterCallbacks($user, $ability, array $arguments, $result
<ide> protected function resolveAuthCallback($user, $ability, array $arguments)
<ide> {
<ide> if (isset($arguments[0])) {
<del> $policy = $this->getPolicyFor($arguments[0]);
<del>
<del> if ($policy !== null) {
<add> if (! is_null($policy = $this->getPolicyFor($arguments[0]))) {
<ide> return $this->resolvePolicyCallback($user, $ability, $arguments, $policy);
<ide> }
<ide> }
<ide> protected function resolveAuthCallback($user, $ability, array $arguments)
<ide> }
<ide> }
<ide>
<add> /**
<add> * Get a policy instance for a given class.
<add> *
<add> * @param object|string $class
<add> * @return mixed
<add> */
<add> public function getPolicyFor($class)
<add> {
<add> if (is_object($class)) {
<add> $class = get_class($class);
<add> }
<add>
<add> if (isset($this->policies[$class])) {
<add> return $this->resolvePolicy($this->policies[$class]);
<add> }
<add>
<add> foreach ($this->policies as $expected => $policy) {
<add> if (is_subclass_of($class, $expected)) {
<add> return $this->resolvePolicy($policy);
<add> }
<add> }
<add> }
<add>
<add> /**
<add> * Build a policy class instance of the given type.
<add> *
<add> * @param object|string $class
<add> * @return mixed
<add> */
<add> public function resolvePolicy($class)
<add> {
<add> return $this->container->make($class);
<add> }
<add>
<ide> /**
<ide> * Resolve the callback for a policy check.
<ide> *
<ide> protected function resolveAuthCallback($user, $ability, array $arguments)
<ide> protected function resolvePolicyCallback($user, $ability, array $arguments, $policy)
<ide> {
<ide> return function () use ($user, $ability, $arguments, $policy) {
<del> // If we receive a non-null result from the before method, we will return it
<del> // as the final result. This will allow developers to override the checks
<del> // in the policy to return a result for all rules defined in the class.
<del> if (method_exists($policy, 'before')) {
<del> if (! is_null($result = $policy->before($user, $ability, ...$arguments))) {
<del> return $result;
<del> }
<add> // This callback will be responsible for calling the policy's before method and
<add> // running this policy method if necessary. This is used to when objects are
<add> // mapped to policy objects in the user's configurations or on this class.
<add> $result = $this->callPolicyBefore(
<add> $policy, $user, $ability, $arguments
<add> );
<add>
<add> // When we receive a non-null result from this before method, we will return it
<add> // as the "final" results. This will allow developers to override the checks
<add> // in this policy to return the result for all rules defined in the class.
<add> if (! is_null($result)) {
<add> return $result;
<ide> }
<ide>
<del> if (strpos($ability, '-') !== false) {
<del> $ability = Str::camel($ability);
<del> }
<add> $ability = $this->formatAbilityToMethod($ability);
<ide>
<del> // If the first argument is a string, that means they are passing a class name
<del> // to the policy. We will remove the first argument from this argument list
<del> // because the policy already knows what type of models it can authorize.
<add> // If this first argument is a string, that means they are passing a class name
<add> // to the policy. We will remove the first argument from this argument array
<add> // because this policy already knows what type of models it can authorize.
<ide> if (isset($arguments[0]) && is_string($arguments[0])) {
<ide> array_shift($arguments);
<ide> }
<ide>
<del> if (! is_callable([$policy, $ability])) {
<del> return false;
<del> }
<del>
<del> return $policy->{$ability}($user, ...$arguments);
<add> return is_callable([$policy, $ability])
<add> ? $policy->{$ability}($user, ...$arguments)
<add> : false;
<ide> };
<ide> }
<ide>
<ide> /**
<del> * Get a policy instance for a given class.
<add> * Call the "before" method on the given policy, if applicable.
<ide> *
<del> * @param object|string $class
<add> * @param mixed $policy
<add> * @param \Illuminate\Contracts\Auth\Authenticatable $user
<add> * @param string $ability
<add> * @param array $arguments
<ide> * @return mixed
<ide> */
<del> public function getPolicyFor($class)
<add> protected function callPolicyBefore($policy, $user, $ability, $arguments)
<ide> {
<del> if (is_object($class)) {
<del> $class = get_class($class);
<del> }
<del>
<del> if (isset($this->policies[$class])) {
<del> return $this->resolvePolicy($this->policies[$class]);
<del> }
<del>
<del> foreach ($this->policies as $expected => $policy) {
<del> if (is_subclass_of($class, $expected)) {
<del> return $this->resolvePolicy($policy);
<del> }
<add> if (method_exists($policy, 'before')) {
<add> return $policy->before($user, $ability, ...$arguments);
<ide> }
<ide> }
<ide>
<ide> /**
<del> * Build a policy class instance of the given type.
<add> * Format the policy ability into a method name.
<ide> *
<del> * @param object|string $class
<del> * @return mixed
<add> * @param string $ability
<add> * @return string
<ide> */
<del> public function resolvePolicy($class)
<add> protected function formatAbilityToMethod($ability)
<ide> {
<del> return $this->container->make($class);
<add> return strpos($ability, '-') !== false ? Str::camel($ability) : $ability;
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | change replacement string | 0ca8b1df201044019596db7173d784aeebdea0a7 | <ide><path>src/stringify.js
<ide> function serializeObject(obj) {
<ide> val = toJsonReplacer(key, val);
<ide> if (isObject(val)) {
<ide>
<del> if (seen.indexOf(val) >= 0) return '<<already seen>>';
<add> if (seen.indexOf(val) >= 0) return '...';
<ide>
<ide> seen.push(val);
<ide> }
<ide><path>test/minErrSpec.js
<ide> describe('minErr', function() {
<ide> a.b.a = a;
<ide>
<ide> var myError = testError('26', 'a is {0}', a);
<del> expect(myError.message).toMatch(/a is {"b":{"a":"<<already seen>>"}}/);
<add> expect(myError.message).toMatch(/a is {"b":{"a":"..."}}/);
<ide> });
<ide>
<ide> it('should preserve interpolation markers when fewer arguments than needed are provided', function() {
<ide><path>test/stringifySpec.js
<ide> describe('toDebugString', function() {
<ide> expect(toDebugString()).toEqual('undefined');
<ide> var a = { };
<ide> a.a = a;
<del> expect(toDebugString(a)).toEqual('{"a":"<<already seen>>"}');
<del> expect(toDebugString([a,a])).toEqual('[{"a":"<<already seen>>"},"<<already seen>>"]');
<add> expect(toDebugString(a)).toEqual('{"a":"..."}');
<add> expect(toDebugString([a,a])).toEqual('[{"a":"..."},"..."]');
<ide> });
<ide> }); | 3 |
Text | Text | remove references to resnext from docs | 4385de660eb47251e09d2f5c3f79d3c9f10727dd | <ide><path>docs/templates/applications.md
<ide> Weights are downloaded automatically when instantiating a model. They are stored
<ide> - [Xception](#xception)
<ide> - [VGG16](#vgg16)
<ide> - [VGG19](#vgg19)
<del>- [ResNet, ResNetV2, ResNeXt](#resnet)
<add>- [ResNet, ResNetV2](#resnet)
<ide> - [InceptionV3](#inceptionv3)
<ide> - [InceptionResNetV2](#inceptionresnetv2)
<ide> - [MobileNet](#mobilenet)
<ide> model = InceptionV3(input_tensor=input_tensor, weights='imagenet', include_top=T
<ide> | [ResNet50V2](#resnet) | 98 MB | 0.760 | 0.930 | 25,613,800 | - |
<ide> | [ResNet101V2](#resnet) | 171 MB | 0.772 | 0.938 | 44,675,560 | - |
<ide> | [ResNet152V2](#resnet) | 232 MB | 0.780 | 0.942 | 60,380,648 | - |
<del>| [ResNeXt50](#resnet) | 96 MB | 0.777 | 0.938 | 25,097,128 | - |
<del>| [ResNeXt101](#resnet) | 170 MB | 0.787 | 0.943 | 44,315,560 | - |
<ide> | [InceptionV3](#inceptionv3) | 92 MB | 0.779 | 0.937 | 23,851,784 | 159 |
<ide> | [InceptionResNetV2](#inceptionresnetv2) | 215 MB | 0.803 | 0.953 | 55,873,736 | 572 |
<ide> | [MobileNet](#mobilenet) | 16 MB | 0.704 | 0.895 | 4,253,864 | 88 |
<ide> keras.applications.resnet.ResNet152(include_top=True, weights='imagenet', input_
<ide> keras.applications.resnet_v2.ResNet50V2(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
<ide> keras.applications.resnet_v2.ResNet101V2(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
<ide> keras.applications.resnet_v2.ResNet152V2(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
<del>keras.applications.resnext.ResNeXt50(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
<del>keras.applications.resnext.ResNeXt101(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
<ide> ```
<ide>
<ide>
<del>ResNet, ResNetV2, ResNeXt models, with weights pre-trained on ImageNet.
<add>ResNet, ResNetV2 models, with weights pre-trained on ImageNet.
<ide>
<ide> This model and can be built both with `'channels_first'` data format (channels, height, width) or `'channels_last'` data format (height, width, channels).
<ide>
<ide> A Keras `Model` instance.
<ide>
<ide> - `ResNet`: [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)
<ide> - `ResNetV2`: [Identity Mappings in Deep Residual Networks](https://arxiv.org/abs/1603.05027)
<del>- `ResNeXt`: [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/abs/1611.05431)
<ide>
<ide> ### License
<ide>
<ide> These weights are ported from the following:
<ide>
<ide> - `ResNet`: [The original repository of Kaiming He](https://github.com/KaimingHe/deep-residual-networks) under the [MIT license](https://github.com/KaimingHe/deep-residual-networks/blob/master/LICENSE).
<ide> - `ResNetV2`: [Facebook](https://github.com/facebook/fb.resnet.torch) under the [BSD license](https://github.com/facebook/fb.resnet.torch/blob/master/LICENSE).
<del>- `ResNeXt`: [Facebook AI Research](https://github.com/facebookresearch/ResNeXt) under the [BSD license](https://github.com/facebookresearch/ResNeXt/blob/master/LICENSE).
<ide>
<ide> -----
<ide> | 1 |
Text | Text | update theme docs | 53b0ac22cc3483acc8c71f4b360605f66313f865 | <ide><path>docs/creating-a-theme.md
<ide> themes which are loaded later (the order is controlled from within the Settings
<ide> pane).
<ide>
<ide> This flexibility is helpful for users which prefer a light interface with a dark
<del>syntax theme. Atom currently has interface and syntax themes but it's easy see
<del>how one might want to create their own language specific syntax theme for very
<del>specific styling.
<add>syntax theme. Atom currently has only interface and syntax themes but it is
<add>possible to create a theme to style something specific — say a changing
<add>the colors in the tree view or creating a language specific syntax theme.
<ide>
<ide> ## Getting Started
<ide>
<ide> a few things before starting:
<ide> inspect the current state of the interface. Checkout Google's
<ide> [extensive tutorial][devtools-tutorial] for a short introduction.
<ide>
<del># Creating a Minimal Syntax Theme
<add>## Creating a Minimal Syntax Theme
<ide>
<del>1. Open the Command Palette (`cmd+p`)
<add>1. Open the Command Palette (`cmd-p`)
<ide> 1. Search for `Package Generator: Generate Theme` and select it.
<ide> 1. Choose a name for the folder which will contain your theme.
<ide> 1. An Atom window will open with your newly created theme.
<ide> contains all of the variables provided by the [core themes][ui-variables].
<ide> Syntax themes don't need to provide any variables to other themes and only
<ide> target elements within the editor.
<ide>
<del>## How to Style a Specific Element
<add>## Development workflow
<ide>
<del>Once you've got the basics down you'll find that there will be changes you want
<del>to make but you aren't sure how to reference an element. That's when the
<del>devtools become really useful. To open them use `cmd+alt+i` and switch to the
<del>`Elements` tab to inspect the element you're interested in.
<add>There are a few of tools to help make theme development much faster.
<add>
<add>### Live Reload
<add>
<add>Reloading via `cmd-r` after you make changes to your theme is slow. Atom
<add>supports [live updating][livereload] of styles on Dev Mode Atom windows.
<add>
<add>1. Open your theme directory in a dev window by either using the
<add>__File > Open in Dev Mode__ menu or the `cmd-shift-o` shortcut
<add>1. Make a change to your theme file and save — your change should be
<add>immediately applied!
<add>
<add>If you'd like to reload all styles at any time, you can use the shortcut
<add>`cmd-ctrl-shift-r`.
<add>
<add>### Developer Tools
<add>
<add>Atom is based on the Chrome browser, and supports Chrome's Developer Tools. You
<add>can open them by selecting the __View > Toggle Developer Tools__ or by using the
<add>`cmd-option-i` shortcut.
<add>
<add>The dev tools allow you to inspect elements and take a look at their CSS
<add>properties.
<add>
<add>![devtools-img]
<add>
<add>### Atom Styleguide
<add>
<add>If you are creating an interface theme, you'll want a way to see how your theme
<add>changes affect all the components in the system. The [styleguide] is a page with
<add>every component Atom supports rendered.
<add>
<add>To open the styleguide, open the command palette (`cmd-p`) and search for
<add>styleguide or use the shortcut `cmd-ctrl-shift-g`.
<add>
<add>![styleguide-img]
<ide>
<ide> [less]: http://lesscss.org/
<ide> [git]: http://git-scm.com/
<ide> devtools become really useful. To open them use `cmd+alt+i` and switch to the
<ide> [less-tutorial]: https://speakerdeck.com/danmatthews/less-css
<ide> [devtools-tutorial]: https://developers.google.com/chrome-developer-tools/docs/elements
<ide> [ui-variables]: https://github.com/atom/atom-dark-ui/blob/master/stylesheets/ui-variables.less
<add>[livereload]: https://github.com/atom/dev-live-reload
<add>[styleguide]: https://github.com/atom/styleguide
<add>[styleguide-img]: https://f.cloud.github.com/assets/69169/1347390/2d431d98-36af-11e3-8f8e-3f4ce1e67adb.png
<add>[devtools-img]: https://f.cloud.github.com/assets/69169/1347391/2d51f91c-36af-11e3-806f-f7b334af43e9.png | 1 |
Python | Python | add legacy command displaying new cli counterparts | 201823b91a931b6d78ef8efa48d11394a6fbf318 | <ide><path>airflow/cli/cli_parser.py
<ide> from tabulate import tabulate_formats
<ide>
<ide> from airflow import settings
<add>from airflow.cli.commands.legacy_commands import check_legacy_command
<ide> from airflow.configuration import conf
<ide> from airflow.exceptions import AirflowException
<ide> from airflow.executors.executor_loader import ExecutorLoader
<ide> def _check_value(self, action, value):
<ide> if value == 'celery' and executor != ExecutorLoader.CELERY_EXECUTOR:
<ide> message = f'celery subcommand works only with CeleryExecutor, your current executor: {executor}'
<ide> raise ArgumentError(action, message)
<add> if action.choices is not None and value not in action.choices:
<add> check_legacy_command(action, value)
<ide>
<ide> super()._check_value(action, value)
<ide>
<ide><path>airflow/cli/commands/legacy_commands.py
<add># Licensed to the Apache Software Foundation (ASF) under one
<add># or more contributor license agreements. See the NOTICE file
<add># distributed with this work for additional information
<add># regarding copyright ownership. The ASF licenses this file
<add># to you under the Apache License, Version 2.0 (the
<add># "License"); you may not use this file except in compliance
<add># with the License. You may obtain a copy of the License at
<add>#
<add># http://www.apache.org/licenses/LICENSE-2.0
<add>#
<add># Unless required by applicable law or agreed to in writing,
<add># software distributed under the License is distributed on an
<add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
<add># KIND, either express or implied. See the License for the
<add># specific language governing permissions and limitations
<add># under the License.
<add>
<add>from argparse import ArgumentError
<add>
<add>COMMAND_MAP = {
<add> "worker": "celery worker",
<add> "flower": "celery flower",
<add> "trigger_dag": "dags trigger",
<add> "delete_dag": "dags delete",
<add> "show_dag": "dags show",
<add> "list_dag": "dags list",
<add> "dag_status": "dags status",
<add> "backfill": "dags backfill",
<add> "list_dag_runs": "dags list_runs",
<add> "pause": "dags pause",
<add> "unpause": "dags unpause",
<add> "test": "tasks test",
<add> "clear": "tasks clear",
<add> "list_tasks": "tasks list",
<add> "task_failed_deps": "tasks failed_deps",
<add> "task_state": "tasks state",
<add> "run": "tasks run",
<add> "render": "tasks render",
<add> "initdb": "db init",
<add> "resetdb": "db reset",
<add> "upgradedb": "db upgrade",
<add> "checkdb": "db check",
<add> "shell": "db shell",
<add> "pool": "pools",
<add> "list_users": "users list",
<add> "create_user": "users create",
<add> "delete_user": "users delete"
<add>}
<add>
<add>
<add>def check_legacy_command(action, value):
<add> """ Checks command value and raise error if value is in removed command """
<add> new_command = COMMAND_MAP.get(value)
<add> if new_command is not None:
<add> msg = f"`airflow {value}` command, has been removed, please use `airflow {new_command}`"
<add> raise ArgumentError(action, msg)
<ide><path>tests/cli/commands/test_legacy_commands.py
<add># Licensed to the Apache Software Foundation (ASF) under one
<add># or more contributor license agreements. See the NOTICE file
<add># distributed with this work for additional information
<add># regarding copyright ownership. The ASF licenses this file
<add># to you under the Apache License, Version 2.0 (the
<add># "License"); you may not use this file except in compliance
<add># with the License. You may obtain a copy of the License at
<add>#
<add># http://www.apache.org/licenses/LICENSE-2.0
<add>#
<add># Unless required by applicable law or agreed to in writing,
<add># software distributed under the License is distributed on an
<add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
<add># KIND, either express or implied. See the License for the
<add># specific language governing permissions and limitations
<add># under the License.
<add>import contextlib
<add>import io
<add>import unittest
<add>from argparse import ArgumentError
<add>from unittest.mock import MagicMock
<add>
<add>from airflow.cli import cli_parser
<add>from airflow.cli.commands import config_command
<add>from airflow.cli.commands.legacy_commands import COMMAND_MAP, check_legacy_command
<add>
<add>LEGACY_COMMANDS = ["worker", "flower", "trigger_dag", "delete_dag", "show_dag", "list_dag",
<add> "dag_status", "backfill", "list_dag_runs", "pause", "unpause", "test",
<add> "clear", "list_tasks", "task_failed_deps", "task_state", "run",
<add> "render", "initdb", "resetdb", "upgradedb", "checkdb", "shell", "pool",
<add> "list_users", "create_user", "delete_user"]
<add>
<add>
<add>class TestCliDeprecatedCommandsValue(unittest.TestCase):
<add> @classmethod
<add> def setUpClass(cls):
<add> cls.parser = cli_parser.get_parser()
<add>
<add> def test_should_display_value(self):
<add> with self.assertRaises(SystemExit) as cm_exception, \
<add> contextlib.redirect_stderr(io.StringIO()) as temp_stderr:
<add> config_command.get_value(self.parser.parse_args(['worker']))
<add>
<add> self.assertEqual(2, cm_exception.exception.code)
<add> self.assertIn(
<add> "`airflow worker` command, has been removed, "
<add> "please use `airflow celery worker`, see help above.",
<add> temp_stderr.getvalue().strip()
<add> )
<add>
<add> def test_command_map(self):
<add> for item in LEGACY_COMMANDS:
<add> self.assertIsNotNone(COMMAND_MAP[item])
<add>
<add> def test_check_legacy_command(self):
<add> action = MagicMock()
<add> with self.assertRaises(ArgumentError) as e:
<add> check_legacy_command(action, 'list_users')
<add> self.assertEqual(
<add> str(e.exception),
<add> "argument : `airflow list_users` command, has been removed, please use `airflow users list`") | 3 |
Go | Go | remove unused named returns | 588090c49bf2ec077626d89196515e6bef1f7a69 | <ide><path>pkg/units/size.go
<ide> func FromHumanSize(size string) (int64, error) {
<ide> // in bytes, kibibytes, mebibytes, gibibytes, or tebibytes and
<ide> // returns the number of bytes, or -1 if the string is unparseable.
<ide> // Units are case-insensitive, and the 'b' suffix is optional.
<del>func RAMInBytes(size string) (bytes int64, err error) {
<add>func RAMInBytes(size string) (int64, error) {
<ide> re, error := regexp.Compile("^(\\d+)([kKmMgGtT])?[bB]?$")
<ide> if error != nil {
<ide> return -1, error | 1 |
Ruby | Ruby | fix warnings when eager loading on ruby 2.7 | afce06bdb24238eb518ab59a20d114ca0091fd38 | <ide><path>activesupport/lib/active_support/dependencies/autoload.rb
<ide> def self.extended(base) # :nodoc:
<ide> @_under_path = nil
<ide> @_at_path = nil
<ide> @_eager_autoload = false
<add> @_eagerloaded_constants = nil
<ide> end
<ide> end
<ide> end | 1 |
Python | Python | prepare 2.0.9 release | c25e06f05a245ebf127ed3856eea19a7c73a9ab9 | <ide><path>keras/__init__.py
<ide> from . import losses
<ide> from . import optimizers
<ide> from . import regularizers
<del># Importable from root because it's technically not a layer
<add>
<add># Also importable from root
<ide> from .layers import Input
<add>from .models import Model
<add>from .models import Sequential
<ide>
<del>__version__ = '2.0.8'
<add>__version__ = '2.0.9'
<ide><path>setup.py
<ide>
<ide>
<ide> setup(name='Keras',
<del> version='2.0.8',
<add> version='2.0.9',
<ide> description='Deep Learning for Python',
<ide> author='Francois Chollet',
<ide> author_email='francois.chollet@gmail.com',
<ide> url='https://github.com/fchollet/keras',
<del> download_url='https://github.com/fchollet/keras/tarball/2.0.8',
<add> download_url='https://github.com/fchollet/keras/tarball/2.0.9',
<ide> license='MIT',
<ide> install_requires=['numpy>=1.9.1',
<ide> 'scipy>=0.14', | 2 |
Text | Text | note audit --new-formula for new formula | 49e9be1970ae7f58d9ed64ac2dad5187a3ea6d5d | <ide><path>share/doc/homebrew/Formula-Cookbook.md
<ide> Add aliases by creating symlinks in an `Aliases` directory in the tap root.
<ide>
<ide> You can run `brew audit --strict --online` to test formulae for adherence to Homebrew house style. The `audit` command includes warnings for trailing whitespace, preferred URLs for certain source hosts, and a lot of other style issues. Fixing these warnings before committing will make the process a lot quicker for everyone.
<ide>
<del>New formulae being submitted to Homebrew should run `brew audit --strict --online foo`. This command is performed by the Brew Test Bot on new submissions as part of the automated build and test process, and highlights more potential issues than the standard audit.
<add>New formulae being submitted to Homebrew should run `brew audit --new-formula foo`. This command is performed by the Brew Test Bot on new submissions as part of the automated build and test process, and highlights more potential issues than the standard audit.
<ide>
<ide> Use `brew info` and check if the version guessed by Homebrew from the URL is
<ide> correct. Add an explicit [`version`](http://www.rubydoc.info/github/Homebrew/brew/master/Formula#version-class_method) if not. | 1 |
Text | Text | update default homebrew_cache (#316) | d363ae53c08abd7e658a0124e7d3bb79d38a1f08 | <ide><path>share/doc/homebrew/External-Commands.md
<ide> A shell script for an command named `extcmd` should be named `brew-extcmd`. This
<ide> </tr>
<ide> <tr>
<ide> <td>HOMEBREW_CACHE</td>
<del> <td>Where Homebrew caches downloaded tarballs to, typically <code>/Library/Caches/Homebrew</code>. </td>
<add> <td>Where Homebrew caches downloaded tarballs to, by default <code>~/Library/Caches/Homebrew</code>. </td>
<ide> </tr>
<ide> <tr>
<ide> <td>HOMEBREW_CELLAR</td> | 1 |
PHP | PHP | add support for easy subscribe | becb439ce4a85e54979feff29886276ad180c232 | <ide><path>src/Illuminate/Redis/Database.php
<ide> public function command($method, array $parameters = array())
<ide> * @param array|string $channels
<ide> * @param \Closure $callback
<ide> * @param string $connection
<add> * @param string $method
<ide> * @return void
<ide> */
<del> public function subscribe($channels, Closure $callback, $connection = null)
<add> public function subscribe($channels, Closure $callback, $connection = null, $method = 'subscribe')
<ide> {
<ide> $loop = $this->connection($connection)->pubSubLoop();
<ide>
<del> call_user_func_array([$loop, 'subscribe'], (array) $channels);
<add> call_user_func_array([$loop, $method], (array) $channels);
<ide>
<ide> foreach ($loop as $message) {
<del> if ($message->kind === 'message') {
<add> echo $message->kind.PHP_EOL;
<add> if ($message->kind === 'message' || $message->kind === 'pmessage') {
<ide> call_user_func($callback, $message->payload, $message->channel);
<ide> }
<ide> }
<ide>
<ide> unset($loop);
<ide> }
<ide>
<add> /**
<add> * Subscribe to a set of given channels with wildcards.
<add> *
<add> * @param array|string $channels
<add> * @param \Closure $callback
<add> * @param string $connection
<add> * @return void
<add> */
<add> public function psubscribe($channels, Closure $callback, $connection = null)
<add> {
<add> return $this->subscribe($channels, $callback, $connection, __FUNCTION__);
<add> }
<add>
<ide> /**
<ide> * Dynamically make a Redis command.
<ide> * | 1 |
PHP | PHP | default the content type on string bodies | 2d9867fb67c5b8f981026badb690803ad84c7771 | <ide><path>src/Network/Http/Client.php
<ide> protected function _createRequest($method, $url, $data, $options)
<ide> $request->method($method)
<ide> ->url($url)
<ide> ->body($data);
<add>
<ide> if (isset($options['type'])) {
<ide> $request->header($this->_typeHeaders($options['type']));
<ide> }
<ide> if (isset($options['headers'])) {
<ide> $request->header($options['headers']);
<ide> }
<add> if (is_string($data) && !$request->header('content-type')) {
<add> $request->header('Content-Type', 'application/x-www-form-urlencoded');
<add> }
<ide> $request->cookie($this->_cookies->get($url));
<ide> if (isset($options['cookies'])) {
<ide> $request->cookie($options['cookies']);
<ide> protected function _typeHeaders($type)
<ide> 'xml' => 'application/xml',
<ide> ];
<ide> if (!isset($typeMap[$type])) {
<del> throw new Exception('Unknown type alias.');
<add> throw new Exception("Unknown type alias '$type'.");
<ide> }
<ide> return [
<ide> 'Accept' => $typeMap[$type],
<ide><path>tests/TestCase/Network/Http/ClientTest.php
<ide> public function testPostWithTypeKey($type, $mime)
<ide> $http->post('/projects/add', $data, ['type' => $type]);
<ide> }
<ide>
<add> /**
<add> * Test that string payloads with no content type have a default content-type set.
<add> *
<add> * @return void
<add> */
<add> public function testPostWithStringDataDefaultsToFormEncoding()
<add> {
<add> $response = new Response();
<add> $data = 'some=value&more=data';
<add> $headers = [
<add> 'Connection' => 'close',
<add> 'User-Agent' => 'CakePHP',
<add> 'Content-Type' => 'application/x-www-form-urlencoded',
<add> ];
<add>
<add> $mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
<add> $mock->expects($this->any())
<add> ->method('send')
<add> ->with($this->logicalAnd(
<add> $this->attributeEqualTo('_body', $data),
<add> $this->attributeEqualTo('_headers', $headers)
<add> ))
<add> ->will($this->returnValue([$response]));
<add>
<add> $http = new Client([
<add> 'host' => 'cakephp.org',
<add> 'adapter' => $mock
<add> ]);
<add> $http->post('/projects/add', $data);
<add> $http->put('/projects/add', $data);
<add> $http->delete('/projects/add', $data);
<add> }
<add>
<ide> /**
<ide> * Test that exceptions are raised on invalid types.
<ide> * | 2 |
Mixed | Ruby | remove sqlite support from `rails dbconsole` | 688c0ec26454c9ab64d8d11fc689a3fe9ab5924f | <ide><path>railties/CHANGELOG.md
<add>* Remove sqlite support from `rails dbconsole`.
<add>
<add> *Andrew White*
<add>
<ide> * Rename `railties/bin` to `railties/exe` to match the new Bundler executables
<ide> convention.
<ide>
<ide><path>railties/lib/rails/commands/dbconsole.rb
<ide> def start
<ide> ENV['PGPASSWORD'] = config["password"].to_s if config["password"] && options['include_password']
<ide> find_cmd_and_exec('psql', config["database"])
<ide>
<del> when "sqlite"
<del> find_cmd_and_exec('sqlite', config["database"])
<del>
<ide> when "sqlite3"
<ide> args = []
<ide>
<ide><path>railties/test/commands/dbconsole_test.rb
<ide> def test_postgresql_include_password
<ide> assert_equal 'q1w2e3', ENV['PGPASSWORD']
<ide> end
<ide>
<del> def test_sqlite
<del> start(adapter: 'sqlite', database: 'db')
<del> assert !aborted
<del> assert_equal ['sqlite', 'db'], dbconsole.find_cmd_and_exec_args
<del> end
<del>
<ide> def test_sqlite3
<ide> start(adapter: 'sqlite3', database: 'db.sqlite3')
<ide> assert !aborted | 3 |
Go | Go | create dirs/files as needed for bind mounts | 70ef53f25e177e42046170ef59bb29ebd77a3016 | <ide><path>pkg/libcontainer/mount/init.go
<ide> func mountSystem(rootfs string, container *libcontainer.Container) error {
<ide> return nil
<ide> }
<ide>
<add>func createIfNotExists(path string, isDir bool) error {
<add> if _, err := os.Stat(path); err != nil {
<add> if os.IsNotExist(err) {
<add> if isDir {
<add> if err := os.MkdirAll(path, 0755); err != nil {
<add> return err
<add> }
<add> } else {
<add> if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
<add> return err
<add> }
<add> f, err := os.OpenFile(path, os.O_CREATE, 0755)
<add> if err != nil {
<add> return err
<add> }
<add> f.Close()
<add> }
<add> }
<add> }
<add> return nil
<add>}
<add>
<ide> func setupBindmounts(rootfs string, bindMounts libcontainer.Mounts) error {
<ide> for _, m := range bindMounts.OfType("bind") {
<ide> var (
<ide> func setupBindmounts(rootfs string, bindMounts libcontainer.Mounts) error {
<ide> if !m.Writable {
<ide> flags = flags | syscall.MS_RDONLY
<ide> }
<add>
<add> stat, err := os.Stat(m.Source)
<add> if err != nil {
<add> return err
<add> }
<add> if err := createIfNotExists(dest, stat.IsDir()); err != nil {
<add> return fmt.Errorf("Creating new bind-mount target, %s\n", err)
<add> }
<add>
<ide> if err := system.Mount(m.Source, dest, "bind", uintptr(flags), ""); err != nil {
<ide> return fmt.Errorf("mounting %s into %s %s", m.Source, dest, err)
<ide> } | 1 |
Javascript | Javascript | check all properties in common.expectserror | 2fef227a614a16f894b574ba9bfe84fc56b64681 | <ide><path>test/common/index.js
<ide> exports.expectsError = function expectsError(fn, settings, exact) {
<ide> fn = undefined;
<ide> }
<ide> function innerFn(error) {
<del> assert.strictEqual(error.code, settings.code);
<ide> if ('type' in settings) {
<ide> const type = settings.type;
<ide> if (type !== Error && !Error.isPrototypeOf(type)) {
<ide> exports.expectsError = function expectsError(fn, settings, exact) {
<ide> `${error.message} does not match ${message}`);
<ide> }
<ide> }
<del> if ('name' in settings) {
<del> assert.strictEqual(error.name, settings.name);
<del> }
<del> if (error.constructor.name === 'AssertionError') {
<del> ['generatedMessage', 'actual', 'expected', 'operator'].forEach((key) => {
<del> if (key in settings) {
<del> const actual = error[key];
<del> const expected = settings[key];
<del> assert.strictEqual(actual, expected,
<del> `${key}: expected ${expected}, not ${actual}`);
<del> }
<del> });
<add>
<add> // Check all error properties.
<add> const keys = Object.keys(settings);
<add> for (const key of keys) {
<add> if (key === 'message' || key === 'type')
<add> continue;
<add> const actual = error[key];
<add> const expected = settings[key];
<add> assert.strictEqual(actual, expected,
<add> `${key}: expected ${expected}, not ${actual}`);
<ide> }
<ide> return true;
<ide> } | 1 |
Python | Python | add support to gradient checkpointing for longt5 | 5a70a77bfa07e8761b195f4239297bf22fa40ad8 | <ide><path>src/transformers/models/longt5/modeling_flax_longt5.py
<ide> def __init__(
<ide> module = self.module_class(config=config, dtype=dtype, **kwargs)
<ide> super().__init__(config, module, input_shape=input_shape, seed=seed, dtype=dtype, _do_init=_do_init)
<ide>
<add> def enable_gradient_checkpointing(self):
<add> self._module = self.module_class(
<add> config=self.config,
<add> dtype=self.dtype,
<add> gradient_checkpointing=True,
<add> )
<add>
<ide> def init_weights(self, rng: jax.random.PRNGKey, input_shape: Tuple, params: FrozenDict = None) -> FrozenDict:
<ide> # init input tensors
<ide> input_ids = jnp.zeros(input_shape, dtype="i4") | 1 |
Mixed | Text | add network id to container inspect | 9f676ade0aef66bb66a26171d6bfb27f105fa1df | <ide><path>container/container_unix.go
<ide> import (
<ide> // DefaultSHMSize is the default size (64MB) of the SHM which will be mounted in the container
<ide> const DefaultSHMSize int64 = 67108864
<ide>
<del>// Container holds the fields specific to unixen implementations. See
<del>// CommonContainer for standard fields common to all containers.
<add>// Container holds the fields specific to unixen implementations.
<add>// See CommonContainer for standard fields common to all containers.
<ide> type Container struct {
<ide> CommonContainer
<ide>
<ide> func (container *Container) BuildEndpointInfo(n libnetwork.Network, ep libnetwor
<ide> if _, ok := networkSettings.Networks[n.Name()]; !ok {
<ide> networkSettings.Networks[n.Name()] = new(network.EndpointSettings)
<ide> }
<add> networkSettings.Networks[n.Name()].NetworkID = n.ID()
<ide> networkSettings.Networks[n.Name()].EndpointID = ep.ID()
<ide>
<ide> iface := epInfo.Iface()
<ide> func copyExistingContents(source, destination string) error {
<ide> return err
<ide> }
<ide> if len(srcList) == 0 {
<del> // If the source volume is empty copy files from the root into the volume
<add> // If the source volume is empty, copies files from the root into the volume
<ide> if err := chrootarchive.CopyWithTar(source, destination); err != nil {
<ide> return err
<ide> }
<ide><path>docs/reference/api/docker_remote_api.md
<ide> This section lists each version from latest to oldest. Each listing includes a
<ide> * `GET /info` now includes the number of containers running, stopped, and paused.
<ide> * `POST /networks/create` now supports restricting external access to the network by setting the `internal` field.
<ide> * `POST /networks/(id)/disconnect` now includes a `Force` option to forcefully disconnect a container from network
<add>* `GET /containers/(id)/json` now returns the `NetworkID` of containers.
<ide>
<ide> ### v1.21 API changes
<ide>
<ide><path>docs/reference/api/docker_remote_api_v1.22.md
<ide> List containers
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
<ide> "Gateway": "172.17.0.1",
<ide> "IPAddress": "172.17.0.2",
<ide> List containers
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
<ide> "Gateway": "172.17.0.1",
<ide> "IPAddress": "172.17.0.8",
<ide> List containers
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
<ide> "Gateway": "172.17.0.1",
<ide> "IPAddress": "172.17.0.6",
<ide> List containers
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
<ide> "Gateway": "172.17.0.1",
<ide> "IPAddress": "172.17.0.5",
<ide> Return low-level information on the container `id`
<ide> "MacAddress": "",
<ide> "Networks": {
<ide> "bridge": {
<del> "EndpointID": "",
<del> "Gateway": "",
<del> "IPAddress": "",
<del> "IPPrefixLen": 0,
<add> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<add> "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
<add> "Gateway": "172.17.0.1",
<add> "IPAddress": "172.17.0.2",
<add> "IPPrefixLen": 16,
<ide> "IPv6Gateway": "",
<ide> "GlobalIPv6Address": "",
<ide> "GlobalIPv6PrefixLen": 0,
<del> "MacAddress": ""
<add> "MacAddress": "02:42:ac:12:00:02"
<ide> }
<ide> }
<ide> },
<ide> Return low-level information about the `exec` command `id`.
<ide> "MacAddress": "",
<ide> "Networks": {
<ide> "bridge": {
<del> "EndpointID": "",
<del> "Gateway": "",
<del> "IPAddress": "",
<del> "IPPrefixLen": 0,
<add> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<add> "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
<add> "Gateway": "172.17.0.1",
<add> "IPAddress": "172.17.0.2",
<add> "IPPrefixLen": 16,
<ide> "IPv6Gateway": "",
<ide> "GlobalIPv6Address": "",
<ide> "GlobalIPv6PrefixLen": 0,
<del> "MacAddress": ""
<add> "MacAddress": "02:42:ac:12:00:02"
<ide> }
<ide> }
<ide> },
<ide><path>docs/userguide/networking/work-with-networks.md
<ide> Now, inspect the network resources used by `container3`.
<ide>
<ide> ```bash
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' container3
<del>{"isolated_nw":{"IPAMConfig":{"IPv4Address":"172.25.3.3"},"EndpointID":"dffc7ec2915af58cc827d995e6ebdc897342be0420123277103c40ae35579103","Gateway":"172.25.0.1","IPAddress":"172.25.3.3","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:19:03:03"}}
<add>{"isolated_nw":{"IPAMConfig":{"IPv4Address":"172.25.3.3"},"NetworkID":"1196a4c5af43a21ae38ef34515b6af19236a3fc48122cf585e3f3054d509679b",
<add>"EndpointID":"dffc7ec2915af58cc827d995e6ebdc897342be0420123277103c40ae35579103","Gateway":"172.25.0.1","IPAddress":"172.25.3.3","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:19:03:03"}}
<ide> ```
<ide> Repeat this command for `container2`. If you have Python installed, you can pretty print the output.
<ide>
<ide> ```bash
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' container2 | python -m json.tool
<ide> {
<ide> "bridge": {
<add> "NetworkID":"7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "0099f9efb5a3727f6a554f176b1e96fca34cae773da68b3b6a26d046c12cb365",
<ide> "Gateway": "172.17.0.1",
<ide> "GlobalIPv6Address": "",
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' container2 | pyt
<ide> "MacAddress": "02:42:ac:11:00:03"
<ide> },
<ide> "isolated_nw": {
<add> "NetworkID":"1196a4c5af43a21ae38ef34515b6af19236a3fc48122cf585e3f3054d509679b",
<ide> "EndpointID": "11cedac1810e864d6b1589d92da12af66203879ab89f4ccd8c8fdaa9b1c48b1d",
<ide> "Gateway": "172.25.0.1",
<ide> "GlobalIPv6Address": "",
<ide> $ docker network disconnect isolated_nw container2
<ide> docker inspect --format='{{json .NetworkSettings.Networks}}' container2 | python -m json.tool
<ide> {
<ide> "bridge": {
<add> "NetworkID":"7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "9e4575f7f61c0f9d69317b7a4b92eefc133347836dd83ef65deffa16b9985dc0",
<ide> "Gateway": "172.17.0.1",
<ide> "GlobalIPv6Address": "",
<ide><path>docs/userguide/networkingcontainers.md
<ide> If you inspect your `my-bridge-network` you'll see it has a container attached.
<ide> You can also inspect your container to see where it is connected:
<ide>
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' db
<del> {"bridge":{"EndpointID":"508b170d56b2ac9e4ef86694b0a76a22dd3df1983404f7321da5649645bf7043","Gateway":"172.18.0.1","IPAddress":"172.18.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"}}
<add> {"my-bridge-network":{"NetworkID":"7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99",
<add> "EndpointID":"508b170d56b2ac9e4ef86694b0a76a22dd3df1983404f7321da5649645bf7043","Gateway":"172.18.0.1","IPAddress":"172.18.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"}}
<ide>
<ide> Now, go ahead and start your by now familiar web application. This time leave off the `-P` flag and also don't specify a network.
<ide>
<ide> Now, go ahead and start your by now familiar web application. This time leave of
<ide> Which network is your `web` application running under? Inspect the application and you'll find it is running in the default `bridge` network.
<ide>
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' web
<del> {"bridge":{"EndpointID":"508b170d56b2ac9e4ef86694b0a76a22dd3df1983404f7321da5649645bf7043","Gateway":"172.17.0.1","IPAddress":"172.17.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"}}
<add> {"bridge":{"NetworkID":"7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<add> "EndpointID":"508b170d56b2ac9e4ef86694b0a76a22dd3df1983404f7321da5649645bf7043","Gateway":"172.17.0.1","IPAddress":"172.17.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"}}
<ide>
<ide> Then, get the IP address of your `web`
<ide>
<ide><path>integration-cli/docker_cli_inspect_test.go
<ide> func (s *DockerSuite) TestInspectHistory(c *check.C) {
<ide> c.Assert(err, check.IsNil)
<ide> c.Assert(out, checker.Contains, "test comment")
<ide> }
<add>
<add>func (s *DockerSuite) TestInspectContainerNetworkDefault(c *check.C) {
<add> testRequires(c, DaemonIsLinux)
<add>
<add> contName := "test1"
<add> dockerCmd(c, "run", "--name", contName, "-d", "busybox", "top")
<add> netOut, _ := dockerCmd(c, "network", "inspect", "--format='{{.ID}}'", "bridge")
<add> out, err := inspectField(contName, "NetworkSettings.Networks")
<add> c.Assert(err, checker.IsNil)
<add> c.Assert(out, checker.Contains, "bridge")
<add> out, err = inspectField(contName, "NetworkSettings.Networks.bridge.NetworkID")
<add> c.Assert(err, checker.IsNil)
<add> c.Assert(strings.TrimSpace(out), checker.Equals, strings.TrimSpace(netOut))
<add>}
<add>
<add>func (s *DockerSuite) TestInspectContainerNetworkCustom(c *check.C) {
<add> testRequires(c, DaemonIsLinux)
<add>
<add> netOut, _ := dockerCmd(c, "network", "create", "net1")
<add> dockerCmd(c, "run", "--name=container1", "--net=net1", "-d", "busybox", "top")
<add> out, err := inspectField("container1", "NetworkSettings.Networks")
<add> c.Assert(err, checker.IsNil)
<add> c.Assert(out, checker.Contains, "net1")
<add> out, err = inspectField("container1", "NetworkSettings.Networks.net1.NetworkID")
<add> c.Assert(err, checker.IsNil)
<add> c.Assert(strings.TrimSpace(out), checker.Equals, strings.TrimSpace(netOut))
<add>}
<ide><path>man/docker-inspect.1.md
<ide> To get information on a container use its ID or instance name:
<ide> "Image": "ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
<ide> "NetworkSettings": {
<ide> "Bridge": "",
<del> "EndpointID": "",
<del> "Gateway": "",
<del> "GlobalIPv6Address": "",
<del> "GlobalIPv6PrefixLen": 0,
<add> "SandboxID": "6b4851d1903e16dd6a567bd526553a86664361f31036eaaa2f8454d6f4611f6f",
<ide> "HairpinMode": false,
<del> "IPAddress": "",
<del> "IPPrefixLen": 0,
<del> "IPv6Gateway": "",
<ide> "LinkLocalIPv6Address": "",
<ide> "LinkLocalIPv6PrefixLen": 0,
<del> "MacAddress": "",
<del> "NetworkID": "",
<del> "Ports": null,
<del> "SandboxKey": "",
<add> "Ports": {},
<add> "SandboxKey": "/var/run/docker/netns/6b4851d1903e",
<ide> "SecondaryIPAddresses": null,
<del> "SecondaryIPv6Addresses": null
<add> "SecondaryIPv6Addresses": null,
<add> "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
<add> "Gateway": "172.17.0.1",
<add> "GlobalIPv6Address": "",
<add> "GlobalIPv6PrefixLen": 0,
<add> "IPAddress": "172.17.0.2",
<add> "IPPrefixLen": 16,
<add> "IPv6Gateway": "",
<add> "MacAddress": "02:42:ac:12:00:02",
<add> "Networks": {
<add> "bridge": {
<add> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<add> "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
<add> "Gateway": "172.17.0.1",
<add> "IPAddress": "172.17.0.2",
<add> "IPPrefixLen": 16,
<add> "IPv6Gateway": "",
<add> "GlobalIPv6Address": "",
<add> "GlobalIPv6PrefixLen": 0,
<add> "MacAddress": "02:42:ac:12:00:02"
<add> }
<add> }
<add>
<ide> },
<ide> "ResolvConfPath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/resolv.conf",
<ide> "HostnamePath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/hostname", | 7 |
Javascript | Javascript | use common.fixtures in tls test | 17857d4fc97d03020d3012ed890da509b294d0d2 | <ide><path>test/parallel/test-tls-max-send-fragment.js
<ide>
<ide> 'use strict';
<ide> const common = require('../common');
<add>const fixtures = require('../common/fixtures');
<add>
<ide> if (!common.hasCrypto)
<ide> common.skip('missing crypto');
<ide>
<ide> const assert = require('assert');
<ide> const tls = require('tls');
<del>const fs = require('fs');
<ide>
<ide> const buf = Buffer.allocUnsafe(10000);
<ide> let received = 0;
<ide> const maxChunk = 768;
<ide>
<ide> const server = tls.createServer({
<del> key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
<del> cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
<add> key: fixtures.readKey('agent1-key.pem'),
<add> cert: fixtures.readKey('agent1-cert.pem')
<ide> }, function(c) {
<ide> // Lower and upper limits
<ide> assert(!c.setMaxSendFragment(511)); | 1 |
Text | Text | add v3.0.0-beta.1 to changelog.md | f7f92863501625fc4677a5f787c8be24286ce92e | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### 3.0.0-beta.1 (January 1, 2018)
<add>
<add>- [#15901](https://github.com/emberjs/ember.js/pull/15901) [CLEANUP] Remove Ember.Handlebars.SafeString
<add>- [#15894](https://github.com/emberjs/ember.js/pull/15894) [CLEANUP] removed `immediateObserver`
<add>- [#15897](https://github.com/emberjs/ember.js/pull/15897) [CLEANUP] Remove controller wrapped param deprecation
<add>- [#15883](https://github.com/emberjs/ember.js/pull/15883) [CLEANUP] Remove this.resource from RouterDSL
<add>- [#15882](https://github.com/emberjs/ember.js/pull/15882) [CLEANUP] Remove Ember.String.fmt
<add>- [#15892](https://github.com/emberjs/ember.js/pull/15892) [CLEANUP] removed `Ember.required`
<add>- [#15223](https://github.com/emberjs/ember.js/pull/15223) Preserve current history state on app boot
<add>- [#15886](https://github.com/emberjs/ember.js/pull/15886) [CLEANUP] Remove arity check from initializer
<add>- [#15893](https://github.com/emberjs/ember.js/pull/15893) [CLEANUP] removed `providing reversed arguments to observer`
<add>- [#15881](https://github.com/emberjs/ember.js/pull/15881) [CLEANUP] Removed console polyfills/shims
<add>- [#15999](https://github.com/emberjs/ember.js/pull/15999) Update acceptance test blueprint to conform to emberjs/rfcs#268
<add>- [#15927](https://github.com/emberjs/ember.js/pull/15927) [BUGFIX] Extend test framework detection to `ember-qunit` and `ember-mocha`
<add>- [#15912](https://github.com/emberjs/ember.js/pull/15912) [CLEANUP] Remove deprecated `{Application,Engine,ApplicationInstance}.registry`
<add>- [#15910](https://github.com/emberjs/ember.js/pull/15910) [CLEANUP] removed `transform-input-on-to-onEvent`
<add>- [#15922](https://github.com/emberjs/ember.js/pull/15922) [CLEANUP] Remove legacy controller proxy behavior
<add>- [#15914](https://github.com/emberjs/ember.js/pull/15914) [CLEANUP] Remove ability to specify `_actions` in `Ember.Route`, `Ember.Controller`, and `Ember.Component`
<add>- [#15923](https://github.com/emberjs/ember.js/pull/15923) [CLEANUP] Remove didInitAttrs lifecycle method
<add>- [#15915](https://github.com/emberjs/ember.js/pull/15915) [CLEANUP] Remove {{render}}
<add>- [#15950](https://github.com/emberjs/ember.js/pull/15950) blueprints/mixin-test: Added RFC-232 variant
<add>- [#15951](https://github.com/emberjs/ember.js/pull/15951) blueprints/service-test: Added RFC-232 variant
<add>- [#15949](https://github.com/emberjs/ember.js/pull/15949) [CLEANUP canary] use `Set` for uniqBy and uniq
<add>- [#15947](https://github.com/emberjs/ember.js/pull/15947) blueprints/util-test: Add RFC232 variants
<add>- [#15943](https://github.com/emberjs/ember.js/pull/15943) blueprints/controller-test: Add RFC232 variants
<add>- [#15948](https://github.com/emberjs/ember.js/pull/15948) [CLEANUP] remove ArrayMixin#contains
<add>- [#15946](https://github.com/emberjs/ember.js/pull/15946) blueprints/initializer-test: Add RFC232 variants
<add>- [#15945](https://github.com/emberjs/ember.js/pull/15945) blueprints/instance-initializers-test: Add RFC232 variants
<add>- [#15957](https://github.com/emberjs/ember.js/pull/15957) RFC 232 route-test blueprints
<add>- [#15934](https://github.com/emberjs/ember.js/pull/15934) blueprints/component-test: Add RFC232 variants
<add>- [#16010](https://github.com/emberjs/ember.js/pull/16010) Cleanup ember-template-compiler's tests
<add>- [#16015](https://github.com/emberjs/ember.js/pull/16015) [CLEANUP] Convert ember-router tests to new style
<add>- [#16036](https://github.com/emberjs/ember.js/pull/16036) [CLEANUP] Convert ember-metal accessors tests to new style
<add>- [#16023](https://github.com/emberjs/ember.js/pull/16023) Make event dispatcher work without jQuery
<add>
<ide> ### 2.18.0 (January 1, 2018)
<ide>
<ide> - [95b449](https://github.com/emberjs/ember.js/commit/95b4499b3667712a202bef834268e23867fc8842) [BUGFIX] Ensure `Ember.run.cancel` while the run loop is flushing works properly. | 1 |
PHP | PHP | update query usage in table class | 9db42b1594c997296c0ccefe77243c054fd10e01 | <ide><path>Cake/ORM/Table.php
<ide> public function query() {
<ide> */
<ide> public function updateAll($fields, $conditions) {
<ide> $query = $this->query();
<del> $query->update($this->table())
<add> $query->update()
<ide> ->set($fields)
<ide> ->where($conditions);
<ide> $statement = $query->execute();
<ide> public function validationDefault(Validator $validator) {
<ide> */
<ide> public function deleteAll($conditions) {
<ide> $query = $this->query();
<del> $query->delete($this->table())
<add> $query->delete()
<ide> ->where($conditions);
<ide> $statement = $query->execute();
<ide> $success = $statement->rowCount() > 0;
<ide> protected function _insert($entity, $data) {
<ide> $data[$primary] = $id;
<ide> }
<ide>
<del> $statement = $query->insert($this->table(), array_keys($data))
<add> $statement = $query->insert(array_keys($data))
<ide> ->values($data)
<ide> ->execute();
<ide>
<ide> protected function _update($entity, $data) {
<ide> }
<ide>
<ide> $query = $this->query();
<del> $statement = $query->update($this->table())
<add> $statement = $query->update()
<ide> ->set($data)
<ide> ->where($primaryKey)
<ide> ->execute();
<ide> protected function _processDelete($entity, $options) {
<ide> }
<ide>
<ide> $query = $this->query();
<del> $statement = $query->delete($this->table())
<add> $statement = $query->delete()
<ide> ->where($conditions)
<ide> ->execute();
<ide>
<ide><path>Cake/Test/TestCase/ORM/TableTest.php
<ide> public function testUpdateAllFailure() {
<ide> $table = $this->getMock(
<ide> 'Cake\ORM\Table',
<ide> ['query'],
<del> [['table' => 'users']]
<add> [['table' => 'users', 'connection' => $this->connection]]
<ide> );
<del> $query = $this->getMock('Cake\ORM\Query', ['_executeStatement'], [$this->connection, null]);
<add> $query = $this->getMock('Cake\ORM\Query', ['_executeStatement'], [$this->connection, $table]);
<ide> $table->expects($this->once())
<ide> ->method('query')
<ide> ->will($this->returnValue($query));
<add>
<ide> $query->expects($this->once())
<ide> ->method('_executeStatement')
<ide> ->will($this->throwException(new \Cake\Database\Exception('Not good')));
<add>
<ide> $table->updateAll(['username' => 'mark'], []);
<ide> }
<ide>
<ide> public function testDeleteAllFailure() {
<ide> ['query'],
<ide> [['table' => 'users', 'connection' => $this->connection]]
<ide> );
<del> $query = $this->getMock('Cake\ORM\Query', ['_executeStatement'], [$this->connection, null]);
<add> $query = $this->getMock('Cake\ORM\Query', ['_executeStatement'], [$this->connection, $table]);
<ide> $table->expects($this->once())
<ide> ->method('query')
<ide> ->will($this->returnValue($query));
<add>
<ide> $query->expects($this->once())
<ide> ->method('_executeStatement')
<ide> ->will($this->throwException(new \Cake\Database\Exception('Not good')));
<add>
<ide> $table->deleteAll(['id >' => 4]);
<ide> }
<ide> | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.