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 |
|---|---|---|---|---|---|
PHP | PHP | fix warnings on complex keys | 906b2fe6f3a3ea83fef70237c53ed06928ead0a5 | <ide><path>src/ORM/Table.php
<ide> protected function _insert($entity, $data)
<ide> $primary = array_combine($primary, $id);
<ide> $primary = array_intersect_key($data, $primary) + $primary;
<ide>
<del> $filteredKeys = array_filter($primary, 'strlen');
<add> $filteredKeys = array_filter($primary, function ($v) {
<add> return $v !== null;
<add> });
<ide> $data += $filteredKeys;
<ide>
<ide> if (count($primary) > 1) {
<ide><path>tests/Fixture/DateKeysFixture.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> * @link https://cakephp.org CakePHP(tm) Project
<add> * @since 3.7.4
<add> * @license https://opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Test\Fixture;
<add>
<add>use Cake\TestSuite\Fixture\TestFixture;
<add>
<add>/**
<add> * Fixture for testing complex types as primary keys
<add> */
<add>class DateKeysFixture extends TestFixture
<add>{
<add>
<add> /**
<add> * fields property
<add> *
<add> * @var array
<add> */
<add> public $fields = [
<add> 'id' => ['type' => 'date'],
<add> 'title' => ['type' => 'string', 'null' => true],
<add> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
<add> ];
<add>
<add> /**
<add> * records property
<add> *
<add> * @var array
<add> */
<add> public $records = [];
<add>}
<ide><path>tests/TestCase/ORM/TableComplexIdTest.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> * @link https://cakephp.org CakePHP(tm) Project
<add> * @since 3.7.4
<add> * @license https://opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Test\TestCase\ORM;
<add>
<add>use Cake\Datasource\ConnectionManager;
<add>use Cake\ORM\Entity;
<add>use Cake\TestSuite\TestCase;
<add>use Cake\Utility\Text;
<add>use DateTime;
<add>
<add>/**
<add> * Integration tests for Table class with uuid primary keys.
<add> */
<add>class TableComplexIdTest extends TestCase
<add>{
<add> /**
<add> * Fixtures
<add> *
<add> * @var array
<add> */
<add> public $fixtures = [
<add> 'core.DateKeys',
<add> ];
<add>
<add> /**
<add> * setup
<add> *
<add> * @return void
<add> */
<add> public function setUp()
<add> {
<add> parent::setUp();
<add> $this->connection = ConnectionManager::get('test');
<add> static::setAppNamespace();
<add> }
<add>
<add> /**
<add> * teardown
<add> *
<add> * @return void
<add> */
<add> public function tearDown()
<add> {
<add> parent::tearDown();
<add> $this->getTableLocator()->clear();
<add> }
<add>
<add> /**
<add> * Test saving new records sets uuids
<add> *
<add> * @return void
<add> */
<add> public function testSaveNew()
<add> {
<add> $now = new DateTime('now');
<add> $entity = new Entity([
<add> 'id' => $now,
<add> 'title' => 'shiny new',
<add> ]);
<add> $table = $this->getTableLocator()->get('DateKeys');
<add> $this->assertSame($entity, $table->save($entity));
<add> $this->assertEquals($now, $entity->id);
<add>
<add> $row = $table->find('all')->where(['id' => $entity->id])->first();
<add> $this->assertEquals($row->id->format('Y-m-d'), $entity->id->format('Y-m-d'));
<add> }
<add>
<add> /**
<add> * Test saving existing records works
<add> *
<add> * @return void
<add> */
<add> public function testSaveUpdate()
<add> {
<add> $id = new DateTime('now');
<add> $entity = new Entity([
<add> 'id' => $id,
<add> 'title' => 'shiny update',
<add> ]);
<add>
<add> $table = $this->getTableLocator()->get('DateKeys');
<add> $this->assertSame($entity, $table->save($entity));
<add> $this->assertEquals($id, $entity->id, 'Should match');
<add>
<add> $row = $table->find('all')->where(['id' => $entity->id])->first();
<add> $row->title = 'things';
<add> $this->assertSame($row, $table->save($row));
<add> }
<add>
<add> /**
<add> * Test delete with string pk.
<add> *
<add> * @return void
<add> */
<add> public function testDelete()
<add> {
<add> $table = $this->getTableLocator()->get('DateKeys');
<add> $entity = new Entity([
<add> 'id' => new DateTime('now'),
<add> 'title' => 'shiny update',
<add> ]);
<add> $table->save($entity);
<add> $this->assertTrue($table->delete($entity));
<add>
<add> $query = $table->find('all')->where(['id' => $entity->id]);
<add> $this->assertEmpty($query->first(), 'No row left');
<add> }
<add>} | 3 |
Ruby | Ruby | add tests for the polymorphic_path method | 5dd6e1b142a5673f1ce6a882ca07e2526c43e740 | <ide><path>actionview/test/activerecord/polymorphic_routes_test.rb
<ide> def setup
<ide> end
<ide>
<ide> def assert_url(url, args)
<add> host = self.class.default_url_options[:host]
<add>
<add> assert_equal url.sub(/http:\/\/#{host}/, ''), polymorphic_path(args)
<ide> assert_equal url, polymorphic_url(args)
<ide> assert_equal url, url_for(args)
<ide> end | 1 |
Javascript | Javascript | improve buffer.from performance | fc1fa4e2c49aa060b97b139ff02b5be8037dba94 | <ide><path>lib/buffer.js
<ide> Buffer.from = function from(value, encodingOrOffset, length) {
<ide> if (isAnyArrayBuffer(value))
<ide> return fromArrayBuffer(value, encodingOrOffset, length);
<ide>
<del> if (value == null) {
<add> if (value === null || value === undefined) {
<ide> throw new errors.TypeError(
<ide> 'ERR_INVALID_ARG_TYPE',
<ide> 'first argument',
<ide> Buffer.from = function from(value, encodingOrOffset, length) {
<ide> );
<ide>
<ide> const valueOf = value.valueOf && value.valueOf();
<del> if (valueOf != null && valueOf !== value)
<add> if (valueOf !== null && valueOf !== undefined && valueOf !== value)
<ide> return Buffer.from(valueOf, encodingOrOffset, length);
<ide>
<ide> var b = fromObject(value);
<ide> function allocate(size) {
<ide> function fromString(string, encoding) {
<ide> var length;
<ide> if (typeof encoding !== 'string' || encoding.length === 0) {
<del> encoding = 'utf8';
<ide> if (string.length === 0)
<ide> return new FastBuffer();
<add> encoding = 'utf8';
<ide> length = byteLengthUtf8(string);
<ide> } else {
<ide> length = byteLength(string, encoding, true); | 1 |
Python | Python | remove redundant builtins imports | 3934ef22494db6d9613c229aaa82ea6a366b7c2f | <ide><path>airflow/providers/amazon/aws/operators/glue.py
<ide> # KIND, either express or implied. See the License for the
<ide> # specific language governing permissions and limitations
<ide> # under the License.
<del>from __future__ import unicode_literals
<ide>
<ide> import os.path
<ide> from typing import Optional
<ide><path>airflow/smart_sensor_dags/smart_sensor_group.py
<ide> # under the License.
<ide>
<ide> """Smart sensor DAGs managing all smart sensor tasks."""
<del>from builtins import range
<ide> from datetime import timedelta
<ide>
<ide> from airflow.configuration import conf | 2 |
PHP | PHP | fix recusion when exporting configuration data | 8c6b0833736188c7343225fcd44dd20247ea19fe | <ide><path>src/Core/ObjectRegistry.php
<ide> protected function _checkDuplicate($name, $config)
<ide> {
<ide> /** @var \Cake\Core\InstanceConfigTrait $existing */
<ide> $existing = $this->_loaded[$name];
<del> $msg = sprintf('The "%s" alias has already been loaded', $name);
<add> $msg = sprintf('The "%s" alias has already been loaded.', $name);
<ide> $hasConfig = method_exists($existing, 'config');
<ide> if (!$hasConfig) {
<ide> throw new RuntimeException($msg);
<ide> protected function _checkDuplicate($name, $config)
<ide> $existingConfig = $existing->getConfig();
<ide> unset($config['enabled'], $existingConfig['enabled']);
<ide>
<del> $fail = false;
<add> $failure = null;
<ide> foreach ($config as $key => $value) {
<ide> if (!array_key_exists($key, $existingConfig)) {
<del> $fail = true;
<add> $failure = " The `{$key}` was not defined in the previous configuration data.";
<ide> break;
<ide> }
<ide> if (isset($existingConfig[$key]) && $existingConfig[$key] !== $value) {
<del> $fail = true;
<add> $failure = sprintf(
<add> ' The `%s` key has a value of `%s` but previously had a value of `%s`',
<add> $key,
<add> json_encode($value),
<add> json_encode($existingConfig[$key])
<add> );
<ide> break;
<ide> }
<ide> }
<del> if ($fail) {
<del> $msg .= ' with the following config: ';
<del> $msg .= var_export($existingConfig, true);
<del> $msg .= ' which differs from ' . var_export($config, true);
<del> throw new RuntimeException($msg);
<add> if ($failure) {
<add> throw new RuntimeException($msg . $failure);
<ide> }
<ide> }
<ide>
<ide><path>tests/TestCase/View/HelperRegistryTest.php
<ide> public function testLoadMultipleTimesDefaultConfigValuesWorks()
<ide> public function testLoadMultipleTimesDifferentConfigured()
<ide> {
<ide> $this->expectException(\RuntimeException::class);
<del> $this->expectExceptionMessage('The "Html" alias has already been loaded with the following');
<add> $this->expectExceptionMessage('The "Html" alias has already been loaded');
<ide> $this->Helpers->load('Html');
<ide> $this->Helpers->load('Html', ['same' => 'stuff']);
<ide> }
<ide> public function testLoadMultipleTimesDifferentConfigured()
<ide> public function testLoadMultipleTimesDifferentConfigValues()
<ide> {
<ide> $this->expectException(\RuntimeException::class);
<del> $this->expectExceptionMessage('The "Html" alias has already been loaded with the following');
<add> $this->expectExceptionMessage('The "Html" alias has already been loaded');
<ide> $this->Helpers->load('Html', ['key' => 'value']);
<ide> $this->Helpers->load('Html', ['key' => 'new value']);
<ide> } | 2 |
Ruby | Ruby | use default remote if forcing homebrew on linux | df086d618e28cee45011c1609c9884c278f53126 | <ide><path>Library/Homebrew/dev-cmd/bump-formula-pr.rb
<ide> def bump_formula_pr_args
<ide> def use_correct_linux_tap(formula, args:)
<ide> default_origin_branch = formula.tap.path.git_origin_branch
<ide>
<del> return formula.tap.remote_repo, "origin", default_origin_branch, "-" if !OS.linux? || !formula.tap.core_tap?
<add> if !OS.linux? || !formula.tap.core_tap? || Homebrew::EnvConfig.force_homebrew_on_linux?
<add> return formula.tap.remote_repo, "origin", default_origin_branch, "-"
<add> end
<ide>
<ide> tap_remote_repo = formula.tap.full_name.gsub("linuxbrew", "homebrew")
<ide> homebrew_core_url = "https://github.com/#{tap_remote_repo}" | 1 |
Python | Python | fix various typos in airflow/cli/commands | fc033048f746684454a447170477d90be4d35794 | <ide><path>airflow/cli/commands/dag_command.py
<ide>
<ide>
<ide> def _tabulate_dag_runs(dag_runs: List[DagRun], tablefmt: str = "fancy_grid") -> str:
<del> tabulat_data = (
<add> tabulate_data = (
<ide> {
<ide> 'ID': dag_run.id,
<ide> 'Run ID': dag_run.run_id,
<ide> def _tabulate_dag_runs(dag_runs: List[DagRun], tablefmt: str = "fancy_grid") ->
<ide> } for dag_run in dag_runs
<ide> )
<ide> return tabulate(
<del> tabular_data=tabulat_data,
<add> tabular_data=tabulate_data,
<ide> tablefmt=tablefmt
<ide> )
<ide>
<ide>
<ide> def _tabulate_dags(dags: List[DAG], tablefmt: str = "fancy_grid") -> str:
<del> tabulat_data = (
<add> tabulate_data = (
<ide> {
<ide> 'DAG ID': dag.dag_id,
<ide> 'Filepath': dag.filepath,
<ide> 'Owner': dag.owner,
<ide> } for dag in sorted(dags, key=lambda d: d.dag_id)
<ide> )
<ide> return tabulate(
<del> tabular_data=tabulat_data,
<add> tabular_data=tabulate_data,
<ide> tablefmt=tablefmt,
<ide> headers='keys'
<ide> )
<ide> def dag_state(args):
<ide> dag = get_dag_by_file_location(args.dag_id)
<ide> dr = DagRun.find(dag.dag_id, execution_date=args.execution_date)
<ide> out = dr[0].state if dr else None
<del> confout = ''
<add> conf_out = ''
<ide> if out and dr[0].conf:
<del> confout = ', ' + json.dumps(dr[0].conf)
<del> print(str(out) + confout)
<add> conf_out = ', ' + json.dumps(dr[0].conf)
<add> print(str(out) + conf_out)
<ide>
<ide>
<ide> @cli_utils.action_logging
<ide><path>airflow/cli/commands/info_command.py
<ide> def process_path(self, value):
<ide> """Remove pii from paths"""
<ide>
<ide> def process_username(self, value):
<del> """Remove pii from ussername"""
<add> """Remove pii from username"""
<ide>
<ide> def process_url(self, value):
<ide> """Remove pii from URL"""
<ide> def __str__(self):
<ide>
<ide>
<ide> class PathsInfo:
<del> """Path informaation"""
<add> """Path information"""
<ide>
<ide> def __init__(self, anonymizer: Anonymizer):
<ide> system_path = os.environ.get("PATH", "").split(os.pathsep)
<ide><path>airflow/cli/commands/webserver_command.py
<ide> class GunicornMonitor(LoggingMixin):
<ide> :param worker_refresh_batch_size: Number of workers to refresh at a time. When set to 0, worker
<ide> refresh is disabled. When nonzero, airflow periodically refreshes webserver workers by
<ide> bringing up new ones and killing old ones.
<del> :param reload_on_plugin_change: If set to True, Airflow will track files in plugins_follder directory.
<add> :param reload_on_plugin_change: If set to True, Airflow will track files in plugins_folder directory.
<ide> When it detects changes, then reload the gunicorn.
<ide> """
<ide> def __init__( | 3 |
Javascript | Javascript | add support for transparent evaluation of promises | 78b6e8a446c0e38075c14b724f3cdf345c01fa06 | <ide><path>src/service/parse.js
<ide> function parser(text, json, $filter){
<ide> consume(']');
<ide> return extend(
<ide> function(self){
<del> var o = obj(self);
<del> var i = indexFn(self);
<del> return (o) ? o[i] : undefined;
<add> var o = obj(self),
<add> i = indexFn(self),
<add> v, p;
<add>
<add> if (!o) return undefined;
<add> v = o[i];
<add> if (v && v.then) {
<add> p = v;
<add> if (!('$$v' in v)) {
<add> p.$$v = undefined;
<add> p.then(function(val) { p.$$v = val; });
<add> }
<add> v = v.$$v;
<add> }
<add> return v;
<ide> }, {
<ide> assign:function(self, value){
<ide> return obj(self)[indexFn(self)] = value;
<ide> function getterFn(path) {
<ide> var fn = getterFnCache[path];
<ide> if (fn) return fn;
<ide>
<del> var code = 'var l, fn, t;\n';
<add> var code = 'var l, fn, p;\n';
<ide> forEach(path.split('.'), function(key) {
<ide> key = (JS_KEYWORDS[key]) ? '["' + key + '"]' : '.' + key;
<ide> code += 'if(!s) return s;\n' +
<ide> function getterFn(path) {
<ide> ' fn=function(){ return l' + key + '.apply(l, arguments); };\n' +
<ide> ' fn.$unboundFn=s;\n' +
<ide> ' s=fn;\n' +
<add> '} else if (s && s.then) {\n' +
<add> ' if (!("$$v" in s)) {\n' +
<add> ' p=s;\n' +
<add> ' p.$$v = undefined;\n' +
<add> ' p.then(function(v) {p.$$v=v;});\n' +
<add> '}\n' +
<add> ' s=s.$$v\n' +
<ide> '}\n';
<ide> });
<ide> code += 'return s;';
<ide> fn = Function('s', code);
<del> fn["toString"] = function() { return code; };
<add> fn.toString = function() { return code; };
<ide>
<ide> return getterFnCache[path] = fn;
<ide> }
<ide><path>test/service/parseSpec.js
<ide> describe('parser', function() {
<ide> });
<ide>
<ide>
<add> describe('promises', function() {
<add> var deferred, promise, q;
<add>
<add> beforeEach(inject(function($q) {
<add> q = $q;
<add> deferred = q.defer();
<add> promise = deferred.promise;
<add> }));
<add>
<add> describe('{{promise}}', function() {
<add> it('should evaluated resolved promise and get its value', function() {
<add> deferred.resolve('hello!');
<add> scope.greeting = promise;
<add> expect(scope.$eval('greeting')).toBe(undefined);
<add> scope.$digest();
<add> expect(scope.$eval('greeting')).toBe('hello!');
<add> });
<add>
<add>
<add> it('should evaluated rejected promise and ignore the rejection reason', function() {
<add> deferred.reject('sorry');
<add> scope.greeting = promise;
<add> expect(scope.$eval('gretting')).toBe(undefined);
<add> scope.$digest();
<add> expect(scope.$eval('greeting')).toBe(undefined);
<add> });
<add>
<add>
<add> it('should evaluate a promise and eventualy get its value', function() {
<add> scope.greeting = promise;
<add> expect(scope.$eval('greeting')).toBe(undefined);
<add>
<add> scope.$digest();
<add> expect(scope.$eval('greeting')).toBe(undefined);
<add>
<add> deferred.resolve('hello!');
<add> expect(scope.$eval('greeting')).toBe(undefined);
<add> scope.$digest();
<add> expect(scope.$eval('greeting')).toBe('hello!');
<add> });
<add>
<add>
<add> it('should evaluate a promise and eventualy ignore its rejection', function() {
<add> scope.greeting = promise;
<add> expect(scope.$eval('greeting')).toBe(undefined);
<add>
<add> scope.$digest();
<add> expect(scope.$eval('greeting')).toBe(undefined);
<add>
<add> deferred.reject('sorry');
<add> expect(scope.$eval('greeting')).toBe(undefined);
<add> scope.$digest();
<add> expect(scope.$eval('greeting')).toBe(undefined);
<add> });
<add> });
<add>
<add> describe('dereferencing', function() {
<add> it('should evaluate and dereference properties leading to and from a promise', function() {
<add> scope.obj = {greeting: promise};
<add> expect(scope.$eval('obj.greeting')).toBe(undefined);
<add> expect(scope.$eval('obj.greeting.polite')).toBe(undefined);
<add>
<add> scope.$digest();
<add> expect(scope.$eval('obj.greeting')).toBe(undefined);
<add> expect(scope.$eval('obj.greeting.polite')).toBe(undefined);
<add>
<add> deferred.resolve({polite: 'Good morning!'});
<add> scope.$digest();
<add> expect(scope.$eval('obj.greeting')).toEqual({polite: 'Good morning!'});
<add> expect(scope.$eval('obj.greeting.polite')).toBe('Good morning!');
<add> });
<add>
<add> it('should evaluate and dereference properties leading to and from a promise via bracket ' +
<add> 'notation', function() {
<add> scope.obj = {greeting: promise};
<add> expect(scope.$eval('obj["greeting"]')).toBe(undefined);
<add> expect(scope.$eval('obj["greeting"]["polite"]')).toBe(undefined);
<add>
<add> scope.$digest();
<add> expect(scope.$eval('obj["greeting"]')).toBe(undefined);
<add> expect(scope.$eval('obj["greeting"]["polite"]')).toBe(undefined);
<add>
<add> deferred.resolve({polite: 'Good morning!'});
<add> scope.$digest();
<add> expect(scope.$eval('obj["greeting"]')).toEqual({polite: 'Good morning!'});
<add> expect(scope.$eval('obj["greeting"]["polite"]')).toBe('Good morning!');
<add> });
<add>
<add>
<add> it('should evaluate and dereference array references leading to and from a promise',
<add> function() {
<add> scope.greetings = [promise];
<add> expect(scope.$eval('greetings[0]')).toBe(undefined);
<add> expect(scope.$eval('greetings[0][0]')).toBe(undefined);
<add>
<add> scope.$digest();
<add> expect(scope.$eval('greetings[0]')).toBe(undefined);
<add> expect(scope.$eval('greetings[0][0]')).toBe(undefined);
<add>
<add> deferred.resolve(['Hi!', 'Cau!']);
<add> scope.$digest();
<add> expect(scope.$eval('greetings[0]')).toEqual(['Hi!', 'Cau!']);
<add> expect(scope.$eval('greetings[0][0]')).toBe('Hi!');
<add> });
<add>
<add>
<add> it('should evaluate and dereference promises used as function arguments', function() {
<add> scope.greet = function(name) { return 'Hi ' + name + '!'; };
<add> scope.name = promise;
<add> expect(scope.$eval('greet(name)')).toBe('Hi undefined!');
<add>
<add> scope.$digest();
<add> expect(scope.$eval('greet(name)')).toBe('Hi undefined!');
<add>
<add> deferred.resolve('Veronica');
<add> expect(scope.$eval('greet(name)')).toBe('Hi undefined!');
<add>
<add> scope.$digest();
<add> expect(scope.$eval('greet(name)')).toBe('Hi Veronica!');
<add> });
<add>
<add>
<add> it('should evaluate and dereference promises used as array indexes', function() {
<add> scope.childIndex = promise;
<add> scope.kids = ['Adam', 'Veronica', 'Elisa'];
<add> expect(scope.$eval('kids[childIndex]')).toBe(undefined);
<add>
<add> scope.$digest();
<add> expect(scope.$eval('kids[childIndex]')).toBe(undefined);
<add>
<add> deferred.resolve(1);
<add> expect(scope.$eval('kids[childIndex]')).toBe(undefined);
<add>
<add> scope.$digest();
<add> expect(scope.$eval('kids[childIndex]')).toBe('Veronica');
<add> });
<add>
<add>
<add> it('should evaluate and dereference promises used as keys in bracket notation', function() {
<add> scope.childKey = promise;
<add> scope.kids = {'a': 'Adam', 'v': 'Veronica', 'e': 'Elisa'};
<add>
<add> expect(scope.$eval('kids[childKey]')).toBe(undefined);
<add>
<add> scope.$digest();
<add> expect(scope.$eval('kids[childKey]')).toBe(undefined);
<add>
<add> deferred.resolve('v');
<add> expect(scope.$eval('kids[childKey]')).toBe(undefined);
<add>
<add> scope.$digest();
<add> expect(scope.$eval('kids[childKey]')).toBe('Veronica');
<add> });
<add>
<add>
<add> it('should not mess with the promise if it was not directly evaluated', function() {
<add> scope.obj = {greeting: promise, username: 'hi'};
<add> var obj = scope.$eval('obj');
<add> expect(obj.username).toEqual('hi');
<add> expect(typeof obj.greeting.then).toBe('function');
<add> });
<add> });
<add> });
<add>
<add>
<ide> describe('assignable', function() {
<ide> it('should expose assignment function', inject(function($parse) {
<ide> var fn = $parse('a'); | 2 |
Javascript | Javascript | remove ember global from ember-glimmer loc tests | 6e01000e4002910ddc966de07714323c101b95af | <ide><path>packages/ember-glimmer/tests/integration/helpers/loc-test.js
<ide> import { RenderingTest, moduleFor } from '../../utils/test-case';
<ide> import { set } from 'ember-metal';
<del>import Ember from 'ember';
<add>import { setStrings } from 'ember-runtime';
<ide>
<ide> moduleFor('Helpers test: {{loc}}', class extends RenderingTest {
<ide>
<ide> constructor() {
<ide> super();
<del> this.oldString = Ember.STRINGS;
<del> Ember.STRINGS = {
<add> setStrings({
<ide> 'Hello Friend': 'Hallo Freund',
<ide> 'Hello': 'Hallo, %@'
<del> };
<add> });
<ide> }
<ide>
<ide> teardown() {
<ide> super.teardown();
<del> Ember.STRINGS = this.oldString;
<add> setStrings({});
<ide> }
<ide>
<ide> ['@test it lets the original value through by default']() {
<ide> moduleFor('Helpers test: {{loc}}', class extends RenderingTest {
<ide> this.render(`{{loc greeting}}`, {
<ide> greeting: 'Hello Friend'
<ide> });
<del> this.assertText('Yup', 'the localized string is correct');
<add> this.assertText('Yup', 'the localized string is correct');
<ide> }
<ide> }); | 1 |
Text | Text | add erickwendel to collaborators | 948712bc4c4b24edc238222ba6a7e585f51d01ef | <ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> **Daniele Belardi** <<dwon.dnl@gmail.com>> (he/him)
<ide> * [edsadr](https://github.com/edsadr) -
<ide> **Adrian Estrada** <<edsadr@gmail.com>> (he/him)
<add>* [erickwendel](https://github.com/erickwendel) -
<add> **Erick Wendel** <<erick.workspace@gmail.com>> (he/him)
<ide> * [evanlucas](https://github.com/evanlucas) -
<ide> **Evan Lucas** <<evanlucas@me.com>> (he/him)
<ide> * [fhinkel](https://github.com/fhinkel) - | 1 |
Python | Python | fix early return in polyadd | f11c32a592360e6def1c9e338a436ad869598833 | <ide><path>numpy/lib/polynomial.py
<ide> def polyadd(a1, a2):
<ide> a2 = atleast_1d(a2)
<ide> diff = len(a2) - len(a1)
<ide> if diff == 0:
<del> return a1 + a2
<add> val = a1 + a2
<ide> elif diff > 0:
<ide> zr = NX.zeros(diff, a1.dtype)
<ide> val = NX.concatenate((zr, a1)) + a2 | 1 |
Ruby | Ruby | resolve warnings by instantizing @attrubtes as nil | e7330f3d4fa97c683a49457239402f826d8016b7 | <ide><path>activerecord/test/cases/attribute_methods_test.rb
<ide> def test_respond_to_with_allocated_object
<ide> # by inspecting it.
<ide> def test_allocated_object_can_be_inspected
<ide> topic = Topic.allocate
<add> topic.instance_eval { @attributes = nil }
<ide> assert_nothing_raised { topic.inspect }
<ide> assert topic.inspect, "#<Topic not initialized>"
<ide> end | 1 |
Text | Text | rewrite javascript guide to use es6 | 1e7f867a7a14403d549edd6b67949d9598192e14 | <ide><path>guides/source/working_with_javascript_in_rails.md
<ide> powers, a JavaScript writer can make a web page that can update just parts of
<ide> itself, without needing to get the full page data from the server. This is a
<ide> powerful technique that we call Ajax.
<ide>
<del>Rails ships with CoffeeScript by default, and so the rest of the examples
<del>in this guide will be in CoffeeScript. All of these lessons, of course, apply
<del>to vanilla JavaScript as well.
<add>As an example, here's some JavaScript code that makes an Ajax request:
<ide>
<del>As an example, here's some CoffeeScript code that makes an Ajax request using
<del>the jQuery library:
<del>
<del>```coffeescript
<del>$.ajax(url: "/test").done (html) ->
<del> $("#results").append html
<add>```js
<add>fetch("/test")
<add> .then((data) => data.text())
<add> .then((html) => {
<add> const results = document.querySelector("#results");
<add> results.insertAdjacentHTML("beforeend", data);
<add> });
<ide> ```
<ide>
<ide> This code fetches data from "/test", and then appends the result to the `div`
<ide> Here's the simplest way to write JavaScript. You may see it referred to as
<ide> 'inline JavaScript':
<ide>
<ide> ```html
<del><a href="#" onclick="this.style.backgroundColor='#990000'">Paint it red</a>
<add><a href="#" onclick="this.style.backgroundColor='#990000';event.preventDefault();">Paint it red</a>
<ide> ```
<ide> When clicked, the link background will become red. Here's the problem: what
<ide> happens when we have lots of JavaScript we want to execute on a click?
<ide>
<ide> ```html
<del><a href="#" onclick="this.style.backgroundColor='#009900';this.style.color='#FFFFFF';">Paint it green</a>
<add><a href="#" onclick="this.style.backgroundColor='#009900';this.style.color='#FFFFFF';event.preventDefault();">Paint it green</a>
<ide> ```
<ide>
<ide> Awkward, right? We could pull the function definition out of the click handler,
<del>and turn it into CoffeeScript:
<add>and turn it a function:
<ide>
<del>```coffeescript
<del>@paintIt = (element, backgroundColor, textColor) ->
<del> element.style.backgroundColor = backgroundColor
<del> if textColor?
<del> element.style.color = textColor
<add>```js
<add>window.paintIt = function(event, backgroundColor, textColor) {
<add> event.preventDefault();
<add> event.target.style.backgroundColor = backgroundColor;
<add> if (textColor) {
<add> event.target.style.color = textColor;
<add> }
<add>}
<ide> ```
<ide>
<ide> And then on our page:
<ide>
<ide> ```html
<del><a href="#" onclick="paintIt(this, '#990000')">Paint it red</a>
<add><a href="#" onclick="paintIt(event, '#990000')">Paint it red</a>
<ide> ```
<ide>
<ide> That's a little bit better, but what about multiple links that have the same
<ide> effect?
<ide>
<ide> ```html
<del><a href="#" onclick="paintIt(this, '#990000')">Paint it red</a>
<del><a href="#" onclick="paintIt(this, '#009900', '#FFFFFF')">Paint it green</a>
<del><a href="#" onclick="paintIt(this, '#000099', '#FFFFFF')">Paint it blue</a>
<add><a href="#" onclick="paintIt(event, '#990000')">Paint it red</a>
<add><a href="#" onclick="paintIt(event, '#009900', '#FFFFFF')">Paint it green</a>
<add><a href="#" onclick="paintIt(event, '#000099', '#FFFFFF')">Paint it blue</a>
<ide> ```
<ide>
<ide> Not very DRY, eh? We can fix this by using events instead. We'll add a `data-*`
<ide> attribute to our link, and then bind a handler to the click event of every link
<ide> that has that attribute:
<ide>
<del>```coffeescript
<del>@paintIt = (element, backgroundColor, textColor) ->
<del> element.style.backgroundColor = backgroundColor
<del> if textColor?
<del> element.style.color = textColor
<del>
<del>$ ->
<del> $("a[data-background-color]").click (e) ->
<del> e.preventDefault()
<del>
<del> backgroundColor = $(this).data("background-color")
<del> textColor = $(this).data("text-color")
<del> paintIt(this, backgroundColor, textColor)
<add>```js
<add>function paintIt(element, backgroundColor, textColor) {
<add> element.style.backgroundColor = backgroundColor;
<add> if (textColor) {
<add> element.style.color = textColor;
<add> }
<add>}
<add>
<add>window.addEventListener("load", () => {
<add> const links = document.querySelectorAll(
<add> "a[data-background-color]"
<add> );
<add> links.forEach((element) => {
<add> element.addEventListener("click", (event) => {
<add> event.preventDefault();
<add>
<add> const {backgroundColor, textColor} = element.dataset;
<add> paintIt(element, backgroundColor, textColor);
<add> });
<add> });
<add>});
<ide> ```
<ide> ```html
<ide> <a href="#" data-background-color="#990000">Paint it red</a>
<ide> concatenator. We can serve our entire JavaScript bundle on every page, which
<ide> means that it'll get downloaded on the first page load and then be cached on
<ide> every page after that. Lots of little benefits really add up.
<ide>
<del>The Rails team strongly encourages you to write your CoffeeScript (and
<del>JavaScript) in this style, and you can expect that many libraries will also
<del>follow this pattern.
<del>
<ide> Built-in Helpers
<ide> ----------------
<ide>
<ide> remote elements inside your application.
<ide> [`form_with`](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_with)
<ide> is a helper that assists with writing forms. By default, `form_with` assumes that
<ide> your form will be using Ajax. You can opt out of this behavior by
<del>passing the `:local` option `form_with`.
<add>passing the `:local` option to `form_with`.
<ide>
<ide> ```erb
<del><%= form_with model: @article do |form| %>
<add><%= form_with(model: @article, id: "new-article") do |form| %>
<ide> ...
<ide> <% end %>
<ide> ```
<ide>
<ide> This will generate the following HTML:
<ide>
<ide> ```html
<del><form action="/articles" accept-charset="UTF-8" method="post" data-remote="true">
<add><form id="new-article" action="/articles" accept-charset="UTF-8" method="post" data-remote="true">
<ide> ...
<ide> </form>
<ide> ```
<ide> You probably don't want to just sit there with a filled out `<form>`, though.
<ide> You probably want to do something upon a successful submission. To do that,
<ide> bind to the `ajax:success` event. On failure, use `ajax:error`. Check it out:
<ide>
<del>```coffeescript
<del>$(document).ready ->
<del> $("#new_article").on("ajax:success", (event) ->
<del> [data, status, xhr] = event.detail
<del> $("#new_article").append xhr.responseText
<del> ).on "ajax:error", (event) ->
<del> $("#new_article").append "<p>ERROR</p>"
<add>```js
<add>window.addEventListener("load", () => {
<add> const element = document.querySelector("#new-article");
<add> element.addEventListener("ajax:success", (event) => {
<add> const [_data, _status, xhr] = event.detail;
<add> element.insertAdjacentHTML("beforeend", xhr.responseText);
<add> });
<add> element.addEventListener("ajax:error", () => {
<add> element.insertAdjacentHTML("beforeend", "<p>ERROR</p>");
<add> });
<add>});
<ide> ```
<ide>
<ide> Obviously, you'll want to be a bit more sophisticated than that, but it's a
<ide> start.
<ide>
<del>NOTE: As of Rails 5.1 and the new `rails-ujs`, the parameters `data, status, xhr`
<del>have been bundled into `event.detail`. For information about the previously used
<del>`jquery-ujs` in Rails 5 and earlier, read the [`jquery-ujs` wiki](https://github.com/rails/jquery-ujs/wiki/ajax).
<del>
<ide> #### link_to
<ide>
<ide> [`link_to`](https://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to)
<ide> click. We would generate some HTML like this:
<ide> <%= link_to "Delete article", @article, remote: true, method: :delete %>
<ide> ```
<ide>
<del>and write some CoffeeScript like this:
<add>and write some JavaScript like this:
<ide>
<del>```coffeescript
<del>$ ->
<del> $("a[data-remote]").on "ajax:success", (event) ->
<del> alert "The article was deleted."
<add>```js
<add>window.addEventListener("load", () => {
<add> const links = document.querySelectorAll("a[data-remote]");
<add> links.forEach((element) => {
<add> element.addEventListener("ajax:success", () => {
<add> alert("The article was deleted.");
<add> });
<add> });
<add>});
<ide> ```
<ide>
<ide> #### button_to
<ide> requests for `data-remote` elements, by way of the `data-type` attribute.
<ide> ### Confirmations
<ide>
<ide> You can ask for an extra confirmation of the user by adding a `data-confirm`
<del>attribute on links and forms. The user will be presented a JavaScript `confirm()`
<add>attribute on links and forms. The user will be presented with a JavaScript `confirm()`
<ide> dialog containing the attribute's text. If the user chooses to cancel, the action
<ide> doesn't take place.
<ide>
<ide> you should **not** have `data-confirm` on the form itself.
<ide> The default confirmation uses a JavaScript confirm dialog, but you can customize
<ide> this by listening to the `confirm` event, which is fired just before the confirmation
<ide> window appears to the user. To cancel this default confirmation, have the confirm
<del>handler to return `false`.
<add>handler return `false`.
<ide>
<ide> ### Automatic disabling
<ide>
<ide> This also works for links with `data-method` attribute.
<ide> For example:
<ide>
<ide> ```erb
<del><%= form_with model: @article.new do |form| %>
<add><%= form_with(model: Article.new) do |form| %>
<ide> <%= form.submit data: { disable_with: "Saving..." } %>
<del><%= end %>
<add><% end %>
<ide> ```
<ide>
<ide> This generates a form with:
<ide> These introductions cause small changes to `custom events` fired during the requ
<ide> NOTE: Signature of calls to UJS's event handlers has changed.
<ide> Unlike the version with jQuery, all custom events return only one parameter: `event`.
<ide> In this parameter, there is an additional attribute `detail` which contains an array of extra parameters.
<add>For information about the previously used `jquery-ujs` in Rails 5 and earlier, read the [`jquery-ujs` wiki](https://github.com/rails/jquery-ujs/wiki/ajax).
<ide>
<ide> | Event name | Extra parameters (event.detail) | Fired |
<ide> |---------------------|---------------------------------|-------------------------------------------------------------|
<ide> In this parameter, there is an additional attribute `detail` which contains an a
<ide>
<ide> Example usage:
<ide>
<del>```html
<del>document.body.addEventListener('ajax:success', function(event) {
<del> var detail = event.detail;
<del> var data = detail[0], status = detail[1], xhr = detail[2];
<del>})
<add>```js
<add>document.body.addEventListener("ajax:success", (event) => {
<add> const [data, status, xhr] = event.detail;
<add>});
<ide> ```
<ide>
<del>NOTE: As of Rails 5.1 and the new `rails-ujs`, the parameters `data, status, xhr`
<del>have been bundled into `event.detail`. For information about the previously used
<del>`jquery-ujs` in Rails 5 and earlier, read the [`jquery-ujs` wiki](https://github.com/rails/jquery-ujs/wiki/ajax).
<del>
<ide> ### Stoppable events
<add>
<ide> You can stop execution of the Ajax request by running `event.preventDefault()`
<ide> from the handlers methods `ajax:before` or `ajax:beforeSend`.
<ide> The `ajax:before` event can manipulate form data before serialization and the
<ide> browser to submit the form via normal means (i.e. non-Ajax submission) will be
<ide> canceled and the form will not be submitted at all. This is useful for
<ide> implementing your own Ajax file upload workaround.
<ide>
<del>Note, you should use `return false` to prevent event for `jquery-ujs` and
<del>`e.preventDefault()` for `rails-ujs`
<add>Note, you should use `return false` to prevent an event for `jquery-ujs` and
<add>`event.preventDefault()` for `rails-ujs`.
<ide>
<ide> Server-Side Concerns
<ide> --------------------
<ide> respond to your Ajax request. You then have a corresponding
<ide> `app/views/users/create.js.erb` view file that generates the actual JavaScript
<ide> code that will be sent and executed on the client side.
<ide>
<del>```erb
<del>$("<%= escape_javascript(render @user) %>").appendTo("#users");
<add>```js
<add>var users = document.querySelector("#users");
<add>users.insertAdjacentHTML("beforeend", "<%= j render(@user) %>");
<ide> ```
<ide>
<add>NOTE: JavaScript view rendering doesn't do any preprocessing, so you shouldn't use ES6 syntax here.
<add>
<ide> Turbolinks
<ide> ----------
<ide>
<ide> attribute to the tag:
<ide>
<ide> ### Page Change Events
<ide>
<del>When writing CoffeeScript, you'll often want to do some sort of processing upon
<del>page load. With jQuery, you'd write something like this:
<add>You'll often want to do some sort of processing upon
<add>page load. Using the DOM, you'd write something like this:
<ide>
<del>```coffeescript
<del>$(document).ready ->
<del> alert "page has loaded!"
<add>```js
<add>window.addEventListener("load", () => {
<add> alert("page has loaded!");
<add>});
<ide> ```
<ide>
<ide> However, because Turbolinks overrides the normal page loading process, the
<ide> event that this relies upon will not be fired. If you have code that looks like
<ide> this, you must change your code to do this instead:
<ide>
<del>```coffeescript
<del>$(document).on "turbolinks:load", ->
<del> alert "page has loaded!"
<add>```js
<add>document.addEventListener("turbolinks:load", () => {
<add> alert("page has loaded!");
<add>});
<ide> ```
<ide>
<ide> For more details, including other events you can bind to, check out [the
<ide> When using another library to make Ajax calls, it is necessary to add
<ide> the security token as a default header for Ajax calls in your library. To get
<ide> the token:
<ide>
<del>```javascript
<del>var token = document.getElementsByName('csrf-token')[0].content
<add>```js
<add>const token = document.getElementsByName(
<add> "csrf-token"
<add>)[0].content;
<ide> ```
<ide>
<ide> You can then submit this token as a `X-CSRF-Token` header for your
<ide> Ajax request. You do not need to add a CSRF token for GET requests,
<ide> only non-GET ones.
<ide>
<del>You can read more about about Cross-Site Request Forgery in [Security](https://guides.rubyonrails.org/security.html#cross-site-request-forgery-csrf)
<add>You can read more about about Cross-Site Request Forgery in the [Security guide](https://guides.rubyonrails.org/security.html#cross-site-request-forgery-csrf).
<ide>
<ide> Other Resources
<ide> ---------------
<ide>
<ide> Here are some helpful links to help you learn even more:
<ide>
<del>* [jquery-ujs wiki](https://github.com/rails/jquery-ujs/wiki)
<del>* [jquery-ujs list of external articles](https://github.com/rails/jquery-ujs/wiki/External-articles)
<del>* [Rails 3 Remote Links and Forms: A Definitive Guide](http://www.alfajango.com/blog/rails-3-remote-links-and-forms/)
<add>* [rails-ujs wiki](https://github.com/rails/rails/tree/master/actionview/app/assets/javascripts)
<ide> * [Railscasts: Unobtrusive JavaScript](http://railscasts.com/episodes/205-unobtrusive-javascript)
<ide> * [Railscasts: Turbolinks](http://railscasts.com/episodes/390-turbolinks) | 1 |
Ruby | Ruby | use bundler.with_clean_env instead of custom code | 7fc4b4681b83b86d5871f0726460ea808bd76f1b | <ide><path>railties/lib/rails/generators/app_base.rb
<ide> def bundle_command(command)
<ide> # Thanks to James Tucker for the Gem tricks involved in this call.
<ide> _bundle_command = Gem.bin_path('bundler', 'bundle')
<ide>
<del> bundle_bin_path, bundle_gemfile, rubyopt = ENV['BUNDLE_BIN_PATH'], ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT']
<del> ENV['BUNDLE_BIN_PATH'], ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = "", "", ""
<del>
<del> print `"#{Gem.ruby}" "#{_bundle_command}" #{command}`
<del>
<del> ENV['BUNDLE_BIN_PATH'], ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = bundle_bin_path, bundle_gemfile, rubyopt
<add> Bundler.with_clean_env do
<add> print `"#{Gem.ruby}" "#{_bundle_command}" #{command}`
<add> end
<ide> end
<ide>
<ide> def run_bundle | 1 |
Text | Text | add more information about developer tools | fdf2579fca0a1cfe142465c7994956ccbe55197d | <ide><path>guide/english/developer-tools/developer-tools-in-browsers/internet-explorer-developer-tools/index.md
<ide> This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/
<ide>
<ide> #### More Information:
<ide> <!-- Please add any articles you think might be helpful to read before writing the article -->
<add>* [Discovering Windows Internet Explorer Developer Tools](https://msdn.microsoft.com/en-us/library/dd565628(v=vs.85).aspx)
<ide>
<ide> | 1 |
Text | Text | update documentation for yml usage | 9a497582e666b20cf38b87bf8beb64e60d3ed564 | <ide><path>guides/source/testing.md
<ide> steve:
<ide> profession: guy with keyboard
<ide> ```
<ide>
<del>Each fixture is given a name followed by an indented list of colon-separated key/value pairs. Records are typically separated by a blank space. You can place comments in a fixture file by using the # character in the first column.
<add>Each fixture is given a name followed by an indented list of colon-separated key/value pairs. Records are typically separated by a blank space. You can place comments in a fixture file by using the # character in the first column. Keys which resemble YAML keywords such as 'yes' and 'no' are quoted so that the YAML Parser correctly interprets them.
<ide>
<ide> #### ERB'in It Up
<ide> | 1 |
Text | Text | clarify curriculum translations | 04f493f30be3ec6e7c57476d258e823c27f54002 | <ide><path>CONTRIBUTING.md
<ide> You can help us to:
<ide>
<ide> - [💻 Create, Update and Fix Bugs in our coding challenges](#create-update-and-fix-bugs-in-our-coding-challenges)
<ide>
<del>- [🌐 Translate guide articles and coding challenges](#translate-guide-articles-and-coding-challenges)
<add>- [Translate guide articles](#translate-guide-articles)
<ide>
<ide> - [🛠 Fix bugs in freeCodeCamp.org's learning platform](#help-us-fix-bugs-in-freecodecamporgs-learning-platform)
<ide>
<ide> You can help expand them and make their wording clearer. You can update the user
<ide>
<ide> If you're interested in improving these coding challenges, here's [how to work on coding challenges](/docs/how-to-work-on-coding-challenges.md).
<ide>
<del>### Translate guide articles and coding challenges
<add>### Translate guide articles
<ide>
<del>You can help us translate our Guide articles and Coding challenges for a language that you speak. Currently, we have translated versions in:
<add>You can help us translate our Guide articles for a language that you speak. Currently, we have translated versions in:
<add>
<add>- [Arabic (عربي)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/guide/arabic)
<add>- [Chinese (中文)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/guide/chinese)
<add>- [Portuguese (Português)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/guide/portuguese)
<add>- [Russian (русский)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/guide/russian)
<add>- [Spanish (Español)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/guide/spanish)
<ide>
<del>- [Chinese (中文)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/chinese)
<del>- [Russian (русский)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/russian)
<del>- [Arabic (عربي)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/arabic)
<del>- [Spanish (Español)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/spanish)
<del>- [Portuguese (Português)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/portuguese)
<ide>
<ide> We would love your help in improving the quality of these translations. Millions of people use the English language version of freeCodeCamp.org, and we expect millions more to use these translated versions as well.
<ide>
<add>Note that once we have finished [Version 7.0 of the freeCodeCamp curriculum](https://www.freecodecamp.org/forum/t/help-us-build-version-7-0-of-the-freecodecamp-curriculum/263546) we plan to translate it as well.
<add>
<ide> ### Help us fix bugs in freeCodeCamp.org's learning platform
<ide>
<ide> Our learning platform runs on a modern JavaScript stack. It has various components, tools and libraries, including but not limited to, Node.js, MongoDB, LoopBack, OAuth 2.0, React, Gatsby, Webpack, and more. | 1 |
Javascript | Javascript | protect property defs against prototype polution | 367c6245b4661d3bed0b67df971dd15fc21c5398 | <ide><path>lib/internal/worker/io.js
<ide> ObjectDefineProperties(MessageEvent.prototype, {
<ide> },
<ide> enumerable: true,
<ide> configurable: true,
<add> set: undefined,
<ide> },
<ide> origin: {
<ide> get() {
<ide> ObjectDefineProperties(MessageEvent.prototype, {
<ide> },
<ide> enumerable: true,
<ide> configurable: true,
<add> set: undefined,
<ide> },
<ide> lastEventId: {
<ide> get() {
<ide> ObjectDefineProperties(MessageEvent.prototype, {
<ide> },
<ide> enumerable: true,
<ide> configurable: true,
<add> set: undefined,
<ide> },
<ide> source: {
<ide> get() {
<ide> ObjectDefineProperties(MessageEvent.prototype, {
<ide> },
<ide> enumerable: true,
<ide> configurable: true,
<add> set: undefined,
<ide> },
<ide> ports: {
<ide> get() {
<ide> ObjectDefineProperties(MessageEvent.prototype, {
<ide> },
<ide> enumerable: true,
<ide> configurable: true,
<add> set: undefined,
<ide> },
<ide> });
<ide> | 1 |
Javascript | Javascript | fix typos on $watch | 83fbdd1097e27cc50c7c7aed6463d69e66fcf8e7 | <ide><path>src/ng/rootScope.js
<ide> function $RootScopeProvider(){
<ide> * - `string`: Evaluated as {@link guide/expression expression}
<ide> * - `function(newValue, oldValue, scope)`: called with current and previous values as parameters.
<ide> *
<del> * @param {boolean=} objectEquality Compare object for equality rather then for refference.
<add> * @param {boolean=} objectEquality Compare object for equality rather than for reference.
<ide> * @returns {function()} Returns a deregistration function for this listener.
<ide> */
<ide> $watch: function(watchExp, listener, objectEquality) { | 1 |
PHP | PHP | fix lint error from merge with master | 6182b0f44e0b082ce4b3e7b18a3377ea25251e99 | <ide><path>src/Routing/Router.php
<ide> public static function fullBaseUrl($base = null)
<ide> return static::$_fullBaseUrl;
<ide> }
<ide>
<del>
<ide> /**
<ide> * Reverses a parsed parameter array into an array.
<ide> * | 1 |
Javascript | Javascript | expose unstable_interactiveupdates on reactdom | 3118ed9d640ad28af306de308301f4fcd029ffca | <ide><path>packages/react-dom/src/client/ReactDOM.js
<ide> const ReactDOM: Object = {
<ide>
<ide> unstable_deferredUpdates: DOMRenderer.deferredUpdates,
<ide>
<add> unstable_interactiveUpdates: DOMRenderer.interactiveUpdates,
<add>
<ide> flushSync: DOMRenderer.flushSync,
<ide>
<ide> unstable_flushControlled: DOMRenderer.flushControlled, | 1 |
Go | Go | propagate "container" env variable from lxc | e8772943215fff3e17642ad410e4815e40e96b8b | <ide><path>container.go
<ide> func (container *Container) Start() (err error) {
<ide> env := []string{
<ide> "HOME=/",
<ide> "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
<del> "container=lxc",
<ide> "HOSTNAME=" + container.Config.Hostname,
<ide> }
<ide>
<ide><path>sysinit/sysinit.go
<ide> func SysInit() {
<ide> log.Fatalf("Unable to unmarshal environment variables: %v", err)
<ide> }
<ide>
<add> // Propagate the plugin-specific container env variable
<add> env = append(env, "container="+os.Getenv("container"))
<add>
<ide> args := &DockerInitArgs{
<ide> user: *user,
<ide> gateway: *gateway, | 2 |
Go | Go | extract docker volume api from local | 9862a4b43ec6236305f6b57274c6edd61dad96b7 | <ide><path>api/server/router/local/local.go
<ide> func (r *router) initRoutes() {
<ide> NewGetRoute("/containers/{name:.*}/attach/ws", r.wsContainersAttach),
<ide> NewGetRoute("/exec/{id:.*}/json", r.getExecByID),
<ide> NewGetRoute("/containers/{name:.*}/archive", r.getContainersArchive),
<del> NewGetRoute("/volumes", r.getVolumesList),
<del> NewGetRoute("/volumes/{name:.*}", r.getVolumeByName),
<ide> // POST
<ide> NewPostRoute("/auth", r.postAuth),
<ide> NewPostRoute("/commit", r.postCommit),
<ide> func (r *router) initRoutes() {
<ide> NewPostRoute("/exec/{name:.*}/start", r.postContainerExecStart),
<ide> NewPostRoute("/exec/{name:.*}/resize", r.postContainerExecResize),
<ide> NewPostRoute("/containers/{name:.*}/rename", r.postContainerRename),
<del> NewPostRoute("/volumes/create", r.postVolumesCreate),
<ide> // PUT
<ide> NewPutRoute("/containers/{name:.*}/archive", r.putContainersArchive),
<ide> // DELETE
<ide> NewDeleteRoute("/containers/{name:.*}", r.deleteContainers),
<ide> NewDeleteRoute("/images/{name:.*}", r.deleteImages),
<del> NewDeleteRoute("/volumes/{name:.*}", r.deleteVolumes),
<ide> }
<ide> }
<ide>
<ide><path>api/server/router/volume/volume.go
<add>package volume
<add>
<add>import (
<add> "github.com/docker/docker/api/server/router"
<add> "github.com/docker/docker/api/server/router/local"
<add> "github.com/docker/docker/daemon"
<add>)
<add>
<add>// volumesRouter is a router to talk with the volumes controller
<add>type volumeRouter struct {
<add> daemon *daemon.Daemon
<add> routes []router.Route
<add>}
<add>
<add>// NewRouter initializes a new volumes router
<add>func NewRouter(d *daemon.Daemon) router.Router {
<add> r := &volumeRouter{
<add> daemon: d,
<add> }
<add> r.initRoutes()
<add> return r
<add>}
<add>
<add>//Routes returns the available routers to the volumes controller
<add>func (r *volumeRouter) Routes() []router.Route {
<add> return r.routes
<add>}
<add>
<add>func (r *volumeRouter) initRoutes() {
<add> r.routes = []router.Route{
<add> // GET
<add> local.NewGetRoute("/volumes", r.getVolumesList),
<add> local.NewGetRoute("/volumes/{name:.*}", r.getVolumeByName),
<add> // POST
<add> local.NewPostRoute("/volumes/create", r.postVolumesCreate),
<add> // DELETE
<add> local.NewDeleteRoute("/volumes/{name:.*}", r.deleteVolumes),
<add> }
<add>}
<add><path>api/server/router/volume/volume_routes.go
<del><path>api/server/router/local/volume.go
<del>package local
<add>package volume
<ide>
<ide> import (
<ide> "encoding/json"
<ide> import (
<ide> "golang.org/x/net/context"
<ide> )
<ide>
<del>func (s *router) getVolumesList(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<add>func (v *volumeRouter) getVolumesList(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<ide> if err := httputils.ParseForm(r); err != nil {
<ide> return err
<ide> }
<ide>
<del> volumes, err := s.daemon.Volumes(r.Form.Get("filters"))
<add> volumes, err := v.daemon.Volumes(r.Form.Get("filters"))
<ide> if err != nil {
<ide> return err
<ide> }
<ide> return httputils.WriteJSON(w, http.StatusOK, &types.VolumesListResponse{Volumes: volumes})
<ide> }
<ide>
<del>func (s *router) getVolumeByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<add>func (v *volumeRouter) getVolumeByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<ide> if err := httputils.ParseForm(r); err != nil {
<ide> return err
<ide> }
<ide>
<del> v, err := s.daemon.VolumeInspect(vars["name"])
<add> volume, err := v.daemon.VolumeInspect(vars["name"])
<ide> if err != nil {
<ide> return err
<ide> }
<del> return httputils.WriteJSON(w, http.StatusOK, v)
<add> return httputils.WriteJSON(w, http.StatusOK, volume)
<ide> }
<ide>
<del>func (s *router) postVolumesCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<add>func (v *volumeRouter) postVolumesCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<ide> if err := httputils.ParseForm(r); err != nil {
<ide> return err
<ide> }
<ide> func (s *router) postVolumesCreate(ctx context.Context, w http.ResponseWriter, r
<ide> return err
<ide> }
<ide>
<del> volume, err := s.daemon.VolumeCreate(req.Name, req.Driver, req.DriverOpts)
<add> volume, err := v.daemon.VolumeCreate(req.Name, req.Driver, req.DriverOpts)
<ide> if err != nil {
<ide> return err
<ide> }
<ide> return httputils.WriteJSON(w, http.StatusCreated, volume)
<ide> }
<ide>
<del>func (s *router) deleteVolumes(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<add>func (v *volumeRouter) deleteVolumes(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<ide> if err := httputils.ParseForm(r); err != nil {
<ide> return err
<ide> }
<del> if err := s.daemon.VolumeRm(vars["name"]); err != nil {
<add> if err := v.daemon.VolumeRm(vars["name"]); err != nil {
<ide> return err
<ide> }
<ide> w.WriteHeader(http.StatusNoContent)
<ide><path>api/server/server.go
<ide> import (
<ide> "github.com/docker/docker/api/server/router"
<ide> "github.com/docker/docker/api/server/router/local"
<ide> "github.com/docker/docker/api/server/router/network"
<add> "github.com/docker/docker/api/server/router/volume"
<ide> "github.com/docker/docker/daemon"
<ide> "github.com/docker/docker/pkg/sockets"
<ide> "github.com/docker/docker/utils"
<ide> func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
<ide> func (s *Server) InitRouters(d *daemon.Daemon) {
<ide> s.addRouter(local.NewRouter(d))
<ide> s.addRouter(network.NewRouter(d))
<add> s.addRouter(volume.NewRouter(d))
<ide>
<ide> for _, srv := range s.servers {
<ide> srv.srv.Handler = s.CreateMux() | 4 |
PHP | PHP | fix phpcs and cast attribute values to strings | 470f6fc9fb3deedf1a6391b7937b402c2abfed61 | <ide><path>src/View/Helper/FormHelper.php
<ide> public function checkbox(string $fieldName, array $options = [])
<ide> 'name' => $options['name'],
<ide> 'value' => $options['hiddenField'] !== true
<ide> && $options['hiddenField'] !== '_split'
<del> ? $options['hiddenField'] : '0',
<add> ? (string)$options['hiddenField'] : '0',
<ide> 'form' => $options['form'] ?? null,
<ide> 'secure' => false,
<ide> ];
<ide> public function checkbox(string $fieldName, array $options = [])
<ide> * - `label` - Either `false` to disable label around the widget or an array of attributes for
<ide> * the label tag. `selected` will be added to any classes e.g. `'class' => 'myclass'` where widget
<ide> * is checked
<del> * - `hiddenField` - boolean|string. Set to false to not include a hidden input with a value of ''.
<del> * Can also be a string to set the value of the hidden input. This is useful for creating
<add> * - `hiddenField` - boolean|string. Set to false to not include a hidden input with a value of ''.
<add> * Can also be a string to set the value of the hidden input. This is useful for creating
<ide> * radio sets that are non-continuous.
<ide> * - `disabled` - Set to `true` or `disabled` to disable all the radio buttons. Use an array of
<ide> * values to disable specific radio buttons.
<ide> public function radio(string $fieldName, iterable $options = [], array $attribut
<ide> $hidden = '';
<ide> if ($hiddenField !== false && is_scalar($hiddenField)) {
<ide> $hidden = $this->hidden($fieldName, [
<del> 'value' => $hiddenField === true ? '' : $hiddenField,
<add> 'value' => $hiddenField === true ? '' : (string)$hiddenField,
<ide> 'form' => $attributes['form'] ?? null,
<ide> 'name' => $attributes['name'],
<ide> ]); | 1 |
PHP | PHP | escape merged attributes by default | 83c8e6e6b575d0029ea164ba4b44f4c4895dbb3d | <ide><path>src/Illuminate/View/ComponentAttributeBag.php
<ide> public function merge(array $attributeDefaults = [])
<ide> {
<ide> $attributes = [];
<ide>
<add> $attributeDefaults = array_map(function ($value) {
<add> return e($value);
<add> }, $attributeDefaults);
<add>
<ide> foreach ($this->attributes as $key => $value) {
<ide> if ($value === true) {
<ide> $attributes[$key] = $key; | 1 |
Python | Python | simplify assert_warns in test_io.py | a1526cabf554e1c91f82f8371d00c484ca05dbe7 | <ide><path>numpy/lib/tests/test_io.py
<ide> def test_invalid_raise(self):
<ide> data[10 * i] = "2, 2, 2, 2 2"
<ide> data.insert(0, "a, b, c, d, e")
<ide> mdata = TextIO("\n".join(data))
<del> #
<add>
<ide> kwargs = dict(delimiter=",", dtype=None, names=True)
<del> # XXX: is there a better way to get the return value of the
<del> # callable in assert_warns ?
<del> ret = {}
<del>
<del> def f(_ret={}):
<del> _ret['mtest'] = np.genfromtxt(mdata, invalid_raise=False, **kwargs)
<del> assert_warns(ConversionWarning, f, _ret=ret)
<del> mtest = ret['mtest']
<add> def f():
<add> return np.genfromtxt(mdata, invalid_raise=False, **kwargs)
<add> mtest = assert_warns(ConversionWarning, f)
<ide> assert_equal(len(mtest), 45)
<ide> assert_equal(mtest, np.ones(45, dtype=[(_, int) for _ in 'abcde']))
<ide> #
<ide> def test_invalid_raise_with_usecols(self):
<ide> data[10 * i] = "2, 2, 2, 2 2"
<ide> data.insert(0, "a, b, c, d, e")
<ide> mdata = TextIO("\n".join(data))
<add>
<ide> kwargs = dict(delimiter=",", dtype=None, names=True,
<ide> invalid_raise=False)
<del> # XXX: is there a better way to get the return value of the
<del> # callable in assert_warns ?
<del> ret = {}
<del>
<del> def f(_ret={}):
<del> _ret['mtest'] = np.genfromtxt(mdata, usecols=(0, 4), **kwargs)
<del> assert_warns(ConversionWarning, f, _ret=ret)
<del> mtest = ret['mtest']
<add> def f():
<add> return np.genfromtxt(mdata, usecols=(0, 4), **kwargs)
<add> mtest = assert_warns(ConversionWarning, f)
<ide> assert_equal(len(mtest), 45)
<ide> assert_equal(mtest, np.ones(45, dtype=[(_, int) for _ in 'ae']))
<ide> # | 1 |
PHP | PHP | fix coding standards in case/event | b2d393eeb9f8f3fe8dd7e8ef51a85d01fe3e8e44 | <ide><path>lib/Cake/Test/Case/Event/CakeEventManagerTest.php
<ide> public function secondListenerFunction() {
<ide> public function stopListener($event) {
<ide> $event->stopPropagation();
<ide> }
<add>
<ide> }
<ide>
<ide> /**
<ide> public function implementedEvents() {
<ide> public function thirdListenerFunction() {
<ide> $this->callStack[] = __FUNCTION__;
<ide> }
<add>
<ide> }
<ide>
<ide> /**
<ide> public function testDispatchFalseStopsEvent() {
<ide> $this->assertTrue($event->isStopped());
<ide> }
<ide>
<del>
<ide> /**
<ide> * Tests event dispatching using priorities
<ide> *
<ide> public function testAttachSubscriber() {
<ide> $listener = $this->getMock('CustomTestEventListerner', array('secondListenerFunction'));
<ide> $manager->attach($listener);
<ide> $event = new CakeEvent('fake.event');
<del>
<add>
<ide> $manager->dispatch($event);
<ide>
<ide> $expected = array('listenerFunction');
<ide> public function testStopPropagation() {
<ide> $expected = array('secondListenerFunction');
<ide> $this->assertEquals($expected, $listener->callStack);
<ide> }
<del>}
<ide>\ No newline at end of file
<add>} | 1 |
PHP | PHP | fix code style; | 01e42d1a6cd15acf4989390721eb663b57a8407c | <ide><path>tests/Http/HttpRequestTest.php
<ide> public function testCreateFromBase()
<ide> }
<ide>
<ide> /**
<del> * Tests to issue https://github.com/laravel/framework/issues/10403
<add> * Tests to https://github.com/laravel/framework/issues/10403 issue.
<ide> * @dataProvider magicMethodsProvider
<ide> */
<ide> public function testMagicMethods($uri, $route, $parameters, $property, $propertyValue, $propertyIsset, $propertyEmpty)
<ide> {
<ide> $request = Request::create($uri, 'GET', $parameters);
<ide>
<ide> // Allow to simulates when a route is inaccessible or undefined.
<del> if (!is_null($route)) {
<add> if (! is_null($route)) {
<ide> $request->setRouteResolver(function () use ($request, $route) {
<ide> $route = new Route('GET', $route, []);
<ide> $route->bind($request);
<ide> public function magicMethodsProvider()
<ide> {
<ide> return [
<ide> // Simulates QueryStrings.
<del> [ '/', null, [ 'foo' => 'bar', 'empty' => '' ], 'foo', 'bar', true, false ],
<del> [ '/', null, [ 'foo' => 'bar', 'empty' => '' ], 'empty', '', true, true ],
<del> [ '/', null, [ 'foo' => 'bar', 'empty' => '' ], 'undefined', null, false, true ],
<add> ['/', null, ['foo' => 'bar', 'empty' => ''], 'foo', 'bar', true, false],
<add> ['/', null, ['foo' => 'bar', 'empty' => ''], 'empty', '', true, true],
<add> ['/', null, ['foo' => 'bar', 'empty' => ''], 'undefined', null, false, true],
<ide>
<ide> // Simulates Routes.
<del> [ '/example/bar', '/example/{foo}/{undefined?}', [], 'foo', 'bar', true, false ],
<del> [ '/example/bar', '/example/{foo}/{undefined?}', [], 'undefined', null, false, true ],
<add> ['/example/bar', '/example/{foo}/{undefined?}', [], 'foo', 'bar', true, false],
<add> ['/example/bar', '/example/{foo}/{undefined?}', [], 'undefined', null, false, true],
<ide>
<ide> // Simulates no QueryStrings or Routes.
<del> [ '/', '/', [], 'undefined', null, false, true ],
<del> [ '/', null, [], 'undefined', null, false, true ],
<add> ['/', '/', [], 'undefined', null, false, true],
<add> ['/', null, [], 'undefined', null, false, true],
<ide> ];
<ide> }
<ide> | 1 |
PHP | PHP | update the docblock for the csrffilter | 5bdf965a7209818881166759f72b10e9aa612aad | <ide><path>app/Http/Filters/CsrfFilter.php
<ide> class CsrfFilter {
<ide> /**
<ide> * Run the request filter.
<ide> *
<del> * @return mixed
<add> * @param \Illuminate\Routing\Route $route
<add> * @param \Illuminate\Http\Request $request
<add> * @return void
<add> *
<add> * @throws \Illuminate\Session\TokenMismatchException
<ide> */
<ide> public function filter(Route $route, Request $request)
<ide> {
<ide> public function filter(Route $route, Request $request)
<ide> }
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>} | 1 |
Javascript | Javascript | make the rest of tests path-independent | 945f20808143d954fea73e4ac3a0d71cf73c9b2c | <ide><path>test/common/index.js
<ide> exports.childShouldThrowAndAbort = function() {
<ide> // continuous testing and developers' machines
<ide> testCmd += 'ulimit -c 0 && ';
<ide> }
<del> testCmd += `${process.argv[0]} --abort-on-uncaught-exception `;
<del> testCmd += `${process.argv[1]} child`;
<add> testCmd += `"${process.argv[0]}" --abort-on-uncaught-exception `;
<add> testCmd += `"${process.argv[1]}" child`;
<ide> const child = child_process.exec(testCmd);
<ide> child.on('exit', function onExit(exitCode, signal) {
<ide> const errMsg = 'Test should have aborted ' +
<ide><path>test/known_issues/test-stdout-buffer-flush-on-exit.js
<ide> if (process.argv[2] === 'child') {
<ide> [22, 21, 20, 19, 18, 17, 16, 16, 17, 18, 19, 20, 21, 22].forEach((exponent) => {
<ide> const bigNum = Math.pow(2, exponent);
<ide> const longLine = lineSeed.repeat(bigNum);
<del> const cmd = `${process.execPath} ${__filename} child ${exponent} ${bigNum}`;
<add> const cmd =
<add> `"${process.execPath}" "${__filename}" child ${exponent} ${bigNum}`;
<ide> const stdout = execSync(cmd).toString().trim();
<ide>
<ide> assert.strictEqual(stdout, longLine, `failed with exponent ${exponent}`);
<ide><path>test/parallel/test-child-process-bad-stdio.js
<ide> ChildProcess.prototype.spawn = function() {
<ide> };
<ide>
<ide> function createChild(options, callback) {
<del> const cmd = `${process.execPath} ${__filename} child`;
<add> const cmd = `"${process.execPath}" "${__filename}" child`;
<ide>
<ide> return cp.exec(cmd, options, common.mustCall(callback));
<ide> }
<ide><path>test/parallel/test-child-process-exec-encoding.js
<ide> if (process.argv[2] === 'child') {
<ide> console.error(stderrData);
<ide> } else {
<ide> function run(options, callback) {
<del> const cmd = `${process.execPath} ${__filename} child`;
<add> const cmd = `"${process.execPath}" "${__filename}" child`;
<ide>
<ide> cp.exec(cmd, options, common.mustCall((err, stdout, stderr) => {
<ide> assert.ifError(err);
<ide><path>test/parallel/test-child-process-exec-kill-throws.js
<ide> if (process.argv[2] === 'child') {
<ide> throw new Error('mock error');
<ide> };
<ide>
<del> const cmd = `${process.execPath} ${__filename} child`;
<add> const cmd = `"${process.execPath}" "${__filename}" child`;
<ide> const options = { maxBuffer: 0 };
<ide> const child = cp.exec(cmd, options, common.mustCall((err, stdout, stderr) => {
<ide> // Verify that if ChildProcess#kill() throws, the error is reported.
<ide><path>test/parallel/test-child-process-exec-timeout.js
<ide> if (process.argv[2] === 'child') {
<ide> return;
<ide> }
<ide>
<del>const cmd = `${process.execPath} ${__filename} child`;
<add>const cmd = `"${process.execPath}" "${__filename}" child`;
<ide>
<ide> // Test the case where a timeout is set, and it expires.
<ide> cp.exec(cmd, { timeout: 1 }, common.mustCall((err, stdout, stderr) => {
<ide><path>test/parallel/test-cli-eval.js
<ide> child.exec(`${nodejs} --use-strict -p process.execArgv`,
<ide> // Ensure that arguments are successfully passed to a script.
<ide> // The first argument after '--' should be interpreted as a script
<ide> // filename.
<del> const filecmd = `${nodejs} -- ${__filename} ${args}`;
<add> const filecmd = `${nodejs} -- "${__filename}" ${args}`;
<ide> child.exec(filecmd, common.mustCall(function(err, stdout, stderr) {
<ide> assert.strictEqual(stdout, `${args}\n`);
<ide> assert.strictEqual(stderr, '');
<ide><path>test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js
<ide> function createTestCmdLine(options) {
<ide> testCmd += 'ulimit -c 0 && ';
<ide> }
<ide>
<del> testCmd += process.argv[0];
<add> testCmd += `"${process.argv[0]}"`;
<ide>
<ide> if (options && options.withAbortOnUncaughtException) {
<ide> testCmd += ' --abort-on-uncaught-exception';
<ide> }
<ide>
<del> testCmd += ` ${process.argv[1]} child`;
<add> testCmd += ` "${process.argv[1]}" child`;
<ide>
<ide> return testCmd;
<ide> }
<ide><path>test/parallel/test-domain-with-abort-on-uncaught-exception.js
<ide> if (process.argv[2] === 'child') {
<ide> if (options.useTryCatch)
<ide> useTryCatchOpt = 'useTryCatch';
<ide>
<del> cmdToExec += `${process.argv[0]} ${cmdLineOption ? cmdLineOption : ''} ${
<del> process.argv[1]} child ${throwInDomainErrHandlerOpt} ${useTryCatchOpt}`;
<add> cmdToExec += `"${process.argv[0]}" ${cmdLineOption ? cmdLineOption : ''} "${
<add> process.argv[1]}" child ${throwInDomainErrHandlerOpt} ${useTryCatchOpt}`;
<ide>
<ide> const child = exec(cmdToExec);
<ide>
<ide><path>test/parallel/test-env-var-no-warnings.js
<ide> if (process.argv[2] === 'child') {
<ide> process.emitWarning('foo');
<ide> } else {
<ide> function test(env) {
<del> const cmd = `${process.execPath} ${__filename} child`;
<add> const cmd = `"${process.execPath}" "${__filename}" child`;
<ide>
<ide> cp.exec(cmd, { env }, common.mustCall((err, stdout, stderr) => {
<ide> assert.strictEqual(err, null);
<ide><path>test/parallel/test-http-chunk-problem.js
<ide> const filename = require('path').join(common.tmpDir, 'big');
<ide> let server;
<ide>
<ide> function executeRequest(cb) {
<del> cp.exec([process.execPath,
<del> __filename,
<add> cp.exec([`"${process.execPath}"`,
<add> `"${__filename}"`,
<ide> 'request',
<ide> server.address().port,
<ide> '|',
<del> process.execPath,
<del> __filename,
<add> `"${process.execPath}"`,
<add> `"${__filename}"`,
<ide> 'shasum' ].join(' '),
<ide> (err, stdout, stderr) => {
<ide> assert.ifError(err);
<ide><path>test/parallel/test-preload.js
<ide> const nodeBinary = process.argv[0];
<ide> const preloadOption = (preloads) => {
<ide> let option = '';
<ide> preloads.forEach(function(preload, index) {
<del> option += `-r ${preload} `;
<add> option += `-r "${preload}" `;
<ide> });
<ide> return option;
<ide> };
<ide> const fixtureD = fixture('define-global.js');
<ide> const fixtureThrows = fixture('throws_error4.js');
<ide>
<ide> // test preloading a single module works
<del>childProcess.exec(`${nodeBinary} ${preloadOption([fixtureA])} ${fixtureB}`,
<add>childProcess.exec(`"${nodeBinary}" ${preloadOption([fixtureA])} "${fixtureB}"`,
<ide> function(err, stdout, stderr) {
<ide> assert.ifError(err);
<ide> assert.strictEqual(stdout, 'A\nB\n');
<ide> });
<ide>
<ide> // test preloading multiple modules works
<ide> childProcess.exec(
<del> `${nodeBinary} ${preloadOption([fixtureA, fixtureB])} ${fixtureC}`,
<add> `"${nodeBinary}" ${preloadOption([fixtureA, fixtureB])} "${fixtureC}"`,
<ide> function(err, stdout, stderr) {
<ide> assert.ifError(err);
<ide> assert.strictEqual(stdout, 'A\nB\nC\n');
<ide> childProcess.exec(
<ide>
<ide> // test that preloading a throwing module aborts
<ide> childProcess.exec(
<del> `${nodeBinary} ${preloadOption([fixtureA, fixtureThrows])} ${fixtureB}`,
<add> `"${nodeBinary}" ${preloadOption([fixtureA, fixtureThrows])} "${fixtureB}"`,
<ide> function(err, stdout, stderr) {
<ide> if (err) {
<ide> assert.strictEqual(stdout, 'A\n');
<ide> childProcess.exec(
<ide>
<ide> // test that preload can be used with --eval
<ide> childProcess.exec(
<del> `${nodeBinary} ${preloadOption([fixtureA])}-e "console.log('hello');"`,
<add> `"${nodeBinary}" ${preloadOption([fixtureA])}-e "console.log('hello');"`,
<ide> function(err, stdout, stderr) {
<ide> assert.ifError(err);
<ide> assert.strictEqual(stdout, 'A\nhello\n');
<ide> replProc.on('close', function(code) {
<ide> // test that preload placement at other points in the cmdline
<ide> // also test that duplicated preload only gets loaded once
<ide> childProcess.exec(
<del> `${nodeBinary} ${preloadOption([fixtureA])}-e "console.log('hello');" ${
<add> `"${nodeBinary}" ${preloadOption([fixtureA])}-e "console.log('hello');" ${
<ide> preloadOption([fixtureA, fixtureB])}`,
<ide> function(err, stdout, stderr) {
<ide> assert.ifError(err);
<ide> childProcess.exec(
<ide>
<ide> // test that preload works with -i
<ide> const interactive = childProcess.exec(
<del> `${nodeBinary} ${preloadOption([fixtureD])}-i`,
<add> `"${nodeBinary}" ${preloadOption([fixtureD])}-i`,
<ide> common.mustCall(function(err, stdout, stderr) {
<ide> assert.ifError(err);
<ide> assert.strictEqual(stdout, "> 'test'\n> ");
<ide> interactive.stdin.write('a\n');
<ide> interactive.stdin.write('process.exit()\n');
<ide>
<ide> childProcess.exec(
<del> `${nodeBinary} --require ${fixture('cluster-preload.js')} ${
<del> fixture('cluster-preload-test.js')}`,
<add> `"${nodeBinary}" --require "${fixture('cluster-preload.js')}" "${
<add> fixture('cluster-preload-test.js')}"`,
<ide> function(err, stdout, stderr) {
<ide> assert.ifError(err);
<ide> assert.ok(/worker terminated with code 43/.test(stdout));
<ide> childProcess.exec(
<ide> // https://github.com/nodejs/node/issues/1691
<ide> process.chdir(common.fixturesDir);
<ide> childProcess.exec(
<del> `${nodeBinary} --expose_natives_as=v8natives --require ` +
<del> `${fixture('cluster-preload.js')} cluster-preload-test.js`,
<add> `"${nodeBinary}" --expose_natives_as=v8natives --require ` +
<add> `"${fixture('cluster-preload.js')}" cluster-preload-test.js`,
<ide> function(err, stdout, stderr) {
<ide> assert.ifError(err);
<ide> assert.ok(/worker terminated with code 43/.test(stdout));
<ide><path>test/sequential/test-domain-abort-on-uncaught.js
<ide> if (process.argv[2] === 'child') {
<ide> testCmd += 'ulimit -c 0 && ';
<ide> }
<ide>
<del> testCmd += `${process.argv[0]} --abort-on-uncaught-exception ` +
<del> `${process.argv[1]} child ${testIndex}`;
<add> testCmd += `"${process.argv[0]}" --abort-on-uncaught-exception ` +
<add> `"${process.argv[1]}" child ${testIndex}`;
<ide>
<ide> const child = child_process.exec(testCmd);
<ide>
<ide><path>test/sequential/test-module-loading.js
<ide> assert.throws(
<ide> function() {
<ide> require('../fixtures/packages/invalid');
<ide> },
<del> /^SyntaxError: Error parsing \S+: Unexpected token , in JSON at position 1$/
<add> /^SyntaxError: Error parsing .+: Unexpected token , in JSON at position 1$/
<ide> );
<ide>
<ide> assert.strictEqual(require('../fixtures/packages/index').ok, 'ok', | 14 |
Text | Text | create meaningful play file | 6da1bc5129691dd6aa8edf49fa4c222ce16f83b0 | <ide><path>guide/english/game-development/meaningful-play/index.md
<add>---
<add>title: Meaningful Play
<add>---
<add>
<add>## Meaningful Play
<add>
<add>The goal of game design is to create meaningful play. When people care about a game and its outcome, they become emotionally invested and the game is meaningful to them. Games are synthetic experiences—they take place in a constructed environment, and consequences in the game don’t affect the outside world. The challenge for game designers is to make games in synthetic environment meaningful to the player.
<add>
<add>People care about a game when something is at stake. There are a variety of stakes, including:
<add>
<add> your team or friend
<add> your character or avatar
<add> your reputation or ego.
<add>
<add>When a game has stakes, players become emotionally invested in the outcome. Players want to see their team in Counter-Strike succeed, trash-talk their friends when they beat them in Guitar Hero, and take pleasure in being in the top 10 on a leader board. It’s a sign of gaming prestige to say you have a level-60 character in World of Warcraft. It feels good to beat Minesweeper, Hearts, and Solitaire.
<add>
<add>## Defining Meaningful Play
<add>
<add>There are two ways to define meaningful play, descriptive and evaluative.
<add>
<add>## Descriptive Meaningful Play
<add>
<add>Rules of Play defines meaningful play in a descriptive sense as a process where “a player takes action within the designed system of a game and the system responds to the action.” [12] The game creates meaning through “the relationship between player action and system outcome.” [13] You can think of this system as cause-and-effect.
<add>
<add>## Evaluative Meaningful Play
<add>
<add>The Rules of Play definition for meaningful play in an evaluative sense requires some unpacking. Evaluative meaningful play “occurs when the relationships between actions and outcomes in a game are both discernable and integrated into the larger context of the game.” [14]
<add>
<add> A discernable outcome means that a player understands the immediate outcome of an action. [15] For example, the player’s action is rolling a pair of dice in a board game. The outcome of the action is that the player advances the number of spaces on the dice.
<add>
<add> An integrated outcome means that the actions players take are “woven into the game system as a whole” and make sense in the narrative. [16] For example, Monopoly simulates real estate transactions. Each part of the game supports the simulation: the money looks like currency; there is a bank to make change, and a system for exchanging money and property. The more integrated a game is, the more closely it simulates an aspect of the real world.
<add>
<add>For games to be meaningful in an evaluative sense, a player must understand the cause-and-effect of their actions, and the player’s actions must relate to the gameplay.
<add>
<add>## Provide Clear and Meaningful Goals
<add>
<add>Video game designer and producer Shigeru Miyamoto’s games are known for their intuitive nature. The Nintendo Wii follows the same design philosophy of intuition and simplicity. The basic function of its controller is intuitive to many people who aren’t gamers because it’s so similar to a television remote.
<add>
<add>Unfortunately, not every game or game system is so easy to use. While playing games, you may have entered an environment with your avatar and realized you don’t know what your goal is, or how to achieve it. Or, you may have finished a quest and did not know how to move forward in the game. You may have been given a quest that you don’t care about because it seems to have nothing to do with the game or its narrative. In these cases, the game failed to provide clear and meaningful goals.
<add>
<add>A goal is clear if players understand what they’re supposed to do and how they need to do it. That doesn’t necessarily mean giving everything away. In fact, giving players all the answers would remove the struggle referred to in Costikyan’s definition of games from Unit 1.
<add>
<add>Instead of giving the player all the answers, clear goals get the player started toward a goal. For instance, imagine that you were assigned a quest to find an ancient key. In the game you have already met an old seer and been to an antiquities shop. Either the seer or the shop could have the key. The game created clear goals by telling you what to find (the key), and placing the key in a logical part of the game world. Unclear or irrelevant goals frustrate players.
<add>
<add>A goal is meaningful if players actually care about its completion. The game Playboy: The Mansion provides an example. If players purchased computers for their journalists, the players could then assign journalists to “research.” Research makes better journalists who, in turn, write better articles. Better articles lead to better magazine issues and to better sales. While it was a valid goal, players seldom pursued it. Players did not complete this goal because they could just fire and hire journalists any time they wanted to without any penalty. Why spend time improving a journalist when hiring a new and better one is more efficient? The goal and its reward lacked meaning.
<add>
<add>The most meaningful goals have incentives to engage players in the game. In the game Psychonauts, designer Tim Shafer provides a strong narrative motivation for the character. In the beginning of the game the protagonist, your avatar, is at a summer camp. His fellow campers, including his best friend, disappear. As players explore the game and complete goals, puzzles and additional parts of the game unlock. This rewards the player for completing goals.
<add>
<add>Goals can also lose their meaning if they are too repetitive, and don’t contribute enough to the game narrative. This is a common problem in MMOs. For example, if an NPC requests you to “go get five saber teeth and bring them back,” after you’ve already completed several delivery-style quests, you will probably be reluctant. Fulfilling the delivery may improve your avatar slightly, but the goal itself has little effect on the game world, so it lacks meaning.
<add>
<add>If players are assigned too many of the same types of quests, they become bored. Goals are stronger and provide more immersion if they motivate both the player and the character in the game world
<add>
<add>## The Right Amount of Information
<add>
<add>Players must be able to understand the state of the game world.
<add>
<add>The more trouble they have to go through to find something out, the more frustrated they will be and the less meaningful the play will be. Games can give players too much or too little information. The HUD (heads-up display—the main interface of the game) may present so much information that the player can’t make sense of it all, or it may not present enough information, so the player misses out on some options.
<add>
<add>
<add>
<add>The game Dead Space provides the right amount of information, and it’s displayed successfully. Instead of using menus or a HUD to show a character’s health, Dead Space indicates a player’s health through the yellow bar on the character’s backpack, illustrated in Figure 4.
<add>A screenshot of the video game Dead Space, showing two characters fighting, a zombie and the protagonist, whose back is facing the camera, showing a glowing yellow bar on its back, indicating its health level.
<add>Fig. 4: Integrating Information into the Game Display (Eurogamer.net)
<add>
<add>
<add>
<add>In Ubisoft’s Beyond Good & Evil, the HUD displays are very minimal. As the player completes quests, the town fills up with villagers that begin to protest the government. In addition to providing meaningful goals and relevant gameplay, the game information is presented well. Figures 5 and 6 are both screenshots from Beyond Good & Evil, at different points in the game. Information is only presented when it is needed. In Figure 5, the only HUD element is the envelope in the bottom right-hand corner. A line of text under the image of the envelope tells players how to read the message. Since it is the only element in the HUD display, it attracts the player’s attention. With the brief instructions, the player also knows what to do next (open the letter) and how to do it (press the arrow key).
<add>A screenshot of the video game Beyond Good & Evil, showing the female protagonist standing in an empty futuristic village with her helper character. A blue glowing envelope symbol is in the bottom right-hand corner, with a line of text under it telling the player to press the left arroe button to read the message. There is no other text or symbols on the screen.
<add>Fig. 5: A Minimal and Instructive HUD Display (SinhVienIT.Net)
<add>
<add>
<add>
<add>
<add>Figure 6 is also from Beyond Good & Evil. This screenshot shows the protagonist and helper character in a different location in the game. They are on a street walking past protesters. Now that the characters are no longer alone, there could be risks, and the HUD has changed to reflect the new circumstance. The envelope symbol is gone, and the HUD now shows the protagonist and helper character’s health stats. The health stats are very easy to read: health is indicated by glowing or non-glowing hearts, and the character’s head is displayed next to their health bar. The protagonist’s active items are also displayed next to her health bar. In Figure 6, she has blue data disks.
<add>A screenshot of the video game Beyond Good & Evil, showing the female protagonist down a street with the helper character, past protesters holding signs. The HUD display shows glowing hearts in a row to communicate level of health and the protagonist’s active items are shown next to her health. The envelope symbol from Figure 5 is gone.
<add>Fig. 6: HUD Display Changes with Circumstances (SinhVienIT.Net)
<add>
<add>Figures 4 – 6 show how to display the right amount of information, and how to make sure that information does not intrude on the game play. In both games, nothing extra is shown on the screen, and the information is easy to understand.
<add>Relevant Gameplay
<add>
<add>“Because it’s cool!” is often heard along the road to bad game design. When added features, quests, or gameplay mechanics don’t provide meaning, or when they are integrated into the game world without creating meaningful play, the point is lost.
<add>
<add>Meaningless game mechanics frustrate to players.
<add>
<add>Consider tutorials or cutscenes that cannot be skipped. The first time through, the sequence is meaningful because the player learns about the game world. However, after the first viewing, the tutorials or cutscenes lose their informative and entertainment value.
<add>
<add>When you analyze a game’s features, ask yourself: “How does this affect the main task of the player in the game? Is it meaningful?”
<add> | 1 |
Text | Text | fix headings in old api docs | d9b109b807a1ea859b9d71eb22663f577b0b8c47 | <ide><path>docs/api/v1.18.md
<ide> redirect_from:
<ide> will be rejected.
<ide> -->
<ide>
<del># Docker Engine API v1.18
<del>
<del># 1. Brief introduction
<add>## 1. Brief introduction
<ide>
<ide> - The daemon listens on `unix:///var/run/docker.sock` but you can
<ide> [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
<ide> - The API tends to be REST, but for some complex commands, like `attach`
<ide> or `pull`, the HTTP connection is hijacked to transport `STDOUT`,
<ide> `STDIN` and `STDERR`.
<ide>
<del># 2. Endpoints
<add>## 2. Endpoints
<ide>
<del>## 2.1 Containers
<add>### 2.1 Containers
<ide>
<del>### List containers
<add>#### List containers
<ide>
<ide> `GET /containers/json`
<ide>
<ide> List containers
<ide> - **400** – bad parameter
<ide> - **500** – server error
<ide>
<del>### Create a container
<add>#### Create a container
<ide>
<ide> `POST /containers/create`
<ide>
<ide> Create a container
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Inspect a container
<add>#### Inspect a container
<ide>
<ide> `GET /containers/(id or name)/json`
<ide>
<ide> Return low-level information on the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### List processes running inside a container
<add>#### List processes running inside a container
<ide>
<ide> `GET /containers/(id or name)/top`
<ide>
<ide> supported on Windows.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container logs
<add>#### Get container logs
<ide>
<ide> `GET /containers/(id or name)/logs`
<ide>
<ide> Get `stdout` and `stderr` logs from the container ``id``
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Inspect changes on a container's filesystem
<add>#### Inspect changes on a container's filesystem
<ide>
<ide> `GET /containers/(id or name)/changes`
<ide>
<ide> Values for `Kind`:
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Export a container
<add>#### Export a container
<ide>
<ide> `GET /containers/(id or name)/export`
<ide>
<ide> Export the contents of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container stats based on resource usage
<add>#### Get container stats based on resource usage
<ide>
<ide> `GET /containers/(id or name)/stats`
<ide>
<ide> This endpoint returns a live stream of a container's resource usage statistics.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Resize a container TTY
<add>#### Resize a container TTY
<ide>
<ide> `POST /containers/(id or name)/resize?h=<height>&w=<width>`
<ide>
<ide> Resize the TTY for container with `id`. You must restart the container for the
<ide> - **404** – No such container
<ide> - **500** – Cannot resize container
<ide>
<del>### Start a container
<add>#### Start a container
<ide>
<ide> `POST /containers/(id or name)/start`
<ide>
<ide> Start the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Stop a container
<add>#### Stop a container
<ide>
<ide> `POST /containers/(id or name)/stop`
<ide>
<ide> Stop the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Restart a container
<add>#### Restart a container
<ide>
<ide> `POST /containers/(id or name)/restart`
<ide>
<ide> Restart the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Kill a container
<add>#### Kill a container
<ide>
<ide> `POST /containers/(id or name)/kill`
<ide>
<ide> Kill the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Rename a container
<add>#### Rename a container
<ide>
<ide> `POST /containers/(id or name)/rename`
<ide>
<ide> Rename the container `id` to a `new_name`
<ide> - **409** - conflict name already assigned
<ide> - **500** – server error
<ide>
<del>### Pause a container
<add>#### Pause a container
<ide>
<ide> `POST /containers/(id or name)/pause`
<ide>
<ide> Pause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Unpause a container
<add>#### Unpause a container
<ide>
<ide> `POST /containers/(id or name)/unpause`
<ide>
<ide> Unpause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Attach to a container
<add>#### Attach to a container
<ide>
<ide> `POST /containers/(id or name)/attach`
<ide>
<ide> The simplest way to implement the Attach protocol is the following:
<ide> 4. Read the extracted size and output it on the correct output.
<ide> 5. Goto 1.
<ide>
<del>### Attach to a container (websocket)
<add>#### Attach to a container (websocket)
<ide>
<ide> `GET /containers/(id or name)/attach/ws`
<ide>
<ide> Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Wait a container
<add>#### Wait a container
<ide>
<ide> `POST /containers/(id or name)/wait`
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Remove a container
<add>#### Remove a container
<ide>
<ide> `DELETE /containers/(id or name)`
<ide>
<ide> Remove the container `id` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Copy files or folders from a container
<add>#### Copy files or folders from a container
<ide>
<ide> `POST /containers/(id or name)/copy`
<ide>
<ide> Copy files or folders of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>## 2.2 Images
<add>### 2.2 Images
<ide>
<del>### List Images
<add>#### List Images
<ide>
<ide> `GET /images/json`
<ide>
<ide> references on the command line.
<ide> - `label=key` or `label="key=value"` of an image label
<ide> - **filter** - only return images with the specified name
<ide>
<del>### Build image from a Dockerfile
<add>#### Build image from a Dockerfile
<ide>
<ide> `POST /build`
<ide>
<ide> or being killed.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Create an image
<add>#### Create an image
<ide>
<ide> `POST /images/create`
<ide>
<ide> a base64-encoded AuthConfig object.
<ide>
<ide>
<ide>
<del>### Inspect an image
<add>#### Inspect an image
<ide>
<ide> `GET /images/(name)/json`
<ide>
<ide> Return low-level information on the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Get the history of an image
<add>#### Get the history of an image
<ide>
<ide> `GET /images/(name)/history`
<ide>
<ide> Return the history of the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Push an image on the registry
<add>#### Push an image on the registry
<ide>
<ide> `POST /images/(name)/push`
<ide>
<ide> then be used in the URL. This duplicates the command line's flow.
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Tag an image into a repository
<add>#### Tag an image into a repository
<ide>
<ide> `POST /images/(name)/tag`
<ide>
<ide> Tag the image `name` into a repository
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Remove an image
<add>#### Remove an image
<ide>
<ide> `DELETE /images/(name)`
<ide>
<ide> Remove the image `name` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Search images
<add>#### Search images
<ide>
<ide> `GET /images/search`
<ide>
<ide> Search for an image on [Docker Hub](https://hub.docker.com).
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>## 2.3 Misc
<add>### 2.3 Misc
<ide>
<del>### Check auth configuration
<add>#### Check auth configuration
<ide>
<ide> `POST /auth`
<ide>
<ide> Get the default username and email
<ide> - **204** – no error
<ide> - **500** – server error
<ide>
<del>### Display system-wide information
<add>#### Display system-wide information
<ide>
<ide> `GET /info`
<ide>
<ide> Display system-wide information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Show the docker version information
<add>#### Show the docker version information
<ide>
<ide> `GET /version`
<ide>
<ide> Show the docker version information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Ping the docker server
<add>#### Ping the docker server
<ide>
<ide> `GET /_ping`
<ide>
<ide> Ping the docker server
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a new image from a container's changes
<add>#### Create a new image from a container's changes
<ide>
<ide> `POST /commit`
<ide>
<ide> Create a new image from a container's changes
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Monitor Docker's events
<add>#### Monitor Docker's events
<ide>
<ide> `GET /events`
<ide>
<ide> Docker images report the following events:
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images in a repository
<add>#### Get a tarball containing all images in a repository
<ide>
<ide> `GET /images/(name)/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images
<add>#### Get a tarball containing all images
<ide>
<ide> `GET /images/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Load a tarball with a set of images and tags into docker
<add>#### Load a tarball with a set of images and tags into docker
<ide>
<ide> `POST /images/load`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Image tarball format
<add>#### Image tarball format
<ide>
<ide> An image tarball contains one directory per image layer (named using its long ID),
<ide> each containing these files:
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide> }
<ide> ```
<ide>
<del>### Exec Create
<add>#### Exec Create
<ide>
<ide> `POST /containers/(id or name)/exec`
<ide>
<ide> Sets up an exec instance in a running container `id`
<ide> - **201** – no error
<ide> - **404** – no such container
<ide>
<del>### Exec Start
<add>#### Exec Start
<ide>
<ide> `POST /exec/(id)/start`
<ide>
<ide> interactive session with the `exec` command.
<ide>
<ide> Similar to the stream behavior of `POST /containers/(id or name)/attach` API
<ide>
<del>### Exec Resize
<add>#### Exec Resize
<ide>
<ide> `POST /exec/(id)/resize`
<ide>
<ide> This API is valid only if `tty` was specified as part of creating and starting t
<ide> - **201** – no error
<ide> - **404** – no such exec instance
<ide>
<del>### Exec Inspect
<add>#### Exec Inspect
<ide>
<ide> `GET /exec/(id)/json`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **404** – no such exec instance
<ide> - **500** - server error
<ide>
<del># 3. Going further
<add>## 3. Going further
<ide>
<del>## 3.1 Inside `docker run`
<add>### 3.1 Inside `docker run`
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> - If in detached mode or only `stdin` is attached, display the container's id.
<ide>
<del>## 3.2 Hijacking
<add>### 3.2 Hijacking
<ide>
<ide> In this version of the API, `/attach`, uses hijacking to transport `stdin`,
<ide> `stdout`, and `stderr` on the same socket.
<ide> from **200 OK** to **101 UPGRADED** and resends the same headers.
<ide>
<ide> This might change in the future.
<ide>
<del>## 3.3 CORS Requests
<add>### 3.3 CORS Requests
<ide>
<ide> To set cross origin requests to the Engine API please give values to
<ide> `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
<ide><path>docs/api/v1.19.md
<ide> redirect_from:
<ide> will be rejected.
<ide> -->
<ide>
<del># Docker Engine API v1.19
<del>
<ide> ## 1. Brief introduction
<ide>
<ide> - The daemon listens on `unix:///var/run/docker.sock` but you can
<ide> redirect_from:
<ide> - When the client API version is newer than the daemon's, these calls return an HTTP
<ide> `400 Bad Request` error message.
<ide>
<del># 2. Endpoints
<add>## 2. Endpoints
<ide>
<del>## 2.1 Containers
<add>### 2.1 Containers
<ide>
<del>### List containers
<add>#### List containers
<ide>
<ide> `GET /containers/json`
<ide>
<ide> List containers
<ide> - **400** – bad parameter
<ide> - **500** – server error
<ide>
<del>### Create a container
<add>#### Create a container
<ide>
<ide> `POST /containers/create`
<ide>
<ide> Create a container
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Inspect a container
<add>#### Inspect a container
<ide>
<ide> `GET /containers/(id or name)/json`
<ide>
<ide> Return low-level information on the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### List processes running inside a container
<add>#### List processes running inside a container
<ide>
<ide> `GET /containers/(id or name)/top`
<ide>
<ide> supported on Windows.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container logs
<add>#### Get container logs
<ide>
<ide> `GET /containers/(id or name)/logs`
<ide>
<ide> Get `stdout` and `stderr` logs from the container ``id``
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Inspect changes on a container's filesystem
<add>#### Inspect changes on a container's filesystem
<ide>
<ide> `GET /containers/(id or name)/changes`
<ide>
<ide> Values for `Kind`:
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Export a container
<add>#### Export a container
<ide>
<ide> `GET /containers/(id or name)/export`
<ide>
<ide> Export the contents of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container stats based on resource usage
<add>#### Get container stats based on resource usage
<ide>
<ide> `GET /containers/(id or name)/stats`
<ide>
<ide> The precpu_stats is the cpu statistic of last read, which is used for calculatin
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Resize a container TTY
<add>#### Resize a container TTY
<ide>
<ide> `POST /containers/(id or name)/resize?h=<height>&w=<width>`
<ide>
<ide> Resize the TTY for container with `id`. You must restart the container for the
<ide> - **404** – No such container
<ide> - **500** – Cannot resize container
<ide>
<del>### Start a container
<add>#### Start a container
<ide>
<ide> `POST /containers/(id or name)/start`
<ide>
<ide> Start the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Stop a container
<add>#### Stop a container
<ide>
<ide> `POST /containers/(id or name)/stop`
<ide>
<ide> Stop the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Restart a container
<add>#### Restart a container
<ide>
<ide> `POST /containers/(id or name)/restart`
<ide>
<ide> Restart the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Kill a container
<add>#### Kill a container
<ide>
<ide> `POST /containers/(id or name)/kill`
<ide>
<ide> Kill the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Rename a container
<add>#### Rename a container
<ide>
<ide> `POST /containers/(id or name)/rename`
<ide>
<ide> Rename the container `id` to a `new_name`
<ide> - **409** - conflict name already assigned
<ide> - **500** – server error
<ide>
<del>### Pause a container
<add>#### Pause a container
<ide>
<ide> `POST /containers/(id or name)/pause`
<ide>
<ide> Pause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Unpause a container
<add>#### Unpause a container
<ide>
<ide> `POST /containers/(id or name)/unpause`
<ide>
<ide> Unpause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Attach to a container
<add>#### Attach to a container
<ide>
<ide> `POST /containers/(id or name)/attach`
<ide>
<ide> The simplest way to implement the Attach protocol is the following:
<ide> 4. Read the extracted size and output it on the correct output.
<ide> 5. Goto 1.
<ide>
<del>### Attach to a container (websocket)
<add>#### Attach to a container (websocket)
<ide>
<ide> `GET /containers/(id or name)/attach/ws`
<ide>
<ide> Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Wait a container
<add>#### Wait a container
<ide>
<ide> `POST /containers/(id or name)/wait`
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Remove a container
<add>#### Remove a container
<ide>
<ide> `DELETE /containers/(id or name)`
<ide>
<ide> Remove the container `id` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Copy files or folders from a container
<add>#### Copy files or folders from a container
<ide>
<ide> `POST /containers/(id or name)/copy`
<ide>
<ide> Copy files or folders of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>## 2.2 Images
<add>### 2.2 Images
<ide>
<del>### List Images
<add>#### List Images
<ide>
<ide> `GET /images/json`
<ide>
<ide> references on the command line.
<ide> - `label=key` or `label="key=value"` of an image label
<ide> - **filter** - only return images with the specified name
<ide>
<del>### Build image from a Dockerfile
<add>#### Build image from a Dockerfile
<ide>
<ide> `POST /build`
<ide>
<ide> or being killed.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Create an image
<add>#### Create an image
<ide>
<ide> `POST /images/create`
<ide>
<ide> a base64-encoded AuthConfig object.
<ide>
<ide>
<ide>
<del>### Inspect an image
<add>#### Inspect an image
<ide>
<ide> `GET /images/(name)/json`
<ide>
<ide> Return low-level information on the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Get the history of an image
<add>#### Get the history of an image
<ide>
<ide> `GET /images/(name)/history`
<ide>
<ide> Return the history of the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Push an image on the registry
<add>#### Push an image on the registry
<ide>
<ide> `POST /images/(name)/push`
<ide>
<ide> then be used in the URL. This duplicates the command line's flow.
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Tag an image into a repository
<add>#### Tag an image into a repository
<ide>
<ide> `POST /images/(name)/tag`
<ide>
<ide> Tag the image `name` into a repository
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Remove an image
<add>#### Remove an image
<ide>
<ide> `DELETE /images/(name)`
<ide>
<ide> Remove the image `name` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Search images
<add>#### Search images
<ide>
<ide> `GET /images/search`
<ide>
<ide> be deprecated and replaced by the `is_automated` property.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>## 2.3 Misc
<add>### 2.3 Misc
<ide>
<del>### Check auth configuration
<add>#### Check auth configuration
<ide>
<ide> `POST /auth`
<ide>
<ide> Get the default username and email
<ide> - **204** – no error
<ide> - **500** – server error
<ide>
<del>### Display system-wide information
<add>#### Display system-wide information
<ide>
<ide> `GET /info`
<ide>
<ide> Display system-wide information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Show the docker version information
<add>#### Show the docker version information
<ide>
<ide> `GET /version`
<ide>
<ide> Show the docker version information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Ping the docker server
<add>#### Ping the docker server
<ide>
<ide> `GET /_ping`
<ide>
<ide> Ping the docker server
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a new image from a container's changes
<add>#### Create a new image from a container's changes
<ide>
<ide> `POST /commit`
<ide>
<ide> Create a new image from a container's changes
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Monitor Docker's events
<add>#### Monitor Docker's events
<ide>
<ide> `GET /events`
<ide>
<ide> Docker images report the following events:
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images in a repository
<add>#### Get a tarball containing all images in a repository
<ide>
<ide> `GET /images/(name)/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images
<add>#### Get a tarball containing all images
<ide>
<ide> `GET /images/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Load a tarball with a set of images and tags into docker
<add>#### Load a tarball with a set of images and tags into docker
<ide>
<ide> `POST /images/load`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Image tarball format
<add>#### Image tarball format
<ide>
<ide> An image tarball contains one directory per image layer (named using its long ID),
<ide> each containing these files:
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide> }
<ide> ```
<ide>
<del>### Exec Create
<add>#### Exec Create
<ide>
<ide> `POST /containers/(id or name)/exec`
<ide>
<ide> Sets up an exec instance in a running container `id`
<ide> - **201** – no error
<ide> - **404** – no such container
<ide>
<del>### Exec Start
<add>#### Exec Start
<ide>
<ide> `POST /exec/(id)/start`
<ide>
<ide> interactive session with the `exec` command.
<ide>
<ide> Similar to the stream behavior of `POST /containers/(id or name)/attach` API
<ide>
<del>### Exec Resize
<add>#### Exec Resize
<ide>
<ide> `POST /exec/(id)/resize`
<ide>
<ide> This API is valid only if `tty` was specified as part of creating and starting t
<ide> - **201** – no error
<ide> - **404** – no such exec instance
<ide>
<del>### Exec Inspect
<add>#### Exec Inspect
<ide>
<ide> `GET /exec/(id)/json`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **404** – no such exec instance
<ide> - **500** - server error
<ide>
<del># 3. Going further
<add>## 3. Going further
<ide>
<del>## 3.1 Inside `docker run`
<add>### 3.1 Inside `docker run`
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> - If in detached mode or only `stdin` is attached, display the container's id.
<ide>
<del>## 3.2 Hijacking
<add>### 3.2 Hijacking
<ide>
<ide> In this version of the API, `/attach`, uses hijacking to transport `stdin`,
<ide> `stdout`, and `stderr` on the same socket.
<ide> When Docker daemon detects the `Upgrade` header, it switches its status code
<ide> from **200 OK** to **101 UPGRADED** and resends the same headers.
<ide>
<ide>
<del>## 3.3 CORS Requests
<add>### 3.3 CORS Requests
<ide>
<ide> To set cross origin requests to the Engine API please give values to
<ide> `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
<ide><path>docs/api/v1.20.md
<ide> redirect_from:
<ide> will be rejected.
<ide> -->
<ide>
<del># Docker Engine API v1.20
<del>
<del># 1. Brief introduction
<add>## 1. Brief introduction
<ide>
<ide> - The daemon listens on `unix:///var/run/docker.sock` but you can
<ide> [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
<ide> - The API tends to be REST. However, for some complex commands, like `attach`
<ide> or `pull`, the HTTP connection is hijacked to transport `stdout`,
<ide> `stdin` and `stderr`.
<ide>
<del># 2. Endpoints
<add>## 2. Endpoints
<ide>
<del>## 2.1 Containers
<add>### 2.1 Containers
<ide>
<del>### List containers
<add>#### List containers
<ide>
<ide> `GET /containers/json`
<ide>
<ide> List containers
<ide> - **400** – bad parameter
<ide> - **500** – server error
<ide>
<del>### Create a container
<add>#### Create a container
<ide>
<ide> `POST /containers/create`
<ide>
<ide> Create a container
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Inspect a container
<add>#### Inspect a container
<ide>
<ide> `GET /containers/(id or name)/json`
<ide>
<ide> Return low-level information on the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### List processes running inside a container
<add>#### List processes running inside a container
<ide>
<ide> `GET /containers/(id or name)/top`
<ide>
<ide> supported on Windows.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container logs
<add>#### Get container logs
<ide>
<ide> `GET /containers/(id or name)/logs`
<ide>
<ide> Get `stdout` and `stderr` logs from the container ``id``
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Inspect changes on a container's filesystem
<add>#### Inspect changes on a container's filesystem
<ide>
<ide> `GET /containers/(id or name)/changes`
<ide>
<ide> Values for `Kind`:
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Export a container
<add>#### Export a container
<ide>
<ide> `GET /containers/(id or name)/export`
<ide>
<ide> Export the contents of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container stats based on resource usage
<add>#### Get container stats based on resource usage
<ide>
<ide> `GET /containers/(id or name)/stats`
<ide>
<ide> The precpu_stats is the cpu statistic of last read, which is used for calculatin
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Resize a container TTY
<add>#### Resize a container TTY
<ide>
<ide> `POST /containers/(id or name)/resize?h=<height>&w=<width>`
<ide>
<ide> Resize the TTY for container with `id`. You must restart the container for the
<ide> - **404** – No such container
<ide> - **500** – Cannot resize container
<ide>
<del>### Start a container
<add>#### Start a container
<ide>
<ide> `POST /containers/(id or name)/start`
<ide>
<ide> Start the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Stop a container
<add>#### Stop a container
<ide>
<ide> `POST /containers/(id or name)/stop`
<ide>
<ide> Stop the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Restart a container
<add>#### Restart a container
<ide>
<ide> `POST /containers/(id or name)/restart`
<ide>
<ide> Restart the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Kill a container
<add>#### Kill a container
<ide>
<ide> `POST /containers/(id or name)/kill`
<ide>
<ide> Kill the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Rename a container
<add>#### Rename a container
<ide>
<ide> `POST /containers/(id or name)/rename`
<ide>
<ide> Rename the container `id` to a `new_name`
<ide> - **409** - conflict name already assigned
<ide> - **500** – server error
<ide>
<del>### Pause a container
<add>#### Pause a container
<ide>
<ide> `POST /containers/(id or name)/pause`
<ide>
<ide> Pause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Unpause a container
<add>#### Unpause a container
<ide>
<ide> `POST /containers/(id or name)/unpause`
<ide>
<ide> Unpause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Attach to a container
<add>#### Attach to a container
<ide>
<ide> `POST /containers/(id or name)/attach`
<ide>
<ide> The simplest way to implement the Attach protocol is the following:
<ide> 4. Read the extracted size and output it on the correct output.
<ide> 5. Goto 1.
<ide>
<del>### Attach to a container (websocket)
<add>#### Attach to a container (websocket)
<ide>
<ide> `GET /containers/(id or name)/attach/ws`
<ide>
<ide> Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Wait a container
<add>#### Wait a container
<ide>
<ide> `POST /containers/(id or name)/wait`
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Remove a container
<add>#### Remove a container
<ide>
<ide> `DELETE /containers/(id or name)`
<ide>
<ide> Remove the container `id` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Copy files or folders from a container
<add>#### Copy files or folders from a container
<ide>
<ide> `POST /containers/(id or name)/copy`
<ide>
<ide> Copy files or folders of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Retrieving information about files and folders in a container
<add>#### Retrieving information about files and folders in a container
<ide>
<ide> `HEAD /containers/(id or name)/archive`
<ide>
<ide> See the description of the `X-Docker-Container-Path-Stat` header in the
<ide> following section.
<ide>
<del>### Get an archive of a filesystem resource in a container
<add>#### Get an archive of a filesystem resource in a container
<ide>
<ide> `GET /containers/(id or name)/archive`
<ide>
<ide> desired.
<ide> - no such file or directory (**path** does not exist)
<ide> - **500** - server error
<ide>
<del>### Extract an archive of files or folders to a directory in a container
<add>#### Extract an archive of files or folders to a directory in a container
<ide>
<ide> `PUT /containers/(id or name)/archive`
<ide>
<ide> Upload a tar archive to be extracted to a path in the filesystem of container
<ide> - no such file or directory (**path** resource does not exist)
<ide> - **500** – server error
<ide>
<del>## 2.2 Images
<add>### 2.2 Images
<ide>
<del>### List Images
<add>#### List Images
<ide>
<ide> `GET /images/json`
<ide>
<ide> references on the command line.
<ide> - `label=key` or `label="key=value"` of an image label
<ide> - **filter** - only return images with the specified name
<ide>
<del>### Build image from a Dockerfile
<add>#### Build image from a Dockerfile
<ide>
<ide> `POST /build`
<ide>
<ide> or being killed.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Create an image
<add>#### Create an image
<ide>
<ide> `POST /images/create`
<ide>
<ide> a base64-encoded AuthConfig object.
<ide>
<ide>
<ide>
<del>### Inspect an image
<add>#### Inspect an image
<ide>
<ide> `GET /images/(name)/json`
<ide>
<ide> Return low-level information on the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Get the history of an image
<add>#### Get the history of an image
<ide>
<ide> `GET /images/(name)/history`
<ide>
<ide> Return the history of the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Push an image on the registry
<add>#### Push an image on the registry
<ide>
<ide> `POST /images/(name)/push`
<ide>
<ide> then be used in the URL. This duplicates the command line's flow.
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Tag an image into a repository
<add>#### Tag an image into a repository
<ide>
<ide> `POST /images/(name)/tag`
<ide>
<ide> Tag the image `name` into a repository
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Remove an image
<add>#### Remove an image
<ide>
<ide> `DELETE /images/(name)`
<ide>
<ide> Remove the image `name` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Search images
<add>#### Search images
<ide>
<ide> `GET /images/search`
<ide>
<ide> Search for an image on [Docker Hub](https://hub.docker.com).
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>## 2.3 Misc
<add>### 2.3 Misc
<ide>
<del>### Check auth configuration
<add>#### Check auth configuration
<ide>
<ide> `POST /auth`
<ide>
<ide> Get the default username and email
<ide> - **204** – no error
<ide> - **500** – server error
<ide>
<del>### Display system-wide information
<add>#### Display system-wide information
<ide>
<ide> `GET /info`
<ide>
<ide> Display system-wide information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Show the docker version information
<add>#### Show the docker version information
<ide>
<ide> `GET /version`
<ide>
<ide> Show the docker version information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Ping the docker server
<add>#### Ping the docker server
<ide>
<ide> `GET /_ping`
<ide>
<ide> Ping the docker server
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a new image from a container's changes
<add>#### Create a new image from a container's changes
<ide>
<ide> `POST /commit`
<ide>
<ide> Create a new image from a container's changes
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Monitor Docker's events
<add>#### Monitor Docker's events
<ide>
<ide> `GET /events`
<ide>
<ide> Docker images report the following events:
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images in a repository
<add>#### Get a tarball containing all images in a repository
<ide>
<ide> `GET /images/(name)/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images
<add>#### Get a tarball containing all images
<ide>
<ide> `GET /images/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Load a tarball with a set of images and tags into docker
<add>#### Load a tarball with a set of images and tags into docker
<ide>
<ide> `POST /images/load`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Image tarball format
<add>#### Image tarball format
<ide>
<ide> An image tarball contains one directory per image layer (named using its long ID),
<ide> each containing these files:
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide> }
<ide> ```
<ide>
<del>### Exec Create
<add>#### Exec Create
<ide>
<ide> `POST /containers/(id or name)/exec`
<ide>
<ide> Sets up an exec instance in a running container `id`
<ide> - **201** – no error
<ide> - **404** – no such container
<ide>
<del>### Exec Start
<add>#### Exec Start
<ide>
<ide> `POST /exec/(id)/start`
<ide>
<ide> interactive session with the `exec` command.
<ide>
<ide> Similar to the stream behavior of `POST /containers/(id or name)/attach` API
<ide>
<del>### Exec Resize
<add>#### Exec Resize
<ide>
<ide> `POST /exec/(id)/resize`
<ide>
<ide> This API is valid only if `tty` was specified as part of creating and starting t
<ide> - **201** – no error
<ide> - **404** – no such exec instance
<ide>
<del>### Exec Inspect
<add>#### Exec Inspect
<ide>
<ide> `GET /exec/(id)/json`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **404** – no such exec instance
<ide> - **500** - server error
<ide>
<del># 3. Going further
<add>## 3. Going further
<ide>
<del>## 3.1 Inside `docker run`
<add>### 3.1 Inside `docker run`
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> - If in detached mode or only `stdin` is attached, display the container's id.
<ide>
<del>## 3.2 Hijacking
<add>### 3.2 Hijacking
<ide>
<ide> In this version of the API, `/attach`, uses hijacking to transport `stdin`,
<ide> `stdout`, and `stderr` on the same socket.
<ide> When Docker daemon detects the `Upgrade` header, it switches its status code
<ide> from **200 OK** to **101 UPGRADED** and resends the same headers.
<ide>
<ide>
<del>## 3.3 CORS Requests
<add>### 3.3 CORS Requests
<ide>
<ide> To set cross origin requests to the Engine API please give values to
<ide> `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
<ide><path>docs/api/v1.21.md
<ide> redirect_from:
<ide> will be rejected.
<ide> -->
<ide>
<del># Docker Engine API v1.21
<del>
<ide> ## 1. Brief introduction
<ide>
<ide> - The daemon listens on `unix:///var/run/docker.sock` but you can
<ide> redirect_from:
<ide> - When the client API version is newer than the daemon's, these calls return an HTTP
<ide> `400 Bad Request` error message.
<ide>
<del># 2. Endpoints
<add>## 2. Endpoints
<ide>
<del>## 2.1 Containers
<add>### 2.1 Containers
<ide>
<del>### List containers
<add>#### List containers
<ide>
<ide> `GET /containers/json`
<ide>
<ide> List containers
<ide> - **400** – bad parameter
<ide> - **500** – server error
<ide>
<del>### Create a container
<add>#### Create a container
<ide>
<ide> `POST /containers/create`
<ide>
<ide> Create a container
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Inspect a container
<add>#### Inspect a container
<ide>
<ide> `GET /containers/(id or name)/json`
<ide>
<ide> Return low-level information on the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### List processes running inside a container
<add>#### List processes running inside a container
<ide>
<ide> `GET /containers/(id or name)/top`
<ide>
<ide> supported on Windows.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container logs
<add>#### Get container logs
<ide>
<ide> `GET /containers/(id or name)/logs`
<ide>
<ide> Get `stdout` and `stderr` logs from the container ``id``
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Inspect changes on a container's filesystem
<add>#### Inspect changes on a container's filesystem
<ide>
<ide> `GET /containers/(id or name)/changes`
<ide>
<ide> Values for `Kind`:
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Export a container
<add>#### Export a container
<ide>
<ide> `GET /containers/(id or name)/export`
<ide>
<ide> Export the contents of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container stats based on resource usage
<add>#### Get container stats based on resource usage
<ide>
<ide> `GET /containers/(id or name)/stats`
<ide>
<ide> The precpu_stats is the cpu statistic of last read, which is used for calculatin
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Resize a container TTY
<add>#### Resize a container TTY
<ide>
<ide> `POST /containers/(id or name)/resize`
<ide>
<ide> Resize the TTY for container with `id`. The unit is number of characters. You m
<ide> - **404** – No such container
<ide> - **500** – Cannot resize container
<ide>
<del>### Start a container
<add>#### Start a container
<ide>
<ide> `POST /containers/(id or name)/start`
<ide>
<ide> Start the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Stop a container
<add>#### Stop a container
<ide>
<ide> `POST /containers/(id or name)/stop`
<ide>
<ide> Stop the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Restart a container
<add>#### Restart a container
<ide>
<ide> `POST /containers/(id or name)/restart`
<ide>
<ide> Restart the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Kill a container
<add>#### Kill a container
<ide>
<ide> `POST /containers/(id or name)/kill`
<ide>
<ide> Kill the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Rename a container
<add>#### Rename a container
<ide>
<ide> `POST /containers/(id or name)/rename`
<ide>
<ide> Rename the container `id` to a `new_name`
<ide> - **409** - conflict name already assigned
<ide> - **500** – server error
<ide>
<del>### Pause a container
<add>#### Pause a container
<ide>
<ide> `POST /containers/(id or name)/pause`
<ide>
<ide> Pause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Unpause a container
<add>#### Unpause a container
<ide>
<ide> `POST /containers/(id or name)/unpause`
<ide>
<ide> Unpause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Attach to a container
<add>#### Attach to a container
<ide>
<ide> `POST /containers/(id or name)/attach`
<ide>
<ide> The simplest way to implement the Attach protocol is the following:
<ide> 4. Read the extracted size and output it on the correct output.
<ide> 5. Goto 1.
<ide>
<del>### Attach to a container (websocket)
<add>#### Attach to a container (websocket)
<ide>
<ide> `GET /containers/(id or name)/attach/ws`
<ide>
<ide> Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Wait a container
<add>#### Wait a container
<ide>
<ide> `POST /containers/(id or name)/wait`
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Remove a container
<add>#### Remove a container
<ide>
<ide> `DELETE /containers/(id or name)`
<ide>
<ide> Remove the container `id` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Copy files or folders from a container
<add>#### Copy files or folders from a container
<ide>
<ide> `POST /containers/(id or name)/copy`
<ide>
<ide> Copy files or folders of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Retrieving information about files and folders in a container
<add>#### Retrieving information about files and folders in a container
<ide>
<ide> `HEAD /containers/(id or name)/archive`
<ide>
<ide> See the description of the `X-Docker-Container-Path-Stat` header in the
<ide> following section.
<ide>
<del>### Get an archive of a filesystem resource in a container
<add>#### Get an archive of a filesystem resource in a container
<ide>
<ide> `GET /containers/(id or name)/archive`
<ide>
<ide> desired.
<ide> - no such file or directory (**path** does not exist)
<ide> - **500** - server error
<ide>
<del>### Extract an archive of files or folders to a directory in a container
<add>#### Extract an archive of files or folders to a directory in a container
<ide>
<ide> `PUT /containers/(id or name)/archive`
<ide>
<ide> Upload a tar archive to be extracted to a path in the filesystem of container
<ide> - no such file or directory (**path** resource does not exist)
<ide> - **500** – server error
<ide>
<del>## 2.2 Images
<add>### 2.2 Images
<ide>
<del>### List Images
<add>#### List Images
<ide>
<ide> `GET /images/json`
<ide>
<ide> references on the command line.
<ide> - `label=key` or `label="key=value"` of an image label
<ide> - **filter** - only return images with the specified name
<ide>
<del>### Build image from a Dockerfile
<add>#### Build image from a Dockerfile
<ide>
<ide> `POST /build`
<ide>
<ide> or being killed.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Create an image
<add>#### Create an image
<ide>
<ide> `POST /images/create`
<ide>
<ide> a base64-encoded AuthConfig object.
<ide>
<ide>
<ide>
<del>### Inspect an image
<add>#### Inspect an image
<ide>
<ide> `GET /images/(name)/json`
<ide>
<ide> Return low-level information on the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Get the history of an image
<add>#### Get the history of an image
<ide>
<ide> `GET /images/(name)/history`
<ide>
<ide> Return the history of the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Push an image on the registry
<add>#### Push an image on the registry
<ide>
<ide> `POST /images/(name)/push`
<ide>
<ide> then be used in the URL. This duplicates the command line's flow.
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Tag an image into a repository
<add>#### Tag an image into a repository
<ide>
<ide> `POST /images/(name)/tag`
<ide>
<ide> Tag the image `name` into a repository
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Remove an image
<add>#### Remove an image
<ide>
<ide> `DELETE /images/(name)`
<ide>
<ide> Remove the image `name` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Search images
<add>#### Search images
<ide>
<ide> `GET /images/search`
<ide>
<ide> Search for an image on [Docker Hub](https://hub.docker.com).
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>## 2.3 Misc
<add>### 2.3 Misc
<ide>
<del>### Check auth configuration
<add>#### Check auth configuration
<ide>
<ide> `POST /auth`
<ide>
<ide> Get the default username and email
<ide> - **204** – no error
<ide> - **500** – server error
<ide>
<del>### Display system-wide information
<add>#### Display system-wide information
<ide>
<ide> `GET /info`
<ide>
<ide> Display system-wide information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Show the docker version information
<add>#### Show the docker version information
<ide>
<ide> `GET /version`
<ide>
<ide> Show the docker version information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Ping the docker server
<add>#### Ping the docker server
<ide>
<ide> `GET /_ping`
<ide>
<ide> Ping the docker server
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a new image from a container's changes
<add>#### Create a new image from a container's changes
<ide>
<ide> `POST /commit`
<ide>
<ide> Create a new image from a container's changes
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Monitor Docker's events
<add>#### Monitor Docker's events
<ide>
<ide> `GET /events`
<ide>
<ide> Docker images report the following events:
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images in a repository
<add>#### Get a tarball containing all images in a repository
<ide>
<ide> `GET /images/(name)/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images
<add>#### Get a tarball containing all images
<ide>
<ide> `GET /images/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Load a tarball with a set of images and tags into docker
<add>#### Load a tarball with a set of images and tags into docker
<ide>
<ide> `POST /images/load`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Image tarball format
<add>#### Image tarball format
<ide>
<ide> An image tarball contains one directory per image layer (named using its long ID),
<ide> each containing these files:
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide> }
<ide> ```
<ide>
<del>### Exec Create
<add>#### Exec Create
<ide>
<ide> `POST /containers/(id or name)/exec`
<ide>
<ide> Sets up an exec instance in a running container `id`
<ide> - **409** - container is paused
<ide> - **500** - server error
<ide>
<del>### Exec Start
<add>#### Exec Start
<ide>
<ide> `POST /exec/(id)/start`
<ide>
<ide> interactive session with the `exec` command.
<ide>
<ide> Similar to the stream behavior of `POST /containers/(id or name)/attach` API
<ide>
<del>### Exec Resize
<add>#### Exec Resize
<ide>
<ide> `POST /exec/(id)/resize`
<ide>
<ide> This API is valid only if `tty` was specified as part of creating and starting t
<ide> - **201** – no error
<ide> - **404** – no such exec instance
<ide>
<del>### Exec Inspect
<add>#### Exec Inspect
<ide>
<ide> `GET /exec/(id)/json`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **404** – no such exec instance
<ide> - **500** - server error
<ide>
<del>## 2.4 Volumes
<add>### 2.4 Volumes
<ide>
<del>### List volumes
<add>#### List volumes
<ide>
<ide> `GET /volumes`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a volume
<add>#### Create a volume
<ide>
<ide> `POST /volumes/create`
<ide>
<ide> Create a volume
<ide> - **DriverOpts** - A mapping of driver options and values. These options are
<ide> passed directly to the driver and are driver specific.
<ide>
<del>### Inspect a volume
<add>#### Inspect a volume
<ide>
<ide> `GET /volumes/(name)`
<ide>
<ide> Return low-level information on the volume `name`
<ide> - **404** - no such volume
<ide> - **500** - server error
<ide>
<del>### Remove a volume
<add>#### Remove a volume
<ide>
<ide> `DELETE /volumes/(name)`
<ide>
<ide> Instruct the driver to remove the volume (`name`).
<ide> - **409** - volume is in use and cannot be removed
<ide> - **500** - server error
<ide>
<del>## 2.5 Networks
<add>### 2.5 Networks
<ide>
<del>### List networks
<add>#### List networks
<ide>
<ide> `GET /networks`
<ide>
<ide> Content-Type: application/json
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Inspect network
<add>#### Inspect network
<ide>
<ide> `GET /networks/<network-id>`
<ide>
<ide> Content-Type: application/json
<ide> - **200** - no error
<ide> - **404** - network not found
<ide>
<del>### Create a network
<add>#### Create a network
<ide>
<ide> `POST /networks/create`
<ide>
<ide> Content-Type: application/json
<ide> `{"Subnet": <CIDR>, "IPRange": <CIDR>, "Gateway": <IP address>, "AuxAddress": <device_name:IP address>}`
<ide> - **Options** - Network specific options to be used by the drivers
<ide>
<del>### Connect a container to a network
<add>#### Connect a container to a network
<ide>
<ide> `POST /networks/(id)/connect`
<ide>
<ide> Content-Type: application/json
<ide>
<ide> - **container** - container-id/name to be connected to the network
<ide>
<del>### Disconnect a container from a network
<add>#### Disconnect a container from a network
<ide>
<ide> `POST /networks/(id)/disconnect`
<ide>
<ide> Content-Type: application/json
<ide>
<ide> - **Container** - container-id/name to be disconnected from a network
<ide>
<del>### Remove a network
<add>#### Remove a network
<ide>
<ide> `DELETE /networks/(id)`
<ide>
<ide> Instruct the driver to remove the network (`id`).
<ide> - **404** - no such network
<ide> - **500** - server error
<ide>
<del># 3. Going further
<add>## 3. Going further
<ide>
<del>## 3.1 Inside `docker run`
<add>### 3.1 Inside `docker run`
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> - If in detached mode or only `stdin` is attached, display the container's id.
<ide>
<del>## 3.2 Hijacking
<add>### 3.2 Hijacking
<ide>
<ide> In this version of the API, `/attach`, uses hijacking to transport `stdin`,
<ide> `stdout`, and `stderr` on the same socket.
<ide> When Docker daemon detects the `Upgrade` header, it switches its status code
<ide> from **200 OK** to **101 UPGRADED** and resends the same headers.
<ide>
<ide>
<del>## 3.3 CORS Requests
<add>### 3.3 CORS Requests
<ide>
<ide> To set cross origin requests to the Engine API please give values to
<ide> `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
<ide><path>docs/api/v1.22.md
<ide> redirect_from:
<ide> will be rejected.
<ide> -->
<ide>
<del># Docker Engine API v1.22
<del>
<del># 1. Brief introduction
<add>## 1. Brief introduction
<ide>
<ide> - The daemon listens on `unix:///var/run/docker.sock` but you can
<ide> [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
<ide> - The API tends to be REST. However, for some complex commands, like `attach`
<ide> or `pull`, the HTTP connection is hijacked to transport `stdout`,
<ide> `stdin` and `stderr`.
<ide>
<del># 2. Endpoints
<add>## 2. Endpoints
<ide>
<del>## 2.1 Containers
<add>### 2.1 Containers
<ide>
<del>### List containers
<add>#### List containers
<ide>
<ide> `GET /containers/json`
<ide>
<ide> List containers
<ide> - **400** – bad parameter
<ide> - **500** – server error
<ide>
<del>### Create a container
<add>#### Create a container
<ide>
<ide> `POST /containers/create`
<ide>
<ide> Create a container
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Inspect a container
<add>#### Inspect a container
<ide>
<ide> `GET /containers/(id or name)/json`
<ide>
<ide> Return low-level information on the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### List processes running inside a container
<add>#### List processes running inside a container
<ide>
<ide> `GET /containers/(id or name)/top`
<ide>
<ide> supported on Windows.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container logs
<add>#### Get container logs
<ide>
<ide> `GET /containers/(id or name)/logs`
<ide>
<ide> Get `stdout` and `stderr` logs from the container ``id``
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Inspect changes on a container's filesystem
<add>#### Inspect changes on a container's filesystem
<ide>
<ide> `GET /containers/(id or name)/changes`
<ide>
<ide> Values for `Kind`:
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Export a container
<add>#### Export a container
<ide>
<ide> `GET /containers/(id or name)/export`
<ide>
<ide> Export the contents of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container stats based on resource usage
<add>#### Get container stats based on resource usage
<ide>
<ide> `GET /containers/(id or name)/stats`
<ide>
<ide> The precpu_stats is the cpu statistic of last read, which is used for calculatin
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Resize a container TTY
<add>#### Resize a container TTY
<ide>
<ide> `POST /containers/(id or name)/resize`
<ide>
<ide> Resize the TTY for container with `id`. The unit is number of characters. You m
<ide> - **404** – No such container
<ide> - **500** – Cannot resize container
<ide>
<del>### Start a container
<add>#### Start a container
<ide>
<ide> `POST /containers/(id or name)/start`
<ide>
<ide> Start the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Stop a container
<add>#### Stop a container
<ide>
<ide> `POST /containers/(id or name)/stop`
<ide>
<ide> Stop the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Restart a container
<add>#### Restart a container
<ide>
<ide> `POST /containers/(id or name)/restart`
<ide>
<ide> Restart the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Kill a container
<add>#### Kill a container
<ide>
<ide> `POST /containers/(id or name)/kill`
<ide>
<ide> Kill the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Update a container
<add>#### Update a container
<ide>
<ide> `POST /containers/(id or name)/update`
<ide>
<ide> Update resource configs of one or more containers.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Rename a container
<add>#### Rename a container
<ide>
<ide> `POST /containers/(id or name)/rename`
<ide>
<ide> Rename the container `id` to a `new_name`
<ide> - **409** - conflict name already assigned
<ide> - **500** – server error
<ide>
<del>### Pause a container
<add>#### Pause a container
<ide>
<ide> `POST /containers/(id or name)/pause`
<ide>
<ide> Pause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Unpause a container
<add>#### Unpause a container
<ide>
<ide> `POST /containers/(id or name)/unpause`
<ide>
<ide> Unpause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Attach to a container
<add>#### Attach to a container
<ide>
<ide> `POST /containers/(id or name)/attach`
<ide>
<ide> The simplest way to implement the Attach protocol is the following:
<ide> 4. Read the extracted size and output it on the correct output.
<ide> 5. Goto 1.
<ide>
<del>### Attach to a container (websocket)
<add>#### Attach to a container (websocket)
<ide>
<ide> `GET /containers/(id or name)/attach/ws`
<ide>
<ide> Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Wait a container
<add>#### Wait a container
<ide>
<ide> `POST /containers/(id or name)/wait`
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Remove a container
<add>#### Remove a container
<ide>
<ide> `DELETE /containers/(id or name)`
<ide>
<ide> Remove the container `id` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Copy files or folders from a container
<add>#### Copy files or folders from a container
<ide>
<ide> `POST /containers/(id or name)/copy`
<ide>
<ide> Copy files or folders of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Retrieving information about files and folders in a container
<add>#### Retrieving information about files and folders in a container
<ide>
<ide> `HEAD /containers/(id or name)/archive`
<ide>
<ide> See the description of the `X-Docker-Container-Path-Stat` header in the
<ide> following section.
<ide>
<del>### Get an archive of a filesystem resource in a container
<add>#### Get an archive of a filesystem resource in a container
<ide>
<ide> `GET /containers/(id or name)/archive`
<ide>
<ide> desired.
<ide> - no such file or directory (**path** does not exist)
<ide> - **500** - server error
<ide>
<del>### Extract an archive of files or folders to a directory in a container
<add>#### Extract an archive of files or folders to a directory in a container
<ide>
<ide> `PUT /containers/(id or name)/archive`
<ide>
<ide> Upload a tar archive to be extracted to a path in the filesystem of container
<ide> - no such file or directory (**path** resource does not exist)
<ide> - **500** – server error
<ide>
<del>## 2.2 Images
<add>### 2.2 Images
<ide>
<del>### List Images
<add>#### List Images
<ide>
<ide> `GET /images/json`
<ide>
<ide> references on the command line.
<ide> - `label=key` or `label="key=value"` of an image label
<ide> - **filter** - only return images with the specified name
<ide>
<del>### Build image from a Dockerfile
<add>#### Build image from a Dockerfile
<ide>
<ide> `POST /build`
<ide>
<ide> or being killed.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Create an image
<add>#### Create an image
<ide>
<ide> `POST /images/create`
<ide>
<ide> a base64-encoded AuthConfig object.
<ide>
<ide>
<ide>
<del>### Inspect an image
<add>#### Inspect an image
<ide>
<ide> `GET /images/(name)/json`
<ide>
<ide> Return low-level information on the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Get the history of an image
<add>#### Get the history of an image
<ide>
<ide> `GET /images/(name)/history`
<ide>
<ide> Return the history of the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Push an image on the registry
<add>#### Push an image on the registry
<ide>
<ide> `POST /images/(name)/push`
<ide>
<ide> The push is cancelled if the HTTP connection is closed.
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Tag an image into a repository
<add>#### Tag an image into a repository
<ide>
<ide> `POST /images/(name)/tag`
<ide>
<ide> Tag the image `name` into a repository
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Remove an image
<add>#### Remove an image
<ide>
<ide> `DELETE /images/(name)`
<ide>
<ide> Remove the image `name` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Search images
<add>#### Search images
<ide>
<ide> `GET /images/search`
<ide>
<ide> Search for an image on [Docker Hub](https://hub.docker.com).
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>## 2.3 Misc
<add>### 2.3 Misc
<ide>
<del>### Check auth configuration
<add>#### Check auth configuration
<ide>
<ide> `POST /auth`
<ide>
<ide> Get the default username and email
<ide> - **204** – no error
<ide> - **500** – server error
<ide>
<del>### Display system-wide information
<add>#### Display system-wide information
<ide>
<ide> `GET /info`
<ide>
<ide> Display system-wide information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Show the docker version information
<add>#### Show the docker version information
<ide>
<ide> `GET /version`
<ide>
<ide> Show the docker version information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Ping the docker server
<add>#### Ping the docker server
<ide>
<ide> `GET /_ping`
<ide>
<ide> Ping the docker server
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a new image from a container's changes
<add>#### Create a new image from a container's changes
<ide>
<ide> `POST /commit`
<ide>
<ide> Create a new image from a container's changes
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Monitor Docker's events
<add>#### Monitor Docker's events
<ide>
<ide> `GET /events`
<ide>
<ide> Docker networks report the following events:
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images in a repository
<add>#### Get a tarball containing all images in a repository
<ide>
<ide> `GET /images/(name)/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images
<add>#### Get a tarball containing all images
<ide>
<ide> `GET /images/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Load a tarball with a set of images and tags into docker
<add>#### Load a tarball with a set of images and tags into docker
<ide>
<ide> `POST /images/load`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Image tarball format
<add>#### Image tarball format
<ide>
<ide> An image tarball contains one directory per image layer (named using its long ID),
<ide> each containing these files:
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide> }
<ide> ```
<ide>
<del>### Exec Create
<add>#### Exec Create
<ide>
<ide> `POST /containers/(id or name)/exec`
<ide>
<ide> Sets up an exec instance in a running container `id`
<ide> - **409** - container is paused
<ide> - **500** - server error
<ide>
<del>### Exec Start
<add>#### Exec Start
<ide>
<ide> `POST /exec/(id)/start`
<ide>
<ide> interactive session with the `exec` command.
<ide>
<ide> Similar to the stream behavior of `POST /containers/(id or name)/attach` API
<ide>
<del>### Exec Resize
<add>#### Exec Resize
<ide>
<ide> `POST /exec/(id)/resize`
<ide>
<ide> This API is valid only if `tty` was specified as part of creating and starting t
<ide> - **201** – no error
<ide> - **404** – no such exec instance
<ide>
<del>### Exec Inspect
<add>#### Exec Inspect
<ide>
<ide> `GET /exec/(id)/json`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **404** – no such exec instance
<ide> - **500** - server error
<ide>
<del>## 2.4 Volumes
<add>### 2.4 Volumes
<ide>
<del>### List volumes
<add>#### List volumes
<ide>
<ide> `GET /volumes`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a volume
<add>#### Create a volume
<ide>
<ide> `POST /volumes/create`
<ide>
<ide> Create a volume
<ide> - **DriverOpts** - A mapping of driver options and values. These options are
<ide> passed directly to the driver and are driver specific.
<ide>
<del>### Inspect a volume
<add>#### Inspect a volume
<ide>
<ide> `GET /volumes/(name)`
<ide>
<ide> Return low-level information on the volume `name`
<ide> - **404** - no such volume
<ide> - **500** - server error
<ide>
<del>### Remove a volume
<add>#### Remove a volume
<ide>
<ide> `DELETE /volumes/(name)`
<ide>
<ide> Instruct the driver to remove the volume (`name`).
<ide> - **409** - volume is in use and cannot be removed
<ide> - **500** - server error
<ide>
<del>## 2.5 Networks
<add>### 2.5 Networks
<ide>
<del>### List networks
<add>#### List networks
<ide>
<ide> `GET /networks`
<ide>
<ide> Content-Type: application/json
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Inspect network
<add>#### Inspect network
<ide>
<ide> `GET /networks/<network-id>`
<ide>
<ide> Content-Type: application/json
<ide> - **200** - no error
<ide> - **404** - network not found
<ide>
<del>### Create a network
<add>#### Create a network
<ide>
<ide> `POST /networks/create`
<ide>
<ide> Content-Type: application/json
<ide> - **Options** - Driver-specific options, specified as a map: `{"option":"value" [,"option2":"value2"]}`
<ide> - **Options** - Network specific options to be used by the drivers
<ide>
<del>### Connect a container to a network
<add>#### Connect a container to a network
<ide>
<ide> `POST /networks/(id)/connect`
<ide>
<ide> Content-Type: application/json
<ide>
<ide> - **container** - container-id/name to be connected to the network
<ide>
<del>### Disconnect a container from a network
<add>#### Disconnect a container from a network
<ide>
<ide> `POST /networks/(id)/disconnect`
<ide>
<ide> Content-Type: application/json
<ide> - **Container** - container-id/name to be disconnected from a network
<ide> - **Force** - Force the container to disconnect from a network
<ide>
<del>### Remove a network
<add>#### Remove a network
<ide>
<ide> `DELETE /networks/(id)`
<ide>
<ide> Instruct the driver to remove the network (`id`).
<ide> - **404** - no such network
<ide> - **500** - server error
<ide>
<del># 3. Going further
<add>## 3. Going further
<ide>
<del>## 3.1 Inside `docker run`
<add>### 3.1 Inside `docker run`
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> - If in detached mode or only `stdin` is attached, display the container's id.
<ide>
<del>## 3.2 Hijacking
<add>### 3.2 Hijacking
<ide>
<ide> In this version of the API, `/attach`, uses hijacking to transport `stdin`,
<ide> `stdout`, and `stderr` on the same socket.
<ide> When Docker daemon detects the `Upgrade` header, it switches its status code
<ide> from **200 OK** to **101 UPGRADED** and resends the same headers.
<ide>
<ide>
<del>## 3.3 CORS Requests
<add>### 3.3 CORS Requests
<ide>
<ide> To set cross origin requests to the Engine API please give values to
<ide> `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
<ide><path>docs/api/v1.23.md
<ide> redirect_from:
<ide> will be rejected.
<ide> -->
<ide>
<del># Docker Engine API v1.23
<del>
<ide> ## 1. Brief introduction
<ide>
<ide> - The daemon listens on `unix:///var/run/docker.sock` but you can
<ide> redirect_from:
<ide> - When the client API version is newer than the daemon's, these calls return an HTTP
<ide> `400 Bad Request` error message.
<ide>
<del># 2. Endpoints
<add>## 2. Endpoints
<ide>
<del>## 2.1 Containers
<add>### 2.1 Containers
<ide>
<del>### List containers
<add>#### List containers
<ide>
<ide> `GET /containers/json`
<ide>
<ide> List containers
<ide> - **400** – bad parameter
<ide> - **500** – server error
<ide>
<del>### Create a container
<add>#### Create a container
<ide>
<ide> `POST /containers/create`
<ide>
<ide> Create a container
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Inspect a container
<add>#### Inspect a container
<ide>
<ide> `GET /containers/(id or name)/json`
<ide>
<ide> Return low-level information on the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### List processes running inside a container
<add>#### List processes running inside a container
<ide>
<ide> `GET /containers/(id or name)/top`
<ide>
<ide> supported on Windows.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container logs
<add>#### Get container logs
<ide>
<ide> `GET /containers/(id or name)/logs`
<ide>
<ide> Get `stdout` and `stderr` logs from the container ``id``
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Inspect changes on a container's filesystem
<add>#### Inspect changes on a container's filesystem
<ide>
<ide> `GET /containers/(id or name)/changes`
<ide>
<ide> Values for `Kind`:
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Export a container
<add>#### Export a container
<ide>
<ide> `GET /containers/(id or name)/export`
<ide>
<ide> Export the contents of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container stats based on resource usage
<add>#### Get container stats based on resource usage
<ide>
<ide> `GET /containers/(id or name)/stats`
<ide>
<ide> The precpu_stats is the cpu statistic of last read, which is used for calculatin
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Resize a container TTY
<add>#### Resize a container TTY
<ide>
<ide> `POST /containers/(id or name)/resize`
<ide>
<ide> Resize the TTY for container with `id`. The unit is number of characters. You m
<ide> - **404** – No such container
<ide> - **500** – Cannot resize container
<ide>
<del>### Start a container
<add>#### Start a container
<ide>
<ide> `POST /containers/(id or name)/start`
<ide>
<ide> Start the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Stop a container
<add>#### Stop a container
<ide>
<ide> `POST /containers/(id or name)/stop`
<ide>
<ide> Stop the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Restart a container
<add>#### Restart a container
<ide>
<ide> `POST /containers/(id or name)/restart`
<ide>
<ide> Restart the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Kill a container
<add>#### Kill a container
<ide>
<ide> `POST /containers/(id or name)/kill`
<ide>
<ide> Kill the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Update a container
<add>#### Update a container
<ide>
<ide> `POST /containers/(id or name)/update`
<ide>
<ide> Update configuration of one or more containers.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Rename a container
<add>#### Rename a container
<ide>
<ide> `POST /containers/(id or name)/rename`
<ide>
<ide> Rename the container `id` to a `new_name`
<ide> - **409** - conflict name already assigned
<ide> - **500** – server error
<ide>
<del>### Pause a container
<add>#### Pause a container
<ide>
<ide> `POST /containers/(id or name)/pause`
<ide>
<ide> Pause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Unpause a container
<add>#### Unpause a container
<ide>
<ide> `POST /containers/(id or name)/unpause`
<ide>
<ide> Unpause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Attach to a container
<add>#### Attach to a container
<ide>
<ide> `POST /containers/(id or name)/attach`
<ide>
<ide> The simplest way to implement the Attach protocol is the following:
<ide> 4. Read the extracted size and output it on the correct output.
<ide> 5. Goto 1.
<ide>
<del>### Attach to a container (websocket)
<add>#### Attach to a container (websocket)
<ide>
<ide> `GET /containers/(id or name)/attach/ws`
<ide>
<ide> Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Wait a container
<add>#### Wait a container
<ide>
<ide> `POST /containers/(id or name)/wait`
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Remove a container
<add>#### Remove a container
<ide>
<ide> `DELETE /containers/(id or name)`
<ide>
<ide> Remove the container `id` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Copy files or folders from a container
<add>#### Copy files or folders from a container
<ide>
<ide> `POST /containers/(id or name)/copy`
<ide>
<ide> Copy files or folders of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Retrieving information about files and folders in a container
<add>#### Retrieving information about files and folders in a container
<ide>
<ide> `HEAD /containers/(id or name)/archive`
<ide>
<ide> See the description of the `X-Docker-Container-Path-Stat` header in the
<ide> following section.
<ide>
<del>### Get an archive of a filesystem resource in a container
<add>#### Get an archive of a filesystem resource in a container
<ide>
<ide> `GET /containers/(id or name)/archive`
<ide>
<ide> desired.
<ide> - no such file or directory (**path** does not exist)
<ide> - **500** - server error
<ide>
<del>### Extract an archive of files or folders to a directory in a container
<add>#### Extract an archive of files or folders to a directory in a container
<ide>
<ide> `PUT /containers/(id or name)/archive`
<ide>
<ide> Upload a tar archive to be extracted to a path in the filesystem of container
<ide> - no such file or directory (**path** resource does not exist)
<ide> - **500** – server error
<ide>
<del>## 2.2 Images
<add>### 2.2 Images
<ide>
<del>### List Images
<add>#### List Images
<ide>
<ide> `GET /images/json`
<ide>
<ide> references on the command line.
<ide> - `label=key` or `label="key=value"` of an image label
<ide> - **filter** - only return images with the specified name
<ide>
<del>### Build image from a Dockerfile
<add>#### Build image from a Dockerfile
<ide>
<ide> `POST /build`
<ide>
<ide> or being killed.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Create an image
<add>#### Create an image
<ide>
<ide> `POST /images/create`
<ide>
<ide> a base64-encoded AuthConfig object.
<ide>
<ide>
<ide>
<del>### Inspect an image
<add>#### Inspect an image
<ide>
<ide> `GET /images/(name)/json`
<ide>
<ide> Return low-level information on the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Get the history of an image
<add>#### Get the history of an image
<ide>
<ide> `GET /images/(name)/history`
<ide>
<ide> Return the history of the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Push an image on the registry
<add>#### Push an image on the registry
<ide>
<ide> `POST /images/(name)/push`
<ide>
<ide> The push is cancelled if the HTTP connection is closed.
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Tag an image into a repository
<add>#### Tag an image into a repository
<ide>
<ide> `POST /images/(name)/tag`
<ide>
<ide> Tag the image `name` into a repository
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Remove an image
<add>#### Remove an image
<ide>
<ide> `DELETE /images/(name)`
<ide>
<ide> Remove the image `name` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Search images
<add>#### Search images
<ide>
<ide> `GET /images/search`
<ide>
<ide> Search for an image on [Docker Hub](https://hub.docker.com).
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>## 2.3 Misc
<add>### 2.3 Misc
<ide>
<del>### Check auth configuration
<add>#### Check auth configuration
<ide>
<ide> `POST /auth`
<ide>
<ide> if available, for accessing the registry without password.
<ide> - **204** – no error
<ide> - **500** – server error
<ide>
<del>### Display system-wide information
<add>#### Display system-wide information
<ide>
<ide> `GET /info`
<ide>
<ide> Display system-wide information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Show the docker version information
<add>#### Show the docker version information
<ide>
<ide> `GET /version`
<ide>
<ide> Show the docker version information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Ping the docker server
<add>#### Ping the docker server
<ide>
<ide> `GET /_ping`
<ide>
<ide> Ping the docker server
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a new image from a container's changes
<add>#### Create a new image from a container's changes
<ide>
<ide> `POST /commit`
<ide>
<ide> Create a new image from a container's changes
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Monitor Docker's events
<add>#### Monitor Docker's events
<ide>
<ide> `GET /events`
<ide>
<ide> Docker networks report the following events:
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images in a repository
<add>#### Get a tarball containing all images in a repository
<ide>
<ide> `GET /images/(name)/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images
<add>#### Get a tarball containing all images
<ide>
<ide> `GET /images/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Load a tarball with a set of images and tags into docker
<add>#### Load a tarball with a set of images and tags into docker
<ide>
<ide> `POST /images/load`
<ide>
<ide> action completes.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Image tarball format
<add>#### Image tarball format
<ide>
<ide> An image tarball contains one directory per image layer (named using its long ID),
<ide> each containing these files:
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide> }
<ide> ```
<ide>
<del>### Exec Create
<add>#### Exec Create
<ide>
<ide> `POST /containers/(id or name)/exec`
<ide>
<ide> Sets up an exec instance in a running container `id`
<ide> - **409** - container is paused
<ide> - **500** - server error
<ide>
<del>### Exec Start
<add>#### Exec Start
<ide>
<ide> `POST /exec/(id)/start`
<ide>
<ide> interactive session with the `exec` command.
<ide>
<ide> Similar to the stream behavior of `POST /containers/(id or name)/attach` API
<ide>
<del>### Exec Resize
<add>#### Exec Resize
<ide>
<ide> `POST /exec/(id)/resize`
<ide>
<ide> This API is valid only if `tty` was specified as part of creating and starting t
<ide> - **201** – no error
<ide> - **404** – no such exec instance
<ide>
<del>### Exec Inspect
<add>#### Exec Inspect
<ide>
<ide> `GET /exec/(id)/json`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **404** – no such exec instance
<ide> - **500** - server error
<ide>
<del>## 2.4 Volumes
<add>### 2.4 Volumes
<ide>
<del>### List volumes
<add>#### List volumes
<ide>
<ide> `GET /volumes`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a volume
<add>#### Create a volume
<ide>
<ide> `POST /volumes/create`
<ide>
<ide> Create a volume
<ide> passed directly to the driver and are driver specific.
<ide> - **Labels** - Labels to set on the volume, specified as a map: `{"key":"value","key2":"value2"}`
<ide>
<del>### Inspect a volume
<add>#### Inspect a volume
<ide>
<ide> `GET /volumes/(name)`
<ide>
<ide> Return low-level information on the volume `name`
<ide> - **404** - no such volume
<ide> - **500** - server error
<ide>
<del>### Remove a volume
<add>#### Remove a volume
<ide>
<ide> `DELETE /volumes/(name)`
<ide>
<ide> Instruct the driver to remove the volume (`name`).
<ide> - **409** - volume is in use and cannot be removed
<ide> - **500** - server error
<ide>
<del>## 3.5 Networks
<add>### 3.5 Networks
<ide>
<del>### List networks
<add>#### List networks
<ide>
<ide> `GET /networks`
<ide>
<ide> Content-Type: application/json
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Inspect network
<add>#### Inspect network
<ide>
<ide> `GET /networks/<network-id>`
<ide>
<ide> Content-Type: application/json
<ide> - **200** - no error
<ide> - **404** - network not found
<ide>
<del>### Create a network
<add>#### Create a network
<ide>
<ide> `POST /networks/create`
<ide>
<ide> Content-Type: application/json
<ide> - **Options** - Network specific options to be used by the drivers
<ide> - **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
<ide>
<del>### Connect a container to a network
<add>#### Connect a container to a network
<ide>
<ide> `POST /networks/(id)/connect`
<ide>
<ide> Content-Type: application/json
<ide>
<ide> - **container** - container-id/name to be connected to the network
<ide>
<del>### Disconnect a container from a network
<add>#### Disconnect a container from a network
<ide>
<ide> `POST /networks/(id)/disconnect`
<ide>
<ide> Content-Type: application/json
<ide> - **Container** - container-id/name to be disconnected from a network
<ide> - **Force** - Force the container to disconnect from a network
<ide>
<del>### Remove a network
<add>#### Remove a network
<ide>
<ide> `DELETE /networks/(id)`
<ide>
<ide> Instruct the driver to remove the network (`id`).
<ide> - **404** - no such network
<ide> - **500** - server error
<ide>
<del># 3. Going further
<add>## 3. Going further
<ide>
<del>## 3.1 Inside `docker run`
<add>### 3.1 Inside `docker run`
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> - If in detached mode or only `stdin` is attached, display the container's id.
<ide>
<del>## 3.2 Hijacking
<add>### 3.2 Hijacking
<ide>
<ide> In this version of the API, `/attach`, uses hijacking to transport `stdin`,
<ide> `stdout`, and `stderr` on the same socket.
<ide> When Docker daemon detects the `Upgrade` header, it switches its status code
<ide> from **200 OK** to **101 UPGRADED** and resends the same headers.
<ide>
<ide>
<del>## 3.3 CORS Requests
<add>### 3.3 CORS Requests
<ide>
<ide> To set cross origin requests to the Engine API please give values to
<ide> `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
<ide><path>docs/api/v1.24.md
<ide> redirect_from:
<ide> will be rejected.
<ide> -->
<ide>
<del># Docker Engine API v1.24
<del>
<del># 1. Brief introduction
<add>## 1. Brief introduction
<ide>
<ide> - The daemon listens on `unix:///var/run/docker.sock` but you can
<ide> [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
<ide> - The API tends to be REST. However, for some complex commands, like `attach`
<ide> or `pull`, the HTTP connection is hijacked to transport `stdout`,
<ide> `stdin` and `stderr`.
<ide>
<del># 2. Errors
<add>## 2. Errors
<ide>
<ide> The Engine API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:
<ide>
<ide> The Engine API uses standard HTTP status codes to indicate the success or failur
<ide>
<ide> The status codes that are returned for each endpoint are specified in the endpoint documentation below.
<ide>
<del># 3. Endpoints
<add>## 3. Endpoints
<ide>
<del>## 3.1 Containers
<add>### 3.1 Containers
<ide>
<del>### List containers
<add>#### List containers
<ide>
<ide> `GET /containers/json`
<ide>
<ide> List containers
<ide> - **400** – bad parameter
<ide> - **500** – server error
<ide>
<del>### Create a container
<add>#### Create a container
<ide>
<ide> `POST /containers/create`
<ide>
<ide> Create a container
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Inspect a container
<add>#### Inspect a container
<ide>
<ide> `GET /containers/(id or name)/json`
<ide>
<ide> Return low-level information on the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### List processes running inside a container
<add>#### List processes running inside a container
<ide>
<ide> `GET /containers/(id or name)/top`
<ide>
<ide> supported on Windows.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container logs
<add>#### Get container logs
<ide>
<ide> `GET /containers/(id or name)/logs`
<ide>
<ide> Get `stdout` and `stderr` logs from the container ``id``
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Inspect changes on a container's filesystem
<add>#### Inspect changes on a container's filesystem
<ide>
<ide> `GET /containers/(id or name)/changes`
<ide>
<ide> Values for `Kind`:
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Export a container
<add>#### Export a container
<ide>
<ide> `GET /containers/(id or name)/export`
<ide>
<ide> Export the contents of container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Get container stats based on resource usage
<add>#### Get container stats based on resource usage
<ide>
<ide> `GET /containers/(id or name)/stats`
<ide>
<ide> The precpu_stats is the cpu statistic of last read, which is used for calculatin
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Resize a container TTY
<add>#### Resize a container TTY
<ide>
<ide> `POST /containers/(id or name)/resize`
<ide>
<ide> Resize the TTY for container with `id`. The unit is number of characters. You m
<ide> - **404** – No such container
<ide> - **500** – Cannot resize container
<ide>
<del>### Start a container
<add>#### Start a container
<ide>
<ide> `POST /containers/(id or name)/start`
<ide>
<ide> Start the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Stop a container
<add>#### Stop a container
<ide>
<ide> `POST /containers/(id or name)/stop`
<ide>
<ide> Stop the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Restart a container
<add>#### Restart a container
<ide>
<ide> `POST /containers/(id or name)/restart`
<ide>
<ide> Restart the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Kill a container
<add>#### Kill a container
<ide>
<ide> `POST /containers/(id or name)/kill`
<ide>
<ide> Kill the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Update a container
<add>#### Update a container
<ide>
<ide> `POST /containers/(id or name)/update`
<ide>
<ide> Update configuration of one or more containers.
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Rename a container
<add>#### Rename a container
<ide>
<ide> `POST /containers/(id or name)/rename`
<ide>
<ide> Rename the container `id` to a `new_name`
<ide> - **409** - conflict name already assigned
<ide> - **500** – server error
<ide>
<del>### Pause a container
<add>#### Pause a container
<ide>
<ide> `POST /containers/(id or name)/pause`
<ide>
<ide> Pause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Unpause a container
<add>#### Unpause a container
<ide>
<ide> `POST /containers/(id or name)/unpause`
<ide>
<ide> Unpause the container `id`
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Attach to a container
<add>#### Attach to a container
<ide>
<ide> `POST /containers/(id or name)/attach`
<ide>
<ide> The simplest way to implement the Attach protocol is the following:
<ide> 4. Read the extracted size and output it on the correct output.
<ide> 5. Goto 1.
<ide>
<del>### Attach to a container (websocket)
<add>#### Attach to a container (websocket)
<ide>
<ide> `GET /containers/(id or name)/attach/ws`
<ide>
<ide> Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Wait a container
<add>#### Wait a container
<ide>
<ide> `POST /containers/(id or name)/wait`
<ide>
<ide> Block until container `id` stops, then returns the exit code
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Remove a container
<add>#### Remove a container
<ide>
<ide> `DELETE /containers/(id or name)`
<ide>
<ide> Remove the container `id` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Retrieving information about files and folders in a container
<add>#### Retrieving information about files and folders in a container
<ide>
<ide> `HEAD /containers/(id or name)/archive`
<ide>
<ide> See the description of the `X-Docker-Container-Path-Stat` header in the
<ide> following section.
<ide>
<del>### Get an archive of a filesystem resource in a container
<add>#### Get an archive of a filesystem resource in a container
<ide>
<ide> `GET /containers/(id or name)/archive`
<ide>
<ide> desired.
<ide> - no such file or directory (**path** does not exist)
<ide> - **500** - server error
<ide>
<del>### Extract an archive of files or folders to a directory in a container
<add>#### Extract an archive of files or folders to a directory in a container
<ide>
<ide> `PUT /containers/(id or name)/archive`
<ide>
<ide> Upload a tar archive to be extracted to a path in the filesystem of container
<ide> - no such file or directory (**path** resource does not exist)
<ide> - **500** – server error
<ide>
<del>## 3.2 Images
<add>### 3.2 Images
<ide>
<del>### List Images
<add>#### List Images
<ide>
<ide> `GET /images/json`
<ide>
<ide> references on the command line.
<ide> - `since`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`)
<ide> - **filter** - only return images with the specified name
<ide>
<del>### Build image from a Dockerfile
<add>#### Build image from a Dockerfile
<ide>
<ide> `POST /build`
<ide>
<ide> or being killed.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Create an image
<add>#### Create an image
<ide>
<ide> `POST /images/create`
<ide>
<ide> a base64-encoded AuthConfig object.
<ide>
<ide>
<ide>
<del>### Inspect an image
<add>#### Inspect an image
<ide>
<ide> `GET /images/(name)/json`
<ide>
<ide> Return low-level information on the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Get the history of an image
<add>#### Get the history of an image
<ide>
<ide> `GET /images/(name)/history`
<ide>
<ide> Return the history of the image `name`
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Push an image on the registry
<add>#### Push an image on the registry
<ide>
<ide> `POST /images/(name)/push`
<ide>
<ide> The push is cancelled if the HTTP connection is closed.
<ide> - **404** – no such image
<ide> - **500** – server error
<ide>
<del>### Tag an image into a repository
<add>#### Tag an image into a repository
<ide>
<ide> `POST /images/(name)/tag`
<ide>
<ide> Tag the image `name` into a repository
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Remove an image
<add>#### Remove an image
<ide>
<ide> `DELETE /images/(name)`
<ide>
<ide> Remove the image `name` from the filesystem
<ide> - **409** – conflict
<ide> - **500** – server error
<ide>
<del>### Search images
<add>#### Search images
<ide>
<ide> `GET /images/search`
<ide>
<ide> Search for an image on [Docker Hub](https://hub.docker.com).
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>## 3.3 Misc
<add>### 3.3 Misc
<ide>
<del>### Check auth configuration
<add>#### Check auth configuration
<ide>
<ide> `POST /auth`
<ide>
<ide> if available, for accessing the registry without password.
<ide> - **204** – no error
<ide> - **500** – server error
<ide>
<del>### Display system-wide information
<add>#### Display system-wide information
<ide>
<ide> `GET /info`
<ide>
<ide> Display system-wide information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Show the docker version information
<add>#### Show the docker version information
<ide>
<ide> `GET /version`
<ide>
<ide> Show the docker version information
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Ping the docker server
<add>#### Ping the docker server
<ide>
<ide> `GET /_ping`
<ide>
<ide> Ping the docker server
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a new image from a container's changes
<add>#### Create a new image from a container's changes
<ide>
<ide> `POST /commit`
<ide>
<ide> Create a new image from a container's changes
<ide> - **404** – no such container
<ide> - **500** – server error
<ide>
<del>### Monitor Docker's events
<add>#### Monitor Docker's events
<ide>
<ide> `GET /events`
<ide>
<ide> Docker daemon report the following event:
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images in a repository
<add>#### Get a tarball containing all images in a repository
<ide>
<ide> `GET /images/(name)/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Get a tarball containing all images
<add>#### Get a tarball containing all images
<ide>
<ide> `GET /images/get`
<ide>
<ide> See the [image tarball format](#image-tarball-format) for more details.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Load a tarball with a set of images and tags into docker
<add>#### Load a tarball with a set of images and tags into docker
<ide>
<ide> `POST /images/load`
<ide>
<ide> action completes.
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Image tarball format
<add>#### Image tarball format
<ide>
<ide> An image tarball contains one directory per image layer (named using its long ID),
<ide> each containing these files:
<ide> the root that contains a list of repository and tag names mapped to layer IDs.
<ide> }
<ide> ```
<ide>
<del>### Exec Create
<add>#### Exec Create
<ide>
<ide> `POST /containers/(id or name)/exec`
<ide>
<ide> Sets up an exec instance in a running container `id`
<ide> - **409** - container is paused
<ide> - **500** - server error
<ide>
<del>### Exec Start
<add>#### Exec Start
<ide>
<ide> `POST /exec/(id)/start`
<ide>
<ide> interactive session with the `exec` command.
<ide>
<ide> Similar to the stream behavior of `POST /containers/(id or name)/attach` API
<ide>
<del>### Exec Resize
<add>#### Exec Resize
<ide>
<ide> `POST /exec/(id)/resize`
<ide>
<ide> This API is valid only if `tty` was specified as part of creating and starting t
<ide> - **201** – no error
<ide> - **404** – no such exec instance
<ide>
<del>### Exec Inspect
<add>#### Exec Inspect
<ide>
<ide> `GET /exec/(id)/json`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **404** – no such exec instance
<ide> - **500** - server error
<ide>
<del>## 3.4 Volumes
<add>### 3.4 Volumes
<ide>
<del>### List volumes
<add>#### List volumes
<ide>
<ide> `GET /volumes`
<ide>
<ide> Return low-level information about the `exec` command `id`.
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Create a volume
<add>#### Create a volume
<ide>
<ide> `POST /volumes/create`
<ide>
<ide> Create a volume
<ide> Refer to the [inspect a volume](#inspect-a-volume) section or details about the
<ide> JSON fields returned in the response.
<ide>
<del>### Inspect a volume
<add>#### Inspect a volume
<ide>
<ide> `GET /volumes/(name)`
<ide>
<ide> response.
<ide> - **Scope** - Scope describes the level at which the volume exists, can be one of
<ide> `global` for cluster-wide or `local` for machine level. The default is `local`.
<ide>
<del>### Remove a volume
<add>#### Remove a volume
<ide>
<ide> `DELETE /volumes/(name)`
<ide>
<ide> Instruct the driver to remove the volume (`name`).
<ide> - **409** - volume is in use and cannot be removed
<ide> - **500** - server error
<ide>
<del>## 3.5 Networks
<add>### 3.5 Networks
<ide>
<del>### List networks
<add>#### List networks
<ide>
<ide> `GET /networks`
<ide>
<ide> Content-Type: application/json
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Inspect network
<add>#### Inspect network
<ide>
<ide> `GET /networks/<network-id>`
<ide>
<ide> Content-Type: application/json
<ide> - **200** - no error
<ide> - **404** - network not found
<ide>
<del>### Create a network
<add>#### Create a network
<ide>
<ide> `POST /networks/create`
<ide>
<ide> Content-Type: application/json
<ide> - **Options** - Network specific options to be used by the drivers
<ide> - **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
<ide>
<del>### Connect a container to a network
<add>#### Connect a container to a network
<ide>
<ide> `POST /networks/(id)/connect`
<ide>
<ide> Content-Type: application/json
<ide>
<ide> - **container** - container-id/name to be connected to the network
<ide>
<del>### Disconnect a container from a network
<add>#### Disconnect a container from a network
<ide>
<ide> `POST /networks/(id)/disconnect`
<ide>
<ide> Content-Type: application/json
<ide> - **Container** - container-id/name to be disconnected from a network
<ide> - **Force** - Force the container to disconnect from a network
<ide>
<del>### Remove a network
<add>#### Remove a network
<ide>
<ide> `DELETE /networks/(id)`
<ide>
<ide> Instruct the driver to remove the network (`id`).
<ide> - **404** - no such network
<ide> - **500** - server error
<ide>
<del>## 3.6 Plugins (experimental)
<add>### 3.6 Plugins (experimental)
<ide>
<del>### List plugins
<add>#### List plugins
<ide>
<ide> `GET /plugins`
<ide>
<ide> Content-Type: application/json
<ide> - **200** - no error
<ide> - **500** - server error
<ide>
<del>### Install a plugin
<add>#### Install a plugin
<ide>
<ide> `POST /plugins/pull?name=<plugin name>`
<ide>
<ide> Content-Length: 175
<ide> name must have at least one component
<ide> - **500** - plugin already exists
<ide>
<del>### Inspect a plugin
<add>#### Inspect a plugin
<ide>
<ide> `GET /plugins/(plugin name)`
<ide>
<ide> Content-Type: application/json
<ide> - **200** - no error
<ide> - **404** - plugin not installed
<ide>
<del>### Enable a plugin
<add>#### Enable a plugin
<ide>
<ide> `POST /plugins/(plugin name)/enable`
<ide>
<ide> Content-Type: text/plain; charset=utf-8
<ide> - **200** - no error
<ide> - **500** - plugin is already enabled
<ide>
<del>### Disable a plugin
<add>#### Disable a plugin
<ide>
<ide> `POST /plugins/(plugin name)/disable`
<ide>
<ide> Content-Type: text/plain; charset=utf-8
<ide> - **200** - no error
<ide> - **500** - plugin is already disabled
<ide>
<del>### Remove a plugin
<add>#### Remove a plugin
<ide>
<ide> `DELETE /plugins/(plugin name)`
<ide>
<ide> Content-Type: text/plain; charset=utf-8
<ide>
<ide> <!-- TODO Document "docker plugin push" endpoint once we have "plugin build"
<ide>
<del>### Push a plugin
<add>#### Push a plugin
<ide>
<ide> `POST /v1.24/plugins/tiborvass/(plugin name)/push HTTP/1.1`
<ide>
<ide> an image](#create-an-image) section for more details.
<ide>
<ide> -->
<ide>
<del>## 3.7 Nodes
<add>### 3.7 Nodes
<ide>
<ide> **Note**: Node operations require the engine to be part of a swarm.
<ide>
<del>### List nodes
<add>#### List nodes
<ide>
<ide>
<ide> `GET /nodes`
<ide> List nodes
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Inspect a node
<add>#### Inspect a node
<ide>
<ide>
<ide> `GET /nodes/(id or name)`
<ide> Return low-level information on the node `id`
<ide> - **404** – no such node
<ide> - **500** – server error
<ide>
<del>### Remove a node
<add>#### Remove a node
<ide>
<ide>
<ide> `DELETE /nodes/(id or name)`
<ide> Remove a node from the swarm.
<ide> - **404** – no such node
<ide> - **500** – server error
<ide>
<del>### Update a node
<add>#### Update a node
<ide>
<ide>
<ide> `POST /nodes/(id)/update`
<ide> JSON Parameters:
<ide> - **404** – no such node
<ide> - **500** – server error
<ide>
<del>## 3.8 Swarm
<add>### 3.8 Swarm
<ide>
<del>### Inspect swarm
<add>#### Inspect swarm
<ide>
<ide>
<ide> `GET /swarm`
<ide> Inspect swarm
<ide>
<ide> - **200** - no error
<ide>
<del>### Initialize a new swarm
<add>#### Initialize a new swarm
<ide>
<ide>
<ide> `POST /swarm/init`
<ide> JSON Parameters:
<ide> - **Options** - An object with key/value pairs that are interpreted
<ide> as protocol-specific options for the external CA driver.
<ide>
<del>### Join an existing swarm
<add>#### Join an existing swarm
<ide>
<ide> `POST /swarm/join`
<ide>
<ide> JSON Parameters:
<ide> - **RemoteAddr** – Address of any manager node already participating in the swarm.
<ide> - **JoinToken** – Secret token for joining this swarm.
<ide>
<del>### Leave a swarm
<add>#### Leave a swarm
<ide>
<ide>
<ide> `POST /swarm/leave`
<ide> Leave a swarm
<ide> - **200** – no error
<ide> - **406** – node is not part of a swarm
<ide>
<del>### Update a swarm
<add>#### Update a swarm
<ide>
<ide>
<ide> `POST /swarm/update`
<ide> JSON Parameters:
<ide> - **Worker** - Token to use for joining as a worker.
<ide> - **Manager** - Token to use for joining as a manager.
<ide>
<del>## 3.9 Services
<add>### 3.9 Services
<ide>
<ide> **Note**: Service operations require to first be part of a swarm.
<ide>
<del>### List services
<add>#### List services
<ide>
<ide>
<ide> `GET /services`
<ide> List services
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Create a service
<add>#### Create a service
<ide>
<ide> `POST /services/create`
<ide>
<ide> image](#create-an-image) section for more details.
<ide> section for more details.
<ide>
<ide>
<del>### Remove a service
<add>#### Remove a service
<ide>
<ide>
<ide> `DELETE /services/(id or name)`
<ide> Stop and remove the service `id`
<ide> - **404** – no such service
<ide> - **500** – server error
<ide>
<del>### Inspect one or more services
<add>#### Inspect one or more services
<ide>
<ide>
<ide> `GET /services/(id or name)`
<ide> Return information on the service `id`.
<ide> - **404** – no such service
<ide> - **500** – server error
<ide>
<del>### Update a service
<add>#### Update a service
<ide>
<ide> `POST /services/(id or name)/update`
<ide>
<ide> image](#create-an-image) section for more details.
<ide> - **404** – no such service
<ide> - **500** – server error
<ide>
<del>## 3.10 Tasks
<add>### 3.10 Tasks
<ide>
<ide> **Note**: Task operations require the engine to be part of a swarm.
<ide>
<del>### List tasks
<add>#### List tasks
<ide>
<ide>
<ide> `GET /tasks`
<ide> List tasks
<ide> - **200** – no error
<ide> - **500** – server error
<ide>
<del>### Inspect a task
<add>#### Inspect a task
<ide>
<ide>
<ide> `GET /tasks/(task id)`
<ide> Get details on a task
<ide> - **404** – unknown task
<ide> - **500** – server error
<ide>
<del># 4. Going further
<add>## 4. Going further
<ide>
<del>## 4.1 Inside `docker run`
<add>### 4.1 Inside `docker run`
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> As an example, the `docker run` command line makes the following API calls:
<ide>
<ide> - If in detached mode or only `stdin` is attached, display the container's id.
<ide>
<del>## 4.2 Hijacking
<add>### 4.2 Hijacking
<ide>
<ide> In this version of the API, `/attach`, uses hijacking to transport `stdin`,
<ide> `stdout`, and `stderr` on the same socket.
<ide> When Docker daemon detects the `Upgrade` header, it switches its status code
<ide> from **200 OK** to **101 UPGRADED** and resends the same headers.
<ide>
<ide>
<del>## 4.3 CORS Requests
<add>### 4.3 CORS Requests
<ide>
<ide> To set cross origin requests to the Engine API please give values to
<ide> `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all, | 7 |
Ruby | Ruby | add metadata support to message verifier | 3bf3653a69a18d19083f46cf09b11e79b017af7c | <ide><path>activesupport/lib/active_support/message_verifier.rb
<ide> require "base64"
<ide> require_relative "core_ext/object/blank"
<ide> require_relative "security_utils"
<add>require_relative "messages/metadata"
<ide>
<ide> module ActiveSupport
<ide> # +MessageVerifier+ makes it easy to generate and verify messages which are
<ide> def valid_message?(signed_message)
<ide> #
<ide> # incompatible_message = "test--dad7b06c94abba8d46a15fafaef56c327665d5ff"
<ide> # verifier.verified(incompatible_message) # => TypeError: incompatible marshal file format
<del> def verified(signed_message)
<add> def verified(signed_message, purpose: nil)
<ide> if valid_message?(signed_message)
<ide> begin
<ide> data = signed_message.split("--".freeze)[0]
<del> @serializer.load(decode(data))
<add> Messages::Metadata.verify(@serializer.load(decode(data)), purpose)
<ide> rescue ArgumentError => argument_error
<ide> return if argument_error.message.include?("invalid base64")
<ide> raise
<ide> def verified(signed_message)
<ide> #
<ide> # other_verifier = ActiveSupport::MessageVerifier.new 'd1ff3r3nt-s3Krit'
<ide> # other_verifier.verify(signed_message) # => ActiveSupport::MessageVerifier::InvalidSignature
<del> def verify(signed_message)
<del> verified(signed_message) || raise(InvalidSignature)
<add> def verify(signed_message, purpose: nil)
<add> verified(signed_message, purpose: purpose) || raise(InvalidSignature)
<ide> end
<ide>
<ide> # Generates a signed message for the provided value.
<ide> def verify(signed_message)
<ide> #
<ide> # verifier = ActiveSupport::MessageVerifier.new 's3Krit'
<ide> # verifier.generate 'a private message' # => "BAhJIhRwcml2YXRlLW1lc3NhZ2UGOgZFVA==--e2d724331ebdee96a10fb99b089508d1c72bd772"
<del> def generate(value)
<del> data = encode(@serializer.dump(value))
<add> def generate(value, expires_at: nil, expires_in: nil, purpose: nil)
<add> data = encode(@serializer.dump(Messages::Metadata.wrap(value, expires_at: expires_at, expires_in: expires_in, purpose: purpose)))
<ide> "#{data}--#{generate_digest(data)}"
<ide> end
<ide>
<ide><path>activesupport/test/message_verifier_test.rb
<ide> require "openssl"
<ide> require "active_support/time"
<ide> require "active_support/json"
<add>require_relative "metadata/shared_metadata_tests"
<ide>
<ide> class MessageVerifierTest < ActiveSupport::TestCase
<ide> class JSONSerializer
<ide> def test_raise_error_when_secret_is_nil
<ide> end
<ide> assert_equal "Secret should not be nil.", exception.message
<ide> end
<add>
<add> def test_backward_compatibility_messages_signed_without_metadata
<add> signed_message = "BAh7BzoJc29tZUkiCWRhdGEGOgZFVDoIbm93SXU6CVRpbWUNIIAbgAAAAAAHOgtvZmZzZXRpADoJem9uZUkiCFVUQwY7BkY=--d03c52c91dfe4ccc5159417c660461bcce005e96"
<add> assert_equal @data, @verifier.verify(signed_message)
<add> end
<add>end
<add>
<add>class MessageVerifierMetadataTest < ActiveSupport::TestCase
<add> include SharedMessageMetadataTests
<add>
<add> setup do
<add> @verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", verifier_options)
<add> end
<add>
<add> private
<add> def generate(message, **options)
<add> @verifier.generate(message, options)
<add> end
<add>
<add> def parse(message, **options)
<add> @verifier.verified(message, options)
<add> end
<add>
<add> def verifier_options
<add> Hash.new
<add> end
<add>end
<add>
<add>class MessageVerifierMetadataMarshalTest < MessageVerifierMetadataTest
<add> private
<add> def verifier_options
<add> { serializer: Marshal }
<add> end
<add>end
<add>
<add>class MessageVerifierMetadataJSONTest < MessageVerifierMetadataTest
<add> private
<add> def verifier_options
<add> { serializer: MessageVerifierTest::JSONSerializer.new }
<add> end
<ide> end | 2 |
Javascript | Javascript | add threshold option to line2 raycast | 84deae15c8944717fe5d874f1246c4d2959303c8 | <ide><path>examples/jsm/lines/LineSegments2.js
<ide> LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
<ide>
<ide> }
<ide>
<add> var threshold = 0;
<add> if ( 'Line2' in raycaster.params ) {
<add>
<add> threshold = raycaster.params.Lines2.threshold || 0.0
<add>
<add> }
<add>
<ide> var ray = raycaster.ray;
<ide> var camera = raycaster.camera;
<ide> var projectionMatrix = camera.projectionMatrix;
<ide>
<ide> var geometry = this.geometry;
<ide> var material = this.material;
<ide> var resolution = material.resolution;
<del> var lineWidth = material.linewidth;
<add> var lineWidth = material.linewidth + threshold;
<ide>
<ide> var instanceStart = geometry.attributes.instanceStart;
<ide> var instanceEnd = geometry.attributes.instanceEnd; | 1 |
Java | Java | fix memory leak in abstractjackson2encoder | 857b6006758e2509d6108a104735382ed0e9010d | <ide><path>spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java
<ide> import org.springframework.core.codec.Hints;
<ide> import org.springframework.core.io.buffer.DataBuffer;
<ide> import org.springframework.core.io.buffer.DataBufferFactory;
<add>import org.springframework.core.io.buffer.DataBufferUtils;
<ide> import org.springframework.core.log.LogFormatUtils;
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.codec.HttpMessageEncoder;
<ide> private DataBuffer encodeValue(Object value, @Nullable MimeType mimeType, DataBu
<ide> writer = customizeWriter(writer, mimeType, elementType, hints);
<ide>
<ide> DataBuffer buffer = bufferFactory.allocateBuffer();
<add> boolean release = true;
<ide> OutputStream outputStream = buffer.asOutputStream();
<ide>
<ide> try {
<del> JsonGenerator generator = getObjectMapper().getFactory().createGenerator(outputStream, encoding);
<add> JsonGenerator generator =
<add> getObjectMapper().getFactory().createGenerator(outputStream, encoding);
<ide> writer.writeValue(generator, value);
<add> release = false;
<ide> }
<ide> catch (InvalidDefinitionException ex) {
<ide> throw new CodecException("Type definition error: " + ex.getType(), ex);
<ide> private DataBuffer encodeValue(Object value, @Nullable MimeType mimeType, DataBu
<ide> throw new EncodingException("JSON encoding error: " + ex.getOriginalMessage(), ex);
<ide> }
<ide> catch (IOException ex) {
<del> throw new IllegalStateException("Unexpected I/O error while writing to data buffer", ex);
<add> throw new IllegalStateException("Unexpected I/O error while writing to data buffer",
<add> ex);
<add> }
<add> finally {
<add> if (release) {
<add> DataBufferUtils.release(buffer);
<add> }
<ide> }
<ide>
<ide> return buffer; | 1 |
Javascript | Javascript | pass a configfilepath along with the user settings | 34a93a9e66ca45557f4f981a9e71422b9ef63fb5 | <ide><path>src/application-delegate.js
<ide> class ApplicationDelegate {
<ide> return remote.systemPreferences.getUserDefault(key, type)
<ide> }
<ide>
<del> async setUserSettings (config) {
<add> async setUserSettings (config, configFilePath) {
<ide> this.pendingSettingsUpdateCount++
<ide> try {
<del> await ipcHelpers.call('set-user-settings', JSON.stringify(config))
<add> await ipcHelpers.call('set-user-settings', JSON.stringify(config), configFilePath)
<ide> } finally {
<ide> this.pendingSettingsUpdateCount--
<ide> } | 1 |
PHP | PHP | correct deprecation version | f36cfc351e3f8bffb4877206773da9360a59682c | <ide><path>src/View/Helper/SessionHelper.php
<ide> * Session reading from the view.
<ide> *
<ide> * @link http://book.cakephp.org/3.0/en/views/helpers/session.html
<del> * @deprecated 3.1.0 Use request->session() instead.
<add> * @deprecated 3.0.2 Use request->session() instead.
<ide> */
<ide> class SessionHelper extends Helper
<ide> { | 1 |
Javascript | Javascript | improve readability of isvalidelementtype | 77e872217c7f4044ae4f96dd99bf999efb601040 | <ide><path>packages/shared/isValidElementType.js
<ide> import {
<ide> } from 'shared/ReactSymbols';
<ide>
<ide> export default function isValidElementType(type: mixed) {
<del> return (
<del> typeof type === 'string' ||
<del> typeof type === 'function' ||
<del> // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
<add> if (typeof type === 'string' || typeof type === 'function') {
<add> return true;
<add> }
<add>
<add> // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
<add> if (
<ide> type === REACT_FRAGMENT_TYPE ||
<ide> type === REACT_PROFILER_TYPE ||
<ide> type === REACT_DEBUG_TRACING_MODE_TYPE ||
<ide> type === REACT_STRICT_MODE_TYPE ||
<ide> type === REACT_SUSPENSE_TYPE ||
<ide> type === REACT_SUSPENSE_LIST_TYPE ||
<del> type === REACT_LEGACY_HIDDEN_TYPE ||
<del> (typeof type === 'object' &&
<del> type !== null &&
<del> (type.$$typeof === REACT_LAZY_TYPE ||
<del> type.$$typeof === REACT_MEMO_TYPE ||
<del> type.$$typeof === REACT_PROVIDER_TYPE ||
<del> type.$$typeof === REACT_CONTEXT_TYPE ||
<del> type.$$typeof === REACT_FORWARD_REF_TYPE ||
<del> type.$$typeof === REACT_FUNDAMENTAL_TYPE ||
<del> type.$$typeof === REACT_RESPONDER_TYPE ||
<del> type.$$typeof === REACT_SCOPE_TYPE ||
<del> type.$$typeof === REACT_BLOCK_TYPE ||
<del> type[(0: any)] === REACT_SERVER_BLOCK_TYPE))
<del> );
<add> type === REACT_LEGACY_HIDDEN_TYPE
<add> ) {
<add> return true;
<add> }
<add>
<add> if (typeof type === 'object' && type !== null) {
<add> if (
<add> type.$$typeof === REACT_LAZY_TYPE ||
<add> type.$$typeof === REACT_MEMO_TYPE ||
<add> type.$$typeof === REACT_PROVIDER_TYPE ||
<add> type.$$typeof === REACT_CONTEXT_TYPE ||
<add> type.$$typeof === REACT_FORWARD_REF_TYPE ||
<add> type.$$typeof === REACT_FUNDAMENTAL_TYPE ||
<add> type.$$typeof === REACT_RESPONDER_TYPE ||
<add> type.$$typeof === REACT_SCOPE_TYPE ||
<add> type.$$typeof === REACT_BLOCK_TYPE ||
<add> type[(0: any)] === REACT_SERVER_BLOCK_TYPE
<add> ) {
<add> return true;
<add> }
<add> }
<add>
<add> return false;
<ide> } | 1 |
Text | Text | fix indentation in changelog.md [ci skip] | d5007f183a977ef440d34645e12885f239f091c1 | <ide><path>activerecord/CHANGELOG.md
<ide>
<ide> Example:
<ide>
<del> config.generators do |g|
<del> g.orm :active_record, primary_key_type: :uuid
<del> end
<add> config.generators do |g|
<add> g.orm :active_record, primary_key_type: :uuid
<add> end
<ide>
<ide> *Jon McCartie*
<ide>
<ide>
<ide> To load the fixtures file `accounts.yml` as the `User` model, use:
<ide>
<del> _fixture:
<del> model_class: User
<del> david:
<del> name: David
<add> _fixture:
<add> model_class: User
<add> david:
<add> name: David
<ide>
<ide> Fixes #9516.
<ide> | 1 |
Ruby | Ruby | use two spaces instead of 4 | 81e4f810c1be24eefbf0657410990bd8e167a024 | <ide><path>Library/Homebrew/caveats.rb
<ide> def plist_caveats
<ide> if !plist_path.file? || !plist_path.symlink?
<ide> if f.plist_startup
<ide> s << "To have launchd start #{f.full_name} at startup:"
<del> s << " sudo mkdir -p #{destination}" unless destination_path.directory?
<del> s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}"
<del> s << " sudo chown root #{plist_link}"
<add> s << " sudo mkdir -p #{destination}" unless destination_path.directory?
<add> s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}"
<add> s << " sudo chown root #{plist_link}"
<ide> else
<ide> s << "To have launchd start #{f.full_name} at login:"
<del> s << " mkdir -p #{destination}" unless destination_path.directory?
<del> s << " ln -sfv #{f.opt_prefix}/*.plist #{destination}"
<add> s << " mkdir -p #{destination}" unless destination_path.directory?
<add> s << " ln -sfv #{f.opt_prefix}/*.plist #{destination}"
<ide> end
<ide> s << "Then to load #{f.full_name} now:"
<ide> if f.plist_startup
<del> s << " sudo launchctl load #{plist_link}"
<add> s << " sudo launchctl load #{plist_link}"
<ide> else
<del> s << " launchctl load #{plist_link}"
<add> s << " launchctl load #{plist_link}"
<ide> end
<ide> # For startup plists, we cannot tell whether it's running on launchd,
<ide> # as it requires for `sudo launchctl list` to get real result.
<ide> elsif f.plist_startup
<del> s << "To reload #{f.full_name} after an upgrade:"
<del> s << " sudo launchctl unload #{plist_link}"
<del> s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}"
<del> s << " sudo chown root #{plist_link}"
<del> s << " sudo launchctl load #{plist_link}"
<add> s << "To reload #{f.full_name} after an upgrade:"
<add> s << " sudo launchctl unload #{plist_link}"
<add> s << " sudo cp -fv #{f.opt_prefix}/*.plist #{destination}"
<add> s << " sudo chown root #{plist_link}"
<add> s << " sudo launchctl load #{plist_link}"
<ide> elsif Kernel.system "/bin/launchctl list #{plist_domain} &>/dev/null"
<del> s << "To reload #{f.full_name} after an upgrade:"
<del> s << " launchctl unload #{plist_link}"
<del> s << " launchctl load #{plist_link}"
<add> s << "To reload #{f.full_name} after an upgrade:"
<add> s << " launchctl unload #{plist_link}"
<add> s << " launchctl load #{plist_link}"
<ide> else
<del> s << "To load #{f.full_name}:"
<del> s << " launchctl load #{plist_link}"
<add> s << "To load #{f.full_name}:"
<add> s << " launchctl load #{plist_link}"
<ide> end
<ide>
<ide> if f.plist_manual
<ide> s << "Or, if you don't want/need launchctl, you can just run:"
<del> s << " #{f.plist_manual}"
<add> s << " #{f.plist_manual}"
<ide> end
<ide>
<del> s << "" << "WARNING: launchctl will fail when run under tmux." if ENV['TMUX']
<add> s << "" << "WARNING: launchctl will fail when run under tmux." if ENV["TMUX"]
<ide> end
<ide> s.join("\n") unless s.empty?
<ide> end | 1 |
Javascript | Javascript | add missing trailing semicolon | d5691a2e6d8725d64d8569f9b1682012ced83eda | <ide><path>resources/js/bootstrap.js
<ide> if (token) {
<ide> * allows your team to easily build robust real-time web applications.
<ide> */
<ide>
<del>// import Echo from 'laravel-echo'
<add>// import Echo from 'laravel-echo';
<ide>
<ide> // window.Pusher = require('pusher-js');
<ide> | 1 |
Text | Text | add test case to regex challenge | 1badd3c3a65c4dc3df970b774211b05c831a25ae | <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames.md
<ide> tests:
<ide> testString: assert(userCheck.test("Z97"));
<ide> - text: Your regex should not match <code>c57bT3</code>
<ide> testString: assert(!userCheck.test("c57bT3"));
<add> - text: Your regex should match <code>AB1</code>
<add> testString: assert(userCheck.test("AB1"));
<ide>
<ide> ```
<ide> | 1 |
Ruby | Ruby | check access on homebrew_prefix/opt | d298e54e50fdea57456385a6e6eaad6f3fc193b8 | <ide><path>Library/Homebrew/cmd/doctor.rb
<ide> def check_access_cellar
<ide> end
<ide> end
<ide>
<add>def check_access_prefix_opt
<add> opt = HOMEBREW_PREFIX.join("opt")
<add> if opt.exist? && !opt.writable_real?
<add> <<-EOS.undent
<add> #{opt} isn't writable.
<add> You should `chown` #{opt}
<add> EOS
<add> end
<add>end
<add>
<ide> def check_ruby_version
<ide> ruby_version = MacOS.version >= "10.9" ? "2.0" : "1.8"
<ide> if RUBY_VERSION[/\d\.\d/] != ruby_version then <<-EOS.undent | 1 |
Java | Java | fix javadoc mistakes and some style | 1327982197a13db62be28c1ad871e8f8a72e873d | <ide><path>src/main/java/io/reactivex/Completable.java
<ide> public static Completable concat(Iterable<? extends CompletableSource> sources)
<ide> /**
<ide> * Returns a Completable which completes only when all sources complete, one after another.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Completable} honors the backpressure of the downstream consumer
<ide> * and expects the other {@code Publisher} to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static Completable concat(Publisher<? extends CompletableSource> sources)
<ide> /**
<ide> * Returns a Completable which completes only when all sources complete, one after another.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Completable} honors the backpressure of the downstream consumer
<ide> * and expects the other {@code Publisher} to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T> Completable fromObservable(final ObservableSource<T> observabl
<ide> * Returns a Completable instance that subscribes to the given publisher, ignores all values and
<ide> * emits only the terminal event.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Completable} honors the backpressure of the downstream consumer
<ide> * and expects the other {@code Publisher} to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static Completable merge(Iterable<? extends CompletableSource> sources) {
<ide> * Returns a Completable instance that subscribes to all sources at once and
<ide> * completes only when all source Completables complete or one of them emits an error.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Completable} honors the backpressure of the downstream consumer
<ide> * and expects the other {@code Publisher} to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static Completable merge(Publisher<? extends CompletableSource> sources)
<ide> * Returns a Completable instance that keeps subscriptions to a limited number of sources at once and
<ide> * completes only when all source Completables complete or one of them emits an error.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Completable} honors the backpressure of the downstream consumer
<ide> * and expects the other {@code Publisher} to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static Completable merge(Publisher<? extends CompletableSource> sources,
<ide> * completes only when all source Completables terminate in one way or another, combining any exceptions
<ide> * thrown by either the sources Observable or the inner Completable instances.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer
<ide> * and expects the other {@code Publisher} to honor it as well.
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static Completable mergeDelayError(Iterable<? extends CompletableSource>
<ide> * any error emitted by either the sources observable or any of the inner Completables until all of
<ide> * them terminate in a way or another.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Completable} honors the backpressure of the downstream consumer
<ide> * and expects the other {@code Publisher} to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static Completable mergeDelayError(Publisher<? extends CompletableSource>
<ide> * observable or any of the inner Completables until all of
<ide> * them terminate in a way or another.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Completable} honors the backpressure of the downstream consumer
<ide> * and expects the other {@code Publisher} to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final <T> Observable<T> andThen(ObservableSource<T> next) {
<ide> * propagated to the downstream subscriber and will result in skipping the subscription of the
<ide> * Publisher.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer
<ide> * and expects the other {@code Publisher} to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final <T> Observable<T> startWith(Observable<T> other) {
<ide> * Returns a Flowable which first delivers the events
<ide> * of the other Publisher then runs this Completable.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer
<ide> * and expects the other {@code Publisher} to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final <U> U to(Function<? super Completable, U> converter) {
<ide> * Returns a Flowable which when subscribed to subscribes to this Completable and
<ide> * relays the terminal events to the subscriber.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code toFlowable} does not operate by default on a particular {@link Scheduler}.</dd>
<ide><path>src/main/java/io/reactivex/Flowable.java
<ide> public static <T> Flowable<T> concat(
<ide> /**
<ide> * Concatenates a variable number of Publisher sources.
<ide> * <p>
<del> * Note: named this way because of overload conflict with concat(Publisher<Publisher>).
<add> * Note: named this way because of overload conflict with concat(Publisher<Publisher>).
<ide> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concat.png" alt="">
<ide> * <dl>
<ide> public static <T, D> Flowable<T> using(Callable<? extends D> resourceSupplier,
<ide> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T, R> Flowable<R> zip(Iterable<? extends Publisher<? extends T>>
<ide> * <p>
<ide> * <img width="640" height="370" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.o.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T, R> Flowable<R> zip(Publisher<? extends Publisher<? extends T>>
<ide> * use {@link #doOnCancel(Action)} as well or use {@code using()} to do cleanup in case of completion
<ide> * or cancellation.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T1, T2, R> Flowable<R> zip(
<ide> * use {@link #doOnCancel(Action)} as well or use {@code using()} to do cleanup in case of completion
<ide> * or cancellation.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T1, T2, R> Flowable<R> zip(
<ide> * use {@link #doOnCancel(Action)} as well or use {@code using()} to do cleanup in case of completion
<ide> * or cancellation.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T1, T2, R> Flowable<R> zip(
<ide> * use {@link #doOnCancel(Action)} as well or use {@code using()} to do cleanup in case of completion
<ide> * or cancellation.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T1, T2, T3, R> Flowable<R> zip(
<ide> * use {@link #doOnCancel(Action)} as well or use {@code using()} to do cleanup in case of completion
<ide> * or cancellation.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T1, T2, T3, T4, R> Flowable<R> zip(
<ide> * use {@link #doOnCancel(Action)} as well or use {@code using()} to do cleanup in case of completion
<ide> * or cancellation.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T1, T2, T3, T4, T5, R> Flowable<R> zip(
<ide> * use {@link #doOnCancel(Action)} as well or use {@code using()} to do cleanup in case of completion
<ide> * or cancellation.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T1, T2, T3, T4, T5, T6, R> Flowable<R> zip(
<ide> * use {@link #doOnCancel(Action)} as well or use {@code using()} to do cleanup in case of completion
<ide> * or cancellation.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T1, T2, T3, T4, T5, T6, T7, R> Flowable<R> zip(
<ide> * use {@link #doOnCancel(Action)} as well or use {@code using()} to do cleanup in case of completion
<ide> * or cancellation.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Flowable<R> zip(
<ide> * use {@link #doOnCancel(Action)} as well or use {@code using()} to do cleanup in case of completion
<ide> * or cancellation.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Flowable<R> zip(
<ide> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public static <T, R> Flowable<R> zipArray(Function<? super Object[], ? extends R
<ide> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public final Flowable<T> distinctUntilChanged(BiPredicate<? super T, ? super T>
<ide> * behavior.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code doFinally} does not operate by default on a particular {@link Scheduler}.</dd>
<del> * <td><b>Operator-fusion:</b></dt>
<add> * <dt><b>Operator-fusion:</b></dt>
<ide> * <dd>This operator supports normal and conditional Subscribers as well as boundary-limited
<ide> * synchronous or asynchronous queue-fusion.</dd>
<ide> * </dl>
<ide> public final Flowable<T> doFinally(Action onFinally) {
<ide> * behavior.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code doAfterNext} does not operate by default on a particular {@link Scheduler}.</dd>
<del> * <td><b>Operator-fusion:</b></dt>
<add> * <dt><b>Operator-fusion:</b></dt>
<ide> * <dd>This operator supports normal and conditional Subscribers as well as boundary-limited
<ide> * synchronous or asynchronous queue-fusion.</dd>
<ide> * </dl>
<ide> public final <R> Flowable<R> flatMapSingle(Function<? super T, ? extends SingleS
<ide> * <p>
<ide> * Alias to {@link #subscribe(Consumer)}
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the source {@code Publisher} in an unbounded manner (i.e., no
<ide> * backpressure is applied to it).</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Disposable forEach(Consumer<? super T> onNext) {
<ide> * {@link io.reactivex.exceptions.OnErrorNotImplementedException OnErrorNotImplementedException}
<ide> * and routed to the RxJavaPlugins.onError handler.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the source {@code Publisher} in an unbounded manner (i.e., no
<ide> * backpressure is applied to it).</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Disposable forEachWhile(Predicate<? super T> onNext) {
<ide> * Subscribes to the {@link Publisher} and receives notifications for each element and error events until the
<ide> * onNext Predicate returns false.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the source {@code Publisher} in an unbounded manner (i.e., no
<ide> * backpressure is applied to it).</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Disposable forEachWhile(Predicate<? super T> onNext, Consumer<? sup
<ide> * Subscribes to the {@link Publisher} and receives notifications for each element and the terminal events until the
<ide> * onNext Predicate returns false.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the source {@code Publisher} in an unbounded manner (i.e., no
<ide> * backpressure is applied to it).</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final ParallelFlowable<T> parallel(int parallelism, int prefetch) {
<ide> * <p>
<ide> * <img width="640" height="510" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/publishConnect.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code ConnectableFlowable} honors backpressure for each of its {@code Subscriber}s
<ide> * and expects the source {@code Publisher} to honor backpressure as well. If this expectation is violated,
<ide> * the operator will signal a {@code MissingBackpressureException} to its {@code Subscriber}s and disconnect.</dd>
<ide> public final <R> Flowable<R> publish(Function<? super Flowable<T>, ? extends Pub
<ide> * <p>
<ide> * <img width="640" height="510" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/publishConnect.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code ConnectableFlowable} honors backpressure for each of its {@code Subscriber}s
<ide> * and expects the source {@code Publisher} to honor backpressure as well. If this expectation is violated,
<ide> * the operator will signal a {@code MissingBackpressureException} to its {@code Subscriber}s and disconnect.</dd>
<ide> public final Maybe<T> reduce(BiFunction<T, T, T> reducer) {
<ide> * and may cause problems if it is mutable. To make sure each subscriber gets its own value, defer
<ide> * the application of this operator via {@link #defer(Callable)}:
<ide> * <pre><code>
<del> * Publisher<T> source = ...
<del> * Single.defer(() -> source.reduce(new ArrayList<>(), (list, item) -> list.add(item)));
<add> * Publisher<T> source = ...
<add> * Single.defer(() -> source.reduce(new ArrayList<>(), (list, item) -> list.add(item)));
<ide> *
<ide> * // alternatively, by using compose to stay fluent
<ide> *
<del> * source.compose(o ->
<del> * Flowable.defer(() -> o.reduce(new ArrayList<>(), (list, item) -> list.add(item)).toFlowable())
<add> * source.compose(o ->
<add> * Flowable.defer(() -> o.reduce(new ArrayList<>(), (list, item) -> list.add(item)).toFlowable())
<ide> * ).firstOrError();
<ide> *
<ide> * // or, by using reduceWith instead of reduce
<ide> *
<del> * source.reduceWith(() -> new ArrayList<>(), (list, item) -> list.add(item)));
<add> * source.reduceWith(() -> new ArrayList<>(), (list, item) -> list.add(item)));
<ide> * </code></pre>
<ide> * <dl>
<ide> * <dt><b>Backpressure:</b></dt>
<ide> public final <R> Single<R> reduceWith(Callable<R> seedSupplier, BiFunction<R, ?
<ide> * <p>
<ide> * <img width="640" height="309" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/repeat.o.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> repeat() {
<ide> * <p>
<ide> * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/repeat.on.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> repeat(long times) {
<ide> * <p>
<ide> * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/repeat.on.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> repeatUntil(BooleanSupplier stop) {
<ide> * <p>
<ide> * <img width="640" height="430" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/repeatWhen.f.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final ConnectableFlowable<T> replay(final Scheduler scheduler) {
<ide> * {@code [1, 2]} then succeeds the second time and emits {@code [1, 2, 3, 4, 5]} then the complete sequence
<ide> * of emissions and notifications would be {@code [1, 2, 1, 2, 3, 4, 5, onComplete]}.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> retry() {
<ide> * <p>
<ide> * <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/retry.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> retry(BiPredicate<? super Integer, ? super Throwable> p
<ide> * {@code [1, 2]} then succeeds the second time and emits {@code [1, 2, 3, 4, 5]} then the complete sequence
<ide> * of emissions and notifications would be {@code [1, 2, 1, 2, 3, 4, 5, onComplete]}.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> retry(long count) {
<ide> * Retries at most times or until the predicate returns false, whichever happens first.
<ide> *
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> retry(long times, Predicate<? super Throwable> predicat
<ide> /**
<ide> * Retries the current Flowable if the predicate returns true.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> retry(Predicate<? super Throwable> predicate) {
<ide> /**
<ide> * Retries until the given stop function returns true.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> retryUntil(final BooleanSupplier stop) {
<ide> * This retries 3 times, each time incrementing the number of seconds it waits.
<ide> *
<ide> * <pre><code>
<del> * Publisher.create((Subscriber<? super String> s) -> {
<add> * Publisher.create((Subscriber<? super String> s) -> {
<ide> * System.out.println("subscribing");
<ide> * s.onError(new RuntimeException("always fails"));
<del> * }).retryWhen(attempts -> {
<del> * return attempts.zipWith(Publisher.range(1, 3), (n, i) -> i).flatMap(i -> {
<add> * }).retryWhen(attempts -> {
<add> * return attempts.zipWith(Flowable.range(1, 3), (n, i) -> i).flatMap(i -> {
<ide> * System.out.println("delay retry by " + i + " second(s)");
<ide> * return Publisher.timer(i, TimeUnit.SECONDS);
<ide> * });
<ide> public final Flowable<T> retryUntil(final BooleanSupplier stop) {
<ide> * subscribing
<ide> * } </pre>
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> retryWhen(
<ide> * deals with exceptions thrown by a misbehaving Subscriber (that doesn't follow the
<ide> * Reactive-Streams specification).
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>This operator leaves the reactive world and the backpressure behavior depends on the Subscriber's behavior.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code safeSubscribe} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final <U> Flowable<T> sample(Publisher<U> sampler, boolean emitLast) {
<ide> * <p>
<ide> * This sort of function is sometimes called an accumulator.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * Violating this expectation, a {@code MissingBackpressureException} <em>may</em> get signalled somewhere downstream.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> scan(BiFunction<T, T, T> accumulator) {
<ide> * and may cause problems if it is mutable. To make sure each subscriber gets its own value, defer
<ide> * the application of this operator via {@link #defer(Callable)}:
<ide> * <pre><code>
<del> * Publisher<T> source = ...
<del> * Publisher.defer(() -> source.scan(new ArrayList<>(), (list, item) -> list.add(item)));
<add> * Publisher<T> source = ...
<add> * Flowable.defer(() -> source.scan(new ArrayList<>(), (list, item) -> list.add(item)));
<ide> *
<ide> * // alternatively, by using compose to stay fluent
<ide> *
<del> * source.compose(o ->
<del> * Publisher.defer(() -> o.scan(new ArrayList<>(), (list, item) -> list.add(item)))
<add> * source.compose(o ->
<add> * Flowable.defer(() -> o.scan(new ArrayList<>(), (list, item) -> list.add(item)))
<ide> * );
<ide> * </code></pre>
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * Violating this expectation, a {@code MissingBackpressureException} <em>may</em> get signalled somewhere downstream.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final <R> Flowable<R> scan(final R initialValue, BiFunction<R, ? super T,
<ide> * <p>
<ide> * This sort of function is sometimes called an accumulator.
<ide> * <p>
<del> * Note that the Publisher that results from this method will emit {@code initialValue} as its first
<del> * emitted item.
<del> * <p>
<del> * Note that the {@code initialValue} is shared among all subscribers to the resulting Publisher
<del> * and may cause problems if it is mutable. To make sure each subscriber gets its own value, defer
<del> * the application of this operator via {@link #defer(Callable)}:
<del> * <pre><code>
<del> * Publisher<T> source = ...
<del> * Publisher.defer(() -> source.scan(new ArrayList<>(), (list, item) -> list.add(item)));
<del> *
<del> * // alternatively, by using compose to stay fluent
<del> *
<del> * source.compose(o ->
<del> * Publisher.defer(() -> o.scan(new ArrayList<>(), (list, item) -> list.add(item)))
<del> * );
<del> * </code></pre>
<del> * <p>
<del> * Unlike 1.x, this operator doesn't emit the seed value unless the upstream signals an event.
<add> * Note that the Publisher that results from this method will emit the value returned by
<add> * the {@code seedSupplier} as its first item.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * Violating this expectation, a {@code MissingBackpressureException} <em>may</em> get signalled somewhere downstream.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> startWithArray(T... items) {
<ide> * {@link io.reactivex.exceptions.OnErrorNotImplementedException OnErrorNotImplementedException}
<ide> * and routed to the RxJavaPlugins.onError handler.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the source {@code Publisher} in an unbounded manner (i.e., no
<ide> * backpressure is applied to it).</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Disposable subscribe() {
<ide> * {@link io.reactivex.exceptions.OnErrorNotImplementedException OnErrorNotImplementedException}
<ide> * and routed to the RxJavaPlugins.onError handler.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the source {@code Publisher} in an unbounded manner (i.e., no
<ide> * backpressure is applied to it).</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Disposable subscribe(Consumer<? super T> onNext) {
<ide> * Subscribes to a Publisher and provides callbacks to handle the items it emits and any error
<ide> * notification it issues.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the source {@code Publisher} in an unbounded manner (i.e., no
<ide> * backpressure is applied to it).</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super T
<ide> * Subscribes to a Publisher and provides callbacks to handle the items it emits and any error or
<ide> * completion notification it issues.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the source {@code Publisher} in an unbounded manner (i.e., no
<ide> * backpressure is applied to it).</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super T
<ide> * Subscribes to a Publisher and provides callbacks to handle the items it emits and any error or
<ide> * completion notification it issues.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator consumes the source {@code Publisher} in an unbounded manner (i.e., no
<ide> * backpressure is applied to it).</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final void subscribe(FlowableSubscriber<? super T> s) {
<ide> * Subscriber as is.
<ide> * <p>Usage example:
<ide> * <pre><code>
<del> * Flowable<Integer> source = Flowable.range(1, 10);
<add> * Flowable<Integer> source = Flowable.range(1, 10);
<ide> * CompositeDisposable composite = new CompositeDisposable();
<ide> *
<del> * ResourceSubscriber<Integer> rs = new ResourceSubscriber<>() {
<add> * ResourceSubscriber<Integer> rs = new ResourceSubscriber<>() {
<ide> * // ...
<ide> * };
<ide> *
<ide> public final Flowable<T> takeLast(long count, long time, TimeUnit unit, Schedule
<ide> * unbounded manner (i.e., no backpressure is applied to it) but note that this <em>may</em>
<ide> * lead to {@code OutOfMemoryError} due to internal buffer bloat.
<ide> * Consider using {@link #takeLast(long, long, TimeUnit)} in this case.</dd>
<del> * behavior.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>This version of {@code takeLast} operates by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<ide> public final Flowable<T> takeLast(long time, TimeUnit unit) {
<ide> * unbounded manner (i.e., no backpressure is applied to it) but note that this <em>may</em>
<ide> * lead to {@code OutOfMemoryError} due to internal buffer bloat.
<ide> * Consider using {@link #takeLast(long, long, TimeUnit)} in this case.</dd>
<del> * behavior.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>This version of {@code takeLast} operates by default on the {@code computation} {@link Scheduler}.</dd>
<ide> * </dl>
<ide> public final Flowable<Timed<T>> timestamp(final TimeUnit unit, final Scheduler s
<ide> * <p>
<ide> * This allows fluent conversion to any other type.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The backpressure behavior depends on what happens in the {@code converter} function.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code to} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final <R> Flowable<R> withLatestFrom(Iterable<? extends Publisher<?>> oth
<ide> * Note that the {@code other} Iterable is evaluated as items are observed from the source Publisher; it is
<ide> * not pre-consumed. This allows you to zip infinite streams on either side.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public final <U, R> Flowable<R> zipWith(Iterable<U> other, BiFunction<? super T
<ide> *
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public final <U, R> Flowable<R> zipWith(Publisher<? extends U> other, BiFunction
<ide> *
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public final <U, R> Flowable<R> zipWith(Publisher<? extends U> other,
<ide> *
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator expects backpressure from the sources and honors backpressure from the downstream.
<ide> * (I.e., zipping with {@link #interval(long, TimeUnit)} may result in MissingBackpressureException, use
<ide> * one of the {@code onBackpressureX} to handle similar, backpressure-ignoring sources.</dd>
<ide> public final <U, R> Flowable<R> zipWith(Publisher<? extends U> other,
<ide> * Creates a TestSubscriber that requests Long.MAX_VALUE and subscribes
<ide> * it to this Flowable.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned TestSubscriber consumes this Flowable in an unbounded fashion.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code test} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final TestSubscriber<T> test() { // NoPMD
<ide> * Creates a TestSubscriber with the given initial request amount and subscribes
<ide> * it to this Flowable.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned TestSubscriber requests the given {@code initialRequest} amount upfront.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code test} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final TestSubscriber<T> test(long initialRequest) { // NoPMD
<ide> * optionally cancels it before the subscription and subscribes
<ide> * it to this Flowable.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned TestSubscriber requests the given {@code initialRequest} amount upfront.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code test} does not operate by default on a particular {@link Scheduler}.</dd>
<ide><path>src/main/java/io/reactivex/Maybe.java
<ide> public static <T> Maybe<T> ambArray(final MaybeSource<? extends T>... sources) {
<ide> * Concatenate the single values, in a non-overlapping fashion, of the MaybeSource sources provided by
<ide> * an Iterable sequence.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Flowable<T> concat(Iterable<? extends MaybeSource<? extends T>
<ide> * <p>
<ide> * <img width="640" height="422" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Maybe.concat.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Flowable<T> concat(MaybeSource<? extends T> source1, MaybeSour
<ide> * <p>
<ide> * <img width="640" height="422" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Maybe.concat.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Flowable<T> concat(
<ide> * <p>
<ide> * <img width="640" height="422" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Maybe.concat.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Flowable<T> concat(
<ide> * Concatenate the single values, in a non-overlapping fashion, of the MaybeSource sources provided by
<ide> * a Publisher sequence.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer and
<ide> * expects the {@code Publisher} to honor backpressure as well. If the sources {@code Publisher}
<ide> * violates this, a {@link io.reactivex.exceptions.MissingBackpressureException} is signalled.</dd>
<ide> public static <T> Flowable<T> concat(Publisher<? extends MaybeSource<? extends T
<ide> * Concatenate the single values, in a non-overlapping fashion, of the MaybeSource sources provided by
<ide> * a Publisher sequence.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer and
<ide> * expects the {@code Publisher} to honor backpressure as well. If the sources {@code Publisher}
<ide> * violates this, a {@link io.reactivex.exceptions.MissingBackpressureException} is signalled.</dd>
<ide> public static <T> Flowable<T> concat(Publisher<? extends MaybeSource<? extends T
<ide> /**
<ide> * Concatenate the single values, in a non-overlapping fashion, of the MaybeSource sources in the array.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concatArray} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final <U, V> Maybe<T> delay(Publisher<U> delayIndicator) {
<ide> * until the other Publisher emits an element or completes normally.
<ide> * <p>
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The {@code Publisher} source is consumed in an unbounded fashion (without applying backpressure).</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>This method does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final Maybe<T> onTerminateDetach() {
<ide> * <p>
<ide> * <img width="640" height="309" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/repeat.o.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code repeat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final Flowable<T> repeat() {
<ide> * <p>
<ide> * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/repeat.on.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>This operator honors downstream backpressure.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code repeat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final Flowable<T> repeat(long times) {
<ide> * <p>
<ide> * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/repeat.on.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>This operator honors downstream backpressure.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code repeatUntil} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final Flowable<T> repeatUntil(BooleanSupplier stop) {
<ide> * <p>
<ide> * <img width="640" height="430" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/repeatWhen.f.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The operator honors downstream backpressure and expects the source {@code Publisher} to honor backpressure as well.
<ide> * If this expectation is violated, the operator <em>may</em> throw an {@code IllegalStateException}.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Maybe<T> retryUntil(final BooleanSupplier stop) {
<ide> * This retries 3 times, each time incrementing the number of seconds it waits.
<ide> *
<ide> * <pre><code>
<del> * Flowable.create((FlowableEmitter<? super String> s) -> {
<add> * Flowable.create((FlowableEmitter<? super String> s) -> {
<ide> * System.out.println("subscribing");
<ide> * s.onError(new RuntimeException("always fails"));
<del> * }, BackpressureStrategy.BUFFER).retryWhen(attempts -> {
<del> * return attempts.zipWith(Publisher.range(1, 3), (n, i) -> i).flatMap(i -> {
<add> * }, BackpressureStrategy.BUFFER).retryWhen(attempts -> {
<add> * return attempts.zipWith(Publisher.range(1, 3), (n, i) -> i).flatMap(i -> {
<ide> * System.out.println("delay retry by " + i + " second(s)");
<ide> * return Publisher.timer(i, TimeUnit.SECONDS);
<ide> * });
<ide> public final Maybe<T> subscribeOn(Scheduler scheduler) {
<ide> * MaybeObserver as is.
<ide> * <p>Usage example:
<ide> * <pre><code>
<del> * Maybe<Integer> source = Maybe.just(1);
<add> * Maybe<Integer> source = Maybe.just(1);
<ide> * CompositeDisposable composite = new CompositeDisposable();
<ide> *
<del> * MaybeObserver<Integer> ms = new MaybeObserver<>() {
<add> * MaybeObserver<Integer> ms = new MaybeObserver<>() {
<ide> * // ...
<ide> * };
<ide> *
<ide><path>src/main/java/io/reactivex/Observable.java
<ide> * <pre><code>
<ide> * Disposable d = Observable.just("Hello world!")
<ide> * .delay(1, TimeUnit.SECONDS)
<del> * .subscribeWith(new DisposableObserver<String>() {
<add> * .subscribeWith(new DisposableObserver<String>() {
<ide> * @Override public void onStart() {
<ide> * System.out.println("Start!");
<ide> * }
<ide> public final Observable<T> distinctUntilChanged(BiPredicate<? super T, ? super T
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code doAfterNext} does not operate by default on a particular {@link Scheduler}.</dd>
<del> * <td><b>Operator-fusion:</b></dt>
<add> * <dt><b>Operator-fusion:</b></dt>
<ide> * <dd>This operator supports boundary-limited synchronous or asynchronous queue-fusion.</dd>
<ide> * </dl>
<ide> * <p>History: 2.0.1 - experimental
<ide> public final Observable<T> doAfterTerminate(Action onFinally) {
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code doFinally} does not operate by default on a particular {@link Scheduler}.</dd>
<del> * <td><b>Operator-fusion:</b></dt>
<add> * <dt><b>Operator-fusion:</b></dt>
<ide> * <dd>This operator supports boundary-limited synchronous or asynchronous queue-fusion.</dd>
<ide> * </dl>
<ide> * <p>History: 2.0.1 - experimental
<ide> public final Maybe<T> reduce(BiFunction<T, T, T> reducer) {
<ide> * and may cause problems if it is mutable. To make sure each subscriber gets its own value, defer
<ide> * the application of this operator via {@link #defer(Callable)}:
<ide> * <pre><code>
<del> * ObservableSource<T> source = ...
<del> * Single.defer(() -> source.reduce(new ArrayList<>(), (list, item) -> list.add(item)));
<add> * ObservableSource<T> source = ...
<add> * Single.defer(() -> source.reduce(new ArrayList<>(), (list, item) -> list.add(item)));
<ide> *
<ide> * // alternatively, by using compose to stay fluent
<ide> *
<del> * source.compose(o ->
<del> * Observable.defer(() -> o.reduce(new ArrayList<>(), (list, item) -> list.add(item)).toObservable())
<add> * source.compose(o ->
<add> * Observable.defer(() -> o.reduce(new ArrayList<>(), (list, item) -> list.add(item)).toObservable())
<ide> * ).firstOrError();
<ide> *
<ide> * // or, by using reduceWith instead of reduce
<ide> *
<del> * source.reduceWith(() -> new ArrayList<>(), (list, item) -> list.add(item)));
<add> * source.reduceWith(() -> new ArrayList<>(), (list, item) -> list.add(item)));
<ide> * </code></pre>
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Observable<T> retryUntil(final BooleanSupplier stop) {
<ide> * This retries 3 times, each time incrementing the number of seconds it waits.
<ide> *
<ide> * <pre><code>
<del> * ObservableSource.create((Observer<? super String> s) -> {
<add> * ObservableSource.create((Observer<? super String> s) -> {
<ide> * System.out.println("subscribing");
<ide> * s.onError(new RuntimeException("always fails"));
<del> * }).retryWhen(attempts -> {
<del> * return attempts.zipWith(ObservableSource.range(1, 3), (n, i) -> i).flatMap(i -> {
<add> * }).retryWhen(attempts -> {
<add> * return attempts.zipWith(Observable.range(1, 3), (n, i) -> i).flatMap(i -> {
<ide> * System.out.println("delay retry by " + i + " second(s)");
<ide> * return ObservableSource.timer(i, TimeUnit.SECONDS);
<ide> * });
<ide> public final Observable<T> scan(BiFunction<T, T, T> accumulator) {
<ide> * and may cause problems if it is mutable. To make sure each subscriber gets its own value, defer
<ide> * the application of this operator via {@link #defer(Callable)}:
<ide> * <pre><code>
<del> * ObservableSource<T> source = ...
<del> * Observable.defer(() -> source.scan(new ArrayList<>(), (list, item) -> list.add(item)));
<add> * ObservableSource<T> source = ...
<add> * Observable.defer(() -> source.scan(new ArrayList<>(), (list, item) -> list.add(item)));
<ide> *
<ide> * // alternatively, by using compose to stay fluent
<ide> *
<del> * source.compose(o ->
<del> * Observable.defer(() -> o.scan(new ArrayList<>(), (list, item) -> list.add(item)))
<add> * source.compose(o ->
<add> * Observable.defer(() -> o.scan(new ArrayList<>(), (list, item) -> list.add(item)))
<ide> * );
<ide> * </code></pre>
<ide> * <dl>
<ide> public final <R> Observable<R> scan(final R initialValue, BiFunction<R, ? super
<ide> * <p>
<ide> * This sort of function is sometimes called an accumulator.
<ide> * <p>
<del> * Note that the ObservableSource that results from this method will emit {@code initialValue} as its first
<del> * emitted item.
<del> * <p>
<del> * Note that the {@code initialValue} is shared among all subscribers to the resulting ObservableSource
<del> * and may cause problems if it is mutable. To make sure each subscriber gets its own value, defer
<del> * the application of this operator via {@link #defer(Callable)}:
<del> * <pre><code>
<del> * ObservableSource<T> source = ...
<del> * Observable.defer(() -> source.scan(new ArrayList<>(), (list, item) -> list.add(item)));
<del> *
<del> * // alternatively, by using compose to stay fluent
<del> *
<del> * source.compose(o ->
<del> * Observable.defer(() -> o.scan(new ArrayList<>(), (list, item) -> list.add(item)))
<del> * );
<del> * </code></pre>
<add> * Note that the ObservableSource that results from this method will emit the value returned
<add> * by the {@code seedSupplier} as its first item.
<ide> * <dl>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code scanWith} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final void subscribe(Observer<? super T> observer) {
<ide> * Observer as is.
<ide> * <p>Usage example:
<ide> * <pre><code>
<del> * Observable<Integer> source = Observable.range(1, 10);
<add> * Observable<Integer> source = Observable.range(1, 10);
<ide> * CompositeDisposable composite = new CompositeDisposable();
<ide> *
<del> * ResourceObserver<Integer> rs = new ResourceObserver<>() {
<add> * ResourceObserver<Integer> rs = new ResourceObserver<>() {
<ide> * // ...
<ide> * };
<ide> *
<ide> public final <U, V> Observable<Observable<T>> window(
<ide> * <p>
<ide> * <img width="640" height="455" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/window1.png" alt="">
<ide> * <dl>
<del> * if left unconsumed.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>This version of {@code window} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> * </dl>
<ide><path>src/main/java/io/reactivex/Single.java
<ide> public static <T> Single<T> ambArray(final SingleSource<? extends T>... sources)
<ide> * Concatenate the single values, in a non-overlapping fashion, of the Single sources provided by
<ide> * an Iterable sequence.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Observable<T> concat(ObservableSource<? extends SingleSource<?
<ide> * Concatenate the single values, in a non-overlapping fashion, of the Single sources provided by
<ide> * a Publisher sequence.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer
<ide> * and the sources {@code Publisher} is expected to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T> Flowable<T> concat(Publisher<? extends SingleSource<? extends
<ide> * Concatenate the single values, in a non-overlapping fashion, of the Single sources provided by
<ide> * a Publisher sequence and prefetched by the specified amount.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer
<ide> * and the sources {@code Publisher} is expected to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public static <T> Flowable<T> concat(Publisher<? extends SingleSource<? extends
<ide> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.concat.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Flowable<T> concat(
<ide> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.concat.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Flowable<T> concat(
<ide> * <p>
<ide> * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.concat.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Flowable<T> concat(
<ide> * Concatenate the single values, in a non-overlapping fashion, of the Single sources provided in
<ide> * an array.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concatArray} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Single<T> just(final T item) {
<ide> * Merges an Iterable sequence of SingleSource instances into a single Flowable sequence,
<ide> * running all SingleSources at once.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code merge} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Flowable<T> merge(Iterable<? extends SingleSource<? extends T>
<ide> * Merges a Flowable sequence of SingleSource instances into a single Flowable sequence,
<ide> * running all SingleSources at once.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code merge} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Single<T> merge(SingleSource<? extends SingleSource<? extends
<ide> * You can combine items emitted by multiple Singles so that they appear as a single Flowable, by
<ide> * using the {@code merge} method.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code merge} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Flowable<T> merge(
<ide> * You can combine items emitted by multiple Singles so that they appear as a single Flowable, by using
<ide> * the {@code merge} method.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code merge} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public static <T> Flowable<T> merge(
<ide> * You can combine items emitted by multiple Singles so that they appear as a single Flowable, by using
<ide> * the {@code merge} method.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code merge} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final <U> Single<U> cast(final Class<? extends U> clazz) {
<ide> * <p>
<ide> * <img width="640" height="335" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.concatWith.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code concatWith} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final <R> Maybe<R> flatMapMaybe(final Function<? super T, ? extends Maybe
<ide> * <p>
<ide> * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.flatMapObservable.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer
<ide> * and the {@code Publisher} returned by the mapper function is expected to honor it as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Single<Boolean> contains(final Object value, final BiPredicate<Obje
<ide> * You can combine items emitted by multiple Singles so that they appear as a single Flowable, by using
<ide> * the {@code mergeWith} method.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code mergeWith} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final Single<T> onErrorResumeNext(
<ide> /**
<ide> * Repeatedly re-subscribes to the current Single and emits each success value.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code repeat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final Flowable<T> repeat() {
<ide> /**
<ide> * Re-subscribes to the current Single at most the given number of times and emits each success value.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code repeat} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final Flowable<T> repeat(long times) {
<ide> * the Publisher returned by the handler function signals a value in response to a
<ide> * value signalled through the Flowable the handle receives.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.
<ide> * The {@code Publisher} returned by the handler function is expected to honor backpressure as well.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> public final Flowable<T> repeatWhen(Function<? super Flowable<Object>, ? extends
<ide> /**
<ide> * Re-subscribes to the current Single until the given BooleanSupplier returns true.
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code repeatUntil} does not operate by default on a particular {@link Scheduler}.</dd>
<ide> public final void subscribe(SingleObserver<? super T> subscriber) {
<ide> * SingleObserver as is.
<ide> * <p>Usage example:
<ide> * <pre><code>
<del> * Single<Integer> source = Single.just(1);
<add> * Single<Integer> source = Single.just(1);
<ide> * CompositeDisposable composite = new CompositeDisposable();
<ide> *
<del> * class ResourceSingleObserver implements SingleObserver<Integer>, Disposable {
<add> * class ResourceSingleObserver implements SingleObserver<Integer>, Disposable {
<ide> * // ...
<ide> * }
<ide> *
<ide> public final Completable toCompletable() {
<ide> * <p>
<ide> * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.toObservable.png" alt="">
<ide> * <dl>
<del> * <dt><b>Backpressure:</b><dt>
<add> * <dt><b>Backpressure:</b></dt>
<ide> * <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
<ide> * <dt><b>Scheduler:</b></dt>
<ide> * <dd>{@code toFlowable} does not operate by default on a particular {@link Scheduler}.</dd>
<ide><path>src/main/java/io/reactivex/observers/DefaultObserver.java
<ide> * If for some reason this can't be avoided, use {@link io.reactivex.Observable#safeSubscribe(io.reactivex.Observer)}
<ide> * instead of the standard {@code subscribe()} method.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Observable.range(1, 5)
<ide> * .subscribe(new DefaultObserver<Integer>() {
<ide> * @Override public void onStart() {
<ide> * System.out.println("Done!");
<ide> * }
<ide> * });
<del> * </pre></code>
<add> * </code></pre>
<ide> *
<ide> * @param <T> the value type
<ide> */
<ide><path>src/main/java/io/reactivex/observers/DisposableCompletableObserver.java
<ide> * <p>Implementation of {@link #onStart()}, {@link #onError(Throwable)} and
<ide> * {@link #onComplete()} are not allowed to throw any unchecked exceptions.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Disposable d =
<ide> * Completable.complete().delay(1, TimeUnit.SECONDS)
<ide> * .subscribeWith(new DisposableMaybeObserver<Integer>() {
<ide> * });
<ide> * // ...
<ide> * d.dispose();
<del> * </pre></code>
<add> * </code></pre>
<ide> */
<ide> public abstract class DisposableCompletableObserver implements CompletableObserver, Disposable {
<ide> final AtomicReference<Disposable> s = new AtomicReference<Disposable>();
<ide><path>src/main/java/io/reactivex/observers/DisposableMaybeObserver.java
<ide> * <p>Implementation of {@link #onStart()}, {@link #onSuccess(Object)}, {@link #onError(Throwable)} and
<ide> * {@link #onComplete()} are not allowed to throw any unchecked exceptions.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Disposable d =
<ide> * Maybe.just(1).delay(1, TimeUnit.SECONDS)
<ide> * .subscribeWith(new DisposableMaybeObserver<Integer>() {
<ide> * });
<ide> * // ...
<ide> * d.dispose();
<del> * </pre></code>
<del> *
<add> * </code></pre>
<ide> *
<ide> * @param <T> the received value type
<ide> */
<ide><path>src/main/java/io/reactivex/observers/DisposableObserver.java
<ide> * If for some reason this can't be avoided, use {@link io.reactivex.Observable#safeSubscribe(io.reactivex.Observer)}
<ide> * instead of the standard {@code subscribe()} method.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Disposable d =
<ide> * Observable.range(1, 5)
<ide> * .subscribeWith(new DisposableObserver<Integer>() {
<ide> * });
<ide> * // ...
<ide> * d.dispose();
<del> * </pre></code>
<add> * </code></pre>
<ide> *
<ide> * @param <T> the received value type
<ide> */
<ide><path>src/main/java/io/reactivex/observers/DisposableSingleObserver.java
<ide> * <p>Implementation of {@link #onStart()}, {@link #onSuccess(Object)} and {@link #onError(Throwable)}
<ide> * are not allowed to throw any unchecked exceptions.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Disposable d =
<ide> * Single.just(1).delay(1, TimeUnit.SECONDS)
<ide> * .subscribeWith(new DisposableSingleObserver<Integer>() {
<ide> * });
<ide> * // ...
<ide> * d.dispose();
<del> * </pre></code>
<add> * </code></pre>
<ide> *
<ide> * @param <T> the received value type
<ide> */
<ide><path>src/main/java/io/reactivex/observers/ResourceCompletableObserver.java
<ide> * <p>Implementation of {@link #onStart()}, {@link #onError(Throwable)}
<ide> * and {@link #onComplete()} are not allowed to throw any unchecked exceptions.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Disposable d =
<ide> * Completable.complete().delay(1, TimeUnit.SECONDS)
<ide> * .subscribeWith(new ResourceCompletableObserver() {
<ide> * });
<ide> * // ...
<ide> * d.dispose();
<del> * </pre></code>
<add> * </code></pre>
<ide> */
<ide> public abstract class ResourceCompletableObserver implements CompletableObserver, Disposable {
<ide> /** The active subscription. */
<ide><path>src/main/java/io/reactivex/observers/ResourceMaybeObserver.java
<ide> * <p>Implementation of {@link #onStart()}, {@link #onSuccess(Object)}, {@link #onError(Throwable)}
<ide> * and {@link #onComplete()} are not allowed to throw any unchecked exceptions.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Disposable d =
<ide> * Maybe.just(1).delay(1, TimeUnit.SECONDS)
<ide> * .subscribeWith(new ResourceMaybeObserver<Integer>() {
<ide> * });
<ide> * // ...
<ide> * d.dispose();
<del> * </pre></code>
<add> * </code></pre>
<ide> *
<ide> * @param <T> the value type
<ide> */
<ide><path>src/main/java/io/reactivex/observers/ResourceObserver.java
<ide> * If for some reason this can't be avoided, use {@link io.reactivex.Observable#safeSubscribe(io.reactivex.Observer)}
<ide> * instead of the standard {@code subscribe()} method.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Disposable d =
<ide> * Observable.range(1, 5)
<ide> * .subscribeWith(new ResourceObserver<Integer>() {
<ide> * });
<ide> * // ...
<ide> * d.dispose();
<del> * </pre></code>
<add> * </code></pre>
<ide> *
<ide> * @param <T> the value type
<ide> */
<ide><path>src/main/java/io/reactivex/observers/ResourceSingleObserver.java
<ide> * <p>Implementation of {@link #onStart()}, {@link #onSuccess(Object)} and {@link #onError(Throwable)}
<ide> * are not allowed to throw any unchecked exceptions.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Disposable d =
<ide> * Single.just(1).delay(1, TimeUnit.SECONDS)
<ide> * .subscribeWith(new ResourceSingleObserver<Integer>() {
<ide> * });
<ide> * // ...
<ide> * d.dispose();
<del> * </pre></code>
<add> * </code></pre>
<ide> *
<ide> * @param <T> the value type
<ide> */
<ide><path>src/main/java/io/reactivex/schedulers/Schedulers.java
<ide> public static Scheduler single() {
<ide> * <p>
<ide> * Starting, stopping and restarting this scheduler is not supported (no-op) and the provided
<ide> * executor's lifecycle must be managed externally:
<del> * <code><pre>
<add> * <pre><code>
<ide> * ExecutorService exec = Executors.newSingleThreadedExecutor();
<ide> * try {
<ide> * Scheduler scheduler = Schedulers.from(exec);
<ide> public static Scheduler single() {
<ide> * } finally {
<ide> * exec.shutdown();
<ide> * }
<del> * </pre></code>
<add> * </code></pre>
<ide> * <p>
<ide> * This type of scheduler is less sensitive to leaking {@link io.reactivex.Scheduler.Worker} instances, although
<ide> * not disposing a worker that has timed/delayed tasks not cancelled by other means may leak resources and/or
<ide><path>src/main/java/io/reactivex/subscribers/DefaultSubscriber.java
<ide> * instead of the standard {@code subscribe()} method.
<ide> * @param <T> the value type
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Flowable.range(1, 5)
<ide> * .subscribe(new DefaultSubscriber<Integer>() {
<ide> * @Override public void onStart() {
<ide> * System.out.println("Done!");
<ide> * }
<ide> * });
<del> * </pre></code>
<add> * </code></pre>
<ide> */
<ide> public abstract class DefaultSubscriber<T> implements FlowableSubscriber<T> {
<ide> private Subscription s;
<ide><path>src/main/java/io/reactivex/subscribers/DisposableSubscriber.java
<ide> * If for some reason this can't be avoided, use {@link io.reactivex.Flowable#safeSubscribe(org.reactivestreams.Subscriber)}
<ide> * instead of the standard {@code subscribe()} method.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Disposable d =
<ide> * Flowable.range(1, 5)
<ide> * .subscribeWith(new DisposableSubscriber<Integer>() {
<ide> * });
<ide> * // ...
<ide> * d.dispose();
<del> * </pre></code>
<add> * </code></pre>
<ide> * @param <T> the received value type.
<ide> */
<ide> public abstract class DisposableSubscriber<T> implements FlowableSubscriber<T>, Disposable {
<ide><path>src/main/java/io/reactivex/subscribers/ResourceSubscriber.java
<ide> * If for some reason this can't be avoided, use {@link io.reactivex.Flowable#safeSubscribe(org.reactivestreams.Subscriber)}
<ide> * instead of the standard {@code subscribe()} method.
<ide> *
<del> * <p>Example<code><pre>
<add> * <p>Example<pre><code>
<ide> * Disposable d =
<ide> * Flowable.range(1, 5)
<ide> * .subscribeWith(new ResourceSubscriber<Integer>() {
<ide> * });
<ide> * // ...
<ide> * d.dispose();
<del> * </pre></code>
<add> * </code></pre>
<ide> *
<ide> * @param <T> the value type
<ide> */
<ide><path>src/test/java/io/reactivex/JavadocFindUnescapedAngleBrackets.java
<add>/**
<add> * Copyright (c) 2016-present, RxJava Contributors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
<add> * compliance with the License. You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software distributed under the License is
<add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
<add> * the License for the specific language governing permissions and limitations under the License.
<add> */
<add>
<add>package io.reactivex;
<add>import java.io.*;
<add>import java.util.*;
<add>
<add>import org.junit.Test;
<add>
<add>public class JavadocFindUnescapedAngleBrackets {
<add>
<add> @Test
<add> public void find() throws Exception {
<add> File base = MaybeNo2Dot0Since.findSource("Flowable");
<add>
<add> if (base == null) {
<add> return;
<add> }
<add>
<add> base = base.getParentFile();
<add>
<add> Queue<File[]> files = new ArrayDeque<File[]>();
<add>
<add> files.offer(base.listFiles());
<add>
<add> StringBuilder b = new StringBuilder();
<add> int count = 0;
<add>
<add> while (!files.isEmpty()) {
<add> for (File file : files.poll()) {
<add> if (file.getName().endsWith(".java")) {
<add>
<add> String s = readFile(file);
<add>
<add> String fn = file.toString().substring(base.toString().length());
<add> fn = fn.replace("\\", ".");
<add> fn = fn.replace("//", ".");
<add> fn = fn.replace(".java", "");
<add> fn = "io.reactivex" + fn;
<add>
<add> int j = 0;
<add> for (;;) {
<add> int idx = s.indexOf("<code>", j);
<add> if (idx < 0) {
<add> break;
<add> }
<add> int jdx = s.indexOf("</code>", idx + 6);
<add>
<add> int k = idx + 6;
<add> for (;;) {
<add> int kdx = s.indexOf('>', k);
<add> if (kdx < 0) {
<add> break;
<add> }
<add>
<add> if (kdx < jdx) {
<add> b.append("at ")
<add> .append(fn)
<add> .append(".gt(")
<add> .append(file.getName()).append(":")
<add> .append(countLine(s, kdx))
<add> .append(")\r\n");
<add> count++;
<add> } else {
<add> break;
<add> }
<add> k = kdx + 1;
<add> }
<add>
<add> k = idx + 6;
<add> for (;;) {
<add> int kdx = s.indexOf('<', k);
<add> if (kdx < 0) {
<add> break;
<add> }
<add>
<add> if (kdx < jdx) {
<add> b.append("at ")
<add> .append(fn)
<add> .append(".lt(")
<add> .append(file.getName()).append(":")
<add> .append(countLine(s, kdx))
<add> .append(")\r\n");
<add> count++;
<add> } else {
<add> break;
<add> }
<add> k = kdx + 1;
<add> }
<add>
<add> j = jdx + 7;
<add> }
<add> }
<add> }
<add> }
<add>
<add> if (b.length() > 0) {
<add> System.err.println("Should escape < and > in <code> blocks! " + count);
<add> System.err.println(b);
<add> throw new Exception("Should escape < and > in <code> blocks! " + count + "\r\n" + b);
<add> }
<add> }
<add>
<add> static int countLine(String s, int kdx) {
<add> int c = 1;
<add> for (int i = kdx; i >= 0; i--) {
<add> if (s.charAt(i) == '\n') {
<add> c++;
<add> }
<add> }
<add> return c;
<add> }
<add>
<add> static String readFile(File f) throws IOException {
<add> StringBuilder b = new StringBuilder((int)f.length());
<add> BufferedReader in = new BufferedReader(new FileReader(f));
<add> try {
<add> String line = null;
<add>
<add> while ((line = in.readLine()) != null) {
<add> b.append(line).append("\n");
<add> }
<add>
<add> } finally {
<add> in.close();
<add> }
<add> return b.toString();
<add> }
<add>}
<ide><path>src/test/java/io/reactivex/internal/operators/flowable/FlowableFilterTest.java
<ide> public boolean test(String t1) {
<ide> }
<ide>
<ide> /**
<del> * Make sure we are adjusting subscriber.request() for filtered items
<add> * Make sure we are adjusting subscriber.request() for filtered items.
<ide> * @throws InterruptedException if the test is interrupted
<ide> * @throws InterruptedException if the test is interrupted
<ide> */
<ide> public void onNext(String t) {
<ide> }
<ide>
<ide> /**
<del> * Make sure we are adjusting subscriber.request() for filtered items
<add> * Make sure we are adjusting subscriber.request() for filtered items.
<ide> * @throws InterruptedException if the test is interrupted
<ide> */
<ide> @Test(timeout = 500000)
<ide><path>src/test/java/io/reactivex/observable/ObservableErrorHandlingTests.java
<ide> public class ObservableErrorHandlingTests {
<ide>
<ide> /**
<del> * Test that an error from a user provided Observer.onNext is handled and emitted to the onError
<add> * Test that an error from a user provided Observer.onNext is handled and emitted to the onError.
<ide> * @throws InterruptedException if the test is interrupted
<ide> */
<ide> @Test
<ide> public void onNext(Long args) {
<ide>
<ide> /**
<ide> * Test that an error from a user provided Observer.onNext is handled and emitted to the onError
<del> * even when done across thread boundaries with observeOn
<add> * even when done across thread boundaries with observeOn.
<ide> * @throws InterruptedException if the test is interrupted
<ide> */
<ide> @Test
<ide><path>src/test/java/io/reactivex/tck/BaseTck.java
<ide> public long maxElementsFromPublisher() {
<ide>
<ide> /**
<ide> * Creates an Iterable with the specified number of elements or an infinite one if
<del> * elements > Integer.MAX_VALUE
<add> * elements > Integer.MAX_VALUE.
<ide> * @param elements the number of elements to return, Integer.MAX_VALUE means an infinite sequence
<ide> * @return the Iterable
<ide> */ | 22 |
Mixed | Ruby | add a #populate method to migrations | df82237a45e930a7ab53b95bee78a3f34c5b92fb | <ide><path>activerecord/CHANGELOG.md
<add>* Add `#only_up` to database migrations for code that is only relevant when
<add> migrating up, e.g. populating a new column.
<add>
<add> *Rich Daley*
<add>
<ide> * Require raw SQL fragments to be explicitly marked when used in
<ide> relation query methods.
<ide>
<ide><path>activerecord/lib/active_record/migration.rb
<ide> def reversible
<ide> execute_block { yield helper }
<ide> end
<ide>
<add> # Used to specify an operation that is only run when migrating up
<add> # (for example, populating a new column with its initial values).
<add> #
<add> # In the following example, the new column `published` will be given
<add> # the value `true` for all existing records.
<add> #
<add> # class AddPublishedToPosts < ActiveRecord::Migration[5.3]
<add> # def change
<add> # add_column :posts, :published, :boolean, default: false
<add> # up_only do
<add> # execute "update posts set published = 'true'"
<add> # end
<add> # end
<add> # end
<add> def up_only
<add> execute_block { yield } unless reverting?
<add> end
<add>
<ide> # Runs the given migration classes.
<ide> # Last argument can specify options:
<ide> # - :direction (default is :up)
<ide><path>activerecord/test/cases/invertible_migration_test.rb
<ide> def change
<ide> end
<ide> end
<ide>
<add> class UpOnlyMigration < SilentMigration
<add> def change
<add> add_column :horses, :oldie, :boolean, default: false
<add> up_only { execute "update horses set oldie = 'true'" }
<add> end
<add> end
<add>
<ide> setup do
<ide> @verbose_was, ActiveRecord::Migration.verbose = ActiveRecord::Migration.verbose, false
<ide> end
<ide> def test_migrate_revert_add_index_with_name
<ide> "horses_index_named index should not exist"
<ide> end
<ide> end
<add>
<add> def test_up_only
<add> InvertibleMigration.new.migrate(:up)
<add> horse1 = Horse.create
<add> # populates existing horses with oldie=true but new ones have default false
<add> UpOnlyMigration.new.migrate(:up)
<add> Horse.reset_column_information
<add> horse1.reload
<add> horse2 = Horse.create
<add>
<add> assert horse1.oldie? # created before migration
<add> assert !horse2.oldie? # created after migration
<add>
<add> UpOnlyMigration.new.migrate(:down) # should be no error
<add> connection = ActiveRecord::Base.connection
<add> assert !connection.column_exists?(:horses, :oldie)
<add> Horse.reset_column_information
<add> end
<ide> end
<ide> end | 3 |
Text | Text | expand definition of usability testing | f83077167320f26a3c2a06db07624bcc0ccbee2a | <ide><path>guide/english/user-experience-research/usability-testing/index.md
<ide> title: Usability Testing
<ide> ---
<ide> ## Usability Testing
<ide>
<del>This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/user-experience-research/usability-testing/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<del>
<del><a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<del>
<del><!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
<del>
<del>#### More Information:
<del><!-- Please add any articles you think might be helpful to read before writing the article -->
<del>
<add>Usability testing involves evaluating the ease of which a user or group of users can interact with a site, software application, etc. It is typically (although not exclusively) achieved by observing users as they attempt to complete a pre-determined set of tasks, with the aim of identifying any difficulties which may arise or any aspects that users particularly approve of; as well as generally noting any observations they might make. Data generated from testing can then be used to inform any subsequent design decisions.
<ide>
<add>In practice, usability testing is often an iterative process undertaken at various stages of a product's development cycle with prototypes of varying levels of fidelity. Employing a low-fidelity prototype of a website, for example, such as a paper sketch that approximates what it will look like, can be considerably more efficient than fully developing an actual website only to discover that it must be changed again. | 1 |
Text | Text | add text from english version | 18fdaf3731a88b487c51d37b22db384f6909a115 | <ide><path>docs/russian/README.md
<ide> <table>
<ide> <tr>
<add> <!-- Do not translate this table -->
<ide> <td> Read these guidelines in </td>
<ide> <td><a href="/CONTRIBUTING.md"> English </a></td>
<ide> <td><a href="/docs/chinese/README.md"> 中文 </a></td>
<ide>
<ide> Hello 👋 !
<ide>
<del>These instructions have not been translated yet. Please check this issue for details: [`#18312`](https://github.com/freeCodeCamp/freeCodeCamp/issues/18312)
<ide>\ No newline at end of file
<add>These instructions have not been translated yet. Please check this issue for details: [`#18312`](https://github.com/freeCodeCamp/freeCodeCamp/issues/18312)
<add>
<add>This directory contains all of the documentation on contributing to freeCodeCamp.org
<add>
<add>## [If you are getting started, start by reading this first.](/CONTRIBUTING.md)
<add>
<add>---
<add>
<add>## Quick references articles
<add>
<add>1. How to work on Guide articles.
<add>2. How to work on Coding Challenges.
<add>3. How to setup freeCodeCamp locally.
<add>4. How to catch outgoing emails locally.
<add>
<add>## Style guides
<add>
<add>1. Style guide for creating guide articles.
<add>2. Style guide for creating coding challenges.
<add>
<add>## Quick commands reference when working locally
<add>
<add>A quick reference to the commands that you will need, when working locally.
<add>
<add>| command | description |
<add>| ------- | ----------- |
<add>| `npm run bootstrap` | Bootstraps the different services |
<add>| `npm run seed` | Parse all the challenge markdown files and inserts them into MongoDB. |
<add>| `npm run develop` | Starts the freeCodeCamp API Server and Client Apps |
<add>| `npm test` | Run all JS tests in the system, including client, server, lint and challenge tests |
<add>| `npm run test:client` | Run the client test suite |
<add>| `npm run test:curriculum` | Run the curriculum test suite |
<add>| `npm run test:server` | Run the server test suite |
<add>| `npm run commit` | An interactive tool to help you build a good commit message | | 1 |
PHP | PHP | fix cs error | 6e5f1fc563d4809a31ac04c47254a6d54597a410 | <ide><path>src/Routing/Route/Route.php
<ide> public function match(array $url, array $context = [])
<ide> $defaults = $this->defaults;
<ide> $context += ['params' => []];
<ide>
<del> if (!empty($this->options['persist']) &&
<add> if (!empty($this->options['persist']) &&
<ide> is_array($this->options['persist'])
<ide> ) {
<ide> $url = $this->_persistParams($url, $context['params']); | 1 |
Javascript | Javascript | fix broken merge | 6591f6dd9d1c86144903f60e5d19e624c5bf6751 | <ide><path>test/unit/traversing.js
<ide> test("closest(Array)", function() {
<ide> same( jQuery("body").closest(["span","html"]), [{selector:"html", elem:document.documentElement, level:2}], "closest([body, html])" );
<ide> });
<ide>
<del><<<<<<< HEAD
<del>test("not(Selector|undefined)", function() {
<del> expect(11);
<del>=======
<ide> test("closest(jQuery)", function() {
<ide> expect(8);
<ide> var $child = jQuery("#nothiddendivchild"),
<ide> test("closest(jQuery)", function() {
<ide> ok( $child.closest( $body.add($parent) ).is('#nothiddendiv'), "Closest ancestor retrieved." );
<ide> });
<ide>
<del>test("not(Selector)", function() {
<del> expect(7);
<del>>>>>>>> 1a167767305202797cf4c839eb64bd7adfb00182
<add>test("not(Selector|undefined)", function() {
<add> expect(11);
<ide> equals( jQuery("#main > p#ap > a").not("#google").length, 2, "not('selector')" );
<ide> same( jQuery("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );
<ide> same( jQuery("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" ); | 1 |
Javascript | Javascript | add first bunch of unit tests for geometry | 5bf7d23f30e21caf0da337e3e84edd71c868e6ba | <ide><path>test/unit/core/Geometry.js
<add>/**
<add> * @author simonThiele / https://github.com/simonThiele
<add> */
<add>
<add>module( "Geometry" );
<add>
<add>test( "rotateX", function() {
<add> var geometry = getGeometry();
<add>
<add> var matrix = new THREE.Matrix4();
<add> matrix.makeRotationX( Math.PI / 2 ); // 90 degree
<add>
<add> geometry.applyMatrix( matrix );
<add>
<add> var v0 = geometry.vertices[0], v1 = geometry.vertices[1], v2 = geometry.vertices[2];
<add> ok ( v0.x === -0.5 && v0.y === 0 && v0.z === 0, "first vertex was rotated" );
<add> ok ( v1.x === 0.5 && v1.y === 0 && v1.z === 0, "second vertex was rotated" );
<add> ok ( v2.x === 0 && v2.y < Number.EPSILON && v2.z === 1, "third vertex was rotated" );
<add>});
<add>
<add>
<add>test( "rotateY", function() {
<add> var geometry = getGeometry();
<add>
<add> var matrix = new THREE.Matrix4();
<add> matrix.makeRotationY( Math.PI ); // 180 degrees
<add>
<add> geometry.applyMatrix( matrix );
<add>
<add> var v0 = geometry.vertices[0], v1 = geometry.vertices[1], v2 = geometry.vertices[2];
<add> ok ( v0.x === 0.5 && v0.y === 0 && v0.z < Number.EPSILON, "first vertex was rotated" );
<add> ok ( v1.x === -0.5 && v1.y === 0 && v1.z < Number.EPSILON, "second vertex was rotated" );
<add> ok ( v2.x === 0 && v2.y === 1 && v2.z === 0, "third vertex was rotated" );
<add>});
<add>
<add>test( "rotateZ", function() {
<add> var geometry = getGeometry();
<add>
<add> var matrix = new THREE.Matrix4();
<add> matrix.makeRotationZ( Math.PI / 2 * 3 ); // 270 degrees
<add>
<add> geometry.applyMatrix( matrix );
<add>
<add> var v0 = geometry.vertices[0], v1 = geometry.vertices[1], v2 = geometry.vertices[2];
<add> ok ( v0.x < Number.EPSILON && v0.y === 0.5 && v0.z === 0, "first vertex was rotated" );
<add> ok ( v1.x < Number.EPSILON && v1.y === -0.5 && v1.z === 0, "second vertex was rotated" );
<add> ok ( v2.x === 1 && v2.y < Number.EPSILON && v2.z === 0, "third vertex was rotated" );
<add>});
<add>
<add>test( "fromBufferGeometry", function() {
<add> var bufferGeometry = new THREE.BufferGeometry();
<add> bufferGeometry.addAttribute('position', new THREE.BufferAttribute(new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9]), 3));
<add> bufferGeometry.addAttribute('color', new THREE.BufferAttribute(new Float32Array([0, 0, 0, 0.5, 0.5, 0.5, 1, 1, 1]), 3));
<add> bufferGeometry.addAttribute('normal', new THREE.BufferAttribute(new Float32Array([0, 1, 0, 1, 0, 1, 1, 1, 0]), 3));
<add> bufferGeometry.addAttribute('uv', new THREE.BufferAttribute(new Float32Array([0, 0, 0, 1, 1, 1]), 2));
<add> bufferGeometry.addAttribute('uv2', new THREE.BufferAttribute(new Float32Array([0, 0, 0, 1, 1, 1]), 2));
<add>
<add> var geometry = new THREE.Geometry().fromBufferGeometry(bufferGeometry);
<add>
<add> var colors = geometry.colors;
<add> ok (
<add> colors[0].r === 0 && colors[0].g === 0 && colors[0].b === 0 &&
<add> colors[1].r === 0.5 && colors[1].g === 0.5 && colors[1].b === 0.5 &&
<add> colors[2].r === 1 && colors[2].g === 1 && colors[2].b === 1
<add> , "colors were created well" );
<add>
<add> var vertices = geometry.vertices;
<add> ok (
<add> vertices[0].x === 1 && vertices[0].y === 2 && vertices[0].z === 3 &&
<add> vertices[1].x === 4 && vertices[1].y === 5 && vertices[1].z === 6 &&
<add> vertices[2].x === 7 && vertices[2].y === 8 && vertices[2].z === 9
<add> , "vertices were created well" );
<add>
<add> var vNormals = geometry.faces[0].vertexNormals;
<add> ok (
<add> vNormals[0].x === 0 && vNormals[0].y === 1 && vNormals[0].z === 0 &&
<add> vNormals[1].x === 1 && vNormals[1].y === 0 && vNormals[1].z === 1 &&
<add> vNormals[2].x === 1 && vNormals[2].y === 1 && vNormals[2].z === 0
<add> , "vertex normals were created well" );
<add>});
<add>
<add>test( "normalize", function() {
<add> var geometry = getGeometry();
<add> geometry.computeLineDistances();
<add>
<add> var distances = geometry.lineDistances;
<add> ok( distances[0] === 0, "distance to the 1st point is 0" );
<add> ok( distances[1] === 1 + distances[0], "distance from the 1st to the 2nd is sqrt(2nd - 1st) + distance - 1" );
<add> ok( distances[2] === Math.sqrt(0.5 * 0.5 + 1) + distances[1], "distance from the 1st to the 3nd is sqrt(3rd - 2nd) + distance - 1" );
<add>});
<add>
<add>function getGeometryByParams( x1, y1, z1, x2, y2, z2, x3, y3, z3 ) {
<add> var geometry = new THREE.Geometry();
<add>
<add> // a triangle
<add> geometry.vertices = [
<add> new THREE.Vector3( x1, y1, z1 ),
<add> new THREE.Vector3( x2, y2, z2 ),
<add> new THREE.Vector3( x3, y3, z3 )
<add> ];
<add>
<add> return geometry;
<add>}
<add>
<add>function getGeometry() {
<add> return getGeometryByParams(-0.5, 0, 0, 0.5, 0, 0, 0, 1, 0);
<add>} | 1 |
Ruby | Ruby | move x86_64 requirement into core | ee7178562fde5fb23acde1cb4f8d8e4c4ac969c2 | <ide><path>Library/Homebrew/dependency_collector.rb
<ide> def parse_symbol_spec spec, tag
<ide> when :postgresql then PostgresqlDependency.new(tag)
<ide> when :tex then TeXDependency.new(tag)
<ide> when :clt then CLTDependency.new(tag)
<add> when :arch then ArchRequirement.new(tag)
<ide> else
<ide> raise "Unsupported special dependency #{spec}"
<ide> end
<ide><path>Library/Homebrew/requirements.rb
<ide> def message; <<-EOS.undent
<ide> EOS
<ide> end
<ide> end
<add>
<add>class ArchRequirement < Requirement
<add> fatal true
<add>
<add> def initialize(arch)
<add> @arch = arch
<add> super
<add> end
<add>
<add> satisfy do
<add> case @arch
<add> when :x86_64 then MacOS.prefer_64_bit?
<add> end
<add> end
<add>
<add> def message; <<-EOS.undent
<add> This formula requires an #{@arch} architecture.
<add> EOS
<add> end
<add>end | 2 |
PHP | PHP | remove empty line | 79ac996b4474c95d55885049bbd8981afc7c6148 | <ide><path>tests/Integration/Events/EventFakeTest.php
<ide> class EventFakeTest extends TestCase
<ide> * Define environment setup.
<ide> *
<ide> * @param \Illuminate\Contracts\Foundation\Application $app
<del> *
<ide> * @return void
<ide> */
<ide> protected function getEnvironmentSetUp($app) | 1 |
Python | Python | add tests for entity->biluo transformation | 2163fd238f01681dc101b5f3e06556ff21473597 | <ide><path>spacy/tests/gold/test_biluo.py
<add>from __future__ import unicode_literals
<add>
<add>from ...gold import biluo_tags_from_offsets
<add>from ...vocab import Vocab
<add>from ...tokens.doc import Doc
<add>
<add>import pytest
<add>
<add>
<add>@pytest.fixture
<add>def vocab():
<add> return Vocab()
<add>
<add>
<add>def test_U(vocab):
<add> orths_and_spaces = [('I', True), ('flew', True), ('to', True), ('London', False),
<add> ('.', True)]
<add> doc = Doc(vocab, orths_and_spaces=orths_and_spaces)
<add> entities = [(len("I flew to "), len("I flew to London"), 'LOC')]
<add> tags = biluo_tags_from_offsets(doc, entities)
<add> assert tags == ['O', 'O', 'O', 'U-LOC', 'O']
<add>
<add>
<add>def test_BL(vocab):
<add> orths_and_spaces = [('I', True), ('flew', True), ('to', True), ('San', True),
<add> ('Francisco', False), ('.', True)]
<add> doc = Doc(vocab, orths_and_spaces=orths_and_spaces)
<add> entities = [(len("I flew to "), len("I flew to San Francisco"), 'LOC')]
<add> tags = biluo_tags_from_offsets(doc, entities)
<add> assert tags == ['O', 'O', 'O', 'B-LOC', 'L-LOC', 'O']
<add>
<add>
<add>def test_BIL(vocab):
<add> orths_and_spaces = [('I', True), ('flew', True), ('to', True), ('San', True),
<add> ('Francisco', True), ('Valley', False), ('.', True)]
<add> doc = Doc(vocab, orths_and_spaces=orths_and_spaces)
<add> entities = [(len("I flew to "), len("I flew to San Francisco Valley"), 'LOC')]
<add> tags = biluo_tags_from_offsets(doc, entities)
<add> assert tags == ['O', 'O', 'O', 'B-LOC', 'I-LOC', 'L-LOC', 'O']
<add>
<add>
<add>def test_misalign(vocab):
<add> orths_and_spaces = [('I', True), ('flew', True), ('to', True), ('San', True),
<add> ('Francisco', True), ('Valley.', False)]
<add> doc = Doc(vocab, orths_and_spaces=orths_and_spaces)
<add> entities = [(len("I flew to "), len("I flew to San Francisco Valley"), 'LOC')]
<add> tags = biluo_tags_from_offsets(doc, entities)
<add> assert tags == ['O', 'O', 'O', '', '', ''] | 1 |
Javascript | Javascript | move _pendingx into reactcompositecomponent | bc4dd411b06b3ae22f16ec622c6f2ca8de44bf6b | <ide><path>src/browser/ui/ReactDOMComponent.js
<ide> ReactDOMComponent.Mixin = {
<ide> return;
<ide> }
<ide>
<del> ReactComponent.Mixin.receiveComponent.call(
<del> this,
<del> nextElement,
<del> transaction
<del> );
<add> var prevElement = this._currentElement;
<add> this._currentElement = nextElement;
<add> this.updateComponent(transaction, prevElement, nextElement);
<ide> },
<ide>
<ide> /**
<ide><path>src/core/ReactComponent.js
<ide> var ReactComponent = {
<ide> * @internal
<ide> */
<ide> construct: function(element) {
<del> // See ReactUpdates.
<del> this._pendingCallbacks = null;
<del>
<ide> // We keep the old element and a reference to the pending element
<ide> // to track updates.
<ide> this._currentElement = element;
<del> this._pendingElement = null;
<ide> },
<ide>
<ide> /**
<ide> var ReactComponent = {
<ide> unmountIDFromEnvironment(this._rootNodeID);
<ide> // Reset all fields
<ide> this._rootNodeID = null;
<del> this._pendingCallbacks = null;
<del> this._pendingElement = null;
<del> },
<del>
<del> /**
<del> * Given a new instance of this component, updates the rendered DOM nodes
<del> * as if that instance was rendered instead.
<del> *
<del> * Subclasses that override this method should make sure to invoke
<del> * `ReactComponent.Mixin.receiveComponent.call(this, ...)`.
<del> *
<del> * @param {object} nextComponent Next set of properties.
<del> * @param {ReactReconcileTransaction} transaction
<del> * @internal
<del> */
<del> receiveComponent: function(nextElement, transaction) {
<del> this._pendingElement = nextElement;
<del> this.performUpdateIfNecessary(transaction);
<del> },
<del>
<del> /**
<del> * If `_pendingElement` is set, update the component.
<del> *
<del> * @param {ReactReconcileTransaction} transaction
<del> * @internal
<del> */
<del> performUpdateIfNecessary: function(transaction) {
<del> if (this._pendingElement == null) {
<del> return;
<del> }
<del> var prevElement = this._currentElement;
<del> var nextElement = this._pendingElement;
<del> this._currentElement = nextElement;
<del> this._pendingElement = null;
<del> this.updateComponent(transaction, prevElement, nextElement);
<ide> },
<ide>
<ide> /**
<ide><path>src/core/ReactCompositeComponent.js
<ide> var ReactCompositeComponentMixin = assign({},
<ide> this._instance.context = null;
<ide> this._instance.refs = emptyObject;
<ide>
<add> this._pendingElement = null;
<ide> this._pendingState = null;
<ide> this._compositeLifeCycleState = null;
<ide>
<ide> // Children can be either an array or more than one argument
<ide> ReactComponent.Mixin.construct.apply(this, arguments);
<add>
<add> // See ReactUpdates.
<add> this._pendingCallbacks = null;
<ide> },
<ide>
<ide> /**
<ide> var ReactCompositeComponentMixin = assign({},
<ide> // Reset pending fields
<ide> this._pendingState = null;
<ide> this._pendingForceUpdate = false;
<add> this._pendingCallbacks = null;
<add> this._pendingElement = null;
<add>
<ide> ReactComponent.Mixin.unmountComponent.call(this);
<ide>
<ide> // Delete the reference from the instance to this internal representation
<ide> var ReactCompositeComponentMixin = assign({},
<ide> return;
<ide> }
<ide>
<del> ReactComponent.Mixin.receiveComponent.call(
<del> this,
<del> nextElement,
<del> transaction
<del> );
<add> this._pendingElement = nextElement;
<add> this.performUpdateIfNecessary(transaction);
<ide> },
<ide>
<ide> /** | 3 |
Go | Go | add lookupdevice() helper | e01b71cebeb96755641a18762dea5b843f107bee | <ide><path>runtime/graphdriver/devmapper/deviceset.go
<ide> func (devices *DeviceSet) saveMetadata() error {
<ide> return nil
<ide> }
<ide>
<add>func (devices *DeviceSet) lookupDevice(hash string) (*DevInfo, error) {
<add> info := devices.Devices[hash]
<add> if info == nil {
<add> return nil, fmt.Errorf("Unknown device %s", hash)
<add> }
<add> return info, nil
<add>}
<add>
<ide> func (devices *DeviceSet) registerDevice(id int, hash string, size uint64) (*DevInfo, error) {
<ide> utils.Debugf("registerDevice(%v, %v)", id, hash)
<ide> info := &DevInfo{
<ide> func (devices *DeviceSet) loadMetaData() error {
<ide> }
<ide>
<ide> func (devices *DeviceSet) setupBaseImage() error {
<del> oldInfo := devices.Devices[""]
<add> oldInfo, _ := devices.lookupDevice("")
<ide> if oldInfo != nil && oldInfo.Initialized {
<ide> return nil
<ide> }
<ide> func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
<ide> devices.Lock()
<ide> defer devices.Unlock()
<ide>
<del> if devices.Devices[hash] != nil {
<del> return fmt.Errorf("hash %s already exists", hash)
<add> if info, _ := devices.lookupDevice(hash); info != nil {
<add> return fmt.Errorf("device %s already exists", hash)
<ide> }
<ide>
<del> baseInfo := devices.Devices[baseHash]
<del> if baseInfo == nil {
<del> return fmt.Errorf("Error adding device for '%s': can't find device for parent '%s'", hash, baseHash)
<add> baseInfo, err := devices.lookupDevice(baseHash)
<add> if err != nil {
<add> return err
<ide> }
<ide>
<ide> baseInfo.lock.Lock()
<ide> func (devices *DeviceSet) DeleteDevice(hash string) error {
<ide> devices.Lock()
<ide> defer devices.Unlock()
<ide>
<del> info := devices.Devices[hash]
<del> if info == nil {
<del> return fmt.Errorf("Unknown device %s", hash)
<add> info, err := devices.lookupDevice(hash)
<add> if err != nil {
<add> return err
<ide> }
<ide>
<ide> info.lock.Lock()
<ide> func (devices *DeviceSet) Shutdown() error {
<ide> info.lock.Unlock()
<ide> }
<ide>
<del> info := devices.Devices[""]
<add> info, _ := devices.lookupDevice("")
<ide> if info != nil {
<ide> if err := devices.deactivateDevice(info); err != nil {
<ide> utils.Debugf("Shutdown deactivate base , error: %s\n", err)
<ide> func (devices *DeviceSet) MountDevice(hash, path string, mountLabel string) erro
<ide> devices.Lock()
<ide> defer devices.Unlock()
<ide>
<del> info := devices.Devices[hash]
<del> if info == nil {
<del> return fmt.Errorf("Unknown device %s", hash)
<add> info, err := devices.lookupDevice(hash)
<add> if err != nil {
<add> return err
<ide> }
<ide>
<ide> info.lock.Lock()
<ide> func (devices *DeviceSet) MountDevice(hash, path string, mountLabel string) erro
<ide> var flags uintptr = sysMsMgcVal
<ide>
<ide> mountOptions := label.FormatMountLabel("discard", mountLabel)
<del> err := sysMount(info.DevName(), path, "ext4", flags, mountOptions)
<add> err = sysMount(info.DevName(), path, "ext4", flags, mountOptions)
<ide> if err != nil && err == sysEInval {
<ide> mountOptions = label.FormatMountLabel(mountLabel, "")
<ide> err = sysMount(info.DevName(), path, "ext4", flags, mountOptions)
<ide> func (devices *DeviceSet) UnmountDevice(hash string, mode UnmountMode) error {
<ide> devices.Lock()
<ide> defer devices.Unlock()
<ide>
<del> info := devices.Devices[hash]
<del> if info == nil {
<del> return fmt.Errorf("UnmountDevice: no such device %s\n", hash)
<add> info, err := devices.lookupDevice(hash)
<add> if err != nil {
<add> return err
<ide> }
<ide>
<ide> info.lock.Lock()
<ide> func (devices *DeviceSet) HasDevice(hash string) bool {
<ide> devices.Lock()
<ide> defer devices.Unlock()
<ide>
<del> return devices.Devices[hash] != nil
<add> info, _ := devices.lookupDevice(hash)
<add> return info != nil
<ide> }
<ide>
<ide> func (devices *DeviceSet) HasInitializedDevice(hash string) bool {
<ide> devices.Lock()
<ide> defer devices.Unlock()
<ide>
<del> info := devices.Devices[hash]
<add> info, _ := devices.lookupDevice(hash)
<ide> return info != nil && info.Initialized
<ide> }
<ide>
<ide> func (devices *DeviceSet) HasActivatedDevice(hash string) bool {
<ide> devices.Lock()
<ide> defer devices.Unlock()
<ide>
<del> info := devices.Devices[hash]
<add> info, _ := devices.lookupDevice(hash)
<ide> if info == nil {
<ide> return false
<ide> }
<ide> func (devices *DeviceSet) GetDeviceStatus(hash string) (*DevStatus, error) {
<ide> devices.Lock()
<ide> defer devices.Unlock()
<ide>
<del> info := devices.Devices[hash]
<del> if info == nil {
<del> return nil, fmt.Errorf("No device %s", hash)
<add> info, err := devices.lookupDevice(hash)
<add> if err != nil {
<add> return nil, err
<ide> }
<ide>
<ide> info.lock.Lock() | 1 |
Go | Go | add lxc support for restricting proc | 0779a8c3287fbf7ff1938df10897b551b839cbee | <ide><path>daemon/execdriver/lxc/driver.go
<ide> func init() {
<ide> }
<ide>
<ide> type driver struct {
<del> root string // root path for the driver to use
<del> apparmor bool
<del> sharedRoot bool
<add> root string // root path for the driver to use
<add> apparmor bool
<add> sharedRoot bool
<add> restrictionPath string
<ide> }
<ide>
<ide> func NewDriver(root string, apparmor bool) (*driver, error) {
<ide> // setup unconfined symlink
<ide> if err := linkLxcStart(root); err != nil {
<ide> return nil, err
<ide> }
<add> restrictionPath := filepath.Join(root, "empty")
<add> if err := os.MkdirAll(restrictionPath, 0700); err != nil {
<add> return nil, err
<add> }
<ide> return &driver{
<del> apparmor: apparmor,
<del> root: root,
<del> sharedRoot: rootIsShared(),
<add> apparmor: apparmor,
<add> root: root,
<add> sharedRoot: rootIsShared(),
<add> restrictionPath: restrictionPath,
<ide> }, nil
<ide> }
<ide>
<ide> func (d *driver) generateLXCConfig(c *execdriver.Command) (string, error) {
<ide>
<ide> if err := LxcTemplateCompiled.Execute(fo, struct {
<ide> *execdriver.Command
<del> AppArmor bool
<del> ProcessLabel string
<del> MountLabel string
<add> AppArmor bool
<add> ProcessLabel string
<add> MountLabel string
<add> RestrictionSource string
<ide> }{
<del> Command: c,
<del> AppArmor: d.apparmor,
<del> ProcessLabel: process,
<del> MountLabel: mount,
<add> Command: c,
<add> AppArmor: d.apparmor,
<add> ProcessLabel: process,
<add> MountLabel: mount,
<add> RestrictionSource: d.restrictionPath,
<ide> }); err != nil {
<ide> return "", err
<ide> }
<ide><path>daemon/execdriver/lxc/lxc_template.go
<ide> lxc.mount.entry = {{$value.Source}} {{escapeFstabSpaces $ROOTFS}}/{{escapeFstabS
<ide> {{if .AppArmor}}
<ide> lxc.aa_profile = unconfined
<ide> {{else}}
<del>#lxc.aa_profile = unconfined
<add># not unconfined
<ide> {{end}}
<add>{{else}}
<add># restrict access to proc
<add>lxc.mount.entry = {{.RestrictionSource}} {{escapeFstabSpaces $ROOTFS}}/proc/sys none bind,ro 0 0
<add>lxc.mount.entry = {{.RestrictionSource}} {{escapeFstabSpaces $ROOTFS}}/proc/irq none bind,ro 0 0
<add>lxc.mount.entry = {{.RestrictionSource}} {{escapeFstabSpaces $ROOTFS}}/proc/acpi none bind,ro 0 0
<add>lxc.mount.entry = {{escapeFstabSpaces $ROOTFS}}/dev/null {{escapeFstabSpaces $ROOTFS}}/proc/sysrq-trigger none bind,ro 0 0
<add>lxc.mount.entry = {{escapeFstabSpaces $ROOTFS}}/dev/null {{escapeFstabSpaces $ROOTFS}}/proc/kcore none bind,ro 0 0
<ide> {{end}}
<ide>
<ide> # limits | 2 |
Text | Text | add section on unit testing middleware to docs | 7edcaf2db18951263f7ab7f9fe357606ac24217e | <ide><path>docs/recipes/WritingTests.md
<ide> describe('todos reducer', () => {
<ide> });
<ide> ```
<ide>
<add>### Middleware
<add>
<add>Middleware functions wrap behavior of `dispatch` calls in Redux, so to test this modified behavior we need to mock the behavior of the `dispatch` call.
<add>
<add>#### Example
<add>
<add>```js
<add>import expect from 'expect';
<add>import * as types from '../../constants/ActionTypes';
<add>import singleDispatch from '../../middleware/singleDispatch';
<add>
<add>const fakeStore = fakeData => ({
<add> getState() {
<add> return fakeData;
<add> }
<add>});
<add>
<add>const dispatchWithStoreOf = (storeData, action) => {
<add> let dispatched = null;
<add> const dispatch = singleDispatch(fakeStore(storeData))(action => dispatched = action);
<add> dispatch(action);
<add> return dispatched;
<add>};
<add>
<add>describe('middleware', () => {
<add> it('should dispatch if store is empty', () => {
<add> const action = {
<add> type: types.ADD_TODO
<add> };
<add>
<add> expect(
<add> dispatchWithStoreOf({}, action)
<add> ).toEqual(action);
<add> });
<add>
<add> it('should not dispatch if store already has type', () => {
<add> const action = {
<add> type: types.ADD_TODO
<add> };
<add>
<add> expect(
<add> dispatchWithStoreOf({
<add> [types.ADD_TODO]: 'dispatched'
<add> }, action)
<add> ).toNotExist();
<add> });
<add>});
<add>```
<add>
<ide> ### Components
<ide>
<ide> A nice thing about React components is that they are usually small and only rely on their props. That makes them easy to test. | 1 |
Javascript | Javascript | change babel/register to babel-register | 245ef7c2be5ba5e417b3ccab661561e421b706e7 | <ide><path>index.js
<ide> /* eslint-disable no-process-exit */
<del>require('babel/register');
<add>require('babel-register');
<ide> require('dotenv').load();
<ide>
<ide> var Rx = require('rx'), | 1 |
Javascript | Javascript | verify errors thrown from fs stat apis | 5eccbb09fa04ccc3ad3a5624d0552b71233dff3f | <ide><path>test/parallel/test-fs-error-messages.js
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<ide> 'use strict';
<del>require('../common');
<add>const common = require('../common');
<ide> const fixtures = require('../common/fixtures');
<ide> const assert = require('assert');
<ide> const fs = require('fs');
<ide> const existingFile = fixtures.path('exit.js');
<ide> const existingFile2 = fixtures.path('create-file.js');
<ide> const existingDir = fixtures.path('empty');
<ide> const existingDir2 = fixtures.path('keys');
<add>const uv = process.binding('uv');
<ide>
<ide> // ASYNC_CALL
<ide>
<del>fs.stat(fn, function(err) {
<add>fs.stat(fn, common.mustCall((err) => {
<ide> assert.strictEqual(fn, err.path);
<del> assert.ok(err.message.includes(fn));
<del>});
<del>
<del>fs.lstat(fn, function(err) {
<del> assert.ok(err.message.includes(fn));
<del>});
<add> assert.strictEqual(
<add> err.message,
<add> `ENOENT: no such file or directory, stat '${fn}'`);
<add> assert.strictEqual(err.errno, uv.UV_ENOENT);
<add> assert.strictEqual(err.code, 'ENOENT');
<add> assert.strictEqual(err.syscall, 'stat');
<add>}));
<add>
<add>fs.lstat(fn, common.mustCall((err) => {
<add> assert.strictEqual(fn, err.path);
<add> assert.strictEqual(
<add> err.message,
<add> `ENOENT: no such file or directory, lstat '${fn}'`);
<add> assert.strictEqual(err.errno, uv.UV_ENOENT);
<add> assert.strictEqual(err.code, 'ENOENT');
<add> assert.strictEqual(err.syscall, 'lstat');
<add>}));
<add>
<add>{
<add> const fd = fs.openSync(existingFile, 'r');
<add> fs.closeSync(fd);
<add> fs.fstat(fd, common.mustCall((err) => {
<add> assert.strictEqual(err.message, 'EBADF: bad file descriptor, fstat');
<add> assert.strictEqual(err.errno, uv.UV_EBADF);
<add> assert.strictEqual(err.code, 'EBADF');
<add> assert.strictEqual(err.syscall, 'fstat');
<add> }));
<add>}
<ide>
<del>fs.readlink(fn, function(err) {
<add>fs.readlink(fn, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(fn));
<del>});
<add>}));
<ide>
<del>fs.link(fn, 'foo', function(err) {
<add>fs.link(fn, 'foo', common.mustCall((err) => {
<ide> assert.ok(err.message.includes(fn));
<del>});
<add>}));
<ide>
<del>fs.link(existingFile, existingFile2, function(err) {
<add>fs.link(existingFile, existingFile2, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(existingFile));
<ide> assert.ok(err.message.includes(existingFile2));
<del>});
<add>}));
<ide>
<del>fs.symlink(existingFile, existingFile2, function(err) {
<add>fs.symlink(existingFile, existingFile2, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(existingFile));
<ide> assert.ok(err.message.includes(existingFile2));
<del>});
<add>}));
<ide>
<del>fs.unlink(fn, function(err) {
<add>fs.unlink(fn, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(fn));
<del>});
<add>}));
<ide>
<del>fs.rename(fn, 'foo', function(err) {
<add>fs.rename(fn, 'foo', common.mustCall((err) => {
<ide> assert.ok(err.message.includes(fn));
<del>});
<add>}));
<ide>
<del>fs.rename(existingDir, existingDir2, function(err) {
<add>fs.rename(existingDir, existingDir2, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(existingDir));
<ide> assert.ok(err.message.includes(existingDir2));
<del>});
<add>}));
<ide>
<del>fs.rmdir(fn, function(err) {
<add>fs.rmdir(fn, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(fn));
<del>});
<add>}));
<ide>
<del>fs.mkdir(existingFile, 0o666, function(err) {
<add>fs.mkdir(existingFile, 0o666, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(existingFile));
<del>});
<add>}));
<ide>
<del>fs.rmdir(existingFile, function(err) {
<add>fs.rmdir(existingFile, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(existingFile));
<del>});
<add>}));
<ide>
<del>fs.chmod(fn, 0o666, function(err) {
<add>fs.chmod(fn, 0o666, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(fn));
<del>});
<add>}));
<ide>
<del>fs.open(fn, 'r', 0o666, function(err) {
<add>fs.open(fn, 'r', 0o666, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(fn));
<del>});
<add>}));
<ide>
<del>fs.readFile(fn, function(err) {
<add>fs.readFile(fn, common.mustCall((err) => {
<ide> assert.ok(err.message.includes(fn));
<del>});
<add>}));
<ide>
<ide> // Sync
<ide>
<ide> try {
<ide> fs.statSync(fn);
<ide> } catch (err) {
<ide> errors.push('stat');
<del> assert.ok(err.message.includes(fn));
<add> assert.strictEqual(fn, err.path);
<add> assert.strictEqual(
<add> err.message,
<add> `ENOENT: no such file or directory, stat '${fn}'`);
<add> assert.strictEqual(err.errno, uv.UV_ENOENT);
<add> assert.strictEqual(err.code, 'ENOENT');
<add> assert.strictEqual(err.syscall, 'stat');
<ide> }
<ide>
<ide> try {
<ide> try {
<ide> fs.lstatSync(fn);
<ide> } catch (err) {
<ide> errors.push('lstat');
<del> assert.ok(err.message.includes(fn));
<add> assert.strictEqual(fn, err.path);
<add> assert.strictEqual(
<add> err.message,
<add> `ENOENT: no such file or directory, lstat '${fn}'`);
<add> assert.strictEqual(err.errno, uv.UV_ENOENT);
<add> assert.strictEqual(err.code, 'ENOENT');
<add> assert.strictEqual(err.syscall, 'lstat');
<add>}
<add>
<add>try {
<add> ++expected;
<add> const fd = fs.openSync(existingFile, 'r');
<add> fs.closeSync(fd);
<add> fs.fstatSync(fd);
<add>} catch (err) {
<add> errors.push('fstat');
<add> assert.strictEqual(err.message, 'EBADF: bad file descriptor, fstat');
<add> assert.strictEqual(err.errno, uv.UV_EBADF);
<add> assert.strictEqual(err.code, 'EBADF');
<add> assert.strictEqual(err.syscall, 'fstat');
<ide> }
<ide>
<ide> try {
<ide> try {
<ide> assert.ok(err.message.includes(fn));
<ide> }
<ide>
<del>process.on('exit', function() {
<del> assert.strictEqual(
<del> expected, errors.length,
<del> `Test fs sync exceptions raised, got ${errors.length} expected ${expected}`
<del> );
<del>});
<add>assert.strictEqual(expected, errors.length); | 1 |
Ruby | Ruby | provide more information about bad sf urls | 24b4d445cf289a83e7cc22ff1844a5e788a0a62a | <ide><path>Library/Homebrew/cmd/audit.rb
<ide> def audit_urls
<ide> end
<ide>
<ide> if p =~ %r[^http://prdownloads\.]
<del> problem "Update this url (don't use prdownloads)."
<add> problem "Update this url (don't use prdownloads). See:\nhttp://librelist.com/browser/homebrew/2011/1/12/prdownloads-is-bad/"
<ide> end
<ide>
<ide> if p =~ %r[^http://\w+\.dl\.] | 1 |
Javascript | Javascript | use safari 7 | 9693a426e3814c0c2d83802015ae6cd8cfec8e3e | <ide><path>karma-shared.conf.js
<ide> module.exports = function(config, specificOptions) {
<ide> 'SL_Safari': {
<ide> base: 'SauceLabs',
<ide> browserName: 'safari',
<del> platform: 'Mac 10.8',
<del> version: '6'
<add> platform: 'OS X 10.9',
<add> version: '7'
<ide> },
<ide> 'SL_IE_8': {
<ide> base: 'SauceLabs', | 1 |
Ruby | Ruby | fix args to ruby method | 2dac10a71146d44cfa8dd985a9187ed5384d9e7f | <ide><path>Library/Homebrew/formula.rb
<ide> def rake *args
<ide> system "#{ruby_bin}/rake", *args
<ide> end
<ide>
<del> def ruby
<add> def ruby *args
<ide> system "#{ruby_bin}/ruby", *args
<ide> end
<ide> | 1 |
Text | Text | replace rct_export with rct_export_method | 127649962dca686b86b55a4683c0cc640dd9fe98 | <ide><path>README.md
<ide> var GeoInfo = React.createClass({
<ide>
<ide> ## Extensibility
<ide>
<del>It is certainly possible to create a great app using React Native without writing a single line of native code, but React Native is also designed to be easily extended with custom native views and modules - that means you can reuse anything you've already built, and can import and use your favorite native libraries. To create a simple module in iOS, create a new class that implements the `RCTBridgeModule` protocol, and add `RCT_EXPORT` to the function you want to make available in JavaScript.
<add>It is certainly possible to create a great app using React Native without writing a single line of native code, but React Native is also designed to be easily extended with custom native views and modules - that means you can reuse anything you've already built, and can import and use your favorite native libraries. To create a simple module in iOS, create a new class that implements the `RCTBridgeModule` protocol, and wrap the function that you want to make available to JavaScript in `RCT_EXPORT_METHOD`. Additionally, the class itself must be explicitly exported with `RCT_EXPORT_MODULE();`.
<ide>
<ide> ```objc
<ide> // Objective-C
<ide> It is certainly possible to create a great app using React Native without writin
<ide> @end
<ide>
<ide> @implementation MyCustomModule
<del>- (void)processString:(NSString *)input callback:(RCTResponseSenderBlock)callback
<add>
<add>RCT_EXPORT_MODULE();
<add>
<add>// Available as NativeModules.MyCustomModule.processString
<add>RCT_EXPORT_METHOD(processString:(NSString *)input callback:(RCTResponseSenderBlock)callback)
<ide> {
<del> RCT_EXPORT(); // available as NativeModules.MyCustomModule.processString
<ide> callback(@[[input stringByReplacingOccurrencesOfString:@"Goodbye" withString:@"Hello"]]);
<ide> }
<ide> @end
<ide><path>docs/NativeModulesIOS.md
<ide> Native module is just an Objectve-C class that implements `RCTBridgeModule` prot
<ide> @end
<ide> ```
<ide>
<del>React Native will not expose any methods of `CalendarManager` to JavaScript unless explicitly asked. Fortunately this is pretty easy with `RCT_EXPORT`:
<add>React Native will not expose any methods of `CalendarManager` to JavaScript unless explicitly asked. Fortunately this is pretty easy with `RCT_EXPORT_METHOD`:
<ide>
<ide> ```objective-c
<ide> // CalendarManager.m
<ide> @implementation CalendarManager
<ide>
<del>- (void)addEventWithName:(NSString *)name location:(NSString *)location
<add>RCT_EXPORT_MODULE();
<add>
<add>RCT_EXPORT_METHOD(addEvent:(NSString *)name location:(NSString *)location)
<ide> {
<del> RCT_EXPORT();
<ide> RCTLogInfo(@"Pretending to create an event %@ at %@", name, location);
<ide> }
<ide>
<ide> Now from your JavaScript file you can call the method like this:
<ide>
<ide> ```javascript
<ide> var CalendarManager = require('NativeModules').CalendarManager;
<del>CalendarManager.addEventWithName('Birthday Party', '4 Privet Drive, Surrey');
<add>CalendarManager.addEvent('Birthday Party', '4 Privet Drive, Surrey');
<ide> ```
<ide>
<del>Notice that the exported method name was generated from first part of Objective-C selector. Sometimes it results in a non-idiomatic JavaScript name (like the one in our example). You can change the name by supplying an optional argument to `RCT_EXPORT`, e.g. `RCT_EXPORT(addEvent)`.
<del>
<del>The return type of the method should always be `void`. React Native bridge is asynchronous, so the only way to pass a result to JavaScript is by using callbacks or emitting events (see below).
<add>The return type of bridge methods is always `void`. React Native bridge is asynchronous, so the only way to pass a result to JavaScript is by using callbacks or emitting events (see below).
<ide>
<ide> ## Argument types
<ide>
<ide> React Native supports several types of arguments that can be passed from JavaScr
<ide> In our `CalendarManager` example, if we want to pass event date to native, we have to convert it to a string or a number:
<ide>
<ide> ```objective-c
<del>- (void)addEventWithName:(NSString *)name location:(NSString *)location date:(NSInteger)secondsSinceUnixEpoch
<add>RCT_EXPORT_METHOD(addEvent:(NSString *)name location:(NSString *)location date:(NSInteger)secondsSinceUnixEpoch)
<ide> {
<del> RCT_EXPORT(addEvent);
<ide> NSDate *date = [NSDate dateWithTimeIntervalSince1970:secondsSinceUnixEpoch];
<ide> }
<ide> ```
<ide> As `CalendarManager.addEvent` method gets more and more complex, the number of a
<ide> ```objective-c
<ide> #import "RCTConvert.h"
<ide>
<del>- (void)addEventWithName:(NSString *)name details:(NSDictionary *)details
<add>RCT_EXPORT_METHOD(addEvent:(NSString *)name details:(NSDictionary *)details)
<ide> {
<del> RCT_EXPORT(addEvent);
<ide> NSString *location = [RCTConvert NSString:details[@"location"]]; // ensure location is a string
<ide> ...
<ide> }
<ide> CalendarManager.addEvent('Birthday Party', {
<ide> Native module also supports a special kind of argument- a callback. In most cases it is used to provide the function call result to JavaScript.
<ide>
<ide> ```objective-c
<del>- (void)findEvents:(RCTResponseSenderBlock)callback
<add>RCT_EXPORT_METHOD(findEvents:(RCTResponseSenderBlock)callback)
<ide> {
<del> RCT_EXPORT();
<ide> NSArray *events = ...
<ide> callback(@[[NSNull null], events]);
<ide> }
<ide> The native module should not have any assumptions about what thread it is being
<ide>
<ide>
<ide> ```objective-c
<del>- (void)addEventWithName:(NSString *)name callback:(RCTResponseSenderBlock)callback
<add>RCT_EXPORT_METHOD(addEvent:(NSString *)name callback:(RCTResponseSenderBlock)callback)
<ide> {
<del> RCT_EXPORT(addEvent);
<ide> dispatch_async(dispatch_get_main_queue(), ^{
<ide> // Call iOS API on main thread
<ide> ... | 2 |
Javascript | Javascript | minimize time for child_process benchmark | 32f77ff8ce3b67ba14943738b28e6912b44a1454 | <ide><path>test/sequential/test-benchmark-child-process.js
<ide> const path = require('path');
<ide>
<ide> const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js');
<ide>
<del>const child = fork(runjs, ['--set', 'dur=0.1',
<add>const child = fork(runjs, ['--set', 'dur=0',
<ide> '--set', 'n=1',
<ide> '--set', 'len=1',
<add> '--set', 'params=1',
<add> '--set', 'methodName=execSync',
<ide> 'child_process'],
<ide> {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}});
<ide> child.on('exit', (code, signal) => { | 1 |
Ruby | Ruby | avoid array#to_s and array(nil)" | 7f0fcadd3650eaee5bd6a8ab8032ed3c5627385b | <ide><path>activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb
<ide> def default_exception_handler(exception, locale, key, options)
<ide> # Merges the given locale, key and scope into a single array of keys.
<ide> # Splits keys that contain dots into multiple keys. Makes sure all
<ide> # keys are Symbols.
<del> def normalize_translation_keys(*keys)
<del> normalized = []
<del> keys.each do |key|
<del> case key
<del> when Array
<del> normalized.concat normalize_translation_keys(*key)
<del> when nil
<del> # skip
<del> else
<del> normalized.concat key.to_s.split('.').map { |sub| sub.to_sym }
<del> end
<del> end
<del> normalized
<add> def normalize_translation_keys(locale, key, scope)
<add> keys = [locale] + Array(scope) + [key]
<add> keys = keys.map { |k| k.to_s.split(/\./) }
<add> keys.flatten.map { |k| k.to_sym }
<ide> end
<ide> end
<ide> end | 1 |
Go | Go | add test and move one from rm to rmi | c68e6b15a5d128eee1637c55471907d90cb828d2 | <ide><path>integration-cli/docker_cli_rm_test.go
<ide> func TestRmContainerOrphaning(t *testing.T) {
<ide> logDone("rm - container orphaning")
<ide> }
<ide>
<del>func TestRmTagWithExistingContainers(t *testing.T) {
<del> container := "test-delete-tag"
<del> newtag := "busybox:newtag"
<del> bb := "busybox:latest"
<del> if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "tag", bb, newtag)); err != nil {
<del> t.Fatalf("Could not tag busybox: %v: %s", err, out)
<add>func TestRmInvalidContainer(t *testing.T) {
<add> if _, _, err := runCommandWithOutput(exec.Command(dockerBinary, "rm", "unknown")); err == nil {
<add> t.Fatal("Expected error on rm unknown container, got none")
<ide> }
<del> if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "run", "--name", container, bb, "/bin/true")); err != nil {
<del> t.Fatalf("Could not run busybox: %v: %s", err, out)
<del> }
<del> out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "rmi", newtag))
<del> if err != nil {
<del> t.Fatalf("Could not remove tag %s: %v: %s", newtag, err, out)
<del> }
<del> if d := strings.Count(out, "Untagged: "); d != 1 {
<del> t.Fatalf("Expected 1 untagged entry got %d: %q", d, out)
<del> }
<del>
<del> deleteAllContainers()
<del>
<del> logDone("rm - delete tag with existing containers")
<ide>
<add> logDone("rm - delete unknown container")
<ide> }
<ide>
<ide> func createRunningContainer(t *testing.T, name string) {
<ide><path>integration-cli/docker_cli_rmi_test.go
<ide> func TestRmiTag(t *testing.T) {
<ide> }
<ide> logDone("tag,rmi- tagging the same images multiple times then removing tags")
<ide> }
<add>
<add>func TestRmiTagWithExistingContainers(t *testing.T) {
<add> container := "test-delete-tag"
<add> newtag := "busybox:newtag"
<add> bb := "busybox:latest"
<add> if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "tag", bb, newtag)); err != nil {
<add> t.Fatalf("Could not tag busybox: %v: %s", err, out)
<add> }
<add> if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "run", "--name", container, bb, "/bin/true")); err != nil {
<add> t.Fatalf("Could not run busybox: %v: %s", err, out)
<add> }
<add> out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "rmi", newtag))
<add> if err != nil {
<add> t.Fatalf("Could not remove tag %s: %v: %s", newtag, err, out)
<add> }
<add> if d := strings.Count(out, "Untagged: "); d != 1 {
<add> t.Fatalf("Expected 1 untagged entry got %d: %q", d, out)
<add> }
<add>
<add> deleteAllContainers()
<add>
<add> logDone("rmi - delete tag with existing containers")
<add>} | 2 |
Text | Text | add api docs for secrets | 0bcb65ccbae17bf9370191bb295548d232569b93 | <ide><path>docs/reference/api/docker_remote_api_v1.25.md
<ide> List containers
<ide> - `volume`=(`<volume name>` or `<mount point destination>`)
<ide> - `network`=(`<network id>` or `<network name>`)
<ide> - `health`=(`starting`|`healthy`|`unhealthy`|`none`)
<del>
<add>
<ide> **Status codes**:
<ide>
<ide> - **200** – no error
<ide> Get details on a task
<ide> - **404** – unknown task
<ide> - **500** – server error
<ide>
<add>## 3.11 Secrets
<add>
<add>**Note**: Secret operations require the engine to be part of a swarm.
<add>
<add>### List secrets
<add>
<add>`GET /secrets`
<add>
<add>List secrets
<add>
<add>**Example request**:
<add>
<add> GET /secrets HTTP/1.1
<add>
<add>**Example response**:
<add>
<add> [
<add> {
<add> "ID": "ktnbjxoalbkvbvedmg1urrz8h",
<add> "Version": {
<add> "Index": 11
<add> },
<add> "CreatedAt": "2016-11-05T01:20:17.327670065Z",
<add> "UpdatedAt": "2016-11-05T01:20:17.327670065Z",
<add> "Spec": {
<add> "Name": "app-dev.crt"
<add> },
<add> "Digest": "sha256:11d7c6f38253b73e608153c9f662a191ae605e1a3d9b756b0b3426388f91d3fa",
<add> "SecretSize": 31
<add> }
<add> ]
<add>
<add>
<add>**Query parameters**:
<add>
<add>- **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the secrets list. Available filters:
<add> - `names=<secret name>`
<add>
<add>**Status codes**:
<add>
<add>- **200** – no error
<add>
<add>### Create a secret
<add>
<add>`POST /secrets/create`
<add>
<add>Create a secret
<add>
<add>**Example request**:
<add>
<add> POST /secrets/create HTTP/1.1
<add> Content-Type: application/json
<add>
<add> {
<add> "Name": "app-key.crt",
<add> "Labels": {
<add> "foo": "bar"
<add> },
<add> "Data": "VEhJUyBJUyBOT1QgQSBSRUFMIENFUlRJRklDQVRFCg=="
<add> }
<add>
<add>**Example response**:
<add>
<add> HTTP/1.1 201 Created
<add> Content-Type: application/json
<add>
<add> {
<add> "ID": "ktnbjxoalbkvbvedmg1urrz8h"
<add> }
<add>
<add>**Status codes**:
<add>
<add>- **201** – no error
<add>- **406** – server error or node is not part of a swarm
<add>- **409** – name conflicts with an existing object
<add>
<add>**JSON Parameters**:
<add>
<add>- **Name** – User-defined name for the secret.
<add>- **Labels** – A map of labels to associate with the secret (e.g., `{"key":"value", "key2":"value2"}`).
<add>- **Data** – Base64-url-safe-encoded secret data
<add>
<add>### Inspect a secret
<add>
<add>`GET /secrets/(secret id)`
<add>
<add>Get details on a secret
<add>
<add>**Example request**:
<add>
<add> GET /secrets/ktnbjxoalbkvbvedmg1urrz8h HTTP/1.1
<add>
<add>**Example response**:
<add>
<add> {
<add> "ID": "ktnbjxoalbkvbvedmg1urrz8h",
<add> "Version": {
<add> "Index": 11
<add> },
<add> "CreatedAt": "2016-11-05T01:20:17.327670065Z",
<add> "UpdatedAt": "2016-11-05T01:20:17.327670065Z",
<add> "Spec": {
<add> "Name": "app-dev.crt"
<add> },
<add> "Digest": "sha256:11d7c6f38253b73e608153c9f662a191ae605e1a3d9b756b0b3426388f91d3fa",
<add> "SecretSize": 31
<add> }
<add>
<add>**Status codes**:
<add>
<add>- **200** – no error
<add>- **404** – unknown secret
<add>- **500** – server error
<add>
<add>### Remove a secret
<add>
<add>`DELETE /secrets/(id)`
<add>
<add>Remove the secret `id` from the secret store
<add>
<add>**Example request**:
<add>
<add> DELETE /secrets/ktnbjxoalbkvbvedmg1urrz8h HTTP/1.1
<add>
<add>**Example response**:
<add>
<add> HTTP/1.1 204 No Content
<add>
<ide> # 4. Going further
<ide>
<ide> ## 4.1 Inside `docker run` | 1 |
Go | Go | implement maintainer to builder | 92e98c66af7543f9a9d6c1a223333201b39aa6dc | <ide><path>builder.go
<ide> func (builder *Builder) clearTmp(containers, images map[string]struct{}) {
<ide> func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, error) {
<ide> var (
<ide> image, base *Image
<add> maintainer string
<ide> tmpContainers map[string]struct{} = make(map[string]struct{})
<ide> tmpImages map[string]struct{} = make(map[string]struct{})
<ide> )
<ide> func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, e
<ide> }
<ide> }
<ide>
<add> break
<add> case "mainainer":
<add> fmt.Fprintf(stdout, "MAINTAINER %s\n", arguments)
<add> maintainer = arguments
<ide> break
<ide> case "run":
<ide> fmt.Fprintf(stdout, "RUN %s\n", arguments)
<ide> func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, e
<ide> }
<ide>
<ide> // Commit the container
<del> base, err = builder.Commit(c, "", "", "", "", nil)
<add> base, err = builder.Commit(c, "", "", "", maintainer, nil)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<ide> func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, e
<ide> if len(tmp) != 2 {
<ide> return nil, fmt.Errorf("Invalid INSERT format")
<ide> }
<del> sourceUrl := strings.Trim(tmp[0], "")
<add> sourceUrl := strings.Trim(tmp[0], " ")
<ide> destPath := strings.Trim(tmp[1], " ")
<ide> fmt.Fprintf(stdout, "COPY %s to %s in %s\n", sourceUrl, destPath, base.ShortId())
<ide>
<ide> func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, e
<ide> return nil, err
<ide> }
<ide>
<del> base, err = builder.Commit(c, "", "", "", "", nil)
<add> base, err = builder.Commit(c, "", "", "", maintainer, nil)
<ide> if err != nil {
<ide> return nil, err
<ide> } | 1 |
Javascript | Javascript | make assert.assertionerror instance of error | c420c89dbd84cc9b7460f25126dd873627e9accf | <ide><path>lib/assert.js
<ide> assert.AssertionError = function AssertionError (options) {
<ide> Error.captureStackTrace(this, stackStartFunction);
<ide> }
<ide> };
<add>process.inherits(assert.AssertionError, Error);
<ide>
<ide> assert.AssertionError.prototype.toString = function() {
<ide> if (this.message) { | 1 |
Mixed | Javascript | remove index and datasetindex from element | a3392e0e59ae77a9c081b4c14de2c95a35422e18 | <ide><path>docs/getting-started/v3-migration.md
<ide> Chart.js is no longer providing the `Chart.bundle.js` and `Chart.bundle.min.js`.
<ide> ##### Time Scale
<ide>
<ide> * `getValueForPixel` now returns milliseconds since the epoch
<add>
<add>#### Controllers
<add>
<add>##### Core Controller
<add>
<add>* The first parameter to `updateHoverStyle` is now an array of objects containing the `element`, `datasetIndex`, and `index`
<add>
<add>##### Dataset Controllers
<add>
<add>* `setHoverStyle` now additionally takes the `datasetIndex` and `index`
<add>
<add>#### Interactions
<add>
<add>* Interaction mode methods now return an array of objects containing the `element`, `datasetIndex`, and `index`
<ide><path>src/controllers/controller.bar.js
<ide> module.exports = DatasetController.extend({
<ide> var me = this;
<ide> var options = me._resolveDataElementOptions(index);
<ide>
<del> rectangle._datasetIndex = me.index;
<del> rectangle._index = index;
<ide> rectangle._model = {
<ide> backgroundColor: options.backgroundColor,
<ide> borderColor: options.borderColor,
<ide><path>src/controllers/controller.bubble.js
<ide> module.exports = DatasetController.extend({
<ide> var y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(parsed[yScale.id]);
<ide>
<ide> point._options = options;
<del> point._datasetIndex = me.index;
<del> point._index = index;
<ide> point._model = {
<ide> backgroundColor: options.backgroundColor,
<ide> borderColor: options.borderColor,
<ide><path>src/controllers/controller.doughnut.js
<ide> module.exports = DatasetController.extend({
<ide> var options = arc._options || {};
<ide>
<ide> helpers.extend(arc, {
<del> // Utility
<del> _datasetIndex: me.index,
<del> _index: index,
<del>
<ide> // Desired view properties
<ide> _model: {
<ide> backgroundColor: options.backgroundColor,
<ide><path>src/controllers/controller.line.js
<ide> module.exports = DatasetController.extend({
<ide>
<ide> // Update Line
<ide> if (showLine) {
<del> // Utility
<del> line._datasetIndex = me.index;
<ide> // Data
<ide> line._children = points;
<ide> // Model
<ide> module.exports = DatasetController.extend({
<ide> updateElement: function(point, index, reset) {
<ide> var me = this;
<ide> var meta = me.getMeta();
<del> var datasetIndex = me.index;
<ide> var xScale = me._xScale;
<ide> var yScale = me._yScale;
<ide> var lineModel = meta.dataset._model;
<ide> module.exports = DatasetController.extend({
<ide>
<ide> // Utility
<ide> point._options = options;
<del> point._datasetIndex = datasetIndex;
<del> point._index = index;
<ide>
<ide> // Desired view properties
<ide> point._model = {
<ide><path>src/controllers/controller.polarArea.js
<ide> module.exports = DatasetController.extend({
<ide> var options = arc._options || {};
<ide>
<ide> helpers.extend(arc, {
<del> // Utility
<del> _datasetIndex: me.index,
<del> _index: index,
<del>
<ide> // Desired view properties
<ide> _model: {
<ide> backgroundColor: options.backgroundColor,
<ide><path>src/controllers/controller.radar.js
<ide> module.exports = DatasetController.extend({
<ide> config.lineTension = config.tension;
<ide> }
<ide>
<del> // Utility
<del> line._datasetIndex = me.index;
<ide> // Data
<ide> line._children = points;
<ide> line._loop = true;
<ide> module.exports = DatasetController.extend({
<ide>
<ide> // Utility
<ide> point._options = options;
<del> point._datasetIndex = me.index;
<del> point._index = index;
<ide>
<ide> // Desired view properties
<ide> point._model = {
<ide><path>src/core/core.controller.js
<ide> helpers.extend(Chart.prototype, /** @lends Chart */ {
<ide> });
<ide> },
<ide>
<del> updateHoverStyle: function(elements, mode, enabled) {
<add> updateHoverStyle: function(items, mode, enabled) {
<ide> var prefix = enabled ? 'set' : 'remove';
<del> var element, i, ilen;
<add> var meta, item, i, ilen;
<ide>
<del> for (i = 0, ilen = elements.length; i < ilen; ++i) {
<del> element = elements[i];
<del> if (element) {
<del> this.getDatasetMeta(element._datasetIndex).controller[prefix + 'HoverStyle'](element);
<add> if (mode === 'dataset') {
<add> meta = this.getDatasetMeta(items[0].datasetIndex);
<add> meta.controller['_' + prefix + 'DatasetHoverStyle']();
<add> for (i = 0, ilen = meta.data.length; i < ilen; ++i) {
<add> meta.controller[prefix + 'HoverStyle'](meta.data[i], items[0].datasetIndex, i);
<ide> }
<add> return;
<ide> }
<ide>
<del> if (mode === 'dataset') {
<del> this.getDatasetMeta(elements[0]._datasetIndex).controller['_' + prefix + 'DatasetHoverStyle']();
<add> for (i = 0, ilen = items.length; i < ilen; ++i) {
<add> item = items[i];
<add> if (item) {
<add> this.getDatasetMeta(item.datasetIndex).controller[prefix + 'HoverStyle'](item.element, item.datasetIndex, item.index);
<add> }
<ide> }
<ide> },
<ide>
<ide> helpers.extend(Chart.prototype, /** @lends Chart */ {
<ide> }
<ide>
<ide> me._updateHoverStyles();
<del> changed = !helpers.arrayEquals(me.active, me.lastActive);
<add> changed = !helpers._elementsEqual(me.active, me.lastActive);
<ide>
<ide> // Remember Last Actives
<ide> me.lastActive = me.active;
<ide><path>src/core/core.datasetController.js
<ide> helpers.extend(DatasetController.prototype, {
<ide> delete element.$previousStyle;
<ide> },
<ide>
<del> setHoverStyle: function(element) {
<del> var dataset = this.chart.data.datasets[element._datasetIndex];
<del> var index = element._index;
<add> setHoverStyle: function(element, datasetIndex, index) {
<add> var dataset = this.chart.data.datasets[datasetIndex];
<ide> var model = element._model;
<ide> var getHoverColor = helpers.getHoverColor;
<ide>
<ide><path>src/core/core.element.js
<ide> class Element {
<ide>
<ide> constructor(configuration) {
<ide> helpers.extend(this, configuration);
<add>
<add> // this.hidden = false; we assume Element has an attribute called hidden, but do not initialize to save memory
<add>
<ide> this.initialize.apply(this, arguments);
<ide> }
<ide>
<del> initialize() {
<del> this.hidden = false;
<del> }
<add> initialize() {}
<ide>
<ide> pivot(animationsDisabled) {
<ide> var me = this;
<ide><path>src/core/core.interaction.js
<ide> function parseVisibleItems(chart, handler) {
<ide> for (j = 0, jlen = metadata.length; j < jlen; ++j) {
<ide> element = metadata[j];
<ide> if (!element._view.skip) {
<del> handler(element);
<add> handler(element, i, j);
<ide> }
<ide> }
<ide> }
<ide> function parseVisibleItems(chart, handler) {
<ide> function getIntersectItems(chart, position) {
<ide> var elements = [];
<ide>
<del> parseVisibleItems(chart, function(element) {
<add> parseVisibleItems(chart, function(element, datasetIndex, index) {
<ide> if (element.inRange(position.x, position.y)) {
<del> elements.push(element);
<add> elements.push({element, datasetIndex, index});
<ide> }
<ide> });
<ide>
<ide> function getNearestItems(chart, position, intersect, distanceMetric) {
<ide> var minDistance = Number.POSITIVE_INFINITY;
<ide> var nearestItems = [];
<ide>
<del> parseVisibleItems(chart, function(element) {
<add> parseVisibleItems(chart, function(element, datasetIndex, index) {
<ide> if (intersect && !element.inRange(position.x, position.y)) {
<ide> return;
<ide> }
<ide>
<ide> var center = element.getCenterPoint();
<ide> var distance = distanceMetric(position, center);
<ide> if (distance < minDistance) {
<del> nearestItems = [element];
<add> nearestItems = [{element, datasetIndex, index}];
<ide> minDistance = distance;
<ide> } else if (distance === minDistance) {
<ide> // Can have multiple items at the same distance in which case we sort by size
<del> nearestItems.push(element);
<add> nearestItems.push({element, datasetIndex, index});
<ide> }
<ide> });
<ide>
<ide> function indexMode(chart, e, options) {
<ide> }
<ide>
<ide> chart._getSortedVisibleDatasetMetas().forEach(function(meta) {
<del> var element = meta.data[items[0]._index];
<add> var index = items[0].index;
<add> var element = meta.data[index];
<ide>
<ide> // don't count items that are skipped (null data)
<ide> if (element && !element._view.skip) {
<del> elements.push(element);
<add> elements.push({element, datasetIndex: meta.index, index});
<ide> }
<ide> });
<ide>
<ide> module.exports = {
<ide> * @param {Chart} chart - the chart we are returning items from
<ide> * @param {Event} e - the event we are find things at
<ide> * @param {IInteractionOptions} options - options to use during interaction
<del> * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
<add> * @return {Object[]} Array of elements that are under the point. If none are found, an empty array is returned
<ide> */
<ide> index: indexMode,
<ide>
<ide> module.exports = {
<ide> * @param {Chart} chart - the chart we are returning items from
<ide> * @param {Event} e - the event we are find things at
<ide> * @param {IInteractionOptions} options - options to use during interaction
<del> * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
<add> * @return {Object[]} Array of elements that are under the point. If none are found, an empty array is returned
<ide> */
<ide> dataset: function(chart, e, options) {
<ide> var position = getRelativePosition(e, chart);
<ide> module.exports = {
<ide> var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);
<ide>
<ide> if (items.length > 0) {
<del> items = chart.getDatasetMeta(items[0]._datasetIndex).data;
<add> items = [{datasetIndex: items[0].datasetIndex}]; // when mode: 'dataset' we only need to return datasetIndex
<ide> }
<ide>
<ide> return items;
<ide> module.exports = {
<ide> * @function Chart.Interaction.modes.intersect
<ide> * @param {Chart} chart - the chart we are returning items from
<ide> * @param {Event} e - the event we are find things at
<del> * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
<add> * @return {Object[]} Array of elements that are under the point. If none are found, an empty array is returned
<ide> */
<ide> point: function(chart, e) {
<ide> var position = getRelativePosition(e, chart);
<ide> module.exports = {
<ide> * @param {Chart} chart - the chart we are returning items from
<ide> * @param {Event} e - the event we are find things at
<ide> * @param {IInteractionOptions} options - options to use
<del> * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
<add> * @return {Object[]} Array of elements that are under the point. If none are found, an empty array is returned
<ide> */
<ide> nearest: function(chart, e, options) {
<ide> var position = getRelativePosition(e, chart);
<ide> module.exports = {
<ide> * @param {Chart} chart - the chart we are returning items from
<ide> * @param {Event} e - the event we are find things at
<ide> * @param {IInteractionOptions} options - options to use
<del> * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
<add> * @return {Object[]} Array of elements that are under the point. If none are found, an empty array is returned
<ide> */
<ide> x: function(chart, e, options) {
<ide> var position = getRelativePosition(e, chart);
<ide> var items = [];
<ide> var intersectsItem = false;
<ide>
<del> parseVisibleItems(chart, function(element) {
<add> parseVisibleItems(chart, function(element, datasetIndex, index) {
<ide> if (element.inXRange(position.x)) {
<del> items.push(element);
<add> items.push({element, datasetIndex, index});
<ide> }
<ide>
<ide> if (element.inRange(position.x, position.y)) {
<ide> module.exports = {
<ide> * @param {Chart} chart - the chart we are returning items from
<ide> * @param {Event} e - the event we are find things at
<ide> * @param {IInteractionOptions} options - options to use
<del> * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
<add> * @return {Object[]} Array of elements that are under the point. If none are found, an empty array is returned
<ide> */
<ide> y: function(chart, e, options) {
<ide> var position = getRelativePosition(e, chart);
<ide> var items = [];
<ide> var intersectsItem = false;
<ide>
<del> parseVisibleItems(chart, function(element) {
<add> parseVisibleItems(chart, function(element, datasetIndex, index) {
<ide> if (element.inYRange(position.y)) {
<del> items.push(element);
<add> items.push({element, datasetIndex, index});
<ide> }
<ide>
<ide> if (element.inRange(position.x, position.y)) {
<ide><path>src/core/core.tooltip.js
<ide> var positioners = {
<ide> var count = 0;
<ide>
<ide> for (i = 0, len = elements.length; i < len; ++i) {
<del> var el = elements[i];
<add> var el = elements[i].element;
<ide> if (el && el.hasValue()) {
<ide> var pos = el.tooltipPosition();
<ide> x += pos.x;
<ide> var positioners = {
<ide> var i, len, nearestElement;
<ide>
<ide> for (i = 0, len = elements.length; i < len; ++i) {
<del> var el = elements[i];
<add> var el = elements[i].element;
<ide> if (el && el.hasValue()) {
<ide> var center = el.getCenterPoint();
<ide> var d = helpers.distanceBetweenPoints(eventPosition, center);
<ide> function splitNewlines(str) {
<ide>
<ide> /**
<ide> * Private helper to create a tooltip item model
<del> * @param element - the chart element (point, arc, bar) to create the tooltip item for
<add> * @param item - the chart element (point, arc, bar) to create the tooltip item for
<ide> * @return new tooltip item
<ide> */
<del>function createTooltipItem(chart, element) {
<del> var datasetIndex = element._datasetIndex;
<del> var index = element._index;
<del> var controller = chart.getDatasetMeta(datasetIndex).controller;
<del> var indexScale = controller._getIndexScale();
<del> var valueScale = controller._getValueScale();
<del> var parsed = controller._getParsed(index);
<add>function createTooltipItem(chart, item) {
<add> const {datasetIndex, element, index} = item;
<add> const controller = chart.getDatasetMeta(datasetIndex).controller;
<add> const indexScale = controller._getIndexScale();
<add> const valueScale = controller._getValueScale();
<add> const parsed = controller._getParsed(index);
<ide>
<ide> return {
<ide> label: indexScale ? '' + indexScale.getLabelForValue(parsed[indexScale.id]) : '',
<ide> class Tooltip extends Element {
<ide> }
<ide>
<ide> // Remember Last Actives
<del> changed = !helpers.arrayEquals(me._active, me._lastActive);
<add> changed = !helpers._elementsEqual(me._active, me._lastActive);
<ide>
<ide> // Only handle target event on tooltip change
<ide> if (changed) {
<ide><path>src/helpers/helpers.core.js
<ide> var helpers = {
<ide> return true;
<ide> },
<ide>
<add> /**
<add> * Returns true if the `a0` and `a1` arrays have the same content, else returns false.
<add> * @param {Array} a0 - The array to compare
<add> * @param {Array} a1 - The array to compare
<add> * @returns {boolean}
<add> */
<add> _elementsEqual: function(a0, a1) {
<add> let i, ilen, v0, v1;
<add>
<add> if (!a0 || !a1 || a0.length !== a1.length) {
<add> return false;
<add> }
<add>
<add> for (i = 0, ilen = a0.length; i < ilen; ++i) {
<add> v0 = a0[i];
<add> v1 = a1[i];
<add>
<add> if (v0.datasetIndex !== v1.datasetIndex || v0.index !== v1.index) {
<add> return false;
<add> }
<add> }
<add>
<add> return true;
<add> },
<add>
<ide> /**
<ide> * Returns a deep copy of `source` without keeping references on objects and arrays.
<ide> * @param {*} source - The value to clone.
<ide><path>test/specs/controller.bar.tests.js
<ide> describe('Chart.controllers.bar', function() {
<ide> var meta = chart.getDatasetMeta(1);
<ide> var bar = meta.data[0];
<ide>
<del> meta.controller.setHoverStyle(bar);
<add> meta.controller.setHoverStyle(bar, 1, 0);
<ide> expect(bar._model.backgroundColor).toBe('rgb(230, 0, 0)');
<ide> expect(bar._model.borderColor).toBe('rgb(0, 0, 230)');
<ide> expect(bar._model.borderWidth).toBe(2);
<ide> describe('Chart.controllers.bar', function() {
<ide> chart.data.datasets[1].hoverBorderColor = 'rgb(0, 0, 0)';
<ide> chart.data.datasets[1].hoverBorderWidth = 5;
<ide>
<del> meta.controller.setHoverStyle(bar);
<add> meta.controller.setHoverStyle(bar, 1, 0);
<ide> expect(bar._model.backgroundColor).toBe('rgb(128, 128, 128)');
<ide> expect(bar._model.borderColor).toBe('rgb(0, 0, 0)');
<ide> expect(bar._model.borderWidth).toBe(5);
<ide> describe('Chart.controllers.bar', function() {
<ide> chart.data.datasets[1].hoverBorderColor = ['rgb(9, 9, 9)', 'rgb(0, 0, 0)'];
<ide> chart.data.datasets[1].hoverBorderWidth = [2.5, 5];
<ide>
<del> meta.controller.setHoverStyle(bar);
<add> meta.controller.setHoverStyle(bar, 1, 0);
<ide> expect(bar._model.backgroundColor).toBe('rgb(255, 255, 255)');
<ide> expect(bar._model.borderColor).toBe('rgb(9, 9, 9)');
<ide> expect(bar._model.borderWidth).toBe(2.5);
<ide> describe('Chart.controllers.bar', function() {
<ide> expect(bar._model.backgroundColor).toBe('rgb(128, 128, 128)');
<ide> expect(bar._model.borderColor).toBe('rgb(15, 15, 15)');
<ide> expect(bar._model.borderWidth).toBe(3.14);
<del> meta.controller.setHoverStyle(bar);
<add> meta.controller.setHoverStyle(bar, 1, 0);
<ide> expect(bar._model.backgroundColor).toBe(helpers.getHoverColor('rgb(128, 128, 128)'));
<ide> expect(bar._model.borderColor).toBe(helpers.getHoverColor('rgb(15, 15, 15)'));
<ide> expect(bar._model.borderWidth).toBe(3.14);
<ide> describe('Chart.controllers.bar', function() {
<ide> expect(bar._model.backgroundColor).toBe('rgb(255, 255, 255)');
<ide> expect(bar._model.borderColor).toBe('rgb(9, 9, 9)');
<ide> expect(bar._model.borderWidth).toBe(2.5);
<del> meta.controller.setHoverStyle(bar);
<add> meta.controller.setHoverStyle(bar, 1, 0);
<ide> expect(bar._model.backgroundColor).toBe(helpers.getHoverColor('rgb(255, 255, 255)'));
<ide> expect(bar._model.borderColor).toBe(helpers.getHoverColor('rgb(9, 9, 9)'));
<ide> expect(bar._model.borderWidth).toBe(2.5);
<ide><path>test/specs/core.controller.tests.js
<ide> describe('Chart', function() {
<ide> // Check and see if tooltip was displayed
<ide> var tooltip = chart.tooltip;
<ide>
<del> expect(chart.lastActive).toEqual([point]);
<del> expect(tooltip._lastActive).toEqual([point]);
<add> expect(chart.lastActive[0].element).toEqual(point);
<add> expect(tooltip._lastActive[0].element).toEqual(point);
<ide>
<ide> // Update and confirm tooltip is updated
<ide> chart.update();
<del> expect(chart.lastActive).toEqual([point]);
<del> expect(tooltip._lastActive).toEqual([point]);
<add> expect(chart.lastActive[0].element).toEqual(point);
<add> expect(tooltip._lastActive[0].element).toEqual(point);
<ide> });
<ide>
<ide> it ('should update the metadata', function() {
<ide><path>test/specs/core.interaction.tests.js
<ide> describe('Core.Interaction', function() {
<ide> y: point._model.y,
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.point(chart, evt);
<add> var elements = Chart.Interaction.modes.point(chart, evt).map(item => item.element);
<ide> expect(elements).toEqual([point, meta1.data[1]]);
<ide> });
<ide>
<ide> describe('Core.Interaction', function() {
<ide> y: 0
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.point(chart, evt);
<add> var elements = Chart.Interaction.modes.point(chart, evt).map(item => item.element);
<ide> expect(elements).toEqual([]);
<ide> });
<ide> });
<ide> describe('Core.Interaction', function() {
<ide> y: point._model.y,
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.index(chart, evt, {intersect: true});
<add> var elements = Chart.Interaction.modes.index(chart, evt, {intersect: true}).map(item => item.element);
<ide> expect(elements).toEqual([point, meta1.data[1]]);
<ide> });
<ide>
<ide> describe('Core.Interaction', function() {
<ide> y: 0,
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.index(chart, evt, {intersect: true});
<add> var elements = Chart.Interaction.modes.index(chart, evt, {intersect: true}).map(item => item.element);
<ide> expect(elements).toEqual([]);
<ide> });
<ide> });
<ide> describe('Core.Interaction', function() {
<ide> y: 0
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.index(chart, evt, {intersect: false});
<add> var elements = Chart.Interaction.modes.index(chart, evt, {intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[0], meta1.data[0]]);
<ide> });
<ide>
<ide> describe('Core.Interaction', function() {
<ide> y: center.y + 30,
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.index(chart, evt, {axis: 'y', intersect: false});
<add> var elements = Chart.Interaction.modes.index(chart, evt, {axis: 'y', intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[0], meta1.data[0]]);
<ide> });
<ide>
<ide> describe('Core.Interaction', function() {
<ide> y: 0
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.index(chart, evt, {axis: 'xy', intersect: false});
<add> var elements = Chart.Interaction.modes.index(chart, evt, {axis: 'xy', intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[0], meta1.data[0]]);
<ide> });
<ide> });
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> var elements = Chart.Interaction.modes.dataset(chart, evt, {intersect: true});
<del> expect(elements).toEqual(meta.data);
<add> expect(elements).toEqual([{datasetIndex: 0}]);
<ide> });
<ide>
<ide> it ('should return an empty array if nothing found', function() {
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> var elements = Chart.Interaction.modes.dataset(chart, evt, {axis: 'x', intersect: false});
<del>
<del> var meta = chart.getDatasetMeta(0);
<del> expect(elements).toEqual(meta.data);
<add> expect(elements).toEqual([{datasetIndex: 0}]);
<ide> });
<ide>
<ide> it ('axis: y gets correct items', function() {
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> var elements = Chart.Interaction.modes.dataset(chart, evt, {axis: 'y', intersect: false});
<del>
<del> var meta = chart.getDatasetMeta(1);
<del> expect(elements).toEqual(meta.data);
<add> expect(elements).toEqual([{datasetIndex: 1}]);
<ide> });
<ide>
<ide> it ('axis: xy gets correct items', function() {
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> var elements = Chart.Interaction.modes.dataset(chart, evt, {intersect: false});
<del>
<del> var meta = chart.getDatasetMeta(1);
<del> expect(elements).toEqual(meta.data);
<add> expect(elements).toEqual([{datasetIndex: 1}]);
<ide> });
<ide> });
<ide> });
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> // Nearest to 0,0 (top left) will be first point of dataset 2
<del> var elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: false});
<add> var elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: false}).map(item => item.element);
<ide> var meta = chart.getDatasetMeta(1);
<ide> expect(elements).toEqual([meta.data[0]]);
<ide> });
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> // Both points are nearest
<del> var elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: false});
<add> var elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[1], meta1.data[1]]);
<ide> });
<ide> });
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> // Middle point from both series are nearest
<del> var elements = Chart.Interaction.modes.nearest(chart, evt, {axis: 'x', intersect: false});
<add> var elements = Chart.Interaction.modes.nearest(chart, evt, {axis: 'x', intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[1], meta1.data[1]]);
<ide> });
<ide>
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> // Should return all (4) points from 'Point 1' and 'Point 2'
<del> var elements = Chart.Interaction.modes.nearest(chart, evt, {axis: 'x', intersect: false});
<add> var elements = Chart.Interaction.modes.nearest(chart, evt, {axis: 'x', intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[0], meta0.data[1], meta1.data[0], meta1.data[1]]);
<ide> });
<ide> });
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> // Middle point from both series are nearest
<del> var elements = Chart.Interaction.modes.nearest(chart, evt, {axis: 'y', intersect: false});
<add> var elements = Chart.Interaction.modes.nearest(chart, evt, {axis: 'y', intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[2]]);
<ide> });
<ide>
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> // Should return points with value 40
<del> var elements = Chart.Interaction.modes.nearest(chart, evt, {axis: 'y', intersect: false});
<add> var elements = Chart.Interaction.modes.nearest(chart, evt, {axis: 'y', intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[1], meta1.data[0], meta1.data[1], meta1.data[2]]);
<ide> });
<ide> });
<ide> describe('Core.Interaction', function() {
<ide> };
<ide>
<ide> // Nothing intersects so find nothing
<del> var elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: true});
<add> var elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: true}).map(item => item.element);
<ide> expect(elements).toEqual([]);
<ide>
<ide> evt = {
<ide> describe('Core.Interaction', function() {
<ide> x: point._view.x,
<ide> y: point._view.y
<ide> };
<del> elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: true});
<add> elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: true}).map(item => item.element);
<ide> expect(elements).toEqual([point]);
<ide> });
<ide>
<ide> describe('Core.Interaction', function() {
<ide> y: pt.y
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: true});
<add> var elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: true}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[1]]);
<ide> });
<ide>
<ide> describe('Core.Interaction', function() {
<ide> y: pt.y
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: true});
<add> var elements = Chart.Interaction.modes.nearest(chart, evt, {intersect: true}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[1], meta1.data[1]]);
<ide> });
<ide> });
<ide> describe('Core.Interaction', function() {
<ide> y: 0
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.x(chart, evt, {intersect: false});
<add> var elements = Chart.Interaction.modes.x(chart, evt, {intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[1], meta1.data[1]]);
<ide>
<ide> evt = {
<ide> describe('Core.Interaction', function() {
<ide> y: 0
<ide> };
<ide>
<del> elements = Chart.Interaction.modes.x(chart, evt, {intersect: false});
<add> elements = Chart.Interaction.modes.x(chart, evt, {intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([]);
<ide> });
<ide>
<ide> describe('Core.Interaction', function() {
<ide> y: 0
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.x(chart, evt, {intersect: true});
<add> var elements = Chart.Interaction.modes.x(chart, evt, {intersect: true}).map(item => item.element);
<ide> expect(elements).toEqual([]); // we don't intersect anything
<ide>
<ide> evt = {
<ide> describe('Core.Interaction', function() {
<ide> y: pt.y
<ide> };
<ide>
<del> elements = Chart.Interaction.modes.x(chart, evt, {intersect: true});
<add> elements = Chart.Interaction.modes.x(chart, evt, {intersect: true}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[1], meta1.data[1]]);
<ide> });
<ide> });
<ide> describe('Core.Interaction', function() {
<ide> y: pt.y,
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.y(chart, evt, {intersect: false});
<add> var elements = Chart.Interaction.modes.y(chart, evt, {intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[1], meta1.data[0], meta1.data[1], meta1.data[2]]);
<ide>
<ide> evt = {
<ide> describe('Core.Interaction', function() {
<ide> y: pt.y + 20, // out of range
<ide> };
<ide>
<del> elements = Chart.Interaction.modes.y(chart, evt, {intersect: false});
<add> elements = Chart.Interaction.modes.y(chart, evt, {intersect: false}).map(item => item.element);
<ide> expect(elements).toEqual([]);
<ide> });
<ide>
<ide> describe('Core.Interaction', function() {
<ide> y: pt.y
<ide> };
<ide>
<del> var elements = Chart.Interaction.modes.y(chart, evt, {intersect: true});
<add> var elements = Chart.Interaction.modes.y(chart, evt, {intersect: true}).map(item => item.element);
<ide> expect(elements).toEqual([]); // we don't intersect anything
<ide>
<ide> evt = {
<ide> describe('Core.Interaction', function() {
<ide> y: pt.y,
<ide> };
<ide>
<del> elements = Chart.Interaction.modes.y(chart, evt, {intersect: true});
<add> elements = Chart.Interaction.modes.y(chart, evt, {intersect: true}).map(item => item.element);
<ide> expect(elements).toEqual([meta0.data[1], meta1.data[0], meta1.data[1], meta1.data[2]]);
<ide> });
<ide> });
<ide><path>test/specs/global.defaults.tests.js
<ide> describe('Default Configs', function() {
<ide> });
<ide>
<ide> // fake out the tooltip hover and force the tooltip to update
<del> chart.tooltip._active = [chart.getDatasetMeta(0).data[0]];
<add> chart.tooltip._active = [{element: chart.getDatasetMeta(0).data[0], datasetIndex: 0, index: 0}];
<ide> chart.tooltip.update();
<ide>
<ide> // Title is always blank
<ide> describe('Default Configs', function() {
<ide> });
<ide>
<ide> // fake out the tooltip hover and force the tooltip to update
<del> chart.tooltip._active = [chart.getDatasetMeta(0).data[1]];
<add> chart.tooltip._active = [{element: chart.getDatasetMeta(0).data[1], datasetIndex: 0, index: 1}];
<ide> chart.tooltip.update();
<ide>
<ide> // Title is always blank
<ide> describe('Default Configs', function() {
<ide> });
<ide>
<ide> // fake out the tooltip hover and force the tooltip to update
<del> chart.tooltip._active = [chart.getDatasetMeta(0).data[1]];
<add> chart.tooltip._active = [{element: chart.getDatasetMeta(0).data[1], datasetIndex: 0, index: 1}];
<ide> chart.tooltip.update();
<ide>
<ide> // Title is always blank
<ide> describe('Default Configs', function() {
<ide> var expected = [{
<ide> text: 'label1',
<ide> fillStyle: 'red',
<del> hidden: false,
<add> hidden: undefined,
<ide> index: 0,
<ide> strokeStyle: '#000',
<ide> lineWidth: 2
<ide> }, {
<ide> text: 'label2',
<ide> fillStyle: 'green',
<del> hidden: false,
<add> hidden: undefined,
<ide> index: 1,
<ide> strokeStyle: '#000',
<ide> lineWidth: 2
<ide> describe('Default Configs', function() {
<ide> });
<ide>
<ide> // fake out the tooltip hover and force the tooltip to update
<del> chart.tooltip._active = [chart.getDatasetMeta(0).data[1]];
<add> chart.tooltip._active = [{element: chart.getDatasetMeta(0).data[1], datasetIndex: 0, index: 1}];
<ide> chart.tooltip.update();
<ide>
<ide> // Title is always blank
<ide> describe('Default Configs', function() {
<ide> var expected = [{
<ide> text: 'label1',
<ide> fillStyle: 'red',
<del> hidden: false,
<add> hidden: undefined,
<ide> index: 0,
<ide> strokeStyle: '#000',
<ide> lineWidth: 2
<ide> }, {
<ide> text: 'label2',
<ide> fillStyle: 'green',
<del> hidden: false,
<add> hidden: undefined,
<ide> index: 1,
<ide> strokeStyle: '#000',
<ide> lineWidth: 2
<ide><path>test/specs/helpers.core.tests.js
<ide> describe('Chart.helpers.core', function() {
<ide> });
<ide> });
<ide>
<add> describe('_elementsEqual', function() {
<add> it('should return true if arrays are the same', function() {
<add> expect(helpers._elementsEqual(
<add> [{datasetIndex: 0, index: 1}, {datasetIndex: 0, index: 2}],
<add> [{datasetIndex: 0, index: 1}, {datasetIndex: 0, index: 2}])).toBeTruthy();
<add> });
<add> it('should return false if arrays are not the same', function() {
<add> expect(helpers._elementsEqual([], [{datasetIndex: 0, index: 1}])).toBeFalsy();
<add> expect(helpers._elementsEqual([{datasetIndex: 0, index: 2}], [{datasetIndex: 0, index: 1}])).toBeFalsy();
<add> });
<add> });
<add>
<ide> describe('clone', function() {
<ide> it('should clone primitive values', function() {
<ide> expect(helpers.clone()).toBe(undefined); | 18 |
PHP | PHP | add a hasfinder method to table object | 3fc40228c42f2f111fbb49d04c00b482791390d2 | <ide><path>src/ORM/Table.php
<ide> protected function _processDelete($entity, $options) {
<ide> return $success;
<ide> }
<ide>
<add>/**
<add> * Returns true if the finder exists for the table
<add> *
<add> * @param string $type name of finder to check
<add> *
<add> * @return bool
<add> */
<add> public function hasFinder($type) {
<add> $finder = 'find' . $type;
<add>
<add> return method_exists($this, $finder) || ($this->_behaviors && $this->_behaviors->hasFinder($type));
<add> }
<add>
<ide> /**
<ide> * Calls a finder method directly and applies it to the passed query,
<ide> * if no query is passed a new one will be created and returned
<ide><path>tests/TestCase/ORM/TableTest.php
<ide> public function testInitializeEvent() {
<ide> EventManager::instance()->detach($cb, 'Model.initialize');
<ide> }
<ide>
<add> public function testHasFinder() {
<add> $table = TableRegistry::get('articles');
<add> $table->addBehavior('Sluggable');
<add>
<add> $this->assertTrue($table->hasFinder('list'));
<add> $this->assertTrue($table->hasFinder('noSlug'));
<add> $this->assertFalse($table->hasFinder('noFind'));
<add> }
<ide> } | 2 |
Ruby | Ruby | fix access to `livecheck` constants in formulae | 768ebe575002075cd9f2952e5db41c72fbbac88e | <ide><path>Library/Homebrew/formula.rb
<ide> class Formula
<ide> include Utils::Shell
<ide> include Context
<ide> include OnSystem::MacOSAndLinux
<add> include Homebrew::Livecheck::Constants
<ide> extend Forwardable
<ide> extend Cachable
<ide> extend Predicable
<ide> def test(&block)
<ide> def livecheck(&block)
<ide> return @livecheck unless block
<ide>
<del> include Homebrew::Livecheck::Constants
<ide> @livecheckable = true
<ide> @livecheck.instance_eval(&block)
<ide> end | 1 |
Text | Text | update the scaffold generator outputs | 2161434d1671edac32ef06bf35cc8fe4c905a7db | <ide><path>guides/source/command_line.md
<ide> $ rails generate scaffold HighScore game:string score:integer
<ide> invoke test_unit
<ide> create test/models/high_score_test.rb
<ide> create test/fixtures/high_scores.yml
<del> route resources :high_scores
<add> invoke resource_route
<add> route resources :high_scores
<ide> invoke scaffold_controller
<ide> create app/controllers/high_scores_controller.rb
<ide> invoke erb
<ide><path>guides/source/generators.md
<ide> $ rails generate scaffold User name:string
<ide> invoke test_unit
<ide> create test/models/user_test.rb
<ide> create test/fixtures/users.yml
<del> route resources :users
<add> invoke resource_route
<add> route resources :users
<ide> invoke scaffold_controller
<ide> create app/controllers/users_controller.rb
<ide> invoke erb
<ide> $ rails generate scaffold User name:string
<ide> create app/helpers/users_helper.rb
<ide> invoke test_unit
<ide> create test/helpers/users_helper_test.rb
<del> invoke stylesheets
<del> create app/assets/stylesheets/scaffold.css
<add> invoke assets
<add> invoke coffee
<add> create app/assets/javascripts/users.js.coffee
<add> invoke scss
<add> create app/assets/stylesheets/users.css.scss
<add> invoke scss
<add> create app/assets/stylesheets/scaffolds.css.scss
<ide> ```
<ide>
<ide> Looking at this output, it's easy to understand how generators work in Rails 3.0 and above. The scaffold generator doesn't actually generate anything, it just invokes others to do the work. This allows us to add/replace/remove any of those invocations. For instance, the scaffold generator invokes the scaffold_controller generator, which invokes erb, test_unit and helper generators. Since each generator has a single responsibility, they are easy to reuse, avoiding code duplication.
<ide> $ rails generate scaffold Comment body:text
<ide> invoke shoulda
<ide> create test/models/comment_test.rb
<ide> create test/fixtures/comments.yml
<add> invoke resource_route
<ide> route resources :comments
<ide> invoke scaffold_controller
<ide> create app/controllers/comments_controller.rb
<ide> $ rails generate scaffold Comment body:text
<ide> create app/views/comments/show.html.erb
<ide> create app/views/comments/new.html.erb
<ide> create app/views/comments/_form.html.erb
<del> create app/views/layouts/comments.html.erb
<ide> invoke shoulda
<ide> create test/controllers/comments_controller_test.rb
<ide> invoke my_helper
<ide> create app/helpers/comments_helper.rb
<ide> invoke shoulda
<ide> create test/helpers/comments_helper_test.rb
<add> invoke assets
<add> invoke coffee
<add> create app/assets/javascripts/comments.js.coffee
<add> invoke scss
<ide> ```
<ide>
<ide> Fallbacks allow your generators to have a single responsibility, increasing code reuse and reducing the amount of duplication. | 2 |
Javascript | Javascript | add param info for `$routeupdate` event | b2b33608a3d25959f4843b2f47a1f9431f60f563 | <ide><path>src/ngRoute/route.js
<ide> function $RouteProvider() {
<ide> * @name $route#$routeUpdate
<ide> * @eventType broadcast on root scope
<ide> * @description
<del> *
<ide> * The `reloadOnSearch` property has been set to false, and we are reusing the same
<ide> * instance of the Controller.
<add> *
<add> * @param {Object} angularEvent Synthetic event object
<add> * @param {Route} current Current/previous route information.
<ide> */
<ide>
<ide> var forceReload = false, | 1 |
Mixed | Javascript | update all internal errors | 6e1c25c45672b70f4b6c6c8af56d9c0762bfae04 | <ide><path>doc/api/errors.md
<ide> An invalid symlink type was passed to the [`fs.symlink()`][] or
<ide>
<ide> An attempt was made to add more headers after the headers had already been sent.
<ide>
<del><a id="ERR_HTTP_INVALID_CHAR"></a>
<del>### ERR_HTTP_INVALID_CHAR
<del>
<del>An invalid character was found in an HTTP response status message (reason
<del>phrase).
<del>
<ide> <a id="ERR_HTTP_INVALID_HEADER_VALUE"></a>
<ide> ### ERR_HTTP_INVALID_HEADER_VALUE
<ide>
<ide> Status code was outside the regular status code range (100-999).
<ide> The `Trailer` header was set even though the transfer encoding does not support
<ide> that.
<ide>
<del><a id="ERR_HTTP2_ALREADY_SHUTDOWN"></a>
<del>### ERR_HTTP2_ALREADY_SHUTDOWN
<del>
<del>Occurs with multiple attempts to shutdown an HTTP/2 session.
<del>
<ide> <a id="ERR_HTTP2_ALTSVC_INVALID_ORIGIN"></a>
<ide> ### ERR_HTTP2_ALTSVC_INVALID_ORIGIN
<ide>
<ide> forbidden.
<ide> For HTTP/2 requests using the `CONNECT` method, the `:scheme` pseudo-header is
<ide> forbidden.
<ide>
<del><a id="ERR_HTTP2_FRAME_ERROR"></a>
<del>### ERR_HTTP2_FRAME_ERROR
<del>
<del>A failure occurred sending an individual frame on the HTTP/2 session.
<del>
<ide> <a id="ERR_HTTP2_GOAWAY_SESSION"></a>
<ide> ### ERR_HTTP2_GOAWAY_SESSION
<ide>
<ide> New HTTP/2 Streams may not be opened after the `Http2Session` has received a
<ide> `GOAWAY` frame from the connected peer.
<ide>
<del><a id="ERR_HTTP2_HEADER_REQUIRED"></a>
<del>### ERR_HTTP2_HEADER_REQUIRED
<del>
<del>A required header was missing in an HTTP/2 message.
<del>
<ide> <a id="ERR_HTTP2_HEADER_SINGLE_VALUE"></a>
<ide> ### ERR_HTTP2_HEADER_SINGLE_VALUE
<ide>
<ide> have only a single value.
<ide>
<ide> An additional headers was specified after an HTTP/2 response was initiated.
<ide>
<del><a id="ERR_HTTP2_HEADERS_OBJECT"></a>
<del>### ERR_HTTP2_HEADERS_OBJECT
<del>
<del>An HTTP/2 Headers Object was expected.
<del>
<ide> <a id="ERR_HTTP2_HEADERS_SENT"></a>
<ide> ### ERR_HTTP2_HEADERS_SENT
<ide>
<ide> An attempt was made to send multiple response headers.
<ide>
<del><a id="ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND"></a>
<del>### ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND
<del>
<del>HTTP/2 Informational headers must only be sent *prior* to calling the
<del>`Http2Stream.prototype.respond()` method.
<del>
<ide> <a id="ERR_HTTP2_INFO_STATUS_NOT_ALLOWED"></a>
<ide> ### ERR_HTTP2_INFO_STATUS_NOT_ALLOWED
<ide>
<ide> strict compliance with the API specification (which in some cases may accept
<ide> `func(undefined)` and `func()` are treated identically, and the
<ide> [`ERR_INVALID_ARG_TYPE`][] error code may be used instead.
<ide>
<del><a id="ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK"></a>
<del>### ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK
<del>
<del>> Stability: 1 - Experimental
<del>
<del>An [ES6 module][] loader hook specified `format: 'dynamic` but did not provide a
<del>`dynamicInstantiate` hook.
<del>
<ide> <a id="ERR_MISSING_MODULE"></a>
<ide> ### ERR_MISSING_MODULE
<ide>
<ide> would be possible by calling a callback more than once.
<ide>
<ide> While using `N-API`, a constructor passed was not a function.
<ide>
<del><a id="ERR_NAPI_CONS_PROTOTYPE_OBJECT"></a>
<del>### ERR_NAPI_CONS_PROTOTYPE_OBJECT
<del>
<del>While using `N-API`, `Constructor.prototype` was not an object.
<del>
<ide> <a id="ERR_NAPI_INVALID_DATAVIEW_ARGS"></a>
<ide> ### ERR_NAPI_INVALID_DATAVIEW_ARGS
<ide>
<ide> For example: `Buffer.write(string, encoding, offset[, length])`
<ide>
<ide> A given value is out of the accepted range.
<ide>
<del><a id="ERR_PARSE_HISTORY_DATA"></a>
<del>### ERR_PARSE_HISTORY_DATA
<del>
<del>The `REPL` module was unable parse data from the REPL history file.
<del>
<ide> <a id="ERR_REQUIRE_ESM"></a>
<ide> ### ERR_REQUIRE_ESM
<ide>
<ide> recommended to use 2048 bits or larger for stronger security.
<ide> A TLS/SSL handshake timed out. In this case, the server must also abort the
<ide> connection.
<ide>
<del><a id="ERR_TLS_RENEGOTIATION_FAILED"></a>
<del>### ERR_TLS_RENEGOTIATION_FAILED
<del>
<del>A TLS renegotiation request has failed in a non-specific way.
<del>
<ide> <a id="ERR_TLS_REQUIRED_SERVER_NAME"></a>
<ide> ### ERR_TLS_REQUIRED_SERVER_NAME
<ide>
<ide><path>lib/internal/errors.js
<ide> module.exports = exports = {
<ide> //
<ide> // Note: Node.js specific errors must begin with the prefix ERR_
<ide>
<del>E('ERR_ARG_NOT_ITERABLE', '%s must be iterable');
<del>E('ERR_ASSERTION', '%s');
<del>E('ERR_ASYNC_CALLBACK', '%s must be a function');
<del>E('ERR_ASYNC_TYPE', 'Invalid name for async "type": %s');
<del>E('ERR_BUFFER_OUT_OF_BOUNDS', bufferOutOfBounds);
<add>E('ERR_ARG_NOT_ITERABLE', '%s must be iterable', TypeError);
<add>E('ERR_ASSERTION', '%s', AssertionError);
<add>E('ERR_ASYNC_CALLBACK', '%s must be a function', TypeError);
<add>E('ERR_ASYNC_TYPE', 'Invalid name for async "type": %s', TypeError);
<add>E('ERR_BUFFER_OUT_OF_BOUNDS', bufferOutOfBounds, RangeError);
<ide> E('ERR_BUFFER_TOO_LARGE',
<del> `Cannot create a Buffer larger than 0x${kMaxLength.toString(16)} bytes`);
<del>E('ERR_CANNOT_WATCH_SIGINT', 'Cannot watch for SIGINT signals');
<del>E('ERR_CHILD_CLOSED_BEFORE_REPLY', 'Child closed before reply received');
<add> `Cannot create a Buffer larger than 0x${kMaxLength.toString(16)} bytes`,
<add> RangeError);
<add>E('ERR_CANNOT_WATCH_SIGINT', 'Cannot watch for SIGINT signals', Error);
<add>E('ERR_CHILD_CLOSED_BEFORE_REPLY',
<add> 'Child closed before reply received', Error);
<ide> E('ERR_CHILD_PROCESS_IPC_REQUIRED',
<del> "Forked processes must have an IPC channel, missing value 'ipc' in %s");
<del>E('ERR_CHILD_PROCESS_STDIO_MAXBUFFER', '%s maxBuffer length exceeded');
<add> "Forked processes must have an IPC channel, missing value 'ipc' in %s",
<add> Error);
<add>E('ERR_CHILD_PROCESS_STDIO_MAXBUFFER', '%s maxBuffer length exceeded',
<add> RangeError);
<ide> E('ERR_CONSOLE_WRITABLE_STREAM',
<del> 'Console expects a writable stream instance for %s');
<del>E('ERR_CPU_USAGE', 'Unable to obtain cpu usage %s');
<add> 'Console expects a writable stream instance for %s', TypeError);
<add>E('ERR_CPU_USAGE', 'Unable to obtain cpu usage %s', Error);
<ide> E('ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED',
<del> 'Custom engines not supported by this OpenSSL');
<del>E('ERR_CRYPTO_ECDH_INVALID_FORMAT', 'Invalid ECDH format: %s');
<add> 'Custom engines not supported by this OpenSSL', Error);
<add>E('ERR_CRYPTO_ECDH_INVALID_FORMAT', 'Invalid ECDH format: %s', TypeError);
<ide> E('ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY',
<del> 'Public key is not valid for specified curve');
<del>E('ERR_CRYPTO_ENGINE_UNKNOWN', 'Engine "%s" was not found');
<add> 'Public key is not valid for specified curve', TypeError);
<add>E('ERR_CRYPTO_ENGINE_UNKNOWN', 'Engine "%s" was not found', Error);
<ide> E('ERR_CRYPTO_FIPS_FORCED',
<del> 'Cannot set FIPS mode, it was forced with --force-fips at startup.');
<del>E('ERR_CRYPTO_FIPS_UNAVAILABLE', 'Cannot set FIPS mode in a non-FIPS build.');
<del>E('ERR_CRYPTO_HASH_DIGEST_NO_UTF16', 'hash.digest() does not support UTF-16');
<del>E('ERR_CRYPTO_HASH_FINALIZED', 'Digest already called');
<del>E('ERR_CRYPTO_HASH_UPDATE_FAILED', 'Hash update failed');
<del>E('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s');
<del>E('ERR_CRYPTO_INVALID_STATE', 'Invalid state for operation %s');
<del>E('ERR_CRYPTO_SIGN_KEY_REQUIRED', 'No key provided to sign');
<add> 'Cannot set FIPS mode, it was forced with --force-fips at startup.', Error);
<add>E('ERR_CRYPTO_FIPS_UNAVAILABLE', 'Cannot set FIPS mode in a non-FIPS build.',
<add> Error);
<add>E('ERR_CRYPTO_HASH_DIGEST_NO_UTF16', 'hash.digest() does not support UTF-16',
<add> Error);
<add>E('ERR_CRYPTO_HASH_FINALIZED', 'Digest already called', Error);
<add>E('ERR_CRYPTO_HASH_UPDATE_FAILED', 'Hash update failed', Error);
<add>E('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s', TypeError);
<add>E('ERR_CRYPTO_INVALID_STATE', 'Invalid state for operation %s', Error);
<add>E('ERR_CRYPTO_SIGN_KEY_REQUIRED', 'No key provided to sign', Error);
<ide> E('ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH',
<del> 'Input buffers must have the same length');
<del>E('ERR_DNS_SET_SERVERS_FAILED', 'c-ares failed to set servers: "%s" [%s]');
<add> 'Input buffers must have the same length', RangeError);
<add>E('ERR_DNS_SET_SERVERS_FAILED', 'c-ares failed to set servers: "%s" [%s]',
<add> Error);
<ide> E('ERR_DOMAIN_CALLBACK_NOT_AVAILABLE',
<ide> 'A callback was registered through ' +
<del> 'process.setUncaughtExceptionCaptureCallback(), which is mutually ' +
<del> 'exclusive with using the `domain` module');
<add> 'process.setUncaughtExceptionCaptureCallback(), which is mutually ' +
<add> 'exclusive with using the `domain` module',
<add> Error);
<ide> E('ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE',
<ide> 'The `domain` module is in use, which is mutually exclusive with calling ' +
<del> 'process.setUncaughtExceptionCaptureCallback()');
<add> 'process.setUncaughtExceptionCaptureCallback()',
<add> Error);
<ide> E('ERR_ENCODING_INVALID_ENCODED_DATA',
<del> 'The encoded data was not valid for encoding %s');
<del>E('ERR_ENCODING_NOT_SUPPORTED', 'The "%s" encoding is not supported');
<del>E('ERR_FALSY_VALUE_REJECTION', 'Promise was rejected with falsy value');
<add> 'The encoded data was not valid for encoding %s', TypeError);
<add>E('ERR_ENCODING_NOT_SUPPORTED', 'The "%s" encoding is not supported',
<add> RangeError); // One entry is currently falsy implemented as "Error"
<add>E('ERR_FALSY_VALUE_REJECTION', 'Promise was rejected with falsy value', Error);
<ide> E('ERR_FS_INVALID_SYMLINK_TYPE',
<del> 'Symlink type must be one of "dir", "file", or "junction". Received "%s"');
<del>E('ERR_HTTP2_ALREADY_SHUTDOWN',
<del> 'Http2Session is already shutdown or destroyed');
<add> 'Symlink type must be one of "dir", "file", or "junction". Received "%s"',
<add> Error);
<ide> E('ERR_HTTP2_ALTSVC_INVALID_ORIGIN',
<del> 'HTTP/2 ALTSVC frames require a valid origin');
<add> 'HTTP/2 ALTSVC frames require a valid origin', TypeError);
<ide> E('ERR_HTTP2_ALTSVC_LENGTH',
<del> 'HTTP/2 ALTSVC frames are limited to 16382 bytes');
<add> 'HTTP/2 ALTSVC frames are limited to 16382 bytes', TypeError);
<ide> E('ERR_HTTP2_CONNECT_AUTHORITY',
<del> ':authority header is required for CONNECT requests');
<add> ':authority header is required for CONNECT requests', Error);
<ide> E('ERR_HTTP2_CONNECT_PATH',
<del> 'The :path header is forbidden for CONNECT requests');
<add> 'The :path header is forbidden for CONNECT requests', Error);
<ide> E('ERR_HTTP2_CONNECT_SCHEME',
<del> 'The :scheme header is forbidden for CONNECT requests');
<del>E('ERR_HTTP2_FRAME_ERROR',
<del> (type, code, id) => {
<del> let msg = `Error sending frame type ${type}`;
<del> if (id !== undefined)
<del> msg += ` for stream ${id}`;
<del> msg += ` with code ${code}`;
<del> return msg;
<del> });
<add> 'The :scheme header is forbidden for CONNECT requests', Error);
<ide> E('ERR_HTTP2_GOAWAY_SESSION',
<del> 'New streams cannot be created after receiving a GOAWAY');
<add> 'New streams cannot be created after receiving a GOAWAY', Error);
<ide> E('ERR_HTTP2_HEADERS_AFTER_RESPOND',
<del> 'Cannot specify additional headers after response initiated');
<del>E('ERR_HTTP2_HEADERS_OBJECT', 'Headers must be an object');
<del>E('ERR_HTTP2_HEADERS_SENT', 'Response has already been initiated.');
<del>E('ERR_HTTP2_HEADER_REQUIRED', 'The %s header is required');
<add> 'Cannot specify additional headers after response initiated', Error);
<add>E('ERR_HTTP2_HEADERS_SENT', 'Response has already been initiated.', Error);
<ide> E('ERR_HTTP2_HEADER_SINGLE_VALUE',
<del> 'Header field "%s" must have only a single value');
<del>E('ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND',
<del> 'Cannot send informational headers after the HTTP message has been sent');
<add> 'Header field "%s" must have only a single value', Error);
<ide> E('ERR_HTTP2_INFO_STATUS_NOT_ALLOWED',
<del> 'Informational status codes cannot be used');
<add> 'Informational status codes cannot be used', RangeError);
<ide> E('ERR_HTTP2_INVALID_CONNECTION_HEADERS',
<del> 'HTTP/1 Connection specific headers are forbidden: "%s"');
<del>E('ERR_HTTP2_INVALID_HEADER_VALUE', 'Invalid value "%s" for header "%s"');
<add> 'HTTP/1 Connection specific headers are forbidden: "%s"', Error);
<add>E('ERR_HTTP2_INVALID_HEADER_VALUE',
<add> 'Invalid value "%s" for header "%s"', TypeError);
<ide> E('ERR_HTTP2_INVALID_INFO_STATUS',
<del> 'Invalid informational status code: %s');
<add> 'Invalid informational status code: %s', RangeError);
<ide> E('ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH',
<del> 'Packed settings length must be a multiple of six');
<add> 'Packed settings length must be a multiple of six', RangeError);
<ide> E('ERR_HTTP2_INVALID_PSEUDOHEADER',
<del> '"%s" is an invalid pseudoheader or is used incorrectly');
<del>E('ERR_HTTP2_INVALID_SESSION', 'The session has been destroyed');
<add> '"%s" is an invalid pseudoheader or is used incorrectly', Error);
<add>E('ERR_HTTP2_INVALID_SESSION', 'The session has been destroyed', Error);
<ide> E('ERR_HTTP2_INVALID_SETTING_VALUE',
<del> 'Invalid value for setting "%s": %s');
<del>E('ERR_HTTP2_INVALID_STREAM', 'The stream has been destroyed');
<add> 'Invalid value for setting "%s": %s', TypeError, RangeError);
<add>E('ERR_HTTP2_INVALID_STREAM', 'The stream has been destroyed', Error);
<ide> E('ERR_HTTP2_MAX_PENDING_SETTINGS_ACK',
<del> 'Maximum number of pending settings acknowledgements (%s)');
<add> 'Maximum number of pending settings acknowledgements (%s)', Error);
<ide> E('ERR_HTTP2_NO_SOCKET_MANIPULATION',
<del> 'HTTP/2 sockets should not be directly manipulated (e.g. read and written)');
<add> 'HTTP/2 sockets should not be directly manipulated (e.g. read and written)',
<add> Error);
<ide> E('ERR_HTTP2_OUT_OF_STREAMS',
<del> 'No stream ID is available because maximum stream ID has been reached');
<add> 'No stream ID is available because maximum stream ID has been reached',
<add> Error);
<ide> E('ERR_HTTP2_PAYLOAD_FORBIDDEN',
<del> 'Responses with %s status must not have a payload');
<del>E('ERR_HTTP2_PING_CANCEL', 'HTTP2 ping cancelled');
<del>E('ERR_HTTP2_PING_LENGTH', 'HTTP2 ping payload must be 8 bytes');
<del>E('ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED', 'Cannot set HTTP/2 pseudo-headers');
<del>E('ERR_HTTP2_PUSH_DISABLED', 'HTTP/2 client has disabled push streams');
<del>E('ERR_HTTP2_SEND_FILE', 'Only regular files can be sent');
<del>E('ERR_HTTP2_SESSION_ERROR', 'Session closed with error code %s');
<add> 'Responses with %s status must not have a payload', Error);
<add>E('ERR_HTTP2_PING_CANCEL', 'HTTP2 ping cancelled', Error);
<add>E('ERR_HTTP2_PING_LENGTH', 'HTTP2 ping payload must be 8 bytes', RangeError);
<add>E('ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',
<add> 'Cannot set HTTP/2 pseudo-headers', Error);
<add>E('ERR_HTTP2_PUSH_DISABLED', 'HTTP/2 client has disabled push streams', Error);
<add>E('ERR_HTTP2_SEND_FILE', 'Only regular files can be sent', Error);
<add>E('ERR_HTTP2_SESSION_ERROR', 'Session closed with error code %s', Error);
<ide> E('ERR_HTTP2_SOCKET_BOUND',
<del> 'The socket is already bound to an Http2Session');
<add> 'The socket is already bound to an Http2Session', Error);
<ide> E('ERR_HTTP2_STATUS_101',
<del> 'HTTP status code 101 (Switching Protocols) is forbidden in HTTP/2');
<del>E('ERR_HTTP2_STATUS_INVALID', 'Invalid status code: %s');
<del>E('ERR_HTTP2_STREAM_CANCEL', 'The pending stream has been canceled');
<del>E('ERR_HTTP2_STREAM_ERROR', 'Stream closed with error code %s');
<del>E('ERR_HTTP2_STREAM_SELF_DEPENDENCY', 'A stream cannot depend on itself');
<del>E('ERR_HTTP2_UNSUPPORTED_PROTOCOL', 'protocol "%s" is unsupported.');
<add> 'HTTP status code 101 (Switching Protocols) is forbidden in HTTP/2', Error);
<add>E('ERR_HTTP2_STATUS_INVALID', 'Invalid status code: %s', RangeError);
<add>E('ERR_HTTP2_STREAM_CANCEL', 'The pending stream has been canceled', Error);
<add>E('ERR_HTTP2_STREAM_ERROR', 'Stream closed with error code %s', Error);
<add>E('ERR_HTTP2_STREAM_SELF_DEPENDENCY',
<add> 'A stream cannot depend on itself', Error);
<add>E('ERR_HTTP2_UNSUPPORTED_PROTOCOL', 'protocol "%s" is unsupported.', Error);
<ide> E('ERR_HTTP_HEADERS_SENT',
<del> 'Cannot %s headers after they are sent to the client');
<del>E('ERR_HTTP_INVALID_CHAR', 'Invalid character in statusMessage.');
<del>E('ERR_HTTP_INVALID_HEADER_VALUE', 'Invalid value "%s" for header "%s"');
<del>E('ERR_HTTP_INVALID_STATUS_CODE', 'Invalid status code: %s');
<add> 'Cannot %s headers after they are sent to the client', Error);
<add>E('ERR_HTTP_INVALID_HEADER_VALUE',
<add> 'Invalid value "%s" for header "%s"', TypeError);
<add>E('ERR_HTTP_INVALID_STATUS_CODE', 'Invalid status code: %s', RangeError);
<ide> E('ERR_HTTP_TRAILER_INVALID',
<del> 'Trailers are invalid with this transfer encoding');
<del>E('ERR_INDEX_OUT_OF_RANGE', 'Index out of range');
<del>E('ERR_INSPECTOR_ALREADY_CONNECTED', 'The inspector is already connected');
<del>E('ERR_INSPECTOR_CLOSED', 'Session was closed');
<del>E('ERR_INSPECTOR_NOT_AVAILABLE', 'Inspector is not available');
<del>E('ERR_INSPECTOR_NOT_CONNECTED', 'Session is not connected');
<del>E('ERR_INVALID_ARG_TYPE', invalidArgType);
<add> 'Trailers are invalid with this transfer encoding', Error);
<add>E('ERR_INDEX_OUT_OF_RANGE', 'Index out of range', RangeError);
<add>E('ERR_INSPECTOR_ALREADY_CONNECTED',
<add> 'The inspector is already connected', Error);
<add>E('ERR_INSPECTOR_CLOSED', 'Session was closed', Error);
<add>E('ERR_INSPECTOR_NOT_AVAILABLE', 'Inspector is not available', Error);
<add>E('ERR_INSPECTOR_NOT_CONNECTED', 'Session is not connected', Error);
<add>E('ERR_INVALID_ARG_TYPE', invalidArgType, TypeError);
<ide> E('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => {
<ide> const util = lazyUtil();
<ide> let inspected = util.inspect(value);
<ide> if (inspected.length > 128) {
<ide> inspected = inspected.slice(0, 128) + '...';
<ide> }
<ide> return `The argument '${name}' ${reason}. Received ${inspected}`;
<del>}),
<add>}, TypeError, RangeError); // Some are currently falsy implemented as "Error"
<ide> E('ERR_INVALID_ARRAY_LENGTH',
<ide> (name, len, actual) => {
<ide> internalAssert(typeof actual === 'number', 'actual must be a number');
<ide> return `The array "${name}" (length ${actual}) must be of length ${len}.`;
<del> });
<del>E('ERR_INVALID_ASYNC_ID', 'Invalid %s value: %s');
<del>E('ERR_INVALID_BUFFER_SIZE', 'Buffer size must be a multiple of %s');
<del>E('ERR_INVALID_CALLBACK', 'Callback must be a function');
<del>E('ERR_INVALID_CHAR', invalidChar);
<add> }, TypeError);
<add>E('ERR_INVALID_ASYNC_ID', 'Invalid %s value: %s', RangeError);
<add>E('ERR_INVALID_BUFFER_SIZE',
<add> 'Buffer size must be a multiple of %s', RangeError);
<add>E('ERR_INVALID_CALLBACK', 'Callback must be a function', TypeError);
<add>E('ERR_INVALID_CHAR', invalidChar, TypeError); //Check falsy "Error" entries.
<ide> E('ERR_INVALID_CURSOR_POS',
<del> 'Cannot set cursor row without setting its column');
<del>E('ERR_INVALID_DOMAIN_NAME', 'Unable to determine the domain name');
<del>E('ERR_INVALID_FD', '"fd" must be a positive integer: %s');
<del>E('ERR_INVALID_FD_TYPE', 'Unsupported fd type: %s');
<add> 'Cannot set cursor row without setting its column', Error);
<add>E('ERR_INVALID_DOMAIN_NAME', 'Unable to determine the domain name', Error);
<add>E('ERR_INVALID_FD',
<add> '"fd" must be a positive integer: %s', RangeError);
<add>E('ERR_INVALID_FD_TYPE', 'Unsupported fd type: %s', TypeError);
<ide> E('ERR_INVALID_FILE_URL_HOST',
<del> 'File URL host must be "localhost" or empty on %s');
<del>E('ERR_INVALID_FILE_URL_PATH', 'File URL path %s');
<del>E('ERR_INVALID_HANDLE_TYPE', 'This handle type cannot be sent');
<del>E('ERR_INVALID_HTTP_TOKEN', '%s must be a valid HTTP token ["%s"]');
<del>E('ERR_INVALID_IP_ADDRESS', 'Invalid IP address: %s');
<add> 'File URL host must be "localhost" or empty on %s', TypeError);
<add>E('ERR_INVALID_FILE_URL_PATH', 'File URL path %s', TypeError);
<add>E('ERR_INVALID_HANDLE_TYPE', 'This handle type cannot be sent', TypeError);
<add>E('ERR_INVALID_HTTP_TOKEN', '%s must be a valid HTTP token ["%s"]', TypeError);
<add>E('ERR_INVALID_IP_ADDRESS', 'Invalid IP address: %s', TypeError, Error);
<ide> E('ERR_INVALID_OPT_VALUE', (name, value) =>
<del> `The value "${String(value)}" is invalid for option "${name}"`);
<add> `The value "${String(value)}" is invalid for option "${name}"`,
<add> TypeError,
<add> RangeError);
<ide> E('ERR_INVALID_OPT_VALUE_ENCODING',
<del> 'The value "%s" is invalid for option "encoding"');
<del>E('ERR_INVALID_PERFORMANCE_MARK', 'The "%s" performance mark has not been set');
<del>E('ERR_INVALID_PROTOCOL', 'Protocol "%s" not supported. Expected "%s"');
<add> 'The value "%s" is invalid for option "encoding"', TypeError);
<add>E('ERR_INVALID_PERFORMANCE_MARK',
<add> 'The "%s" performance mark has not been set', Error);
<add>E('ERR_INVALID_PROTOCOL', 'Protocol "%s" not supported. Expected "%s"', Error);
<ide> E('ERR_INVALID_REPL_EVAL_CONFIG',
<del> 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL');
<add> 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL', Error);
<ide> E('ERR_INVALID_SYNC_FORK_INPUT',
<del> 'Asynchronous forks do not support Buffer, Uint8Array or string input: %s');
<del>E('ERR_INVALID_THIS', 'Value of "this" must be of type %s');
<del>E('ERR_INVALID_TUPLE', '%s must be an iterable %s tuple');
<del>E('ERR_INVALID_URI', 'URI malformed');
<del>E('ERR_INVALID_URL', 'Invalid URL: %s');
<add> 'Asynchronous forks do not support Buffer, Uint8Array or string input: %s',
<add> TypeError);
<add>E('ERR_INVALID_THIS', 'Value of "this" must be of type %s', TypeError);
<add>E('ERR_INVALID_TUPLE', '%s must be an iterable %s tuple', TypeError);
<add>E('ERR_INVALID_URI', 'URI malformed', URIError);
<add>E('ERR_INVALID_URL', 'Invalid URL: %s', TypeError);
<ide> E('ERR_INVALID_URL_SCHEME',
<del> (expected) => `The URL must be ${oneOf(expected, 'scheme')}`);
<del>E('ERR_IPC_CHANNEL_CLOSED', 'Channel closed');
<del>E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected');
<del>E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe');
<del>E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks');
<del>E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented');
<del>E('ERR_MISSING_ARGS', missingArgs);
<del>E('ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK',
<del> 'The ES Module loader may not return a format of \'dynamic\' when no ' +
<del> 'dynamicInstantiate function was provided');
<del>E('ERR_MISSING_MODULE', 'Cannot find module %s');
<del>E('ERR_MODULE_RESOLUTION_LEGACY', '%s not found by import in %s.' +
<del> ' Legacy behavior in require() would have found it at %s');
<del>E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
<del>E('ERR_NAPI_CONS_FUNCTION', 'Constructor must be a function');
<del>E('ERR_NAPI_CONS_PROTOTYPE_OBJECT', 'Constructor.prototype must be an object');
<add> (expected) => `The URL must be ${oneOf(expected, 'scheme')}`, TypeError);
<add>E('ERR_IPC_CHANNEL_CLOSED', 'Channel closed', Error);
<add>E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected', Error);
<add>E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe', Error);
<add>E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks', Error);
<add>E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error);
<add>E('ERR_MISSING_ARGS', missingArgs, TypeError);
<add>E('ERR_MISSING_MODULE', 'Cannot find module %s', Error);
<add>E('ERR_MODULE_RESOLUTION_LEGACY',
<add> '%s not found by import in %s.' +
<add> ' Legacy behavior in require() would have found it at %s',
<add> Error);
<add>E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error);
<add>E('ERR_NAPI_CONS_FUNCTION', 'Constructor must be a function', TypeError);
<ide> E('ERR_NAPI_INVALID_DATAVIEW_ARGS',
<ide> 'byte_offset + byte_length should be less than or eqaul to the size in ' +
<del> 'bytes of the array passed in');
<del>E('ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT', 'start offset of %s should be a ' +
<del> 'multiple of %s');
<del>E('ERR_NAPI_INVALID_TYPEDARRAY_LENGTH', 'Invalid typed array length');
<del>E('ERR_NO_CRYPTO', 'Node.js is not compiled with OpenSSL crypto support');
<del>E('ERR_NO_ICU', '%s is not supported on Node.js compiled without ICU');
<del>E('ERR_NO_LONGER_SUPPORTED', '%s is no longer supported');
<del>E('ERR_OUT_OF_RANGE', outOfRange);
<del>E('ERR_PARSE_HISTORY_DATA', 'Could not parse history data in %s');
<del>E('ERR_REQUIRE_ESM', 'Must use import to load ES Module: %s');
<add> 'bytes of the array passed in',
<add> RangeError);
<add>E('ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT',
<add> 'start offset of %s should be a multiple of %s', RangeError);
<add>E('ERR_NAPI_INVALID_TYPEDARRAY_LENGTH',
<add> 'Invalid typed array length', RangeError);
<add>E('ERR_NO_CRYPTO',
<add> 'Node.js is not compiled with OpenSSL crypto support', Error);
<add>E('ERR_NO_ICU',
<add> '%s is not supported on Node.js compiled without ICU', TypeError);
<add>E('ERR_NO_LONGER_SUPPORTED', '%s is no longer supported', Error);
<add>E('ERR_OUT_OF_RANGE', outOfRange, RangeError);
<add>E('ERR_REQUIRE_ESM', 'Must use import to load ES Module: %s', Error);
<ide> E('ERR_SCRIPT_EXECUTION_INTERRUPTED',
<del> 'Script execution was interrupted by `SIGINT`.');
<add> 'Script execution was interrupted by `SIGINT`.', Error);
<ide> E('ERR_SERVER_ALREADY_LISTEN',
<del> 'Listen method has been called more than once without closing.');
<del>E('ERR_SERVER_NOT_RUNNING', 'Server is not running.');
<del>E('ERR_SOCKET_ALREADY_BOUND', 'Socket is already bound');
<del>E('ERR_SOCKET_BAD_BUFFER_SIZE', 'Buffer size must be a positive integer');
<del>E('ERR_SOCKET_BAD_PORT', 'Port should be > 0 and < 65536. Received %s.');
<add> 'Listen method has been called more than once without closing.', Error);
<add>E('ERR_SERVER_NOT_RUNNING', 'Server is not running.', Error);
<add>E('ERR_SOCKET_ALREADY_BOUND', 'Socket is already bound', Error);
<add>E('ERR_SOCKET_BAD_BUFFER_SIZE',
<add> 'Buffer size must be a positive integer', TypeError);
<add>E('ERR_SOCKET_BAD_PORT',
<add> 'Port should be > 0 and < 65536. Received %s.', RangeError);
<ide> E('ERR_SOCKET_BAD_TYPE',
<del> 'Bad socket type specified. Valid types are: udp4, udp6');
<del>E('ERR_SOCKET_BUFFER_SIZE', 'Could not get or set buffer size: %s');
<del>E('ERR_SOCKET_CANNOT_SEND', 'Unable to send data');
<del>E('ERR_SOCKET_CLOSED', 'Socket is closed');
<del>E('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running');
<del>E('ERR_STDERR_CLOSE', 'process.stderr cannot be closed');
<del>E('ERR_STDOUT_CLOSE', 'process.stdout cannot be closed');
<del>E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
<del>E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream');
<del>E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
<del>E('ERR_STREAM_READ_NOT_IMPLEMENTED', '_read() is not implemented');
<del>E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
<del>E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode');
<del>E('ERR_STREAM_WRITE_AFTER_END', 'write after end');
<add> 'Bad socket type specified. Valid types are: udp4, udp6', TypeError);
<add>E('ERR_SOCKET_BUFFER_SIZE', 'Could not get or set buffer size: %s', Error);
<add>E('ERR_SOCKET_CANNOT_SEND', 'Unable to send data', Error);
<add>E('ERR_SOCKET_CLOSED', 'Socket is closed', Error);
<add>E('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running', Error);
<add>E('ERR_STDERR_CLOSE', 'process.stderr cannot be closed', Error);
<add>E('ERR_STDOUT_CLOSE', 'process.stdout cannot be closed', Error);
<add>E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error);
<add>E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
<add>E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error);
<add>E('ERR_STREAM_READ_NOT_IMPLEMENTED', '_read() is not implemented', Error);
<add>E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT',
<add> 'stream.unshift() after end event', Error);
<add>E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode', Error);
<add>E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error);
<ide> E('ERR_SYSTEM_ERROR', sysError('A system error occurred'));
<ide> E('ERR_TLS_CERT_ALTNAME_INVALID',
<del> 'Hostname/IP does not match certificate\'s altnames: %s');
<del>E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048');
<del>E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout');
<add> 'Hostname/IP does not match certificate\'s altnames: %s', Error);
<add>E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048', Error);
<add>E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error);
<ide> E('ERR_TLS_RENEGOTIATION_DISABLED',
<del> 'TLS session renegotiation disabled for this socket');
<del>E('ERR_TLS_RENEGOTIATION_FAILED', 'Failed to renegotiate');
<add> 'TLS session renegotiation disabled for this socket', Error);
<ide> E('ERR_TLS_REQUIRED_SERVER_NAME',
<del> '"servername" is required parameter for Server.addContext');
<del>E('ERR_TLS_SESSION_ATTACK', 'TLS session renegotiation attack detected');
<add> '"servername" is required parameter for Server.addContext', Error);
<add>E('ERR_TLS_SESSION_ATTACK', 'TLS session renegotiation attack detected', Error);
<ide> E('ERR_TLS_SNI_FROM_SERVER',
<del> 'Cannot issue SNI from a TLS server-side socket');
<add> 'Cannot issue SNI from a TLS server-side socket', Error);
<ide> E('ERR_TRANSFORM_ALREADY_TRANSFORMING',
<del> 'Calling transform done when still transforming');
<add> 'Calling transform done when still transforming', Error);
<ide> E('ERR_TRANSFORM_WITH_LENGTH_0',
<del> 'Calling transform done when writableState.length != 0');
<add> 'Calling transform done when writableState.length != 0', Error);
<ide> E('ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET',
<ide> '`process.setupUncaughtExceptionCapture()` was called while a capture ' +
<del> 'callback was already active');
<del>E('ERR_UNESCAPED_CHARACTERS', '%s contains unescaped characters');
<add> 'callback was already active',
<add> Error);
<add>E('ERR_UNESCAPED_CHARACTERS', '%s contains unescaped characters', TypeError);
<ide> E('ERR_UNHANDLED_ERROR',
<ide> (err) => {
<ide> const msg = 'Unhandled error.';
<ide> if (err === undefined) return msg;
<ide> return `${msg} (${err})`;
<del> });
<del>E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s');
<del>E('ERR_UNKNOWN_FILE_EXTENSION', 'Unknown file extension: %s');
<del>E('ERR_UNKNOWN_MODULE_FORMAT', 'Unknown module format: %s');
<del>E('ERR_UNKNOWN_SIGNAL', 'Unknown signal: %s');
<del>E('ERR_UNKNOWN_STDIN_TYPE', 'Unknown stdin file type');
<del>E('ERR_UNKNOWN_STREAM_TYPE', 'Unknown stream file type');
<del>E('ERR_V8BREAKITERATOR', 'Full ICU data not installed. ' +
<del> 'See https://github.com/nodejs/node/wiki/Intl');
<add> }, Error);
<add>E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError);
<add>E('ERR_UNKNOWN_FILE_EXTENSION', 'Unknown file extension: %s', Error);
<add>E('ERR_UNKNOWN_MODULE_FORMAT', 'Unknown module format: %s', RangeError);
<add>E('ERR_UNKNOWN_SIGNAL', 'Unknown signal: %s', TypeError);
<add>E('ERR_UNKNOWN_STDIN_TYPE', 'Unknown stdin file type', Error);
<add>E('ERR_UNKNOWN_STREAM_TYPE', 'Unknown stream file type', Error);
<add>E('ERR_V8BREAKITERATOR',
<add> 'Full ICU data not installed. See https://github.com/nodejs/node/wiki/Intl',
<add> Error);
<ide> E('ERR_VALID_PERFORMANCE_ENTRY_TYPE',
<del> 'At least one valid performance entry type is required');
<del>E('ERR_VM_MODULE_ALREADY_LINKED', 'Module has already been linked');
<add> 'At least one valid performance entry type is required', Error);
<add>E('ERR_VM_MODULE_ALREADY_LINKED', 'Module has already been linked', Error);
<ide> E('ERR_VM_MODULE_DIFFERENT_CONTEXT',
<del> 'Linked modules must use the same context');
<add> 'Linked modules must use the same context', Error);
<ide> E('ERR_VM_MODULE_LINKING_ERRORED',
<del> 'Linking has already failed for the provided module');
<add> 'Linking has already failed for the provided module', Error);
<ide> E('ERR_VM_MODULE_NOT_LINKED',
<del> 'Module must be linked before it can be instantiated');
<del>E('ERR_VM_MODULE_NOT_MODULE', 'Provided module is not an instance of Module');
<del>E('ERR_VM_MODULE_STATUS', 'Module status %s');
<del>E('ERR_ZLIB_BINDING_CLOSED', 'zlib binding closed');
<del>E('ERR_ZLIB_INITIALIZATION_FAILED', 'Initialization failed');
<add> 'Module must be linked before it can be instantiated', Error);
<add>E('ERR_VM_MODULE_NOT_MODULE',
<add> 'Provided module is not an instance of Module', Error);
<add>E('ERR_VM_MODULE_STATUS', 'Module status %s', Error);
<add>E('ERR_ZLIB_BINDING_CLOSED', 'zlib binding closed', Error);
<add>E('ERR_ZLIB_INITIALIZATION_FAILED', 'Initialization failed', Error);
<ide>
<ide> function sysError(defaultMessage) {
<ide> return function(code,
<ide><path>test/parallel/test-internal-errors.js
<ide> assert.strictEqual(
<ide> errors.message('ERR_ENCODING_NOT_SUPPORTED', ['enc']),
<ide> 'The "enc" encoding is not supported');
<ide>
<del>// Test ERR_HTTP2_HEADER_REQUIRED
<del>assert.strictEqual(
<del> errors.message('ERR_HTTP2_HEADER_REQUIRED', ['test']),
<del> 'The test header is required');
<del>
<del>// Test ERR_HTTP2_FRAME_ERROR
<del>assert.strictEqual(
<del> errors.message('ERR_HTTP2_FRAME_ERROR', ['foo', 'bar', 'baz']),
<del> 'Error sending frame type foo for stream baz with code bar');
<del>assert.strictEqual(
<del> errors.message('ERR_HTTP2_FRAME_ERROR', ['foo', 'bar']),
<del> 'Error sending frame type foo with code bar');
<del>
<ide> // Test error messages for async_hooks
<ide> assert.strictEqual(
<ide> errors.message('ERR_ASYNC_CALLBACK', ['init']), | 3 |
Javascript | Javascript | update $location.search() jsdoc signature | 894c7da2f3c88969404bd7178daec827093e2f90 | <ide><path>src/ng/location.js
<ide> LocationHashbangInHtml5Url.prototype =
<ide> * If the argument is a hash object containing an array of values, these values will be encoded
<ide> * as duplicate search parameters in the url.
<ide> *
<del> * @param {(string|Array<string>)=} paramValue If `search` is a string, then `paramValue` will
<del> * override only a single search property.
<add> * @param {(string|Array<string>|boolean)=} paramValue If `search` is a string, then `paramValue`
<add> * will override only a single search property.
<ide> *
<ide> * If `paramValue` is an array, it will override the property of the `search` component of
<ide> * `$location` specified via the first argument.
<ide> *
<ide> * If `paramValue` is `null`, the property specified via the first argument will be deleted.
<ide> *
<add> * If `paramValue` is `true`, the property specified via the first argument will be added with no
<add> * value nor trailing equal sign.
<add> *
<ide> * @return {Object} If called with no arguments returns the parsed `search` object. If called with
<ide> * one or more arguments returns `$location` object itself.
<ide> */ | 1 |
Python | Python | raise exceptions instead of asserts | 0d309ce39ab2582ecb409d0f824d779b7e397c9b | <ide><path>utils/download_glue_data.py
<ide> def format_mrpc(data_dir, path_to_data):
<ide> mrpc_test_file = os.path.join(mrpc_dir, "msr_paraphrase_test.txt")
<ide> urllib.request.urlretrieve(MRPC_TRAIN, mrpc_train_file)
<ide> urllib.request.urlretrieve(MRPC_TEST, mrpc_test_file)
<del> assert os.path.isfile(mrpc_train_file), "Train data not found at %s" % mrpc_train_file
<del> assert os.path.isfile(mrpc_test_file), "Test data not found at %s" % mrpc_test_file
<add> if not os.path.isfile(mrpc_train_file):
<add> raise ValueError(f"Train data not found at {mrpc_train_file}")
<add> if not os.path.isfile(mrpc_test_file):
<add> raise ValueError(f"Test data not found at {mrpc_test_file}")
<ide> urllib.request.urlretrieve(TASK2PATH["MRPC"], os.path.join(mrpc_dir, "dev_ids.tsv"))
<ide>
<ide> dev_ids = []
<ide> def get_tasks(task_names):
<ide> else:
<ide> tasks = []
<ide> for task_name in task_names:
<del> assert task_name in TASKS, "Task %s not found!" % task_name
<add> if task_name not in TASKS:
<add> raise ValueError(f"Task {task_name} not found!")
<ide> tasks.append(task_name)
<ide> return tasks
<ide> | 1 |
Python | Python | change should_response to should_respond | b4324bb9cc3739ffccc55238917b3a1238084131 | <ide><path>tests/api_connexion/endpoints/test_config_endpoint.py
<ide> def setup_method(self) -> None:
<ide> self.client = self.app.test_client() # type:ignore
<ide>
<ide> @patch("airflow.api_connexion.endpoints.config_endpoint.conf.as_dict", return_value=MOCK_CONF)
<del> def test_should_response_200_text_plain(self, mock_as_dict):
<add> def test_should_respond_200_text_plain(self, mock_as_dict):
<ide> response = self.client.get(
<ide> "/api/v1/config", headers={'Accept': 'text/plain'}, environ_overrides={'REMOTE_USER': "test"}
<ide> )
<ide> def test_should_response_200_text_plain(self, mock_as_dict):
<ide> assert expected == response.data.decode()
<ide>
<ide> @patch("airflow.api_connexion.endpoints.config_endpoint.conf.as_dict", return_value=MOCK_CONF)
<del> def test_should_response_200_application_json(self, mock_as_dict):
<add> def test_should_respond_200_application_json(self, mock_as_dict):
<ide> response = self.client.get(
<ide> "/api/v1/config",
<ide> headers={'Accept': 'application/json'},
<ide> def test_should_response_200_application_json(self, mock_as_dict):
<ide> assert expected == response.json
<ide>
<ide> @patch("airflow.api_connexion.endpoints.config_endpoint.conf.as_dict", return_value=MOCK_CONF)
<del> def test_should_response_406(self, mock_as_dict):
<add> def test_should_respond_406(self, mock_as_dict):
<ide> response = self.client.get(
<ide> "/api/v1/config",
<ide> headers={'Accept': 'application/octet-stream'},
<ide><path>tests/api_connexion/endpoints/test_connection_endpoint.py
<ide> def _create_connection(self, session):
<ide>
<ide> class TestDeleteConnection(TestConnectionEndpoint):
<ide> @provide_session
<del> def test_delete_should_response_204(self, session):
<add> def test_delete_should_respond_204(self, session):
<ide> connection_model = Connection(conn_id='test-connection', conn_type='test_type')
<ide>
<ide> session.add(connection_model)
<ide> def test_delete_should_response_204(self, session):
<ide> connection = session.query(Connection).all()
<ide> assert len(connection) == 0
<ide>
<del> def test_delete_should_response_404(self):
<add> def test_delete_should_respond_404(self):
<ide> response = self.client.delete(
<ide> "/api/v1/connections/test-connection", environ_overrides={'REMOTE_USER': "test"}
<ide> )
<ide> def test_should_raise_403_forbidden(self):
<ide>
<ide> class TestGetConnection(TestConnectionEndpoint):
<ide> @provide_session
<del> def test_should_response_200(self, session):
<add> def test_should_respond_200(self, session):
<ide> connection_model = Connection(
<ide> conn_id='test-connection-id',
<ide> conn_type='mysql',
<ide> def test_should_response_200(self, session):
<ide> },
<ide> )
<ide>
<del> def test_should_response_404(self):
<add> def test_should_respond_404(self):
<ide> response = self.client.get(
<ide> "/api/v1/connections/invalid-connection", environ_overrides={'REMOTE_USER': "test"}
<ide> )
<ide> def test_should_raises_401_unauthenticated(self):
<ide>
<ide> class TestGetConnections(TestConnectionEndpoint):
<ide> @provide_session
<del> def test_should_response_200(self, session):
<add> def test_should_respond_200(self, session):
<ide> connection_model_1 = Connection(conn_id='test-connection-id-1', conn_type='test_type')
<ide> connection_model_2 = Connection(conn_id='test-connection-id-2', conn_type='test_type')
<ide> connections = [connection_model_1, connection_model_2]
<ide> class TestPatchConnection(TestConnectionEndpoint):
<ide> ]
<ide> )
<ide> @provide_session
<del> def test_patch_should_response_200(self, payload, session):
<add> def test_patch_should_respond_200(self, payload, session):
<ide> self._create_connection(session)
<ide>
<ide> response = self.client.patch(
<ide> def test_patch_should_response_200(self, payload, session):
<ide> assert response.status_code == 200
<ide>
<ide> @provide_session
<del> def test_patch_should_response_200_with_update_mask(self, session):
<add> def test_patch_should_respond_200_with_update_mask(self, session):
<ide> self._create_connection(session)
<ide> test_connection = "test-connection-id"
<ide> payload = {
<ide> def test_patch_should_response_200_with_update_mask(self, session):
<ide> ]
<ide> )
<ide> @provide_session
<del> def test_patch_should_response_400_for_invalid_fields_in_update_mask(
<add> def test_patch_should_respond_400_for_invalid_fields_in_update_mask(
<ide> self, payload, update_mask, error_message, session
<ide> ):
<ide> self._create_connection(session)
<ide> def test_patch_should_response_400_for_invalid_fields_in_update_mask(
<ide> ]
<ide> )
<ide> @provide_session
<del> def test_patch_should_response_400_for_invalid_update(self, payload, error_message, session):
<add> def test_patch_should_respond_400_for_invalid_update(self, payload, error_message, session):
<ide> self._create_connection(session)
<ide> response = self.client.patch(
<ide> "/api/v1/connections/test-connection-id", json=payload, environ_overrides={'REMOTE_USER': "test"}
<ide> )
<ide> assert response.status_code == 400
<ide> self.assertIn(error_message, response.json['detail'])
<ide>
<del> def test_patch_should_response_404_not_found(self):
<add> def test_patch_should_respond_404_not_found(self):
<ide> payload = {"connection_id": "test-connection-id", "conn_type": "test-type", "port": 90}
<ide> response = self.client.patch(
<ide> "/api/v1/connections/test-connection-id", json=payload, environ_overrides={'REMOTE_USER': "test"}
<ide> def test_should_raises_401_unauthenticated(self, session):
<ide>
<ide> class TestPostConnection(TestConnectionEndpoint):
<ide> @provide_session
<del> def test_post_should_response_200(self, session):
<add> def test_post_should_respond_200(self, session):
<ide> payload = {"connection_id": "test-connection-id", "conn_type": 'test_type'}
<ide> response = self.client.post(
<ide> "/api/v1/connections", json=payload, environ_overrides={'REMOTE_USER': "test"}
<ide> def test_post_should_response_200(self, session):
<ide> assert len(connection) == 1
<ide> self.assertEqual(connection[0].conn_id, 'test-connection-id')
<ide>
<del> def test_post_should_response_400_for_invalid_payload(self):
<add> def test_post_should_respond_400_for_invalid_payload(self):
<ide> payload = {
<ide> "connection_id": "test-connection-id",
<ide> } # conn_type missing
<ide> def test_post_should_response_400_for_invalid_payload(self):
<ide> },
<ide> )
<ide>
<del> def test_post_should_response_409_already_exist(self):
<add> def test_post_should_respond_409_already_exist(self):
<ide> payload = {"connection_id": "test-connection-id", "conn_type": 'test_type'}
<ide> response = self.client.post(
<ide> "/api/v1/connections", json=payload, environ_overrides={'REMOTE_USER': "test"}
<ide><path>tests/api_connexion/endpoints/test_dag_endpoint.py
<ide> def _create_dag_models(self, count, session=None):
<ide>
<ide>
<ide> class TestGetDag(TestDagEndpoint):
<del> def test_should_response_200(self):
<add> def test_should_respond_200(self):
<ide> self._create_dag_models(1)
<ide> response = self.client.get("/api/v1/dags/TEST_DAG_1", environ_overrides={'REMOTE_USER': "test"})
<ide> assert response.status_code == 200
<ide> def test_should_response_200(self):
<ide> )
<ide>
<ide> @provide_session
<del> def test_should_response_200_with_schedule_interval_none(self, session=None):
<add> def test_should_respond_200_with_schedule_interval_none(self, session=None):
<ide> dag_model = DagModel(
<ide> dag_id="TEST_DAG_1",
<ide> fileloc="/tmp/dag_1.py",
<ide> def test_should_response_200_with_schedule_interval_none(self, session=None):
<ide> current_response,
<ide> )
<ide>
<del> def test_should_response_200_with_granular_dag_access(self):
<add> def test_should_respond_200_with_granular_dag_access(self):
<ide> self._create_dag_models(1)
<ide> response = self.client.get(
<ide> "/api/v1/dags/TEST_DAG_1", environ_overrides={'REMOTE_USER': "test_granular_permissions"}
<ide> )
<ide> assert response.status_code == 200
<ide>
<del> def test_should_response_404(self):
<add> def test_should_respond_404(self):
<ide> response = self.client.get("/api/v1/dags/INVALID_DAG", environ_overrides={'REMOTE_USER': "test"})
<ide> assert response.status_code == 404
<ide>
<ide> def test_should_raise_403_forbidden(self):
<ide> )
<ide> assert response.status_code == 403
<ide>
<del> def test_should_response_403_with_granular_access_for_different_dag(self):
<add> def test_should_respond_403_with_granular_access_for_different_dag(self):
<ide> self._create_dag_models(3)
<ide> response = self.client.get(
<ide> "/api/v1/dags/TEST_DAG_2", environ_overrides={'REMOTE_USER': "test_granular_permissions"}
<ide> def test_should_response_403_with_granular_access_for_different_dag(self):
<ide>
<ide>
<ide> class TestGetDagDetails(TestDagEndpoint):
<del> def test_should_response_200(self):
<add> def test_should_respond_200(self):
<ide> response = self.client.get(
<ide> f"/api/v1/dags/{self.dag_id}/details", environ_overrides={'REMOTE_USER': "test"}
<ide> )
<ide> def test_should_response_200(self):
<ide> }
<ide> assert response.json == expected
<ide>
<del> def test_should_response_200_serialized(self):
<add> def test_should_respond_200_serialized(self):
<ide> # Create empty app with empty dagbag to check if DAG is read from db
<ide> with conf_vars({("api", "auth_backend"): "tests.test_utils.remote_user_api_auth_backend"}):
<ide> app_serialized = app.create_app(testing=True)
<ide> def test_should_raises_401_unauthenticated(self):
<ide>
<ide>
<ide> class TestGetDags(TestDagEndpoint):
<del> def test_should_response_200(self):
<add> def test_should_respond_200(self):
<ide> self._create_dag_models(2)
<ide>
<ide> response = self.client.get("api/v1/dags", environ_overrides={'REMOTE_USER': "test"})
<ide> def test_should_response_200(self):
<ide> response.json,
<ide> )
<ide>
<del> def test_should_response_200_with_granular_dag_access(self):
<add> def test_should_respond_200_with_granular_dag_access(self):
<ide> self._create_dag_models(3)
<ide> response = self.client.get(
<ide> "/api/v1/dags", environ_overrides={'REMOTE_USER': "test_granular_permissions"}
<ide> def test_should_response_200_with_granular_dag_access(self):
<ide> ("api/v1/dags?limit=2&offset=2", ["TEST_DAG_2", "TEST_DAG_3"]),
<ide> ]
<ide> )
<del> def test_should_response_200_and_handle_pagination(self, url, expected_dag_ids):
<add> def test_should_respond_200_and_handle_pagination(self, url, expected_dag_ids):
<ide> self._create_dag_models(10)
<ide>
<ide> response = self.client.get(url, environ_overrides={'REMOTE_USER': "test"})
<ide> def test_should_response_200_and_handle_pagination(self, url, expected_dag_ids):
<ide> self.assertEqual(expected_dag_ids, dag_ids)
<ide> self.assertEqual(10, response.json["total_entries"])
<ide>
<del> def test_should_response_200_default_limit(self):
<add> def test_should_respond_200_default_limit(self):
<ide> self._create_dag_models(101)
<ide>
<ide> response = self.client.get("api/v1/dags", environ_overrides={'REMOTE_USER': "test"})
<ide> def test_should_raises_401_unauthenticated(self):
<ide>
<ide> assert_401(response)
<ide>
<del> def test_should_response_403_unauthorized(self):
<add> def test_should_respond_403_unauthorized(self):
<ide> self._create_dag_models(1)
<ide>
<ide> response = self.client.get("api/v1/dags", environ_overrides={'REMOTE_USER': "test_no_permissions"})
<ide> def test_should_response_403_unauthorized(self):
<ide>
<ide>
<ide> class TestPatchDag(TestDagEndpoint):
<del> def test_should_response_200_on_patch_is_paused(self):
<add> def test_should_respond_200_on_patch_is_paused(self):
<ide> dag_model = self._create_dag_model()
<ide> response = self.client.patch(
<ide> f"/api/v1/dags/{dag_model.dag_id}",
<ide> def test_should_response_200_on_patch_is_paused(self):
<ide> }
<ide> self.assertEqual(response.json, expected_response)
<ide>
<del> def test_should_response_200_on_patch_with_granular_dag_access(self):
<add> def test_should_respond_200_on_patch_with_granular_dag_access(self):
<ide> self._create_dag_models(1)
<ide> response = self.client.patch(
<ide> "/api/v1/dags/TEST_DAG_1",
<ide> def test_should_response_200_on_patch_with_granular_dag_access(self):
<ide> )
<ide> assert response.status_code == 200
<ide>
<del> def test_should_response_400_on_invalid_request(self):
<add> def test_should_respond_400_on_invalid_request(self):
<ide> patch_body = {
<ide> "is_paused": True,
<ide> "schedule_interval": {
<ide> def test_should_response_400_on_invalid_request(self):
<ide> },
<ide> )
<ide>
<del> def test_should_response_404(self):
<add> def test_should_respond_404(self):
<ide> response = self.client.get("/api/v1/dags/INVALID_DAG", environ_overrides={'REMOTE_USER': "test"})
<ide> self.assertEqual(response.status_code, 404)
<ide>
<ide> def test_should_raises_401_unauthenticated(self):
<ide>
<ide> assert_401(response)
<ide>
<del> def test_should_response_200_with_update_mask(self):
<add> def test_should_respond_200_with_update_mask(self):
<ide> dag_model = self._create_dag_model()
<ide> payload = {
<ide> "is_paused": False,
<ide> def test_should_response_200_with_update_mask(self):
<ide> ),
<ide> ]
<ide> )
<del> def test_should_response_400_for_invalid_fields_in_update_mask(self, payload, update_mask, error_message):
<add> def test_should_respond_400_for_invalid_fields_in_update_mask(self, payload, update_mask, error_message):
<ide> dag_model = self._create_dag_model()
<ide>
<ide> response = self.client.patch(
<ide> def test_should_response_400_for_invalid_fields_in_update_mask(self, payload, up
<ide> self.assertEqual(response.status_code, 400)
<ide> self.assertEqual(response.json['detail'], error_message)
<ide>
<del> def test_should_response_403_unauthorized(self):
<add> def test_should_respond_403_unauthorized(self):
<ide> dag_model = self._create_dag_model()
<ide> response = self.client.patch(
<ide> f"/api/v1/dags/{dag_model.dag_id}",
<ide><path>tests/api_connexion/endpoints/test_dag_run_endpoint.py
<ide> def _create_test_dag_run(self, state='running', extra_dag=False, commit=True):
<ide>
<ide> class TestDeleteDagRun(TestDagRunEndpoint):
<ide> @provide_session
<del> def test_should_response_204(self, session):
<add> def test_should_respond_204(self, session):
<ide> session.add_all(self._create_test_dag_run())
<ide> session.commit()
<ide> response = self.client.delete(
<ide> def test_should_response_204(self, session):
<ide> )
<ide> self.assertEqual(response.status_code, 404)
<ide>
<del> def test_should_response_404(self):
<add> def test_should_respond_404(self):
<ide> response = self.client.delete(
<ide> "api/v1/dags/INVALID_DAG_RUN/dagRuns/INVALID_DAG_RUN", environ_overrides={'REMOTE_USER': "test"}
<ide> )
<ide> def test_should_raise_403_forbidden(self):
<ide>
<ide> class TestGetDagRun(TestDagRunEndpoint):
<ide> @provide_session
<del> def test_should_response_200(self, session):
<add> def test_should_respond_200(self, session):
<ide> dagrun_model = DagRun(
<ide> dag_id="TEST_DAG_ID",
<ide> run_id="TEST_DAG_RUN_ID",
<ide> def test_should_response_200(self, session):
<ide> }
<ide> assert response.json == expected_response
<ide>
<del> def test_should_response_404(self):
<add> def test_should_respond_404(self):
<ide> response = self.client.get(
<ide> "api/v1/dags/invalid-id/dagRuns/invalid-id", environ_overrides={'REMOTE_USER': "test"}
<ide> )
<ide> def test_should_raises_401_unauthenticated(self, session):
<ide>
<ide> class TestGetDagRuns(TestDagRunEndpoint):
<ide> @provide_session
<del> def test_should_response_200(self, session):
<add> def test_should_respond_200(self, session):
<ide> self._create_test_dag_run()
<ide> result = session.query(DagRun).all()
<ide> assert len(result) == 2
<ide> class TestPostDagRun(TestDagRunEndpoint):
<ide> ]
<ide> )
<ide> @provide_session
<del> def test_should_response_200(self, name, request_json, session):
<add> def test_should_respond_200(self, name, request_json, session):
<ide> del name
<ide> dag_instance = DagModel(dag_id="TEST_DAG_ID")
<ide> session.add(dag_instance)
<ide><path>tests/api_connexion/endpoints/test_dag_source_endpoint.py
<ide> def _get_dag_file_docstring(fileloc: str) -> str:
<ide> return docstring
<ide>
<ide> @parameterized.expand([(True,), (False,)])
<del> def test_should_response_200_text(self, store_dag_code):
<add> def test_should_respond_200_text(self, store_dag_code):
<ide> serializer = URLSafeSerializer(conf.get('webserver', 'SECRET_KEY'))
<ide> with mock.patch("airflow.models.dag.settings.STORE_DAG_CODE", store_dag_code), mock.patch(
<ide> "airflow.models.dagcode.STORE_DAG_CODE", store_dag_code
<ide> def test_should_response_200_text(self, store_dag_code):
<ide> self.assertEqual('text/plain', response.headers['Content-Type'])
<ide>
<ide> @parameterized.expand([(True,), (False,)])
<del> def test_should_response_200_json(self, store_dag_code):
<add> def test_should_respond_200_json(self, store_dag_code):
<ide> serializer = URLSafeSerializer(conf.get('webserver', 'SECRET_KEY'))
<ide> with mock.patch("airflow.models.dag.settings.STORE_DAG_CODE", store_dag_code), mock.patch(
<ide> "airflow.models.dagcode.STORE_DAG_CODE", store_dag_code
<ide> def test_should_response_200_json(self, store_dag_code):
<ide> self.assertEqual('application/json', response.headers['Content-Type'])
<ide>
<ide> @parameterized.expand([(True,), (False,)])
<del> def test_should_response_406(self, store_dag_code):
<add> def test_should_respond_406(self, store_dag_code):
<ide> serializer = URLSafeSerializer(conf.get('webserver', 'SECRET_KEY'))
<ide> with mock.patch("airflow.models.dag.settings.STORE_DAG_CODE", store_dag_code), mock.patch(
<ide> "airflow.models.dagcode.STORE_DAG_CODE", store_dag_code
<ide> def test_should_response_406(self, store_dag_code):
<ide> self.assertEqual(406, response.status_code)
<ide>
<ide> @parameterized.expand([(True,), (False,)])
<del> def test_should_response_404(self, store_dag_code):
<add> def test_should_respond_404(self, store_dag_code):
<ide> with mock.patch("airflow.models.dag.settings.STORE_DAG_CODE", store_dag_code), mock.patch(
<ide> "airflow.models.dagcode.STORE_DAG_CODE", store_dag_code
<ide> ):
<ide><path>tests/api_connexion/endpoints/test_event_log_endpoint.py
<ide> def _create_task_instance(self):
<ide>
<ide> class TestGetEventLog(TestEventLogEndpoint):
<ide> @provide_session
<del> def test_should_response_200(self, session):
<add> def test_should_respond_200(self, session):
<ide> log_model = Log(
<ide> event='TEST_EVENT',
<ide> task_instance=self._create_task_instance(),
<ide> def test_should_response_200(self, session):
<ide> },
<ide> )
<ide>
<del> def test_should_response_404(self):
<add> def test_should_respond_404(self):
<ide> response = self.client.get("/api/v1/eventLogs/1", environ_overrides={'REMOTE_USER': "test"})
<ide> assert response.status_code == 404
<ide> self.assertEqual(
<ide> def test_should_raise_403_forbidden(self):
<ide>
<ide> class TestGetEventLogs(TestEventLogEndpoint):
<ide> @provide_session
<del> def test_should_response_200(self, session):
<add> def test_should_respond_200(self, session):
<ide> log_model_1 = Log(
<ide> event='TEST_EVENT_1',
<ide> task_instance=self._create_task_instance(),
<ide><path>tests/api_connexion/endpoints/test_extra_link_endpoint.py
<ide> def _create_dag():
<ide> ),
<ide> ]
<ide> )
<del> def test_should_response_404(self, name, url, expected_title, expected_detail):
<add> def test_should_respond_404(self, name, url, expected_title, expected_detail):
<ide> del name
<ide> response = self.client.get(url, environ_overrides={'REMOTE_USER': "test"})
<ide>
<ide> def test_should_raise_403_forbidden(self):
<ide> assert response.status_code == 403
<ide>
<ide> @mock_plugin_manager(plugins=[])
<del> def test_should_response_200(self):
<add> def test_should_respond_200(self):
<ide> XCom.set(
<ide> key="job_id",
<ide> value="TEST_JOB_ID",
<ide> def test_should_response_200(self):
<ide> )
<ide>
<ide> @mock_plugin_manager(plugins=[])
<del> def test_should_response_200_missing_xcom(self):
<add> def test_should_respond_200_missing_xcom(self):
<ide> response = self.client.get(
<ide> "/api/v1/dags/TEST_DAG_ID/dagRuns/TEST_DAG_RUN_ID/taskInstances/TEST_SINGLE_QUERY/links",
<ide> environ_overrides={'REMOTE_USER': "test"},
<ide> def test_should_response_200_missing_xcom(self):
<ide> )
<ide>
<ide> @mock_plugin_manager(plugins=[])
<del> def test_should_response_200_multiple_links(self):
<add> def test_should_respond_200_multiple_links(self):
<ide> XCom.set(
<ide> key="job_id",
<ide> value=["TEST_JOB_ID_1", "TEST_JOB_ID_2"],
<ide> def test_should_response_200_multiple_links(self):
<ide> )
<ide>
<ide> @mock_plugin_manager(plugins=[])
<del> def test_should_response_200_multiple_links_missing_xcom(self):
<add> def test_should_respond_200_multiple_links_missing_xcom(self):
<ide> response = self.client.get(
<ide> "/api/v1/dags/TEST_DAG_ID/dagRuns/TEST_DAG_RUN_ID/taskInstances/TEST_MULTIPLE_QUERY/links",
<ide> environ_overrides={'REMOTE_USER': "test"},
<ide> def test_should_response_200_multiple_links_missing_xcom(self):
<ide> response.json,
<ide> )
<ide>
<del> def test_should_response_200_support_plugins(self):
<add> def test_should_respond_200_support_plugins(self):
<ide> class GoogleLink(BaseOperatorLink):
<ide> name = "Google"
<ide>
<ide><path>tests/api_connexion/endpoints/test_log_endpoint.py
<ide> def tearDown(self):
<ide> super().tearDown()
<ide>
<ide> @provide_session
<del> def test_should_response_200_json(self, session):
<add> def test_should_respond_200_json(self, session):
<ide> self._create_dagrun(session)
<ide> key = self.app.config["SECRET_KEY"]
<ide> serializer = URLSafeSerializer(key)
<ide> def test_should_response_200_json(self, session):
<ide> self.assertEqual(200, response.status_code)
<ide>
<ide> @provide_session
<del> def test_should_response_200_text_plain(self, session):
<add> def test_should_respond_200_text_plain(self, session):
<ide> self._create_dagrun(session)
<ide> key = self.app.config["SECRET_KEY"]
<ide> serializer = URLSafeSerializer(key)
<ide><path>tests/api_connexion/endpoints/test_task_endpoint.py
<ide> def tearDown(self) -> None:
<ide>
<ide>
<ide> class TestGetTask(TestTaskEndpoint):
<del> def test_should_response_200(self):
<add> def test_should_respond_200(self):
<ide> expected = {
<ide> "class_ref": {
<ide> "class_name": "DummyOperator",
<ide> def test_should_response_200(self):
<ide> assert response.status_code == 200
<ide> assert response.json == expected
<ide>
<del> def test_should_response_200_serialized(self):
<add> def test_should_respond_200_serialized(self):
<ide> # Create empty app with empty dagbag to check if DAG is read from db
<ide> with conf_vars({("api", "auth_backend"): "tests.test_utils.remote_user_api_auth_backend"}):
<ide> app_serialized = app.create_app(testing=True)
<ide> def test_should_response_200_serialized(self):
<ide> assert response.status_code == 200
<ide> assert response.json == expected
<ide>
<del> def test_should_response_404(self):
<add> def test_should_respond_404(self):
<ide> task_id = "xxxx_not_existing"
<ide> response = self.client.get(
<ide> f"/api/v1/dags/{self.dag_id}/tasks/{task_id}", environ_overrides={'REMOTE_USER': "test"}
<ide> def test_should_raise_403_forbidden(self):
<ide>
<ide>
<ide> class TestGetTasks(TestTaskEndpoint):
<del> def test_should_response_200(self):
<add> def test_should_respond_200(self):
<ide> expected = {
<ide> "tasks": [
<ide> {
<ide> def test_should_response_200(self):
<ide> assert response.status_code == 200
<ide> assert response.json == expected
<ide>
<del> def test_should_response_404(self):
<add> def test_should_respond_404(self):
<ide> dag_id = "xxxx_not_existing"
<ide> response = self.client.get(f"/api/v1/dags/{dag_id}/tasks", environ_overrides={'REMOTE_USER': "test"})
<ide> assert response.status_code == 404
<ide><path>tests/api_connexion/endpoints/test_task_instance_endpoint.py
<ide> def create_task_instances(
<ide>
<ide> class TestGetTaskInstance(TestTaskInstanceEndpoint):
<ide> @provide_session
<del> def test_should_response_200(self, session):
<add> def test_should_respond_200(self, session):
<ide> self.create_task_instances(session)
<ide> response = self.client.get(
<ide> "/api/v1/dags/example_python_operator/dagRuns/TEST_DAG_RUN_ID/taskInstances/print_the_context",
<ide> def test_should_response_200(self, session):
<ide> )
<ide>
<ide> @provide_session
<del> def test_should_response_200_task_instance_with_sla(self, session):
<add> def test_should_respond_200_task_instance_with_sla(self, session):
<ide> self.create_task_instances(session)
<ide> session.query()
<ide> sla_miss = SlaMiss(
<ide> class TestGetTaskInstances(TestTaskInstanceEndpoint):
<ide> ]
<ide> )
<ide> @provide_session
<del> def test_should_response_200(self, _, task_instances, update_extras, url, expected_ti, session):
<add> def test_should_respond_200(self, _, task_instances, update_extras, url, expected_ti, session):
<ide> self.create_task_instances(
<ide> session,
<ide> update_extras=update_extras,
<ide> def test_should_response_200(self, _, task_instances, update_extras, url, expect
<ide> self.assertEqual(len(response.json["task_instances"]), expected_ti)
<ide>
<ide> @provide_session
<del> def test_should_response_200_for_dag_id_filter(self, session):
<add> def test_should_respond_200_for_dag_id_filter(self, session):
<ide> self.create_task_instances(session)
<ide> self.create_task_instances(session, dag_id="example_skip_dag")
<ide> response = self.client.get(
<ide> class TestGetTaskInstancesBatch(TestTaskInstanceEndpoint):
<ide> ]
<ide> )
<ide> @provide_session
<del> def test_should_response_200(
<add> def test_should_respond_200(
<ide> self, _, task_instances, update_extras, single_dag_run, payload, expected_ti_count, session
<ide> ):
<ide> self.create_task_instances(
<ide> def test_should_response_200(
<ide> ],
<ide> )
<ide> @provide_session
<del> def test_should_response_200_dag_ids_filter(self, _, payload, expected_ti, total_ti, session):
<add> def test_should_respond_200_dag_ids_filter(self, _, payload, expected_ti, total_ti, session):
<ide> self.create_task_instances(session)
<ide> self.create_task_instances(session, dag_id="example_skip_dag")
<ide> response = self.client.post(
<ide> class TestPostClearTaskInstances(TestTaskInstanceEndpoint):
<ide> ]
<ide> )
<ide> @provide_session
<del> def test_should_response_200(
<add> def test_should_respond_200(
<ide> self, _, main_dag, task_instances, request_dag, payload, expected_ti, session
<ide> ):
<ide> self.create_task_instances(
<ide> def test_should_response_200(
<ide> self.assertEqual(len(response.json["task_instances"]), expected_ti)
<ide>
<ide> @provide_session
<del> def test_should_response_200_with_reset_dag_run(self, session):
<add> def test_should_respond_200_with_reset_dag_run(self, session):
<ide> dag_id = "example_python_operator"
<ide> payload = {
<ide> "dry_run": False,
<ide><path>tests/api_connexion/endpoints/test_variable_endpoint.py
<ide> def test_should_delete_variable(self):
<ide> response = self.client.get("/api/v1/variables/delete_var1", environ_overrides={'REMOTE_USER': "test"})
<ide> assert response.status_code == 404
<ide>
<del> def test_should_response_404_if_key_does_not_exist(self):
<add> def test_should_respond_404_if_key_does_not_exist(self):
<ide> response = self.client.delete(
<ide> "/api/v1/variables/NONEXIST_VARIABLE_KEY", environ_overrides={'REMOTE_USER': "test"}
<ide> )
<ide> def test_should_raise_403_forbidden(self):
<ide>
<ide>
<ide> class TestGetVariable(TestVariableEndpoint):
<del> def test_should_response_200(self):
<add> def test_should_respond_200(self):
<ide> expected_value = '{"foo": 1}'
<ide> Variable.set("TEST_VARIABLE_KEY", expected_value)
<ide> response = self.client.get(
<ide> def test_should_response_200(self):
<ide> assert response.status_code == 200
<ide> assert response.json == {"key": "TEST_VARIABLE_KEY", "value": expected_value}
<ide>
<del> def test_should_response_404_if_not_found(self):
<add> def test_should_respond_404_if_not_found(self):
<ide> response = self.client.get(
<ide> "/api/v1/variables/NONEXIST_VARIABLE_KEY", environ_overrides={'REMOTE_USER': "test"}
<ide> )
<ide><path>tests/api_connexion/endpoints/test_version_endpoint.py
<ide> def setUp(self) -> None:
<ide> @mock.patch(
<ide> "airflow.api_connexion.endpoints.version_endpoint.get_airflow_git_version", return_value="GIT_COMMIT"
<ide> )
<del> def test_should_response_200(self, mock_get_airflow_get_commit):
<add> def test_should_respond_200(self, mock_get_airflow_get_commit):
<ide> response = self.client.get("/api/v1/version")
<ide>
<ide> self.assertEqual(200, response.status_code)
<ide><path>tests/api_connexion/endpoints/test_xcom_endpoint.py
<ide> def tearDown(self) -> None:
<ide>
<ide>
<ide> class TestGetXComEntry(TestXComEndpoint):
<del> def test_should_response_200(self):
<add> def test_should_respond_200(self):
<ide> dag_id = 'test-dag-id'
<ide> task_id = 'test-task-id'
<ide> execution_date = '2005-04-02T00:00:00+00:00'
<ide> def _create_xcom_entry(self, dag_id, dag_run_id, execution_date, task_id, xcom_k
<ide>
<ide>
<ide> class TestGetXComEntries(TestXComEndpoint):
<del> def test_should_response_200(self):
<add> def test_should_respond_200(self):
<ide> dag_id = 'test-dag-id'
<ide> task_id = 'test-task-id'
<ide> execution_date = '2005-04-02T00:00:00+00:00'
<ide> def test_should_response_200(self):
<ide> },
<ide> )
<ide>
<del> def test_should_response_200_with_tilde_and_access_to_all_dags(self):
<add> def test_should_respond_200_with_tilde_and_access_to_all_dags(self):
<ide> dag_id_1 = 'test-dag-id-1'
<ide> task_id_1 = 'test-task-id-1'
<ide> execution_date = '2005-04-02T00:00:00+00:00'
<ide> def test_should_response_200_with_tilde_and_access_to_all_dags(self):
<ide> },
<ide> )
<ide>
<del> def test_should_response_200_with_tilde_and_granular_dag_access(self):
<add> def test_should_respond_200_with_tilde_and_granular_dag_access(self):
<ide> dag_id_1 = 'test-dag-id-1'
<ide> task_id_1 = 'test-task-id-1'
<ide> execution_date = '2005-04-02T00:00:00+00:00' | 13 |
Java | Java | introduce soft assertions for webtestclient | 25dca404138e85e8864e4bfa4b37c88f236a559e | <ide><path>spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java
<ide> import java.nio.charset.StandardCharsets;
<ide> import java.time.Duration;
<ide> import java.time.ZonedDateTime;
<add>import java.util.ArrayList;
<ide> import java.util.Arrays;
<ide> import java.util.LinkedHashMap;
<ide> import java.util.List;
<ide> public <T> FluxExchangeResult<T> returnResult(ParameterizedTypeReference<T> elem
<ide> Flux<T> body = this.response.bodyToFlux(elementTypeRef);
<ide> return new FluxExchangeResult<>(this.exchangeResult, body);
<ide> }
<add>
<add> @Override
<add> public ResponseSpec expectAllSoftly(ResponseSpecMatcher... asserts) {
<add> List<String> failedMessages = new ArrayList<>();
<add> for (int i = 0; i < asserts.length; i++) {
<add> ResponseSpecMatcher anAssert = asserts[i];
<add> try {
<add> anAssert.accept(this);
<add> }
<add> catch (AssertionError assertionException) {
<add> failedMessages.add("[" + i + "] " + assertionException.getMessage());
<add> }
<add> }
<add> if (!failedMessages.isEmpty()) {
<add> throw new AssertionError(String.join("\n", failedMessages));
<add> }
<add> return this;
<add> }
<ide> }
<ide>
<ide>
<ide><path>spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java
<ide> interface ResponseSpec {
<ide> * about a target type with generics.
<ide> */
<ide> <T> FluxExchangeResult<T> returnResult(ParameterizedTypeReference<T> elementTypeRef);
<add>
<add> /**
<add> * Array of assertions to test together a.k.a. soft assertions.
<add> */
<add> ResponseSpec expectAllSoftly(ResponseSpecMatcher... asserts);
<ide> }
<ide>
<ide>
<ide> default XpathAssertions xpath(String expression, Object... args) {
<ide> EntityExchangeResult<byte[]> returnResult();
<ide> }
<ide>
<add> interface ResponseSpecMatcher extends Consumer<ResponseSpec> {}
<ide> }
<ide><path>spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/SoftAssertionTests.java
<add>/*
<add> * Copyright 2002-2021 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * https://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>package org.springframework.test.web.reactive.server.samples;
<add>
<add>import org.junit.jupiter.api.BeforeEach;
<add>import org.junit.jupiter.api.Test;
<add>
<add>import org.springframework.test.web.reactive.server.WebTestClient;
<add>import org.springframework.web.bind.annotation.GetMapping;
<add>import org.springframework.web.bind.annotation.RestController;
<add>
<add>import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
<add>
<add>/**
<add> * Samples of tests using {@link WebTestClient} with soft assertions.
<add> *
<add> * @author Michał Rowicki
<add> * @since 5.3
<add> */
<add>public class SoftAssertionTests {
<add>
<add> private WebTestClient client;
<add>
<add>
<add> @BeforeEach
<add> public void setUp() throws Exception {
<add> this.client = WebTestClient.bindToController(new TestController()).build();
<add> }
<add>
<add>
<add> @Test
<add> public void test() throws Exception {
<add> this.client.get().uri("/test")
<add> .exchange()
<add> .expectAllSoftly(
<add> exchange -> exchange.expectStatus().isOk(),
<add> exchange -> exchange.expectBody(String.class).isEqualTo("It works!")
<add> );
<add> }
<add>
<add> @Test
<add> public void testAllFails() throws Exception {
<add> assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
<add> this.client.get().uri("/test")
<add> .exchange()
<add> .expectAllSoftly(
<add> exchange -> exchange.expectStatus().isBadRequest(),
<add> exchange -> exchange.expectBody(String.class).isEqualTo("It won't work :(")
<add> )
<add> ).withMessage("[0] Status expected:<400 BAD_REQUEST> but was:<200 OK>\n[1] Response body expected:<It won't work :(> but was:<It works!>");
<add> }
<add>
<add>
<add> @RestController
<add> static class TestController {
<add>
<add> @GetMapping("/test")
<add> public String handle() {
<add> return "It works!";
<add> }
<add> }
<add>} | 3 |
Mixed | Go | resolve the config file from the sudo user | afde6450ee7bd4a43765fdc0a9799b411276d9e4 | <ide><path>cliconfig/config.go
<ide> var (
<ide> configDir = os.Getenv("DOCKER_CONFIG")
<ide> )
<ide>
<add>func getDefaultConfigDir(confFile string) string {
<add> confDir := filepath.Join(homedir.Get(), confFile)
<add> // if the directory doesn't exist, maybe we called docker with sudo
<add> if _, err := os.Stat(configDir); err != nil {
<add> if os.IsNotExist(err) {
<add> return filepath.Join(homedir.GetWithSudoUser(), confFile)
<add> }
<add> }
<add> return confDir
<add>}
<add>
<ide> func init() {
<ide> if configDir == "" {
<del> configDir = filepath.Join(homedir.Get(), ".docker")
<add> configDir = getDefaultConfigDir(".docker")
<ide> }
<ide> }
<ide>
<ide> func Load(configDir string) (*ConfigFile, error) {
<ide> }
<ide>
<ide> // Can't find latest config file so check for the old one
<del> confFile := filepath.Join(homedir.Get(), oldConfigfile)
<add> confFile := getDefaultConfigDir(oldConfigfile)
<ide> if _, err := os.Stat(confFile); err != nil {
<ide> return &configFile, nil //missing file is not an error
<ide> }
<ide><path>docs/reference/commandline/cli.md
<ide> For example:
<ide> Instructs Docker to use the configuration files in your `~/testconfigs/`
<ide> directory when running the `ps` command.
<ide>
<add>> **Note**: If you run docker commands with `sudo`, Docker first looks for a configuration
<add>> file in `/root/.docker/`, before looking in `~/.docker/` for the user that did the sudo call.
<add>
<ide> Docker manages most of the files in the configuration directory
<ide> and you should not modify them. However, you *can modify* the
<ide> `config.json` file to control certain aspects of how the `docker`
<ide><path>image/v1/imagev1.go
<ide> func rawJSON(value interface{}) *json.RawMessage {
<ide> // ValidateID checks whether an ID string is a valid image ID.
<ide> func ValidateID(id string) error {
<ide> if ok := validHex.MatchString(id); !ok {
<del> return fmt.Errorf("image ID '%s' is invalid ", id)
<add> return fmt.Errorf("image ID %q is invalid", id)
<ide> }
<ide> return nil
<ide> }
<ide><path>pkg/homedir/homedir.go
<ide> func Get() string {
<ide> return home
<ide> }
<ide>
<add>// GetWithSudoUser returns the home directory of the user who called sudo (if
<add>// available, retrieved from $SUDO_USER). It fallbacks to Get if any error occurs.
<add>// Returned path should be used with "path/filepath" to form new paths.
<add>func GetWithSudoUser() string {
<add> sudoUser := os.Getenv("SUDO_USER")
<add> if sudoUser != "" {
<add> if user, err := user.LookupUser(sudoUser); err == nil {
<add> return user.Home
<add> }
<add> }
<add> return Get()
<add>}
<add>
<ide> // GetShortcutString returns the string that is shortcut to user's home directory
<ide> // in the native shell of the platform running on.
<ide> func GetShortcutString() string { | 4 |
Ruby | Ruby | reject build and test dependency | 2888d050f78f047fb82ec97709483978b6d74728 | <ide><path>Library/Homebrew/cask_dependent.rb
<ide> def full_name
<ide> end
<ide>
<ide> def runtime_dependencies(ignore_missing: false)
<del> recursive_dependencies(ignore_missing: ignore_missing).select do |dependency|
<del> dependency.tags.blank?
<add> recursive_dependencies(ignore_missing: ignore_missing).reject do |dependency|
<add> tags = dependency.tags
<add> tags.include?(:build) || tags.include?(:test)
<ide> end
<ide> end
<ide> | 1 |
Go | Go | keep track of the container start time | 64fc86fba760dd5cb34cd6d9f3ddf13dc3dc4280 | <ide><path>state.go
<ide> package docker
<ide>
<ide> import (
<ide> "sync"
<add> "time"
<ide> )
<ide>
<ide> type State struct {
<ide> Running bool
<ide> Pid int
<ide> ExitCode int
<add> StartedAt time.Time
<ide>
<ide> stateChangeLock *sync.Mutex
<ide> stateChangeCond *sync.Cond
<ide> func (s *State) setRunning(pid int) {
<ide> s.Running = true
<ide> s.ExitCode = 0
<ide> s.Pid = pid
<add> s.StartedAt = time.Now()
<ide> s.broadcast()
<ide> }
<ide> | 1 |
Python | Python | fix typo in gcp credentials_provider's docstring | b86bf79bff615e61de98bead4d02eace5690d5fb | <ide><path>airflow/providers/google/cloud/utils/credentials_provider.py
<ide> def get_credentials_and_project_id(
<ide>
<ide> :param key_path: Path to GCP Credential JSON file
<ide> :type key_path: str
<del> :param key_dict: A dict representing GCP Credential as in the Credential JSON file
<del> :type key_dict: Dict[str, str]
<add> :param keyfile_dict: A dict representing GCP Credential as in the Credential JSON file
<add> :type keyfile_dict: Dict[str, str]
<ide> :param scopes: OAuth scopes for the connection
<ide> :type scopes: Sequence[str]
<ide> :param delegate_to: The account to impersonate, if any. | 1 |
Java | Java | remove write pausing in undertow response | 224589ea74a2bfd4230e67331c109944df7260b4 | <ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java
<ide> protected void dataReceived(T data) {
<ide> * Invoked after the current data has been written and before requesting
<ide> * the next item from the upstream, write Publisher.
<ide> * <p>The default implementation is a no-op.
<add> * @deprecated originally introduced for Undertow to stop write notifications
<add> * when no data is available, but deprecated as of as of 5.0.6 since constant
<add> * switching on every requested item causes a significant slowdown.
<ide> */
<add> @Deprecated
<ide> protected void writingPaused() {
<ide> }
<ide>
<ide> public <T> void onComplete(AbstractListenerWriteProcessor<T> processor) {
<ide> },
<ide>
<ide> RECEIVED {
<add> @SuppressWarnings("deprecation")
<ide> @Override
<ide> public <T> void onWritePossible(AbstractListenerWriteProcessor<T> processor) {
<ide> if (processor.changeState(this, WRITING)) {
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/UndertowServerHttpResponse.java
<ide> protected boolean isDataEmpty(DataBuffer dataBuffer) {
<ide> return (dataBuffer.readableByteCount() == 0);
<ide> }
<ide>
<del> @Override
<del> protected void writingPaused() {
<del> this.channel.suspendWrites();
<del> }
<del>
<ide> @Override
<ide> protected void writingComplete() {
<ide> this.channel.getWriteSetter().set(null); | 2 |
Python | Python | use context manager to manage pools | 36d9274f4ea87f28e2dcbab393b21e34a04eec30 | <ide><path>docs/build_docs.py
<ide> def run_in_parallel(
<ide> verbose,
<ide> ):
<ide> """Run both - spellcheck and docs build sequentially without multiprocessing"""
<del> pool = multiprocessing.Pool(processes=jobs)
<del> if not spellcheck_only:
<del> run_docs_build_in_parallel(
<del> all_build_errors=all_build_errors,
<del> for_production=for_production,
<del> current_packages=current_packages,
<del> verbose=verbose,
<del> pool=pool,
<del> )
<del> if not docs_only:
<del> run_spell_check_in_parallel(
<del> all_spelling_errors=all_spelling_errors,
<del> for_production=for_production,
<del> current_packages=current_packages,
<del> verbose=verbose,
<del> pool=pool,
<del> )
<add> with multiprocessing.Pool(processes=jobs) as pool:
<add> if not spellcheck_only:
<add> run_docs_build_in_parallel(
<add> all_build_errors=all_build_errors,
<add> for_production=for_production,
<add> current_packages=current_packages,
<add> verbose=verbose,
<add> pool=pool,
<add> )
<add> if not docs_only:
<add> run_spell_check_in_parallel(
<add> all_spelling_errors=all_spelling_errors,
<add> for_production=for_production,
<add> current_packages=current_packages,
<add> verbose=verbose,
<add> pool=pool,
<add> )
<ide>
<ide>
<ide> def print_build_output(result: BuildDocsResult): | 1 |
Javascript | Javascript | use braces for multiline block | 095c0de94d818088cacf2c33ad4913768c15024a | <ide><path>benchmark/buffers/buffer-iterate.js
<ide> function main(conf) {
<ide> function benchFor(buffer, n) {
<ide> bench.start();
<ide>
<del> for (var k = 0; k < n; k++)
<del> for (var i = 0; i < buffer.length; i++)
<add> for (var k = 0; k < n; k++) {
<add> for (var i = 0; i < buffer.length; i++) {
<ide> assert(buffer[i] === 0);
<add> }
<add> }
<ide>
<ide> bench.end(n);
<ide> }
<ide>
<ide> function benchForOf(buffer, n) {
<ide> bench.start();
<ide>
<del> for (var k = 0; k < n; k++)
<del> for (var b of buffer)
<add> for (var k = 0; k < n; k++) {
<add> for (var b of buffer) {
<ide> assert(b === 0);
<del>
<add> }
<add> }
<ide> bench.end(n);
<ide> }
<ide>
<ide><path>benchmark/dgram/array-vs-concat.js
<ide> function server() {
<ide> var onsend = type === 'concat' ? onsendConcat : onsendMulti;
<ide>
<ide> function onsendConcat() {
<del> if (sent++ % num === 0)
<add> if (sent++ % num === 0) {
<ide> for (var i = 0; i < num; i++) {
<ide> socket.send(Buffer.concat(chunk), PORT, '127.0.0.1', onsend);
<ide> }
<add> }
<ide> }
<ide>
<ide> function onsendMulti() {
<del> if (sent++ % num === 0)
<add> if (sent++ % num === 0) {
<ide> for (var i = 0; i < num; i++) {
<ide> socket.send(chunk, PORT, '127.0.0.1', onsend);
<ide> }
<add> }
<ide> }
<ide>
<ide> socket.on('listening', function() {
<ide><path>benchmark/dgram/multi-buffer.js
<ide> function server() {
<ide> var socket = dgram.createSocket('udp4');
<ide>
<ide> function onsend() {
<del> if (sent++ % num === 0)
<del> for (var i = 0; i < num; i++)
<add> if (sent++ % num === 0) {
<add> for (var i = 0; i < num; i++) {
<ide> socket.send(chunk, PORT, '127.0.0.1', onsend);
<add> }
<add> }
<ide> }
<ide>
<ide> socket.on('listening', function() {
<ide><path>benchmark/dgram/offset-length.js
<ide> function server() {
<ide> var socket = dgram.createSocket('udp4');
<ide>
<ide> function onsend() {
<del> if (sent++ % num === 0)
<del> for (var i = 0; i < num; i++)
<add> if (sent++ % num === 0) {
<add> for (var i = 0; i < num; i++) {
<ide> socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend);
<add> }
<add> }
<ide> }
<ide>
<ide> socket.on('listening', function() {
<ide><path>benchmark/dgram/single-buffer.js
<ide> function server() {
<ide> var socket = dgram.createSocket('udp4');
<ide>
<ide> function onsend() {
<del> if (sent++ % num === 0)
<del> for (var i = 0; i < num; i++)
<add> if (sent++ % num === 0) {
<add> for (var i = 0; i < num; i++) {
<ide> socket.send(chunk, PORT, '127.0.0.1', onsend);
<add> }
<add> }
<ide> }
<ide>
<ide> socket.on('listening', function() {
<ide><path>benchmark/url/url-searchparams-iteration.js
<ide> function iterator(n) {
<ide> const noDead = [];
<ide>
<ide> bench.start();
<del> for (var i = 0; i < n; i += 1)
<add> for (var i = 0; i < n; i += 1) {
<ide> for (var pair of params) {
<ide> noDead[0] = pair[0];
<ide> noDead[1] = pair[1];
<ide> }
<add> }
<ide> bench.end(n);
<ide>
<ide> assert.strictEqual(noDead[0], 'three');
<ide><path>lib/_http_client.js
<ide> ClientRequest.prototype.abort = function abort() {
<ide> this.aborted = Date.now();
<ide>
<ide> // If we're aborting, we don't care about any more response data.
<del> if (this.res)
<add> if (this.res) {
<ide> this.res._dump();
<del> else
<add> } else {
<ide> this.once('response', function(res) {
<ide> res._dump();
<ide> });
<add> }
<ide>
<ide> // In the event that we don't have a socket, we will pop out of
<ide> // the request queue through handling in onSocket.
<ide><path>lib/_http_outgoing.js
<ide> OutgoingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
<ide> // any messages, before ever calling this. In that case, just skip
<ide> // it, since something else is destroying this connection anyway.
<ide> OutgoingMessage.prototype.destroy = function destroy(error) {
<del> if (this.socket)
<add> if (this.socket) {
<ide> this.socket.destroy(error);
<del> else
<add> } else {
<ide> this.once('socket', function(socket) {
<ide> socket.destroy(error);
<ide> });
<add> }
<ide> };
<ide>
<ide>
<ide> function matchHeader(self, state, field, value) {
<ide>
<ide> function validateHeader(msg, name, value) {
<ide> if (typeof name !== 'string' || !name || !checkIsHttpToken(name))
<del> throw new TypeError(
<del> 'Header name must be a valid HTTP Token ["' + name + '"]');
<add> throw new TypeError(`Header name must be a valid HTTP Token ["${name}"]`);
<ide> if (value === undefined)
<ide> throw new Error('"value" required in setHeader("' + name + '", value)');
<ide> if (msg._header)
<ide><path>lib/_http_server.js
<ide> function writeHead(statusCode, reason, obj) {
<ide> var originalStatusCode = statusCode;
<ide>
<ide> statusCode |= 0;
<del> if (statusCode < 100 || statusCode > 999)
<add> if (statusCode < 100 || statusCode > 999) {
<ide> throw new errors.RangeError('ERR_HTTP_INVALID_STATUS_CODE',
<ide> originalStatusCode);
<add> }
<ide>
<ide>
<ide> if (typeof reason === 'string') {
<ide> function writeHead(statusCode, reason, obj) {
<ide> headers = obj;
<ide> }
<ide>
<del> if (common._checkInvalidHeaderChar(this.statusMessage))
<add> if (common._checkInvalidHeaderChar(this.statusMessage)) {
<ide> throw new errors.Error('ERR_HTTP_INVALID_CHAR',
<ide> 'Invalid character in statusMessage.');
<add> }
<ide>
<ide> var statusLine = 'HTTP/1.1 ' + statusCode + ' ' + this.statusMessage + CRLF;
<ide>
<ide><path>lib/buffer.js
<ide> Object.setPrototypeOf(Buffer, Uint8Array);
<ide> function assertSize(size) {
<ide> let err = null;
<ide>
<del> if (typeof size !== 'number')
<add> if (typeof size !== 'number') {
<ide> err = new TypeError('"size" argument must be a number');
<del> else if (size < 0)
<add> } else if (size < 0) {
<ide> err = new RangeError('"size" argument must not be negative');
<del> else if (size > binding.kMaxLength)
<add> } else if (size > binding.kMaxLength) {
<ide> err = new RangeError('"size" argument must not be larger ' +
<ide> 'than ' + binding.kMaxLength);
<add> }
<ide>
<ide> if (err) {
<ide> Error.captureStackTrace(err, assertSize);
<ide><path>lib/child_process.js
<ide> function spawnSync(/*file, args, options*/) {
<ide> var input = options.stdio[i] && options.stdio[i].input;
<ide> if (input != null) {
<ide> var pipe = options.stdio[i] = util._extend({}, options.stdio[i]);
<del> if (isUint8Array(input))
<add> if (isUint8Array(input)) {
<ide> pipe.input = input;
<del> else if (typeof input === 'string')
<add> } else if (typeof input === 'string') {
<ide> pipe.input = Buffer.from(input, options.encoding);
<del> else
<add> } else {
<ide> throw new TypeError(util.format(
<ide> 'stdio[%d] should be Buffer, Uint8Array or string not %s',
<ide> i,
<ide> typeof input));
<add> }
<ide> }
<ide> }
<ide>
<ide><path>lib/fs.js
<ide> ReadStream.prototype.open = function() {
<ide> };
<ide>
<ide> ReadStream.prototype._read = function(n) {
<del> if (typeof this.fd !== 'number')
<add> if (typeof this.fd !== 'number') {
<ide> return this.once('open', function() {
<ide> this._read(n);
<ide> });
<add> }
<ide>
<ide> if (this.destroyed)
<ide> return;
<ide> WriteStream.prototype._write = function(data, encoding, cb) {
<ide> if (!(data instanceof Buffer))
<ide> return this.emit('error', new Error('Invalid data'));
<ide>
<del> if (typeof this.fd !== 'number')
<add> if (typeof this.fd !== 'number') {
<ide> return this.once('open', function() {
<ide> this._write(data, encoding, cb);
<ide> });
<add> }
<ide>
<ide> var self = this;
<ide> fs.write(this.fd, data, 0, data.length, this.pos, function(er, bytes) {
<ide> function writev(fd, chunks, position, callback) {
<ide>
<ide>
<ide> WriteStream.prototype._writev = function(data, cb) {
<del> if (typeof this.fd !== 'number')
<add> if (typeof this.fd !== 'number') {
<ide> return this.once('open', function() {
<ide> this._writev(data, cb);
<ide> });
<add> }
<ide>
<ide> const self = this;
<ide> const len = data.length;
<ide><path>lib/inspector.js
<ide> class Session extends EventEmitter {
<ide> }
<ide>
<ide> post(method, params, callback) {
<del> if (typeof method !== 'string')
<add> if (typeof method !== 'string') {
<ide> throw new TypeError(
<ide> `"method" must be a string, got ${typeof method} instead`);
<add> }
<ide> if (!callback && util.isFunction(params)) {
<ide> callback = params;
<ide> params = null;
<ide> }
<del> if (params && typeof params !== 'object')
<add> if (params && typeof params !== 'object') {
<ide> throw new TypeError(
<ide> `"params" must be an object, got ${typeof params} instead`);
<del> if (callback && typeof callback !== 'function')
<add> }
<add> if (callback && typeof callback !== 'function') {
<ide> throw new TypeError(
<ide> `"callback" must be a function, got ${typeof callback} instead`);
<add> }
<ide>
<del> if (!this[connectionSymbol])
<add> if (!this[connectionSymbol]) {
<ide> throw new Error('Session is not connected');
<add> }
<ide> const id = this[nextIdSymbol]++;
<ide> const message = {id, method};
<ide> if (params) {
<ide><path>lib/internal/process.js
<ide> function setup_cpuUsage() {
<ide> }
<ide>
<ide> // If a previous value was passed in, return diff of current from previous.
<del> if (prevValue) return {
<del> user: cpuValues[0] - prevValue.user,
<del> system: cpuValues[1] - prevValue.system
<del> };
<add> if (prevValue) {
<add> return {
<add> user: cpuValues[0] - prevValue.user,
<add> system: cpuValues[1] - prevValue.system
<add> };
<add> }
<ide>
<ide> // If no previous value passed in, return current value.
<ide> return {
<ide><path>lib/net.js
<ide> function lookupAndConnect(self, options) {
<ide> var localAddress = options.localAddress;
<ide> var localPort = options.localPort;
<ide>
<del> if (localAddress && !cares.isIP(localAddress))
<add> if (localAddress && !cares.isIP(localAddress)) {
<ide> throw new TypeError('"localAddress" option must be a valid IP: ' +
<ide> localAddress);
<add> }
<ide>
<del> if (localPort && typeof localPort !== 'number')
<add> if (localPort && typeof localPort !== 'number') {
<ide> throw new TypeError('"localPort" option should be a number: ' + localPort);
<add> }
<ide>
<ide> if (typeof port !== 'undefined') {
<del> if (typeof port !== 'number' && typeof port !== 'string')
<add> if (typeof port !== 'number' && typeof port !== 'string') {
<ide> throw new TypeError('"port" option should be a number or string: ' +
<ide> port);
<del> if (!isLegalPort(port))
<add> }
<add> if (!isLegalPort(port)) {
<ide> throw new RangeError('"port" option should be >= 0 and < 65536: ' + port);
<add> }
<ide> }
<ide> port |= 0;
<ide>
<ide><path>lib/readline.js
<ide> Interface.prototype._onLine = function(line) {
<ide> };
<ide>
<ide> Interface.prototype._writeToOutput = function _writeToOutput(stringToWrite) {
<del> if (typeof stringToWrite !== 'string')
<add> if (typeof stringToWrite !== 'string') {
<ide> throw new errors.TypeError(
<ide> 'ERR_INVALID_ARG_TYPE',
<ide> 'stringToWrite',
<ide> 'string',
<ide> stringToWrite
<ide> );
<add> }
<ide>
<del> if (this.output !== null && this.output !== undefined)
<add> if (this.output !== null && this.output !== undefined) {
<ide> this.output.write(stringToWrite);
<add> }
<ide> };
<ide>
<ide> Interface.prototype._addHistory = function() {
<ide><path>lib/tls.js
<ide> function check(hostParts, pattern, wildcards) {
<ide> return false;
<ide>
<ide> // Check host parts from right to left first.
<del> for (var i = hostParts.length - 1; i > 0; i -= 1)
<add> for (var i = hostParts.length - 1; i > 0; i -= 1) {
<ide> if (hostParts[i] !== patternParts[i])
<ide> return false;
<add> }
<ide>
<ide> const hostSubdomain = hostParts[0];
<ide> const patternSubdomain = patternParts[0];
<ide><path>lib/util.js
<ide> exports.inherits = function(ctor, superCtor) {
<ide> if (superCtor === undefined || superCtor === null)
<ide> throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'superCtor', 'function');
<ide>
<del> if (superCtor.prototype === undefined)
<add> if (superCtor.prototype === undefined) {
<ide> throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'superCtor.prototype',
<ide> 'function');
<add> }
<ide> ctor.super_ = superCtor;
<ide> Object.setPrototypeOf(ctor.prototype, superCtor.prototype);
<ide> };
<ide><path>test/common/index.js
<ide> function leakedGlobals() {
<ide> const leaked = [];
<ide>
<ide> // eslint-disable-next-line no-var
<del> for (var val in global)
<del> if (!knownGlobals.includes(global[val]))
<add> for (var val in global) {
<add> if (!knownGlobals.includes(global[val])) {
<ide> leaked.push(val);
<add> }
<add> }
<ide>
<ide> if (global.__coverage__) {
<ide> return leaked.filter((varname) => !/^(?:cov_|__cov)/.test(varname));
<ide> Object.defineProperty(exports, 'hasSmallICU', {
<ide> exports.expectsError = function expectsError({code, type, message}) {
<ide> return function(error) {
<ide> assert.strictEqual(error.code, code);
<del> if (type !== undefined)
<add> if (type !== undefined) {
<ide> assert(error instanceof type,
<ide> `${error} is not the expected type ${type}`);
<add> }
<ide> if (message instanceof RegExp) {
<ide> assert(message.test(error.message),
<ide> `${error.message} does not match ${message}`);
<ide> exports.getTTYfd = function getTTYfd() {
<ide> if (!tty.isatty(tty_fd)) tty_fd++;
<ide> else if (!tty.isatty(tty_fd)) tty_fd++;
<ide> else if (!tty.isatty(tty_fd)) tty_fd++;
<del> else try {
<del> tty_fd = require('fs').openSync('/dev/tty');
<del> } catch (e) {
<del> // There aren't any tty fd's available to use.
<del> return -1;
<add> else {
<add> try {
<add> tty_fd = require('fs').openSync('/dev/tty');
<add> } catch (e) {
<add> // There aren't any tty fd's available to use.
<add> return -1;
<add> }
<ide> }
<ide> return tty_fd;
<ide> };
<ide><path>test/parallel/test-domain-uncaught-exception.js
<ide> if (process.argv[2] === 'child') {
<ide> // Make sure that all expected messages were sent from the
<ide> // child process
<ide> test.expectedMessages.forEach(function(expectedMessage) {
<del> if (test.messagesReceived === undefined ||
<del> test.messagesReceived.indexOf(expectedMessage) === -1)
<add> const msgs = test.messagesReceived;
<add> if (msgs === undefined || !msgs.includes(expectedMessage)) {
<ide> assert.fail(`test ${test.fn.name} should have sent message: ${
<ide> expectedMessage} but didn't`);
<add> }
<ide> });
<ide>
<ide> if (test.messagesReceived) {
<ide><path>test/parallel/test-fs-null-bytes.js
<ide> function check(async, sync) {
<ide> assert.strictEqual(er.code, 'ENOENT');
<ide> });
<ide>
<del> if (sync)
<add> if (sync) {
<ide> assert.throws(() => {
<ide> sync.apply(null, argsSync);
<ide> }, expected);
<add> }
<ide>
<del> if (async)
<add> if (async) {
<ide> async.apply(null, argsAsync);
<add> }
<ide> }
<ide>
<ide> check(fs.access, fs.accessSync, 'foo\u0000bar');
<ide><path>test/pummel/test-net-write-callbacks.js
<ide> function makeCallback(c) {
<ide> if (called)
<ide> throw new Error(`called callback #${c} more than once`);
<ide> called = true;
<del> if (c < lastCalled)
<add> if (c < lastCalled) {
<ide> throw new Error(
<ide> `callbacks out of order. last=${lastCalled} current=${c}`);
<add> }
<ide> lastCalled = c;
<ide> cbcount++;
<ide> }; | 22 |
Go | Go | correct some nits in comments | 9279a93f6d43da4c904eeb0adb249fdfa34f7f92 | <ide><path>builder/dockerfile/parser/parser.go
<ide> func init() {
<ide> }
<ide> }
<ide>
<del>// ParseLine parse a line and return the remainder.
<add>// ParseLine parses a line and returns the remainder.
<ide> func ParseLine(line string, d *Directive) (string, *Node, error) {
<ide> // Handle the parser directive '# escape=<char>. Parser directives must precede
<ide> // any builder instruction or other comments, and cannot be repeated.
<ide><path>client/events_test.go
<ide> func TestEventsErrorInOptions(t *testing.T) {
<ide> }
<ide> _, err := client.Events(context.Background(), e.options)
<ide> if err == nil || !strings.Contains(err.Error(), e.expectedError) {
<del> t.Fatalf("expected a error %q, got %v", e.expectedError, err)
<add> t.Fatalf("expected an error %q, got %v", e.expectedError, err)
<ide> }
<ide> }
<ide> }
<ide><path>container/container.go
<ide> type attachContext struct {
<ide> mu sync.Mutex
<ide> }
<ide>
<del>// InitAttachContext initialize or returns existing context for attach calls to
<add>// InitAttachContext initializes or returns existing context for attach calls to
<ide> // track container liveness.
<ide> func (container *Container) InitAttachContext() context.Context {
<ide> container.attachContext.mu.Lock()
<ide> func (container *Container) InitAttachContext() context.Context {
<ide> return container.attachContext.ctx
<ide> }
<ide>
<del>// CancelAttachContext cancel attach context. All attach calls should detach
<add>// CancelAttachContext cancels attach context. All attach calls should detach
<ide> // after this call.
<ide> func (container *Container) CancelAttachContext() {
<ide> container.attachContext.mu.Lock()
<ide><path>container/container_windows.go
<ide> func (container *Container) CreateDaemonEnvironment(linkedEnv []string) []string
<ide> return utils.ReplaceOrAppendEnvValues(linkedEnv, container.Config.Env)
<ide> }
<ide>
<del>// UnmountIpcMounts unmount Ipc related mounts.
<add>// UnmountIpcMounts unmounts Ipc related mounts.
<ide> // This is a NOOP on windows.
<ide> func (container *Container) UnmountIpcMounts(unmount func(pth string) error) {
<ide> }
<ide><path>daemon/graphdriver/overlay2/overlay.go
<ide> func init() {
<ide>
<ide> // Init returns the a native diff driver for overlay filesystem.
<ide> // If overlay filesystem is not supported on the host, graphdriver.ErrNotSupported is returned as error.
<del>// If a overlay filesystem is not supported over a existing filesystem then error graphdriver.ErrIncompatibleFS is returned.
<add>// If an overlay filesystem is not supported over an existing filesystem then error graphdriver.ErrIncompatibleFS is returned.
<ide> func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
<ide> opts, err := parseOptions(options)
<ide> if err != nil {
<ide><path>plugin/store/interface.go
<ide> package store
<ide>
<ide> import "github.com/docker/docker/pkg/plugins"
<ide>
<del>// CompatPlugin is a abstraction to handle both new and legacy (v1) plugins.
<add>// CompatPlugin is an abstraction to handle both new and legacy (v1) plugins.
<ide> type CompatPlugin interface {
<ide> Client() *plugins.Client
<ide> Name() string | 6 |
Ruby | Ruby | remove unnecessary comment | 9c3d01c682056367f59d557720c7a08ca67f48c4 | <ide><path>Library/Homebrew/test/support/helper/test_case.rb
<ide> def setup
<ide> super
<ide>
<ide> @__argv = ARGV.dup
<del> @__env = copy_env # Call #to_hash to duplicate ENV
<add> @__env = copy_env
<ide> end
<ide>
<ide> def teardown | 1 |
Javascript | Javascript | simplify applicationinstance creation | b06bd88352228cbc826b3a0e033936b50506260e | <ide><path>packages/ember-application/lib/system/application-instance.js
<ide> export default EmberObject.extend(RegistryProxy, {
<ide> container: null,
<ide>
<ide> /**
<del> The application's registry. The registry contains the classes, templates,
<del> and other code that makes up the application.
<add> The `Application` for which this is an instance.
<ide>
<del> @property {Ember.Registry} registry
<add> @property {Ember.Application} application
<ide> @private
<ide> */
<del> applicationRegistry: null,
<add> application: null,
<ide>
<ide> /**
<ide> The DOM events for which the event dispatcher should listen.
<ide> export default EmberObject.extend(RegistryProxy, {
<ide> init() {
<ide> this._super(...arguments);
<ide>
<add> var application = get(this, 'application');
<add>
<add> set(this, 'customEvents', get(application, 'customEvents'));
<add> set(this, 'rootElement', get(application, 'rootElement'));
<add>
<ide> // Create a per-instance registry that will use the application's registry
<ide> // as a fallback for resolving registrations.
<add> var applicationRegistry = get(application, 'registry');
<ide> var registry = this.registry = new Registry({
<del> fallback: this.applicationRegistry,
<del> resolver: this.applicationRegistry.resolver
<add> fallback: applicationRegistry,
<add> resolver: applicationRegistry.resolver
<ide> });
<del> registry.normalizeFullName = this.applicationRegistry.normalizeFullName;
<del> registry.makeToString = this.applicationRegistry.makeToString;
<add> registry.normalizeFullName = applicationRegistry.normalizeFullName;
<add> registry.makeToString = applicationRegistry.makeToString;
<ide>
<ide> // Create a per-instance container from the instance's registry
<ide> this.container = registry.container();
<ide> export default EmberObject.extend(RegistryProxy, {
<ide> // to notify us when it has created the root-most view. That view is then
<ide> // appended to the rootElement, in the case of apps, to the fixture harness
<ide> // in tests, or rendered to a string in the case of FastBoot.
<del> this.registry.register('-application-instance:main', this, { instantiate: false });
<add> this.register('-application-instance:main', this, { instantiate: false });
<ide> },
<ide>
<ide> router: computed(function() {
<ide><path>packages/ember-application/lib/system/application.js
<ide> var Application = Namespace.extend(RegistryProxy, {
<ide> */
<ide> buildInstance() {
<ide> return ApplicationInstance.create({
<del> customEvents: get(this, 'customEvents'),
<del> rootElement: get(this, 'rootElement'),
<del> applicationRegistry: this.registry
<add> application: this
<ide> });
<ide> },
<ide> | 2 |
PHP | PHP | use path.public to set 'public' folder location | 33ef4462ff94c4f5916aca8b65a4d7ad4747f72d | <ide><path>src/Illuminate/Foundation/Console/ServeCommand.php
<ide> public function fire()
<ide>
<ide> $port = $this->input->getOption('port');
<ide>
<add> $public = $this->laravel['path.public'];
<add>
<ide> $this->info("Laravel development server started on {$host}:{$port}...");
<ide>
<del> passthru("php -S {$host}:{$port} -t public server.php");
<add> passthru("php -S {$host}:{$port} -t {$public} server.php");
<ide> }
<ide>
<ide> /**
<ide> protected function getOptions()
<ide> );
<ide> }
<ide>
<del>}
<ide>\ No newline at end of file
<add>} | 1 |
Text | Text | update devops guide | 040eb2d51df99dbadac66f6209e2cd6df63b123b | <ide><path>docs/devops.md
<ide> |-|
<ide> <!-- do not translate this -->
<ide>
<del># DevOps Guide
<del>
<ide> > ### :warning: THIS GUIDE IS NOT LIVE YET. :warning:
<ide> > The processes described here will come to effect in the upcoming version of freeCodeCamp.org.
<ide> > Some parts of the guide are applicable on the beta application.
<ide>
<del>## Developer Operations at freeCodeCamp.org
<add># Developer Operations at freeCodeCamp.org
<add>
<add>Thanks for your interest in learning more about how we do devops for the platform at freeCodeCamp.org.
<add>
<add>We have tried to keep the language in this guide as simple as possible for everyone. However, you may find some technical jargon in here. This is not an exhaustive guide for all operations, and is to be used just as a reference for your understanding of the systems.
<add>
<add>## How we build and deploy the codebase?
<add>
<add>We continuously build and deploy [`master`](https://github.com/freeCodeCamp/freeCodeCamp/tree/master), our default development branch on a **separate set of servers**.
<add>
<add>Typically, the `master` branch is merged into the [`production-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) branch once a day and released into an isolated infrastructure. We call this our "staging/beta" application.
<ide>
<del>We continuously deploy our current `master`, the default development branch on a **separate isolated environment**.
<add>It is identical to our live production environment at `freeCodeCamp.org`, other than it using a separate set of databases, servers, web-proxy, etc. This isolation lets us test ongoing development and features in a "production like" scenario, without affecting regular users of freeCodeCamp.org's platforms.
<ide>
<del>Typically, the `master` branch is merged into the `production-staging` branch once a day and released into an isolated infrastructure. This is known as our "staging / beta" application. It is identical to our live production environment at `freeCodeCamp.org`, other than it using a separate set of databases. This isolation lets us test ongoing development and features in a "production like" scenario, without affecting regular users of freeCodeCamp.org's platforms. Once the developer teams are satisfied with the changes on the staging application, these changes are moved every few days to the `production-current` branch. This branch as the name suggests is what you would see live on `freeCodeCamp.org`.
<add>Once the developer team (@freeCodeCamp/dev-team) is happy with the changes on the staging application, these changes are moved every few days to the [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-current) branch. We then release the changes to our live platforms on freeCodeCamp.org
<add>
<add>We employ various levels of integration and acceptance testing to check on the quality of the code. All our tests are done through software like Travis and Azure Pipelines. Some of this automated, that is once changes are pushed to the corresponding branch, they get built and deployed on the platforms.
<ide>
<ide> We welcome you to test these releases in a **"public beta testing"** mode and get early access to upcoming features to the platforms. Sometimes these features/changes are referred to as **next, beta, staging,** etc. interchangeably.
<ide>
<ide> Your contributions via feedback and issue reports will help us in making the production platforms at `freeCodeCamp.org` more **resilient**, **consistent** and **stable** for everyone.
<ide>
<ide> We thank you for reporting bugs that you encounter and help in making freeCodeCamp.org better. You rock!
<ide>
<del>## Identifying the upcoming version of freeCodeCamp
<add>## Identifying the upcoming version of platform
<ide>
<ide> The domain name will be different than **`freeCodeCamp.org`**. Currently this public beta testing version is available at:
<ide>
<ide> <h3 align="center"><a href='https://www.freecodecamp.dev' _target='blank'><code>www.freecodecamp.dev</code></a></h4>
<ide>
<del>## Build and Deployment Status
<add>The dev-team merges changes from the `master` branch to `production-staging` when they release changes. Usually the top commit should be what you see live on the site. You can identify the exact version deployed by visiting the build and deployment logs available below in the status section.
<add>
<add>## Identifying the current version of platform
<ide>
<del>Usually the dev team will merge the changes from the master branch to special branch called `production-staging` (`beta/staging site`) when they deploy. Usually the top commit should be what you see live on the site.
<add>**The current version of the platform is always available at [`freeCodeCamp.org`](https://www.freecodecamp.org).**
<add>
<add>The dev-team merges changes from the `production-staging` branch to `production-current` when they release changes. The top commit should be what you see live on the site. You can identify the exact version deployed by visiting the build and deployment logs available below in the status section.
<add>
<add>## Build and Deployment Status
<ide>
<ide> We use Azure Pipelines and other CI software (Travis, GitHub Actions), to continiously test and deploy our applications.
<ide>
<ide> We use Azure Pipelines and other CI software (Travis, GitHub Actions), to contin
<ide>
<ide> ## Known Limitations
<ide>
<del>There will be some known limitations and tradeoffs when using this beta version of freeCodeCamp.
<add>There will be some known limitations and tradeoffs when using this beta version of the platform.
<ide>
<ide> - #### All data / personal progress on these beta applications `will NOT be saved or carried over` to production.
<ide> **Users on the beta version will have a separate account from the production.** The beta version uses a physically separate database from production. This gives us the ability to prevent any accidental loss of data or modifications. The dev team may purge the database on this beta version as needed. | 1 |
Ruby | Ruby | remove test that may alter the repository | 39b890e255fbee0f1bce1cc1e9ead28ff4be9e2e | <ide><path>Library/Homebrew/test/test_ENV.rb
<ide> def setup
<ide> class SuperenvTests < Homebrew::TestCase
<ide> include SharedEnvTests
<ide>
<del> attr_reader :env, :bin
<del>
<ide> def setup
<ide> @env = {}.extend(Superenv)
<del> @bin = HOMEBREW_REPOSITORY/"Library/ENV/#{MacOS::Xcode.version}"
<del> bin.mkpath
<del> end
<del>
<del> def test_bin
<del> assert_equal bin, Superenv.bin
<ide> end
<ide>
<ide> def test_initializes_deps
<del> assert_equal [], env.deps
<del> assert_equal [], env.keg_only_deps
<del> end
<del>
<del> def teardown
<del> bin.rmtree
<add> assert_equal [], @env.deps
<add> assert_equal [], @env.keg_only_deps
<ide> end
<ide> end | 1 |
Javascript | Javascript | add more tests for wrapmap | 4862eb43e3c1b9d428bd64db50c08c6a6d6e01fd | <ide><path>test/unit/manipulation.js
<ide> var testAppendForObject = function( valueObj, isFragment ) {
<ide>
<ide> var testAppend = function( valueObj ) {
<ide>
<del> expect( 68 );
<add> expect( 75 );
<ide>
<ide> testAppendForObject( valueObj, false );
<ide> testAppendForObject( valueObj, true );
<ide> var testAppend = function( valueObj ) {
<ide> jQuery.each( "thead tbody tfoot colgroup caption tr td".split(" "), function( i, name ) {
<ide> $table.append( valueObj( "<" + name + "/>" ) );
<ide> equal( $table.find( name ).length, 1, "Append " + name );
<add> ok( jQuery.clean( ["<" + name + "/>"] ).length, name + " wrapped correctly" );
<ide> });
<ide>
<ide> jQuery("#table colgroup").append( valueObj("<col/>") ); | 1 |
Javascript | Javascript | ignore stray escape sequence | c84b3c4b73bb7cbd7116b5872babe7e50b45d4a6 | <ide><path>lib/readline.js
<ide> Interface.prototype._ttyWrite = function(s, key) {
<ide> var next_word, next_non_word, previous_word, previous_non_word;
<ide> key = key || {};
<ide>
<add> // Ignore escape key - Fixes #2876
<add> if (key.name == 'escape') return;
<add>
<ide> if (key.ctrl && key.shift) {
<ide> /* Control and shift pressed */
<ide> switch (key.name) { | 1 |
Javascript | Javascript | remove http.cat. fixes | 584ae7b08477fba93be4b77cb1e1511f40c95fdf | <ide><path>lib/http2.js
<ide> exports.Client = Client;
<ide> exports.createClient = function(port, host) {
<ide> return new Client(port, host);
<ide> };
<del>
<del>exports.cat = function(url, encoding_, headers_) {
<del> var encoding = 'utf8';
<del> var headers = {};
<del> var callback = null;
<del>
<del> console.error("http.cat will be removed in the near future. use http.get");
<del>
<del> // parse the arguments for the various options... very ugly
<del> if (typeof(arguments[1]) == 'string') {
<del> encoding = arguments[1];
<del> if (typeof(arguments[2]) == 'object') {
<del> headers = arguments[2];
<del> if (typeof(arguments[3]) == 'function') callback = arguments[3];
<del> } else {
<del> if (typeof(arguments[2]) == 'function') callback = arguments[2];
<del> }
<del> } else {
<del> // didn't specify encoding
<del> if (typeof(arguments[1]) == 'object') {
<del> headers = arguments[1];
<del> callback = arguments[2];
<del> } else {
<del> callback = arguments[1];
<del> }
<del> }
<del>
<del> var url = require('url').parse(url);
<del>
<del> var hasHost = false;
<del> if (Array.isArray(headers)) {
<del> for (var i = 0, l = headers.length; i < l; i++) {
<del> if (headers[i][0].toLowerCase() === 'host') {
<del> hasHost = true;
<del> break;
<del> }
<del> }
<del> } else if (typeof headers === 'Object') {
<del> var keys = Object.keys(headers);
<del> for (var i = 0, l = keys.length; i < l; i++) {
<del> var key = keys[i];
<del> if (key.toLowerCase() == 'host') {
<del> hasHost = true;
<del> break;
<del> }
<del> }
<del> }
<del> if (!hasHost) headers['Host'] = url.hostname;
<del>
<del> var content = '';
<del>
<del> var path = (url.pathname || '/') + (url.search || '') + (url.hash || '');
<del> var callbackSent = false;
<del> var req = exports.request({port: url.port || 80, host: url.hostname, path: path}, function(res) {
<del> if (res.statusCode < 200 || res.statusCode >= 300) {
<del> if (callback && !callbackSent) {
<del> callback(res.statusCode);
<del> callbackSent = true;
<del> }
<del> client.end();
<del> return;
<del> }
<del> res.setEncoding(encoding);
<del> res.addListener('data', function(chunk) { content += chunk; });
<del> res.addListener('end', function() {
<del> if (callback && !callbackSent) {
<del> callback(null, content);
<del> callbackSent = true;
<del> }
<del> });
<del> });
<del>
<del>
<del> req.addListener('error', function(err) {
<del> if (callback && !callbackSent) {
<del> callback(err);
<del> callbackSent = true;
<del> }
<del> });
<del>
<del> req.end();
<del>};
<ide><path>test/simple/test-http-cat.js
<del>// Copyright Joyent, Inc. and other Node contributors.
<del>//
<del>// Permission is hereby granted, free of charge, to any person obtaining a
<del>// copy of this software and associated documentation files (the
<del>// "Software"), to deal in the Software without restriction, including
<del>// without limitation the rights to use, copy, modify, merge, publish,
<del>// distribute, sublicense, and/or sell copies of the Software, and to permit
<del>// persons to whom the Software is furnished to do so, subject to the
<del>// following conditions:
<del>//
<del>// The above copyright notice and this permission notice shall be included
<del>// in all copies or substantial portions of the Software.
<del>//
<del>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<del>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<del>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
<del>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
<del>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
<del>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
<del>// USE OR OTHER DEALINGS IN THE SOFTWARE.
<del>
<del>var common = require('../common');
<del>var assert = require('assert');
<del>var http = require('http');
<del>
<del>var body = 'exports.A = function() { return "A";}';
<del>var server = http.createServer(function(req, res) {
<del> console.log('got request');
<del> res.writeHead(200, [
<del> ['Content-Length', body.length],
<del> ['Content-Type', 'text/plain']
<del> ]);
<del> res.end(body);
<del>});
<del>
<del>var got_good_server_content = false;
<del>var bad_server_got_error = false;
<del>
<del>server.listen(common.PORT, function() {
<del> http.cat('http://localhost:' + common.PORT + '/', 'utf8',
<del> function(err, content) {
<del> if (err) {
<del> throw err;
<del> } else {
<del> console.log('got response');
<del> got_good_server_content = true;
<del> assert.equal(body, content);
<del> server.close();
<del> }
<del> });
<del>
<del> http.cat('http://localhost:12312/', 'utf8', function(err, content) {
<del> if (err) {
<del> console.log('got error (this should happen)');
<del> bad_server_got_error = true;
<del> }
<del> });
<del>});
<del>
<del>process.addListener('exit', function() {
<del> console.log('exit');
<del> assert.equal(true, got_good_server_content);
<del> assert.equal(true, bad_server_got_error);
<del>});
<ide><path>test/simple/test-http-chunked.js
<ide> var server = http.createServer(function(req, res) {
<ide> res.writeHead(200, {'Content-Type': 'text/plain; charset=utf8'});
<ide> res.end(UTF8_STRING, 'utf8');
<ide> });
<del>server.listen(common.PORT);
<add>server.listen(common.PORT, function() {
<add> var data = '';
<add> var get = http.get({path:'/', host:'localhost', port:common.PORT}, function (x) {
<add> x.setEncoding('utf8')
<add> x.on('data', function (c) {data += c});
<add> x.on('error', function (e) {
<add> throw e;
<add> })
<add> x.on('end', function () {
<add> assert.equal('string', typeof data);
<add> console.log('here is the response:');
<add> assert.equal(UTF8_STRING, data);
<add> console.log(data);
<add> server.close();
<add> })
<add> })
<add> get.on('error', function (e) {throw e});
<add> get.end();
<ide>
<del>server.addListener('listening', function() {
<del> http.cat('http://127.0.0.1:' + common.PORT + '/', 'utf8',
<del> function(err, data) {
<del> if (err) throw err;
<del> assert.equal('string', typeof data);
<del> console.log('here is the response:');
<del> assert.equal(UTF8_STRING, data);
<del> console.log(data);
<del> server.close();
<del> });
<ide> });
<ide><path>test/simple/test-http-set-timeout.js
<ide> server.listen(common.PORT, function() {
<ide> throw new Error('Timeout was not sucessful');
<ide> }, 2000);
<ide>
<del> var url = 'http://localhost:' + common.PORT + '/';
<del>
<del> http.cat(url, 'utf8', function(err, content) {
<add> var x = http.get({port:common.PORT, path:'/'});
<add> x.on('error', function () {
<ide> clearTimeout(errorTimer);
<ide> console.log('HTTP REQUEST COMPLETE (this is good)');
<del> });
<add> })
<add> x.end();
<add>
<ide> }); | 4 |
Ruby | Ruby | add full stack tests for #take | 07e133e97ed422436810b7398dcbd780cabea2c3 | <ide><path>lib/arel/algebra/relations/operations/take.rb
<ide> module Arel
<ide> class Take < Compound
<ide> attributes :relation, :taken
<del> deriving :initialize, :==
<add> deriving :initialize, :==
<add> requires :limiting
<ide>
<ide> def externalizable?
<ide> true
<ide><path>spec/shared/relation_spec.rb
<ide> raise "@expected needs to have at least 6 items" unless @expected.length >= 6
<ide> end
<ide>
<add> before :each do
<add> @expected = @expected.dup
<add> end
<add>
<ide> describe "#each" do
<ide> it "iterates over the rows in any order" do
<ide> @relation.should have_rows(@expected)
<ide> it "works"
<ide> end
<ide> end
<add>
<add> describe "#take" do
<add> it "returns a relation" do
<add> @relation.take(3).should be_a(Arel::Relation)
<add> end
<add>
<add> it "returns X items from the collection" do
<add> length = @expected.length
<add>
<add> @relation.take(3).each do |resource|
<add> @expected.delete_if { |r| r.tuple == resource.tuple }
<add> end
<add>
<add> @expected.length.should == length - 3
<add> end
<add>
<add> it "works with ordering" do
<add> expected = @expected.sort_by { |r| [r[@relation[:age]], r[@relation[:id]]] }.map { |r| r[@relation[:id]] }
<add> actual = @relation.order(@relation[:age].asc, @relation[:id].asc).take(3).map { |r| r[@relation[:id]] }
<add>
<add> actual.should == expected[0,3]
<add> end
<add> end
<ide> end
<ide>\ No newline at end of file | 2 |
PHP | PHP | apply fixes from styleci | 5a39e9dcb5650d674d6ff6e839a4619c25c7f334 | <ide><path>src/Illuminate/Console/Scheduling/Event.php
<ide> protected function pingCallback($url)
<ide> return function (Container $container, HttpClient $http) use ($url) {
<ide> try {
<ide> $http->get($url);
<del> } catch (ClientExceptionInterface | TransferException $e) {
<add> } catch (ClientExceptionInterface|TransferException $e) {
<ide> $container->make(ExceptionHandler::class)->report($e);
<ide> }
<ide> };
<ide><path>src/Illuminate/Support/Traits/ForwardsCalls.php
<ide> protected function forwardCallTo($object, $method, $parameters)
<ide> {
<ide> try {
<ide> return $object->{$method}(...$parameters);
<del> } catch (Error | BadMethodCallException $e) {
<add> } catch (Error|BadMethodCallException $e) {
<ide> $pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~';
<ide>
<ide> if (! preg_match($pattern, $e->getMessage(), $matches)) { | 2 |
PHP | PHP | add perhour and perday methods to ratelimiting | 9fd47f396505ddaa9c1bb0104e0c185b08476f58 | <ide><path>src/Illuminate/Cache/RateLimiting/Limit.php
<ide> public static function perMinute($maxAttempts)
<ide> return new static('', $maxAttempts);
<ide> }
<ide>
<add> /**
<add> * Create a new rate limit using hours as decay time.
<add> *
<add> * @param int $maxAttempts
<add> * @param int $decayHours
<add> * @return static
<add> */
<add> public static function perHour($maxAttempts, $decayHours = 1)
<add> {
<add> return new static('', $maxAttempts, 60 * $decayHours);
<add> }
<add>
<add> /**
<add> * Create a new rate limit using days as decay time.
<add> *
<add> * @param int $maxAttempts
<add> * @param int $decayDays
<add> * @return static
<add> */
<add> public static function perDay($maxAttempts, $decayDays = 1)
<add> {
<add> return new static('', $maxAttempts, 60 * 24 * $decayDays);
<add> }
<add>
<ide> /**
<ide> * Create a new unlimited rate limit.
<ide> * | 1 |
Javascript | Javascript | add benchmark for vm.runin*() | 030dd14793da2aa1c252e38d33abb37570f8ee8a | <ide><path>benchmark/vm/run-in-context.js
<add>'use strict';
<add>
<add>const common = require('../common.js');
<add>
<add>const bench = common.createBenchmark(main, {
<add> n: [1],
<add> breakOnSigint: [0, 1],
<add> withSigintListener: [0, 1]
<add>});
<add>
<add>const vm = require('vm');
<add>
<add>function main(conf) {
<add> const n = +conf.n;
<add> const options = conf.breakOnSigint ? {breakOnSigint: true} : {};
<add> const withSigintListener = !!conf.withSigintListener;
<add>
<add> process.removeAllListeners('SIGINT');
<add> if (withSigintListener)
<add> process.on('SIGINT', () => {});
<add>
<add> var i = 0;
<add>
<add> const contextifiedSandbox = vm.createContext();
<add>
<add> common.v8ForceOptimization(vm.runInContext,
<add> '0', contextifiedSandbox, options);
<add> bench.start();
<add> for (; i < n; i++)
<add> vm.runInContext('0', contextifiedSandbox, options);
<add> bench.end(n);
<add>}
<ide><path>benchmark/vm/run-in-this-context.js
<add>'use strict';
<add>
<add>const common = require('../common.js');
<add>
<add>const bench = common.createBenchmark(main, {
<add> n: [1],
<add> breakOnSigint: [0, 1],
<add> withSigintListener: [0, 1]
<add>});
<add>
<add>const vm = require('vm');
<add>
<add>function main(conf) {
<add> const n = +conf.n;
<add> const options = conf.breakOnSigint ? {breakOnSigint: true} : {};
<add> const withSigintListener = !!conf.withSigintListener;
<add>
<add> process.removeAllListeners('SIGINT');
<add> if (withSigintListener)
<add> process.on('SIGINT', () => {});
<add>
<add> var i = 0;
<add>
<add> common.v8ForceOptimization(vm.runInThisContext, '0', options);
<add> bench.start();
<add> for (; i < n; i++)
<add> vm.runInThisContext('0', options);
<add> bench.end(n);
<add>} | 2 |
Java | Java | fix typo in javadoc | e16f3b95cb012cdbcf2a1310a86fe881ad8c0fb1 | <ide><path>spring-web/src/main/java/org/springframework/http/converter/AbstractHttpMessageConverter.java
<ide> protected Long getContentLength(T t, MediaType contentType) throws IOException {
<ide> protected abstract boolean supports(Class<?> clazz);
<ide>
<ide> /**
<del> * Abstract template method that reads the actualy object. Invoked from {@link #read}.
<add> * Abstract template method that reads the actual object. Invoked from {@link #read}.
<ide> * @param clazz the type of object to return
<ide> * @param inputMessage the HTTP input message to read from
<ide> * @return the converted object | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.