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 |
|---|---|---|---|---|---|
Ruby | Ruby | remove flaky cask upgrade test | 626f9406b1987932382814bc7d7cae3b41b771f4 | <ide><path>Library/Homebrew/test/cask/cmd/upgrade_spec.rb
<ide> expect(local_transmission_path).to be_a_directory
<ide> expect(local_transmission.versions).to include("2.60")
<ide> end
<del>
<del> it 'updates "auto_updates" and "latest" Casks when their tokens are provided in the command line' do
<del> local_caffeine = Cask::CaskLoader.load("local-caffeine")
<del> local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app")
<del> auto_updates = Cask::CaskLoader.load("auto-updates")
<del> auto_updates_path = Cask::Config.global.appdir.join("MyFancyApp.app")
<del>
<del> expect(local_caffeine).to be_installed
<del> expect(local_caffeine_path).to be_a_directory
<del> expect(local_caffeine.versions).to include("1.2.2")
<del>
<del> expect(auto_updates).to be_installed
<del> expect(auto_updates_path).to be_a_directory
<del> expect(auto_updates.versions).to include("2.57")
<del>
<del> described_class.run("local-caffeine", "auto-updates")
<del>
<del> expect(local_caffeine).to be_installed
<del> expect(local_caffeine_path).to be_a_directory
<del> expect(local_caffeine.versions).to include("1.2.3")
<del>
<del> expect(auto_updates).to be_installed
<del> expect(auto_updates_path).to be_a_directory
<del> expect(auto_updates.versions).to include("2.61")
<del> end
<ide> end
<ide>
<ide> describe "with --greedy it checks additional Casks" do | 1 |
PHP | PHP | change artisan requirement | 0434715dd49fc46940efa35790c5ddd9506dca65 | <ide><path>src/Illuminate/Console/Application.php
<ide> public static function make($app)
<ide> */
<ide> public function boot()
<ide> {
<del> require $this->laravel['path'].'/start/artisan.php';
<del>
<ide> // If the event dispatcher is set on the application, we will fire an event
<ide> // with the Artisan instance to provide each listener the opportunity to
<ide> // register their commands on this application before it gets started. | 1 |
Python | Python | add vae example | d7ff7cde925f803919d954f5cb73a685b8f14b0a | <ide><path>examples/variational_autoencoder.py
<add>'''This script demonstrates how to build a variational autoencoder with Keras.
<add>
<add>Reference: "Auto-Encoding Variational Bayes" https://arxiv.org/abs/1312.6114
<add>'''
<add>import numpy as np
<add>import matplotlib.pyplot as plt
<add>
<add>from keras.layers import Input, Dense, Lambda
<add>from keras.models import Model
<add>from keras import backend as K
<add>from keras import objectives
<add>from keras.datasets import mnist
<add>
<add>batch_size = 16
<add>original_dim = 784
<add>latent_dim = 2
<add>intermediate_dim = 128
<add>epsilon_std = 0.01
<add>nb_epoch = 40
<add>
<add>x = Input(batch_shape=(batch_size, original_dim))
<add>h = Dense(intermediate_dim, activation='relu')(x)
<add>z_mean = Dense(latent_dim)(h)
<add>z_log_sigma = Dense(latent_dim)(h)
<add>
<add>def sampling(args):
<add> z_mean, z_log_sigma = args
<add> epsilon = K.random_normal(shape=(batch_size, latent_dim),
<add> mean=0., std=epsilon_std)
<add> return z_mean + K.exp(z_log_sigma) * epsilon
<add>
<add># note that "output_shape" isn't necessary with the TensorFlow backend
<add># so you could write `Lambda(sampling)([z_mean, z_log_sigma])`
<add>z = Lambda(sampling, output_shape=(latent_dim,))([z_mean, z_log_sigma])
<add>
<add># we instantiate these layers separately so as to reuse them later
<add>decoder_h = Dense(intermediate_dim, activation='relu')
<add>decoder_mean = Dense(original_dim, activation='sigmoid')
<add>h_decoded = decoder_h(z)
<add>x_decoded_mean = decoder_mean(h_decoded)
<add>
<add>def vae_loss(x, x_decoded_mean):
<add> xent_loss = objectives.binary_crossentropy(x, x_decoded_mean)
<add> kl_loss = - 0.5 * K.mean(1 + z_log_sigma - K.square(z_mean) - K.exp(z_log_sigma), axis=-1)
<add> return xent_loss + kl_loss
<add>
<add>vae = Model(x, x_decoded_mean)
<add>vae.compile(optimizer='rmsprop', loss=vae_loss)
<add>
<add># train the VAE on MNIST digits
<add>(x_train, y_train), (x_test, y_test) = mnist.load_data()
<add>
<add>x_train = x_train.astype('float32') / 255.
<add>x_test = x_test.astype('float32') / 255.
<add>x_train = x_train.reshape((len(x_train), np.prod(x_train.shape[1:])))
<add>x_test = x_test.reshape((len(x_test), np.prod(x_test.shape[1:])))
<add>
<add>vae.fit(x_train, x_train,
<add> shuffle=True,
<add> nb_epoch=nb_epoch,
<add> batch_size=batch_size,
<add> validation_data=(x_test, x_test))
<add>
<add># build a model to project inputs on the latent space
<add>encoder = Model(x, z_mean)
<add>
<add># display a 2D plot of the digit classes in the latent space
<add>x_test_encoded = encoder.predict(x_test, batch_size=batch_size)
<add>plt.figure(figsize=(6, 6))
<add>plt.scatter(x_test_encoded[:, 0], x_test_encoded[:, 1], c=y_test)
<add>plt.colorbar()
<add>plt.show()
<add>
<add># build a digit generator that can sample from the learned distribution
<add>decoder_input = Input(shape=(latent_dim,))
<add>_h_decoded = decoder_h(decoder_input)
<add>_x_decoded_mean = decoder_mean(_h_decoded)
<add>generator = Model(decoder_input, _x_decoded_mean)
<add>
<add># display a 2D manifold of the digits
<add>n = 15 # figure with 15x15 digits
<add>digit_size = 28
<add>figure = np.zeros((digit_size * n, digit_size * n))
<add># we will sample n points within [-15, 15] standard deviations
<add>grid_x = np.linspace(-15, 15, n)
<add>grid_y = np.linspace(-15, 15, n)
<add>
<add>for i, yi in enumerate(grid_x):
<add> for j, xi in enumerate(grid_y):
<add> z_sample = np.array([[xi, yi]]) * epsilon_std
<add> x_decoded = generator.predict(z_sample)
<add> digit = x_decoded[0].reshape(digit_size, digit_size)
<add> figure[i * digit_size: (i + 1) * digit_size,
<add> j * digit_size: (j + 1) * digit_size] = digit
<add>
<add>plt.figure(figsize=(10, 10))
<add>plt.imshow(figure)
<add>plt.show() | 1 |
Python | Python | update paver script file doc + todo | 0b0dbdf45032ad170fbcb2068a95b34326a4a523 | <ide><path>pavement.py
<ide> """
<add>This paver file is intented to help with the release process as much as
<add>possible. It relies on virtualenv to generate 'bootstrap' environments as
<add>independent from the user system as possible (e.g. to make sure the sphinx doc
<add>is built against the built numpy, not an installed one).
<add>
<ide> Building a fancy dmg from scratch
<ide> =================================
<ide>
<ide> Clone the numpy-macosx-installer git repo from on github into the source tree
<ide> (numpy-macosx-installer should be in the same directory as setup.py). Then, do
<ide> as follows::
<ide>
<del> paver clean clean_bootstrap
<add> git clone git://github.com/cournape/macosx-numpy-installer
<add> # remove build dir, and everything generated by previous paver calls
<add> # (included generated installers). Use with care !
<add> paver nuke
<ide> paver bootstrap && source boostrap/bin/activate
<add> # Installing numpy is necessary to build the correct documentation (because
<add> # of autodoc)
<ide> python setupegg.py install
<ide> paver dmg
<ide>
<ide> It assumes that blas/lapack are in c:\local\lib inside drive_c. Build python
<ide> 2.5 and python 2.6 installers.
<ide>
<del> paver clean
<del> paver bdist_wininst
<add> paver bdist_wininst_simple
<add>
<add>You will have to configure your wine python locations (WINE_PYS).
<add>
<add>The superpack requires all the atlas libraries for every arch to be installed
<add>(see SITECFG), and can then be built as follows::
<add>
<add> paver bdist_superpack
<ide>
<ide> Building changelog + notes
<ide> ==========================
<ide>
<ide> This automatically put the checksum into NOTES.txt, and write the Changelog
<ide> which can be uploaded to sourceforge.
<add>
<add>TODO
<add>====
<add> - the script is messy, lots of global variables
<add> - make it more easily customizable (through command line args)
<add> - missing targets: install & test, sdist test, debian packaging
<ide> """
<ide> import os
<ide> import sys | 1 |
Javascript | Javascript | replace assert.throws w/ common.expectserror | 146a9b1a8a38285b0613559aa96498bc7859fc75 | <ide><path>test/parallel/test-async-hooks-asyncresource-constructor.js
<ide> // This tests that AsyncResource throws an error if bad parameters are passed
<ide>
<ide> const common = require('../common');
<del>const assert = require('assert');
<ide> const async_hooks = require('async_hooks');
<ide> const { AsyncResource } = async_hooks;
<ide>
<ide> async_hooks.createHook({
<ide> init() {}
<ide> }).enable();
<ide>
<del>assert.throws(() => {
<add>common.expectsError(() => {
<ide> return new AsyncResource();
<del>}, common.expectsError({
<add>}, {
<ide> code: 'ERR_INVALID_ARG_TYPE',
<ide> type: TypeError,
<del>}));
<add>});
<ide>
<del>assert.throws(() => {
<add>common.expectsError(() => {
<ide> new AsyncResource('');
<del>}, common.expectsError({
<add>}, {
<ide> code: 'ERR_ASYNC_TYPE',
<ide> type: TypeError,
<del>}));
<add>});
<ide>
<del>assert.throws(() => {
<add>common.expectsError(() => {
<ide> new AsyncResource('type', -4);
<del>}, common.expectsError({
<add>}, {
<ide> code: 'ERR_INVALID_ASYNC_ID',
<ide> type: RangeError,
<del>}));
<add>});
<ide>
<del>assert.throws(() => {
<add>common.expectsError(() => {
<ide> new AsyncResource('type', Math.PI);
<del>}, common.expectsError({
<add>}, {
<ide> code: 'ERR_INVALID_ASYNC_ID',
<ide> type: RangeError,
<del>}));
<add>});
<ide><path>test/parallel/test-async-wrap-constructor.js
<ide> // This tests that using falsy values in createHook throws an error.
<ide>
<ide> const common = require('../common');
<del>const assert = require('assert');
<ide> const async_hooks = require('async_hooks');
<ide>
<ide> for (const badArg of [0, 1, false, true, null, 'hello']) {
<ide> const hookNames = ['init', 'before', 'after', 'destroy', 'promiseResolve'];
<ide> for (const field of hookNames) {
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> async_hooks.createHook({ [field]: badArg });
<del> }, common.expectsError({
<add> }, {
<ide> code: 'ERR_ASYNC_CALLBACK',
<ide> type: TypeError,
<del> }));
<add> });
<ide> }
<ide> }
<ide><path>test/parallel/test-buffer-alloc.js
<ide> assert.throws(() => Buffer.allocUnsafe(8).writeFloatLE(0.0, -1), RangeError);
<ide> }
<ide>
<ide> // Regression test for #5482: should throw but not assert in C++ land.
<del>assert.throws(() => Buffer.from('', 'buffer'),
<del> common.expectsError({
<del> code: 'ERR_UNKNOWN_ENCODING',
<del> type: TypeError,
<del> message: 'Unknown encoding: buffer'
<del> }));
<add>common.expectsError(
<add> () => Buffer.from('', 'buffer'),
<add> {
<add> code: 'ERR_UNKNOWN_ENCODING',
<add> type: TypeError,
<add> message: 'Unknown encoding: buffer'
<add> }
<add>);
<ide>
<ide> // Regression test for #6111. Constructing a buffer from another buffer
<ide> // should a) work, and b) not corrupt the source buffer.
<ide><path>test/parallel/test-buffer-arraybuffer.js
<ide> b.writeDoubleBE(11.11, 0, true);
<ide> buf[0] = 9;
<ide> assert.strictEqual(ab[1], 9);
<ide>
<del> assert.throws(() => Buffer.from(ab.buffer, 6), common.expectsError({
<add> common.expectsError(() => Buffer.from(ab.buffer, 6), {
<ide> code: 'ERR_BUFFER_OUT_OF_BOUNDS',
<ide> type: RangeError,
<ide> message: '"offset" is outside of buffer bounds'
<del> }));
<del> assert.throws(() => Buffer.from(ab.buffer, 3, 6), common.expectsError({
<add> });
<add> common.expectsError(() => Buffer.from(ab.buffer, 3, 6), {
<ide> code: 'ERR_BUFFER_OUT_OF_BOUNDS',
<ide> type: RangeError,
<ide> message: '"length" is outside of buffer bounds'
<del> }));
<add> });
<ide> }
<ide>
<ide> // Test the deprecated Buffer() version also
<ide> b.writeDoubleBE(11.11, 0, true);
<ide> buf[0] = 9;
<ide> assert.strictEqual(ab[1], 9);
<ide>
<del> assert.throws(() => Buffer(ab.buffer, 6), common.expectsError({
<add> common.expectsError(() => Buffer(ab.buffer, 6), {
<ide> code: 'ERR_BUFFER_OUT_OF_BOUNDS',
<ide> type: RangeError,
<ide> message: '"offset" is outside of buffer bounds'
<del> }));
<del> assert.throws(() => Buffer(ab.buffer, 3, 6), common.expectsError({
<add> });
<add> common.expectsError(() => Buffer(ab.buffer, 3, 6), {
<ide> code: 'ERR_BUFFER_OUT_OF_BOUNDS',
<ide> type: RangeError,
<ide> message: '"length" is outside of buffer bounds'
<del> }));
<add> });
<ide> }
<ide>
<ide> {
<ide> b.writeDoubleBE(11.11, 0, true);
<ide> assert.deepStrictEqual(Buffer.from(ab, [1]), Buffer.from(ab, 1));
<ide>
<ide> // If byteOffset is Infinity, throw.
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> Buffer.from(ab, Infinity);
<del> }, common.expectsError({
<add> }, {
<ide> code: 'ERR_BUFFER_OUT_OF_BOUNDS',
<ide> type: RangeError,
<ide> message: '"offset" is outside of buffer bounds'
<del> }));
<add> });
<ide> }
<ide>
<ide> {
<ide> b.writeDoubleBE(11.11, 0, true);
<ide> assert.deepStrictEqual(Buffer.from(ab, 0, [1]), Buffer.from(ab, 0, 1));
<ide>
<ide> //If length is Infinity, throw.
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> Buffer.from(ab, 0, Infinity);
<del> }, common.expectsError({
<add> }, {
<ide> code: 'ERR_BUFFER_OUT_OF_BOUNDS',
<ide> type: RangeError,
<ide> message: '"length" is outside of buffer bounds'
<del> }));
<add> });
<ide> }
<ide><path>test/parallel/test-buffer-compare-offset.js
<ide> assert.throws(() => a.compare(b, 0, '0xff'), oor);
<ide> assert.throws(() => a.compare(b, 0, Infinity), oor);
<ide> assert.throws(() => a.compare(b, 0, 1, -1), oor);
<ide> assert.throws(() => a.compare(b, -Infinity, Infinity), oor);
<del>assert.throws(() => a.compare(), common.expectsError({
<add>common.expectsError(() => a.compare(), {
<ide> code: 'ERR_INVALID_ARG_TYPE',
<ide> type: TypeError,
<ide> message: 'The "target" argument must be one of ' +
<ide> 'type Buffer or Uint8Array. Received type undefined'
<del>}));
<add>});
<ide><path>test/parallel/test-buffer-compare.js
<ide> assert.throws(() => Buffer.compare(Buffer.alloc(1), 'abc'), errMsg);
<ide>
<ide> assert.throws(() => Buffer.compare('abc', Buffer.alloc(1)), errMsg);
<ide>
<del>assert.throws(() => Buffer.alloc(1).compare('abc'), common.expectsError({
<add>common.expectsError(() => Buffer.alloc(1).compare('abc'), {
<ide> code: 'ERR_INVALID_ARG_TYPE',
<ide> type: TypeError,
<ide> message: 'The "target" argument must be one of ' +
<ide> 'type Buffer or Uint8Array. Received type string'
<del>}));
<add>});
<ide><path>test/parallel/test-buffer-concat.js
<ide> assertWrongList(['hello', 'world']);
<ide> assertWrongList(['hello', Buffer.from('world')]);
<ide>
<ide> function assertWrongList(value) {
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> Buffer.concat(value);
<del> }, common.expectsError({
<add> }, {
<ide> code: 'ERR_INVALID_ARG_TYPE',
<ide> type: TypeError,
<ide> message: 'The "list" argument must be one of type ' +
<ide> 'Array, Buffer, or Uint8Array'
<del> }));
<add> });
<ide> }
<ide>
<ide> // eslint-disable-next-line crypto-check
<ide><path>test/parallel/test-buffer-fill.js
<ide> function testBufs(string, offset, length, encoding) {
<ide> }
<ide>
<ide> // Make sure these throw.
<del>assert.throws(
<add>common.expectsError(
<ide> () => Buffer.allocUnsafe(8).fill('a', -1),
<del> common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }));
<del>assert.throws(
<add> { code: 'ERR_INDEX_OUT_OF_RANGE' });
<add>common.expectsError(
<ide> () => Buffer.allocUnsafe(8).fill('a', 0, 9),
<del> common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }));
<add> { code: 'ERR_INDEX_OUT_OF_RANGE' });
<ide>
<ide> // Make sure this doesn't hang indefinitely.
<ide> Buffer.allocUnsafe(8).fill('');
<ide> Buffer.alloc(8, '');
<ide> // magically mangled using Symbol.toPrimitive.
<ide> {
<ide> let elseWasLast = false;
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> let ctr = 0;
<ide> const start = {
<ide> [Symbol.toPrimitive]() {
<ide> Buffer.alloc(8, '');
<ide> }
<ide> };
<ide> Buffer.alloc(1).fill(Buffer.alloc(1), start, 1);
<del> }, common.expectsError(
<del> { code: undefined, type: RangeError, message: 'Index out of range' }));
<add> }, {
<add> code: undefined, type: RangeError, message: 'Index out of range'
<add> });
<ide> // Make sure -1 is making it to Buffer::Fill().
<ide> assert.ok(elseWasLast,
<ide> 'internal API changed, -1 no longer in correct location');
<ide> }
<ide>
<ide> // Testing process.binding. Make sure "start" is properly checked for -1 wrap
<ide> // around.
<del>assert.throws(() => {
<add>common.expectsError(() => {
<ide> process.binding('buffer').fill(Buffer.alloc(1), 1, -1, 0, 1);
<del>}, common.expectsError(
<del> { code: undefined, type: RangeError, message: 'Index out of range' }));
<add>}, {
<add> code: undefined, type: RangeError, message: 'Index out of range'
<add>});
<ide>
<ide> // Make sure "end" is properly checked, even if it's magically mangled using
<ide> // Symbol.toPrimitive.
<ide> {
<ide> let elseWasLast = false;
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> let ctr = 0;
<ide> const end = {
<ide> [Symbol.toPrimitive]() {
<ide> assert.throws(() => {
<ide> }
<ide> };
<ide> Buffer.alloc(1).fill(Buffer.alloc(1), 0, end);
<del> }, common.expectsError(
<del> { code: undefined, type: RangeError, message: 'Index out of range' }));
<add> }, {
<add> code: undefined, type: RangeError, message: 'Index out of range'
<add> });
<ide> // Make sure -1 is making it to Buffer::Fill().
<ide> assert.ok(elseWasLast,
<ide> 'internal API changed, -1 no longer in correct location');
<ide><path>test/parallel/test-buffer-new.js
<ide> 'use strict';
<ide>
<ide> const common = require('../common');
<del>const assert = require('assert');
<ide>
<del>assert.throws(() => new Buffer(42, 'utf8'), common.expectsError({
<add>common.expectsError(() => new Buffer(42, 'utf8'), {
<ide> code: 'ERR_INVALID_ARG_TYPE',
<ide> type: TypeError,
<ide> message: 'The "string" argument must be of type string. Received type number'
<del>}));
<add>});
<ide><path>test/parallel/test-buffer-read.js
<ide> const buf = Buffer.from([0xa4, 0xfd, 0x48, 0xea, 0xcf, 0xff, 0xd9, 0x01, 0xde]);
<ide> function read(buff, funx, args, expected) {
<ide>
<ide> assert.strictEqual(buff[funx](...args), expected);
<del> assert.throws(
<add> common.expectsError(
<ide> () => buff[funx](-1),
<del> common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })
<add> {
<add> code: 'ERR_INDEX_OUT_OF_RANGE'
<add> }
<ide> );
<ide>
<ide> assert.doesNotThrow( | 10 |
Python | Python | fix documentation for convolution2d | 26ab219159ec4afa5940e0cd2cf2dcffb4b2399d | <ide><path>keras/layers/convolutional.py
<ide> class Convolution2D(Layer):
<ide>
<ide> # Output shape
<ide> 4D tensor with shape:
<del> `(samples, nb_filter, nb_row, nb_col)` if dim_ordering='th'
<add> `(samples, nb_filter, new_rows, new_cols)` if dim_ordering='th'
<ide> or 4D tensor with shape:
<del> `(samples, nb_row, nb_col, nb_filter)` if dim_ordering='tf'.
<add> `(samples, new_rows, new_cols, nb_filter)` if dim_ordering='tf'.
<add> `rows` and `cols` values might have changed due to padding.
<ide>
<ide>
<ide> # Arguments | 1 |
Ruby | Ruby | clarify service.build arguments | 1a17cfb9d9719c8458fb1259371c173627b96d8f | <ide><path>lib/active_storage/service.rb
<ide> def self.configure(service_name, configurations)
<ide>
<ide> # Override in subclasses that stitch together multiple services and hence
<ide> # need to do additional lookups from configurations. See MirrorService.
<del> def self.build(config, configurations) #:nodoc:
<del> new(config)
<add> def self.build(service_config, all_configurations) #:nodoc:
<add> new(service_config)
<ide> end
<ide>
<ide> def upload(key, io, checksum: nil)
<ide><path>lib/active_storage/service/mirror_service.rb
<ide> class ActiveStorage::Service::MirrorService < ActiveStorage::Service
<ide> delegate :download, :exist?, :url, to: :primary
<ide>
<ide> # Stitch together from named configuration.
<del> def self.build(mirror_config, all_configurations) #:nodoc:
<del> primary = ActiveStorage::Service.configure(mirror_config.fetch(:primary), all_configurations)
<add> def self.build(service_config, all_configurations) #:nodoc:
<add> primary = ActiveStorage::Service.configure(service_config.fetch(:primary), all_configurations)
<ide>
<del> mirrors = mirror_config.fetch(:mirrors).collect do |service_name|
<add> mirrors = service_config.fetch(:mirrors).collect do |service_name|
<ide> ActiveStorage::Service.configure(service_name.to_sym, all_configurations)
<ide> end
<ide> | 2 |
Javascript | Javascript | fix spelling mistake in node.js comment | ec6e5c79993599a8b6977050bcc09b32b187a8ac | <ide><path>src/node.js
<ide> process._tickDomainCallback = _tickDomainCallback;
<ide>
<ide> // This tickInfo thing is used so that the C++ code in src/node.cc
<del> // can have easy accesss to our nextTick state, and avoid unnecessary
<add> // can have easy access to our nextTick state, and avoid unnecessary
<ide> // calls into JS land.
<ide> const tickInfo = process._setupNextTick(_tickCallback, _runMicrotasks);
<ide> | 1 |
Javascript | Javascript | reconstruct constructor in more cases | a92ad36894dc91af765e7cc9bfce4a7ea64c27fa | <ide><path>lib/internal/util/inspect.js
<ide> function formatRaw(ctx, value, recurseTimes, typedArray) {
<ide> braces = getIteratorBraces('Set', tag);
<ide> formatter = formatIterator;
<ide> // Handle other regular objects again.
<del> } else if (keys.length === 0) {
<del> if (isExternal(value))
<del> return ctx.stylize('[External]', 'special');
<del> return `${getPrefix(constructor, tag, 'Object')}{}`;
<ide> } else {
<del> braces[0] = `${getPrefix(constructor, tag, 'Object')}{`;
<add> let fallback = '';
<add> if (constructor === null) {
<add> fallback = internalGetConstructorName(value);
<add> if (fallback === tag) {
<add> fallback = 'Object';
<add> }
<add> }
<add> if (keys.length === 0) {
<add> if (isExternal(value))
<add> return ctx.stylize('[External]', 'special');
<add> return `${getPrefix(constructor, tag, fallback)}{}`;
<add> }
<add> braces[0] = `${getPrefix(constructor, tag, fallback)}{`;
<ide> }
<ide> }
<ide> }
<ide><path>test/parallel/test-util-inspect.js
<ide> if (typeof Symbol !== 'undefined') {
<ide> util.inspect({ a: { b: new ArraySubclass([1, [2], 3]) } }, { depth: 1 }),
<ide> '{ a: { b: [ArraySubclass] } }'
<ide> );
<add> assert.strictEqual(
<add> util.inspect(Object.setPrototypeOf(x, null)),
<add> '[ObjectSubclass: null prototype] { foo: 42 }'
<add> );
<ide> }
<ide>
<ide> // Empty and circular before depth. | 2 |
Python | Python | maintain aspect ratio of content image | d0b4779071c0383f2ec9092ab9eee4b8ed4f81c2 | <ide><path>examples/neural_style_transfer.py
<ide> content_weight = args.content_weight
<ide>
<ide> # dimensions of the generated picture.
<add>width, height = load_img(base_image_path).size
<ide> img_nrows = 400
<del>img_ncols = 400
<del>assert img_ncols == img_nrows, 'Due to the use of the Gram matrix, width and height must match.'
<add>img_ncols = int(width * img_nrows / height)
<ide>
<ide> # util function to open, resize and format pictures into appropriate tensors
<ide> def preprocess_image(image_path): | 1 |
Javascript | Javascript | remove unnecessary comma in oceanshader | 59162563eddb4fab7f294560bdfdf2cc0c5abfd7 | <ide><path>examples/js/shaders/OceanShaders.js
<ide> THREE.ShaderLib[ 'ocean_initial_spectrum' ] = {
<ide> uniforms: {
<ide> "u_wind": { value: new THREE.Vector2( 10.0, 10.0 ) },
<ide> "u_resolution": { value: 512.0 },
<del> "u_size": { value: 250.0 },
<add> "u_size": { value: 250.0 }
<ide> },
<ide> fragmentShader: [
<ide> 'precision highp float;',
<ide> THREE.ShaderLib[ 'ocean_phase' ] = {
<ide> "u_phases": { value: null },
<ide> "u_deltaTime": { value: null },
<ide> "u_resolution": { value: null },
<del> "u_size": { value: null },
<add> "u_size": { value: null }
<ide> },
<ide> fragmentShader: [
<ide> 'precision highp float;',
<ide> THREE.ShaderLib[ 'ocean_spectrum' ] = {
<ide> "u_resolution": { value: null },
<ide> "u_choppiness": { value: null },
<ide> "u_phases": { value: null },
<del> "u_initialSpectrum": { value: null },
<add> "u_initialSpectrum": { value: null }
<ide> },
<ide> fragmentShader: [
<ide> 'precision highp float;',
<ide> THREE.ShaderLib[ 'ocean_normals' ] = {
<ide> uniforms: {
<ide> "u_displacementMap": { value: null },
<ide> "u_resolution": { value: null },
<del> "u_size": { value: null },
<add> "u_size": { value: null }
<ide> },
<ide> fragmentShader: [
<ide> 'precision highp float;',
<ide> THREE.ShaderLib[ 'ocean_main' ] = {
<ide> "u_skyColor": { value: null },
<ide> "u_oceanColor": { value: null },
<ide> "u_sunDirection": { value: null },
<del> "u_exposure": { value: null },
<add> "u_exposure": { value: null }
<ide> },
<ide> vertexShader: [
<ide> 'precision highp float;', | 1 |
Go | Go | fix experimental tests | 44da86172aeb750d0ac46c000e32e51a12411ecd | <ide><path>integration-cli/docker_utils.go
<ide> import (
<ide> "github.com/go-check/check"
<ide> )
<ide>
<add>func init() {
<add> out, err := exec.Command(dockerBinary, "images").CombinedOutput()
<add> if err != nil {
<add> panic(err)
<add> }
<add> lines := strings.Split(string(out), "\n")[1:]
<add> for _, l := range lines {
<add> if l == "" {
<add> continue
<add> }
<add> fields := strings.Fields(l)
<add> imgTag := fields[0] + ":" + fields[1]
<add> // just for case if we have dangling images in tested daemon
<add> if imgTag != "<none>:<none>" {
<add> protectedImages[imgTag] = struct{}{}
<add> }
<add> }
<add>
<add> // Obtain the daemon platform so that it can be used by tests to make
<add> // intelligent decisions about how to configure themselves, and validate
<add> // that the target platform is valid.
<add> res, _, err := sockRequestRaw("GET", "/version", nil, "application/json")
<add> if err != nil || res == nil || (res != nil && res.StatusCode != http.StatusOK) {
<add> panic(fmt.Errorf("Init failed to get version: %v. Res=%v", err.Error(), res))
<add> }
<add> svrHeader, _ := httputils.ParseServerHeader(res.Header.Get("Server"))
<add> daemonPlatform = svrHeader.OS
<add> if daemonPlatform != "linux" && daemonPlatform != "windows" {
<add> panic("Cannot run tests against platform: " + daemonPlatform)
<add> }
<add>
<add> // On Windows, extract out the version as we need to make selective
<add> // decisions during integration testing as and when features are implemented.
<add> if daemonPlatform == "windows" {
<add> if body, err := ioutil.ReadAll(res.Body); err == nil {
<add> var server types.Version
<add> if err := json.Unmarshal(body, &server); err == nil {
<add> // eg in "10.0 10550 (10550.1000.amd64fre.branch.date-time)" we want 10550
<add> windowsDaemonKV, _ = strconv.Atoi(strings.Split(server.KernelVersion, " ")[1])
<add> }
<add> }
<add> }
<add>
<add> // Now we know the daemon platform, can set paths used by tests.
<add> _, body, err := sockRequest("GET", "/info", nil)
<add> if err != nil {
<add> panic(err)
<add> }
<add>
<add> var info types.Info
<add> err = json.Unmarshal(body, &info)
<add> dockerBasePath = info.DockerRootDir
<add> volumesConfigPath = filepath.Join(dockerBasePath, "volumes")
<add> containerStoragePath = filepath.Join(dockerBasePath, "containers")
<add>}
<add>
<ide> // Daemon represents a Docker daemon for the testing framework.
<ide> type Daemon struct {
<ide> // Defaults to "daemon"
<ide> func getAllVolumes() ([]*types.Volume, error) {
<ide>
<ide> var protectedImages = map[string]struct{}{}
<ide>
<del>func init() {
<del> out, err := exec.Command(dockerBinary, "images").CombinedOutput()
<del> if err != nil {
<del> panic(err)
<del> }
<del> lines := strings.Split(string(out), "\n")[1:]
<del> for _, l := range lines {
<del> if l == "" {
<del> continue
<del> }
<del> fields := strings.Fields(l)
<del> imgTag := fields[0] + ":" + fields[1]
<del> // just for case if we have dangling images in tested daemon
<del> if imgTag != "<none>:<none>" {
<del> protectedImages[imgTag] = struct{}{}
<del> }
<del> }
<del>
<del> // Obtain the daemon platform so that it can be used by tests to make
<del> // intelligent decisions about how to configure themselves, and validate
<del> // that the target platform is valid.
<del> res, _, err := sockRequestRaw("GET", "/version", nil, "application/json")
<del> if err != nil || res == nil || (res != nil && res.StatusCode != http.StatusOK) {
<del> panic(fmt.Errorf("Init failed to get version: %v. Res=%v", err.Error(), res))
<del> }
<del> svrHeader, _ := httputils.ParseServerHeader(res.Header.Get("Server"))
<del> daemonPlatform = svrHeader.OS
<del> if daemonPlatform != "linux" && daemonPlatform != "windows" {
<del> panic("Cannot run tests against platform: " + daemonPlatform)
<del> }
<del>
<del> // On Windows, extract out the version as we need to make selective
<del> // decisions during integration testing as and when features are implemented.
<del> if daemonPlatform == "windows" {
<del> if body, err := ioutil.ReadAll(res.Body); err == nil {
<del> var server types.Version
<del> if err := json.Unmarshal(body, &server); err == nil {
<del> // eg in "10.0 10550 (10550.1000.amd64fre.branch.date-time)" we want 10550
<del> windowsDaemonKV, _ = strconv.Atoi(strings.Split(server.KernelVersion, " ")[1])
<del> }
<del> }
<del> }
<del>
<del> // Now we know the daemon platform, can set paths used by tests.
<del> if daemonPlatform == "windows" {
<del> dockerBasePath = `c:\programdata\docker`
<del> volumesConfigPath = dockerBasePath + `\volumes`
<del> containerStoragePath = dockerBasePath + `\containers`
<del> } else {
<del> dockerBasePath = "/var/lib/docker"
<del> volumesConfigPath = dockerBasePath + "/volumes"
<del> containerStoragePath = dockerBasePath + "/containers"
<del> }
<del>}
<del>
<ide> func deleteAllImages() error {
<ide> out, err := exec.Command(dockerBinary, "images").CombinedOutput()
<ide> if err != nil { | 1 |
Java | Java | support meta @component with non-string value | a8fd832818af60140ac3e4660d1a26bd3944ab8b | <ide><path>spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java
<ide> /*
<del> * Copyright 2002-2012 the original author or authors.
<add> * Copyright 2002-2013 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> protected boolean isStereotypeWithNameValue(String annotationType,
<ide> (metaAnnotationTypes != null && metaAnnotationTypes.contains(COMPONENT_ANNOTATION_CLASSNAME)) ||
<ide> annotationType.equals("javax.annotation.ManagedBean") ||
<ide> annotationType.equals("javax.inject.Named");
<del> return (isStereotype && attributes != null && attributes.containsKey("value"));
<add>
<add> return (isStereotype && attributes != null &&
<add> attributes.containsKey("value") &&
<add> attributes.get("value") instanceof String);
<ide> }
<ide>
<ide> /**
<ide><path>spring-context/src/test/java/org/springframework/context/annotation/AnnotationBeanNameGeneratorTests.java
<ide> /*
<del> * Copyright 2002-2012 the original author or authors.
<add> * Copyright 2002-2013 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide>
<ide> package org.springframework.context.annotation;
<ide>
<del>import example.scannable.DefaultNamedComponent;
<del>import org.junit.Test;
<add>import java.lang.annotation.ElementType;
<add>import java.lang.annotation.Retention;
<add>import java.lang.annotation.RetentionPolicy;
<add>import java.lang.annotation.Target;
<ide>
<add>import org.junit.Test;
<ide> import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
<ide> import org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition;
<ide> import org.springframework.beans.factory.support.BeanDefinitionRegistry;
<ide> import org.springframework.beans.factory.support.SimpleBeanDefinitionRegistry;
<ide> import org.springframework.stereotype.Component;
<add>import org.springframework.stereotype.Service;
<ide> import org.springframework.util.StringUtils;
<ide>
<add>import example.scannable.DefaultNamedComponent;
<ide> import static org.junit.Assert.*;
<ide>
<ide> /**
<ide> public void testGenerateBeanNameWithAnonymousComponentYieldsGeneratedBeanName()
<ide> assertEquals(expectedGeneratedBeanName, beanName);
<ide> }
<ide>
<add> @Test
<add> public void testGenerateBeanNameFromMetaComponentWithStringValue() {
<add> BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
<add> AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromStringMeta.class);
<add> String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
<add> assertEquals("henry", beanName);
<add> }
<add>
<add> @Test
<add> public void testGenerateBeanNameFromMetaComponentWithNonStringValue() {
<add> BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
<add> AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromNonStringMeta.class);
<add> String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
<add> assertEquals("annotationBeanNameGeneratorTests.ComponentFromNonStringMeta", beanName);
<add> }
<add>
<ide>
<ide> @Component("walden")
<ide> private static class ComponentWithName {
<ide> private static class ComponentWithBlankName {
<ide> private static class AnonymousComponent {
<ide> }
<ide>
<add> @Service("henry")
<add> private static class ComponentFromStringMeta {
<add> }
<add>
<add> @Retention(RetentionPolicy.RUNTIME)
<add> @Target(ElementType.TYPE)
<add> @Component
<add> public @interface NonStringMetaComponent {
<add> long value();
<add> }
<add>
<add> @NonStringMetaComponent(123)
<add> private static class ComponentFromNonStringMeta {
<add> }
<add>
<ide> } | 2 |
Ruby | Ruby | provide unpatched argv | 34a8ab74af5e7687e92a8a9641be1aabc14cb54d | <ide><path>Library/Homebrew/global.rb
<ide> require "messages"
<ide> require "system_command"
<ide>
<add>ARGV_WITHOUT_MONKEY_PATCHING = ARGV.dup
<ide> ARGV.extend(HomebrewArgvExtension)
<ide>
<ide> HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"] | 1 |
PHP | PHP | fix typo in bake | 6ffdf09d4d93ebaba69f7c9117acd9ea1df7d6a3 | <ide><path>cake/scripts/bake.php
<ide> function __bakeActions($controllerName, $admin = null, $admin_url = null, $wanna
<ide> $habtmModelName = $this->__modelName($associationName);
<ide> $habtmSingularName = $this->__singularName($associationName);
<ide> $habtmPluralName = $this->__pluralName($associationName);
<del> $actions .= "\t\t\${$habtmPluralName} = \$this->{$currentModelName}->{$habtmoModelName}->generateList();\n";
<add> $actions .= "\t\t\${$habtmPluralName} = \$this->{$currentModelName}->{$habtmModelName}->generateList();\n";
<ide> $compact[] = "'{$habtmPluralName}'";
<ide> }
<ide> }
<ide> function __bakeActions($controllerName, $admin = null, $admin_url = null, $wanna
<ide> $habtmModelName = $this->__modelName($associationName);
<ide> $habtmSingularName = $this->__singularName($associationName);
<ide> $habtmPluralName = $this->__pluralName($associationName);
<del> $actions .= "\t\t\${$habtmPluralName} = \$this->{$currentModelName}->{$habtmoModelName}->generateList();\n";
<add> $actions .= "\t\t\${$habtmPluralName} = \$this->{$currentModelName}->{$habtmModelName}->generateList();\n";
<ide> $compact[] = "'{$habtmPluralName}'";
<ide> }
<ide> } | 1 |
Ruby | Ruby | allow #nulls_first and #nulls_last in postgresql | 66b19b5dec78a74e4280d69ac0e4801699ca691a | <ide><path>activerecord/lib/arel/nodes.rb
<ide> # unary
<ide> require "arel/nodes/unary"
<ide> require "arel/nodes/grouping"
<add>require "arel/nodes/ordering"
<ide> require "arel/nodes/ascending"
<ide> require "arel/nodes/descending"
<ide> require "arel/nodes/unqualified_column"
<ide><path>activerecord/lib/arel/nodes/ordering.rb
<add># frozen_string_literal: true
<add>
<add>module Arel # :nodoc: all
<add> module Nodes
<add> class Ordering < Unary
<add> def nulls_first
<add> NullsFirst.new(self)
<add> end
<add>
<add> def nulls_last
<add> NullsLast.new(self)
<add> end
<add> end
<add>
<add> class NullsFirst < Ordering; end
<add> class NullsLast < Ordering; end
<add> end
<add>end
<ide><path>activerecord/lib/arel/nodes/unary.rb
<ide> def eql?(other)
<ide> Offset
<ide> On
<ide> OptimizerHints
<del> Ordering
<ide> RollUp
<ide> }.each do |name|
<ide> const_set(name, Class.new(Unary))
<ide><path>activerecord/lib/arel/visitors/postgresql.rb
<ide> def visit_Arel_Nodes_IsDistinctFrom(o, collector)
<ide> visit o.right, collector
<ide> end
<ide>
<add> def visit_Arel_Nodes_NullsFirst(o, collector)
<add> visit o.expr, collector
<add> collector << " NULLS FIRST"
<add> end
<add>
<add> def visit_Arel_Nodes_NullsLast(o, collector)
<add> visit o.expr, collector
<add> collector << " NULLS LAST"
<add> end
<add>
<ide> # Used by Lateral visitor to enclose select queries in parentheses
<ide> def grouping_parentheses(o, collector)
<ide> if o.expr.is_a? Nodes::SelectStatement
<ide><path>activerecord/test/cases/arel/visitors/postgres_test.rb
<ide> def compile(node)
<ide> _(sql).must_be_like %{ "users"."name" IS DISTINCT FROM NULL }
<ide> end
<ide> end
<add>
<add> describe "Nodes::Ordering" do
<add> it "should handle nulls first" do
<add> test = Table.new(:users)[:first_name].desc.nulls_first
<add> _(compile(test)).must_be_like %{
<add> "users"."first_name" DESC NULLS FIRST
<add> }
<add> end
<add>
<add> it "should handle nulls last" do
<add> test = Table.new(:users)[:first_name].desc.nulls_last
<add> _(compile(test)).must_be_like %{
<add> "users"."first_name" DESC NULLS LAST
<add> }
<add> end
<add> end
<ide> end
<ide> end
<ide> end | 5 |
Ruby | Ruby | fix warning thrown by ruby 1.8.6 | 7ffa831718b1377a9faea623ed185bae54248106 | <ide><path>Library/Homebrew/patches.rb
<ide> def curl_args
<ide> # Write the given file object (DATA) out to a local file for patch
<ide> def write_data f
<ide> pn = Pathname.new @patch_filename
<del> pn.write(brew_var_substitution f.read.to_s)
<add> pn.write(brew_var_substitution(f.read.to_s))
<ide> end
<ide>
<ide> # Do any supported substitutions of HOMEBREW vars in a DATA patch | 1 |
Javascript | Javascript | prevent undefined values in mergeconfig | b1c378606f09a38d7e6713595add07676882b8f2 | <ide><path>lib/core/mergeConfig.js
<ide> module.exports = function mergeConfig(config1, config2) {
<ide> var config = {};
<ide>
<ide> utils.forEach(['url', 'method', 'params', 'data'], function valueFromInstanceConfig(prop) {
<del> config[prop] = config2[prop];
<add> if (typeof config2[prop] !== 'undefined') {
<add> config[prop] = config2[prop];
<add> }
<ide> });
<ide>
<ide> utils.forEach(['headers', 'auth', 'proxy'], function mergeInstanceConfigWithDefaults(prop) { | 1 |
Javascript | Javascript | throw an error when getwindowsize() fails | f1f5de1c8d289766ee1628a06cb7dbab440e12f8 | <ide><path>lib/tty.js
<ide> function WriteStream(fd) {
<ide> this.writable = true;
<ide>
<ide> var winSize = this._handle.getWindowSize();
<del> this.columns = winSize[0];
<del> this.rows = winSize[1];
<add> if (winSize) {
<add> this.columns = winSize[0];
<add> this.rows = winSize[1];
<add> }
<ide> }
<ide> inherits(WriteStream, net.Socket);
<ide> exports.WriteStream = WriteStream;
<ide> WriteStream.prototype._refreshSize = function() {
<ide> var oldCols = this.columns;
<ide> var oldRows = this.rows;
<ide> var winSize = this._handle.getWindowSize();
<add> if (!winSize) {
<add> throw errnoException(errno, 'getWindowSize');
<add> }
<ide> var newCols = winSize[0];
<ide> var newRows = winSize[1];
<ide> if (oldCols !== newCols || oldRows !== newRows) {
<ide> WriteStream.prototype.clearScreenDown = function() {
<ide> WriteStream.prototype.getWindowSize = function() {
<ide> return [this.columns, this.rows];
<ide> };
<add>
<add>
<add>// TODO share with net_uv and others
<add>function errnoException(errorno, syscall) {
<add> var e = new Error(syscall + ' ' + errorno);
<add> e.errno = e.code = errorno;
<add> e.syscall = syscall;
<add> return e;
<add>} | 1 |
Ruby | Ruby | create plpgsql language if not available | 5156110476575f1b26be0b204ab2e12d2dd37434 | <ide><path>activerecord/test/schema/postgresql_specific_schema.rb
<ide> );
<ide> _SQL
<ide>
<del> execute <<_SQL
<del> CREATE TABLE postgresql_partitioned_table_parent (
<del> id SERIAL PRIMARY KEY,
<del> number integer
<del> );
<del> CREATE TABLE postgresql_partitioned_table ( )
<del> INHERITS (postgresql_partitioned_table_parent);
<del>
<del> CREATE OR REPLACE FUNCTION partitioned_insert_trigger()
<del> RETURNS TRIGGER AS $$
<del> BEGIN
<del> INSERT INTO postgresql_partitioned_table VALUES (NEW.*);
<del> RETURN NULL;
<del> END;
<del> $$
<del> LANGUAGE plpgsql;
<del>
<del> CREATE TRIGGER insert_partitioning_trigger
<del> BEFORE INSERT ON postgresql_partitioned_table_parent
<del> FOR EACH ROW EXECUTE PROCEDURE partitioned_insert_trigger();
<add>begin
<add> execute <<_SQL
<add> CREATE TABLE postgresql_partitioned_table_parent (
<add> id SERIAL PRIMARY KEY,
<add> number integer
<add> );
<add> CREATE TABLE postgresql_partitioned_table ( )
<add> INHERITS (postgresql_partitioned_table_parent);
<add>
<add> CREATE OR REPLACE FUNCTION partitioned_insert_trigger()
<add> RETURNS TRIGGER AS $$
<add> BEGIN
<add> INSERT INTO postgresql_partitioned_table VALUES (NEW.*);
<add> RETURN NULL;
<add> END;
<add> $$
<add> LANGUAGE plpgsql;
<add>
<add> CREATE TRIGGER insert_partitioning_trigger
<add> BEFORE INSERT ON postgresql_partitioned_table_parent
<add> FOR EACH ROW EXECUTE PROCEDURE partitioned_insert_trigger();
<ide> _SQL
<del>
<add>rescue ActiveRecord::StatementInvalid => e
<add> if e.message =~ /language "plpgsql" does not exist/
<add> execute "CREATE LANGUAGE 'plpgsql';"
<add> retry
<add> else
<add> raise e
<add> end
<add>end
<ide>
<ide> begin
<ide> execute <<_SQL | 1 |
Text | Text | fix small typo in activejob changelog | d6a7aab4fd128da2385fdad8b9bf197172bc79fb | <ide><path>activejob/CHANGELOG.md
<ide> end
<ide> end
<ide>
<del> When dealing with sensitive arugments as password and tokens it is now possible to configure the job
<add> When dealing with sensitive arguments as password and tokens it is now possible to configure the job
<ide> to not put the sensitive argument in the logs.
<ide>
<ide> *Rafael Mendonça França* | 1 |
Text | Text | fix dead link in doc/releases.md | a6b47a29f2035de3342b917eacb4607a4f6a5f00 | <ide><path>doc/releases.md
<ide> Release builds require manual promotion by an individual with SSH access to the
<ide>
<ide> A SHASUMS256.txt file is produced for every promoted build, nightly, and releases. Additionally for releases, this file is signed by the individual responsible for that release. In order to be able to verify downloaded binaries, the public should be able to check that the SHASUMS256.txt file has been signed by someone who has been authorized to create a release.
<ide>
<del>The GPG keys should be fetchable from a known third-party keyserver. The SKS Keyservers at <https://sks-keyservers.net> are recommended. Use the [submission](https://sks-keyservers.net/i/#submit) form to submit a new GPG key. Keys should be fetchable via:
<add>The GPG keys should be fetchable from a known third-party keyserver. The SKS Keyservers at <https://sks-keyservers.net> are recommended. Use the [submission](https://pgp.mit.edu/) form to submit a new GPG key. Keys should be fetchable via:
<ide>
<ide> ```console
<ide> $ gpg --keyserver pool.sks-keyservers.net --recv-keys <FINGERPRINT> | 1 |
PHP | PHP | remove bad test | ed6ff92296107121d8fa50fb6ae75cd6ca61ca5e | <ide><path>lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
<ide> public function testMultipleServers() {
<ide> $Memcache = new MemcacheEngine();
<ide> $Memcache->init(array('engine' => 'Memcache', 'servers' => $servers));
<ide>
<del> $servers = array_keys($Memcache->__Memcache->getExtendedStats());
<ide> $settings = $Memcache->settings();
<ide> $this->assertEquals($settings['servers'], $servers);
<ide> Cache::drop('dual_server'); | 1 |
PHP | PHP | fix failing folder test | 9b53319ee38a7f05c31b097497b68d3b0334b087 | <ide><path>lib/Cake/Test/TestCase/Utility/FolderTest.php
<ide> public function testFindRecursive() {
<ide> $this->assertSame(array_diff($expected, $result), array());
<ide> $this->assertSame(array_diff($expected, $result), array());
<ide>
<del> $result = $Folder->findRecursive('(config|paths)\.php', true);
<add> $result = $Folder->findRecursive('(config|woot)\.php', true);
<ide> $expected = array(
<ide> CAKE . 'Config/config.php'
<ide> ); | 1 |
Ruby | Ruby | use string for example | 3c975d85f17bc2f47b01aff06f34e16605e66bf0 | <ide><path>activesupport/lib/active_support/message_verifier.rb
<ide> module ActiveSupport
<ide> # return the original value. But messages can be set to expire at a given
<ide> # time with +:expires_in+ or +:expires_at+.
<ide> #
<del> # @verifier.generate(parcel, expires_in: 1.month)
<del> # @verifier.generate(doowad, expires_at: Time.now.end_of_year)
<add> # @verifier.generate("parcel", expires_in: 1.month)
<add> # @verifier.generate("doowad", expires_at: Time.now.end_of_year)
<ide> #
<ide> # Then the messages can be verified and returned up to the expire time.
<ide> # Thereafter, the +verified+ method returns +nil+ while +verify+ raises | 1 |
Text | Text | remove title and hr | 4204557bc5086fbf9c8da9476a9efde92e10b8ed | <ide><path>docs/topics/documenting-your-api.md
<ide> Mark is also the author of the [REST Framework Docs][rest-framework-docs] packag
<ide>
<ide> ![Screenshot - Django REST Swagger][image-django-rest-swagger]
<ide>
<del>---
<del>
<del>#### REST Framework Docs
<del>
<del>
<ide> ---
<ide>
<ide> #### Apiary | 1 |
Ruby | Ruby | add warnings for patches and resources | 8df618958dbd459715f3d5ee6456092f4fec59af | <ide><path>Library/Homebrew/dev-cmd/bump-formula-pr.rb
<ide> def bump_formula_pr
<ide> new_version = args.version
<ide> check_closed_pull_requests(formula, tap_full_name, version: new_version, args: args) if new_version
<ide>
<add> opoo "This formula has patches that may be resolved upstream." if formula.patchlist.present?
<add> opoo "This formula has resources that may need to be updated." if formula.resources.present?
<add>
<ide> requested_spec = :stable
<ide> formula_spec = formula.stable
<ide> odie "#{formula}: no #{requested_spec} specification found!" unless formula_spec | 1 |
Javascript | Javascript | use class fields in event and eventtarget | ea0668a27e2d89dd7924d577b6bcf3f87ed3d986 | <ide><path>lib/internal/event_target.js
<ide> const kTrustEvent = Symbol('kTrustEvent');
<ide>
<ide> const { now } = require('internal/perf/utils');
<ide>
<del>// TODO(joyeecheung): V8 snapshot does not support instance member
<del>// initializers for now:
<del>// https://bugs.chromium.org/p/v8/issues/detail?id=10704
<ide> const kType = Symbol('type');
<del>const kDefaultPrevented = Symbol('defaultPrevented');
<del>const kCancelable = Symbol('cancelable');
<del>const kTimestamp = Symbol('timestamp');
<del>const kBubbles = Symbol('bubbles');
<del>const kComposed = Symbol('composed');
<del>const kPropagationStopped = Symbol('propagationStopped');
<ide>
<ide> const isTrustedSet = new SafeWeakSet();
<ide> const isTrusted = ObjectGetOwnPropertyDescriptor({
<ide> function isEvent(value) {
<ide> }
<ide>
<ide> class Event {
<add> #cancelable = false;
<add> #bubbles = false;
<add> #composed = false;
<add> #defaultPrevented = false;
<add> #timestamp = now();
<add> #propagationStopped = false;
<add>
<ide> /**
<ide> * @param {string} type
<ide> * @param {{
<ide> class Event {
<ide> allowArray: true, allowFunction: true, nullable: true,
<ide> });
<ide> const { cancelable, bubbles, composed } = { ...options };
<del> this[kCancelable] = !!cancelable;
<del> this[kBubbles] = !!bubbles;
<del> this[kComposed] = !!composed;
<add> this.#cancelable = !!cancelable;
<add> this.#bubbles = !!bubbles;
<add> this.#composed = !!composed;
<add>
<ide> this[kType] = `${type}`;
<del> this[kDefaultPrevented] = false;
<del> this[kTimestamp] = now();
<del> this[kPropagationStopped] = false;
<ide> if (options?.[kTrustEvent]) {
<ide> isTrustedSet.add(this);
<ide> }
<ide> class Event {
<ide>
<ide> return `${name} ${inspect({
<ide> type: this[kType],
<del> defaultPrevented: this[kDefaultPrevented],
<del> cancelable: this[kCancelable],
<del> timeStamp: this[kTimestamp],
<add> defaultPrevented: this.#defaultPrevented,
<add> cancelable: this.#cancelable,
<add> timeStamp: this.#timestamp,
<ide> }, opts)}`;
<ide> }
<ide>
<ide> class Event {
<ide> preventDefault() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<del> this[kDefaultPrevented] = true;
<add> this.#defaultPrevented = true;
<ide> }
<ide>
<ide> /**
<ide> class Event {
<ide> get cancelable() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<del> return this[kCancelable];
<add> return this.#cancelable;
<ide> }
<ide>
<ide> /**
<ide> class Event {
<ide> get defaultPrevented() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<del> return this[kCancelable] && this[kDefaultPrevented];
<add> return this.#cancelable && this.#defaultPrevented;
<ide> }
<ide>
<ide> /**
<ide> class Event {
<ide> get timeStamp() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<del> return this[kTimestamp];
<add> return this.#timestamp;
<ide> }
<ide>
<ide>
<ide> class Event {
<ide> get bubbles() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<del> return this[kBubbles];
<add> return this.#bubbles;
<ide> }
<ide>
<ide> /**
<ide> class Event {
<ide> get composed() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<del> return this[kComposed];
<add> return this.#composed;
<ide> }
<ide>
<ide> /**
<ide> class Event {
<ide> get cancelBubble() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<del> return this[kPropagationStopped];
<add> return this.#propagationStopped;
<ide> }
<ide>
<ide> /**
<ide> class Event {
<ide> stopPropagation() {
<ide> if (!isEvent(this))
<ide> throw new ERR_INVALID_THIS('Event');
<del> this[kPropagationStopped] = true;
<add> this.#propagationStopped = true;
<ide> }
<ide>
<ide> static NONE = 0; | 1 |
Javascript | Javascript | add verify-requirements util | 07e64152be272dea68f3b149be9b94a27b871491 | <ide><path>script/utils/verify-requirements.js
<add>module.exports = function() {
<add> verifyNode();
<add> verifyPython27();
<add>};
<add>
<add>function verifyNode() {
<add> var nodeVersion = process.versions.node.split('.');
<add> var nodeMajorVersion = +nodeVersion[0];
<add> var nodeMinorVersion = +nodeVersion[1];
<add> if (nodeMajorVersion === 0 && nodeMinorVersion < 10) {
<add> console.warn("node v0.10 is required to build Atom.");
<add> process.exit(1);
<add> }
<add>}
<add>
<add>function verifyPython27() {
<add> if (process.platform == 'win32') {
<add> var pythonPath = process.env.PYTHON;
<add> if (!pythonPath) {
<add> var systemDrive = process.env.SystemDrive || 'C:\\';
<add> pythonPath = path.join(systemDrive, 'Python27');
<add> }
<add>
<add> if (!fs.existsSync(pythonPath)) {
<add> console.warn("Python 2.7 is required to build Atom. Python 2.7 must be installed at '" + pythonPath + "' or the PYTHON env var must be set to '/path/to/executable/python2.7'");
<add> process.exit(1);
<add> }
<add> }
<add>} | 1 |
PHP | PHP | add touch method to timestamp behavior | 527291974c2276164cc641c241243bf1fe110791 | <ide><path>Cake/Model/Behavior/TimestampBehavior.php
<ide> class TimestampBehavior extends Behavior {
<ide> */
<ide> protected static $_defaultConfig = [
<ide> 'implementedFinders' => [],
<del> 'implementedMethods' => ['timestamp' => 'timestamp'],
<add> 'implementedMethods' => [
<add> 'timestamp' => 'timestamp',
<add> 'touch' => 'touch'
<add> ],
<ide> 'events' => [
<ide> 'Model.beforeSave' => [
<ide> 'created' => 'new',
<ide> public function timestamp(\DateTime $ts = null, $refreshTimestamp = false) {
<ide> return $this->_ts;
<ide> }
<ide>
<add>/**
<add> * Touch an entity
<add> *
<add> * Bumps timestamp fields for an entity. For any fields configured to be updated
<add> * "always" or "existing", update the timestamp value. This method will overwrite
<add> * any pre-existing value.
<add> *
<add> * @param Entity $entity
<add> * @param string $eventName
<add> * @return bool true if a field is updated, false if no action performed
<add> */
<add> public function touch(Entity $entity, $eventName = 'Model.beforeSave') {
<add> $config = $this->config();
<add> if (!isset($config['events'][$eventName])) {
<add> return false;
<add> }
<add>
<add> $new = $entity->isNew() !== false;
<add> $return = false;
<add>
<add> foreach ($config['events'][$eventName] as $field => $when) {
<add> if (
<add> $when === 'always' ||
<add> ($when === 'existing' && !$new)
<add> ) {
<add> $return = true;
<add> $entity->dirty($field, false);
<add> $this->_updateField($entity, $field, $config['refreshTimestamp']);
<add> }
<add> }
<add>
<add> return $return;
<add> }
<add>
<ide> /**
<ide> * Update a field, if it hasn't been updated already
<ide> *
<ide><path>Cake/Test/TestCase/Model/Behavior/TimestampBehaviorTest.php
<ide> public function testSetTimestampExplicit() {
<ide> );
<ide> }
<ide>
<add>/**
<add> * testTouch
<add> *
<add> * @return void
<add> */
<add> public function testTouch() {
<add> $table = $this->getMock('Cake\ORM\Table');
<add> $this->Behavior = new TimestampBehavior($table, ['refreshTimestamp' => false]);
<add> $ts = new \DateTime('2000-01-01');
<add> $this->Behavior->timestamp($ts);
<add>
<add> $entity = new Entity(['username' => 'timestamp test']);
<add> $return = $this->Behavior->touch($entity);
<add> $this->assertTrue($return, 'touch is expected to return true if it sets a field value');
<add> $this->assertSame(
<add> $ts->format('Y-m-d H:i:s'),
<add> $entity->modified->format('Y-m-d H:i:s'),
<add> 'Modified field is expected to be updated'
<add> );
<add> $this->assertNull($entity->created, 'Created field is NOT expected to change');
<add> }
<add>
<add>/**
<add> * testTouchNoop
<add> *
<add> * @return void
<add> */
<add> public function testTouchNoop() {
<add> $table = $this->getMock('Cake\ORM\Table');
<add> $config = [
<add> 'refreshTimestamp' => false,
<add> 'events' => [
<add> 'Model.beforeSave' => [
<add> 'created' => 'new',
<add> ]
<add> ]
<add> ];
<add>
<add> $this->Behavior = new TimestampBehavior($table, $config);
<add> $ts = new \DateTime('2000-01-01');
<add> $this->Behavior->timestamp($ts);
<add>
<add> $entity = new Entity(['username' => 'timestamp test']);
<add> $return = $this->Behavior->touch($entity);
<add> $this->assertFalse($return, 'touch is expected to do nothing and return false');
<add> $this->assertNull($entity->modified, 'Modified field is NOT expected to change');
<add> $this->assertNull($entity->created, 'Created field is NOT expected to change');
<add> }
<add>
<add>/**
<add> * testTouchCustomEvent
<add> *
<add> * @return void
<add> */
<add> public function testTouchCustomEvent() {
<add> $table = $this->getMock('Cake\ORM\Table');
<add> $settings = ['events' => ['Something.special' => ['date_specialed' => 'always']], 'refreshTimestamp' => false];
<add> $this->Behavior = new TimestampBehavior($table, $settings);
<add> $ts = new \DateTime('2000-01-01');
<add> $this->Behavior->timestamp($ts);
<add>
<add> $entity = new Entity(['username' => 'timestamp test']);
<add> $return = $this->Behavior->touch($entity, 'Something.special');
<add> $this->assertTrue($return, 'touch is expected to return true if it sets a field value');
<add> $this->assertSame(
<add> $ts->format('Y-m-d H:i:s'),
<add> $entity->date_specialed->format('Y-m-d H:i:s'),
<add> 'Modified field is expected to be updated'
<add> );
<add> $this->assertNull($entity->created, 'Created field is NOT expected to change');
<add> }
<add>
<ide> /**
<ide> * Test that calling save, triggers an insert including the created and updated field values
<ide> * | 2 |
Javascript | Javascript | remove module argument from getdependencyreference | 923e16dd5ad86f0619bac26938436cac9b9d4957 | <ide><path>lib/Compilation.js
<ide> class Compilation {
<ide> }
<ide>
<ide> /**
<del> * @param {Module} module the module containing the dependency
<ide> * @param {Dependency} dependency the dependency
<ide> * @returns {DependencyReference} a reference for the dependency
<ide> */
<del> getDependencyReference(module, dependency) {
<add> getDependencyReference(dependency) {
<ide> const ref = dependency.getReference(this.moduleGraph);
<ide> if (!ref) return null;
<del> return this.hooks.dependencyReference.call(ref, dependency, module);
<add> return this.hooks.dependencyReference.call(ref, dependency);
<ide> }
<ide>
<ide> /**
<ide> class Compilation {
<ide> */
<ide> const iteratorDependency = d => {
<ide> // We skip Dependencies without Reference
<del> const ref = this.getDependencyReference(currentModule, d);
<add> const ref = this.getDependencyReference(d);
<ide> if (!ref) {
<ide> return;
<ide> }
<ide> class Compilation {
<ide> blockQueue.push(b);
<ide> };
<ide>
<del> /** @type {Module} */
<del> let currentModule;
<ide> /** @type {DependenciesBlock} */
<ide> let block;
<ide> /** @type {DependenciesBlock[]} */
<ide> class Compilation {
<ide>
<ide> for (const module of this.modules) {
<ide> blockQueue = [module];
<del> currentModule = module;
<ide> while (blockQueue.length > 0) {
<ide> block = blockQueue.pop();
<ide> blockInfoModules = new Set();
<ide><path>lib/FlagDependencyUsagePlugin.js
<ide> class FlagDependencyUsagePlugin {
<ide> * @returns {void}
<ide> */
<ide> const processDependency = (module, dep) => {
<del> const reference = compilation.getDependencyReference(module, dep);
<add> const reference = compilation.getDependencyReference(dep);
<ide> if (!reference) return;
<ide> const referenceModule = reference.module;
<ide> const importedNames = reference.importedNames;
<ide><path>lib/optimize/ConcatenatedModule.js
<ide> class ConcatenatedModule extends Module {
<ide> const getConcatenatedImports = module => {
<ide> const references = module.dependencies
<ide> .filter(dep => dep instanceof HarmonyImportDependency)
<del> .map(dep => compilation.getDependencyReference(module, dep))
<add> .map(dep => compilation.getDependencyReference(dep))
<ide> .filter(ref => ref !== null);
<ide> DependencyReference.sort(references);
<ide> return references.map(ref => {
<ide><path>lib/optimize/ModuleConcatenationPlugin.js
<ide> class ModuleConcatenationPlugin {
<ide> .map(dep => {
<ide> if (!(dep instanceof HarmonyImportDependency)) return null;
<ide> if (!compilation) return dep.getReference(moduleGraph);
<del> return compilation.getDependencyReference(module, dep);
<add> return compilation.getDependencyReference(dep);
<ide> })
<ide>
<ide> // Reference is valid and has a module
<ide><path>lib/wasm/WasmFinalizeExportsPlugin.js
<ide> class WasmFinalizeExportsPlugin {
<ide> false
<ide> ) {
<ide> const ref = compilation.getDependencyReference(
<del> connection.originModule,
<ide> connection.dependency
<ide> );
<ide> | 5 |
Javascript | Javascript | add preparse/postformat for ta | 5b720a191a3ff5cbc052660d65d38ca2ab756a64 | <ide><path>src/locale/ta.js
<ide>
<ide> import moment from '../moment';
<ide>
<add>var symbolMap = {
<add> '1': '௧',
<add> '2': '௨',
<add> '3': '௩',
<add> '4': '௪',
<add> '5': '௫',
<add> '6': '௬',
<add> '7': '௭',
<add> '8': '௮',
<add> '9': '௯',
<add> '0': '௦'
<add>}, numberMap = {
<add> '௧': '1',
<add> '௨': '2',
<add> '௩': '3',
<add> '௪': '4',
<add> '௫': '5',
<add> '௬': '6',
<add> '௭': '7',
<add> '௮': '8',
<add> '௯': '9',
<add> '௦': '0'
<add>};
<add>
<ide> export default moment.defineLocale('ta', {
<ide> months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'),
<ide> monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'),
<ide> export default moment.defineLocale('ta', {
<ide> ordinal : function (number) {
<ide> return number + 'வது';
<ide> },
<add> preparse: function (string) {
<add> return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) {
<add> return numberMap[match];
<add> });
<add> },
<add> postformat: function (string) {
<add> return string.replace(/\d/g, function (match) {
<add> return symbolMap[match];
<add> });
<add> },
<ide> // refer http://ta.wikipedia.org/s/1er1
<ide> meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,
<ide> meridiem : function (hour, minute, isLower) {
<ide><path>src/test/locale/ta.js
<ide> test('parse', function (assert) {
<ide>
<ide> test('format', function (assert) {
<ide> var a = [
<del> ['dddd, MMMM Do YYYY, h:mm:ss a', 'ஞாயிற்றுக்கிழமை, பிப்ரவரி 14வது 2010, 3:25:50 எற்பாடு'],
<del> ['ddd, hA', 'ஞாயிறு, 3 எற்பாடு'],
<del> ['M Mo MM MMMM MMM', '2 2வது 02 பிப்ரவரி பிப்ரவரி'],
<del> ['YYYY YY', '2010 10'],
<del> ['D Do DD', '14 14வது 14'],
<del> ['d do dddd ddd dd', '0 0வது ஞாயிற்றுக்கிழமை ஞாயிறு ஞா'],
<del> ['DDD DDDo DDDD', '45 45வது 045'],
<del> ['w wo ww', '8 8வது 08'],
<del> ['h hh', '3 03'],
<del> ['H HH', '15 15'],
<del> ['m mm', '25 25'],
<del> ['s ss', '50 50'],
<add> ['dddd, MMMM Do YYYY, h:mm:ss a', 'ஞாயிற்றுக்கிழமை, பிப்ரவரி ௧௪வது ௨௦௧௦, ௩:௨௫:௫௦ எற்பாடு'],
<add> ['ddd, hA', 'ஞாயிறு, ௩ எற்பாடு'],
<add> ['M Mo MM MMMM MMM', '௨ ௨வது ௦௨ பிப்ரவரி பிப்ரவரி'],
<add> ['YYYY YY', '௨௦௧௦ ௧௦'],
<add> ['D Do DD', '௧௪ ௧௪வது ௧௪'],
<add> ['d do dddd ddd dd', '௦ ௦வது ஞாயிற்றுக்கிழமை ஞாயிறு ஞா'],
<add> ['DDD DDDo DDDD', '௪௫ ௪௫வது ௦௪௫'],
<add> ['w wo ww', '௮ ௮வது ௦௮'],
<add> ['h hh', '௩ ௦௩'],
<add> ['H HH', '௧௫ ௧௫'],
<add> ['m mm', '௨௫ ௨௫'],
<add> ['s ss', '௫௦ ௫௦'],
<ide> ['a A', ' எற்பாடு எற்பாடு'],
<del> ['[ஆண்டின்] DDDo [நாள்]', 'ஆண்டின் 45வது நாள்'],
<del> ['LTS', '15:25:50'],
<del> ['L', '14/02/2010'],
<del> ['LL', '14 பிப்ரவரி 2010'],
<del> ['LLL', '14 பிப்ரவரி 2010, 15:25'],
<del> ['LLLL', 'ஞாயிற்றுக்கிழமை, 14 பிப்ரவரி 2010, 15:25'],
<del> ['l', '14/2/2010'],
<del> ['ll', '14 பிப்ரவரி 2010'],
<del> ['lll', '14 பிப்ரவரி 2010, 15:25'],
<del> ['llll', 'ஞாயிறு, 14 பிப்ரவரி 2010, 15:25']
<add> ['[ஆண்டின்] DDDo [நாள்]', 'ஆண்டின் ௪௫வது நாள்'],
<add> ['LTS', '௧௫:௨௫:௫௦'],
<add> ['L', '௧௪/௦௨/௨௦௧௦'],
<add> ['LL', '௧௪ பிப்ரவரி ௨௦௧௦'],
<add> ['LLL', '௧௪ பிப்ரவரி ௨௦௧௦, ௧௫:௨௫'],
<add> ['LLLL', 'ஞாயிற்றுக்கிழமை, ௧௪ பிப்ரவரி ௨௦௧௦, ௧௫:௨௫'],
<add> ['l', '௧௪/௨/௨௦௧௦'],
<add> ['ll', '௧௪ பிப்ரவரி ௨௦௧௦'],
<add> ['lll', '௧௪ பிப்ரவரி ௨௦௧௦, ௧௫:௨௫'],
<add> ['llll', 'ஞாயிறு, ௧௪ பிப்ரவரி ௨௦௧௦, ௧௫:௨௫']
<ide> ],
<ide> b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
<ide> i;
<ide> test('format', function (assert) {
<ide> });
<ide>
<ide> test('format ordinal', function (assert) {
<del> assert.equal(moment([2011, 0, 1]).format('DDDo'), '1வது', '1வது');
<del> assert.equal(moment([2011, 0, 2]).format('DDDo'), '2வது', '2வது');
<del> assert.equal(moment([2011, 0, 3]).format('DDDo'), '3வது', '3வது');
<del> assert.equal(moment([2011, 0, 4]).format('DDDo'), '4வது', '4வது');
<del> assert.equal(moment([2011, 0, 5]).format('DDDo'), '5வது', '5வது');
<del> assert.equal(moment([2011, 0, 6]).format('DDDo'), '6வது', '6வது');
<del> assert.equal(moment([2011, 0, 7]).format('DDDo'), '7வது', '7வது');
<del> assert.equal(moment([2011, 0, 8]).format('DDDo'), '8வது', '8வது');
<del> assert.equal(moment([2011, 0, 9]).format('DDDo'), '9வது', '9வது');
<del> assert.equal(moment([2011, 0, 10]).format('DDDo'), '10வது', '10வது');
<del>
<del> assert.equal(moment([2011, 0, 11]).format('DDDo'), '11வது', '11வது');
<del> assert.equal(moment([2011, 0, 12]).format('DDDo'), '12வது', '12வது');
<del> assert.equal(moment([2011, 0, 13]).format('DDDo'), '13வது', '13வது');
<del> assert.equal(moment([2011, 0, 14]).format('DDDo'), '14வது', '14வது');
<del> assert.equal(moment([2011, 0, 15]).format('DDDo'), '15வது', '15வது');
<del> assert.equal(moment([2011, 0, 16]).format('DDDo'), '16வது', '16வது');
<del> assert.equal(moment([2011, 0, 17]).format('DDDo'), '17வது', '17வது');
<del> assert.equal(moment([2011, 0, 18]).format('DDDo'), '18வது', '18வது');
<del> assert.equal(moment([2011, 0, 19]).format('DDDo'), '19வது', '19வது');
<del> assert.equal(moment([2011, 0, 20]).format('DDDo'), '20வது', '20வது');
<del>
<del> assert.equal(moment([2011, 0, 21]).format('DDDo'), '21வது', '21வது');
<del> assert.equal(moment([2011, 0, 22]).format('DDDo'), '22வது', '22வது');
<del> assert.equal(moment([2011, 0, 23]).format('DDDo'), '23வது', '23வது');
<del> assert.equal(moment([2011, 0, 24]).format('DDDo'), '24வது', '24வது');
<del> assert.equal(moment([2011, 0, 25]).format('DDDo'), '25வது', '25வது');
<del> assert.equal(moment([2011, 0, 26]).format('DDDo'), '26வது', '26வது');
<del> assert.equal(moment([2011, 0, 27]).format('DDDo'), '27வது', '27வது');
<del> assert.equal(moment([2011, 0, 28]).format('DDDo'), '28வது', '28வது');
<del> assert.equal(moment([2011, 0, 29]).format('DDDo'), '29வது', '29வது');
<del> assert.equal(moment([2011, 0, 30]).format('DDDo'), '30வது', '30வது');
<del>
<del> assert.equal(moment([2011, 0, 31]).format('DDDo'), '31வது', '31வது');
<add> assert.equal(moment([2011, 0, 1]).format('DDDo'), '௧வது', '௧வது');
<add> assert.equal(moment([2011, 0, 2]).format('DDDo'), '௨வது', '௨வது');
<add> assert.equal(moment([2011, 0, 3]).format('DDDo'), '௩வது', '௩வது');
<add> assert.equal(moment([2011, 0, 4]).format('DDDo'), '௪வது', '௪வது');
<add> assert.equal(moment([2011, 0, 5]).format('DDDo'), '௫வது', '௫வது');
<add> assert.equal(moment([2011, 0, 6]).format('DDDo'), '௬வது', '௬வது');
<add> assert.equal(moment([2011, 0, 7]).format('DDDo'), '௭வது', '௭வது');
<add> assert.equal(moment([2011, 0, 8]).format('DDDo'), '௮வது', '௮வது');
<add> assert.equal(moment([2011, 0, 9]).format('DDDo'), '௯வது', '௯வது');
<add> assert.equal(moment([2011, 0, 10]).format('DDDo'), '௧௦வது', '௧௦வது');
<add>
<add> assert.equal(moment([2011, 0, 11]).format('DDDo'), '௧௧வது', '௧௧வது');
<add> assert.equal(moment([2011, 0, 12]).format('DDDo'), '௧௨வது', '௧௨வது');
<add> assert.equal(moment([2011, 0, 13]).format('DDDo'), '௧௩வது', '௧௩வது');
<add> assert.equal(moment([2011, 0, 14]).format('DDDo'), '௧௪வது', '௧௪வது');
<add> assert.equal(moment([2011, 0, 15]).format('DDDo'), '௧௫வது', '௧௫வது');
<add> assert.equal(moment([2011, 0, 16]).format('DDDo'), '௧௬வது', '௧௬வது');
<add> assert.equal(moment([2011, 0, 17]).format('DDDo'), '௧௭வது', '௧௭வது');
<add> assert.equal(moment([2011, 0, 18]).format('DDDo'), '௧௮வது', '௧௮வது');
<add> assert.equal(moment([2011, 0, 19]).format('DDDo'), '௧௯வது', '௧௯வது');
<add> assert.equal(moment([2011, 0, 20]).format('DDDo'), '௨௦வது', '௨௦வது');
<add>
<add> assert.equal(moment([2011, 0, 21]).format('DDDo'), '௨௧வது', '௨௧வது');
<add> assert.equal(moment([2011, 0, 22]).format('DDDo'), '௨௨வது', '௨௨வது');
<add> assert.equal(moment([2011, 0, 23]).format('DDDo'), '௨௩வது', '௨௩வது');
<add> assert.equal(moment([2011, 0, 24]).format('DDDo'), '௨௪வது', '௨௪வது');
<add> assert.equal(moment([2011, 0, 25]).format('DDDo'), '௨௫வது', '௨௫வது');
<add> assert.equal(moment([2011, 0, 26]).format('DDDo'), '௨௬வது', '௨௬வது');
<add> assert.equal(moment([2011, 0, 27]).format('DDDo'), '௨௭வது', '௨௭வது');
<add> assert.equal(moment([2011, 0, 28]).format('DDDo'), '௨௮வது', '௨௮வது');
<add> assert.equal(moment([2011, 0, 29]).format('DDDo'), '௨௯வது', '௨௯வது');
<add> assert.equal(moment([2011, 0, 30]).format('DDDo'), '௩௦வது', '௩௦வது');
<add>
<add> assert.equal(moment([2011, 0, 31]).format('DDDo'), '௩௧வது', '௩௧வது');
<ide> });
<ide>
<ide> test('format month', function (assert) {
<ide> test('from', function (assert) {
<ide> assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ஒரு சில விநாடிகள்', '44 விநாடிகள் = ஒரு சில விநாடிகள்');
<ide> assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ஒரு நிமிடம்', '45 விநாடிகள் = ஒரு நிமிடம்');
<ide> assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ஒரு நிமிடம்', '89 விநாடிகள் = ஒரு நிமிடம்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 நிமிடங்கள்', '90 விநாடிகள் = 2 நிமிடங்கள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 நிமிடங்கள்', '44 நிமிடங்கள் = 44 நிமிடங்கள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '௨ நிமிடங்கள்', '90 விநாடிகள் = ௨ நிமிடங்கள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '௪௪ நிமிடங்கள்', '44 நிமிடங்கள் = 44 நிமிடங்கள்');
<ide> assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ஒரு மணி நேரம்', '45 நிமிடங்கள் = ஒரு மணி நேரம்');
<ide> assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ஒரு மணி நேரம்', '89 நிமிடங்கள் = ஒரு மணி நேரம்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 மணி நேரம்', '90 நிமிடங்கள் = 2 மணி நேரம்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 மணி நேரம்', '5 மணி நேரம் = 5 மணி நேரம்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 மணி நேரம்', '21 மணி நேரம் = 21 மணி நேரம்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ஒரு நாள்', '22 மணி நேரம் = ஒரு நாள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ஒரு நாள்', '35 மணி நேரம் = ஒரு நாள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 நாட்கள்', '36 மணி நேரம் = 2 days');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ஒரு நாள்', '1 நாள் = ஒரு நாள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 நாட்கள்', '5 நாட்கள் = 5 நாட்கள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 நாட்கள்', '25 நாட்கள் = 25 நாட்கள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ஒரு மாதம்', '26 நாட்கள் = ஒரு மாதம்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ஒரு மாதம்', '30 நாட்கள் = ஒரு மாதம்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '௨ மணி நேரம்', '90 நிமிடங்கள் = ௨ மணி நேரம்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '௫ மணி நேரம்', '5 மணி நேரம் = 5 மணி நேரம்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '௨௧ மணி நேரம்', '௨௧ மணி நேரம் = ௨௧ மணி நேரம்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ஒரு நாள்', '௨௨ மணி நேரம் = ஒரு நாள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ஒரு நாள்', '௩5 மணி நேரம் = ஒரு நாள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '௨ நாட்கள்', '௩6 மணி நேரம் = ௨ days');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ஒரு நாள்', '௧ நாள் = ஒரு நாள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '௫ நாட்கள்', '5 நாட்கள் = 5 நாட்கள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '௨௫ நாட்கள்', '௨5 நாட்கள் = ௨5 நாட்கள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ஒரு மாதம்', '௨6 நாட்கள் = ஒரு மாதம்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ஒரு மாதம்', '௩0 நாட்கள் = ஒரு மாதம்');
<ide> assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ஒரு மாதம்', '45 நாட்கள் = ஒரு மாதம்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 மாதங்கள்', '46 நாட்கள் = 2 மாதங்கள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 மாதங்கள்', '75 நாட்கள் = 2 மாதங்கள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 மாதங்கள்', '76 நாட்கள் = 3 மாதங்கள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ஒரு மாதம்', '1 மாதம் = ஒரு மாதம்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 மாதங்கள்', '5 மாதங்கள் = 5 மாதங்கள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ஒரு வருடம்', '345 நாட்கள் = ஒரு வருடம்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ஆண்டுகள்', '548 நாட்கள் = 2 ஆண்டுகள்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ஒரு வருடம்', '1 வருடம் = ஒரு வருடம்');
<del> assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ஆண்டுகள்', '5 ஆண்டுகள் = 5 ஆண்டுகள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '௨ மாதங்கள்', '46 நாட்கள் = ௨ மாதங்கள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '௨ மாதங்கள்', '75 நாட்கள் = ௨ மாதங்கள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '௩ மாதங்கள்', '76 நாட்கள் = ௩ மாதங்கள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ஒரு மாதம்', '௧ மாதம் = ஒரு மாதம்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '௫ மாதங்கள்', '5 மாதங்கள் = 5 மாதங்கள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ஒரு வருடம்', '௩45 நாட்கள் = ஒரு வருடம்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '௨ ஆண்டுகள்', '548 நாட்கள் = ௨ ஆண்டுகள்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ஒரு வருடம்', '௧ வருடம் = ஒரு வருடம்');
<add> assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '௫ ஆண்டுகள்', '5 ஆண்டுகள் = 5 ஆண்டுகள்');
<ide> });
<ide>
<ide> test('suffix', function (assert) {
<ide> test('now from now', function (assert) {
<ide>
<ide> test('fromNow', function (assert) {
<ide> assert.equal(moment().add({s: 30}).fromNow(), 'ஒரு சில விநாடிகள் இல்', 'ஒரு சில விநாடிகள் இல்');
<del> assert.equal(moment().add({d: 5}).fromNow(), '5 நாட்கள் இல்', '5 நாட்கள் இல்');
<add> assert.equal(moment().add({d: 5}).fromNow(), '௫ நாட்கள் இல்', '5 நாட்கள் இல்');
<ide> });
<ide>
<ide> test('calendar day', function (assert) {
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<del> assert.equal(moment(a).calendar(), 'இன்று 02:00', 'இன்று 02:00');
<del> assert.equal(moment(a).add({m: 25}).calendar(), 'இன்று 02:25', 'இன்று 02:25');
<del> assert.equal(moment(a).add({h: 1}).calendar(), 'இன்று 03:00', 'இன்று 03:00');
<del> assert.equal(moment(a).add({d: 1}).calendar(), 'நாளை 02:00', 'நாளை 02:00');
<del> assert.equal(moment(a).subtract({h: 1}).calendar(), 'இன்று 01:00', 'இன்று 01:00');
<del> assert.equal(moment(a).subtract({d: 1}).calendar(), 'நேற்று 02:00', 'நேற்று 02:00');
<add> assert.equal(moment(a).calendar(), 'இன்று ௦௨:௦௦', 'இன்று 02:00');
<add> assert.equal(moment(a).add({m: 25}).calendar(), 'இன்று ௦௨:௨௫', 'இன்று 02:25');
<add> assert.equal(moment(a).add({h: 1}).calendar(), 'இன்று ௦௩:௦௦', 'இன்று 03:00');
<add> assert.equal(moment(a).add({d: 1}).calendar(), 'நாளை ௦௨:௦௦', 'நாளை 02:00');
<add> assert.equal(moment(a).subtract({h: 1}).calendar(), 'இன்று ௦௧:௦௦', 'இன்று 0௧:00');
<add> assert.equal(moment(a).subtract({d: 1}).calendar(), 'நேற்று ௦௨:௦௦', 'நேற்று 02:00');
<ide> });
<ide>
<ide> test('calendar next week', function (assert) { | 2 |
Ruby | Ruby | remove reference to homebrew/x11 | 06ecad2950b8890eb9175081e9f9231cd0542470 | <ide><path>Library/Homebrew/formula.rb
<ide> def go_resource(name, &block)
<ide> # depends_on :arch => :x86_64 # If this formula only builds on Intel x86 64-bit.
<ide> # depends_on :arch => :ppc # Only builds on PowerPC?
<ide> # depends_on :ld64 # Sometimes ld fails on `MacOS.version < :leopard`. Then use this.
<del> # depends_on :x11 # X11/XQuartz components. Non-optional X11 deps should go in Homebrew/Homebrew-x11
<add> # depends_on :x11 # X11/XQuartz components.
<ide> # depends_on :osxfuse # Permits the use of the upstream signed binary or our source package.
<ide> # depends_on :tuntap # Does the same thing as above. This is vital for Yosemite and above.
<ide> # depends_on :mysql => :recommended</pre> | 1 |
Javascript | Javascript | simplify the code | accd0b3b2067ac05cd2557252ba4394fd04c7939 | <ide><path>src/loaders/FileLoader.js
<ide> Object.assign( FileLoader.prototype, {
<ide>
<ide> if ( request.overrideMimeType ) request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' );
<ide>
<del> if ( this.requestHeader !== undefined ) {
<add> for ( var header in this.requestHeader ) {
<ide>
<del> var keys = Object.keys( this.requestHeader );
<del>
<del> for ( var i = 0, il = keys.length; i < il; i ++ ) {
<del>
<del> var header = keys[ i ];
<del> var value = this.requestHeader[ header ];
<del>
<del> request.setRequestHeader( header, value );
<del>
<del> }
<add> request.setRequestHeader( header, this.requestHeader[ header ] );
<ide>
<ide> }
<ide> | 1 |
Ruby | Ruby | catch another name error | b40615d66ac8572c6735f3bb9d6cd3e781edf740 | <ide><path>Library/Homebrew/formulary.rb
<ide> def get_formula; end
<ide> # Return the Class for this formula, `require`-ing it if
<ide> # it has not been parsed before.
<ide> def klass
<del> unless Formulary.formula_class_defined? name
<add> begin
<add> have_klass = Formulary.formula_class_defined? name
<add> rescue NameError
<add> raise FormulaUnavailableError.new(name)
<add> end
<add>
<add> unless have_klass
<ide> puts "#{$0}: loading #{path}" if ARGV.debug?
<ide> begin
<ide> require path.to_s
<ide> def klass
<ide> raise FormulaUnavailableError.new(name)
<ide> end
<ide> end
<add>
<ide> klass = Formulary.get_formula_class(name)
<ide> if (klass == Formula) || !klass.ancestors.include?(Formula)
<ide> raise FormulaUnavailableError.new(name) | 1 |
Python | Python | fix some error messages | edf68c5bcc0df076af25f65c561350d98c05402f | <ide><path>numpy/_array_api/_array_object.py
<ide> def __float__(self: array, /) -> float:
<ide> """
<ide> # Note: This is an error here.
<ide> if self._array.shape != ():
<del> raise TypeError("bool is only allowed on arrays with shape ()")
<add> raise TypeError("float is only allowed on arrays with shape ()")
<ide> res = self._array.__float__()
<ide> return res
<ide>
<ide> def __int__(self: array, /) -> int:
<ide> """
<ide> # Note: This is an error here.
<ide> if self._array.shape != ():
<del> raise TypeError("bool is only allowed on arrays with shape ()")
<add> raise TypeError("int is only allowed on arrays with shape ()")
<ide> res = self._array.__int__()
<ide> return res
<ide> | 1 |
Javascript | Javascript | improve future tense " | 545026426aaaecff52c2c640a795794e3c5c6146 | <ide><path>src/locale/sk.js
<ide> export default moment.defineLocale('sk', {
<ide> sameElse: 'L'
<ide> },
<ide> relativeTime : {
<del> future : 'o %s',
<add> future : 'za %s',
<ide> past : 'pred %s',
<ide> s : translate,
<ide> ss : translate,
<ide><path>src/test/locale/sk.js
<ide> test('from', function (assert) {
<ide> });
<ide>
<ide> test('suffix', function (assert) {
<del> assert.equal(moment(30000).from(0), 'o pár sekúnd', 'prefix');
<add> assert.equal(moment(30000).from(0), 'za pár sekúnd', 'prefix');
<ide> assert.equal(moment(0).from(30000), 'pred pár sekundami', 'suffix');
<ide> });
<ide>
<ide> test('now from now', function (assert) {
<ide> });
<ide>
<ide> test('fromNow (future)', function (assert) {
<del> assert.equal(moment().add({s: 30}).fromNow(), 'o pár sekúnd', 'in a few seconds');
<del> assert.equal(moment().add({m: 1}).fromNow(), 'o minútu', 'in a minute');
<del> assert.equal(moment().add({m: 3}).fromNow(), 'o 3 minúty', 'in 3 minutes');
<del> assert.equal(moment().add({m: 10}).fromNow(), 'o 10 minút', 'in 10 minutes');
<del> assert.equal(moment().add({h: 1}).fromNow(), 'o hodinu', 'in an hour');
<del> assert.equal(moment().add({h: 3}).fromNow(), 'o 3 hodiny', 'in 3 hours');
<del> assert.equal(moment().add({h: 10}).fromNow(), 'o 10 hodín', 'in 10 hours');
<del> assert.equal(moment().add({d: 1}).fromNow(), 'o deň', 'in a day');
<del> assert.equal(moment().add({d: 3}).fromNow(), 'o 3 dni', 'in 3 days');
<del> assert.equal(moment().add({d: 10}).fromNow(), 'o 10 dní', 'in 10 days');
<del> assert.equal(moment().add({M: 1}).fromNow(), 'o mesiac', 'in a month');
<del> assert.equal(moment().add({M: 3}).fromNow(), 'o 3 mesiace', 'in 3 months');
<del> assert.equal(moment().add({M: 10}).fromNow(), 'o 10 mesiacov', 'in 10 months');
<del> assert.equal(moment().add({y: 1}).fromNow(), 'o rok', 'in a year');
<del> assert.equal(moment().add({y: 3}).fromNow(), 'o 3 roky', 'in 3 years');
<del> assert.equal(moment().add({y: 10}).fromNow(), 'o 10 rokov', 'in 10 years');
<add> assert.equal(moment().add({s: 30}).fromNow(), 'za pár sekúnd', 'in a few seconds');
<add> assert.equal(moment().add({m: 1}).fromNow(), 'za minútu', 'in a minute');
<add> assert.equal(moment().add({m: 3}).fromNow(), 'za 3 minúty', 'in 3 minutes');
<add> assert.equal(moment().add({m: 10}).fromNow(), 'za 10 minút', 'in 10 minutes');
<add> assert.equal(moment().add({h: 1}).fromNow(), 'za hodinu', 'in an hour');
<add> assert.equal(moment().add({h: 3}).fromNow(), 'za 3 hodiny', 'in 3 hours');
<add> assert.equal(moment().add({h: 10}).fromNow(), 'za 10 hodín', 'in 10 hours');
<add> assert.equal(moment().add({d: 1}).fromNow(), 'za deň', 'in a day');
<add> assert.equal(moment().add({d: 3}).fromNow(), 'za 3 dni', 'in 3 days');
<add> assert.equal(moment().add({d: 10}).fromNow(), 'za 10 dní', 'in 10 days');
<add> assert.equal(moment().add({M: 1}).fromNow(), 'za mesiac', 'in a month');
<add> assert.equal(moment().add({M: 3}).fromNow(), 'za 3 mesiace', 'in 3 months');
<add> assert.equal(moment().add({M: 10}).fromNow(), 'za 10 mesiacov', 'in 10 months');
<add> assert.equal(moment().add({y: 1}).fromNow(), 'za rok', 'in a year');
<add> assert.equal(moment().add({y: 3}).fromNow(), 'za 3 roky', 'in 3 years');
<add> assert.equal(moment().add({y: 10}).fromNow(), 'za 10 rokov', 'in 10 years');
<ide> });
<ide>
<ide> test('fromNow (past)', function (assert) {
<ide> test('calendar all else', function (assert) {
<ide>
<ide> test('humanize duration', function (assert) {
<ide> assert.equal(moment.duration(1, 'minutes').humanize(), 'minúta', 'a minute (future)');
<del> assert.equal(moment.duration(1, 'minutes').humanize(true), 'o minútu', 'in a minute');
<add> assert.equal(moment.duration(1, 'minutes').humanize(true), 'za minútu', 'in a minute');
<ide> assert.equal(moment.duration(-1, 'minutes').humanize(), 'minúta', 'a minute (past)');
<ide> assert.equal(moment.duration(-1, 'minutes').humanize(true), 'pred minútou', 'a minute ago');
<ide> }); | 2 |
Ruby | Ruby | add note about observer config for rails apps | bd7d8665a083f534f9d1aaa544d912f933b4fd61 | <ide><path>activemodel/lib/active_model/observing.rb
<ide> def notify_observers(method)
<ide> # The AuditObserver will now act on both updates to Account and Balance by treating
<ide> # them both as records.
<ide> #
<add> # If you're using an Observer in a Rails application with Active Record, be sure to
<add> # read about the necessary configuration in the documentation for
<add> # ActiveRecord::Observer.
<add> #
<ide> class Observer
<ide> include Singleton
<ide> | 1 |
Text | Text | add v3.28.0-beta.4 to changelog | b6948fbe9dc2d1cc148b7d859bb43cc024f43312 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.28.0-beta.4 (June 7, 2021)
<add>
<add>- [#19586](https://github.com/emberjs/ember.js/pull/19586) [BUGFIX] Fix Embroider compatibility
<add>
<ide> ### v3.28.0-beta.3 (June 1, 2021)
<ide>
<ide> - [#19565](https://github.com/emberjs/ember.js/pull/19565) [BUGFIX] Ensures that computed can depend on dynamic hash keys | 1 |
Ruby | Ruby | make the type_map per connection. fixes | c9223dc366f17b61d0cffeff14a7e670ece9d0d4 | <ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
<ide> def indexes(table_name, name = nil)
<ide> def columns(table_name)
<ide> # Limit, precision, and scale are all handled by the superclass.
<ide> column_definitions(table_name).map do |column_name, type, default, notnull, oid, fmod|
<del> oid = OID::TYPE_MAP.fetch(oid.to_i, fmod.to_i) {
<add> oid = type_map.fetch(oid.to_i, fmod.to_i) {
<ide> OID::Identity.new
<ide> }
<ide> PostgreSQLColumn.new(column_name, default, oid, type, notnull == 'f')
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
<ide> def initialize(connection, logger, connection_parameters, config)
<ide> raise "Your version of PostgreSQL (#{postgresql_version}) is too old, please upgrade!"
<ide> end
<ide>
<del> initialize_type_map
<add> @type_map = OID::TypeMap.new
<add> initialize_type_map(type_map)
<ide> @local_tz = execute('SHOW TIME ZONE', 'SCHEMA').first["TimeZone"]
<ide> @use_insert_returning = @config.key?(:insert_returning) ? self.class.type_cast_config_to_boolean(@config[:insert_returning]) : true
<ide> end
<ide> def translate_exception(exception, message)
<ide>
<ide> private
<ide>
<add> def type_map
<add> @type_map
<add> end
<add>
<ide> def reload_type_map
<del> OID::TYPE_MAP.clear
<del> initialize_type_map
<add> type_map.clear
<add> initialize_type_map(type_map)
<ide> end
<ide>
<del> def initialize_type_map
<add> def initialize_type_map(type_map)
<ide> result = execute('SELECT oid, typname, typelem, typdelim, typinput FROM pg_type', 'SCHEMA')
<ide> leaves, nodes = result.partition { |row| row['typelem'] == '0' }
<ide>
<ide> # populate the leaf nodes
<ide> leaves.find_all { |row| OID.registered_type? row['typname'] }.each do |row|
<del> OID::TYPE_MAP[row['oid'].to_i] = OID::NAMES[row['typname']]
<add> type_map[row['oid'].to_i] = OID::NAMES[row['typname']]
<ide> end
<ide>
<ide> arrays, nodes = nodes.partition { |row| row['typinput'] == 'array_in' }
<ide>
<ide> # populate composite types
<del> nodes.find_all { |row| OID::TYPE_MAP.key? row['typelem'].to_i }.each do |row|
<add> nodes.find_all { |row| type_map.key? row['typelem'].to_i }.each do |row|
<ide> if OID.registered_type? row['typname']
<ide> # this composite type is explicitly registered
<ide> vector = OID::NAMES[row['typname']]
<ide> else
<ide> # use the default for composite types
<del> vector = OID::Vector.new row['typdelim'], OID::TYPE_MAP[row['typelem'].to_i]
<add> vector = OID::Vector.new row['typdelim'], type_map[row['typelem'].to_i]
<ide> end
<ide>
<del> OID::TYPE_MAP[row['oid'].to_i] = vector
<add> type_map[row['oid'].to_i] = vector
<ide> end
<ide>
<ide> # populate array types
<del> arrays.find_all { |row| OID::TYPE_MAP.key? row['typelem'].to_i }.each do |row|
<del> array = OID::Array.new OID::TYPE_MAP[row['typelem'].to_i]
<del> OID::TYPE_MAP[row['oid'].to_i] = array
<add> arrays.find_all { |row| type_map.key? row['typelem'].to_i }.each do |row|
<add> array = OID::Array.new type_map[row['typelem'].to_i]
<add> type_map[row['oid'].to_i] = array
<ide> end
<ide> end
<ide> | 2 |
Javascript | Javascript | fix jslint issues | 48650639248e73f78b2bd4ba2d3d1590749753ce | <ide><path>test/internet/test-dns.js
<ide> TEST(function test_lookup_localhost_ipv4(done) {
<ide>
<ide> var getaddrinfoCallbackCalled = false;
<ide>
<del>console.log("looking up nodejs.org...");
<add>console.log('looking up nodejs.org...');
<ide> var req = process.binding('cares_wrap').getaddrinfo('nodejs.org');
<ide>
<ide> req.oncomplete = function(domains) {
<del> console.log("nodejs.org = ", domains);
<add> console.log('nodejs.org = ', domains);
<ide> assert.ok(Array.isArray(domains));
<ide> assert.ok(domains.length >= 1);
<ide> assert.ok(typeof domains[0] == 'string');
<ide><path>test/message/throw_custom_error.js
<ide> var assert = require('assert');
<ide> common.error('before');
<ide>
<ide> // custom error throwing
<del>throw { name: 'MyCustomError', message: 'This is a custom message' }
<add>throw { name: 'MyCustomError', message: 'This is a custom message' };
<ide>
<ide> common.error('after');
<ide><path>test/message/throw_non_error.js
<ide> var assert = require('assert');
<ide> common.error('before');
<ide>
<ide> // custom error throwing
<del>throw { foo: 'bar' }
<add>throw { foo: 'bar' };
<ide>
<ide> common.error('after');
<ide><path>test/pummel/test-net-timeout2.js
<ide> var counter = 0;
<ide> var server = net.createServer(function(socket) {
<ide> socket.setTimeout((seconds / 2) * 1000, function() {
<ide> gotTimeout = true;
<del> console.log('timeout!!');
<del> socket.destroy();
<add> console.log('timeout!!');
<add> socket.destroy();
<ide> process.exit(1);
<del> });
<add> });
<ide>
<del> var interval = setInterval(function() {
<add> var interval = setInterval(function() {
<ide> counter++;
<ide>
<ide> if (counter == seconds) {
<ide> var server = net.createServer(function(socket) {
<ide> socket.destroy();
<ide> }
<ide>
<del> if (socket.writable) {
<del> socket.write(Date.now()+'\n');
<del> }
<add> if (socket.writable) {
<add> socket.write(Date.now() + '\n');
<add> }
<ide> }, 1000);
<ide> });
<ide>
<ide><path>test/simple/test-assert.js
<ide> threw = false;
<ide> try {
<ide> assert.throws(
<ide> function() {
<del> throw {}
<add> throw {};
<ide> },
<ide> Array
<ide> );
<ide><path>test/simple/test-child-process-fork2.js
<ide> server.listen(common.PORT, function() {
<ide> function makeConnections() {
<ide> for (var i = 0; i < N; i++) {
<ide> var socket = net.connect(common.PORT, function() {
<del> console.log("CLIENT connected");
<add> console.log('CLIENT connected');
<ide> });
<ide>
<del> socket.on("close", function() {
<add> socket.on('close', function() {
<ide> socketCloses++;
<del> console.log("CLIENT closed " + socketCloses);
<add> console.log('CLIENT closed ' + socketCloses);
<ide> if (socketCloses == N) {
<ide> n.kill();
<ide> server.close();
<ide><path>test/simple/test-cluster-kill-workers.js
<ide> var fork = require('child_process').fork;
<ide> var isTestRunner = process.argv[2] != 'child';
<ide>
<ide> if (isTestRunner) {
<del> console.log("starting master...");
<del> var master = fork(__filename, [ 'child' ]);
<add> console.log('starting master...');
<add> var master = fork(__filename, ['child']);
<ide>
<del> console.log("master pid =", master.pid);
<add> console.log('master pid =', master.pid);
<ide>
<ide> var workerPID;
<ide>
<del> master.on("message", function(m) {
<del> console.log("got message from master:", m);
<add> master.on('message', function(m) {
<add> console.log('got message from master:', m);
<ide> if (m.workerPID) {
<del> console.log("worker pid =", m.workerPID);
<add> console.log('worker pid =', m.workerPID);
<ide> workerPID = m.workerPID;
<ide> }
<ide> });
<ide> if (isTestRunner) {
<ide> assert(workerPID > 0);
<ide> try {
<ide> process.kill(workerPID, 0);
<del> } catch(e) {
<add> } catch (e) {
<ide> // workerPID is no longer running
<del> console.log(e)
<add> console.log(e);
<ide> assert(e.code == 'ESRCH');
<ide> gotKillException = true;
<ide> }
<del> })
<add> });
<ide>
<ide> process.on('exit', function() {
<ide> assert(gotExit);
<ide><path>test/simple/test-crypto-ecb.js
<ide> try {
<ide> // Testing whether EVP_CipherInit_ex is functioning correctly.
<ide> // Reference: bug#1997
<ide>
<del>(function()
<del>{
<add>(function() {
<ide> var encrypt = crypto.createCipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR', '');
<ide> var hex = encrypt.update('Hello World!', 'ascii', 'hex');
<ide> hex += encrypt.final('hex');
<ide> assert.equal(hex.toUpperCase(), '6D385F424AAB0CFBF0BB86E07FFB7D71');
<ide> }());
<ide>
<del>(function()
<del>{
<del> var decrypt = crypto.createDecipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR', '');
<add>(function() {
<add> var decrypt = crypto.createDecipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR',
<add> '');
<ide> var msg = decrypt.update('6D385F424AAB0CFBF0BB86E07FFB7D71', 'hex', 'ascii');
<ide> msg += decrypt.final('ascii');
<ide> assert.equal(msg, 'Hello World!');
<ide><path>test/simple/test-dgram-send-error.js
<ide> function doSend() {
<ide> }
<ide>
<ide> process.on('exit', function() {
<del> console.log(packetsSent + ' UDP packets sent, ' +
<add> console.log(packetsSent + ' UDP packets sent, ' +
<ide> packetsReceived + ' received');
<del>
<add>
<ide> assert.strictEqual(packetsSent, ITERATIONS * 2);
<ide> assert.strictEqual(packetsReceived, ITERATIONS);
<ide> });
<ide><path>test/simple/test-eval.js
<ide> var exec = require('child_process').exec;
<ide> var success_count = 0;
<ide> var error_count = 0;
<ide>
<del>var cmd = [process.execPath, '-e', '"console.error(process.argv)"', 'foo', 'bar']
<del> .join(' ');
<add>var cmd = [process.execPath, '-e', '"console.error(process.argv)"',
<add> 'foo', 'bar'].join(' ');
<ide> var expected = util.format([process.execPath, 'foo', 'bar']) + '\n';
<ide> var child = exec(cmd, function(err, stdout, stderr) {
<ide> if (err) {
<ide><path>test/simple/test-fs-long-path.js
<ide> var fileNameLen = Math.max(260 - common.tmpDir.length - 1, 1);
<ide> var fileName = path.join(common.tmpDir, new Array(fileNameLen + 1).join('x'));
<ide> var fullPath = path.resolve(fileName);
<ide>
<del>console.log({ filenameLength: fileName.length,
<del> fullPathLength: fullPath.length });
<add>console.log({
<add> filenameLength: fileName.length,
<add> fullPathLength: fullPath.length
<add>});
<ide>
<ide> fs.writeFile(fullPath, 'ok', function(err) {
<ide> if (err) throw err;
<ide><path>test/simple/test-fs-mkdir.js
<ide> function unlink(pathname) {
<ide>
<ide> // Keep the event loop alive so the async mkdir() requests
<ide> // have a chance to run (since they don't ref the event loop).
<del>process.nextTick(function(){});
<add>process.nextTick(function() {});
<ide><path>test/simple/test-fs-symlink.js
<ide> var runtest = function(skip_symlinks) {
<ide> // Delete previously created link
<ide> try {
<ide> fs.unlinkSync(linkPath);
<del> } catch(e)
<del> {}
<add> } catch (e) {}
<ide>
<ide> fs.symlink(linkData, linkPath, function(err) {
<ide> if (err) throw err;
<ide> var runtest = function(skip_symlinks) {
<ide> // Delete previously created link
<ide> try {
<ide> fs.unlinkSync(dstPath);
<del> } catch(e)
<del> {}
<add> } catch (e) {}
<ide>
<ide> fs.link(srcPath, dstPath, function(err) {
<ide> if (err) throw err;
<ide> var runtest = function(skip_symlinks) {
<ide> assert.equal(srcContent, dstContent);
<ide> completed++;
<ide> });
<del>}
<add>};
<ide>
<ide> if (is_windows) {
<ide> // On Windows, creating symlinks requires admin privileges.
<ide> // We'll only try to run symlink test if we have enough privileges.
<del> exec("whoami /priv", function(err, o) {
<add> exec('whoami /priv', function(err, o) {
<ide> if (err || o.indexOf('SeCreateSymbolicLinkPrivilege') == -1) {
<ide> expected_tests = 1;
<ide> runtest(true);
<ide><path>test/simple/test-fs-utimes.js
<ide> function expect_ok(syscall, resource, err, atime, mtime) {
<ide> // the tests assume that __filename belongs to the user running the tests
<ide> // this should be a fairly safe assumption; testing against a temp file
<ide> // would be even better though (node doesn't have such functionality yet)
<del>function runTests(atime, mtime, callback) {
<add>function runTest(atime, mtime, callback) {
<ide>
<ide> var fd, err;
<ide> //
<ide> function runTests(atime, mtime, callback) {
<ide>
<ide> var stats = fs.statSync(__filename);
<ide>
<del>runTests(new Date('1982-09-10 13:37'), new Date('1982-09-10 13:37'), function() {
<del> runTests(new Date(), new Date(), function() {
<del> runTests(123456.789, 123456.789, function() {
<del> runTests(stats.mtime, stats.mtime, function() {
<add>runTest(new Date('1982-09-10 13:37'), new Date('1982-09-10 13:37'), function() {
<add> runTest(new Date(), new Date(), function() {
<add> runTest(123456.789, 123456.789, function() {
<add> runTest(stats.mtime, stats.mtime, function() {
<ide> // done
<ide> });
<ide> });
<ide><path>test/simple/test-http-abort-before-end.js
<ide> var server = http.createServer(function(req, res) {
<ide> });
<ide>
<ide> server.listen(common.PORT, function() {
<del> var req = http.request({method:'GET', host:'127.0.0.1', port:common.PORT});
<add> var req = http.request({method: 'GET', host: '127.0.0.1', port: common.PORT});
<ide>
<ide> req.on('error', function(ex) {
<ide> // https://github.com/joyent/node/issues/1399#issuecomment-2597359
<ide><path>test/simple/test-http-res-write-end-dont-take-array.js
<ide> var http = require('http');
<ide>
<ide> var test = 1;
<ide>
<del>var server = http.createServer(function (req, res) {
<add>var server = http.createServer(function(req, res) {
<ide> res.writeHead(200, {'Content-Type': 'text/plain'});
<ide> if (test === 1) {
<ide> // write should accept string
<ide> var server = http.createServer(function (req, res) {
<ide>
<ide> server.listen(common.PORT, function() {
<ide> // just make a request, other tests handle responses
<del> http.get({port:common.PORT}, function() {
<add> http.get({port: common.PORT}, function() {
<ide> // lazy serial test, becuase we can only call end once per request
<ide> test += 1;
<ide> // do it again to test .end(Buffer);
<del> http.get({port:common.PORT}, function() {
<add> http.get({port: common.PORT}, function() {
<ide> server.close();
<ide> });
<ide> });
<ide><path>test/simple/test-http-response-no-headers.js
<ide> var net = require('net');
<ide> var expected = {
<ide> '0.9': 'I AM THE WALRUS',
<ide> '1.0': 'I AM THE WALRUS',
<del> '1.1': '',
<del>}
<add> '1.1': ''
<add>};
<ide>
<ide> var gotExpected = false;
<ide>
<ide> function test(httpVersion, callback) {
<ide> });
<ide>
<ide> var server = net.createServer(function(conn) {
<del> var reply = 'HTTP/' + httpVersion + ' 200 OK\r\n\r\n' + expected[httpVersion];
<add> var reply = 'HTTP/' + httpVersion + ' 200 OK\r\n\r\n' +
<add> expected[httpVersion];
<ide>
<ide> conn.write(reply, function() {
<ide> conn.destroy();
<del> })
<add> });
<ide> });
<ide>
<ide> server.listen(common.PORT, '127.0.0.1', function() {
<ide><path>test/simple/test-init.js
<ide>
<ide> child.exec(process.execPath + ' test-init', {env: {'TEST_INIT': 1}},
<ide> function(err, stdout, stderr) {
<del> assert.equal(stdout, 'Loaded successfully!', '`node test-init` failed!');
<add> assert.equal(stdout, 'Loaded successfully!',
<add> '`node test-init` failed!');
<ide> });
<ide> child.exec(process.execPath + ' test-init.js', {env: {'TEST_INIT': 1}},
<ide> function(err, stdout, stderr) {
<del> assert.equal(stdout, 'Loaded successfully!', '`node test-init.js` failed!');
<add> assert.equal(stdout, 'Loaded successfully!',
<add> '`node test-init.js` failed!');
<ide> });
<ide>
<ide> // test-init-index is in fixtures dir as requested by ry, so go there
<ide> process.chdir(common.fixturesDir);
<ide>
<ide> child.exec(process.execPath + ' test-init-index', {env: {'TEST_INIT': 1}},
<ide> function(err, stdout, stderr) {
<del> assert.equal(stdout, 'Loaded successfully!', '`node test-init-index failed!');
<add> assert.equal(stdout, 'Loaded successfully!',
<add> '`node test-init-index failed!');
<ide> });
<ide>
<ide> // ensures that `node fs` does not mistakenly load the native 'fs' module
<del> // instead of the desired file and that the fs module loads as expected in node
<add> // instead of the desired file and that the fs module loads as
<add> // expected in node
<ide> process.chdir(common.fixturesDir + '/test-init-native/');
<ide>
<ide> child.exec(process.execPath + ' fs', {env: {'TEST_INIT': 1}},
<ide> function(err, stdout, stderr) {
<del> assert.equal(stdout, 'fs loaded successfully', '`node fs` failed!');
<add> assert.equal(stdout, 'fs loaded successfully',
<add> '`node fs` failed!');
<ide> });
<ide> }
<ide> })();
<ide><path>test/simple/test-module-load-list.js
<ide> // beginning of this file.
<ide>
<ide> function assertEqual(x, y) {
<del> if (x !== y) throw new Error("Expected '" + x + "' got '" + y + "'");
<add> if (x !== y) throw new Error('Expected \'' + x + '\' got \'' + y + '\'');
<ide> }
<ide>
<ide> function checkExpected() {
<ide> var toCompare = Math.max(expected.length, process.moduleLoadList.length);
<ide> for (var i = 0; i < toCompare; i++) {
<ide> if (expected[i] !== process.moduleLoadList[i]) {
<del> console.error("process.moduleLoadList[" + i + "] = " + process.moduleLoadList[i]);
<del> console.error("expected[" + i + "] = " + expected[i]);
<add> console.error('process.moduleLoadList[' + i + '] = ' +
<add> process.moduleLoadList[i]);
<add> console.error('expected[' + i + '] = ' + expected[i]);
<ide>
<del> console.error("process.moduleLoadList", process.moduleLoadList);
<del> console.error("expected = ", expected);
<del> throw new Error("mismatch");
<add> console.error('process.moduleLoadList', process.moduleLoadList);
<add> console.error('expected = ', expected);
<add> throw new Error('mismatch');
<ide> }
<ide> }
<ide> }
<ide><path>test/simple/test-net-connect-buffer.js
<ide> tcp.listen(common.PORT, function() {
<ide> // Write a string that contains a multi-byte character sequence to test that
<ide> // `bytesWritten` is incremented with the # of bytes, not # of characters.
<ide> var a = "L'État, c'est ";
<del> var b = "moi";
<add> var b = 'moi';
<ide>
<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><path>test/simple/test-net-pipe-connect-errors.js
<ide> var accessErrorFired = false;
<ide>
<ide> // Test if ENOTSOCK is fired when trying to connect to a file which is not
<ide> // a socket.
<del>var notSocketClient = net.createConnection(
<del> path.join(common.fixturesDir, 'empty.txt'),
<del> function () {
<del> assert.ok(false);
<del> }
<del>);
<add>var emptyTxt = path.join(common.fixturesDir, 'empty.txt');
<add>var notSocketClient = net.createConnection(emptyTxt, function() {
<add> assert.ok(false);
<add>});
<ide>
<del>notSocketClient.on('error', function (err) {
<add>notSocketClient.on('error', function(err) {
<ide> assert(err.code === 'ENOTSOCK' || err.code === 'ECONNREFUSED');
<ide> notSocketErrorFired = true;
<ide> });
<ide>
<ide>
<ide> // Trying to connect to not-existing socket should result in ENOENT error
<del>var noEntSocketClient = net.createConnection('no-ent-file', function () {
<add>var noEntSocketClient = net.createConnection('no-ent-file', function() {
<ide> assert.ok(false);
<ide> });
<ide>
<del>noEntSocketClient.on('error', function (err) {
<add>noEntSocketClient.on('error', function(err) {
<ide> assert.equal(err.code, 'ENOENT');
<ide> noEntErrorFired = true;
<ide> });
<ide>
<ide>
<ide> // Trying to connect to a socket one has no access to should result in EACCES
<del>var accessServer = net.createServer(function () {
<add>var accessServer = net.createServer(function() {
<ide> assert.ok(false);
<ide> });
<del>accessServer.listen(common.PIPE, function () {
<add>accessServer.listen(common.PIPE, function() {
<ide> fs.chmodSync(common.PIPE, 0);
<ide>
<del> var accessClient = net.createConnection(common.PIPE, function () {
<add> var accessClient = net.createConnection(common.PIPE, function() {
<ide> assert.ok(false);
<ide> });
<ide>
<del> accessClient.on('error', function (err) {
<add> accessClient.on('error', function(err) {
<ide> assert.equal(err.code, 'EACCES');
<ide> accessErrorFired = true;
<ide> accessServer.close();
<ide> accessServer.listen(common.PIPE, function () {
<ide>
<ide>
<ide> // Assert that all error events were fired
<del>process.on('exit', function () {
<add>process.on('exit', function() {
<ide> assert.ok(notSocketErrorFired);
<ide> assert.ok(noEntErrorFired);
<ide> assert.ok(accessErrorFired);
<ide><path>test/simple/test-path.js
<ide> assert.equal(path.basename(f, '.js'), 'test-path');
<ide> // c.f. http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html
<ide> if (!isWindows) {
<ide> var controlCharFilename = 'Icon' + String.fromCharCode(13);
<del> assert.equal(path.basename('/a/b/' + controlCharFilename), controlCharFilename);
<add> assert.equal(path.basename('/a/b/' + controlCharFilename),
<add> controlCharFilename);
<ide> }
<ide>
<ide> assert.equal(path.extname(f), '.js');
<ide>
<del>assert.equal(path.dirname(f).substr(-11), isWindows ? 'test\\simple' : 'test/simple');
<add>assert.equal(path.dirname(f).substr(-11),
<add> isWindows ? 'test\\simple' : 'test/simple');
<ide> assert.equal(path.dirname('/a/b/'), '/a');
<ide> assert.equal(path.dirname('/a/b'), '/a');
<ide> assert.equal(path.dirname('/a'), '/');
<ide> var failures = [];
<ide> relativeTests.forEach(function(test) {
<ide> var actual = path.relative(test[0], test[1]);
<ide> var expected = test[2];
<del> var message = 'path.relative(' + test.slice(0, 2).map(JSON.stringify).join(',') + ')' +
<add> var message = 'path.relative(' +
<add> test.slice(0, 2).map(JSON.stringify).join(',') +
<add> ')' +
<ide> '\n expect=' + JSON.stringify(expected) +
<ide> '\n actual=' + JSON.stringify(actual);
<ide> if (actual !== expected) failures.push('\n' + message);
<ide><path>test/simple/test-punycode.js
<ide> assert.equal(punycode.decode('wgv71a119e'), '日本語');
<ide> var tests = {
<ide> // (A) Arabic (Egyptian)
<ide> 'egbpdaj6bu4bxfgehfvwxn':
<del> '\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644\u0645\u0648' +
<del> '\u0634\u0639\u0631\u0628\u064A\u061F',
<add> '\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644\u0645\u0648' +
<add> '\u0634\u0639\u0631\u0628\u064A\u061F',
<ide>
<ide> // (B) Chinese (simplified)
<ide> 'ihqwcrb4cv8a8dqg056pqjye':
<del> '\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587',
<add> '\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587',
<ide>
<ide> // (C) Chinese (traditional)
<ide> 'ihqwctvzc91f659drss3x8bo0yb':
<del> '\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587',
<add> '\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587',
<ide>
<ide> // (D) Czech: Pro<ccaron>prost<ecaron>nemluv<iacute><ccaron>esky
<ide> 'Proprostnemluvesky-uyb24dma41a':
<del> '\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074\u011B\u006E' +
<del> '\u0065\u006D\u006C\u0075\u0076\u00ED\u010D\u0065\u0073\u006B\u0079',
<add> '\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074\u011B\u006E' +
<add> '\u0065\u006D\u006C\u0075\u0076\u00ED\u010D\u0065\u0073\u006B\u0079',
<ide>
<ide> // (E) Hebrew
<ide> '4dbcagdahymbxekheh6e0a7fei0b':
<del> '\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8\u05DC\u05D0' +
<del> '\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2\u05D1\u05E8\u05D9\u05EA',
<add> '\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8\u05DC\u05D0' +
<add> '\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2\u05D1\u05E8\u05D9\u05EA',
<ide>
<ide> // (F) Hindi (Devanagari)
<ide> 'i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd':
<del> '\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D\u0926\u0940' +
<del> '\u0915\u094D\u092F\u094B\u0902\u0928\u0939\u0940\u0902\u092C\u094B' +
<del> '\u0932\u0938\u0915\u0924\u0947\u0939\u0948\u0902',
<add> '\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D\u0926\u0940' +
<add> '\u0915\u094D\u092F\u094B\u0902\u0928\u0939\u0940\u0902\u092C\u094B' +
<add> '\u0932\u0938\u0915\u0924\u0947\u0939\u0948\u0902',
<ide>
<ide> // (G) Japanese (kanji and hiragana)
<ide> 'n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa':
<del> '\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092\u8A71\u3057' +
<del> '\u3066\u304F\u308C\u306A\u3044\u306E\u304B',
<add> '\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092\u8A71\u3057' +
<add> '\u3066\u304F\u308C\u306A\u3044\u306E\u304B',
<ide>
<ide> // (H) Korean (Hangul syllables)
<ide> '989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5jpsd879ccm6fea98c':
<del> '\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774\uD55C\uAD6D' +
<del> '\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74\uC5BC\uB9C8\uB098\uC88B' +
<del> '\uC744\uAE4C',
<add> '\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774\uD55C\uAD6D' +
<add> '\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74\uC5BC\uB9C8\uB098\uC88B' +
<add> '\uC744\uAE4C',
<ide>
<ide> // (I) Russian (Cyrillic)
<ide> /* XXX disabled, fails - possibly a bug in the RFC
<ide> 'b1abfaaepdrnnbgefbaDotcwatmq2g4l':
<del> '\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E\u043D\u0438' +
<del> '\u043D\u0435\u0433\u043E\u0432\u043E\u0440\u044F\u0442\u043F\u043E' +
<del> '\u0440\u0443\u0441\u0441\u043A\u0438',
<add> '\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E\u043D\u0438' +
<add> '\u043D\u0435\u0433\u043E\u0432\u043E\u0440\u044F\u0442\u043F\u043E' +
<add> '\u0440\u0443\u0441\u0441\u043A\u0438',
<ide> */
<ide>
<ide> // (J) Spanish: Porqu<eacute>nopuedensimplementehablarenEspa<ntilde>ol
<ide> 'PorqunopuedensimplementehablarenEspaol-fmd56a':
<del> '\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070\u0075\u0065' +
<del> '\u0064\u0065\u006E\u0073\u0069\u006D\u0070\u006C\u0065\u006D\u0065' +
<del> '\u006E\u0074\u0065\u0068\u0061\u0062\u006C\u0061\u0072\u0065\u006E' +
<del> '\u0045\u0073\u0070\u0061\u00F1\u006F\u006C',
<add> '\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070\u0075\u0065' +
<add> '\u0064\u0065\u006E\u0073\u0069\u006D\u0070\u006C\u0065\u006D\u0065' +
<add> '\u006E\u0074\u0065\u0068\u0061\u0062\u006C\u0061\u0072\u0065\u006E' +
<add> '\u0045\u0073\u0070\u0061\u00F1\u006F\u006C',
<ide>
<del> // (K) Vietnamese: T<adotbelow>isaoh<odotbelow>kh<ocirc>ngth<ecirchookabove>ch<ihookabove>n<oacute>iti<ecircacute>ngVi<ecircdotbelow>t
<add> // (K) Vietnamese: T<adotbelow>isaoh<odotbelow>kh<ocirc>ngth
<add> // <ecirchookabove>ch<ihookabove>n<oacute>iti<ecircacute>ngVi<ecircdotbelow>t
<ide> 'TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g':
<del> '\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B\u0068\u00F4' +
<del> '\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068\u1EC9\u006E\u00F3\u0069' +
<del> '\u0074\u0069\u1EBF\u006E\u0067\u0056\u0069\u1EC7\u0074',
<add> '\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B\u0068\u00F4' +
<add> '\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068\u1EC9\u006E\u00F3\u0069' +
<add> '\u0074\u0069\u1EBF\u006E\u0067\u0056\u0069\u1EC7\u0074',
<ide>
<ide> // (L) 3<nen>B<gumi><kinpachi><sensei>
<ide> '3B-ww4c5e180e575a65lsy2b':
<del> '\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F',
<add> '\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F',
<ide>
<ide> // (M) <amuro><namie>-with-SUPER-MONKEYS
<ide> '-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n':
<del> '\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074\u0068\u002D' +
<del> '\u0053\u0055\u0050\u0045\u0052\u002D\u004D\u004F\u004E\u004B\u0045' +
<del> '\u0059\u0053',
<add> '\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074\u0068\u002D' +
<add> '\u0053\u0055\u0050\u0045\u0052\u002D\u004D\u004F\u004E\u004B\u0045' +
<add> '\u0059\u0053',
<ide>
<ide> // (N) Hello-Another-Way-<sorezore><no><basho>
<ide> 'Hello-Another-Way--fc4qua05auwb3674vfr0b':
<del> '\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F\u0074\u0068' +
<del> '\u0065\u0072\u002D\u0057\u0061\u0079\u002D\u305D\u308C\u305E\u308C' +
<del> '\u306E\u5834\u6240',
<add> '\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F\u0074\u0068' +
<add> '\u0065\u0072\u002D\u0057\u0061\u0079\u002D\u305D\u308C\u305E\u308C' +
<add> '\u306E\u5834\u6240',
<ide>
<ide> // (O) <hitotsu><yane><no><shita>2
<ide> '2-u9tlzr9756bt3uc0v':
<del> '\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032',
<add> '\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032',
<ide>
<ide> // (P) Maji<de>Koi<suru>5<byou><mae>
<ide> 'MajiKoi5-783gue6qz075azm5e':
<del> '\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059\u308B\u0035' +
<del> '\u79D2\u524D',
<add> '\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059\u308B\u0035' +
<add> '\u79D2\u524D',
<ide>
<ide> // (Q) <pafii>de<runba>
<ide> 'de-jg4avhby1noc0d':
<del> '\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0',
<add> '\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0',
<ide>
<ide> // (R) <sono><supiido><de>
<ide> 'd9juau41awczczp':
<del> '\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067',
<add> '\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067',
<ide>
<ide> // (S) -> $1.00 <-
<ide> '-> $1.00 <--':
<del> '\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020\u003C\u002D'
<add> '\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020\u003C\u002D'
<ide> };
<ide>
<ide> var errors = 0;
<ide><path>test/simple/test-readdir.js
<ide> process.on('exit', function() {
<ide> var has_caught = false;
<ide>
<ide> try {
<del> fs.readdirSync(__filename)
<add> fs.readdirSync(__filename);
<ide> }
<ide> catch (e) {
<ide> has_caught = true;
<ide><path>test/simple/test-regress-GH-1899.js
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<ide> var path = require('path');
<del>var assert = require('assert')
<add>var assert = require('assert');
<ide> var spawn = require('child_process').spawn;
<ide> var common = require('../common');
<ide>
<del>var child = spawn(process.argv[0], [path.join(common.fixturesDir, 'GH-1899-output.js')]);
<add>var child = spawn(process.argv[0], [
<add> path.join(common.fixturesDir, 'GH-1899-output.js')
<add>]);
<ide> var output = '';
<ide>
<del>child.stdout.on('data', function (data) {
<add>child.stdout.on('data', function(data) {
<ide> output += data;
<ide> });
<ide>
<del>child.on('exit', function (code, signal) {
<add>child.on('exit', function(code, signal) {
<ide> assert.equal(code, 0);
<ide> assert.equal(output, 'hello, world!\n');
<ide> });
<ide><path>test/simple/test-regress-GH-877.js
<ide> var server = http.createServer(function(req, res) {
<ide> res.end('Hello World\n');
<ide> });
<ide>
<add>var addrString = '127.0.0.1:' + common.PORT;
<add>
<ide> server.listen(common.PORT, '127.0.0.1', function() {
<ide> for (var i = 0; i < N; i++) {
<ide> var options = {
<ide> server.listen(common.PORT, '127.0.0.1', function() {
<ide>
<ide> assert.equal(req.agent, agent);
<ide>
<del> console.log('Socket: ' + agent.sockets['127.0.0.1:' + common.PORT].length +
<del> '/' + agent.maxSockets +
<del> ' queued: ' + (agent.requests['127.0.0.1:' + common.PORT] ? agent.requests['127.0.0.1:' + common.PORT].length : 0));
<add> console.log('Socket: ' + agent.sockets[addrString].length + '/' +
<add> agent.maxSockets + ' queued: ' + (agent.requests[addrString] ?
<add> agent.requests['127.0.0.1:' + common.PORT].length : 0));
<add>
<add> var agentRequests = agent.requests[addrString] ?
<add> agent.requests[addrString].length : 0;
<ide>
<del> if (maxQueued < (agent.requests['127.0.0.1:' + common.PORT] ? agent.requests['127.0.0.1:' + common.PORT].length : 0)) {
<del> maxQueued = (agent.requests['127.0.0.1:' + common.PORT] ? agent.requests['127.0.0.1:' + common.PORT].length : 0);
<add> if (maxQueued < agentRequests) {
<add> maxQueued = agentRequests;
<ide> }
<ide> }
<ide> });
<ide><path>test/simple/test-repl-.save.load.js
<ide> var repl = require('repl');
<ide>
<ide> // A stream to push an array into a REPL
<ide> function ArrayStream() {
<del> this.run = function (data) {
<add> this.run = function(data) {
<ide> var self = this;
<del> data.forEach(function (line) {
<add> data.forEach(function(line) {
<ide> self.emit('data', line);
<ide> });
<ide> }
<ide> }
<ide> util.inherits(ArrayStream, require('stream').Stream);
<ide> ArrayStream.prototype.readable = true;
<ide> ArrayStream.prototype.writable = true;
<del>ArrayStream.prototype.resume = function () {};
<del>ArrayStream.prototype.write = function () {};
<add>ArrayStream.prototype.resume = function() {};
<add>ArrayStream.prototype.write = function() {};
<ide>
<del>var works = [ [ 'inner.one' ], 'inner.o' ];
<add>var works = [['inner.one'], 'inner.o'];
<ide>
<ide> var putIn = new ArrayStream();
<ide> var testMe = repl.start('', putIn);
<ide> putIn.run(testFile);
<ide> putIn.run(['.save ' + saveFileName]);
<ide>
<ide> // the file should have what I wrote
<del>assert.equal(
<del> fs.readFileSync(saveFileName, 'utf8'),
<del> testFile.join('\n') + '\n');
<add>assert.equal(fs.readFileSync(saveFileName, 'utf8'), testFile.join('\n') + '\n');
<ide>
<ide> // make sure that the REPL data is "correct"
<ide> // so when I load it back I know I'm good
<del>testMe.complete('inner.o', function (error, data) {
<add>testMe.complete('inner.o', function(error, data) {
<ide> assert.deepEqual(data, works);
<ide> });
<ide>
<ide> putIn.run(['.clear']);
<ide> putIn.run(['.load ' + saveFileName]);
<ide>
<ide> // make sure that the REPL data is "correct"
<del>testMe.complete('inner.o', function (error, data) {
<add>testMe.complete('inner.o', function(error, data) {
<ide> assert.deepEqual(data, works);
<ide> });
<ide>
<ide> var loadFile = join(common.tmpDir, 'file.does.not.exist');
<ide> // shold not break
<ide> putIn.write = function(data) {
<ide> // make sure I get a failed to load message and not some crazy error
<del> assert.equal(data,
<del> 'Failed to load:' + loadFile + '\n');
<add> assert.equal(data, 'Failed to load:' + loadFile + '\n');
<ide> // eat me to avoid work
<ide> putIn.write = function() {};
<ide> };
<del>putIn.run(['.load ' +loadFile]);
<add>putIn.run(['.load ' + loadFile]);
<ide>
<ide>
<ide> //TODO how do I do a failed .save test?
<ide><path>test/simple/test-setproctitle.js
<ide>
<ide> // FIXME add sunos support
<ide> if ('linux freebsd'.indexOf(process.platform) === -1) {
<del> console.error("Skipping test, platform not supported.");
<add> console.error('Skipping test, platform not supported.');
<ide> process.exit();
<ide> }
<ide>
<ide> var assert = require('assert');
<ide> var exec = require('child_process').exec;
<ide>
<del>var title = "testTestTESTtest123123123123123123HiHaiJo";
<add>var title = 'testTestTESTtest123123123123123123HiHaiJo';
<ide>
<ide> assert.notEqual(process.title, title);
<ide> process.title = title;
<ide><path>test/simple/test-stdin-pause-resume.js
<ide> // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<del>console.error("before opening stdin");
<add>console.error('before opening stdin');
<ide> process.stdin.resume();
<del>console.error("stdin opened");
<add>console.error('stdin opened');
<ide> setTimeout(function() {
<del> console.error("pausing stdin");
<add> console.error('pausing stdin');
<ide> process.stdin.pause();
<ide> setTimeout(function() {
<del> console.error("opening again");
<add> console.error('opening again');
<ide> process.stdin.resume();
<ide> setTimeout(function() {
<del> console.error("pausing again");
<add> console.error('pausing again');
<ide> process.stdin.pause();
<del> console.error("should exit now");
<add> console.error('should exit now');
<ide> }, 1);
<ide> }, 1);
<ide> }, 1);
<ide><path>test/simple/test-tls-passphrase.js
<ide> var server = tls.Server({
<ide> key: key,
<ide> passphrase: 'passphrase',
<ide> cert: cert,
<del> ca: [ cert ],
<add> ca: [cert],
<ide> requestCert: true,
<ide> rejectUnauthorized: true
<ide> }, function(s) {
<ide><path>test/simple/test-tls-session-cache.js
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<ide> if (!process.versions.openssl) {
<del> console.error("Skipping because node compiled without OpenSSL.");
<add> console.error('Skipping because node compiled without OpenSSL.');
<ide> process.exit(0);
<ide> }
<ide> require('child_process').exec('openssl version', function(err) {
<ide> if (err !== null) {
<del> console.error("Skipping because openssl command is not available.");
<add> console.error('Skipping because openssl command is not available.');
<ide> process.exit(0);
<ide> }
<ide> doTest();
<ide> function doTest() {
<ide> var options = {
<ide> key: key,
<ide> cert: cert,
<del> ca: [ cert ],
<add> ca: [cert],
<ide> requestCert: true
<ide> };
<ide> var requestCount = 0;
<ide><path>test/simple/test-tls-set-ciphers.js
<ide> var server = tls.createServer(options, function(conn) {
<ide> });
<ide>
<ide> server.listen(common.PORT, '127.0.0.1', function() {
<del> var cmd = 'openssl s_client -cipher NULL-MD5 -connect 127.0.0.1:' + common.PORT;
<add> var cmd = 'openssl s_client -cipher NULL-MD5 -connect 127.0.0.1:' +
<add> common.PORT;
<ide>
<ide> exec(cmd, function(err, stdout, stderr) {
<ide> if (err) throw err;
<ide><path>test/simple/test-tty-stdout-end.js
<ide> var exceptionCaught = false;
<ide>
<ide> try {
<ide> process.stdout.end();
<del>} catch(e) {
<add>} catch (e) {
<ide> exceptionCaught = true;
<ide> assert.ok(common.isError(e));
<ide> assert.equal('process.stdout cannot be closed', e.message);
<ide><path>test/simple/test-util-inspect.js
<ide> assert.ok(ex.indexOf('[type]') != -1);
<ide>
<ide> // GH-1941
<ide> // should not throw:
<del>assert.equal(util.inspect(Object.create(Date.prototype)), '{}')
<add>assert.equal(util.inspect(Object.create(Date.prototype)), '{}');
<ide>
<ide> // GH-1944
<del>assert.doesNotThrow(function () {
<add>assert.doesNotThrow(function() {
<ide> var d = new Date();
<ide> d.toUTCString = null;
<ide> util.inspect(d);
<ide> });
<ide>
<del>assert.doesNotThrow(function () {
<add>assert.doesNotThrow(function() {
<ide> var r = /regexp/;
<ide> r.toString = null;
<ide> util.inspect(r);
<ide><path>test/simple/test-util.js
<ide> var util = require('util');
<ide> var context = require('vm').runInNewContext;
<ide>
<ide> // isArray
<del>assert.equal(true, util.isArray([]))
<del>assert.equal(true, util.isArray(Array()))
<del>assert.equal(true, util.isArray(new Array()))
<del>assert.equal(true, util.isArray(new Array(5)))
<del>assert.equal(true, util.isArray(new Array('with', 'some', 'entries')))
<del>assert.equal(true, util.isArray(context('Array')()))
<del>assert.equal(false, util.isArray({}))
<del>assert.equal(false, util.isArray({ push: function () {} }))
<del>assert.equal(false, util.isArray(/regexp/))
<del>assert.equal(false, util.isArray(new Error))
<del>assert.equal(false, util.isArray(Object.create(Array.prototype)))
<add>assert.equal(true, util.isArray([]));
<add>assert.equal(true, util.isArray(Array()));
<add>assert.equal(true, util.isArray(new Array()));
<add>assert.equal(true, util.isArray(new Array(5)));
<add>assert.equal(true, util.isArray(new Array('with', 'some', 'entries')));
<add>assert.equal(true, util.isArray(context('Array')()));
<add>assert.equal(false, util.isArray({}));
<add>assert.equal(false, util.isArray({ push: function() {} }));
<add>assert.equal(false, util.isArray(/regexp/));
<add>assert.equal(false, util.isArray(new Error));
<add>assert.equal(false, util.isArray(Object.create(Array.prototype)));
<ide>
<ide> // isRegExp
<del>assert.equal(true, util.isRegExp(/regexp/))
<del>assert.equal(true, util.isRegExp(RegExp()))
<del>assert.equal(true, util.isRegExp(new RegExp()))
<del>assert.equal(true, util.isRegExp(context('RegExp')()))
<del>assert.equal(false, util.isRegExp({}))
<del>assert.equal(false, util.isRegExp([]))
<del>assert.equal(false, util.isRegExp(new Date()))
<del>assert.equal(false, util.isRegExp(Object.create(RegExp.prototype)))
<add>assert.equal(true, util.isRegExp(/regexp/));
<add>assert.equal(true, util.isRegExp(RegExp()));
<add>assert.equal(true, util.isRegExp(new RegExp()));
<add>assert.equal(true, util.isRegExp(context('RegExp')()));
<add>assert.equal(false, util.isRegExp({}));
<add>assert.equal(false, util.isRegExp([]));
<add>assert.equal(false, util.isRegExp(new Date()));
<add>assert.equal(false, util.isRegExp(Object.create(RegExp.prototype)));
<ide>
<ide> // isDate
<del>assert.equal(true, util.isDate(new Date()))
<del>assert.equal(true, util.isDate(new Date(0)))
<del>assert.equal(true, util.isDate(new (context('Date'))))
<del>assert.equal(false, util.isDate(Date()))
<del>assert.equal(false, util.isDate({}))
<del>assert.equal(false, util.isDate([]))
<del>assert.equal(false, util.isDate(new Error))
<del>assert.equal(false, util.isDate(Object.create(Date.prototype)))
<add>assert.equal(true, util.isDate(new Date()));
<add>assert.equal(true, util.isDate(new Date(0)));
<add>assert.equal(true, util.isDate(new (context('Date'))));
<add>assert.equal(false, util.isDate(Date()));
<add>assert.equal(false, util.isDate({}));
<add>assert.equal(false, util.isDate([]));
<add>assert.equal(false, util.isDate(new Error));
<add>assert.equal(false, util.isDate(Object.create(Date.prototype)));
<ide>
<ide> // isError
<del>assert.equal(true, util.isError(new Error))
<del>assert.equal(true, util.isError(new TypeError))
<del>assert.equal(true, util.isError(new SyntaxError))
<del>assert.equal(true, util.isError(new (context('Error'))))
<del>assert.equal(true, util.isError(new (context('TypeError'))))
<del>assert.equal(true, util.isError(new (context('SyntaxError'))))
<del>assert.equal(false, util.isError({}))
<del>assert.equal(false, util.isError({ name: 'Error', message: '' }))
<del>assert.equal(false, util.isError([]))
<del>assert.equal(false, util.isError(Object.create(Error.prototype)))
<add>assert.equal(true, util.isError(new Error));
<add>assert.equal(true, util.isError(new TypeError));
<add>assert.equal(true, util.isError(new SyntaxError));
<add>assert.equal(true, util.isError(new (context('Error'))));
<add>assert.equal(true, util.isError(new (context('TypeError'))));
<add>assert.equal(true, util.isError(new (context('SyntaxError'))));
<add>assert.equal(false, util.isError({}));
<add>assert.equal(false, util.isError({ name: 'Error', message: '' }));
<add>assert.equal(false, util.isError([]));
<add>assert.equal(false, util.isError(Object.create(Error.prototype)));
<ide><path>test/simple/test-zlib-from-gzip.js
<ide> out.on('close', function() {
<ide> var actual = fs.readFileSync(outputFile);
<ide> assert.equal(actual.length, expect.length, 'length should match');
<ide> for (var i = 0, l = actual.length; i < l; i++) {
<del> assert.equal(actual[i], expect[i], 'byte['+i+']');
<add> assert.equal(actual[i], expect[i], 'byte[' + i + ']');
<ide> }
<ide> });
<ide><path>test/simple/test-zlib-from-string.js
<ide> var common = require('../common.js');
<ide> var assert = require('assert');
<ide> var zlib = require('zlib');
<ide>
<del>var inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi faucibus, purus at gravida dictum, libero arcu convallis lacus, in commodo libero metus eu nisi. Nullam commodo, neque nec porta placerat, nisi est fermentum augue, vitae gravida tellus sapien sit amet tellus. Aenean non diam orci. Proin quis elit turpis. Suspendisse non diam ipsum. Suspendisse nec ullamcorper odio. Vestibulum arcu mi, sodales non suscipit id, ultrices ut massa. Sed ac sem sit amet arcu malesuada fermentum. Nunc sed. ';
<del>var expectedBase64Deflate = 'eJxdUUtOQzEMvMoc4OndgT0gJCT2buJWlpI4jePeqZfpmXAKLRKbLOzx/HK73q6vOrhCunlF1qIDJhNUeW5I2ozT5OkDlKWLJWkncJG5403HQXAkT3Jw29B9uIEmToMukglZ0vS6ociBh4JG8sV4oVLEUCitK2kxq1WzPnChHDzsaGKy491LofoAbWh8do43oeuYhB5EPCjcLjzYJo48KrfQBvnJecNFJvHT1+RSQsGoC7dn2t/xjhduTA1NWyQIZR0pbHwMDatnD+crPqKSqGPHp1vnlsWM/07ubf7bheF7kqSj84Bm0R1fYTfaK8vqqqfKBtNMhe3OZh6N95CTvMX5HJJi4xOVzCgUOIMSLH7wmeOHaFE4RdpnGavKtrB5xzfO/Ll9';
<del>var expectedBase64Gzip = 'H4sIAAAAAAAAA11RS05DMQy8yhzg6d2BPSAkJPZu4laWkjiN496pl+mZcAotEpss7PH8crverq86uEK6eUXWogMmE1R5bkjajNPk6QOUpYslaSdwkbnjTcdBcCRPcnDb0H24gSZOgy6SCVnS9LqhyIGHgkbyxXihUsRQKK0raTGrVbM+cKEcPOxoYrLj3Uuh+gBtaHx2jjeh65iEHkQ8KNwuPNgmjjwqt9AG+cl5w0Um8dPX5FJCwagLt2fa3/GOF25MDU1bJAhlHSlsfAwNq2cP5ys+opKoY8enW+eWxYz/Tu5t/tuF4XuSpKPzgGbRHV9hN9ory+qqp8oG00yF7c5mHo33kJO8xfkckmLjE5XMKBQ4gxIsfvCZ44doUThF2mcZq8q2sHnHNzRtagj5AQAA';
<add>var inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing el' +
<add> 'it. Morbi faucibus, purus at gravida dictum, libero arcu convallis la' +
<add> 'cus, in commodo libero metus eu nisi. Nullam commodo, neque nec porta' +
<add> ' placerat, nisi est fermentum augue, vitae gravida tellus sapien sit ' +
<add> 'amet tellus. Aenean non diam orci. Proin quis elit turpis. Suspendiss' +
<add> 'e non diam ipsum. Suspendisse nec ullamcorper odio. Vestibulum arcu m' +
<add> 'i, sodales non suscipit id, ultrices ut massa. Sed ac sem sit amet ar' +
<add> 'cu malesuada fermentum. Nunc sed. ';
<add>var expectedBase64Deflate = 'eJxdUUtOQzEMvMoc4OndgT0gJCT2buJWlpI4jePeqZfpm' +
<add> 'XAKLRKbLOzx/HK73q6vOrhCunlF1qIDJhNUeW5I2ozT5OkDlKWLJWkncJG5403HQXAkT3' +
<add> 'Jw29B9uIEmToMukglZ0vS6ociBh4JG8sV4oVLEUCitK2kxq1WzPnChHDzsaGKy491Lofo' +
<add> 'AbWh8do43oeuYhB5EPCjcLjzYJo48KrfQBvnJecNFJvHT1+RSQsGoC7dn2t/xjhduTA1N' +
<add> 'WyQIZR0pbHwMDatnD+crPqKSqGPHp1vnlsWM/07ubf7bheF7kqSj84Bm0R1fYTfaK8vqq' +
<add> 'qfKBtNMhe3OZh6N95CTvMX5HJJi4xOVzCgUOIMSLH7wmeOHaFE4RdpnGavKtrB5xzfO/Ll9';
<add>var expectedBase64Gzip = 'H4sIAAAAAAAAA11RS05DMQy8yhzg6d2BPSAkJPZu4laWkjiN' +
<add> '496pl+mZcAotEpss7PH8crverq86uEK6eUXWogMmE1R5bkjajNPk6QOUpYslaSdwkbnjT' +
<add> 'cdBcCRPcnDb0H24gSZOgy6SCVnS9LqhyIGHgkbyxXihUsRQKK0raTGrVbM+cKEcPOxoYr' +
<add> 'Lj3Uuh+gBtaHx2jjeh65iEHkQ8KNwuPNgmjjwqt9AG+cl5w0Um8dPX5FJCwagLt2fa3/G' +
<add> 'OF25MDU1bJAhlHSlsfAwNq2cP5ys+opKoY8enW+eWxYz/Tu5t/tuF4XuSpKPzgGbRHV9h' +
<add> 'N9ory+qqp8oG00yF7c5mHo33kJO8xfkckmLjE5XMKBQ4gxIsfvCZ44doUThF2mcZq8q2s' +
<add> 'HnHNzRtagj5AQAA';
<ide>
<ide> zlib.deflate(inputString, function(err, buffer) {
<del> assert.equal(buffer.toString('base64'), expectedBase64Deflate, 'deflate encoded string should match');
<add> assert.equal(buffer.toString('base64'), expectedBase64Deflate,
<add> 'deflate encoded string should match');
<ide> });
<ide>
<ide> zlib.gzip(inputString, function(err, buffer) {
<ide> zlib.gzip(inputString, function(err, buffer) {
<ide> // However, decrypting it should definitely yield the same
<ide> // result that we're expecting, and this should match what we get
<ide> // from inflating the known valid deflate data.
<del> zlib.gunzip(buffer, function (err, gunzipped) {
<add> zlib.gunzip(buffer, function(err, gunzipped) {
<ide> assert.equal(gunzipped.toString(), inputString,
<ide> 'Should get original string after gzip/gunzip');
<ide> });
<ide> });
<ide>
<ide> var buffer = new Buffer(expectedBase64Deflate, 'base64');
<ide> zlib.unzip(buffer, function(err, buffer) {
<del> assert.equal(buffer.toString(), inputString, 'decoded inflated string should match');
<add> assert.equal(buffer.toString(), inputString,
<add> 'decoded inflated string should match');
<ide> });
<ide>
<ide> buffer = new Buffer(expectedBase64Gzip, 'base64');
<ide> zlib.unzip(buffer, function(err, buffer) {
<del> assert.equal(buffer.toString(), inputString, 'decoded gunzipped string should match');
<add> assert.equal(buffer.toString(), inputString,
<add> 'decoded gunzipped string should match');
<ide> });
<ide><path>test/simple/test-zlib-random-byte-pipes.js
<ide> var zlib = require('zlib');
<ide>
<ide>
<ide> // emit random bytes, and keep a shasum
<del>function RandomReadStream (opt) {
<add>function RandomReadStream(opt) {
<ide> Stream.call(this);
<ide>
<ide> this.readable = true;
<ide> RandomReadStream.prototype.resume = function() {
<ide> // console.error("rrs resume");
<ide> this._paused = false;
<ide> this.emit('resume');
<del> this._process()
<add> this._process();
<ide> };
<ide>
<ide> RandomReadStream.prototype._process = function() {
<ide> RandomReadStream.prototype._process = function() {
<ide> if (jitter) {
<ide> block += Math.ceil(Math.random() * jitter - (jitter / 2));
<ide> }
<del> block = Math.min(block, this._remaining)
<add> block = Math.min(block, this._remaining);
<ide> var buf = new Buffer(block);
<del> for (var i = 0; i < block; i ++) {
<add> for (var i = 0; i < block; i++) {
<ide> buf[i] = Math.random() * 256;
<ide> }
<ide>
<ide> RandomReadStream.prototype._process = function() {
<ide>
<ide>
<ide> // a filter that just verifies a shasum
<del>function HashStream () {
<add>function HashStream() {
<ide> Stream.call(this);
<ide>
<ide> this.readable = this.writable = true;
<ide> var gunz = zlib.createGunzip();
<ide> inp.pipe(gzip).pipe(gunz).pipe(out);
<ide>
<ide> var didSomething = false;
<del>out.on('data', function (c) {
<add>out.on('data', function(c) {
<ide> didSomething = true;
<ide> console.error('hash=%s', c);
<ide> assert.equal(c, inp._hash, 'hashes should match');
<ide> });
<ide>
<ide> process.on('exit', function() {
<ide> assert(didSomething, 'should have done something');
<del>})
<add>}); | 38 |
Go | Go | update documentation for ringlogger's ring buffer | 3521d534e5c9338ae5605d1228554862e922a8a9 | <ide><path>daemon/logger/ring.go
<ide> func newRing(maxBytes int64) *messageRing {
<ide> }
<ide>
<ide> // Enqueue adds a message to the buffer queue
<del>// If the message is too big for the buffer it drops the oldest messages to make room
<add>// If the message is too big for the buffer it drops the new message.
<ide> // If there are no messages in the queue and the message is still too big, it adds the message anyway.
<ide> func (r *messageRing) Enqueue(m *Message) error {
<ide> mSize := int64(len(m.Line))
<ide><path>daemon/logger/ring_test.go
<ide> func TestRingCap(t *testing.T) {
<ide> }
<ide> }
<ide>
<del> // should have messages in the queue for "5" to "10"
<add> // should have messages in the queue for "0" to "4"
<ide> for i := 0; i < 5; i++ {
<ide> m, err := r.Dequeue()
<ide> if err != nil { | 2 |
Javascript | Javascript | use lazysets for contextmodulefactory | 88d90bea14354ef5e2333891cbdacc2defddaa32 | <ide><path>lib/ContextModuleFactory.js
<ide> const { AsyncSeriesWaterfallHook, SyncWaterfallHook } = require("tapable");
<ide> const ContextModule = require("./ContextModule");
<ide> const ModuleFactory = require("./ModuleFactory");
<ide> const ContextElementDependency = require("./dependencies/ContextElementDependency");
<add>const LazySet = require("./util/LazySet");
<ide> const { cachedSetProperty } = require("./util/cleverMerge");
<ide> const { createFakeHook } = require("./util/deprecation");
<ide> const { join } = require("./util/fs");
<ide> module.exports = class ContextModuleFactory extends ModuleFactory {
<ide> const dependencies = data.dependencies;
<ide> const resolveOptions = data.resolveOptions;
<ide> const dependency = /** @type {ContextDependency} */ (dependencies[0]);
<del> const fileDependencies = new Set();
<del> const missingDependencies = new Set();
<del> const contextDependencies = new Set();
<add> const fileDependencies = new LazySet();
<add> const missingDependencies = new LazySet();
<add> const contextDependencies = new LazySet();
<ide> this.hooks.beforeResolve.callAsync(
<ide> {
<ide> context: context, | 1 |
PHP | PHP | handle new compile config | 1fa90966dd7867da71d03115d5bb6cdb071f8864 | <ide><path>src/Illuminate/Foundation/Console/OptimizeCommand.php
<ide> protected function compileClasses()
<ide> */
<ide> protected function getClassFiles()
<ide> {
<del> $app = $this->laravel;
<del>
<ide> $core = require __DIR__.'/Optimize/config.php';
<ide>
<del> return array_merge($core, $this->laravel['config']['compile']);
<add> $files = array_merge($core, $this->laravel['config']['compile.files']);
<add>
<add> foreach ($this->laravel['config']['compile.providers'] as $provider)
<add> {
<add> $files = array_merge($files, forward_static_call([$provider, 'compiles']));
<add> }
<add>
<add> return $files;
<ide> }
<ide>
<ide> /** | 1 |
Python | Python | add test for issue #955 | 874a3cbb073b8bf79925c3c620e09245afa2157e | <ide><path>spacy/tests/regression/test_issue995.py
<add>import pytest
<add>from ... import load as load_spacy
<add>
<add>@pytest.fixture
<add>def doc():
<add> nlp = load_spacy('en')
<add> return nlp('Does flight number three fifty-four require a connecting flight'
<add> ' to get to Boston?')
<add>
<add>
<add>@pytest.mark.models
<add>def test_issue955(doc):
<add> '''Test that we don't have any nested noun chunks'''
<add> seen_tokens = set()
<add> for np in doc.noun_chunks:
<add> print(np.text, np.root.text, np.root.dep_, np.root.tag_)
<add> for word in np:
<add> key = (word.i, word.text)
<add> assert key not in seen_tokens
<add> seen_tokens.add(key) | 1 |
Text | Text | add documentation for fs.writestream.close() | 5b9074813fa8930d4abcd6e0533647d20d9e3145 | <ide><path>doc/api/fs.md
<ide> added: v0.4.7
<ide> The number of bytes written so far. Does not include data that is still queued
<ide> for writing.
<ide>
<add>#### `writeStream.close([callback])`
<add><!-- YAML
<add>added: v0.9.4
<add>-->
<add>
<add>* `callback` {Function}
<add> * `err` {Error}
<add>
<add>Closes `writeStream`. Optionally accepts a
<add>callback that will be executed once the `writeStream`
<add>is closed.
<add>
<ide> #### `writeStream.path`
<ide> <!-- YAML
<ide> added: v0.1.93 | 1 |
Text | Text | fix typo in more-about-refs.md | 7aa621daeeac103fc7e86e713e0dcd48cfac9819 | <ide><path>docs/docs/08.1-more-about-refs.md
<ide> Refs are a great way to send a message to a particular child instance in a way t
<ide> ### Cautions:
<ide>
<ide> - *Never* access refs inside of any component's render method – or while any component's render method is even running anywhere in the call stack.
<del>- If you want to preserve Google Closure Compiler advanced-mode crushing resilience, make sure to never access as a property what was specified as a string. This means you must access using `this.refs['myRefString']` if your ref was defined as `ref="myRefString"`.
<add>- If you want to preserve Google Closure Compiler advanced-mode crushing resilience, make sure to never access as a property that was specified as a string. This means you must access using `this.refs['myRefString']` if your ref was defined as `ref="myRefString"`.
<ide> - If you have not programmed several apps with React, your first inclination is usually going to be to try to use refs to "make things happen" in your app. If this is the case, take a moment and think more critically about where state should be owned in the component hierarchy. Often, it becomes clear that the proper place to "own" that state is at a higher level in the hierarchy. Placing the state there often eliminates any desire to use `ref`s to "make things happen" – instead, the data flow will usually accomplish your goal.
<ide> - Refs may not be attached to a [stateless function](/react/docs/reusable-components.html#stateless-functions), because the component does not have a backing instance. You can always wrap a stateless component in a standard composite component and attach a ref to the composite component. | 1 |
PHP | PHP | fix logic as per comment from @grahamcampbell | af31256a55b36a8576a6c8f4ea3ed39c97bdc2c8 | <ide><path>src/Illuminate/Validation/Validator.php
<ide> protected function validateUrl($attribute, $value)
<ide> */
<ide> protected function validateActiveUrl($attribute, $value)
<ide> {
<del> if (! ($url = parse_url($value, PHP_URL_HOST))) {
<del> return false;
<add> if ($url = parse_url($value, PHP_URL_HOST)) {
<add> return checkdnsrr($url, 'A');
<ide> }
<ide>
<del> return checkdnsrr($url, 'A');
<add> return false;
<ide> }
<ide>
<ide> /** | 1 |
Ruby | Ruby | use quieter `system_command!` | a74d6060f317c360106d81c461827cb016752d39 | <ide><path>Library/Homebrew/settings.rb
<ide> # typed: true
<ide> # frozen_string_literal: true
<ide>
<add>require "system_command"
<add>
<ide> module Homebrew
<ide> # Helper functions for reading and writing settings.
<ide> #
<ide> # @api private
<ide> module Settings
<ide> extend T::Sig
<add> include SystemCommand::Mixin
<ide>
<ide> module_function
<ide>
<ide> def write(setting, value, repo: HOMEBREW_REPOSITORY)
<ide> return unless (repo/".git/config").exist?
<ide>
<ide> repo.cd do
<del> safe_system "git", "config", "--replace-all", "homebrew.#{setting}", value.to_s
<add> system_command! "git", args: ["config", "--replace-all", "homebrew.#{setting}", value.to_s]
<ide> end
<ide> end
<ide>
<ide> def delete(setting, repo: HOMEBREW_REPOSITORY)
<ide> return if read(setting, repo: repo).blank?
<ide>
<ide> repo.cd do
<del> safe_system "git", "config", "--unset-all", "homebrew.#{setting}"
<add> system_command! "git", args: ["config", "--unset-all", "homebrew.#{setting}"]
<ide> end
<ide> end
<ide> end | 1 |
Javascript | Javascript | use clamp correctly in progress control | cad9114b2e8994fd51c2dd88a15efffbdb0b2b8a | <ide><path>src/js/control-bar/progress-control/progress-control.js
<ide> class ProgressControl extends Component {
<ide> // The default skin has a gap on either side of the `SeekBar`. This means
<ide> // that it's possible to trigger this behavior outside the boundaries of
<ide> // the `SeekBar`. This ensures we stay within it at all times.
<del> seekBarPoint = clamp(0, 1, seekBarPoint);
<add> seekBarPoint = clamp(seekBarPoint, 0, 1);
<ide>
<ide> if (mouseTimeDisplay) {
<ide> mouseTimeDisplay.update(seekBarRect, seekBarPoint); | 1 |
PHP | PHP | set the e-mail subject to something reasonable | bfd01c401f632d5701fee171c24d2b515527a176 | <ide><path>src/Illuminate/Foundation/Auth/ResetsPasswords.php
<ide> public function postEmail(Request $request)
<ide> {
<ide> $this->validate($request, ['email' => 'required']);
<ide>
<del> switch ($response = $this->passwords->sendResetLink($request->only('email')))
<add> $response = $this->passwords->sendResetLink($request->only('email'), function($m)
<add> {
<add> $m->subject($this->getEmailSubject());
<add> });
<add>
<add> switch ($response)
<ide> {
<ide> case PasswordBroker::RESET_LINK_SENT:
<ide> return redirect()->back()->with('status', trans($response));
<ide> public function postEmail(Request $request)
<ide> }
<ide> }
<ide>
<add> /**
<add> * Get the e-mail subject line to be used for the reset link email.
<add> *
<add> * @return string
<add> */
<add> protected function getEmailSubject()
<add> {
<add> return isset($this->subject) ? $this->subject : 'Your Password Reset Link';
<add> }
<add>
<ide> /**
<ide> * Display the password reset view for the given token.
<ide> * | 1 |
Text | Text | trim wording in n-api.md text about exceptions | bdfbbf6c68da7a413d5e7101ce135ea41e4e81f4 | <ide><path>doc/api/n-api.md
<ide> This API can be called even if there is a pending JavaScript exception.
<ide> ### Exceptions
<ide>
<ide> Any N-API function call may result in a pending JavaScript exception. This is
<del>obviously the case for any function that may cause the execution of
<del>JavaScript, but N-API specifies that an exception may be pending
<del>on return from any of the API functions.
<add>the case for any of the API functions, even those that may not cause the
<add>execution of JavaScript.
<ide>
<ide> If the `napi_status` returned by a function is `napi_ok` then no
<ide> exception is pending and no additional action is required. If the | 1 |
PHP | PHP | apply fixes from styleci | 6226955654cbb98146f3acdfcce1b31770888d7f | <ide><path>src/Illuminate/Database/Eloquent/Builder.php
<ide> public function setEagerLoads(array $eagerLoad)
<ide>
<ide> return $this;
<ide> }
<del>
<add>
<ide> /**
<ide> * Indicate that the given relationships should not be eagerly loaded.
<ide> * | 1 |
Ruby | Ruby | use the class method to (un)escape binary values | 00e192ef1f613339b2f0fadd537b5e3c9e9f8cbf | <ide><path>activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
<ide> def table_alias_length
<ide>
<ide> # Escapes binary strings for bytea input to the database.
<ide> def escape_bytea(value)
<del> @connection.escape_bytea(value) if value
<add> PGconn.escape_bytea(value) if value
<ide> end
<ide>
<ide> # Unescapes bytea output from a database to the binary string it represents.
<ide> # NOTE: This is NOT an inverse of escape_bytea! This is only to be used
<ide> # on escaped binary output from database drive.
<ide> def unescape_bytea(value)
<del> @connection.unescape_bytea(value) if value
<add> PGconn.unescape_bytea(value) if value
<ide> end
<ide>
<ide> # Quotes PostgreSQL-specific data types for SQL input. | 1 |
Python | Python | consolidate all array construction tests | e142934543713507bab9418d53290d8896455b79 | <ide><path>numpy/typing/tests/data/fail/array_constructors.py
<ide> np.require(a, requirements=1) # E: No overload variant
<ide> np.require(a, requirements="TEST") # E: incompatible type
<ide>
<add>np.zeros("test") # E: incompatible type
<add>np.zeros() # E: Too few arguments
<add>
<add>np.ones("test") # E: incompatible type
<add>np.ones() # E: Too few arguments
<add>
<add>np.array(0, float, True) # E: Too many positional
<add>
<add>np.linspace(None, 'bob') # E: No overload variant
<add>np.linspace(0, 2, num=10.0) # E: No overload variant
<add>np.linspace(0, 2, endpoint='True') # E: No overload variant
<add>np.linspace(0, 2, retstep=b'False') # E: No overload variant
<add>np.linspace(0, 2, dtype=0) # E: No overload variant
<add>np.linspace(0, 2, axis=None) # E: No overload variant
<add>
<add>np.logspace(None, 'bob') # E: Argument 1
<add>np.logspace(0, 2, base=None) # E: Argument "base"
<add>
<add>np.geomspace(None, 'bob') # E: Argument 1
<ide><path>numpy/typing/tests/data/fail/linspace.py
<del>import numpy as np
<del>
<del>np.linspace(None, 'bob') # E: No overload variant
<del>np.linspace(0, 2, num=10.0) # E: No overload variant
<del>np.linspace(0, 2, endpoint='True') # E: No overload variant
<del>np.linspace(0, 2, retstep=b'False') # E: No overload variant
<del>np.linspace(0, 2, dtype=0) # E: No overload variant
<del>np.linspace(0, 2, axis=None) # E: No overload variant
<del>
<del>np.logspace(None, 'bob') # E: Argument 1
<del>np.logspace(0, 2, base=None) # E: Argument "base"
<del>
<del>np.geomspace(None, 'bob') # E: Argument 1
<ide><path>numpy/typing/tests/data/fail/simple.py
<del>"""Simple expression that should fail with mypy."""
<del>
<del>import numpy as np
<del>
<del># Array creation routines checks
<del>np.zeros("test") # E: incompatible type
<del>np.zeros() # E: Too few arguments
<del>
<del>np.ones("test") # E: incompatible type
<del>np.ones() # E: Too few arguments
<del>
<del>np.array(0, float, True) # E: Too many positional
<ide><path>numpy/typing/tests/data/pass/array_constructors.py
<ide> from typing import List
<ide> import numpy as np
<ide>
<add>class Index:
<add> def __index__(self) -> int:
<add> return 0
<add>
<ide> class SubClass(np.ndarray): ...
<ide>
<ide> A = np.array([1])
<ide> B = A.view(SubClass).copy()
<ide> C = [1]
<ide>
<add>np.array(1, dtype=float)
<add>np.array(1, copy=False)
<add>np.array(1, order='F')
<add>np.array(1, order=None)
<add>np.array(1, subok=True)
<add>np.array(1, ndmin=3)
<add>np.array(1, str, copy=True, order='C', subok=False, ndmin=2)
<add>
<ide> np.asarray(A)
<ide> np.asarray(B)
<ide> np.asarray(C)
<ide> class SubClass(np.ndarray): ...
<ide> np.require(B, requirements="A")
<ide> np.require(C)
<ide>
<add>np.linspace(0, 2)
<add>np.linspace(0.5, [0, 1, 2])
<add>np.linspace([0, 1, 2], 3)
<add>np.linspace(0j, 2)
<add>np.linspace(0, 2, num=10)
<add>np.linspace(0, 2, endpoint=True)
<add>np.linspace(0, 2, retstep=True)
<add>np.linspace(0j, 2j, retstep=True)
<add>np.linspace(0, 2, dtype=bool)
<add>np.linspace([0, 1], [2, 3], axis=Index())
<add>
<add>np.logspace(0, 2, base=2)
<add>np.logspace(0, 2, base=2)
<add>np.logspace(0, 2, base=[1j, 2j], num=2)
<add>
<add>np.geomspace(1, 2)
<ide><path>numpy/typing/tests/data/pass/linspace.py
<del>import numpy as np
<del>
<del>class Index:
<del> def __index__(self) -> int:
<del> return 0
<del>
<del>np.linspace(0, 2)
<del>np.linspace(0.5, [0, 1, 2])
<del>np.linspace([0, 1, 2], 3)
<del>np.linspace(0j, 2)
<del>np.linspace(0, 2, num=10)
<del>np.linspace(0, 2, endpoint=True)
<del>np.linspace(0, 2, retstep=True)
<del>np.linspace(0j, 2j, retstep=True)
<del>np.linspace(0, 2, dtype=bool)
<del>np.linspace([0, 1], [2, 3], axis=Index())
<del>
<del>np.logspace(0, 2, base=2)
<del>np.logspace(0, 2, base=2)
<del>np.logspace(0, 2, base=[1j, 2j], num=2)
<del>
<del>np.geomspace(1, 2)
<ide><path>numpy/typing/tests/data/pass/simple.py
<ide> def ndarray_func(x):
<ide> array == 1
<ide> array.dtype == float
<ide>
<del># Array creation routines checks
<del>np.array(1, dtype=float)
<del>np.array(1, copy=False)
<del>np.array(1, order='F')
<del>np.array(1, order=None)
<del>np.array(1, subok=True)
<del>np.array(1, ndmin=3)
<del>np.array(1, str, copy=True, order='C', subok=False, ndmin=2)
<del>
<ide> ndarray_func(np.zeros([1, 2]))
<ide> ndarray_func(np.ones([1, 2]))
<ide> ndarray_func(np.empty([1, 2]))
<ide><path>numpy/typing/tests/data/reveal/array_constructors.py
<ide> class SubClass(np.ndarray): ...
<ide> reveal_type(np.require(B, requirements="A")) # E: SubClass
<ide> reveal_type(np.require(C)) # E: ndarray
<ide>
<add>reveal_type(np.linspace(0, 10)) # E: numpy.ndarray
<add>reveal_type(np.linspace(0, 10, retstep=True)) # E: Tuple[numpy.ndarray, numpy.inexact]
<add>reveal_type(np.logspace(0, 10)) # E: numpy.ndarray
<add>reveal_type(np.geomspace(1, 10)) # E: numpy.ndarray
<ide><path>numpy/typing/tests/data/reveal/linspace.py
<del>import numpy as np
<del>
<del>reveal_type(np.linspace(0, 10)) # E: numpy.ndarray
<del>reveal_type(np.linspace(0, 10, retstep=True)) # E: Tuple[numpy.ndarray, numpy.inexact]
<del>reveal_type(np.logspace(0, 10)) # E: numpy.ndarray
<del>reveal_type(np.geomspace(1, 10)) # E: numpy.ndarray | 8 |
Python | Python | fix default value for additional param | 52f84add7746a233f1d4c8904344bef35b8fa2d2 | <ide><path>test/testpy/__init__.py
<ide>
<ide> class SimpleTestCase(test.TestCase):
<ide>
<del> def __init__(self, path, file, arch, mode, context, config, additional=[]):
<add> def __init__(self, path, file, arch, mode, context, config, additional=None):
<ide> super(SimpleTestCase, self).__init__(context, path, arch, mode)
<ide> self.file = file
<ide> self.config = config
<ide> self.arch = arch
<ide> self.mode = mode
<ide> self.tmpdir = join(dirname(self.config.root), 'tmp')
<del> self.additional_flags = additional
<add> if additional is not None:
<add> self.additional_flags = additional
<add> else:
<add> self.additional_flags = []
<add>
<ide>
<del>
<ide> def GetLabel(self):
<ide> return "%s %s" % (self.mode, self.GetName())
<ide>
<ide> def GetSource(self):
<ide>
<ide> class SimpleTestConfiguration(test.TestConfiguration):
<ide>
<del> def __init__(self, context, root, section, additional=[]):
<add> def __init__(self, context, root, section, additional=None):
<ide> super(SimpleTestConfiguration, self).__init__(context, root)
<ide> self.section = section
<del> self.additional_flags = additional
<add> if additional is not None:
<add> self.additional_flags = additional
<add> else:
<add> self.additional_flags = []
<ide>
<ide> def Ls(self, path):
<ide> def SelectTest(name):
<ide> def GetTestStatus(self, sections, defs):
<ide> test.ReadConfigurationInto(status_file, sections, defs)
<ide>
<ide> class ParallelTestConfiguration(SimpleTestConfiguration):
<del> def __init__(self, context, root, section, additional=[]):
<add> def __init__(self, context, root, section, additional=None):
<ide> super(ParallelTestConfiguration, self).__init__(context, root, section,
<ide> additional)
<ide>
<ide> def ListTests(self, current_path, path, arch, mode):
<ide> return result
<ide>
<ide> class AddonTestConfiguration(SimpleTestConfiguration):
<del> def __init__(self, context, root, section, additional=[]):
<del> super(AddonTestConfiguration, self).__init__(context, root, section)
<add> def __init__(self, context, root, section, additional=None):
<add> super(AddonTestConfiguration, self).__init__(context, root, section, additional)
<ide>
<ide> def Ls(self, path):
<ide> def SelectTest(name): | 1 |
PHP | PHP | add back annotation | 96ed230d1e927f0d2793cad57142e6af22566054 | <ide><path>src/Mailer/Email.php
<ide> public static function deliver(
<ide> if (is_array($config) && !isset($config['transport'])) {
<ide> $config['transport'] = 'default';
<ide> }
<add> /** @var \Cake\Mailer\Email $instance */
<ide> $instance = new $class($config);
<ide> if ($to !== null) {
<ide> $instance->setTo($to); | 1 |
PHP | PHP | add api endpoint to mailguntransport | 819dbe33b899e174ff70192479f1beaa86ab6707 | <ide><path>src/Illuminate/Mail/Transport/MailgunTransport.php
<ide> class MailgunTransport extends Transport
<ide> protected $key;
<ide>
<ide> /**
<del> * The Mailgun domain.
<add> * The Mailgun email domain.
<ide> *
<ide> * @var string
<ide> */
<ide> class MailgunTransport extends Transport
<ide> *
<ide> * @var string
<ide> */
<del> protected $url;
<add> protected $endpoint;
<ide>
<ide> /**
<ide> * Create a new Mailgun transport instance.
<ide> class MailgunTransport extends Transport
<ide> * @param string $domain
<ide> * @return void
<ide> */
<del> public function __construct(ClientInterface $client, $key, $domain)
<add> public function __construct(ClientInterface $client, $key, $domain, $endpoint = null)
<ide> {
<ide> $this->key = $key;
<ide> $this->client = $client;
<add> $this->endpoint = $endpoint ?? 'api.mailgun.net';
<add>
<ide> $this->setDomain($domain);
<ide> }
<ide>
<ide> public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = nul
<ide>
<ide> $message->setBcc([]);
<ide>
<del> $this->client->post($this->url, $this->payload($message, $to));
<add> $this->client->post(
<add> "https://{$this->endpoint}/v3/{$this->domain}/messages.mime",
<add> $this->payload($message, $to)
<add> );
<ide>
<ide> $this->sendPerformed($message);
<ide>
<ide> public function getDomain()
<ide> */
<ide> public function setDomain($domain)
<ide> {
<del> $url = ! Str::startsWith($domain, ['http://', 'https://'])
<del> ? 'https://api.mailgun.net/v3/'.$domain
<del> : $domain;
<del>
<del> $this->url = $url.'/messages.mime';
<del>
<ide> return $this->domain = $domain;
<ide> }
<ide> }
<ide><path>src/Illuminate/Mail/TransportManager.php
<ide> protected function createMailgunDriver()
<ide>
<ide> return new MailgunTransport(
<ide> $this->guzzle($config),
<del> $config['secret'], $config['domain']
<add> $config['secret'],
<add> $config['domain'],
<add> $config['endpoint'] ?? null
<ide> );
<ide> }
<ide> | 2 |
PHP | PHP | add missing namespace | 33dcddf14c3b60296aff056f8117870f4957d0b4 | <ide><path>src/Routing/Middleware/RoutingMiddleware.php
<ide> use Cake\Cache\Cache;
<ide> use Cake\Core\HttpApplicationInterface;
<ide> use Cake\Core\PluginApplicationInterface;
<add>use Cake\Http\BaseApplication;
<ide> use Cake\Http\MiddlewareQueue;
<ide> use Cake\Http\Runner;
<ide> use Cake\Routing\Exception\RedirectException; | 1 |
PHP | PHP | return abort method | 808420b97de1af11b101db5f26d4891c50d19609 | <ide><path>src/Illuminate/Foundation/Application.php
<ide> use Illuminate\Events\EventServiceProvider;
<ide> use Illuminate\Routing\RoutingServiceProvider;
<ide> use Illuminate\Contracts\Foundation\Application as ApplicationContract;
<add>use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
<ide>
<ide> class Application extends Container implements ApplicationContract {
<ide>
<ide> public function down(Closure $callback)
<ide> $this['events']->listen('illuminate.app.down', $callback);
<ide> }
<ide>
<add> /**
<add> * Throw an HttpException with the given data.
<add> *
<add> * @param int $code
<add> * @param string $message
<add> * @param array $headers
<add> * @throws HttpException
<add> */
<add> public function abort($code, $message = '', array $headers = array())
<add> {
<add> if ($code == 404)
<add> {
<add> throw new NotFoundHttpException($message);
<add> }
<add>
<add> throw new HttpException($code, $message, null, $headers);
<add> }
<add>
<ide> /**
<ide> * Get the service providers that have been loaded.
<ide> * | 1 |
Javascript | Javascript | name anonymous functions in https | 1f45d7aa41291383ce63cca5f80fd2a2a73d7603 | <ide><path>lib/https.js
<ide> function Server(opts, requestListener) {
<ide> this.addListener('request', requestListener);
<ide> }
<ide>
<del> this.addListener('tlsClientError', function(err, conn) {
<add> this.addListener('tlsClientError', function addListener(err, conn) {
<ide> if (!this.emit('clientError', err, conn))
<ide> conn.destroy(err);
<ide> });
<ide> exports.Server = Server;
<ide>
<ide> Server.prototype.setTimeout = http.Server.prototype.setTimeout;
<ide>
<del>exports.createServer = function(opts, requestListener) {
<add>exports.createServer = function createServer(opts, requestListener) {
<ide> return new Server(opts, requestListener);
<ide> };
<ide>
<ide> function Agent(options) {
<ide> inherits(Agent, http.Agent);
<ide> Agent.prototype.createConnection = createConnection;
<ide>
<del>Agent.prototype.getName = function(options) {
<add>Agent.prototype.getName = function getName(options) {
<ide> var name = http.Agent.prototype.getName.call(this, options);
<ide>
<ide> name += ':';
<ide> const globalAgent = new Agent();
<ide> exports.globalAgent = globalAgent;
<ide> exports.Agent = Agent;
<ide>
<del>exports.request = function(options, cb) {
<add>exports.request = function request(options, cb) {
<ide> if (typeof options === 'string') {
<ide> options = url.parse(options);
<ide> if (!options.hostname) {
<ide> exports.request = function(options, cb) {
<ide> return http.request(options, cb);
<ide> };
<ide>
<del>exports.get = function(options, cb) {
<add>exports.get = function get(options, cb) {
<ide> var req = exports.request(options, cb);
<ide> req.end();
<ide> return req; | 1 |
Ruby | Ruby | make a developer command | af8a9ff502107fd02f6911bf7c1ab72889add666 | <ide><path>Library/Contributions/cmd/brew-aspell-dictionaries.rb
<del>require 'open-uri'
<del>require 'resource'
<del>require 'formula'
<del>
<del>dict_url = "http://ftpmirror.gnu.org/aspell/dict"
<del>dict_mirror = "http://ftp.gnu.org/gnu/aspell/dict"
<del>languages = {}
<del>
<del>open("#{dict_url}/0index.html") do |content|
<del> content.each_line do |line|
<del> break if %r{^</table} === line
<del> next unless /^<tr><td><a/ === line
<del>
<del> fields = line.split('"')
<del> lang, path = fields[1], fields[3]
<del> lang.gsub!("-", "_")
<del> languages[lang] = path
<del> end
<del>end
<del>
<del>languages.inject([]) do |resources, (lang, path)|
<del> r = Resource.new(lang)
<del> r.owner = Formulary.factory("aspell")
<del> r.url "#{dict_url}/#{path}"
<del> r.mirror "#{dict_mirror}/#{path}"
<del> resources << r
<del>end.each(&:fetch).each do |r|
<del> puts <<-EOS
<del> resource "#{r.name}" do
<del> url "#{r.url}"
<del> mirror "#{r.mirrors.first}"
<del> sha1 "#{r.cached_download.sha1}"
<del> end
<del>
<del> EOS
<del>end
<ide><path>Library/Homebrew/cmd/aspell-dictionaries.rb
<add>require 'open-uri'
<add>require 'resource'
<add>require 'formula'
<add>
<add>module Homebrew
<add> def aspell_dictionaries
<add> dict_url = "http://ftpmirror.gnu.org/aspell/dict"
<add> dict_mirror = "http://ftp.gnu.org/gnu/aspell/dict"
<add> languages = {}
<add>
<add> open("#{dict_url}/0index.html") do |content|
<add> content.each_line do |line|
<add> break if %r{^</table} === line
<add> next unless /^<tr><td><a/ === line
<add>
<add> fields = line.split('"')
<add> lang, path = fields[1], fields[3]
<add> lang.gsub!("-", "_")
<add> languages[lang] = path
<add> end
<add> end
<add>
<add> languages.inject([]) do |resources, (lang, path)|
<add> r = Resource.new(lang)
<add> r.owner = Formulary.factory("aspell")
<add> r.url "#{dict_url}/#{path}"
<add> r.mirror "#{dict_mirror}/#{path}"
<add> resources << r
<add> end.each(&:fetch).each do |r|
<add> puts <<-EOS
<add> resource "#{r.name}" do
<add> url "#{r.url}"
<add> mirror "#{r.mirrors.first}"
<add> sha1 "#{r.cached_download.sha1}"
<add> end
<add>
<add> EOS
<add> end
<add> end
<add>end | 2 |
Javascript | Javascript | improve getworkersrcfiles (builder.js) | 8ba73cb4de7cad6ef080daf741bb6b1ec829f8b1 | <ide><path>external/builder/builder.js
<ide> function getWorkerSrcFiles(filePath) {
<ide> var src = fs.readFileSync(filePath).toString();
<ide> var reSrcFiles = /var\s+otherFiles\s*=\s*(\[[^\]]*\])/;
<ide> var match = reSrcFiles.exec(src);
<add> if (!match) {
<add> throw new Error('Cannot find otherFiles array in ' + filePath);
<add> }
<add>
<add> var files = match[1].replace(/'/g, '"').replace(/^\s*\/\/.*/gm, '')
<add> .replace(/,\s*]$/, ']');
<ide> try {
<del> var files = JSON.parse(match[1].replace(/'/g, '"'));
<del> var srcFiles = files.filter(function(name) {
<del> return name.indexOf('external') === -1;
<del> });
<del> var externalSrcFiles = files.filter(function(name) {
<del> return name.indexOf('external') > -1;
<del> });
<del> return {
<del> srcFiles: srcFiles,
<del> externalSrcFiles: externalSrcFiles
<del> };
<del> } catch(e) {
<del> return {};
<add> files = JSON.parse(files);
<add> } catch (e) {
<add> throw new Error('Failed to parse otherFiles in ' + filePath + ' as JSON, ' +
<add> e);
<ide> }
<add>
<add> var srcFiles = files.filter(function(name) {
<add> return name.indexOf('external') === -1;
<add> });
<add> var externalSrcFiles = files.filter(function(name) {
<add> return name.indexOf('external') > -1;
<add> });
<add> return {
<add> srcFiles: srcFiles,
<add> externalSrcFiles: externalSrcFiles
<add> };
<ide> }
<ide> exports.getWorkerSrcFiles = getWorkerSrcFiles;
<ide> | 1 |
Python | Python | fix parse_html_dict signature. closes | 6161ac7d07226da1fed643a6957a834b3dc3b619 | <ide><path>rest_framework/utils/html.py
<ide> def parse_html_list(dictionary, prefix=''):
<ide> return [ret[item] for item in sorted(ret.keys())]
<ide>
<ide>
<del>def parse_html_dict(dictionary, prefix):
<add>def parse_html_dict(dictionary, prefix=''):
<ide> """
<ide> Used to support dictionary values in HTML forms.
<ide> | 1 |
Ruby | Ruby | fix strongparameters example [ci skip] | ae057d622fccf7cc5dcd2609a7fe3f1e0589808f | <ide><path>actionpack/lib/action_controller/metal/strong_parameters.rb
<ide> def each_element(object)
<ide> # # It's mandatory to specify the nested attributes that should be whitelisted.
<ide> # # If you use `permit` with just the key that points to the nested attributes hash,
<ide> # # it will return an empty hash.
<del> # params.require(:person).permit(:name, :age, pets_attributes: { :name, :category })
<add> # params.require(:person).permit(:name, :age, pets_attributes: [ :name, :category ])
<ide> # end
<ide> # end
<ide> # | 1 |
PHP | PHP | expand api docs for ruleschecker | c7a649d37e13629bfe3061d5e7cf81c434090b95 | <ide><path>src/ORM/RulesChecker.php
<ide> /**
<ide> * Contains logic for storing and checking rules on entities
<ide> *
<add> * RulesCheckers are used by Table classes to ensure that the
<add> * current entity state satifies the application logic and business rules.
<add> *
<add> * RulesCheckers afford different rules to be applied in the create and update
<add> * scenario.
<add> *
<add> * ### Adding rules
<add> *
<add> * Rules must be callable objects that return true/false depending on whether or
<add> * not the rule has been satisified. You can use RulesChecker::add(), RulesChecker::addCreate()
<add> * and RulesChecker::addUpdate() to add rules to a checker.
<add> *
<add> * ### Running checks
<add> *
<add> * Generally a Table object will invoke the rules objects, but you can manually
<add> * invoke the checks by calling RulesChecker::checkCreate() or RulesChecker::checkUpdate().
<ide> */
<ide> class RulesChecker {
<ide> | 1 |
Javascript | Javascript | handle changes at module boundaries | f11540926d2b28ec1f227a79ec9e95b75708c2e3 | <ide><path>packages/react-refresh/src/ReactFreshRuntime.js
<ide> if (!__DEV__) {
<ide>
<ide> // In old environments, we'll leak previous types after every edit.
<ide> const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
<del>const PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
<ide>
<ide> // We never remove these associations.
<ide> // It's OK to reference families, but use WeakMap/Set for types.
<ide> const allFamiliesByID: Map<string, Family> = new Map();
<del>// $FlowIssue
<del>const allTypes: WeakSet<any> | Set<any> = new PossiblyWeakSet();
<add>const allFamiliesByType: // $FlowIssue
<add>WeakMap<any, Family> | Map<any, Family> = new PossiblyWeakMap();
<ide> const allSignaturesByType: // $FlowIssue
<ide> WeakMap<any, Signature> | Map<any, Signature> = new PossiblyWeakMap();
<ide> // This WeakMap is read by React, so we only put families
<ide> // that have actually been edited here. This keeps checks fast.
<ide> // $FlowIssue
<del>const familiesByType: // $FlowIssue
<add>const updatedFamiliesByType: // $FlowIssue
<ide> WeakMap<any, Family> | Map<any, Family> = new PossiblyWeakMap();
<ide>
<ide> // This is cleared on every performReactRefresh() call.
<ide> function canPreserveStateBetween(prevType, nextType) {
<ide> }
<ide>
<ide> function resolveFamily(type) {
<del> return familiesByType.get(type);
<add> // Only check updated types to keep lookups fast.
<add> return updatedFamiliesByType.get(type);
<ide> }
<ide>
<ide> export function performReactRefresh(): RefreshUpdate | null {
<ide> export function performReactRefresh(): RefreshUpdate | null {
<ide> // Now that we got a real edit, we can create associations
<ide> // that will be read by the React reconciler.
<ide> const prevType = family.current;
<del> familiesByType.set(prevType, family);
<del> familiesByType.set(nextType, family);
<add> updatedFamiliesByType.set(prevType, family);
<add> updatedFamiliesByType.set(nextType, family);
<ide> family.current = nextType;
<ide>
<ide> // Determine whether this should be a re-render or a re-mount.
<ide> export function register(type: any, id: string): void {
<ide> // This can happen in an edge case, e.g. if we register
<ide> // return value of a HOC but it returns a cached component.
<ide> // Ignore anything but the first registration for each type.
<del> if (allTypes.has(type)) {
<add> if (allFamiliesByType.has(type)) {
<ide> return;
<ide> }
<del> allTypes.add(type);
<del>
<ide> // Create family or remember to update it.
<ide> // None of this bookkeeping affects reconciliation
<ide> // until the first performReactRefresh() call above.
<ide> export function register(type: any, id: string): void {
<ide> } else {
<ide> pendingUpdates.push([family, type]);
<ide> }
<add> allFamiliesByType.set(type, family);
<ide>
<ide> // Visit inner types because we might not have registered them.
<ide> if (typeof type === 'object' && type !== null) {
<ide> export function getFamilyByID(id: string): Family | void {
<ide> }
<ide> }
<ide>
<add>export function getFamilyByType(type: any): Family | void {
<add> if (__DEV__) {
<add> return allFamiliesByType.get(type);
<add> } else {
<add> throw new Error(
<add> 'Unexpected call to React Refresh in a production environment.',
<add> );
<add> }
<add>}
<add>
<ide> export function findAffectedHostInstances(
<ide> families: Array<Family>,
<ide> ): Set<Instance> {
<ide><path>packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js
<ide> let freshPlugin = require('react-refresh/babel');
<ide>
<ide> describe('ReactFreshIntegration', () => {
<ide> let container;
<add> let exportsObj;
<ide>
<ide> beforeEach(() => {
<ide> if (__DEV__) {
<ide> describe('ReactFreshIntegration', () => {
<ide> act = require('react-dom/test-utils').act;
<ide> container = document.createElement('div');
<ide> document.body.appendChild(container);
<add> exportsObj = undefined;
<ide> }
<ide> });
<ide>
<ide> describe('ReactFreshIntegration', () => {
<ide> compileDestructuring && 'transform-es2015-destructuring',
<ide> ].filter(Boolean),
<ide> }).code;
<del> const exportsObj = {};
<add> exportsObj = {};
<ide> // eslint-disable-next-line no-new-func
<ide> new Function(
<ide> 'global',
<ide> describe('ReactFreshIntegration', () => {
<ide> '$RefreshSig$',
<ide> compiled,
<ide> )(global, React, exportsObj, $RefreshReg$, $RefreshSig$);
<add> // Module systems will register exports as a fallback.
<add> // This is useful for cases when e.g. a class is exported,
<add> // and we don't want to propagate the update beyond this module.
<add> $RefreshReg$(exportsObj.default, 'exports.default');
<ide> return exportsObj.default;
<ide> }
<ide>
<ide> describe('ReactFreshIntegration', () => {
<ide> }
<ide>
<ide> function patch(source) {
<add> const prevExports = exportsObj;
<ide> execute(source);
<add> const nextExports = exportsObj;
<add>
<add> // Check if exported families have changed.
<add> // (In a real module system we'd do this for *all* exports.)
<add> // For example, this can happen if you convert a class to a function.
<add> // Or if you wrap something in a HOC.
<add> let didExportsChange =
<add> ReactFreshRuntime.getFamilyByType(prevExports.default) !==
<add> ReactFreshRuntime.getFamilyByType(nextExports.default);
<add> if (didExportsChange) {
<add> // In a real module system, we would propagate such updates upwards,
<add> // and re-execute modules that imported this one. (Just like if we edited them.)
<add> // This makes adding/removing/renaming exports re-render references to them.
<add> // Here, we'll just force a re-render using the newer type to emulate this.
<add> const NextComponent = nextExports.default;
<add> act(() => {
<add> ReactDOM.render(<NextComponent />, container);
<add> });
<add> }
<ide> act(() => {
<del> expect(ReactFreshRuntime.performReactRefresh()).not.toBe(null);
<add> const result = ReactFreshRuntime.performReactRefresh();
<add> if (!didExportsChange) {
<add> // Normally we expect that some components got updated in our tests.
<add> expect(result).not.toBe(null);
<add> } else {
<add> // However, we have tests where we convert functions to classes,
<add> // and in those cases it's expected nothing would get updated.
<add> // (Instead, the export change branch above would take care of it.)
<add> }
<ide> });
<ide> expect(ReactFreshRuntime._getMountedRootCount()).toBe(1);
<ide> }
<ide> describe('ReactFreshIntegration', () => {
<ide> }
<ide> });
<ide>
<add> it('remounts when switching export from function to class', () => {
<add> if (__DEV__) {
<add> render(`
<add> export default function App() {
<add> return <h1>A1</h1>;
<add> }
<add> `);
<add> let el = container.firstChild;
<add> expect(el.textContent).toBe('A1');
<add> patch(`
<add> export default function App() {
<add> return <h1>A2</h1>;
<add> }
<add> `);
<add> // Keep state.
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('A2');
<add>
<add> patch(`
<add> export default class App extends React.Component {
<add> render() {
<add> return <h1>B1</h1>
<add> }
<add> }
<add> `);
<add> // Reset (function -> class).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('B1');
<add> patch(`
<add> export default class App extends React.Component {
<add> render() {
<add> return <h1>B2</h1>
<add> }
<add> }
<add> `);
<add> // Reset (classes always do).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('B2');
<add>
<add> patch(`
<add> export default function App() {
<add> return <h1>C1</h1>;
<add> }
<add> `);
<add> // Reset (class -> function).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('C1');
<add> patch(`
<add> export default function App() {
<add> return <h1>C2</h1>;
<add> }
<add> `);
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('C2');
<add>
<add> patch(`
<add> export default function App() {
<add> return <h1>D1</h1>;
<add> }
<add> `);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('D1');
<add> patch(`
<add> export default function App() {
<add> return <h1>D2</h1>;
<add> }
<add> `);
<add> // Keep state.
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('D2');
<add> }
<add> });
<add>
<add> it('remounts when switching export from class to function', () => {
<add> if (__DEV__) {
<add> render(`
<add> export default class App extends React.Component {
<add> render() {
<add> return <h1>A1</h1>
<add> }
<add> }
<add> `);
<add> let el = container.firstChild;
<add> expect(el.textContent).toBe('A1');
<add> patch(`
<add> export default class App extends React.Component {
<add> render() {
<add> return <h1>A2</h1>
<add> }
<add> }
<add> `);
<add> // Reset (classes always do).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('A2');
<add>
<add> patch(`
<add> export default function App() {
<add> return <h1>B1</h1>;
<add> }
<add> `);
<add> // Reset (class -> function).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('B1');
<add> patch(`
<add> export default function App() {
<add> return <h1>B2</h1>;
<add> }
<add> `);
<add> // Keep state.
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('B2');
<add>
<add> patch(`
<add> export default class App extends React.Component {
<add> render() {
<add> return <h1>C1</h1>
<add> }
<add> }
<add> `);
<add> // Reset (function -> class).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('C1');
<add> }
<add> });
<add>
<add> it('remounts when wrapping export in a HOC', () => {
<add> if (__DEV__) {
<add> render(`
<add> export default function App() {
<add> return <h1>A1</h1>;
<add> }
<add> `);
<add> let el = container.firstChild;
<add> expect(el.textContent).toBe('A1');
<add> patch(`
<add> export default function App() {
<add> return <h1>A2</h1>;
<add> }
<add> `);
<add> // Keep state.
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('A2');
<add>
<add> patch(`
<add> function hoc(Inner) {
<add> return function Wrapper() {
<add> return <Inner />;
<add> }
<add> }
<add>
<add> function App() {
<add> return <h1>B1</h1>;
<add> }
<add>
<add> export default hoc(App);
<add> `);
<add> // Reset (wrapped in HOC).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('B1');
<add> patch(`
<add> function hoc(Inner) {
<add> return function Wrapper() {
<add> return <Inner />;
<add> }
<add> }
<add>
<add> function App() {
<add> return <h1>B2</h1>;
<add> }
<add>
<add> export default hoc(App);
<add> `);
<add> // Keep state.
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('B2');
<add>
<add> patch(`
<add> export default function App() {
<add> return <h1>C1</h1>;
<add> }
<add> `);
<add> // Reset (unwrapped).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('C1');
<add> patch(`
<add> export default function App() {
<add> return <h1>C2</h1>;
<add> }
<add> `);
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('C2');
<add> }
<add> });
<add>
<add> it('remounts when wrapping export in memo()', () => {
<add> if (__DEV__) {
<add> render(`
<add> export default function App() {
<add> return <h1>A1</h1>;
<add> }
<add> `);
<add> let el = container.firstChild;
<add> expect(el.textContent).toBe('A1');
<add> patch(`
<add> export default function App() {
<add> return <h1>A2</h1>;
<add> }
<add> `);
<add> // Keep state.
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('A2');
<add>
<add> patch(`
<add> function App() {
<add> return <h1>B1</h1>;
<add> }
<add>
<add> export default React.memo(App);
<add> `);
<add> // Reset (wrapped in HOC).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('B1');
<add> patch(`
<add> function App() {
<add> return <h1>B2</h1>;
<add> }
<add>
<add> export default React.memo(App);
<add> `);
<add> // Keep state.
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('B2');
<add>
<add> patch(`
<add> export default function App() {
<add> return <h1>C1</h1>;
<add> }
<add> `);
<add> // Reset (unwrapped).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('C1');
<add> patch(`
<add> export default function App() {
<add> return <h1>C2</h1>;
<add> }
<add> `);
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('C2');
<add> }
<add> });
<add>
<add> it('remounts when wrapping export in forwardRef()', () => {
<add> if (__DEV__) {
<add> render(`
<add> export default function App() {
<add> return <h1>A1</h1>;
<add> }
<add> `);
<add> let el = container.firstChild;
<add> expect(el.textContent).toBe('A1');
<add> patch(`
<add> export default function App() {
<add> return <h1>A2</h1>;
<add> }
<add> `);
<add> // Keep state.
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('A2');
<add>
<add> patch(`
<add> function App() {
<add> return <h1>B1</h1>;
<add> }
<add>
<add> export default React.forwardRef(App);
<add> `);
<add> // Reset (wrapped in HOC).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('B1');
<add> patch(`
<add> function App() {
<add> return <h1>B2</h1>;
<add> }
<add>
<add> export default React.forwardRef(App);
<add> `);
<add> // Keep state.
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('B2');
<add>
<add> patch(`
<add> export default function App() {
<add> return <h1>C1</h1>;
<add> }
<add> `);
<add> // Reset (unwrapped).
<add> expect(container.firstChild).not.toBe(el);
<add> el = container.firstChild;
<add> expect(el.textContent).toBe('C1');
<add> patch(`
<add> export default function App() {
<add> return <h1>C2</h1>;
<add> }
<add> `);
<add> expect(container.firstChild).toBe(el);
<add> expect(el.textContent).toBe('C2');
<add> }
<add> });
<add>
<ide> describe('with inline requires', () => {
<ide> beforeEach(() => {
<ide> global.FakeModuleSystem = {}; | 2 |
Ruby | Ruby | add test case for the `|` token in journey scanner | 3928e52bf849b618584540ee9229c7974f5c9de1 | <ide><path>actionpack/test/journey/route/definition/scanner_test.rb
<ide> def setup
<ide> ["/~page", [[:SLASH, "/"], [:LITERAL, "~page"]]],
<ide> ["/pa-ge", [[:SLASH, "/"], [:LITERAL, "pa-ge"]]],
<ide> ["/:page", [[:SLASH, "/"], [:SYMBOL, ":page"]]],
<add> ["/:page|*foo", [
<add> [:SLASH, "/"],
<add> [:SYMBOL, ":page"],
<add> [:OR, "|"],
<add> [:STAR, "*foo"]
<add> ]],
<ide> ["/(:page)", [
<ide> [:SLASH, "/"],
<ide> [:LPAREN, "("], | 1 |
Javascript | Javascript | fix bug with enablelegacyfbsupport click handlers | e387c98ffabdf3808d34910b4493093dd975ec69 | <ide><path>packages/react-dom/src/__tests__/ReactDOM-test.js
<ide> let React;
<ide> let ReactDOM;
<ide> let ReactDOMServer;
<ide> let ReactTestUtils;
<del>const ReactFeatureFlags = require('shared/ReactFeatureFlags');
<ide>
<ide> describe('ReactDOM', () => {
<ide> beforeEach(() => {
<ide> describe('ReactDOM', () => {
<ide> document.body.appendChild(container);
<ide> try {
<ide> ReactDOM.render(<Wrapper />, container);
<del> let expected;
<del>
<del> if (ReactFeatureFlags.enableLegacyFBSupport) {
<del> // We expect to duplicate the 2nd handler because this test is
<del> // not really designed around how the legacy FB support system works.
<del> // This is because the above test sync fires a click() event
<del> // during that of another click event, which causes the FB support system
<del> // to duplicate adding an event listener. In practice this would never
<del> // happen, as we only apply the legacy FB logic for "click" events,
<del> // which would never stack this way in product code.
<del> expected = [
<del> '1st node clicked',
<del> "2nd node clicked imperatively from 1st's handler",
<del> "2nd node clicked imperatively from 1st's handler",
<del> ];
<del> } else {
<del> expected = [
<del> '1st node clicked',
<del> "2nd node clicked imperatively from 1st's handler",
<del> ];
<del> }
<add>
<add> const expected = [
<add> '1st node clicked',
<add> "2nd node clicked imperatively from 1st's handler",
<add> ];
<ide>
<ide> expect(actual).toEqual(expected);
<ide> } finally {
<ide><path>packages/react-dom/src/events/DOMModernPluginEventSystem.js
<ide> function addTrappedEventListener(
<ide> if (enableLegacyFBSupport && isDeferredListenerForLegacyFBSupport) {
<ide> const originalListener = listener;
<ide> listener = function(...p) {
<del> try {
<del> return originalListener.apply(this, p);
<del> } finally {
<del> removeEventListener(
<del> targetContainer,
<del> rawEventName,
<del> unsubscribeListener,
<del> isCapturePhaseListener,
<del> );
<del> }
<add> removeEventListener(
<add> targetContainer,
<add> rawEventName,
<add> unsubscribeListener,
<add> isCapturePhaseListener,
<add> );
<add> return originalListener.apply(this, p);
<ide> };
<ide> }
<ide> if (isCapturePhaseListener) {
<ide><path>packages/react-dom/src/events/__tests__/DOMModernPluginEventSystem-test.internal.js
<ide> describe('DOMModernPluginEventSystem', () => {
<ide> expect(log[5]).toEqual(['bubble', buttonElement]);
<ide> });
<ide>
<add> it('handle propagation of click events combined with sync clicks', () => {
<add> const buttonRef = React.createRef();
<add> let clicks = 0;
<add>
<add> function Test() {
<add> const inputRef = React.useRef(null);
<add> return (
<add> <div>
<add> <button
<add> ref={buttonRef}
<add> onClick={() => {
<add> // Sync click
<add> inputRef.current.click();
<add> }}
<add> />
<add> <input
<add> ref={inputRef}
<add> onClick={() => {
<add> clicks++;
<add> }}
<add> />
<add> </div>
<add> );
<add> }
<add>
<add> ReactDOM.render(<Test />, container);
<add>
<add> const buttonElement = buttonRef.current;
<add> dispatchClickEvent(buttonElement);
<add>
<add> expect(clicks).toBe(1);
<add> });
<add>
<ide> it('handle propagation of click events between roots', () => {
<ide> const buttonRef = React.createRef();
<ide> const divRef = React.createRef(); | 3 |
Python | Python | add return types for tf gptj, xlm, and xlnet | e4d56e818a08b0df2827fd31d053e776b9cd825e | <ide><path>src/transformers/models/gptj/modeling_tf_gptj.py
<ide> def call(
<ide> output_hidden_states=None,
<ide> return_dict=None,
<ide> training=False,
<del> ):
<add> ) -> Union[TFBaseModelOutputWithPast, Tuple[tf.Tensor]]:
<ide>
<ide> if input_ids is not None and inputs_embeds is not None:
<ide> raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
<ide> def call(
<ide> output_hidden_states: Optional[bool] = None,
<ide> return_dict: Optional[bool] = None,
<ide> training: Optional[bool] = False,
<del> ):
<add> ) -> Union[TFBaseModelOutputWithPast, Tuple[tf.Tensor]]:
<ide> r"""
<ide> use_cache (`bool`, *optional*, defaults to `True`):
<ide> If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
<ide> def call(
<ide> output_hidden_states: Optional[bool] = None,
<ide> return_dict: Optional[bool] = None,
<ide> training: Optional[bool] = False,
<del> ):
<add> ) -> Union[TFCausalLMOutputWithPast, Tuple[tf.Tensor]]:
<ide> r"""
<ide> labels (`np.ndarray` or `tf.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
<ide> Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set
<ide> def call(
<ide> output_hidden_states: Optional[bool] = None,
<ide> return_dict: Optional[bool] = None,
<ide> training: Optional[bool] = False,
<del> ):
<add> ) -> Union[TFSequenceClassifierOutputWithPast, Tuple[tf.Tensor]]:
<ide> r"""
<ide> labels (`np.ndarray` or `tf.Tensor` of shape `(batch_size,)`, *optional*):
<ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
<ide> def call(
<ide> output_hidden_states: Optional[bool] = None,
<ide> return_dict: Optional[bool] = None,
<ide> training: Optional[bool] = False,
<del> ):
<add> ) -> Union[TFQuestionAnsweringModelOutput, Tuple[tf.Tensor]]:
<ide> r"""
<ide> start_positions (`np.ndarray` or `tf.Tensor` of shape `(batch_size,)`, *optional*):
<ide> Labels for position (index) of the start of the labelled span for computing the token classification loss.
<ide><path>src/transformers/models/xlm/modeling_tf_xlm.py
<ide> def call(
<ide> output_hidden_states=None,
<ide> return_dict=None,
<ide> training=False,
<del> ):
<add> ) -> Union[TFBaseModelOutput, Tuple[tf.Tensor]]:
<ide> # removed: src_enc=None, src_len=None
<ide>
<ide> if input_ids is not None and inputs_embeds is not None:
<ide> def call(
<ide> output_hidden_states=None,
<ide> return_dict=None,
<ide> training=False,
<del> ):
<add> ) -> Union[TFBaseModelOutput, Tuple[tf.Tensor]]:
<ide> outputs = self.transformer(
<ide> input_ids=input_ids,
<ide> attention_mask=attention_mask,
<ide> def call(
<ide> output_hidden_states: Optional[bool] = None,
<ide> return_dict: Optional[bool] = None,
<ide> training: bool = False,
<del> ):
<add> ) -> Union[TFXLMWithLMHeadModelOutput, Tuple[tf.Tensor]]:
<ide> transformer_outputs = self.transformer(
<ide> input_ids=input_ids,
<ide> attention_mask=attention_mask,
<ide> def call(
<ide> return_dict: Optional[bool] = None,
<ide> labels: Optional[Union[np.ndarray, tf.Tensor]] = None,
<ide> training: bool = False,
<del> ):
<add> ) -> Union[TFSequenceClassifierOutput, Tuple[tf.Tensor]]:
<ide> r"""
<ide> labels (`tf.Tensor` of shape `(batch_size,)`, *optional*):
<ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
<ide> def call(
<ide> return_dict: Optional[bool] = None,
<ide> labels: Optional[Union[np.ndarray, tf.Tensor]] = None,
<ide> training: bool = False,
<del> ):
<add> ) -> Union[TFMultipleChoiceModelOutput, Tuple[tf.Tensor]]:
<ide> if input_ids is not None:
<ide> num_choices = shape_list(input_ids)[1]
<ide> seq_length = shape_list(input_ids)[2]
<ide> def call(
<ide> return_dict: Optional[bool] = None,
<ide> labels: Optional[Union[np.ndarray, tf.Tensor]] = None,
<ide> training: bool = False,
<del> ):
<add> ) -> Union[TFTokenClassifierOutput, Tuple[tf.Tensor]]:
<ide> r"""
<ide> labels (`tf.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
<ide> Labels for computing the token classification loss. Indices should be in `[0, ..., config.num_labels - 1]`.
<ide> def call(
<ide> start_positions: Optional[Union[np.ndarray, tf.Tensor]] = None,
<ide> end_positions: Optional[Union[np.ndarray, tf.Tensor]] = None,
<ide> training: bool = False,
<del> ):
<add> ) -> Union[TFQuestionAnsweringModelOutput, Tuple[tf.Tensor]]:
<ide> r"""
<ide> start_positions (`tf.Tensor` of shape `(batch_size,)`, *optional*):
<ide> Labels for position (index) of the start of the labelled span for computing the token classification loss.
<ide><path>src/transformers/models/xlnet/modeling_tf_xlnet.py
<ide> def call(
<ide> output_hidden_states: Optional[bool] = None,
<ide> return_dict: Optional[bool] = None,
<ide> training: bool = False,
<del> ):
<add> ) -> Union[TFXLNetModelOutput, Tuple[tf.Tensor]]:
<ide> outputs = self.transformer(
<ide> input_ids=input_ids,
<ide> attention_mask=attention_mask, | 3 |
Text | Text | update weights for distilgpt2 | 7ce83b4931fe675955e82e1aac07e6c8fe972c9c | <ide><path>examples/distillation/README.md
<ide> This folder contains the original code used to train Distil* as well as examples
<ide>
<ide> Distil* is a class of compressed models that started with DistilBERT. DistilBERT stands for Distillated-BERT. DistilBERT is a small, fast, cheap and light Transformer model based on Bert architecture. It has 40% less parameters than `bert-base-uncased`, runs 60% faster while preserving 97% of BERT's performances as measured on the GLUE language understanding benchmark. DistilBERT is trained using knowledge distillation, a technique to compress a large model called the teacher into a smaller model called the student. By distillating Bert, we obtain a smaller Transformer model that bears a lot of similarities with the original BERT model while being lighter, smaller and faster to run. DistilBERT is thus an interesting option to put large-scaled trained Transformer model into production.
<ide>
<del>We have applied the same method to GPT2 and release the weights of the compressed model. On the [WikiText-103](https://blog.einstein.ai/the-wikitext-long-term-dependency-language-modeling-dataset/) benchmark, GPT2 reaches a perplexity on the test of 15.8 compared to 19.3 for DistilGPT2 (after fine-tuning on the train set).
<add>We have applied the same method to GPT2 and release the weights of the compressed model. On the [WikiText-103](https://blog.einstein.ai/the-wikitext-long-term-dependency-language-modeling-dataset/) benchmark, GPT2 reaches a perplexity on the test set of 15.0 compared to 18.5 for DistilGPT2 (after fine-tuning on the train set).
<ide>
<ide> For more information on DistilBERT, please refer to our [NeurIPS workshop paper](https://arxiv.org/abs/1910.01108). The paper superseeds our [previous blogpost](https://medium.com/huggingface/distilbert-8cf3380435b5) with a different distillation loss and better performances.
<ide> | 1 |
Python | Python | fix sparse checkout for 'spacy project' | 6bfb1b3a29fa556daad7e81ab4980fb3a54c616e | <ide><path>spacy/cli/_util.py
<ide> def ensure_pathy(path):
<ide> return Pathy(path)
<ide>
<ide>
<del>def git_sparse_checkout(
<del> repo: str, subpath: str, dest: Path, *, branch: Optional[str] = None
<del>):
<add>def git_sparse_checkout(repo: str, subpath: str, dest: Path, *, branch: str = "master"):
<ide> if dest.exists():
<ide> msg.fail("Destination of checkout must not exist", exits=1)
<ide> if not dest.parent.exists():
<ide> def git_sparse_checkout(
<ide> # This is the "clone, but don't download anything" part.
<ide> cmd = (
<ide> f"git clone {repo} {tmp_dir} --no-checkout --depth 1 "
<del> "--filter=blob:none" # <-- The key bit
<add> f"--filter=blob:none " # <-- The key bit
<add> f"-b {branch}"
<ide> )
<del> if branch is not None:
<del> cmd = f"{cmd} -b {branch}"
<ide> run_command(cmd, capture=True)
<ide> # Now we need to find the missing filenames for the subpath we want.
<ide> # Looking for this 'rev-list' command in the git --help? Hah.
<ide> cmd = f"git -C {tmp_dir} rev-list --objects --all --missing=print -- {subpath}"
<ide> ret = run_command(cmd, capture=True)
<del> missings = "\n".join([x[1:] for x in ret.stdout.split() if x.startswith("?")])
<add> repo = _from_http_to_git(repo)
<ide> # Now pass those missings into another bit of git internals
<del> run_command(
<del> f"git -C {tmp_dir} fetch-pack --stdin {repo}", capture=True, stdin=missings
<del> )
<add> missings = " ".join([x[1:] for x in ret.stdout.split() if x.startswith("?")])
<add> cmd = f"git -C {tmp_dir} fetch-pack {repo} {missings}"
<add> run_command(cmd, capture=True)
<ide> # And finally, we can checkout our subpath
<del> run_command(f"git -C {tmp_dir} checkout {branch} {subpath}")
<add> cmd = f"git -C {tmp_dir} checkout {branch} {subpath}"
<add> run_command(cmd)
<ide> # We need Path(name) to make sure we also support subdirectories
<ide> shutil.move(str(tmp_dir / Path(subpath)), str(dest))
<add>
<add>
<add>def _from_http_to_git(repo):
<add> if repo.startswith("http://"):
<add> repo = repo.replace(r"http://", r"https://")
<add> if repo.startswith(r"https://"):
<add> repo = repo.replace("https://", "git@").replace("/", ":", 1)
<add> repo = f"{repo}.git"
<add> return repo
<ide><path>spacy/cli/project/clone.py
<ide> def project_clone(name: str, dest: Path, *, repo: str = about.__projects__) -> N
<ide> git_sparse_checkout(repo, name, dest)
<ide> except subprocess.CalledProcessError:
<ide> err = f"Could not clone '{name}' from repo '{repo_name}'"
<del> msg.fail(err)
<add> msg.fail(err, exits=1)
<ide> msg.good(f"Cloned '{name}' from {repo_name}", project_dir)
<ide> if not (project_dir / PROJECT_FILE).exists():
<ide> msg.warn(f"No {PROJECT_FILE} found in directory")
<ide> def check_clone(name: str, dest: Path, repo: str) -> None:
<ide> if not dest.parent.exists():
<ide> # We're not creating parents, parent dir should exist
<ide> msg.fail(
<del> f"Can't clone project, parent directory doesn't exist: {dest.parent}",
<add> f"Can't clone project, parent directory doesn't exist: {dest.parent}. "
<add> f"Create the necessary folder(s) first before continuing.",
<ide> exits=1,
<ide> ) | 2 |
Ruby | Ruby | pull buffer assignment up | ec5c946138f63dc975341d6521587adc74f6b441 | <ide><path>actionview/lib/action_view/base.rb
<ide> def initialize(context = nil, assigns = {}, controller = nil, formats = nil) #:n
<ide>
<ide> def run(method, locals, buffer, &block)
<ide> _old_output_buffer = @output_buffer
<add> @output_buffer = buffer
<ide> send(method, locals, buffer, &block)
<ide> ensure
<ide> @output_buffer = _old_output_buffer
<ide><path>actionview/lib/action_view/template/handlers/erb/erubi.rb
<ide> def initialize(input, properties = {})
<ide>
<ide> # Dup properties so that we don't modify argument
<ide> properties = Hash[properties]
<del> properties[:preamble] = "@output_buffer = output_buffer;"
<add> properties[:preamble] = ""
<ide> properties[:postamble] = "@output_buffer.to_s"
<ide> properties[:bufvar] = "@output_buffer"
<ide> properties[:escapefunc] = "" | 2 |
Javascript | Javascript | fix legend tests and disable other failing tests | eb14481d02b42a35836306af6ff95baf022df360 | <ide><path>gulpfile.js
<ide> var preTestFiles = [
<ide>
<ide> var testFiles = [
<ide> './test/mockContext.js',
<del> './test/*.js'
<add> './test/*.js',
<add>
<add> // Disable tests which need to be rewritten based on changes introduced by
<add> // the following changes: https://github.com/chartjs/Chart.js/pull/2346
<add> '!./test/controller.line.tests.js',
<add> '!./test/controller.radar.tests.js',
<add> '!./test/core.layoutService.tests.js',
<add> '!./test/defaultConfig.tests.js',
<add> '!./test/scale.linear.tests.js',
<add> '!./test/scale.radialLinear.tests.js'
<ide> ];
<ide>
<ide> gulp.task('build', buildTask);
<ide><path>test/controller.bar.tests.js
<ide> describe('Bar controller tests', function() {
<ide> { b: 290, w: 91, x: 322, y: 161 },
<ide> { b: 290, w: 91, x: 436, y: 419 }
<ide> ].forEach(function(values, i) {
<del> expect(meta0.data[i]._model.base).toBeCloseToPixel(values.b);
<del> expect(meta0.data[i]._model.width).toBeCloseToPixel(values.w);
<del> expect(meta0.data[i]._model.x).toBeCloseToPixel(values.x);
<del> expect(meta0.data[i]._model.y).toBeCloseToPixel(values.y);
<add> expect(meta0.data[i]._model.base).toBeCloseToPixel(values.b);
<add> expect(meta0.data[i]._model.width).toBeCloseToPixel(values.w);
<add> expect(meta0.data[i]._model.x).toBeCloseToPixel(values.x);
<add> expect(meta0.data[i]._model.y).toBeCloseToPixel(values.y);
<ide> });
<ide>
<ide> var meta1 = chart.getDatasetMeta(1);
<ide> describe('Bar controller tests', function() {
<ide> { b: 161, w: 91, x: 322, y: 161 },
<ide> { b: 419, w: 91, x: 436, y: 471 }
<ide> ].forEach(function(values, i) {
<del> expect(meta1.data[i]._model.base).toBeCloseToPixel(values.b);
<del> expect(meta1.data[i]._model.width).toBeCloseToPixel(values.w);
<del> expect(meta1.data[i]._model.x).toBeCloseToPixel(values.x);
<del> expect(meta1.data[i]._model.y).toBeCloseToPixel(values.y);
<add> expect(meta1.data[i]._model.base).toBeCloseToPixel(values.b);
<add> expect(meta1.data[i]._model.width).toBeCloseToPixel(values.w);
<add> expect(meta1.data[i]._model.x).toBeCloseToPixel(values.x);
<add> expect(meta1.data[i]._model.y).toBeCloseToPixel(values.y);
<ide> });
<ide> });
<ide>
<ide><path>test/core.layoutService.tests.js
<ide> describe('Test the layout service', function() {
<ide> expect(chart.scales.xScale1.bottom).toBeCloseToPixel(512);
<ide> expect(chart.scales.xScale1.left).toBeCloseToPixel(45);
<ide> expect(chart.scales.xScale1.right).toBeCloseToPixel(512);
<del> expect(chart.scales.x1.top).toBeCloseToPixel(484);
<add> expect(chart.scales.xScale1.top).toBeCloseToPixel(484);
<ide>
<ide> expect(chart.scales.xScale2.bottom).toBeCloseToPixel(28);
<ide> expect(chart.scales.xScale2.left).toBeCloseToPixel(0);
<ide><path>test/core.legend.tests.js
<ide> // Test the rectangle element
<del>
<ide> describe('Legend block tests', function() {
<add>
<add> beforeEach(function() {
<add> window.addDefaultMatchers(jasmine);
<add> });
<add>
<add> afterEach(function() {
<add> window.releaseAllCharts();
<add> });
<add>
<ide> it('Should be constructed', function() {
<ide> var legend = new Chart.Legend({});
<ide> expect(legend).not.toBe(undefined);
<ide> describe('Legend block tests', function() {
<ide> });
<ide>
<ide> it('should update correctly', function() {
<del> var chart = {
<add> var chart = window.acquireChart({
<add> type: 'bar',
<ide> data: {
<ide> datasets: [{
<ide> label: 'dataset1',
<ide> backgroundColor: '#f31',
<ide> borderCapStyle: 'butt',
<ide> borderDash: [2, 2],
<del> borderDashOffset: 5.5
<add> borderDashOffset: 5.5,
<add> data: []
<ide> }, {
<ide> label: 'dataset2',
<ide> hidden: true,
<ide> borderJoinStyle: 'miter',
<add> data: []
<ide> }, {
<ide> label: 'dataset3',
<ide> borderWidth: 10,
<del> borderColor: 'green'
<del> }]
<add> borderColor: 'green',
<add> data: []
<add> }],
<add> labels: []
<ide> }
<del> };
<del> var context = window.createMockContext();
<del> var options = Chart.helpers.clone(Chart.defaults.global.legend);
<del> var legend = new Chart.Legend({
<del> chart: chart,
<del> ctx: context,
<del> options: options
<ide> });
<ide>
<del> var minSize = legend.update(400, 200);
<del> expect(minSize).toEqual({
<del> width: 400,
<del> height: 54
<del> });
<del> expect(legend.legendItems).toEqual([{
<add> expect(chart.legend.legendItems).toEqual([{
<ide> text: 'dataset1',
<ide> fillStyle: '#f31',
<del> hidden: undefined,
<add> hidden: false,
<ide> lineCap: 'butt',
<ide> lineDash: [2, 2],
<ide> lineDashOffset: 5.5,
<ide> describe('Legend block tests', function() {
<ide> }, {
<ide> text: 'dataset3',
<ide> fillStyle: undefined,
<del> hidden: undefined,
<add> hidden: false,
<ide> lineCap: undefined,
<ide> lineDash: undefined,
<ide> lineDashOffset: undefined,
<ide> describe('Legend block tests', function() {
<ide> });
<ide>
<ide> it('should draw correctly', function() {
<del> var chart = {
<add> var chart = window.acquireChart({
<add> type: 'bar',
<ide> data: {
<ide> datasets: [{
<ide> label: 'dataset1',
<ide> backgroundColor: '#f31',
<ide> borderCapStyle: 'butt',
<ide> borderDash: [2, 2],
<del> borderDashOffset: 5.5
<add> borderDashOffset: 5.5,
<add> data: []
<ide> }, {
<ide> label: 'dataset2',
<ide> hidden: true,
<ide> borderJoinStyle: 'miter',
<add> data: []
<ide> }, {
<ide> label: 'dataset3',
<ide> borderWidth: 10,
<del> borderColor: 'green'
<del> }]
<add> borderColor: 'green',
<add> data: []
<add> }],
<add> labels: []
<ide> }
<del> };
<del> var context = window.createMockContext();
<del> var options = Chart.helpers.clone(Chart.defaults.global.legend);
<del> var legend = new Chart.Legend({
<del> chart: chart,
<del> ctx: context,
<del> options: options
<ide> });
<ide>
<del> var minSize = legend.update(400, 200);
<del> legend.left = 50;
<del> legend.top = 100;
<del> legend.right = legend.left + minSize.width;
<del> legend.bottom = legend.top + minSize.height;
<add> expect(chart.legend.legendHitBoxes.length).toBe(3);
<ide>
<del> legend.draw();
<del> expect(legend.legendHitBoxes).toEqual([{
<del> left: 114,
<del> top: 110,
<del> width: 126,
<del> height: 12
<del> }, {
<del> left: 250,
<del> top: 110,
<del> width: 126,
<del> height: 12
<del> }, {
<del> left: 182,
<del> top: 132,
<del> width: 126,
<del> height: 12
<del> }]);
<del> expect(context.getCalls()).toEqual([{
<add> [ { h: 12, l: 101, t: 10, w: 93 },
<add> { h: 12, l: 205, t: 10, w: 93 },
<add> { h: 12, l: 308, t: 10, w: 93 }
<add> ].forEach(function(expected, i) {
<add> expect(chart.legend.legendHitBoxes[i].height).toBeCloseToPixel(expected.h);
<add> expect(chart.legend.legendHitBoxes[i].left).toBeCloseToPixel(expected.l);
<add> expect(chart.legend.legendHitBoxes[i].top).toBeCloseToPixel(expected.t);
<add> expect(chart.legend.legendHitBoxes[i].width).toBeCloseToPixel(expected.w);
<add> })
<add>
<add> // NOTE(SB) We should get ride of the following tests and use image diff instead.
<add> // For now, as discussed with Evert Timberg, simply comment out.
<add> // See http://humblesoftware.github.io/js-imagediff/test.html
<add> /*chart.legend.ctx = window.createMockContext();
<add> chart.update();
<add>
<add> expect(chart.legend.ctx .getCalls()).toEqual([{
<add> "name": "measureText",
<add> "args": ["dataset1"]
<add> }, {
<add> "name": "measureText",
<add> "args": ["dataset2"]
<add> }, {
<add> "name": "measureText",
<add> "args": ["dataset3"]
<add> }, {
<ide> "name": "measureText",
<ide> "args": ["dataset1"]
<ide> }, {
<ide> describe('Legend block tests', function() {
<ide> }, {
<ide> "name": "fillText",
<ide> "args": ["dataset3", 228, 132]
<del> }]);
<add> }]);*/
<ide> });
<ide> }); | 4 |
Javascript | Javascript | add new 'reiwa' era | 709579ab504c93657826cfa1954e37ff2647d7df | <ide><path>src/locale/ja.js
<ide> import moment from '../moment';
<ide>
<ide> export default moment.defineLocale('ja', {
<ide> eras: [
<add> {
<add> since: '2019-05-01',
<add> offset: 1,
<add> name: '令和',
<add> narrow: '㋿',
<add> abbr: 'R',
<add> },
<ide> {
<ide> since: '1989-01-08',
<ide> offset: 1,
<ide><path>src/test/locale/ja.js
<ide> test('format', function (assert) {
<ide>
<ide> test('parse era', function (assert) {
<ide> // strict
<del> assert.equal(
<del> moment('平成30年', 'NNNNy年', true).isValid(),
<del> true,
<del> '平成30年'
<del> );
<del> assert.equal(moment('平成30年', 'NNNNy年', true).year(), 2018, '平成30年');
<del> assert.equal(
<del> moment('平成30年', 'NNNNyo', true).isValid(),
<del> true,
<del> '平成30年'
<del> );
<del> assert.equal(moment('平成30年', 'NNNNyo', true).year(), 2018, '平成30年');
<add> assert.equal(moment('令和2年', 'NNNNy年', true).isValid(), true, '令和2年');
<add> assert.equal(moment('令和2年', 'NNNNy年', true).year(), 2020, '令和2年');
<add> assert.equal(moment('令和2年', 'NNNNyo', true).isValid(), true, '令和2年');
<add> assert.equal(moment('令和2年', 'NNNNyo', true).year(), 2020, '令和2年');
<ide>
<del> assert.equal(moment('平成30年', 'Ny年', true).isValid(), false, '平成30年');
<del> assert.equal(moment('平成30年', 'Ny年', false).isValid(), true, '平成30年');
<del> assert.equal(moment('㍻30年', 'Ny年', true).isValid(), false, '㍻30年');
<del> assert.equal(moment('㍻30年', 'Ny年', false).isValid(), true, '㍻30年');
<del> assert.equal(moment('H30年', 'Ny年', false).isValid(), true, 'H30年');
<add> assert.equal(moment('令和2年', 'Ny年', true).isValid(), false, '令和2年');
<add> assert.equal(moment('令和2年', 'Ny年', false).isValid(), true, '令和2年');
<add> assert.equal(moment('㋿2年', 'Ny年', true).isValid(), false, '㋿2年');
<add> assert.equal(moment('㋿2年', 'Ny年', false).isValid(), true, '㋿2年');
<add> assert.equal(moment('R2', 'Ny', false).isValid(), true, 'R2');
<ide>
<ide> // abbrv
<del> assert.equal(moment('H30年', 'Ny年', true).isValid(), true, 'H30年');
<del> assert.equal(moment('H30年', 'Ny年', true).year(), 2018, 'H30年');
<del> assert.equal(moment('H30年', 'NNNNy年', true).isValid(), false, 'H30年');
<del> assert.equal(moment('H30年', 'NNNNNy年', true).isValid(), false, 'H30年');
<add> assert.equal(moment('R2', 'Ny', true).isValid(), true, 'R2');
<add> assert.equal(moment('R2', 'Ny', true).year(), 2020, 'R2');
<add> assert.equal(moment('R2', 'NNNNy', true).isValid(), false, 'R2');
<add> assert.equal(moment('R2', 'NNNNNy', true).isValid(), false, 'R2');
<ide>
<ide> // narrow
<del> assert.equal(moment('㍻30年', 'Ny年', true).isValid(), false, '㍻30年');
<del> assert.equal(moment('㍻30年', 'NNNNy年', true).isValid(), false, '㍻30年');
<del> assert.equal(moment('㍻30年', 'NNNNNy年', true).isValid(), true, '㍻30年');
<del> assert.equal(moment('㍻30年', 'NNNNNy年', true).year(), 2018, '㍻30年');
<add> assert.equal(moment('㋿2年', 'Ny年', true).isValid(), false, '㋿2年');
<add> assert.equal(moment('㋿2年', 'NNNNy年', true).isValid(), false, '㋿2年');
<add> assert.equal(moment('㋿2年', 'NNNNNy年', true).isValid(), true, '㋿2年');
<add> assert.equal(moment('㋿2年', 'NNNNNy年', true).year(), 2020, '㋿2年');
<ide>
<ide> // ordinal year
<del> assert.equal(moment('平成30年', 'NNNNyo', true).year(), 2018, '平成30年');
<del> assert.equal(moment('平成元年', 'NNNNyo', true).year(), 1989, '平成元年');
<add> assert.equal(moment('令和2年', 'NNNNyo', true).year(), 2020, '平成30年');
<add> assert.equal(moment('令和元年', 'NNNNyo', true).year(), 2019, '平成元年');
<ide>
<ide> // old eras
<add> assert.equal(moment('平成30年', 'NNNNyo', true).year(), 2018, '平成30年');
<add> assert.equal(moment('平成元年', 'NNNNyo', true).year(), 1989, '平成元年');
<ide> assert.equal(moment('昭和64年', 'NNNNyo', true).year(), 1989, '昭和64年');
<ide> assert.equal(moment('昭和元年', 'NNNNyo', true).year(), 1926, '昭和元年');
<ide> assert.equal(moment('大正元年', 'NNNNyo', true).year(), 1912, '大正元年');
<ide> test('parse era', function (assert) {
<ide>
<ide> test('format era', function (assert) {
<ide> var a = [
<add> /* First day of Reiwa Era */
<add> ['+002019-05-01', 'N, NN, NNN', 'R, R, R'],
<add> ['+002019-05-01', 'NNNN', '令和'],
<add> ['+002019-05-01', 'NNNNN', '㋿'],
<add> ['+002019-05-01', 'y yy yyy yyyy', '1 01 001 0001'],
<add> ['+002019-05-01', 'yo', '元年'],
<add>
<add> /* Last day of Heisei Era */
<add> ['+002019-04-30', 'N, NN, NNN', 'H, H, H'],
<add> ['+002019-04-30', 'NNNN', '平成'],
<add> ['+002019-04-30', 'NNNNN', '㍻'],
<add> ['+002019-04-30', 'y yy yyy yyyy', '31 31 031 0031'],
<add> ['+002019-04-30', 'yo', '31年'],
<add>
<ide> /* First day of Heisei Era */
<ide> ['+001989-01-08', 'N, NN, NNN', 'H, H, H'],
<ide> ['+001989-01-08', 'NNNN', '平成'], | 2 |
Go | Go | check size of keys slice | 3f542419acd9119c53f2b334ab9099867994a6ca | <ide><path>libnetwork/agent.go
<ide> func (c *controller) handleKeyChange(keys []*types.EncryptionKey) error {
<ide> }
<ide> }
<ide>
<del> key, tag := c.getPrimaryKeyTag(subsysGossip)
<add> key, tag, err := c.getPrimaryKeyTag(subsysGossip)
<add> if err != nil {
<add> return err
<add> }
<ide> a.networkDB.SetPrimaryKey(key)
<ide>
<del> key, tag = c.getPrimaryKeyTag(subsysIPSec)
<add> key, tag, err = c.getPrimaryKeyTag(subsysIPSec)
<add> if err != nil {
<add> return err
<add> }
<ide> drvEnc.Primary = key
<ide> drvEnc.PrimaryTag = tag
<ide>
<ide> func (c *controller) getKeys(subsys string) ([][]byte, []uint64) {
<ide> return keys, tags
<ide> }
<ide>
<del>// getPrimaryKeyTag returns the primary key for a given subsytem from the
<add>// getPrimaryKeyTag returns the primary key for a given subsystem from the
<ide> // list of sorted key and the associated tag
<del>func (c *controller) getPrimaryKeyTag(subsys string) ([]byte, uint64) {
<add>func (c *controller) getPrimaryKeyTag(subsys string) ([]byte, uint64, error) {
<ide> sort.Sort(ByTime(c.keys))
<ide> keys := []*types.EncryptionKey{}
<ide> for _, key := range c.keys {
<ide> if key.Subsystem == subsys {
<ide> keys = append(keys, key)
<ide> }
<ide> }
<del> return keys[1].Key, keys[1].LamportTime
<add> if len(keys) < 2 {
<add> return nil, 0, fmt.Errorf("primary key for subsystem %s not found", subsys)
<add> }
<add> return keys[1].Key, keys[1].LamportTime, nil
<ide> }
<ide>
<ide> func (c *controller) agentInit(bindAddrOrInterface, advertiseAddr string) error { | 1 |
Java | Java | switch defaults for contenttyperesolver | 92c72b93a61b84a8d94119e8126e964f933f09b5 | <ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/accept/CompositeContentTypeResolverBuilder.java
<ide>
<ide>
<ide> /**
<del> * Builder for {@link CompositeContentTypeResolver}.
<add> * Factory to create a {@link CompositeContentTypeResolver} and configure it with
<add> * one or more {@link ContentTypeResolver} instances with build style methods.
<add> * The following table shows methods, resulting strategy instances, and if in
<add> * use by default:
<add> *
<add> * <table>
<add> * <tr>
<add> * <th>Property Setter</th>
<add> * <th>Underlying Strategy</th>
<add> * <th>Default Setting</th>
<add> * </tr>
<add> * <tr>
<add> * <td>{@link #favorPathExtension}</td>
<add> * <td>{@link PathExtensionContentTypeResolver Path Extension resolver}</td>
<add> * <td>On</td>
<add> * </tr>
<add> * <tr>
<add> * <td>{@link #favorParameter}</td>
<add> * <td>{@link ParameterContentTypeResolver Parameter resolver}</td>
<add> * <td>Off</td>
<add> * </tr>
<add> * <tr>
<add> * <td>{@link #ignoreAcceptHeader}</td>
<add> * <td>{@link HeaderContentTypeResolver Header resolver}</td>
<add> * <td>On</td>
<add> * </tr>
<add> * <tr>
<add> * <td>{@link #defaultContentType}</td>
<add> * <td>{@link FixedContentTypeResolver Fixed content resolver}</td>
<add> * <td>Not set</td>
<add> * </tr>
<add> * <tr>
<add> * <td>{@link #defaultContentTypeResolver}</td>
<add> * <td>{@link ContentTypeResolver}</td>
<add> * <td>Not set</td>
<add> * </tr>
<add> * </table>
<add> *
<add> * <p>The order in which resolvers are configured is fixed. Config methods may only
<add> * turn individual resolvers on or off. If you need a custom order for any
<add> * reason simply instantiate {@code {@link CompositeContentTypeResolver}} directly.
<add> *
<add> * <p>For the path extension and parameter resolvers you may explicitly add
<add> * {@link #mediaTypes(Map)}. This will be used to resolve path extensions or a
<add> * parameter value such as "json" to a media type such as "application/json".
<add> *
<add> * <p>The path extension strategy will also use the Java Activation framework
<add> * (JAF), if available, to resolve a path extension to a MediaType. You may
<add> * {@link #useJaf suppress} the use of JAF.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> */
<ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java
<ide> import org.springframework.web.HttpMediaTypeNotAcceptableException;
<ide> import org.springframework.web.accept.ContentNegotiationManager;
<ide> import org.springframework.web.bind.annotation.RequestMapping;
<add>import org.springframework.web.reactive.accept.CompositeContentTypeResolverBuilder;
<ide> import org.springframework.web.reactive.accept.ContentTypeResolver;
<ide> import org.springframework.web.reactive.accept.HeaderContentTypeResolver;
<ide> import org.springframework.web.server.ServerWebExchange;
<ide> private ProducesRequestCondition(Collection<ProduceMediaTypeExpression> expressi
<ide>
<ide> this.expressions = new ArrayList<>(expressions);
<ide> Collections.sort(this.expressions);
<del> this.contentTypeResolver = (resolver != null ? resolver : new HeaderContentTypeResolver());
<add> this.contentTypeResolver = (resolver != null ?
<add> resolver : new CompositeContentTypeResolverBuilder().build());
<ide> }
<ide>
<ide>
<ide><path>spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java
<ide> import org.springframework.util.StringValueResolver;
<ide> import org.springframework.web.accept.ContentNegotiationManager;
<ide> import org.springframework.web.bind.annotation.RequestMapping;
<add>import org.springframework.web.reactive.accept.CompositeContentTypeResolver;
<add>import org.springframework.web.reactive.accept.CompositeContentTypeResolverBuilder;
<ide> import org.springframework.web.reactive.accept.ContentTypeResolver;
<ide> import org.springframework.web.reactive.accept.HeaderContentTypeResolver;
<ide> import org.springframework.web.reactive.result.condition.RequestCondition;
<ide> public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
<ide>
<ide> private boolean useTrailingSlashMatch = true;
<ide>
<del> private ContentTypeResolver contentTypeResolver = new HeaderContentTypeResolver();
<add> private ContentTypeResolver contentTypeResolver = new CompositeContentTypeResolverBuilder().build();
<ide>
<ide> private StringValueResolver embeddedValueResolver;
<ide>
<ide><path>spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMappingTests.java
<ide> public void useRegisteredSuffixPatternMatch() {
<ide>
<ide> assertTrue(this.handlerMapping.useSuffixPatternMatch());
<ide> assertTrue(this.handlerMapping.useRegisteredSuffixPatternMatch());
<del> assertEquals(Collections.singletonList("json"), this.handlerMapping.getFileExtensions());
<add> assertEquals(Collections.singleton("json"), this.handlerMapping.getFileExtensions());
<ide> }
<ide>
<ide> @Test | 4 |
Ruby | Ruby | check bash style with shellcheck | 96504ec9dcba438855ebb314f1dd004442453e12 | <ide><path>Library/Homebrew/style.rb
<ide> def check_style_impl(files, output_type, options = {})
<ide>
<ide> cache_env = { "XDG_CACHE_HOME" => "#{HOMEBREW_CACHE}/style" }
<ide>
<add> rubocop_success = false
<add>
<ide> case output_type
<ide> when :print
<ide> args << "--debug" if ARGV.debug?
<ide> args << "--display-cop-names" if ARGV.include? "--display-cop-names"
<ide> args << "--format" << "simple" if files
<ide> system(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", *args)
<del> !$CHILD_STATUS.success?
<add> rubocop_success = $CHILD_STATUS.success?
<ide> when :json
<ide> json, err, status =
<ide> Open3.capture3(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_",
<ide> def check_style_impl(files, output_type, options = {})
<ide> raise "Error running `rubocop --format json #{args.join " "}`\n#{err}"
<ide> end
<ide>
<del> RubocopResults.new(JSON.parse(json))
<add> return RubocopResults.new(JSON.parse(json))
<ide> else
<ide> raise "Invalid output_type for check_style_impl: #{output_type}"
<ide> end
<add>
<add> return !rubocop_success if !files.nil? && !has_non_formula
<add>
<add> shellcheck = which("shellcheck")
<add> shellcheck ||= which("shellcheck", ENV["HOMEBREW_PATH"])
<add> shellcheck ||= begin
<add> ohai "Installing `shellcheck` for shell style checks..."
<add> system HOMEBREW_BREW_FILE, "install", "shellcheck"
<add> which("shellcheck") || which("shellcheck", ENV["HOMEBREW_PATH"])
<add> end
<add> unless shellcheck
<add> opoo "Could not find or install `shellcheck`! Not checking shell style."
<add> return !rubocop_success
<add> end
<add>
<add> shell_files = [
<add> HOMEBREW_BREW_FILE,
<add> *Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/*.sh"),
<add> *Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/cmd/*.sh"),
<add> *Pathname.glob("#{HOMEBREW_LIBRARY}/Homebrew/utils/*.sh"),
<add> ].select(&:exist?)
<add> # TODO: check, fix completions here too.
<add> # TODO: consider using ShellCheck JSON output
<add> shellcheck_success = system shellcheck, "--shell=bash", *shell_files
<add> !rubocop_success || !shellcheck_success
<ide> end
<ide>
<ide> class RubocopResults | 1 |
Ruby | Ruby | remove mysql2 specific rescue in abstract adapter | 18c6f80960d2054e7d8761e0893dd1af7e46b6d0 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
<ide> def translate_exception(exception, message:, sql:, binds:)
<ide> when ER_QUERY_INTERRUPTED
<ide> QueryCanceled.new(message, sql: sql, binds: binds)
<ide> else
<del> if exception.is_a?(Mysql2::Error::TimeoutError)
<del> ActiveRecord::AdapterTimeout.new(message, sql: sql, binds: binds)
<del> else
<del> super
<del> end
<add> super
<ide> end
<ide> end
<ide>
<ide><path>activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
<ide> def full_version
<ide> def get_full_version
<ide> @connection.server_info[:version]
<ide> end
<add>
<add> def translate_exception(exception, message:, sql:, binds:)
<add> if exception.is_a?(Mysql2::Error::TimeoutError) && !exception.error_number
<add> ActiveRecord::AdapterTimeout.new(message, sql: sql, binds: binds)
<add> else
<add> super
<add> end
<add> end
<ide> end
<ide> end
<ide> end | 2 |
Text | Text | add missing semicolon in test-utils part of docs | 8e6996267fb58a3562cccdf43ead8dcbf99e183c | <ide><path>docs/docs/10.4-test-utils.it-IT.md
<ide> React.addons.TestUtils.Simulate.click(node);
<ide>
<ide> ```javascript
<ide> var node = ReactDOM.findDOMNode(this.refs.input);
<del>node.value = 'giraffe'
<add>node.value = 'giraffe';
<ide> React.addons.TestUtils.Simulate.change(node);
<ide> React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});
<ide> ```
<ide><path>docs/docs/10.4-test-utils.ko-KR.md
<ide> ReactTestUtils.Simulate.click(node);
<ide> ```javascript
<ide> // <input ref="input" />
<ide> var node = this.refs.input;
<del>node.value = 'giraffe'
<add>node.value = 'giraffe';
<ide> ReactTestUtils.Simulate.change(node);
<ide> ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});
<ide> ```
<ide><path>docs/docs/10.4-test-utils.md
<ide> ReactTestUtils.Simulate.click(node);
<ide> ```javascript
<ide> // <input ref="input" />
<ide> var node = this.refs.input;
<del>node.value = 'giraffe'
<add>node.value = 'giraffe';
<ide> ReactTestUtils.Simulate.change(node);
<ide> ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});
<ide> ```
<ide><path>docs/docs/10.4-test-utils.zh-CN.md
<ide> ReactTestUtils.Simulate.click(node);
<ide> ```javascript
<ide> // <input ref="input" />
<ide> var node = this.refs.input;
<del>node.value = 'giraffe'
<add>node.value = 'giraffe';
<ide> ReactTestUtils.Simulate.change(node);
<ide> ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});
<ide> ``` | 4 |
Mixed | Javascript | fix various typos | 03eaadb131df925d1072afd2496ee3b41d2f1fc6 | <ide><path>README.md
<ide> t( testName, selector, [ "array", "of", "ids" ] );
<ide> Example:
<ide>
<ide> ```js
<del>t("Check for something", "//[a]", ["foo", "baar"]);
<add>t("Check for something", "//[a]", ["foo", "bar"]);
<ide> ```
<ide>
<ide>
<ide><path>src/event.js
<ide> jQuery.each( {
<ide> related = event.relatedTarget,
<ide> handleObj = event.handleObj;
<ide>
<del> // For mousenter/leave call the handler if related is outside the target.
<add> // For mouseenter/leave call the handler if related is outside the target.
<ide> // NB: No relatedTarget if the mouse left/entered the browser window
<ide> if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
<ide> event.type = handleObj.origType;
<ide><path>test/data/jquery-1.9.1.js
<ide> jQuery.each( {
<ide> related = event.relatedTarget,
<ide> handleObj = event.handleObj;
<ide>
<del> // For mousenter/leave call the handler if related is outside the target.
<add> // For mouseenter/leave call the handler if related is outside the target.
<ide> // NB: No relatedTarget if the mouse left/entered the browser window
<ide> if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
<ide> event.type = handleObj.origType;
<ide><path>test/data/testinit.js
<ide> this.q = function() {
<ide> * @param {String} a - Assertion name
<ide> * @param {String} b - Sizzle selector
<ide> * @param {String} c - Array of ids to construct what is expected
<del> * @example t("Check for something", "//[a]", ["foo", "baar"]);
<del> * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
<add> * @example t("Check for something", "//[a]", ["foo", "bar"]);
<add> * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'bar'
<ide> */
<ide> QUnit.assert.t = function( a, b, c ) {
<ide> var f = jQuery( b ).get(),
<ide><path>test/unit/event.js
<ide> QUnit.test( "withinElement implemented with jQuery.contains()", function( assert
<ide>
<ide> } ).trigger( "mouseenter" );
<ide>
<del> jQuery( "#jc-inner" ).trigger( "mousenter" );
<add> jQuery( "#jc-inner" ).trigger( "mouseenter" );
<ide>
<ide> jQuery( "#jc-outer" ).off( "mouseenter mouseleave" ).remove();
<ide> jQuery( "#jc-inner" ).remove();
<ide><path>test/unit/selector.js
<ide> testIframe(
<ide>
<ide> /**
<ide> * Asserts that a select matches the given IDs
<del> * @example t("Check for something", "//[a]", ["foo", "baar"]);
<add> * @example t("Check for something", "//[a]", ["foo", "bar"]);
<ide> * @param {String} a - Assertion name
<ide> * @param {String} b - Sizzle selector
<ide> * @param {Array} c - Array of ids to construct what is expected | 6 |
Javascript | Javascript | update examples to use modules | 1bce5bb3bb119447b4d4882c4b59613eb8e13886 | <ide><path>src/ng/directive/ngBind.js
<ide> *
<ide> * @example
<ide> * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
<del> <example>
<add> <example module="bindExample">
<ide> <file name="index.html">
<ide> <script>
<del> function Ctrl($scope) {
<del> $scope.name = 'Whirled';
<del> }
<add> angular.module('bindExample', [])
<add> .controller('ExampleController', ['$scope', function($scope) {
<add> $scope.name = 'Whirled';
<add> }]);
<ide> </script>
<del> <div ng-controller="Ctrl">
<add> <div ng-controller="ExampleController">
<ide> Enter name: <input type="text" ng-model="name"><br>
<ide> Hello <span ng-bind="name"></span>!
<ide> </div>
<ide> var ngBindDirective = ngDirective({
<ide> *
<ide> * @example
<ide> * Try it here: enter text in text box and watch the greeting change.
<del> <example>
<add> <example module="bindExample">
<ide> <file name="index.html">
<ide> <script>
<del> function Ctrl($scope) {
<del> $scope.salutation = 'Hello';
<del> $scope.name = 'World';
<del> }
<add> angular.module('bindExample', [])
<add> .controller('ExampleController', ['$scope', function ($scope) {
<add> $scope.salutation = 'Hello';
<add> $scope.name = 'World';
<add> }]);
<ide> </script>
<del> <div ng-controller="Ctrl">
<add> <div ng-controller="ExampleController">
<ide> Salutation: <input type="text" ng-model="salutation"><br>
<ide> Name: <input type="text" ng-model="name"><br>
<ide> <pre ng-bind-template="{{salutation}} {{name}}!"></pre>
<ide> var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
<ide> * @example
<ide> Try it here: enter text in text box and watch the greeting change.
<ide>
<del> <example module="ngBindHtmlExample" deps="angular-sanitize.js">
<add> <example module="bindHtmlExample" deps="angular-sanitize.js">
<ide> <file name="index.html">
<del> <div ng-controller="ngBindHtmlCtrl">
<add> <div ng-controller="ExampleController">
<ide> <p ng-bind-html="myHTML"></p>
<ide> </div>
<ide> </file>
<ide>
<ide> <file name="script.js">
<del> angular.module('ngBindHtmlExample', ['ngSanitize'])
<del>
<del> .controller('ngBindHtmlCtrl', ['$scope', function ngBindHtmlCtrl($scope) {
<del> $scope.myHTML =
<del> 'I am an <code>HTML</code>string with <a href="#">links!</a> and other <em>stuff</em>';
<del> }]);
<add> angular.module('bindHtmlExample', ['ngSanitize'])
<add> .controller('ExampleController', ['$scope', function($scope) {
<add> $scope.myHTML =
<add> 'I am an <code>HTML</code>string with ' +
<add> '<a href="#">links!</a> and other <em>stuff</em>';
<add> }]);
<ide> </file>
<ide>
<ide> <file name="protractor.js" type="protractor"> | 1 |
Ruby | Ruby | follow rails convention by using array.wrap | ee044ea5477b4af41d2c0cebb13e47600da7493a | <ide><path>activemodel/lib/active_model/mass_assignment_security.rb
<ide> require 'active_support/core_ext/class/attribute'
<ide> require 'active_support/core_ext/string/inflections'
<add>require 'active_support/core_ext/array/wrap'
<ide> require 'active_model/mass_assignment_security/permission_set'
<ide> require 'active_model/mass_assignment_security/sanitizer'
<ide>
<ide> def attr_protected(*args)
<ide>
<ide> self._protected_attributes = protected_attributes_configs.dup
<ide>
<del> Array(role).each do |name|
<add> Array.wrap(role).each do |name|
<ide> self._protected_attributes[name] = self.protected_attributes(name) + args
<ide> end
<ide>
<ide> def attr_accessible(*args)
<ide>
<ide> self._accessible_attributes = accessible_attributes_configs.dup
<ide>
<del> Array(role).each do |name|
<add> Array.wrap(role).each do |name|
<ide> self._accessible_attributes[name] = self.accessible_attributes(name) + args
<ide> end
<ide> | 1 |
Ruby | Ruby | remove unused construct_finder_sql | 9f4e98330b3a7f85a4bca91fca062106ffbee2bf | <ide><path>activerecord/lib/active_record/base.rb
<ide> def construct_finder_arel_with_includes(options = {})
<ide> relation
<ide> end
<ide>
<del> def construct_finder_sql(options, scope = scope(:find))
<del> construct_finder_arel(options, scope).to_sql
<del> end
<del>
<ide> def construct_join(joins, scope)
<ide> merged_joins = scope && scope[:joins] && joins ? merge_joins(scope[:joins], joins) : (joins || scope && scope[:joins])
<ide> case merged_joins
<ide><path>activerecord/test/cases/associations/inner_join_association_test.rb
<ide> class InnerJoinAssociationTest < ActiveRecord::TestCase
<ide> fixtures :authors, :posts, :comments, :categories, :categories_posts, :categorizations
<ide>
<ide> def test_construct_finder_sql_creates_inner_joins
<del> sql = Author.send(:construct_finder_sql, :joins => :posts)
<add> sql = Author.joins(:posts).to_sql
<ide> assert_match /INNER JOIN .?posts.? ON .?posts.?.author_id = authors.id/, sql
<ide> end
<ide>
<ide> def test_construct_finder_sql_cascades_inner_joins
<del> sql = Author.send(:construct_finder_sql, :joins => {:posts => :comments})
<add> sql = Author.joins(:posts => :comments).to_sql
<ide> assert_match /INNER JOIN .?posts.? ON .?posts.?.author_id = authors.id/, sql
<ide> assert_match /INNER JOIN .?comments.? ON .?comments.?.post_id = posts.id/, sql
<ide> end
<ide>
<ide> def test_construct_finder_sql_inner_joins_through_associations
<del> sql = Author.send(:construct_finder_sql, :joins => :categorized_posts)
<add> sql = Author.joins(:categorized_posts).to_sql
<ide> assert_match /INNER JOIN .?categorizations.?.*INNER JOIN .?posts.?/, sql
<ide> end
<ide>
<ide> def test_construct_finder_sql_applies_association_conditions
<del> sql = Author.send(:construct_finder_sql, :joins => :categories_like_general, :conditions => "TERMINATING_MARKER")
<add> sql = Author.joins(:categories_like_general).where("TERMINATING_MARKER").to_sql
<ide> assert_match /INNER JOIN .?categories.? ON.*AND.*.?General.?(.|\n)*TERMINATING_MARKER/, sql
<ide> end
<ide>
<ide> def test_construct_finder_sql_applies_aliases_tables_on_association_conditions
<del> result = Author.find(:all, :joins => [:thinking_posts, :welcome_posts])
<add> result = Author.joins(:thinking_posts, :welcome_posts).to_a
<ide> assert_equal authors(:david), result.first
<ide> end
<ide>
<ide> def test_construct_finder_sql_unpacks_nested_joins
<del> sql = Author.send(:construct_finder_sql, :joins => {:posts => [[:comments]]})
<add> sql = Author.joins(:posts => [[:comments]]).to_sql
<ide> assert_no_match /inner join.*inner join.*inner join/i, sql, "only two join clauses should be present"
<ide> assert_match /INNER JOIN .?posts.? ON .?posts.?.author_id = authors.id/, sql
<ide> assert_match /INNER JOIN .?comments.? ON .?comments.?.post_id = .?posts.?.id/, sql
<ide> end
<ide>
<ide> def test_construct_finder_sql_ignores_empty_joins_hash
<del> sql = Author.send(:construct_finder_sql, :joins => {})
<add> sql = Author.joins({}).to_sql
<ide> assert_no_match /JOIN/i, sql
<ide> end
<ide>
<ide> def test_construct_finder_sql_ignores_empty_joins_array
<del> sql = Author.send(:construct_finder_sql, :joins => [])
<add> sql = Author.joins([]).to_sql
<ide> assert_no_match /JOIN/i, sql
<ide> end
<ide>
<ide> def test_find_with_implicit_inner_joins_honors_readonly_without_select
<del> authors = Author.find(:all, :joins => :posts)
<add> authors = Author.joins(:posts).to_a
<ide> assert !authors.empty?, "expected authors to be non-empty"
<ide> assert authors.all? {|a| a.readonly? }, "expected all authors to be readonly"
<ide> end
<ide>
<ide> def test_find_with_implicit_inner_joins_honors_readonly_with_select
<del> authors = Author.find(:all, :select => 'authors.*', :joins => :posts)
<add> authors = Author.joins(:posts).select('authors.*').to_a
<ide> assert !authors.empty?, "expected authors to be non-empty"
<ide> assert authors.all? {|a| !a.readonly? }, "expected no authors to be readonly"
<ide> end
<ide> def test_find_with_implicit_inner_joins_honors_readonly_false
<ide> end
<ide>
<ide> def test_find_with_implicit_inner_joins_does_not_set_associations
<del> authors = Author.find(:all, :select => 'authors.*', :joins => :posts)
<add> authors = Author.joins(:posts).select('authors.*')
<ide> assert !authors.empty?, "expected authors to be non-empty"
<ide> assert authors.all? {|a| !a.send(:instance_variable_names).include?("@posts")}, "expected no authors to have the @posts association loaded"
<ide> end
<ide>
<ide> def test_count_honors_implicit_inner_joins
<del> real_count = Author.find(:all).sum{|a| a.posts.count }
<add> real_count = Author.scoped.to_a.sum{|a| a.posts.count }
<ide> assert_equal real_count, Author.count(:joins => :posts), "plain inner join count should match the number of referenced posts records"
<ide> end
<ide>
<ide> def test_calculate_honors_implicit_inner_joins
<del> real_count = Author.find(:all).sum{|a| a.posts.count }
<add> real_count = Author.scoped.to_a.sum{|a| a.posts.count }
<ide> assert_equal real_count, Author.calculate(:count, 'authors.id', :joins => :posts), "plain inner join count should match the number of referenced posts records"
<ide> end
<ide>
<ide> def test_calculate_honors_implicit_inner_joins_and_distinct_and_conditions
<del> real_count = Author.find(:all).select {|a| a.posts.any? {|p| p.title =~ /^Welcome/} }.length
<add> real_count = Author.scoped.to_a.select {|a| a.posts.any? {|p| p.title =~ /^Welcome/} }.length
<ide> authors_with_welcoming_post_titles = Author.calculate(:count, 'authors.id', :joins => :posts, :distinct => true, :conditions => "posts.title like 'Welcome%'")
<ide> assert_equal real_count, authors_with_welcoming_post_titles, "inner join and conditions should have only returned authors posting titles starting with 'Welcome'"
<ide> end | 2 |
Go | Go | fix two obvious bugs??? | 9632cf09bfd7b4a8513799bf19070ecabd55c446 | <ide><path>registry/registry.go
<ide> func (r *Registry) GetRemoteHistory(imgId, registry string, token []string) ([]s
<ide> func (r *Registry) LookupRemoteImage(imgId, registry string, token []string) bool {
<ide> rt := &http.Transport{Proxy: http.ProxyFromEnvironment}
<ide>
<del> req, err := http.NewRequest("GET", registry+"/images/"+imgId+"/json", nil)
<add> req, err := http.NewRequest("GET", registry+"/v1/images/"+imgId+"/json", nil)
<ide> if err != nil {
<ide> return false
<ide> }
<ide><path>server.go
<ide> func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name, reg
<ide> if _, exists := repoData.ImgList[elem.ID]; exists {
<ide> out.Write(sf.FormatStatus("Image %s already on registry, skipping", name))
<ide> continue
<del> } else if registryEp != "" && r.LookupRemoteImage(elem.ID, registryEp, repoData.Tokens) {
<add> } else if r.LookupRemoteImage(elem.ID, ep, repoData.Tokens) {
<ide> fmt.Fprintf(out, "Image %s already on registry, skipping\n", name)
<ide> continue
<ide> } | 2 |
Python | Python | add min size to docs and fix raise | 6edd903b0ba1e3ade0f4192466d5883c335370e2 | <ide><path>airflow/hooks/S3_hook.py
<ide> def load_file(
<ide> error will be raised.
<ide> :type replace: bool
<ide> :param multipart_bytes: If provided, the file is uploaded in parts of
<del> this size. If None, the whole file is uploaded at once.
<add> this size (minimum 5242880). If None, the whole file is uploaded at
<add> once.
<ide> :type multipart_bytes: int
<ide> """
<ide> if not bucket_name:
<ide> def load_string(self, string_data,
<ide> if not bucket_name:
<ide> (bucket_name, key) = self.parse_s3_url(key)
<ide> bucket = self.get_bucket(bucket_name)
<del> if not self.check_for_key(key, bucket_name):
<add> key_obj = bucket.get_key(key)
<add> if not replace and key_obj:
<add> raise ValueError("The key {key} already exists.".format(
<add> **locals()))
<add> if not key_obj:
<ide> key_obj = bucket.new_key(key_name=key)
<del> else:
<del> key_obj = bucket.get_key(key)
<ide> key_size = key_obj.set_contents_from_string(string_data,
<ide> replace=replace)
<ide> logging.info("The key {key} now contains" | 1 |
Javascript | Javascript | remove legacy econnreset workaround code | 88686aa4106499a603365b887e2381b55c61c027 | <ide><path>lib/http.js
<ide> OutgoingMessage.prototype._writeRaw = function(data, encoding) {
<ide> return this.connection.write(data, encoding);
<ide> } else if (this.connection && this.connection.destroyed) {
<ide> // The socket was destroyed. If we're still trying to write to it,
<del> // then something bad happened, but it could be just that we haven't
<del> // gotten the 'close' event yet.
<del> //
<del> // In v0.10 and later, this isn't a problem, since ECONNRESET isn't
<del> // ignored in the first place. We'll probably emit 'close' on the
<del> // next tick, but just in case it's not coming, set a timeout that
<del> // will emit it for us.
<del> if (!this._hangupClose) {
<del> this._hangupClose = true;
<del> var socket = this.socket;
<del> var timer = setTimeout(function() {
<del> socket.emit('close');
<del> });
<del> socket.once('close', function() {
<del> clearTimeout(timer);
<del> });
<del> }
<add> // then we haven't gotten the 'close' event yet.
<ide> return false;
<ide> } else {
<ide> // buffer, as long as we're not destroyed.
<ide><path>test/simple/test-http-many-ended-pipelines.js
<add>// Copyright Joyent, Inc. and other Node contributors.
<add>//
<add>// Permission is hereby granted, free of charge, to any person obtaining a
<add>// copy of this software and associated documentation files (the
<add>// "Software"), to deal in the Software without restriction, including
<add>// without limitation the rights to use, copy, modify, merge, publish,
<add>// distribute, sublicense, and/or sell copies of the Software, and to permit
<add>// persons to whom the Software is furnished to do so, subject to the
<add>// following conditions:
<add>//
<add>// The above copyright notice and this permission notice shall be included
<add>// in all copies or substantial portions of the Software.
<add>//
<add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
<add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
<add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
<add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
<add>// USE OR OTHER DEALINGS IN THE SOFTWARE.
<add>
<add>var common = require('../common');
<add>var assert = require('assert');
<add>
<add>// no warnings should happen!
<add>var trace = console.trace;
<add>console.trace = function() {
<add> trace.apply(console, arguments);
<add> throw new Error('no tracing should happen here');
<add>};
<add>
<add>var http = require('http');
<add>var net = require('net');
<add>
<add>var server = http.createServer(function(req, res) {
<add> res.end('ok');
<add>
<add> // Oh no! The connection died!
<add> req.socket.destroy();
<add>});
<add>
<add>server.listen(common.PORT);
<add>
<add>var client = net.connect({ port: common.PORT, allowHalfOpen: true });
<add>for (var i = 0; i < 20; i++) {
<add> client.write('GET / HTTP/1.1\r\n' +
<add> 'Host: some.host.name\r\n'+
<add> '\r\n\r\n');
<add>}
<add>client.end();
<add>client.on('connect', function() {
<add> server.close();
<add>});
<add>client.pipe(process.stdout); | 2 |
Javascript | Javascript | fix constructor declaration in headmanager (#321) | 8a2981746b7083bc60d75f4a4b9374936fffd50e | <ide><path>client/head-manager.js
<ide> import HTMLDOMPropertyConfig from 'react-dom/lib/HTMLDOMPropertyConfig'
<ide> const DEFAULT_TITLE = ''
<ide>
<ide> export default class HeadManager {
<del> constuctor () {
<add> constructor () {
<ide> this.requestId = null
<ide> }
<ide> | 1 |
PHP | PHP | remove comment bloat from eloquent hydrator | 34605ad49d9f3a7525725d5725deccf3b9bf9491 | <ide><path>system/db/eloquent/hydrator.php
<ide> class Hydrator {
<ide> */
<ide> public static function hydrate($eloquent)
<ide> {
<del> // -----------------------------------------------------
<ide> // Load the base / parent models from the query results.
<del> // -----------------------------------------------------
<ide> $results = static::base(get_class($eloquent), $eloquent->query->get());
<ide>
<del> // -----------------------------------------------------
<ide> // Load all of the eager relationships.
<del> // -----------------------------------------------------
<ide> if (count($results) > 0)
<ide> {
<ide> foreach ($eloquent->includes as $include)
<ide> private static function base($class, $results)
<ide> $model->attributes = (array) $result;
<ide> $model->exists = true;
<ide>
<del> // -----------------------------------------------------
<del> // The results are keyed by the ID on the record. This
<del> // will allow us to conveniently match them to child
<del> // models during eager loading.
<del> // -----------------------------------------------------
<add> // The results are keyed by the ID on the record. This will allow us to conveniently
<add> // match them to child models during eager loading.
<ide> $models[$model->id] = $model;
<ide> }
<ide>
<ide> private static function base($class, $results)
<ide> */
<ide> private static function eagerly($eloquent, &$parents, $include)
<ide> {
<del> // -----------------------------------------------------
<ide> // Get the relationship Eloquent model.
<ide> //
<del> // We temporarily spoof the belongs_to key to allow the
<del> // query to be fetched without any problems, since the
<del> // belongs_to method actually gets the attribute.
<del> // -----------------------------------------------------
<add> // We temporarily spoof the belongs_to key to allow the query to be fetched without
<add> // any problems, since the belongs_to method actually gets the attribute.
<ide> $eloquent->attributes[$spoof = $include.'_id'] = 0;
<ide>
<ide> $relationship = $eloquent->$include();
<ide>
<ide> unset($eloquent->attributes[$spoof]);
<ide>
<del> // -----------------------------------------------------
<del> // Reset the WHERE clause and bindings on the query.
<del> // We'll add our own WHERE clause soon.
<del> // -----------------------------------------------------
<add> // Reset the WHERE clause and bindings on the query. We'll add our own WHERE clause soon.
<ide> $relationship->query->where = 'WHERE 1 = 1';
<ide> $relationship->query->bindings = array();
<ide>
<del> // -----------------------------------------------------
<del> // Initialize the relationship attribute on the parents.
<del> // As expected, "many" relationships are initialized to
<del> // an array and "one" relationships to null.
<del> // -----------------------------------------------------
<add> // Initialize the relationship attribute on the parents. As expected, "many" relationships
<add> // are initialized to an array and "one" relationships are initialized to null.
<ide> foreach ($parents as &$parent)
<ide> {
<ide> $parent->ignore[$include] = (strpos($eloquent->relating, 'has_many') === 0) ? array() : null;
<ide> }
<ide>
<del> // -----------------------------------------------------
<del> // Eagerly load the relationships. Phew, almost there!
<del> // -----------------------------------------------------
<ide> if ($eloquent->relating == 'has_one')
<ide> {
<ide> static::eagerly_load_one($relationship, $parents, $eloquent->relating_key, $include);
<ide> private static function eagerly($eloquent, &$parents, $include)
<ide> */
<ide> private static function eagerly_load_one($relationship, &$parents, $relating_key, $include)
<ide> {
<del> // -----------------------------------------------------
<del> // Get the all of the related models by the parent IDs.
<del> //
<del> // Remember, the parent results are keyed by ID. So, we
<del> // can simply pass the keys of the array into the query.
<del> //
<del> // After getting the models, we'll match by ID.
<del> // -----------------------------------------------------
<ide> foreach ($relationship->where_in($relating_key, array_keys($parents))->get() as $key => $child)
<ide> {
<ide> $parents[$child->$relating_key]->ignore[$include] = $child;
<ide> private static function eagerly_load_many($relationship, &$parents, $relating_ke
<ide> */
<ide> private static function eagerly_load_belonging($relationship, &$parents, $relating_key, $include)
<ide> {
<del> // -----------------------------------------------------
<del> // Gather the keys from the parent models. Since the
<del> // foreign key is on the parent model for this type of
<del> // relationship, we have to gather them individually.
<del> // -----------------------------------------------------
<add> // Gather the keys from the parent models. Since the foreign key is on the parent model
<add> // for this type of relationship, we have to gather them individually.
<ide> $keys = array();
<ide>
<ide> foreach ($parents as &$parent)
<ide> {
<ide> $keys[] = $parent->$relating_key;
<ide> }
<ide>
<del> // -----------------------------------------------------
<del> // Get the related models.
<del> // -----------------------------------------------------
<ide> $children = $relationship->where_in('id', array_unique($keys))->get();
<ide>
<del> // -----------------------------------------------------
<del> // Match the child models with their parent by ID.
<del> // -----------------------------------------------------
<ide> foreach ($parents as &$parent)
<ide> {
<ide> if (array_key_exists($parent->$relating_key, $children))
<ide> private static function eagerly_load_many_to_many($relationship, &$parents, $rel
<ide> {
<ide> $relationship->query->select = null;
<ide>
<del> // -----------------------------------------------------
<ide> // Retrieve the raw results as stdClasses.
<ide> //
<del> // We also add the foreign key to the select which will allow us
<del> // to match the models back to their parents.
<del> // -----------------------------------------------------
<add> // We also add the foreign key to the select which will allow us to match the
<add> // models back to their parents.
<ide> $children = $relationship->query
<ide> ->where_in($relating_table.'.'.$relating_key, array_keys($parents))
<ide> ->get(Eloquent::table(get_class($relationship)).'.*', $relating_table.'.'.$relating_key);
<ide>
<ide> $class = get_class($relationship);
<ide>
<del> // -----------------------------------------------------
<del> // Create the related models.
<del> // -----------------------------------------------------
<ide> foreach ($children as $child)
<ide> {
<ide> $related = new $class;
<ide>
<ide> $related->attributes = (array) $child;
<ide> $related->exists = true;
<ide>
<del> // -----------------------------------------------------
<del> // Remove the foreign key from the attributes since it
<del> // was added to the query to help us match the models.
<del> // -----------------------------------------------------
<add> // Remove the foreign key from the attributes since it was added to the query
<add> // to help us match the models.
<ide> unset($related->attributes[$relating_key]);
<ide>
<del> // -----------------------------------------------------
<del> // Match the child model its parent by ID.
<del> // -----------------------------------------------------
<ide> $parents[$child->$relating_key]->ignore[$include][$child->id] = $related;
<ide> }
<ide> } | 1 |
Ruby | Ruby | refactor the format | 75a38b7187788b61461a0b76b7033bf96a33c1c1 | <ide><path>Library/Homebrew/cask/quarantine.rb
<ide> def xattr
<ide> def check_quarantine_support
<ide> odebug "Checking quarantine support"
<ide>
<del> if !system_command(xattr, args:[ "-h" ], print_stderr: false).success?
<add> if !system_command(xattr, args: ["-h"], print_stderr: false).success?
<ide> odebug "There's no working version of `xattr` on this system."
<ide> :xattr_broken
<ide> elsif swift.nil?
<ide><path>Library/Homebrew/diagnostic.rb
<ide> def check_cask_environment_variables
<ide> end
<ide>
<ide> def check_cask_xattr
<del> result = system_command "/usr/bin/xattr", args: [ "-h" ]
<add> result = system_command "/usr/bin/xattr", args: ["-h"]
<ide>
<ide> return if result.status.success?
<ide> | 2 |
Javascript | Javascript | remove `rctdeviceeventemitter` checks | c8c975f0d7b8a57e9e90373a2be4d630ed9dd65e | <ide><path>Libraries/EventEmitter/RCTDeviceEventEmitter.js
<ide> import EventEmitter from '../vendor/emitter/EventEmitter';
<ide> import type EmitterSubscription from '../vendor/emitter/_EmitterSubscription';
<ide> import EventSubscriptionVendor from '../vendor/emitter/_EventSubscriptionVendor';
<ide>
<del>function checkNativeEventModule(eventType: ?string) {
<del> if (eventType) {
<del> if (eventType.lastIndexOf('statusBar', 0) === 0) {
<del> throw new Error(
<del> '`' +
<del> eventType +
<del> '` event should be registered via the StatusBarIOS module',
<del> );
<del> }
<del> if (eventType.lastIndexOf('keyboard', 0) === 0) {
<del> throw new Error(
<del> '`' +
<del> eventType +
<del> '` event should be registered via the Keyboard module',
<del> );
<del> }
<del> if (eventType === 'appStateDidChange' || eventType === 'memoryWarning') {
<del> throw new Error(
<del> '`' +
<del> eventType +
<del> '` event should be registered via the AppState module',
<del> );
<del> }
<del> }
<del>}
<del>
<ide> /**
<ide> * Deprecated - subclass NativeEventEmitter to create granular event modules instead of
<ide> * adding all event listeners directly to RCTDeviceEventEmitter.
<ide> class RCTDeviceEventEmitter<
<ide> this.sharedSubscriber = sharedSubscriber;
<ide> }
<ide>
<del> addListener<K: $Keys<EventDefinitions>>(
<del> eventType: K,
<del> listener: (...$ElementType<EventDefinitions, K>) => mixed,
<del> context: $FlowFixMe,
<del> ): EmitterSubscription<EventDefinitions, K> {
<del> if (__DEV__) {
<del> checkNativeEventModule(eventType);
<del> }
<del> return super.addListener(eventType, listener, context);
<del> }
<del>
<del> removeAllListeners<K: $Keys<EventDefinitions>>(eventType: ?K): void {
<del> if (__DEV__) {
<del> checkNativeEventModule(eventType);
<del> }
<del> super.removeAllListeners(eventType);
<del> }
<del>
<ide> removeSubscription<K: $Keys<EventDefinitions>>(
<ide> subscription: EmitterSubscription<EventDefinitions, K>,
<ide> ): void { | 1 |
Javascript | Javascript | fix typo in chunk.js | 9352bb88066816ff3286c81f1fb728f9dea972fc | <ide><path>lib/Chunk.js
<ide> Chunk.prototype.canBeIntegrated = function(other) {
<ide> };
<ide>
<ide> Chunk.prototype.integratedSize = function(other, options) {
<del> // Chunk if it's possible to integrate this chunks
<add> // Chunk if it's possible to integrate this chunk
<ide> if(!this.canBeIntegrated(other)) {
<ide> return false;
<ide> } | 1 |
PHP | PHP | add tests for and reformat code | 86bc7f186194bb1da3b84873987fb4be0071b85f | <ide><path>lib/Cake/Test/Case/Utility/FolderTest.php
<ide> public function testCopyWithSkip() {
<ide> $Folder->delete();
<ide> }
<ide>
<add>/**
<add> * Test that SKIP mode skips files too.
<add> *
<add> * @return void
<add> */
<add> public function testCopyWithSkipFileSkipped() {
<add> $path = TMP . 'folder_test';
<add> $folderOne = $path . DS . 'folder1';
<add> $folderTwo = $path . DS . 'folder2';
<add>
<add> new Folder($path, true);
<add> new Folder($folderOne, true);
<add> new Folder($folderTwo, true);
<add> file_put_contents($folderOne . DS . 'fileA.txt', 'Folder One File');
<add> file_put_contents($folderTwo . DS . 'fileA.txt', 'Folder Two File');
<add>
<add> $Folder = new Folder($folderOne);
<add> $result = $Folder->copy(array('to' => $folderTwo, 'scheme' => Folder::SKIP));
<add> $this->assertTrue($result);
<add> $this->assertEquals('Folder Two File', file_get_contents($folderTwo . DS . 'fileA.txt'));
<add> }
<add>
<ide> /**
<ide> * testCopyWithOverwrite
<ide> *
<ide><path>lib/Cake/Utility/Folder.php
<ide> public function copy($options) {
<ide> $to = $options;
<ide> $options = array();
<ide> }
<del> $options += array('to' => $to, 'from' => $this->path, 'mode' => $this->mode, 'skip' => array(), 'scheme' => Folder::MERGE);
<add> $options += array(
<add> 'to' => $to,
<add> 'from' => $this->path,
<add> 'mode' => $this->mode,
<add> 'skip' => array(),
<add> 'scheme' => Folder::MERGE
<add> );
<ide>
<ide> $fromDir = $options['from'];
<ide> $toDir = $options['to']; | 2 |
Mixed | Javascript | drop duplicate api in promises mode | c594d15170e6664c0609d317a9a201f34e875900 | <ide><path>benchmark/fs/bench-stat-promise.js
<ide> const bench = common.createBenchmark(main, {
<ide> });
<ide>
<ide> async function run(n, statType) {
<del> const arg = statType === 'fstat' ?
<del> await fsPromises.open(__filename, 'r') : __filename;
<add> const handleMode = statType === 'fstat';
<add> const arg = handleMode ? await fsPromises.open(__filename, 'r') : __filename;
<ide> let remaining = n;
<ide> bench.start();
<ide> while (remaining-- > 0)
<del> await fsPromises[statType](arg);
<add> await (handleMode ? arg.stat() : fsPromises[statType](arg));
<ide> bench.end(n);
<ide>
<ide> if (typeof arg.close === 'function')
<ide><path>doc/api/fs.md
<ide> fsPromises.copyFile('source.txt', 'destination.txt', COPYFILE_EXCL)
<ide> .catch(() => console.log('The file could not be copied'));
<ide> ```
<ide>
<del>### fsPromises.fchmod(filehandle, mode)
<del><!-- YAML
<del>added: v10.0.0
<del>-->
<del>
<del>* `filehandle` {FileHandle}
<del>* `mode` {integer}
<del>* Returns: {Promise}
<del>
<del>Asynchronous fchmod(2). The `Promise` is resolved with no arguments upon
<del>success.
<del>
<del>### fsPromises.fchown(filehandle, uid, gid)
<del><!-- YAML
<del>added: v10.0.0
<del>-->
<del>
<del>* `filehandle` {FileHandle}
<del>* `uid` {integer}
<del>* `gid` {integer}
<del>* Returns: {Promise}
<del>
<del>Changes the ownership of the file represented by `filehandle` then resolves
<del>the `Promise` with no arguments upon success.
<del>
<del>### fsPromises.fdatasync(filehandle)
<del><!-- YAML
<del>added: v10.0.0
<del>-->
<del>
<del>* `filehandle` {FileHandle}
<del>* Returns: {Promise}
<del>
<del>Asynchronous fdatasync(2). The `Promise` is resolved with no arguments upon
<del>success.
<del>
<del>### fsPromises.fstat(filehandle)
<del><!-- YAML
<del>added: v10.0.0
<del>-->
<del>
<del>* `filehandle` {FileHandle}
<del>* Returns: {Promise}
<del>
<del>Retrieves the [`fs.Stats`][] for the given `filehandle`.
<del>
<del>### fsPromises.fsync(filehandle)
<del><!-- YAML
<del>added: v10.0.0
<del>-->
<del>
<del>* `filehandle` {FileHandle}
<del>* Returns: {Promise}
<del>
<del>Asynchronous fsync(2). The `Promise` is resolved with no arguments upon
<del>success.
<del>
<del>### fsPromises.ftruncate(filehandle[, len])
<del><!-- YAML
<del>added: v10.0.0
<del>-->
<del>
<del>* `filehandle` {FileHandle}
<del>* `len` {integer} **Default:** `0`
<del>* Returns: {Promise}
<del>
<del>Truncates the file represented by `filehandle` then resolves the `Promise`
<del>with no arguments upon success.
<del>
<del>If the file referred to by the `FileHandle` was larger than `len` bytes, only
<del>the first `len` bytes will be retained in the file.
<del>
<del>For example, the following program retains only the first four bytes of the
<del>file:
<del>
<del>```js
<del>console.log(fs.readFileSync('temp.txt', 'utf8'));
<del>// Prints: Node.js
<del>
<del>async function doTruncate() {
<del> const fd = await fsPromises.open('temp.txt', 'r+');
<del> await fsPromises.ftruncate(fd, 4);
<del> console.log(fs.readFileSync('temp.txt', 'utf8')); // Prints: Node
<del>}
<del>
<del>doTruncate().catch(console.error);
<del>```
<del>
<del>If the file previously was shorter than `len` bytes, it is extended, and the
<del>extended part is filled with null bytes (`'\0'`). For example,
<del>
<del>```js
<del>console.log(fs.readFileSync('temp.txt', 'utf8'));
<del>// Prints: Node.js
<del>
<del>async function doTruncate() {
<del> const fd = await fsPromises.open('temp.txt', 'r+');
<del> await fsPromises.ftruncate(fd, 10);
<del> console.log(fs.readFileSync('temp.txt', 'utf8')); // Prints Node.js\0\0\0
<del>}
<del>
<del>doTruncate().catch(console.error);
<del>```
<del>
<del>The last three bytes are null bytes (`'\0'`), to compensate the over-truncation.
<del>
<del>### fsPromises.futimes(filehandle, atime, mtime)
<del><!-- YAML
<del>added: v10.0.0
<del>-->
<del>
<del>* `filehandle` {FileHandle}
<del>* `atime` {number|string|Date}
<del>* `mtime` {number|string|Date}
<del>* Returns: {Promise}
<del>
<del>Change the file system timestamps of the object referenced by the supplied
<del>`FileHandle` then resolves the `Promise` with no arguments upon success.
<del>
<del>This function does not work on AIX versions before 7.1, it will resolve the
<del>`Promise` with an error using code `UV_ENOSYS`.
<del>
<ide> ### fsPromises.lchmod(path, mode)
<ide> <!-- YAML
<ide> deprecated: v10.0.0
<ide> by [Naming Files, Paths, and Namespaces][]. Under NTFS, if the filename contains
<ide> a colon, Node.js will open a file system stream, as described by
<ide> [this MSDN page][MSDN-Using-Streams].
<ide>
<del>### fsPromises.read(filehandle, buffer, offset, length, position)
<del><!-- YAML
<del>added: v10.0.0
<del>-->
<del>
<del>* `filehandle` {FileHandle}
<del>* `buffer` {Buffer|Uint8Array}
<del>* `offset` {integer}
<del>* `length` {integer}
<del>* `position` {integer}
<del>* Returns: {Promise}
<del>
<del>Read data from the file specified by `filehandle`.
<del>
<del>`buffer` is the buffer that the data will be written to.
<del>
<del>`offset` is the offset in the buffer to start writing at.
<del>
<del>`length` is an integer specifying the number of bytes to read.
<del>
<del>`position` is an argument specifying where to begin reading from in the file.
<del>If `position` is `null`, data will be read from the current file position,
<del>and the file position will be updated.
<del>If `position` is an integer, the file position will remain unchanged.
<del>
<del>Following successful read, the `Promise` is resolved with an object with a
<del>`bytesRead` property specifying the number of bytes read, and a `buffer`
<del>property that is a reference to the passed in `buffer` argument.
<del>
<ide> ### fsPromises.readdir(path[, options])
<ide> <!-- YAML
<ide> added: v10.0.0
<ide> The `atime` and `mtime` arguments follow these rules:
<ide> - If the value can not be converted to a number, or is `NaN`, `Infinity` or
<ide> `-Infinity`, an `Error` will be thrown.
<ide>
<del>### fsPromises.write(filehandle, buffer[, offset[, length[, position]]])
<del><!-- YAML
<del>added: v10.0.0
<del>-->
<del>
<del>* `filehandle` {FileHandle}
<del>* `buffer` {Buffer|Uint8Array}
<del>* `offset` {integer}
<del>* `length` {integer}
<del>* `position` {integer}
<del>* Returns: {Promise}
<del>
<del>Write `buffer` to the file specified by `filehandle`.
<del>
<del>The `Promise` is resolved with an object containing a `bytesWritten` property
<del>identifying the number of bytes written, and a `buffer` property containing
<del>a reference to the `buffer` written.
<del>
<del>`offset` determines the part of the buffer to be written, and `length` is
<del>an integer specifying the number of bytes to write.
<del>
<del>`position` refers to the offset from the beginning of the file where this data
<del>should be written. If `typeof position !== 'number'`, the data will be written
<del>at the current position. See pwrite(2).
<del>
<del>It is unsafe to use `fsPromises.write()` multiple times on the same file
<del>without waiting for the `Promise` to be resolved (or rejected). For this
<del>scenario, `fs.createWriteStream` is strongly recommended.
<del>
<del>On Linux, positional writes do not work when the file is opened in append mode.
<del>The kernel ignores the position argument and always appends the data to
<del>the end of the file.
<del>
<ide> ### fsPromises.writeFile(file, data[, options])
<ide> <!-- YAML
<ide> added: v10.0.0
<ide><path>lib/internal/fs/promises.js
<ide> module.exports = {
<ide> access,
<ide> copyFile,
<ide> open,
<del> read,
<del> write,
<ide> rename,
<ide> truncate,
<del> ftruncate,
<ide> rmdir,
<del> fdatasync,
<del> fsync,
<ide> mkdir,
<ide> readdir,
<ide> readlink,
<ide> symlink,
<del> fstat,
<ide> lstat,
<ide> stat,
<ide> link,
<ide> unlink,
<del> fchmod,
<ide> chmod,
<ide> lchmod,
<ide> lchown,
<del> fchown,
<ide> chown,
<ide> utimes,
<del> futimes,
<ide> realpath,
<ide> mkdtemp,
<ide> writeFile,
<ide><path>test/parallel/test-fs-promises.js
<ide> const {
<ide> access,
<ide> chmod,
<ide> copyFile,
<del> fchmod,
<del> fdatasync,
<del> fstat,
<del> fsync,
<del> ftruncate,
<del> futimes,
<ide> link,
<ide> lstat,
<ide> mkdir,
<ide> mkdtemp,
<ide> open,
<del> read,
<ide> readdir,
<ide> readlink,
<ide> realpath,
<ide> rename,
<ide> rmdir,
<ide> stat,
<ide> symlink,
<del> write,
<ide> unlink,
<ide> utimes
<ide> } = fsPromises;
<ide> function verifyStatObject(stat) {
<ide> const handle = await open(dest, 'r+');
<ide> assert.strictEqual(typeof handle, 'object');
<ide>
<del> let stats = await fstat(handle);
<add> let stats = await handle.stat();
<ide> verifyStatObject(stats);
<ide> assert.strictEqual(stats.size, 35);
<ide>
<del> await ftruncate(handle, 1);
<add> await handle.truncate(1);
<ide>
<del> stats = await fstat(handle);
<add> stats = await handle.stat();
<ide> verifyStatObject(stats);
<ide> assert.strictEqual(stats.size, 1);
<ide>
<ide> function verifyStatObject(stat) {
<ide> stats = await handle.stat();
<ide> verifyStatObject(stats);
<ide>
<del> await fdatasync(handle);
<ide> await handle.datasync();
<del> await fsync(handle);
<ide> await handle.sync();
<ide>
<ide> const buf = Buffer.from('hello fsPromises');
<ide> const bufLen = buf.length;
<del> await write(handle, buf);
<del> const ret = await read(handle, Buffer.alloc(bufLen), 0, bufLen, 0);
<add> await handle.write(buf);
<add> const ret = await handle.read(Buffer.alloc(bufLen), 0, bufLen, 0);
<ide> assert.strictEqual(ret.bytesRead, bufLen);
<ide> assert.deepStrictEqual(ret.buffer, buf);
<ide>
<ide> function verifyStatObject(stat) {
<ide> assert.deepStrictEqual(ret2.buffer, buf2);
<ide>
<ide> await chmod(dest, 0o666);
<del> await fchmod(handle, 0o666);
<ide> await handle.chmod(0o666);
<ide>
<ide> // Mode larger than 0o777 should be masked off.
<ide> await chmod(dest, (0o777 + 1));
<del> await fchmod(handle, 0o777 + 1);
<ide> await handle.chmod(0o777 + 1);
<ide>
<ide> await utimes(dest, new Date(), new Date());
<ide>
<ide> try {
<del> await futimes(handle, new Date(), new Date());
<ide> await handle.utimes(new Date(), new Date());
<ide> } catch (err) {
<ide> // Some systems do not have futimes. If there is an error, | 4 |
Python | Python | pass custom headers through in ses email backend | de84eaf1b042304dd966219da22c7c529afbb662 | <ide><path>airflow/providers/amazon/aws/utils/emailer.py
<ide> # specific language governing permissions and limitations
<ide> # under the License.
<ide> """Airflow module for email backend using AWS SES"""
<del>from typing import List, Optional, Union
<add>from typing import Any, Dict, List, Optional, Union
<ide>
<ide> from airflow.providers.amazon.aws.hooks.ses import SesHook
<ide>
<ide> def send_email(
<ide> mime_charset: str = 'utf-8',
<ide> conn_id: str = 'aws_default',
<ide> from_email: Optional[str] = None,
<add> custom_headers: Optional[Dict[str, Any]] = None,
<ide> **kwargs,
<ide> ) -> None:
<ide> """Email backend for SES."""
<ide> def send_email(
<ide> bcc=bcc,
<ide> mime_subtype=mime_subtype,
<ide> mime_charset=mime_charset,
<add> custom_headers=custom_headers,
<ide> )
<ide><path>tests/providers/amazon/aws/utils/test_emailer.py
<ide> def test_send_ses_email(self, mock_hook):
<ide> subject="subject",
<ide> html_content="content",
<ide> from_email="From Test <from@test.com>",
<add> custom_headers={"X-Test-Header": "test-val"},
<ide> )
<ide>
<ide> mock_hook.return_value.send_email.assert_called_once_with(
<ide> def test_send_ses_email(self, mock_hook):
<ide> files=None,
<ide> mime_charset="utf-8",
<ide> mime_subtype="mixed",
<add> custom_headers={"X-Test-Header": "test-val"},
<ide> )
<ide>
<ide> @mock.patch("airflow.providers.amazon.aws.utils.emailer.SesHook") | 2 |
Mixed | Javascript | fix svc/nvc for androiddrawerlayout | 848e34e753ca4ea7cc3e3262d3354a557467efca | <ide><path>Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js
<ide> type NativeProps = $ReadOnly<{|
<ide> /**
<ide> * Function called whenever the navigation view has been opened.
<ide> */
<del> onDrawerOpen?: ?DirectEventHandler<null, 'topDrawerOpened'>,
<add> onDrawerOpen?: ?DirectEventHandler<null>,
<ide>
<ide> /**
<ide> * Function called whenever the navigation view has been closed.
<ide> */
<del> onDrawerClose?: ?DirectEventHandler<null, 'topDrawerClosed'>,
<add> onDrawerClose?: ?DirectEventHandler<null>,
<ide>
<ide> /**
<ide> * Make the drawer take the entire screen and draw the background of the
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.java
<ide> public void closeDrawer(ReactDrawerLayout view) {
<ide> }
<ide>
<ide> @Override
<add> @ReactProp(name = "keyboardDismissMode")
<ide> public void setKeyboardDismissMode(ReactDrawerLayout view, @Nullable String value) {}
<ide>
<ide> @Override
<add> @ReactProp(name = "drawerBackgroundColor", customType = "Color")
<ide> public void setDrawerBackgroundColor(ReactDrawerLayout view, @Nullable Integer value) {}
<ide>
<ide> @Override
<add> @ReactProp(name = "statusBarBackgroundColor", customType = "Color")
<ide> public void setStatusBarBackgroundColor(ReactDrawerLayout view, @Nullable Integer value) {}
<ide>
<ide> @Override | 2 |
Javascript | Javascript | fix request path for proxied requests | 4de17bca095345854a1a39a60af8d85f55961900 | <ide><path>lib/adapters/http.js
<ide> module.exports = function httpAdapter(resolve, reject, config) {
<ide> if (config.proxy) {
<ide> options.host = config.proxy.host;
<ide> options.port = config.proxy.port;
<del> options.path = parsed.protocol + '//' + parsed.hostname + buildUrl(parsed.path, config.params).replace(/^\?/, '')
<add> options.path = parsed.protocol + '//' + parsed.hostname + options.path;
<ide> }
<ide>
<ide> // Create the request | 1 |
Python | Python | remove unused return value | 48fd6b902681e65be09e0fc2d4f47e751b9a1405 | <ide><path>test/test_voxel.py
<ide> def setUp(self):
<ide> def test_auth_failed(self):
<ide> VoxelMockHttp.type = 'UNAUTHORIZED'
<ide> try:
<del> ret = self.driver.list_nodes()
<add> self.driver.list_nodes()
<ide> except Exception, e:
<ide> self.assertTrue(isinstance(e, InvalidCredsException))
<ide> else: | 1 |
Javascript | Javascript | update imports in ember-testing package tests | 42e22ec8ff246474ea0b77b2e15e8203c6add104 | <ide><path>packages/ember-testing/tests/acceptance_test.js
<del>import run from 'ember-metal/run_loop';
<del>import jQuery from 'ember-views/system/jquery';
<del>import Test from 'ember-testing/test';
<del>import QUnitAdapter from 'ember-testing/adapters/qunit';
<del>import 'ember-testing/initializers'; // ensure the initializer is setup
<del>import EmberApplication from 'ember-application/system/application';
<del>import EmberRoute from 'ember-routing/system/route';
<add>import { run } from 'ember-metal';
<add>import { jQuery } from 'ember-views';
<add>import Test from '../test';
<add>import QUnitAdapter from '../adapters/qunit';
<add>import '../initializers'; // ensure the initializer is setup
<add>import { Application as EmberApplication } from 'ember-application';
<add>import { Route as EmberRoute } from 'ember-routing';
<ide> import { compile } from 'ember-template-compiler';
<del>import RSVP from 'ember-runtime/ext/rsvp';
<add>import { RSVP } from 'ember-runtime';
<ide> import { setTemplates, setTemplate } from 'ember-glimmer';
<ide>
<ide> //ES6TODO: we need {{link-to}} and {{outlet}} to exist here
<ide><path>packages/ember-testing/tests/adapters/adapter_test.js
<del>import run from 'ember-metal/run_loop';
<del>import Adapter from 'ember-testing/adapters/adapter';
<add>import { run } from 'ember-metal';
<add>import Adapter from '../../adapters/adapter';
<ide>
<ide> var adapter;
<ide>
<ide><path>packages/ember-testing/tests/adapters/qunit_test.js
<del>import run from 'ember-metal/run_loop';
<del>import QUnitAdapter from 'ember-testing/adapters/qunit';
<add>import { run } from 'ember-metal';
<add>import QUnitAdapter from '../../adapters/qunit';
<ide>
<ide> var adapter;
<ide>
<ide><path>packages/ember-testing/tests/adapters_test.js
<del>import run from 'ember-metal/run_loop';
<del>import Test from 'ember-testing/test';
<del>import Adapter from 'ember-testing/adapters/adapter';
<del>import QUnitAdapter from 'ember-testing/adapters/qunit';
<del>import EmberApplication from 'ember-application/system/application';
<add>import { run } from 'ember-metal';
<add>import Test from '../test';
<add>import Adapter from '../adapters/adapter';
<add>import QUnitAdapter from '../adapters/qunit';
<add>import { Application as EmberApplication } from 'ember-application';
<ide>
<ide> var App, originalAdapter;
<ide>
<ide><path>packages/ember-testing/tests/ext/rsvp_test.js
<del>import RSVP from 'ember-testing/ext/rsvp';
<del>import { getAdapter, setAdapter } from 'ember-testing/test/adapter';
<del>import { isTesting, setTesting } from 'ember-metal/testing';
<del>import run from 'ember-metal/run_loop';
<add>import RSVP from '../../ext/rsvp';
<add>import { getAdapter, setAdapter } from '../../test/adapter';
<add>import { isTesting, setTesting, run } from 'ember-metal';
<ide>
<ide> const originalTestAdapter = getAdapter();
<ide> const originalTestingFlag = isTesting();
<ide><path>packages/ember-testing/tests/helper_registration_test.js
<del>import run from 'ember-metal/run_loop';
<del>import Test from 'ember-testing/test';
<del>import EmberApplication from 'ember-application/system/application';
<add>import { run } from 'ember-metal';
<add>import Test from '../test';
<add>import { Application as EmberApplication } from 'ember-application';
<ide>
<ide> var App, appBooted, helperContainer;
<ide>
<ide><path>packages/ember-testing/tests/helpers_test.js
<del>import Route from 'ember-routing/system/route';
<del>import Controller from 'ember-runtime/controllers/controller';
<del>import run from 'ember-metal/run_loop';
<del>import EmberObject from 'ember-runtime/system/object';
<del>import RSVP from 'ember-runtime/ext/rsvp';
<del>import jQuery from 'ember-views/system/jquery';
<del>import { Component, setTemplates, setTemplate } from 'ember-glimmer';
<del>
<del>import Test from 'ember-testing/test';
<del>import 'ember-testing/helpers'; // ensure that the helpers are loaded
<del>import 'ember-testing/initializers'; // ensure the initializer is setup
<del>import setupForTesting from 'ember-testing/setup_for_testing';
<del>import EmberRouter from 'ember-routing/system/router';
<del>import EmberRoute from 'ember-routing/system/route';
<del>import EmberApplication from 'ember-application/system/application';
<add>import { Route, Router } from 'ember-routing';
<add>import {
<add> Controller,
<add> Object as EmberObject,
<add> RSVP
<add>} from 'ember-runtime';
<add>import { run } from 'ember-metal';
<add>import { jQuery } from 'ember-views';
<add>import {
<add> Component,
<add> setTemplates,
<add> setTemplate
<add>} from 'ember-glimmer';
<add>
<add>import Test from '../test';
<add>import '../helpers'; // ensure that the helpers are loaded
<add>import '../initializers'; // ensure the initializer is setup
<add>import setupForTesting from '../setup_for_testing';
<add>import { Application as EmberApplication } from 'ember-application';
<ide> import { compile } from 'ember-template-compiler';
<ide>
<ide> import {
<ide> pendingRequests,
<ide> incrementPendingRequests,
<ide> clearPendingRequests
<del>} from 'ember-testing/test/pending_requests';
<add>} from '../test/pending_requests';
<ide> import {
<ide> setAdapter,
<ide> getAdapter
<del>} from 'ember-testing/test/adapter';
<add>} from '../test/adapter';
<ide> import {
<ide> registerWaiter,
<ide> unregisterWaiter
<del>} from 'ember-testing/test/waiters';
<add>} from '../test/waiters';
<ide>
<ide> var App;
<ide> var originalAdapter = getAdapter();
<ide> QUnit.module('ember-testing debugging helpers', {
<ide> setupApp();
<ide>
<ide> run(function() {
<del> App.Router = EmberRouter.extend({
<add> App.Router = Router.extend({
<ide> location: 'none'
<ide> });
<ide> });
<ide> QUnit.module('ember-testing routing helpers', {
<ide>
<ide> App.injectTestHelpers();
<ide>
<del> App.Router = EmberRouter.extend({
<add> App.Router = Router.extend({
<ide> location: 'none'
<ide> });
<ide>
<ide> QUnit.module('ember-testing async router', {
<ide>
<ide> run(function() {
<ide> App = EmberApplication.create();
<del> App.Router = EmberRouter.extend({
<add> App.Router = Router.extend({
<ide> location: 'none'
<ide> });
<ide>
<ide> QUnit.module('ember-testing async router', {
<ide> });
<ide> });
<ide>
<del> App.UserRoute = EmberRoute.extend({
<add> App.UserRoute = Route.extend({
<ide> model() {
<ide> return resolveLater();
<ide> }
<ide> });
<ide>
<del> App.UserProfileRoute = EmberRoute.extend({
<add> App.UserProfileRoute = Route.extend({
<ide> beforeModel() {
<ide> var self = this;
<ide> return resolveLater().then(function() {
<ide><path>packages/ember-testing/tests/integration_test.js
<del>import run from 'ember-metal/run_loop';
<del>import EmberObject from 'ember-runtime/system/object';
<del>import jQuery from 'ember-views/system/jquery';
<del>import Test from 'ember-testing/test';
<del>import EmberRoute from 'ember-routing/system/route';
<del>import EmberApplication from 'ember-application/system/application';
<add>import { run } from 'ember-metal';
<add>import {
<add> Object as EmberObject,
<add> Controller,
<add> A as emberA
<add>} from 'ember-runtime';
<add>import { jQuery } from 'ember-views';
<add>import Test from '../test';
<add>import { Route as EmberRoute } from 'ember-routing';
<add>import { Application as EmberApplication } from 'ember-application';
<ide> import { compile } from 'ember-template-compiler';
<del>import Controller from 'ember-runtime/controllers/controller';
<del>import { A as emberA } from 'ember-runtime/system/native_array';
<ide> import { setTemplates, setTemplate } from 'ember-glimmer';
<ide>
<del>import 'ember-application';
<del>
<ide> var App, find, visit;
<ide> var originalAdapter = Test.adapter;
<ide>
<ide><path>packages/ember-testing/tests/simple_setup.js
<del>import run from 'ember-metal/run_loop';
<del>import jQuery from 'ember-views/system/jquery';
<add>import { run } from 'ember-metal';
<add>import { jQuery } from 'ember-views';
<ide>
<ide> var App;
<ide>
<ide><path>packages/ember-testing/tests/test/waiters-test.js
<del>import isEnabled from 'ember-metal/features';
<add>import { isFeatureEnabled } from 'ember-metal';
<ide> import {
<ide> registerWaiter,
<ide> unregisterWaiter,
<ide> checkWaiters,
<ide> generateDeprecatedWaitersArray
<del>} from 'ember-testing/test/waiters';
<add>} from '../../test/waiters';
<ide>
<ide> class Waiters {
<ide> constructor() {
<ide> QUnit.test('generateDeprecatedWaitersArray provides deprecated access to waiters
<ide> this.waiters.register();
<ide>
<ide> let waiters;
<del> if (isEnabled('ember-testing-check-waiters')) {
<add> if (isFeatureEnabled('ember-testing-check-waiters')) {
<ide> expectDeprecation(function() {
<ide> waiters = generateDeprecatedWaitersArray();
<ide> }, /Usage of `Ember.Test.waiters` is deprecated/); | 10 |
Javascript | Javascript | add test case | dda231ed471db3e6279307f3e62a29cd15f72b9d | <ide><path>test/fixtures/buildDependencies/run.js
<ide> webpack(
<ide> type: "filesystem",
<ide> cacheDirectory: path.resolve(__dirname, "../../js/buildDepsCache"),
<ide> buildDependencies: {
<del> config: [__filename]
<del> }
<add> config: [
<add> __filename,
<add> path.resolve(__dirname, "../../../node_modules/.yarn-integrity")
<add> ]
<add> },
<add> managedPaths: [path.resolve(__dirname, "../../../node_modules")]
<ide> }
<ide> },
<ide> (err, stats) => { | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.