content_type stringclasses 8 values | main_lang stringclasses 7 values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Java | Java | remove superfluous method override | 07ba13c9ca8f1da0833eb044b3ea3d1d6fb43c96 | <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/view/RedirectView.java
<ide> public String[] getHosts() {
<ide> return this.hosts;
<ide> }
<ide>
<del>
<del> @Override
<del> public void afterPropertiesSet() throws Exception {
<del> super.afterPropertiesSet();
<del> }
<del>
<del>
<ide> @Override
<ide> public boolean isRedirectView() {
<ide> return true; | 1 |
PHP | PHP | fix composite primary key reflection in postgres | ae1560a6a17f118bd463bd1540bf2e8212bebb54 | <ide><path>src/Database/Schema/PostgresSchema.php
<ide> public function convertColumnDescription(Table $table, $row)
<ide> $row['default'] = 0;
<ide> }
<ide> }
<add> // Sniff out serial types.
<add> if (in_array($field['type'], ['integer', 'biginteger']) && strpos($row['default'], 'nextval(') === 0) {
<add> $field['autoIncrement'] = true;
<add> }
<ide> $field += [
<ide> 'default' => $this->_defaultValue($row['default']),
<ide> 'null' => $row['null'] === 'YES' ? true : false,
<ide> public function convertIndexDescription(Table $table, $row)
<ide> // If there is only one column in the primary key and it is integery,
<ide> // make it autoincrement.
<ide> $columnDef = $table->column($columns[0]);
<del> if (count($columns) === 1 &&
<del> in_array($columnDef['type'], ['integer', 'biginteger']) &&
<del> $type === Table::CONSTRAINT_PRIMARY
<add> if (
<add> $type === Table::CONSTRAINT_PRIMARY &&
<add> count($columns) === 1 &&
<add> in_array($columnDef['type'], ['integer', 'biginteger'])
<ide> ) {
<ide> $columnDef['autoIncrement'] = true;
<ide> $table->addColumn($columns[0], $columnDef);
<ide><path>tests/TestCase/Database/Schema/PostgresSchemaTest.php
<ide> public function testDescribeTable()
<ide> }
<ide> }
<ide>
<add> /**
<add> * Test describing a table with postgres and composite keys
<add> *
<add> * @return void
<add> */
<add> public function testDescribeTableCompositeKey()
<add> {
<add> $this->_needsConnection();
<add> $connection = ConnectionManager::get('test');
<add> $sql = <<<SQL
<add>CREATE TABLE schema_composite (
<add> "id" SERIAL,
<add> "site_id" INTEGER NOT NULL,
<add> "name" VARCHAR(255),
<add> PRIMARY KEY("id", "site_id")
<add>);
<add>SQL;
<add> $connection->execute($sql);
<add> $schema = new SchemaCollection($connection);
<add> $result = $schema->describe('schema_composite');
<add> $connection->execute('DROP TABLE schema_composite');
<add>
<add> $this->assertEquals(['id', 'site_id'], $result->primaryKey());
<add> $this->assertNull($result->column('site_id')['autoIncrement'], 'site_id should not be autoincrement');
<add> $this->assertTrue($result->column('id')['autoIncrement'], 'id should be autoincrement');
<add> }
<add>
<add>
<ide> /**
<ide> * Test describing a table containing defaults with Postgres
<ide> *
<ide><path>tests/TestCase/ORM/TableTest.php
<ide> public function testSaveNewErrorCompositeKeyNoIncrement()
<ide> public function testSaveNewCompositeKeyIncrement()
<ide> {
<ide> $articles = TableRegistry::get('SiteAuthors');
<del> $article = $articles->newEntity(['site_id' => 1, 'name' => 'new guy']);
<add> $article = $articles->newEntity(['site_id' => 3, 'name' => 'new guy']);
<ide> $this->assertSame($article, $articles->save($article));
<ide> $this->assertNotEmpty($article->id, 'Primary key should have been populated');
<del> $this->assertSame(1, $article->site_id);
<add> $this->assertSame(3, $article->site_id);
<ide> }
<ide>
<ide> /** | 3 |
Text | Text | add the comparison | 0e8c00bff4884542d0f5d32f8b92a85d15f1dc89 | <ide><path>guide/english/python/basic-operators/index.md
<ide> y = x
<ide> z = y
<ide> print z is 1 # prints True
<ide> print z is x # prints True
<add>print y is x # prints True
<ide>
<ide> str1 = "FreeCodeCamp"
<ide> str2 = "FreeCodeCamp" | 1 |
Python | Python | remove confusing legacy comments | 5a423a2dce0b6daf033e92a20544a34476867ed9 | <ide><path>official/modeling/model_training_utils.py
<ide> def run_customized_training_loop(
<ide> 'if `metric_fn` is specified, metric_fn must be a callable.')
<ide>
<ide> total_training_steps = steps_per_epoch * epochs
<del>
<del> # To reduce unnecessary send/receive input pipeline operation, we place input
<del> # pipeline ops in worker task.
<ide> train_iterator = _get_input_iterator(train_input_fn, strategy)
<ide>
<ide> with distribution_utils.get_strategy_scope(strategy): | 1 |
Mixed | Javascript | add asyncresource.bind utility | 74df7496ff6d899e4b8ceed9505a641e79ad6366 | <ide><path>doc/api/async_hooks.md
<ide> class DBQuery extends AsyncResource {
<ide> }
<ide> ```
<ide>
<add>#### `static AsyncResource.bind(fn[, type])`
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>* `fn` {Function} The function to bind to the current execution context.
<add>* `type` {string} An optional name to associate with the underlying
<add> `AsyncResource`.
<add>
<add>Binds the given function to the current execution context.
<add>
<add>The returned function will have an `asyncResource` property referencing
<add>the `AsyncResource` to which the function is bound.
<add>
<add>#### `asyncResource.bind(fn)`
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>* `fn` {Function} The function to bind to the current `AsyncResource`.
<add>
<add>Binds the given function to execute to this `AsyncResource`'s scope.
<add>
<add>The returned function will have an `asyncResource` property referencing
<add>the `AsyncResource` to which the function is bound.
<add>
<ide> #### `asyncResource.runInAsyncScope(fn[, thisArg, ...args])`
<ide> <!-- YAML
<ide> added: v9.6.0
<ide> const { createServer } = require('http');
<ide> const { AsyncResource, executionAsyncId } = require('async_hooks');
<ide>
<ide> const server = createServer((req, res) => {
<del> const asyncResource = new AsyncResource('request');
<del> // The listener will always run in the execution context of `asyncResource`.
<del> req.on('close', asyncResource.runInAsyncScope.bind(asyncResource, () => {
<del> // Prints: true
<del> console.log(asyncResource.asyncId() === executionAsyncId());
<add> req.on('close', AsyncResource.bind(() => {
<add> // Execution context is bound to the current outer scope.
<ide> }));
<add> req.on('close', () => {
<add> // Execution context is bound to the scope that caused 'close' to emit.
<add> });
<ide> res.end();
<ide> }).listen(3000);
<ide> ```
<ide><path>lib/async_hooks.js
<ide>
<ide> const {
<ide> NumberIsSafeInteger,
<add> ObjectDefineProperties,
<ide> ReflectApply,
<ide> Symbol,
<ide> } = primordials;
<ide>
<ide> const {
<ide> ERR_ASYNC_CALLBACK,
<ide> ERR_ASYNC_TYPE,
<add> ERR_INVALID_ARG_TYPE,
<ide> ERR_INVALID_ASYNC_ID
<ide> } = require('internal/errors').codes;
<ide> const { validateString } = require('internal/validators');
<ide> class AsyncResource {
<ide> triggerAsyncId() {
<ide> return this[trigger_async_id_symbol];
<ide> }
<add>
<add> bind(fn) {
<add> if (typeof fn !== 'function')
<add> throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);
<add> const ret = this.runInAsyncScope.bind(this, fn);
<add> ObjectDefineProperties(ret, {
<add> 'length': {
<add> enumerable: true,
<add> value: fn.length,
<add> },
<add> 'asyncResource': {
<add> enumerable: true,
<add> value: this,
<add> }
<add> });
<add> return ret;
<add> }
<add>
<add> static bind(fn, type) {
<add> type = type || fn.name;
<add> return (new AsyncResource(type || 'bound-anonymous-fn')).bind(fn);
<add> }
<ide> }
<ide>
<ide> const storageList = [];
<ide><path>test/parallel/test-asyncresource-bind.js
<add>'use strict';
<add>
<add>const common = require('../common');
<add>const assert = require('assert');
<add>const { AsyncResource, executionAsyncId } = require('async_hooks');
<add>
<add>const fn = common.mustCall(AsyncResource.bind(() => {
<add> return executionAsyncId();
<add>}));
<add>
<add>setImmediate(() => {
<add> const asyncId = executionAsyncId();
<add> assert.notStrictEqual(asyncId, fn());
<add>});
<add>
<add>const asyncResource = new AsyncResource('test');
<add>
<add>[1, false, '', {}, []].forEach((i) => {
<add> assert.throws(() => asyncResource.bind(i), {
<add> code: 'ERR_INVALID_ARG_TYPE'
<add> });
<add>});
<add>
<add>const fn2 = asyncResource.bind((a, b) => {
<add> return executionAsyncId();
<add>});
<add>
<add>assert.strictEqual(fn2.asyncResource, asyncResource);
<add>assert.strictEqual(fn2.length, 2);
<add>
<add>setImmediate(() => {
<add> const asyncId = executionAsyncId();
<add> assert.strictEqual(asyncResource.asyncId(), fn2());
<add> assert.notStrictEqual(asyncId, fn2());
<add>}); | 3 |
Python | Python | fix typo in lambda layer | 16590ccce51c44e72b0826f50641bcbb2a09a3d5 | <ide><path>keras/layers/core.py
<ide> def __init__(self, function, output_shape=None):
<ide>
<ide> @property
<ide> def output_shape(self):
<del> if self._ouput_shape is None:
<add> if self._output_shape is None:
<ide> return self.input_shape
<ide> elif type(self._output_shape) == tuple:
<ide> return (self.input_shape[0], ) + self._output_shape | 1 |
Ruby | Ruby | remove duplicated `elsif` branch | 67e605f5406b31d0928749d1bb44a416b5a16623 | <ide><path>activerecord/test/cases/migration/column_attributes_test.rb
<ide> def test_native_decimal_insert_manual_vs_automatic
<ide> # Do a manual insertion
<ide> if current_adapter?(:OracleAdapter)
<ide> connection.execute "insert into test_models (id, wealth) values (people_seq.nextval, 12345678901234567890.0123456789)"
<del> elsif current_adapter?(:PostgreSQLAdapter)
<del> connection.execute "insert into test_models (wealth) values (12345678901234567890.0123456789)"
<ide> else
<ide> connection.execute "insert into test_models (wealth) values (12345678901234567890.0123456789)"
<ide> end | 1 |
Go | Go | move pkg/gitutils to remotecontext/git | b9d85ac58db8b8d4480fca93f8b952d084ea36f5 | <ide><path>builder/remotecontext/git.go
<ide> import (
<ide> "os"
<ide>
<ide> "github.com/docker/docker/builder"
<add> "github.com/docker/docker/builder/remotecontext/git"
<ide> "github.com/docker/docker/pkg/archive"
<del> "github.com/docker/docker/pkg/gitutils"
<ide> )
<ide>
<ide> // MakeGitContext returns a Context from gitURL that is cloned in a temporary directory.
<ide> func MakeGitContext(gitURL string) (builder.Source, error) {
<del> root, err := gitutils.Clone(gitURL)
<add> root, err := git.Clone(gitURL)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<add><path>builder/remotecontext/git/gitutils.go
<del><path>pkg/gitutils/gitutils.go
<del>package gitutils
<add>package git
<ide>
<ide> import (
<ide> "fmt"
<add><path>builder/remotecontext/git/gitutils_test.go
<del><path>pkg/gitutils/gitutils_test.go
<del>package gitutils
<add>package git
<ide>
<ide> import (
<ide> "fmt"
<ide> import (
<ide> "net/url"
<ide> "os"
<ide> "path/filepath"
<del> "reflect"
<ide> "runtime"
<ide> "strings"
<ide> "testing"
<add>
<add> "github.com/stretchr/testify/assert"
<add> "github.com/stretchr/testify/require"
<ide> )
<ide>
<ide> func TestCloneArgsSmartHttp(t *testing.T) {
<ide> func TestCloneArgsSmartHttp(t *testing.T) {
<ide>
<ide> args := fetchArgs(serverURL, "master")
<ide> exp := []string{"fetch", "--recurse-submodules=yes", "--depth", "1", "origin", "master"}
<del> if !reflect.DeepEqual(args, exp) {
<del> t.Fatalf("Expected %v, got %v", exp, args)
<del> }
<add> assert.Equal(t, exp, args)
<ide> }
<ide>
<ide> func TestCloneArgsDumbHttp(t *testing.T) {
<ide> func TestCloneArgsDumbHttp(t *testing.T) {
<ide>
<ide> args := fetchArgs(serverURL, "master")
<ide> exp := []string{"fetch", "--recurse-submodules=yes", "origin", "master"}
<del> if !reflect.DeepEqual(args, exp) {
<del> t.Fatalf("Expected %v, got %v", exp, args)
<del> }
<add> assert.Equal(t, exp, args)
<ide> }
<ide>
<ide> func TestCloneArgsGit(t *testing.T) {
<ide> u, _ := url.Parse("git://github.com/docker/docker")
<ide> args := fetchArgs(u, "master")
<ide> exp := []string{"fetch", "--recurse-submodules=yes", "--depth", "1", "origin", "master"}
<del> if !reflect.DeepEqual(args, exp) {
<del> t.Fatalf("Expected %v, got %v", exp, args)
<del> }
<add> assert.Equal(t, exp, args)
<ide> }
<ide>
<ide> func gitGetConfig(name string) string {
<ide> func gitGetConfig(name string) string {
<ide>
<ide> func TestCheckoutGit(t *testing.T) {
<ide> root, err := ioutil.TempDir("", "docker-build-git-checkout")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<add> require.NoError(t, err)
<ide> defer os.RemoveAll(root)
<ide>
<ide> autocrlf := gitGetConfig("core.autocrlf")
<ide> func TestCheckoutGit(t *testing.T) {
<ide>
<ide> gitDir := filepath.Join(root, "repo")
<ide> _, err = git("init", gitDir)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<add> require.NoError(t, err)
<ide>
<del> if _, err = gitWithinDir(gitDir, "config", "user.email", "test@docker.com"); err != nil {
<del> t.Fatal(err)
<del> }
<add> _, err = gitWithinDir(gitDir, "config", "user.email", "test@docker.com")
<add> require.NoError(t, err)
<ide>
<del> if _, err = gitWithinDir(gitDir, "config", "user.name", "Docker test"); err != nil {
<del> t.Fatal(err)
<del> }
<add> _, err = gitWithinDir(gitDir, "config", "user.name", "Docker test")
<add> require.NoError(t, err)
<ide>
<del> if err = ioutil.WriteFile(filepath.Join(gitDir, "Dockerfile"), []byte("FROM scratch"), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<add> err = ioutil.WriteFile(filepath.Join(gitDir, "Dockerfile"), []byte("FROM scratch"), 0644)
<add> require.NoError(t, err)
<ide>
<ide> subDir := filepath.Join(gitDir, "subdir")
<del> if err = os.Mkdir(subDir, 0755); err != nil {
<del> t.Fatal(err)
<del> }
<add> require.NoError(t, os.Mkdir(subDir, 0755))
<ide>
<del> if err = ioutil.WriteFile(filepath.Join(subDir, "Dockerfile"), []byte("FROM scratch\nEXPOSE 5000"), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<add> err = ioutil.WriteFile(filepath.Join(subDir, "Dockerfile"), []byte("FROM scratch\nEXPOSE 5000"), 0644)
<add> require.NoError(t, err)
<ide>
<ide> if runtime.GOOS != "windows" {
<ide> if err = os.Symlink("../subdir", filepath.Join(gitDir, "parentlink")); err != nil {
<ide> func TestCheckoutGit(t *testing.T) {
<ide> }
<ide> }
<ide>
<del> if _, err = gitWithinDir(gitDir, "add", "-A"); err != nil {
<del> t.Fatal(err)
<del> }
<add> _, err = gitWithinDir(gitDir, "add", "-A")
<add> require.NoError(t, err)
<ide>
<del> if _, err = gitWithinDir(gitDir, "commit", "-am", "First commit"); err != nil {
<del> t.Fatal(err)
<del> }
<add> _, err = gitWithinDir(gitDir, "commit", "-am", "First commit")
<add> require.NoError(t, err)
<ide>
<del> if _, err = gitWithinDir(gitDir, "checkout", "-b", "test"); err != nil {
<del> t.Fatal(err)
<del> }
<add> _, err = gitWithinDir(gitDir, "checkout", "-b", "test")
<add> require.NoError(t, err)
<ide>
<del> if err = ioutil.WriteFile(filepath.Join(gitDir, "Dockerfile"), []byte("FROM scratch\nEXPOSE 3000"), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<add> err = ioutil.WriteFile(filepath.Join(gitDir, "Dockerfile"), []byte("FROM scratch\nEXPOSE 3000"), 0644)
<add> require.NoError(t, err)
<ide>
<del> if err = ioutil.WriteFile(filepath.Join(subDir, "Dockerfile"), []byte("FROM busybox\nEXPOSE 5000"), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<add> err = ioutil.WriteFile(filepath.Join(subDir, "Dockerfile"), []byte("FROM busybox\nEXPOSE 5000"), 0644)
<add> require.NoError(t, err)
<ide>
<del> if _, err = gitWithinDir(gitDir, "add", "-A"); err != nil {
<del> t.Fatal(err)
<del> }
<add> _, err = gitWithinDir(gitDir, "add", "-A")
<add> require.NoError(t, err)
<ide>
<del> if _, err = gitWithinDir(gitDir, "commit", "-am", "Branch commit"); err != nil {
<del> t.Fatal(err)
<del> }
<add> _, err = gitWithinDir(gitDir, "commit", "-am", "Branch commit")
<add> require.NoError(t, err)
<ide>
<del> if _, err = gitWithinDir(gitDir, "checkout", "master"); err != nil {
<del> t.Fatal(err)
<del> }
<add> _, err = gitWithinDir(gitDir, "checkout", "master")
<add> require.NoError(t, err)
<ide>
<ide> type singleCase struct {
<ide> frag string
<ide> func TestCheckoutGit(t *testing.T) {
<ide> ref, subdir := getRefAndSubdir(c.frag)
<ide> r, err := checkoutGit(gitDir, ref, subdir)
<ide>
<del> fail := err != nil
<del> if fail != c.fail {
<del> t.Fatalf("Expected %v failure, error was %v\n", c.fail, err)
<del> }
<ide> if c.fail {
<add> assert.Error(t, err)
<ide> continue
<ide> }
<ide>
<ide> b, err := ioutil.ReadFile(filepath.Join(r, "Dockerfile"))
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> if string(b) != c.exp {
<del> t.Fatalf("Expected %v, was %v\n", c.exp, string(b))
<del> }
<add> require.NoError(t, err)
<add> assert.Equal(t, c.exp, string(b))
<ide> }
<ide> } | 3 |
Ruby | Ruby | decrease string allocation in content_tag_string | 2a4d4301d405dbc4a6bce85b4632a78099c8d1c6 | <ide><path>actionview/lib/action_view/helpers/tag_helper.rb
<ide> module TagHelper
<ide>
<ide> TAG_PREFIXES = ['aria', 'data', :aria, :data].to_set
<ide>
<del> PRE_CONTENT_STRINGS = {
<del> :textarea => "\n"
<del> }
<add> PRE_CONTENT_STRINGS = Hash.new { "".freeze }
<add> PRE_CONTENT_STRINGS[:textarea] = "\n"
<add> PRE_CONTENT_STRINGS["textarea"] = "\n"
<add>
<ide>
<ide> # Returns an empty HTML tag of type +name+ which by default is XHTML
<ide> # compliant. Set +open+ to true to create an open tag compatible
<ide> def escape_once(html)
<ide> def content_tag_string(name, content, options, escape = true)
<ide> tag_options = tag_options(options, escape) if options
<ide> content = ERB::Util.unwrapped_html_escape(content) if escape
<del> "<#{name}#{tag_options}>#{PRE_CONTENT_STRINGS[name.to_sym]}#{content}</#{name}>".html_safe
<add> "<#{name}#{tag_options}>#{PRE_CONTENT_STRINGS[name]}#{content}</#{name}>".html_safe
<ide> end
<ide>
<ide> def tag_options(options, escape = true)
<ide> def tag_options(options, escape = true)
<ide> attrs << tag_option(key, value, escape)
<ide> end
<ide> end
<del> " #{attrs * ' '}" unless attrs.empty?
<add> " ".freeze + attrs * ' '.freeze unless attrs.empty?
<ide> end
<ide>
<ide> def prefix_tag_option(prefix, key, value, escape)
<ide> def boolean_tag_option(key)
<ide>
<ide> def tag_option(key, value, escape)
<ide> if value.is_a?(Array)
<del> value = escape ? safe_join(value, " ") : value.join(" ")
<add> value = escape ? safe_join(value, " ".freeze) : value.join(" ".freeze)
<ide> else
<ide> value = escape ? ERB::Util.unwrapped_html_escape(value) : value
<ide> end | 1 |
Text | Text | distinguish env from setting environment inline | 9f6e7e9aed85464651745090692317b30e4a3526 | <ide><path>docs/sources/reference/builder.md
<ide> was no formal definition on as to which instructions handled environment
<ide> replacement at the time. After 1.3 this behavior will be preserved and
<ide> canonical.
<ide>
<del>Environment variables (declared with the `ENV` statement) can also be used in
<add>Environment variables (declared with [the `ENV` statement](#env)) can also be used in
<ide> certain instructions as variables to be interpreted by the `Dockerfile`. Escapes
<ide> are also handled for including variable-like syntax into a statement literally.
<ide>
<ide> accessible from the host by default. To expose ports to the host, at runtime,
<ide> ENV <key>=<value> ...
<ide>
<ide> The `ENV` instruction sets the environment variable `<key>` to the value
<del>`<value>`. This value will be passed to all future
<del>`RUN`, `ENTRYPOINT`, and `CMD` instructions. This is
<del>functionally equivalent to prefixing the command with `<key>=<value>`
<add>`<value>`. This value will be in the environment of all "descendent" `Dockerfile`
<add>commands and can be [replaced inline](#environment-replacement) in many as well.
<ide>
<ide> The `ENV` instruction has two forms. The first form, `ENV <key> <value>`,
<ide> will set a single variable to a value. The entire string after the first
<ide> from the resulting image. You can view the values using `docker inspect`, and
<ide> change them using `docker run --env <key>=<value>`.
<ide>
<ide> > **Note**:
<del>> One example where this can cause unexpected consequences, is setting
<del>> `ENV DEBIAN_FRONTEND noninteractive`. Which will persist when the container
<del>> is run interactively; for example: `docker run -t -i image bash`
<add>> Environment persistence can cause unexpected effects. For example,
<add>> setting `ENV DEBIAN_FRONTEND noninteractive` may confuse apt-get
<add>> users on a Debian-based image. To set a value for a single command, use
<add>> `RUN <key>=<value> <command>`.
<ide>
<ide> ## ADD
<ide> | 1 |
Javascript | Javascript | exclude test files from copy in trace-next-server | a0ba545042b3ecfb034e4c21e8a55a9ead3f9fe6 | <ide><path>scripts/trace-next-server.js
<ide> async function main() {
<ide> const origRepoDir = path.join(__dirname, '..')
<ide> const repoDir = path.join(tmpdir, `tmp-next-${Date.now()}`)
<ide> const workDir = path.join(tmpdir, `trace-next-${Date.now()}`)
<add> const origTestDir = path.join(origRepoDir, 'test')
<add> const dotDir = path.join(origRepoDir, './') + '.'
<ide>
<ide> await fs.copy(origRepoDir, repoDir, {
<ide> filter: (item) => {
<del> return !item.includes('node_modules')
<add> return (
<add> !item.startsWith(origTestDir) &&
<add> !item.startsWith(dotDir) &&
<add> !item.includes('node_modules')
<add> )
<ide> },
<ide> })
<ide>
<ide> async function main() {
<ide> if (result.reasons[file].type === 'initial') {
<ide> continue
<ide> }
<del> tracedDeps.add(file)
<add> tracedDeps.add(file.replace(/\\/g, '/'))
<ide> const stat = await fs.stat(path.join(workDir, file))
<ide>
<ide> if (stat.isFile()) { | 1 |
Go | Go | restrict portallocator to docker allocated ports | dafddf461eeabd792d9ced6caced75ad6961c1d7 | <ide><path>daemon/networkdriver/bridge/driver.go
<ide> import (
<ide> "github.com/docker/libcontainer/netlink"
<ide> "github.com/dotcloud/docker/daemon/networkdriver"
<ide> "github.com/dotcloud/docker/daemon/networkdriver/ipallocator"
<del> "github.com/dotcloud/docker/daemon/networkdriver/portallocator"
<ide> "github.com/dotcloud/docker/daemon/networkdriver/portmapper"
<ide> "github.com/dotcloud/docker/engine"
<ide> "github.com/dotcloud/docker/pkg/iptables"
<ide> func Release(job *engine.Job) engine.Status {
<ide> var (
<ide> id = job.Args[0]
<ide> containerInterface = currentInterfaces.Get(id)
<del> ip net.IP
<del> port int
<del> proto string
<ide> )
<ide>
<ide> if containerInterface == nil {
<ide> func Release(job *engine.Job) engine.Status {
<ide> if err := portmapper.Unmap(nat); err != nil {
<ide> log.Printf("Unable to unmap port %s: %s", nat, err)
<ide> }
<del>
<del> // this is host mappings
<del> switch a := nat.(type) {
<del> case *net.TCPAddr:
<del> proto = "tcp"
<del> ip = a.IP
<del> port = a.Port
<del> case *net.UDPAddr:
<del> proto = "udp"
<del> ip = a.IP
<del> port = a.Port
<del> }
<del>
<del> if err := portallocator.ReleasePort(ip, proto, port); err != nil {
<del> log.Printf("Unable to release port %s", nat)
<del> }
<ide> }
<ide>
<ide> if err := ipallocator.ReleaseIP(bridgeNetwork, &containerInterface.IP); err != nil {
<ide> func AllocatePort(job *engine.Job) engine.Status {
<ide> ip = defaultBindingIP
<ide> id = job.Args[0]
<ide> hostIP = job.Getenv("HostIP")
<del> origHostPort = job.GetenvInt("HostPort")
<add> hostPort = job.GetenvInt("HostPort")
<ide> containerPort = job.GetenvInt("ContainerPort")
<ide> proto = job.Getenv("Proto")
<ide> network = currentInterfaces.Get(id)
<ide> func AllocatePort(job *engine.Job) engine.Status {
<ide> ip = net.ParseIP(hostIP)
<ide> }
<ide>
<del> var (
<del> hostPort int
<del> container net.Addr
<del> host net.Addr
<del> )
<add> // host ip, proto, and host port
<add> var container net.Addr
<add> switch proto {
<add> case "tcp":
<add> container = &net.TCPAddr{IP: network.IP, Port: containerPort}
<add> case "udp":
<add> container = &net.UDPAddr{IP: network.IP, Port: containerPort}
<add> default:
<add> return job.Errorf("unsupported address type %s", proto)
<add> }
<ide>
<ide> /*
<ide> Try up to 10 times to get a port that's not already allocated.
<ide>
<ide> In the event of failure to bind, return the error that portmapper.Map
<ide> yields.
<ide> */
<del> for i := 0; i < 10; i++ {
<del> // host ip, proto, and host port
<del> hostPort, err = portallocator.RequestPort(ip, proto, origHostPort)
<ide>
<del> if err != nil {
<del> return job.Error(err)
<del> }
<del>
<del> if proto == "tcp" {
<del> host = &net.TCPAddr{IP: ip, Port: hostPort}
<del> container = &net.TCPAddr{IP: network.IP, Port: containerPort}
<del> } else {
<del> host = &net.UDPAddr{IP: ip, Port: hostPort}
<del> container = &net.UDPAddr{IP: network.IP, Port: containerPort}
<add> var host net.Addr
<add> for i := 0; i < 10; i++ {
<add> if host, err = portmapper.Map(container, ip, hostPort); err == nil {
<add> break
<ide> }
<ide>
<del> if err = portmapper.Map(container, ip, hostPort); err == nil {
<add> // There is no point in immediately retrying to map an explicitely
<add> // chosen port.
<add> if hostPort != 0 {
<add> job.Logf("Failed to bind %s for container address %s", host.String(), container.String())
<ide> break
<ide> }
<ide>
<del> job.Logf("Failed to bind %s:%d for container address %s:%d. Trying another port.", ip.String(), hostPort, network.IP.String(), containerPort)
<add> // Automatically chosen 'free' port failed to bind: move on the next.
<add> job.Logf("Failed to bind %s for container address %s. Trying another port.", host.String(), container.String())
<ide> }
<ide>
<ide> if err != nil {
<ide> func AllocatePort(job *engine.Job) engine.Status {
<ide> network.PortMappings = append(network.PortMappings, host)
<ide>
<ide> out := engine.Env{}
<del> out.Set("HostIP", ip.String())
<del> out.SetInt("HostPort", hostPort)
<del>
<add> switch netAddr := host.(type) {
<add> case *net.TCPAddr:
<add> out.Set("HostIP", netAddr.IP.String())
<add> out.SetInt("HostPort", netAddr.Port)
<add> case *net.UDPAddr:
<add> out.Set("HostIP", netAddr.IP.String())
<add> out.SetInt("HostPort", netAddr.Port)
<add> }
<ide> if _, err := out.WriteTo(job.Stdout); err != nil {
<ide> return job.Error(err)
<ide> }
<add>
<ide> return engine.StatusOK
<ide> }
<ide>
<ide><path>daemon/networkdriver/bridge/driver_test.go
<add>package bridge
<add>
<add>import (
<add> "fmt"
<add> "net"
<add> "strconv"
<add> "testing"
<add>
<add> "github.com/dotcloud/docker/engine"
<add>)
<add>
<add>func findFreePort(t *testing.T) int {
<add> l, err := net.Listen("tcp", ":0")
<add> if err != nil {
<add> t.Fatal("Failed to find a free port")
<add> }
<add> defer l.Close()
<add>
<add> result, err := net.ResolveTCPAddr("tcp", l.Addr().String())
<add> if err != nil {
<add> t.Fatal("Failed to resolve address to identify free port")
<add> }
<add> return result.Port
<add>}
<add>
<add>func newPortAllocationJob(eng *engine.Engine, port int) (job *engine.Job) {
<add> strPort := strconv.Itoa(port)
<add>
<add> job = eng.Job("allocate_port", "container_id")
<add> job.Setenv("HostIP", "127.0.0.1")
<add> job.Setenv("HostPort", strPort)
<add> job.Setenv("Proto", "tcp")
<add> job.Setenv("ContainerPort", strPort)
<add> return
<add>}
<add>
<add>func TestAllocatePortDetection(t *testing.T) {
<add> eng := engine.New()
<add> eng.Logging = false
<add>
<add> freePort := findFreePort(t)
<add>
<add> // Init driver
<add> job := eng.Job("initdriver")
<add> if res := InitDriver(job); res != engine.StatusOK {
<add> t.Fatal("Failed to initialize network driver")
<add> }
<add>
<add> // Allocate interface
<add> job = eng.Job("allocate_interface", "container_id")
<add> if res := Allocate(job); res != engine.StatusOK {
<add> t.Fatal("Failed to allocate network interface")
<add> }
<add>
<add> // Allocate same port twice, expect failure on second call
<add> job = newPortAllocationJob(eng, freePort)
<add> if res := AllocatePort(job); res != engine.StatusOK {
<add> t.Fatal("Failed to find a free port to allocate")
<add> }
<add> if res := AllocatePort(job); res == engine.StatusOK {
<add> t.Fatal("Duplicate port allocation granted by AllocatePort")
<add> }
<add>}
<add>
<add>func TestAllocatePortReclaim(t *testing.T) {
<add> eng := engine.New()
<add> eng.Logging = false
<add>
<add> freePort := findFreePort(t)
<add>
<add> // Init driver
<add> job := eng.Job("initdriver")
<add> if res := InitDriver(job); res != engine.StatusOK {
<add> t.Fatal("Failed to initialize network driver")
<add> }
<add>
<add> // Allocate interface
<add> job = eng.Job("allocate_interface", "container_id")
<add> if res := Allocate(job); res != engine.StatusOK {
<add> t.Fatal("Failed to allocate network interface")
<add> }
<add>
<add> // Occupy port
<add> listenAddr := fmt.Sprintf(":%d", freePort)
<add> tcpListenAddr, err := net.ResolveTCPAddr("tcp", listenAddr)
<add> if err != nil {
<add> t.Fatalf("Failed to resolve TCP address '%s'", listenAddr)
<add> }
<add>
<add> l, err := net.ListenTCP("tcp", tcpListenAddr)
<add> if err != nil {
<add> t.Fatalf("Fail to listen on port %d", freePort)
<add> }
<add>
<add> // Allocate port, expect failure
<add> job = newPortAllocationJob(eng, freePort)
<add> if res := AllocatePort(job); res == engine.StatusOK {
<add> t.Fatal("Successfully allocated currently used port")
<add> }
<add>
<add> // Reclaim port, retry allocation
<add> l.Close()
<add> if res := AllocatePort(job); res != engine.StatusOK {
<add> t.Fatal("Failed to allocate previously reclaimed port")
<add> }
<add>}
<ide><path>daemon/networkdriver/portmapper/mapper.go
<ide> package portmapper
<ide> import (
<ide> "errors"
<ide> "fmt"
<del> "github.com/dotcloud/docker/pkg/iptables"
<del> "github.com/dotcloud/docker/pkg/proxy"
<ide> "net"
<ide> "sync"
<add>
<add> "github.com/dotcloud/docker/daemon/networkdriver/portallocator"
<add> "github.com/dotcloud/docker/pkg/iptables"
<add> "github.com/dotcloud/docker/pkg/proxy"
<ide> )
<ide>
<ide> type mapping struct {
<ide> var (
<ide> ErrPortNotMapped = errors.New("port is not mapped")
<ide> )
<ide>
<add>type genericAddr struct {
<add> IP net.IP
<add> Port int
<add>}
<add>
<add>func (g *genericAddr) Network() string {
<add> return ""
<add>}
<add>
<add>func (g *genericAddr) String() string {
<add> return fmt.Sprintf("%s:%d", g.IP.String(), g.Port)
<add>}
<add>
<ide> func SetIptablesChain(c *iptables.Chain) {
<ide> chain = c
<ide> }
<ide>
<del>func Map(container net.Addr, hostIP net.IP, hostPort int) error {
<add>func Map(container net.Addr, hostIP net.IP, hostPort int) (net.Addr, error) {
<ide> lock.Lock()
<ide> defer lock.Unlock()
<ide>
<del> var m *mapping
<add> var (
<add> m *mapping
<add> err error
<add> proto string
<add> allocatedHostPort int
<add> )
<add>
<ide> switch container.(type) {
<ide> case *net.TCPAddr:
<add> proto = "tcp"
<add> if allocatedHostPort, err = portallocator.RequestPort(hostIP, proto, hostPort); err != nil {
<add> return &net.TCPAddr{IP: hostIP, Port: hostPort}, err
<add> }
<ide> m = &mapping{
<del> proto: "tcp",
<del> host: &net.TCPAddr{IP: hostIP, Port: hostPort},
<add> proto: proto,
<add> host: &net.TCPAddr{IP: hostIP, Port: allocatedHostPort},
<ide> container: container,
<ide> }
<ide> case *net.UDPAddr:
<add> proto = "udp"
<add> if allocatedHostPort, err = portallocator.RequestPort(hostIP, proto, hostPort); err != nil {
<add> return &net.UDPAddr{IP: hostIP, Port: hostPort}, err
<add> }
<ide> m = &mapping{
<del> proto: "udp",
<del> host: &net.UDPAddr{IP: hostIP, Port: hostPort},
<add> proto: proto,
<add> host: &net.UDPAddr{IP: hostIP, Port: allocatedHostPort},
<ide> container: container,
<ide> }
<ide> default:
<del> return ErrUnknownBackendAddressType
<add> // Always return a proper net.Addr for proper reporting.
<add> return &genericAddr{IP: hostIP, Port: hostPort}, ErrUnknownBackendAddressType
<ide> }
<ide>
<add> // When binding fails:
<add> // - for a specifically requested port: it might be locked by some other
<add> // process, so we want to allow for an ulterior retry
<add> // - for an automatically allocated port: it falls in the Docker range of
<add> // ports, so we'll just remember it as used and try the next free one
<add> defer func() {
<add> if err != nil && hostPort != 0 {
<add> portallocator.ReleasePort(hostIP, proto, allocatedHostPort)
<add> }
<add> }()
<add>
<ide> key := getKey(m.host)
<ide> if _, exists := currentMappings[key]; exists {
<del> return ErrPortMappedForIP
<add> err = ErrPortMappedForIP
<add> return m.host, err
<ide> }
<ide>
<ide> containerIP, containerPort := getIPAndPort(m.container)
<del> if err := forward(iptables.Add, m.proto, hostIP, hostPort, containerIP.String(), containerPort); err != nil {
<del> return err
<add> if err := forward(iptables.Add, m.proto, hostIP, allocatedHostPort, containerIP.String(), containerPort); err != nil {
<add> return m.host, err
<ide> }
<ide>
<ide> p, err := newProxy(m.host, m.container)
<ide> if err != nil {
<ide> // need to undo the iptables rules before we reutrn
<del> forward(iptables.Delete, m.proto, hostIP, hostPort, containerIP.String(), containerPort)
<del> return err
<add> forward(iptables.Delete, m.proto, hostIP, allocatedHostPort, containerIP.String(), containerPort)
<add> return m.host, err
<ide> }
<ide>
<ide> m.userlandProxy = p
<ide> currentMappings[key] = m
<ide>
<ide> go p.Run()
<ide>
<del> return nil
<add> return m.host, nil
<ide> }
<ide>
<ide> func Unmap(host net.Addr) error {
<ide> func Unmap(host net.Addr) error {
<ide> if err := forward(iptables.Delete, data.proto, hostIP, hostPort, containerIP.String(), containerPort); err != nil {
<ide> return err
<ide> }
<add>
<add> switch a := host.(type) {
<add> case *net.TCPAddr:
<add> if err := portallocator.ReleasePort(a.IP, "tcp", a.Port); err != nil {
<add> return err
<add> }
<add> case *net.UDPAddr:
<add> if err := portallocator.ReleasePort(a.IP, "udp", a.Port); err != nil {
<add> return err
<add> }
<add> }
<add>
<ide> return nil
<ide> }
<ide>
<ide><path>daemon/networkdriver/portmapper/mapper_test.go
<ide> func TestMapPorts(t *testing.T) {
<ide> srcAddr1 := &net.TCPAddr{Port: 1080, IP: net.ParseIP("172.16.0.1")}
<ide> srcAddr2 := &net.TCPAddr{Port: 1080, IP: net.ParseIP("172.16.0.2")}
<ide>
<del> if err := Map(srcAddr1, dstIp1, 80); err != nil {
<add> addrEqual := func(addr1, addr2 net.Addr) bool {
<add> return (addr1.Network() == addr2.Network()) && (addr1.String() == addr2.String())
<add> }
<add>
<add> if host, err := Map(srcAddr1, dstIp1, 80); err != nil {
<ide> t.Fatalf("Failed to allocate port: %s", err)
<add> } else if !addrEqual(dstAddr1, host) {
<add> t.Fatalf("Incorrect mapping result: expected %s:%s, got %s:%s",
<add> dstAddr1.String(), dstAddr1.Network(), host.String(), host.Network())
<ide> }
<ide>
<del> if Map(srcAddr1, dstIp1, 80) == nil {
<add> if host, err := Map(srcAddr1, dstIp1, 80); err == nil {
<ide> t.Fatalf("Port is in use - mapping should have failed")
<add> } else if !addrEqual(dstAddr1, host) {
<add> t.Fatalf("Incorrect mapping result: expected %s:%s, got %s:%s",
<add> dstAddr1.String(), dstAddr1.Network(), host.String(), host.Network())
<ide> }
<ide>
<del> if Map(srcAddr2, dstIp1, 80) == nil {
<add> if host, err := Map(srcAddr2, dstIp1, 80); err == nil {
<ide> t.Fatalf("Port is in use - mapping should have failed")
<add> } else if !addrEqual(dstAddr1, host) {
<add> t.Fatalf("Incorrect mapping result: expected %s:%s, got %s:%s",
<add> dstAddr1.String(), dstAddr1.Network(), host.String(), host.Network())
<ide> }
<ide>
<del> if err := Map(srcAddr2, dstIp2, 80); err != nil {
<add> if host, err := Map(srcAddr2, dstIp2, 80); err != nil {
<ide> t.Fatalf("Failed to allocate port: %s", err)
<add> } else if !addrEqual(dstAddr2, host) {
<add> t.Fatalf("Incorrect mapping result: expected %s:%s, got %s:%s",
<add> dstAddr1.String(), dstAddr1.Network(), host.String(), host.Network())
<ide> }
<ide>
<ide> if Unmap(dstAddr1) != nil { | 4 |
Text | Text | fix doc format issue | 4d4d1e7f82592c4996650b92b01d9f4633e8878b | <ide><path>docs/security/https/README.md
<ide> draft = true
<ide>
<ide>
<ide> This is an initial attempt to make it easier to test the examples in the https.md
<del>doc
<add>doc.
<ide>
<del>at this point, it has to be a manual thing, and I've been running it in boot2docker
<add>At this point, it has to be a manual thing, and I've been running it in boot2docker.
<ide>
<del>so my process is
<add>My process is as following:
<add>
<add> $ boot2docker ssh
<add> $$ git clone https://github.com/docker/docker
<add> $$ cd docker/docs/articles/https
<add> $$ make cert
<ide>
<del>$ boot2docker ssh
<del>$$ git clone https://github.com/docker/docker
<del>$$ cd docker/docs/articles/https
<del>$$ make cert
<ide> lots of things to see and manually answer, as openssl wants to be interactive
<add>
<ide> **NOTE:** make sure you enter the hostname (`boot2docker` in my case) when prompted for `Computer Name`)
<del>$$ sudo make run
<ide>
<del>start another terminal
<add> $$ sudo make run
<ide>
<del>$ boot2docker ssh
<del>$$ cd docker/docs/articles/https
<del>$$ make client
<add>Start another terminal:
<ide>
<del>the last will connect first with `--tls` and then with `--tlsverify`
<add> $ boot2docker ssh
<add> $$ cd docker/docs/articles/https
<add> $$ make client
<ide>
<del>both should succeed
<add>The last will connect first with `--tls` and then with `--tlsverify`, both should succeed. | 1 |
Python | Python | fix unit testing on macos | c8f6e4d1bca5306d5b663268b79928131874c7c0 | <ide><path>glances/programs.py
<ide> def processes_to_programs(processes):
<ide> # Create a new entry in the dict (new program)
<ide> programs_dict[p[key]] = {
<ide> 'time_since_update': p['time_since_update'],
<del> 'num_threads': p['num_threads'],
<del> 'cpu_percent': p['cpu_percent'],
<del> 'memory_percent': p['memory_percent'],
<del> 'cpu_times': p['cpu_times'],
<del> 'memory_info': p['memory_info'],
<del> 'io_counters': p['io_counters'],
<add> # some values can be None, e.g. macOS system processes
<add> 'num_threads': p['num_threads'] or 0,
<add> 'cpu_percent': p['cpu_percent'] or 0,
<add> 'memory_percent': p['memory_percent'] or 0,
<add> 'cpu_times': p['cpu_times'] or (),
<add> 'memory_info': p['memory_info'] or (),
<add> 'io_counters': p['io_counters'] or (),
<ide> 'childrens': [p['pid']],
<ide> # Others keys are not used
<ide> # but should be set to be compliant with the existing process_list
<ide> def processes_to_programs(processes):
<ide> }
<ide> else:
<ide> # Update a existing entry in the dict (existing program)
<del> programs_dict[p[key]]['num_threads'] += p['num_threads']
<del> programs_dict[p[key]]['cpu_percent'] += p['cpu_percent']
<del> programs_dict[p[key]]['memory_percent'] += p['memory_percent']
<del> programs_dict[p[key]]['cpu_times'] += p['cpu_times']
<del> programs_dict[p[key]]['memory_info'] += p['memory_info']
<add> # some values can be None, e.g. macOS system processes
<add> programs_dict[p[key]]['num_threads'] += p['num_threads'] or 0
<add> programs_dict[p[key]]['cpu_percent'] += p['cpu_percent'] or 0
<add> programs_dict[p[key]]['memory_percent'] += p['memory_percent'] or 0
<add> programs_dict[p[key]]['cpu_times'] += p['cpu_times'] or ()
<add> programs_dict[p[key]]['memory_info'] += p['memory_info'] or ()
<add>
<ide> programs_dict[p[key]]['io_counters'] += p['io_counters']
<ide> programs_dict[p[key]]['childrens'].append(p['pid'])
<ide> # If all the subprocess has the same value, display it
<ide><path>unitest.py
<ide> def test_016_hddsmart(self):
<ide> def test_017_programs(self):
<ide> """Check Programs function (it's not a plugin)."""
<ide> # stats_to_check = [ ]
<del> print('INFO: [TEST_010] Check PROGRAM stats')
<add> print('INFO: [TEST_017] Check PROGRAM stats')
<ide> stats_grab = processes_to_programs(stats.get_plugin('processlist').get_raw())
<ide> self.assertTrue(type(stats_grab) is list, msg='Programs stats is not a list')
<ide> print('INFO: PROGRAM list stats: %s items in the list' % len(stats_grab)) | 2 |
Python | Python | fix a type hint in numpy.array_api | 4457e37b39bfc660beb8be579b282e5acbae1b5f | <ide><path>numpy/array_api/linalg.py
<ide> def vecdot(x1: Array, x2: Array, /, *, axis: int = -1) -> Array:
<ide>
<ide> # The type for ord should be Optional[Union[int, float, Literal[np.inf,
<ide> # -np.inf]]] but Literal does not support floating-point literals.
<del>def vector_norm(x: Array, /, *, axis: Optional[Union[int, Tuple[int, int]]] = None, keepdims: bool = False, ord: Optional[Union[int, float]] = 2) -> Array:
<add>def vector_norm(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False, ord: Optional[Union[int, float]] = 2) -> Array:
<ide> """
<ide> Array API compatible wrapper for :py:func:`np.linalg.norm <numpy.linalg.norm>`.
<ide> | 1 |
Javascript | Javascript | add known issue about custom interpolation symbols | c8e09c8a40540856c189532044ed10c1708d6be1 | <ide><path>src/ng/interpolate.js
<ide> function $InterpolateProvider() {
<ide> * symbol. For example, `{{ '}}' }}` will be incorrectly interpreted as `{{ ' }}` + `' }}`, i.e.
<ide> * an interpolated expression consisting of a single-quote (`'`) and the `' }}` string.
<ide> *
<add> * @knownIssue
<add> * All directives and components must use the standard `{{` `}}` interpolation symbols
<add> * in their templates. If you change the application interpolation symbols the {@link $compile}
<add> * service will attempt to denormalize the standard symbols to the custom symbols.
<add> * The denormalization process is not clever enough to know not to replace instances of the standard
<add> * symbols where they would not normally be treated as interpolation symbols. For example in the following
<add> * code snippet the closing braces of the literal object will get incorrectly denormalized:
<add> *
<add> * ```
<add> * <div data-context='{"context":{"id":3,"type":"page"}}">
<add> * ```
<add> *
<add> * The workaround is to ensure that such instances are separated by whitespace:
<add> * ```
<add> * <div data-context='{"context":{"id":3,"type":"page"} }">
<add> * ```
<add> *
<add> * See https://github.com/angular/angular.js/pull/14610#issuecomment-219401099 for more information.
<add> *
<ide> * @param {string} text The text with markup to interpolate.
<ide> * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have
<ide> * embedded expression in order to return an interpolation function. Strings with no | 1 |
Javascript | Javascript | require coffee before module cache in dev mode | 289f17b119386fbb93589ce22a9452ee7fcf3720 | <ide><path>static/index.js
<ide> window.onload = function() {
<ide> // Skip "?loadSettings=".
<ide> var loadSettings = JSON.parse(decodeURIComponent(location.search.substr(14)));
<ide>
<add> // Require before the module cache in dev mode
<add> if (loadSettings.devMode) {
<add> require('coffee-script').register();
<add> }
<add>
<ide> ModuleCache = require('../src/module-cache');
<ide> ModuleCache.register(loadSettings);
<ide> ModuleCache.add(loadSettings.resourcePath);
<ide> window.onload = function() {
<ide> });
<ide>
<ide> require('vm-compatibility-layer');
<del> require('coffee-script').register();
<add>
<add> if (!loadSettings.devMode) {
<add> require('coffee-script').register();
<add> }
<add>
<ide> require('../src/coffee-cache').register();
<ide>
<ide> require(loadSettings.bootstrapScript); | 1 |
PHP | PHP | remove environment check | 77d3b687904158e319f80ac5565404b3ea2e6d34 | <ide><path>src/Illuminate/Foundation/Console/EnvironmentEncryptCommand.php
<ide> use Illuminate\Console\Command;
<ide> use Illuminate\Encryption\Encrypter;
<ide> use Illuminate\Filesystem\Filesystem;
<del>use Illuminate\Support\Env;
<ide> use Symfony\Component\Console\Attribute\AsCommand;
<ide>
<ide> #[AsCommand(name: 'env:encrypt')]
<ide> public function __construct(Filesystem $files)
<ide> public function handle()
<ide> {
<ide> $cipher = $this->option('cipher') ?: 'aes-128-cbc';
<del> $key = $keyPassed = $this->option('key') ?: Env::get('ENVIRONMENT_ENCRYPTION_KEY');
<add> $key = $this->option('key');
<add> $keyPassed = $key !== null;
<ide> $environmentFile = $this->option('env')
<ide> ? base_path('.env').'.'.$this->option('env')
<ide> : $this->laravel->environmentFilePath(); | 1 |
Java | Java | remove propagation_ prefix in javadoc | c0252f8758db901d8ac5b7af798099db4e95f4dc | <ide><path>spring-tx/src/main/java/org/springframework/transaction/annotation/Propagation.java
<ide> public enum Propagation {
<ide> * Support a current transaction, execute non-transactionally if none exists.
<ide> * Analogous to EJB transaction attribute of the same name.
<ide> * <p>Note: For transaction managers with transaction synchronization,
<del> * PROPAGATION_SUPPORTS is slightly different from no transaction at all,
<add> * SUPPORTS is slightly different from no transaction at all,
<ide> * as it defines a transaction scope that synchronization will apply for.
<ide> * As a consequence, the same resources (JDBC Connection, Hibernate Session, etc)
<ide> * will be shared for the entire specified scope. Note that this depends on
<ide> public enum Propagation {
<ide>
<ide> /**
<ide> * Execute within a nested transaction if a current transaction exists,
<del> * behave like PROPAGATION_REQUIRED else. There is no analogous feature in EJB.
<add> * behave like REQUIRED else. There is no analogous feature in EJB.
<ide> * <p>Note: Actual creation of a nested transaction will only work on specific
<ide> * transaction managers. Out of the box, this only applies to the JDBC
<ide> * DataSourceTransactionManager when working on a JDBC 3.0 driver. | 1 |
Python | Python | remove lldbinit file from install script | e6cdf24bb52c8d362bfb6a258a65e9be2d670d94 | <ide><path>tools/install.py
<ide> def files(action):
<ide> action(['src/node.stp'], 'share/systemtap/tapset/')
<ide>
<ide> action(['deps/v8/tools/gdbinit'], 'share/doc/node/')
<del> action(['deps/v8/tools/lldbinit'], 'share/doc/node/')
<ide> action(['deps/v8/tools/lldb_commands.py'], 'share/doc/node/')
<ide>
<ide> if 'freebsd' in sys.platform or 'openbsd' in sys.platform: | 1 |
Text | Text | ignore extra spaces after opening main tag | 7e22661455f9f81bb9885ec12e3201c45202b965 | <ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc23991f86c76b9248c6eb8.md
<ide> assert(
<ide> Your `h2` element should be below the `main` element's opening tag and its opening tag should start 6 spaces over from the start of the line.
<ide>
<ide> ```js
<del>assert(code.toLowerCase().match(/<main\>\n\s{6}<h2>/));
<add>assert(code.toLowerCase().match(/<main\>\s*\n\s{6}<h2>/));
<ide> ```
<ide>
<ide> Your code should have a comment. You removed the comment from an earlier step. | 1 |
Ruby | Ruby | eliminate function that is only used in one place | 5a0cca739a42c60fc852b42eb2b36c457981dce2 | <ide><path>activerecord/lib/active_record/associations/join_dependency.rb
<ide> def build_join_association(reflection, parent, join_type)
<ide>
<ide> def construct(parent, nodes, row, rs)
<ide> nodes.sort_by { |k| k.name }.each do |node|
<del> assoc = node.children
<del> association = construct_scalar(parent, row, rs, node)
<del> construct(association, assoc, row, rs) if association
<add> association = construct_association(parent, node.join_part, row, rs)
<add> construct(association, node.children, row, rs) if association
<ide> end
<ide> end
<ide>
<del> def construct_scalar(parent, row, rs, node)
<del> construct_association(parent, node.join_part, row, rs)
<del> end
<del>
<ide> def construct_association(record, join_part, row, rs)
<ide> caster = rs.column_type(join_part.parent.aliased_primary_key)
<ide> row_id = caster.type_cast row[join_part.parent.aliased_primary_key] | 1 |
Text | Text | add some comments to the examples for clarity | 3969c719323b466ac0b093b31ba15fb5c0fc818f | <ide><path>docs/upgrading/upgrading-your-ui-theme.md
<ide> Chromium provides two tools for bypassing shadow boundaries, the `::shadow` pseu
<ide> The `::shadow` pseudo-element allows you to bypass a single shadow root. For example, say you want to update a highlight decoration for a linter package. Initially, the style looks as follows:
<ide>
<ide> ```css
<add>// Without shadow DOM support
<ide> atom-text-editor .highlight.my-linter {
<ide> background: hotpink;
<ide> }
<ide> atom-text-editor .highlight.my-linter {
<ide> In order for this style to apply with the shadow DOM enabled, you will need to add a second selector with the `::shadow` pseudo-element. You should leave the original selector in place so your theme continues to work with the shadow DOM disabled during the transition period.
<ide>
<ide> ```css
<add>// With shadow DOM support
<ide> atom-text-editor .highlight.my-linter,
<ide> atom-text-editor::shadow .highlight.my-linter {
<ide> background: hotpink;
<ide> Check out the [find-and-replace][https://github.com/atom/find-and-replace/blob/m
<ide> The `/deep/` combinator overrides *all* shadow boundaries, making it useful for rules you want to apply globally such as scrollbar styling. Here's a snippet containing scrollbar styling for the Atom Dark UI theme before shadow DOM support:
<ide>
<ide> ```css
<add>// Without shadow DOM support
<ide> .scrollbars-visible-always {
<ide> ::-webkit-scrollbar {
<ide> width: 8px;
<ide> The `/deep/` combinator overrides *all* shadow boundaries, making it useful for
<ide> To style scrollbars even inside of the shadow DOM, each rule needs to be prefixed with `/deep/`. We use `/deep/` instead of `::shadow` because we don't care about the selector of the host element in this case. We just want our styling to apply everywhere.
<ide>
<ide> ```css
<add>// With shadow DOM support using /deep/
<ide> .scrollbars-visible-always {
<ide> /deep/ ::-webkit-scrollbar {
<ide> width: 8px; | 1 |
PHP | PHP | move constructor to app | 013007a9e11d23a8e1a2ed39d80c4a4484d38107 | <ide><path>app/Http/Controllers/Auth/AuthController.php
<ide> <?php namespace App\Http\Controllers\Auth;
<ide>
<ide> use App\Http\Controllers\Controller;
<add>use Illuminate\Contracts\Auth\Guard;
<add>use Illuminate\Contracts\Auth\Registrar;
<ide> use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
<ide>
<ide> class AuthController extends Controller {
<ide><path>app/Http/Controllers/Auth/PasswordController.php
<ide> <?php namespace App\Http\Controllers\Auth;
<ide>
<ide> use App\Http\Controllers\Controller;
<add>use Illuminate\Contracts\Auth\Guard;
<add>use Illuminate\Contracts\Auth\PasswordBroker;
<ide> use Illuminate\Foundation\Auth\ResetsPasswords;
<ide>
<ide> class PasswordController extends Controller {
<ide> class PasswordController extends Controller {
<ide>
<ide> use ResetsPasswords;
<ide>
<add> /**
<add> * Create a new password controller instance.
<add> *
<add> * @param Guard $auth
<add> * @param PasswordBroker $passwords
<add> * @return void
<add> */
<add> public function __construct(Guard $auth, PasswordBroker $passwords)
<add> {
<add> $this->auth = $auth;
<add> $this->passwords = $passwords;
<add>
<add> $this->middleware('guest');
<add> }
<add>
<ide> } | 2 |
Java | Java | fix failing test from previous commit | 8afcf717e2873e57f62ec6367be4f656039e6cc4 | <ide><path>spring-test-mvc/src/main/java/org/springframework/test/web/servlet/result/PrintingResultHandler.java
<ide> import java.util.Map;
<ide>
<ide> import javax.servlet.ServletRequest;
<add>import javax.servlet.http.HttpServletRequest;
<ide>
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.mock.web.MockHttpServletRequest;
<ide> protected final MultiValueMap<String, String> getParamsMultiValueMap(MockHttpSer
<ide> }
<ide>
<ide> protected void printAsyncResult(MvcResult result) throws Exception {
<del> this.printer.printValue("Was async started", result.getRequest().isAsyncStarted());
<add> HttpServletRequest request = result.getRequest();
<add> this.printer.printValue("Was async started", request.isAsyncStarted());
<ide> this.printer.printValue("Async result", result.getAsyncResult(0));
<ide> }
<ide> | 1 |
Python | Python | expand asan acronym in configure help | 131b50d1878924291e4a7e3304e180494d5a3e0f | <ide><path>configure.py
<ide> parser.add_option('--enable-asan',
<ide> action='store_true',
<ide> dest='enable_asan',
<del> help='build with asan')
<add> help='compile for Address Sanitizer to find memory bugs')
<ide>
<ide> parser.add_option('--enable-static',
<ide> action='store_true', | 1 |
Javascript | Javascript | fix iterators for indexed lazy sequences | f3df9037a777c143678239a3ff57da41fe16076a | <ide><path>dist/Immutable.js
<ide> var $Sequence = Sequence;
<ide> return this.__deepEquals(other);
<ide> },
<ide> __deepEquals: function(other) {
<del> var entries = this.cacheResult().entrySeq().toArray();
<del> var iterations = 0;
<add> var entries = this.entries();
<ide> return other.every((function(v, k) {
<del> var entry = entries[iterations++];
<add> var entry = entries.next().value;
<ide> return entry && is(k, entry[0]) && is(v, entry[1]);
<del> })) && iterations === entries.length;
<add> })) && entries.next().done;
<ide> },
<ide> join: function(separator) {
<ide> separator = separator !== undefined ? '' + separator : ',';
<ide> function skipFactory(sequence, amount, useKeys) {
<ide> }
<ide> var iterator = amount && sequence.__iterator(type, reverse);
<ide> var skipped = 0;
<add> var iterations = 0;
<ide> return new Iterator((function() {
<ide> while (skipped < amount) {
<ide> skipped++;
<ide> iterator.next();
<ide> }
<del> return iterator.next();
<add> var step = iterator.next();
<add> if (useKeys || type === ITERATE_VALUES) {
<add> return step;
<add> } else if (type === ITERATE_KEYS) {
<add> return iteratorValue(type, iterations++, null, step);
<add> } else {
<add> return iteratorValue(type, iterations++, step.value[1], step);
<add> }
<ide> }));
<ide> };
<ide> return skipSequence;
<ide> function skipWhileFactory(sequence, predicate, context, useKeys) {
<ide> }
<ide> var iterator = sequence.__iterator(ITERATE_ENTRIES, reverse);
<ide> var skipping = true;
<add> var iterations = 0;
<ide> return new Iterator((function() {
<ide> var step,
<ide> k,
<ide> v;
<ide> do {
<ide> step = iterator.next();
<ide> if (step.done) {
<del> return step;
<add> if (useKeys || type === ITERATE_VALUES) {
<add> return step;
<add> } else if (type === ITERATE_KEYS) {
<add> return iteratorValue(type, iterations++, null, step);
<add> } else {
<add> return iteratorValue(type, iterations++, step.value[1], step);
<add> }
<ide> }
<ide> var entry = step.value;
<ide> k = entry[0];
<ide> function flattenFactory(sequence, useKeys) {
<ide> flatSequence.__iteratorUncached = function(type, reverse) {
<ide> var sequenceIterator = sequence.__iterator(ITERATE_VALUES, reverse);
<ide> var iterator;
<add> var iterations = 0;
<ide> return new Iterator((function() {
<ide> while (true) {
<ide> if (iterator) {
<ide> var step = iterator.next();
<ide> if (!step.done) {
<del> return step;
<add> if (useKeys || type === ITERATE_VALUES) {
<add> return step;
<add> } else if (type === ITERATE_KEYS) {
<add> return iteratorValue(type, iterations++, null, step);
<add> } else {
<add> return iteratorValue(type, iterations++, step.value[1], step);
<add> }
<ide> }
<ide> }
<ide> var sequenceStep = sequenceIterator.next();
<ide><path>dist/Immutable.min.js
<ide> * LICENSE file in the root directory of this source tree. An additional grant
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> */
<del>function t(){function t(t,e,r,n){var i;if(n){var u=n.prototype;i=Oe.create(u)}else i=t.prototype;return Oe.keys(e).forEach(function(t){i[t]=e[t]}),Oe.keys(r).forEach(function(e){t[e]=r[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,r,n){return Oe.getPrototypeOf(e)[r].apply(t,n)}function r(t,r,n){e(t,r,"constructor",n)}function n(t){return t.value=!1,t}function i(t){t&&(t.value=!0)}function u(){}function a(t,e){e=e||0;for(var r=Math.max(0,t.length-e),n=Array(r),i=0;r>i;i++)n[i]=t[i+e];return n}function s(t,e){if(!t)throw Error(e)}function o(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&Je;t=""+t,e="string"}return"string"===e?t.length>Ve?h(t):c(t):t.hashCode?o("function"==typeof t.hashCode?t.hashCode():t.hashCode):f(t)}function h(t){var e=Fe[t];return null==e&&(e=c(t),Te===Ne&&(Te=0,Fe={}),Te++,Fe[t]=e),e}function c(t){for(var e=0,r=0;t.length>r;r++)e=31*e+t.charCodeAt(r)&Je;return e}function f(t){var e=t[Le];if(e)return e;if(!ze){if(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[Le])return e;if(e=_(t))return e}if(!ze||Object.isExtensible(t)){if(e=++Be&Je,ze)Object.defineProperty(t,Le,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(Ke&&t.propertyIsEnumerable===Ke)t.propertyIsEnumerable=function(){return Ke.apply(this,arguments)},t.propertyIsEnumerable[Le]=e;else{if(!t.nodeType)throw Error("Unable to set a non-enumerable property on object.");t[Le]=e}return e}throw Error("Non-extensible objects are not allowed as keys.")}function _(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function l(t,e,r,n){var i=0===t?e:1===t?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function v(){return{value:void 0,done:!0}}function g(t){return!!y(t)}function p(t){return t&&"function"==typeof t.next}function m(t){var e=y(t);return"function"==typeof e?e.call(t):void 0}function y(t){return t&&(t[Ye]||t[Xe])}function d(t){return null==t.length&&t.cacheResult(),s(1/0>t.length,"Cannot reverse infinite range."),t.length
<add>function t(){function t(t,e,r,n){var i;if(n){var u=n.prototype;i=Oe.create(u)}else i=t.prototype;return Oe.keys(e).forEach(function(t){i[t]=e[t]}),Oe.keys(r).forEach(function(e){t[e]=r[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,r,n){return Oe.getPrototypeOf(e)[r].apply(t,n)}function r(t,r,n){e(t,r,"constructor",n)}function n(t){return t.value=!1,t}function i(t){t&&(t.value=!0)}function u(){}function a(t,e){e=e||0;for(var r=Math.max(0,t.length-e),n=Array(r),i=0;r>i;i++)n[i]=t[i+e];return n}function s(t,e){if(!t)throw Error(e)}function o(t){if(!t)return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if((0|t)===t)return t&Je;t=""+t,e="string"}return"string"===e?t.length>Ve?h(t):c(t):t.hashCode?o("function"==typeof t.hashCode?t.hashCode():t.hashCode):f(t)}function h(t){var e=Fe[t];return null==e&&(e=c(t),Te===Ne&&(Te=0,Fe={}),Te++,Fe[t]=e),e}function c(t){for(var e=0,r=0;t.length>r;r++)e=31*e+t.charCodeAt(r)&Je;return e}function f(t){var e=t[Le];if(e)return e;if(!ze){if(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[Le])return e;if(e=_(t))return e}if(!ze||Object.isExtensible(t)){if(e=++Be&Je,ze)Object.defineProperty(t,Le,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(Ke&&t.propertyIsEnumerable===Ke)t.propertyIsEnumerable=function(){return Ke.apply(this,arguments)},t.propertyIsEnumerable[Le]=e;else{if(!t.nodeType)throw Error("Unable to set a non-enumerable property on object.");t[Le]=e}return e}throw Error("Non-extensible objects are not allowed as keys.")}function _(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function l(t,e,r,n){var i=0===t?e:1===t?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function v(){return{value:void 0,done:!0}}function g(t){return!!d(t)}function p(t){return t&&"function"==typeof t.next}function m(t){var e=d(t);return"function"==typeof e?e.call(t):void 0}function d(t){return t&&(t[Ye]||t[Xe])}function y(t){return null==t.length&&t.cacheResult(),s(1/0>t.length,"Cannot reverse infinite range."),t.length
<ide> }function w(t,e,r){return(0===t||null!=r&&-r>=t)&&(null==e||null!=r&&e>=r)}function S(t,e){return b(t,e,0)}function q(t,e){return b(t,e,e)}function b(t,e,r){return null==t?r:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function I(t){return t}function x(t,e){return[e,t]}function M(){return!0}function k(t){return function(){return!t.apply(this,arguments)}}function D(t){return"string"==typeof t?JSON.stringify(t):t}function O(t,e){return t>e?1:e>t?-1:0}function C(t,e){return 0>e?(null==t.length&&t.cacheResult(),t.length+e):e}function A(t){s(1/0!==t,"Cannot perform this action with an infinite sequence.")}function E(t,e,r,n){var i=t._cache;if(i){for(var u=i.length-1,a=0;u>=a;a++){var s=i[r?u-a:a];if(e(s[1],n?s[0]:a,t)===!1)return a+1}return a}return t.__iterateUncached(e,r)}function j(t,e,r,n){var i=t._cache;if(i){var u=i.length-1,a=0;return new Ze(function(){var t=i[r?u-a:a];return a++>u?v():l(e,n?t[0]:a-1,t[1])})}return t.__iteratorUncached?t.__iteratorUncached(e,r):t.cacheResult().__iterator(e,r)}function R(t){var e=t.__makeSequence();return e.length=t.length,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.contains(e)},e.contains=function(e){return t.has(e)},e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t,r){return e(r,t,n)!==!1},r)},e.__iteratorUncached=function(e,r){if(e===Qe){var n=t.__iterator(e,r);return new Ze(function(){var t=n.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(e===He?Ge:He,r)},e}function U(t,e,r){var n=t.__makeSequence();return n.length=t.length,n.has=function(e){return t.has(e)},n.get=function(n,i){var u=t.get(n,Ue);return u===Ue?i:e.call(r,u,n,t)},n.__iterateUncached=function(n,i){var u=this;return t.__iterate(function(t,i,a){return n(e.call(r,t,i,a),i,u)!==!1},i)},n.__iteratorUncached=function(n,i){var u=t.__iterator(Qe,i);return new Ze(function(){var i=u.next();if(i.done)return i;var a=i.value,s=a[0];return l(n,s,e.call(r,a[1],s,t),i)
<ide> })},n}function P(t){var e=t.__makeSequence();return e.length=t.length,e.reverse=function(){return t},e.flip=function(){var e=t.flip.apply(this);return e.reverse=function(){return t.flip()},e},e.get=function(e,r){return t.get(e,r)},e.has=function(e){return t.has(e)},e.contains=function(e){return t.contains(e)},e.cacheResult=function(){return t.cacheResult(),this.length=t.length,this},e.__iterate=function(e,r){var n=this;return t.__iterate(function(t,r){return e(t,r,n)},!r)},e.__iterator=function(e,r){return t.__iterator(e,!r)},e}function W(t,e,r,n){var i=t.__makeSequence();return i.has=function(n){var i=t.get(n,Ue);return i!==Ue&&!!e.call(r,i,n,t)},i.get=function(n,i){var u=t.get(n,Ue);return u!==Ue&&e.call(r,u,n,t)?u:i},i.__iterateUncached=function(i,u){var a=this,s=0;return t.__iterate(function(t,u,o){return e.call(r,t,u,o)?(s++,i(t,n?u:s-1,a)):void 0},u),s},i.__iteratorUncached=function(i,u){var a=t.__iterator(Qe,u),s=0;return new Ze(function(){for(;;){var u=a.next();if(u.done)return u;var o=u.value,h=o[0],c=o[1];if(e.call(r,c,h,t))return l(i,n?h:s++,c,u)}})},i}function K(t,e,r,n){var i={},u=[];return t.__iterate(function(a,s){var h=e.call(r,a,s,t),c=o(h),f=n?[s,a]:a;i.hasOwnProperty(c)?u[i[c]][1].push(f):(i[c]=u.length,u.push([h,[f]]))}),tr(u).fromEntrySeq().map(n?function(t){return tr(t).fromEntrySeq()}:function(t){return tr(t)})}function z(t,e){if(e>t.length)return t;0>e&&(e=0);var r=t.__makeSequence();return r.length=t.length&&Math.min(t.length,e),r.__iterateUncached=function(r,n){var i=this;if(0===e)return 0;if(n)return this.cacheResult().__iterate(r,n);var u=0;return t.__iterate(function(t,n){return++u&&r(t,n,i)!==!1&&e>u}),u},r.__iteratorUncached=function(r,n){if(n)return this.cacheResult().__iterator(r,n);var i=e&&t.__iterator(r,n),u=0;return new Ze(function(){return u++>e?v():i.next()})},r}function J(t,e,r){var n=t.__makeSequence();return n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i);var a=0;return t.__iterate(function(t,i,s){return e.call(r,t,i,s)&&++a&&n(t,i,u)
<del>}),a},n.__iteratorUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterator(n,i);var a=t.__iterator(Qe,i),s=!0;return new Ze(function(){if(!s)return v();var t=a.next();if(t.done)return t;var i=t.value,o=i[0],h=i[1];return e.call(r,h,o,u)?n===Qe?t:l(n,o,h,t):(s=!1,v())})},n}function B(t,e,r){if(0>=e)return t;var n=t.__makeSequence();return n.length=t.length&&Math.max(0,t.length-e),n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i);var a=0,s=!0,o=0;return t.__iterate(function(t,i){return s&&(s=a++<e)?void 0:(o++,n(t,r?i:o-1,u))}),o},n.__iteratorUncached=function(r,n){if(n)return this.cacheResult().__iterator(r,n);var i=e&&t.__iterator(r,n),u=0;return new Ze(function(){for(;e>u;)u++,i.next();return i.next()})},n}function L(t,e,r,n){var i=t.__makeSequence();return i.__iterateUncached=function(i,u){var a=this;if(u)return this.cacheResult().__iterate(i,u);var s=!0,o=0;return t.__iterate(function(t,u,h){return s&&(s=e.call(r,t,u,h))?void 0:(o++,i(t,n?u:o-1,a))}),o},i.__iteratorUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterator(n,i);var a=t.__iterator(Qe,i),s=!0;return new Ze(function(){var t,i,o;do{if(t=a.next(),t.done)return t;var h=t.value;i=h[0],o=h[1],s&&(s=e.call(r,o,i,u))}while(s);return n===Qe?t:l(n,i,o,t)})},i}function V(t,e,r){var n=[t].concat(e),i=tr(n);return r&&(i=i.toKeyedSeq()),i=i.flatten(),i.length=n.reduce(function(t,e){if(void 0!==t){var r=tr(e).length;if(null!=r)return t+r}},0),i}function N(t,e){var r=t.__makeSequence();return r.__iterateUncached=function(r,n){var i=this,u=0;return t.__iterate(function(t){var a=!1;return tr(t).__iterate(function(t,n){return r(t,e?n:u++,i)===!1?(a=!0,!1):void 0},n),!a},n),u},r.__iteratorUncached=function(e,r){var n,i=t.__iterator(He,r);return new Ze(function(){for(;;){if(n){var t=n.next();if(!t.done)return t}var u=i.next();if(u.done)return u;n=tr(u.value).__iterator(e,r)}})},r}function T(t,e,r){return r instanceof tr?F(t,e,r):r}function F(t,e,r){return new lr(t._rootData,t._keyPath.concat(e),t._onChange,r)
<del>}function G(t,e,r){var n=t._rootData.updateIn(t._keyPath,r?vr.empty():void 0,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,n,t._rootData,r?i.concat(r):i),new lr(n,t._keyPath,t._onChange)}function H(t,e){return t instanceof lr&&(t=t.deref()),e instanceof lr&&(e=e.deref()),t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof tr?t.equals(e):!1}function Q(t,e){return l(t,e[0],e[1])}function X(t,e){return{node:t,index:0,__prev:e}}function Y(t,e,r,n){var i=Object.create(pr);return i.length=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Z(t,e,r){var i=n(Pe),u=n(We),a=$(t._root,t.__ownerID,0,o(e),e,r,i,u);if(!u.value)return t;var s=t.length+(i.value?r===Ue?-1:1:0);return t.__ownerID?(t.length=s,t._root=a,t.__hash=void 0,t.__altered=!0,t):a?Y(s,a):vr.empty()}function $(t,e,r,n,u,a,s,o){return t?t.update(e,r,n,u,a,s,o):a===Ue?t:(i(o),i(s),new br(e,n,[u,a]))}function te(t){return t.constructor===br||t.constructor===Sr}function ee(t,e,r,n,i){if(t.hash===n)return new Sr(e,n,[t.entry,i]);var u,a=(0===r?t.hash:t.hash>>>r)&Re,s=(0===r?n:n>>>r)&Re,o=a===s?[ee(t,e,r+Ee,n,i)]:(u=new br(e,n,i),s>a?[t,u]:[u,t]);return new mr(e,1<<a|1<<s,o)}function re(t,e,r,n){for(var i=0,u=0,a=Array(r),s=0,o=1,h=e.length;h>s;s++,o<<=1){var c=e[s];null!=c&&s!==n&&(i|=o,a[u++]=c)}return new mr(t,i,a)}function ne(t,e,r,n,i){for(var u=0,a=Array(je),s=0;0!==r;s++,r>>>=1)a[s]=1&r?e[u++]:null;return a[n]=i,new dr(t,u+1,a)}function ie(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u instanceof tr||(u=tr(u),u instanceof nr&&(u=u.fromEntrySeq())),u&&n.push(u)}return ae(t,e,n)}function ue(t){return function(e,r){return e&&e.mergeDeepWith?e.mergeDeepWith(t,r):t?t(e,r):r}}function ae(t,e,r){return 0===r.length?t:t.withMutations(function(t){for(var n=e?function(r,n){var i=t.get(n,Ue);t.set(n,i===Ue?r:e(i,r))}:function(e,r){t.set(r,e)},i=0;r.length>i;i++)r[i].forEach(n)})}function se(t,e,r,n,i){var u=e.length;if(i===u)return n(t);s(t.set,"updateIn with invalid keyPath");var a=i===u-1?r:vr.empty(),o=e[i],h=t.get(o,a),c=se(h,e,r,n,i+1);
<del>return c===h?t:t.set(o,c)}function oe(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function he(t,e,r,n){var i=n?t:a(t);return i[e]=r,i}function ce(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var u=Array(i),a=0,s=0;i>s;s++)s===e?(u[s]=r,a=-1):u[s]=t[s+a];return u}function fe(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=Array(n),u=0,a=0;n>a;a++)a===e&&(u=1),i[a]=t[a+u];return i}function _e(t,e,r,n,i,u){var a,s=t&&t.array;if(0===e){var o=0>r?-r:0,h=n-r;for(h>je&&(h=je),a=o;h>a;a++)if(i(s&&s[u?o+h-1-a:a])===!1)return!1}else{var c=1<<e,f=e-Ee;for(a=0;Re>=a;a++){var _=u?Re-a:a,l=r+(_<<e);if(n>l&&l+c>0){var v=s&&s[_];if(!_e(v,f,l,n,i,u))return!1}}}return!0}function le(t,e,r,n,i){return{array:t,level:e,offset:r,max:n,rawMax:n-r>>e,index:0,__prev:i}}function ve(t,e,r,n,i,u,a){var s=Object.create(Ar);return s.length=e-t,s._origin=t,s._size=e,s._level=r,s._root=n,s._tail=i,s.__ownerID=u,s.__hash=a,s.__altered=!1,s}function ge(t,e,r){if(e=C(t,e),e>=t.length||0>e)return r===Ue?t:t.withMutations(function(t){0>e?de(t,e).set(0,r):de(t,0,e+1).set(e,r)});e+=t._origin;var i=t._tail,u=t._root,a=n(We);return e>=Se(t._size)?i=pe(i,t.__ownerID,0,e,r,a):u=pe(u,t.__ownerID,t._level,e,r,a),a.value?t.__ownerID?(t._root=u,t._tail=i,t.__hash=void 0,t.__altered=!0,t):ve(t._origin,t._size,t._level,u,i):t}function pe(t,e,r,n,u,a){var s,o=u===Ue,h=n>>>r&Re,c=t&&t.array.length>h;if(o&&!c)return t;if(r>0){var f=t&&t.array[h],_=pe(f,e,r-Ee,n,u,a);return _===f?t:(s=me(t,e),s.array[h]=_,s)}return!o&&c&&t.array[h]===u?t:(i(a),s=me(t,e),o&&h===s.array.length-1?s.array.pop():s.array[h]=o?void 0:u,s)}function me(t,e){return e&&t&&e===t.ownerID?t:new Er(t?t.array.slice():[],e)}function ye(t,e){if(e>=Se(t._size))return t._tail;if(1<<t._level+Ee>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&Re],n-=Ee;return r}}function de(t,e,r){var n=t.__ownerID||new u,i=t._origin,a=t._size,s=i+e,o=null==r?a:0>r?a+r:i+r;if(s===i&&o===a)return t;if(s>=o)return t.clear();for(var h=t._level,c=t._root,f=0;0>s+f;)c=new Er(c&&c.array.length?[null,c]:[],n),h+=Ee,f+=1<<h;
<del>f&&(s+=f,i+=f,o+=f,a+=f);for(var _=Se(a),l=Se(o);l>=1<<h+Ee;)c=new Er(c&&c.array.length?[c]:[],n),h+=Ee;var v=t._tail,g=_>l?ye(t,o-1):l>_?new Er([],n):v;if(v&&l>_&&a>s&&v.array.length){c=me(c,n);for(var p=c,m=h;m>Ee;m-=Ee){var y=_>>>mℜp=p.array[y]=me(p.array[y],n)}p.array[_>>>Ee&Re]=v}if(a>o&&(g=g&&g.removeAfter(n,0,o)),s>=l)s-=l,o-=l,h=Ee,c=null,g=g&&g.removeBefore(n,0,s);else if(s>i||_>l){var d,w;f=0;do d=s>>>h&Re,w=l-1>>>h&Re,d===w&&(d&&(f+=(1<<h)*d),h-=Ee,c=c&&c.array[d]);while(c&&d===w);c&&s>i&&(c=c&&c.removeBefore(n,h,s-f)),c&&_>l&&(c=c&&c.removeAfter(n,h,l-f)),f&&(s-=f,o-=f)}return t.__ownerID?(t.length=o-s,t._origin=s,t._size=o,t._level=h,t._root=c,t._tail=g,t.__hash=void 0,t.__altered=!0,t):ve(s,o,h,c,g)}function we(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u&&n.push(tr(u))}var a=Math.max.apply(null,n.map(function(t){return t.length||0}));return a>t.length&&(t=t.setLength(a)),ae(t,e,n)}function Se(t){return je>t?0:t-1>>>Ee<<Ee}function qe(t,e){var r=Object.create(Kr);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}function be(t,e,r,n){var i=Object.create(Jr.prototype);return i.length=t?t.length:0,i._map=t,i._vector=e,i.__ownerID=r,i.__hash=n,i}function Ie(t,e,r){var n=t._map,i=t._vector,u=n.get(e),a=void 0!==u,s=r===Ue;if(!a&&s||a&&r===i.get(u)[1])return t;a||(u=i.length);var o=s?n.remove(e):a?n:n.set(e,u),h=s?i.remove(u):i.set(u,[e,r]);return t.__ownerID?(t.length=o.length,t._map=o,t._vector=h,t.__hash=void 0,t):be(o,h)}function xe(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function Me(t,e){return e?ke(e,t,"",{"":t}):De(t)}function ke(t,e,r,n){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(n,r,tr(e).map(function(r,n){return ke(t,r,n,e)})):e}function De(t){if(t){if(Array.isArray(t))return tr(t).map(De).toVector();if(t.constructor===Object)return tr(t).map(De).toMap()}return t}var Oe=Object,Ce={};Ce.createClass=t,Ce.superCall=e,Ce.defaultSuperCall=r;var Ae="delete",Ee=5,je=1<<Ee,Re=je-1,Ue={},Pe={value:!1},We={value:!1},Ke=Object.prototype.propertyIsEnumerable,ze=function(){try{return Object.defineProperty({},"x",{}),!0
<del>}catch(t){return!1}}(),Je=2147483647,Be=0,Le="__immutablehash__";"undefined"!=typeof Symbol&&(Le=Symbol(Le));var Ve=16,Ne=255,Te=0,Fe={},Ge=0,He=1,Qe=2,Xe="@@iterator",Ye="undefined"!=typeof Symbol?Symbol.iterator:Xe,Ze=function(t){this.next=t};Ce.createClass(Ze,{toString:function(){return"[Iterator]"}},{});var $e=Ze.prototype;$e.inspect=$e.toSource=function(){return""+this},$e[Ye]=function(){return this};var tr=function(t){return er.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},er=tr;Ce.createClass(tr,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+D(t)},toJS:function(){return this.map(function(t){return t instanceof er?t.toJS():t}).__toJS()},toArray:function(){A(this.length);var t=Array(this.length||0);return this.valueSeq().__iterate(function(e,r){t[r]=e}),t},toObject:function(){A(this.length);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toVector:function(){return A(this.length),Or.from(this)},toMap:function(){return A(this.length),vr.from(this)},toOrderedMap:function(){return A(this.length),Jr.from(this)},toSet:function(){return A(this.length),Pr.from(this)},toKeyedSeq:function(){return this},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,r){return t+(o(e)^(e===r?0:o(r)))&Je},0))},equals:function(t){if(this===t)return!0;if(!(t instanceof er))return!1;if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;if(0===this.length&&0===t.length)return!0}return null!=this.__hash&&null!=t.__hash&&this.__hash!==t.__hash?!1:this.__deepEquals(t)},__deepEquals:function(t){var e=this.cacheResult().entrySeq().toArray(),r=0;return t.every(function(t,n){var i=e[r++];return i&&H(n,i[0])&&H(t,i[1])})&&r===e.length},join:function(t){t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!=n?n:""}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.__iterate(M)),this.length)
<del>},countBy:function(t,e){var r=this,n={},i=[];return this.__iterate(function(u,a){var s=t.call(e,u,a,r),h=o(s);n.hasOwnProperty(h)?i[n[h]][1]++:(n[h]=i.length,i.push([s,1]))}),er(i).fromEntrySeq()},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return V(this,t,!0)},flatten:function(){return N(this,!0)},flatMap:function(t,e){return this.map(t,e).flatten()},reverse:function(){return P(this)},keySeq:function(){return this.flip().valueSeq()},valueSeq:function(){return new cr(this)},entrySeq:function(){var t=this;if(t._cache)return er(t._cache);var e=t.toKeyedSeq().map(x).valueSeq();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,r){var n,i;return 2>arguments.length?i=!0:n=e,this.__iterate(function(e,u,a){i?(i=!1,n=e):n=t.call(r,n,e,u,a)}),n},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},every:function(t,e){var r=!0;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},some:function(t,e){return!this.every(k(t),e)},first:function(){return this.find(M)},last:function(){return this.findLast(M)},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,Ue)!==Ue},get:function(t,e){return this.find(function(e,r){return H(r,t)},null,e)},getIn:function(t,e){var r=this;if(t)for(var n=0;t.length>n;n++)if(r=r&&r.get?r.get(t[n],Ue):Ue,r===Ue)return e;return r},contains:function(t){return this.find(function(e){return H(e,t)},null,Ue)!==Ue},find:function(t,e,r){var n=r;return this.__iterate(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},findKey:function(t,e){var r;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?(r=i,!1):void 0}),r},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},flip:function(){return R(this)},map:function(t,e){return U(this,t,e)},mapKeys:function(t,e){var r=this;
<del>return this.flip().map(function(n,i){return t.call(e,n,i,r)}).flip()},mapEntries:function(t,e){var r=this;return this.entrySeq().map(function(n,i){return t.call(e,n,i,r)}).fromEntrySeq()},filter:function(t,e){return W(this,t,e,!0)},slice:function(t,e){if(w(t,e,this.length))return this;var r=S(t,this.length),n=q(e,this.length);if(r!==r||n!==n)return this.cacheResult().slice(t,e);var i=0===r?this:this.skip(r);return null==n||n===this.length?i:i.take(n-r)},take:function(t){return z(this,t)},takeLast:function(t){return this.reverse().take(t).reverse()},takeWhile:function(t,e){return J(this,t,e)},takeUntil:function(t,e){return this.takeWhile(k(t),e)},skip:function(t){return B(this,t,!0)},skipLast:function(t){return this.reverse().skip(t).reverse()},skipWhile:function(t,e){return L(this,t,e,!0)},skipUntil:function(t,e){return this.skipWhile(k(t),e)},groupBy:function(t,e){return K(this,t,e,!0)},sort:function(t){return this.sortBy(I,t)},sortBy:function(t,e){e=e||O;var r=this;return er(this.entrySeq().entrySeq().toArray().sort(function(n,i){return e(t(n[1][1],n[1][0],r),t(i[1][1],i[1][0],r))||n[0]-i[0]})).fromEntrySeq().valueSeq().fromEntrySeq()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(A(this.length),this._cache=this.entrySeq().toArray(),null==this.length&&(this.length=this._cache.length)),this},keys:function(){return this.__iterator(Ge)},values:function(){return this.__iterator(He)},entries:function(){return this.__iterator(Qe)},__iterate:function(t,e){return E(this,t,e,!0)},__iterator:function(t,e){return j(this,t,e,!0)},__makeSequence:function(){return Object.create(rr)}},{from:function(t){if(t instanceof er)return t;if(!Array.isArray(t)){if(p(t))return new ar(t);if(g(t))return new sr(t);if(t&&t.constructor===Object)return new or(t);t=[t]}return new hr(t)}});var rr=tr.prototype;rr[Ye]=rr.entries,rr.toJSON=rr.toJS,rr.__toJS=rr.toObject,rr.inspect=rr.toSource=function(){return""+this},rr.chain=rr.flatMap;var nr=function(){Ce.defaultSuperCall(this,ir.prototype,arguments)},ir=nr;Ce.createClass(nr,{toString:function(){return this.__toString("Seq [","]")
<del>},toKeyedSeq:function(){return new fr(this)},valueSeq:function(){return this},fromEntrySeq:function(){return new _r(this)},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return V(this,t,!1)},filter:function(t,e){return W(this,t,e,!1)},get:function(t,e){return t=C(this,t),0>t||1/0===this.length||null!=this.length&&t>this.length?e:this.find(function(e,r){return r===t},null,e)},has:function(t){return t=C(this,t),t>=0&&(null!=this.length?1/0===this.length||this.length>t:-1!==this.indexOf(t))},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},indexOf:function(t){return this.findIndex(function(e){return H(e,t)})},lastIndexOf:function(t){return this.toKeyedSeq().reverse().indexOf(t)},findIndex:function(t,e){var r=this.findKey(t,e);return null==r?-1:r},findLastIndex:function(t,e){return this.toKeyedSeq().reverse().findIndex(t,e)},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=S(t,this.length);var n=this.slice(0,t);return 1===r?n:n.concat(a(arguments,2),this.slice(t+e))},flip:function(){return R(this.toKeyedSeq())},flatten:function(){return N(this,!1)},take:function(t){var e=this,r=z(this,t);return r!==this&&(r.get=function(r,n){return t>r?e.get(r,n):n}),r},skip:function(t){var e=this,r=B(this,t,!1);return r!==this&&(r.get=function(r,n){return e.get(r-t,n)}),r},skipWhile:function(t,e){return L(this,t,e,!1)},groupBy:function(t,e){return K(this,t,e,!1)},sortBy:function(t,e){e=e||O;var r=this;return tr(this.entrySeq().toArray().sort(function(n,i){return e(t(n[1],n[0],r),t(i[1],i[0],r))||n[0]-i[0]})).fromEntrySeq().valueSeq()},__iterate:function(t,e){return E(this,t,e,!1)},__iterator:function(t,e){return j(this,t,e,!1)},__makeSequence:function(){return Object.create(ur)}},{},tr);var ur=nr.prototype;ur[Ye]=ur.values,ur.__toJS=ur.toArray,ur.__toStringMapper=D;var ar=function(t){this._iterator=t,this._iteratorCache=[]};Ce.createClass(ar,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);
<del>for(var r=this._iterator,n=this._iteratorCache,i=0;n.length>i;)if(t(n[i],i++,this)===!1)return i;for(var u;!(u=r.next()).done;){var a=u.value;if(n[i]=a,t(a,i++,this)===!1)break}return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterator,n=this._iteratorCache,i=0;return new Ze(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return l(t,i,n[i++])})}},{},nr);var sr=function(t){this._iterable=t,this.length=t.length||t.size};Ce.createClass(sr,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=m(r),i=0;if(p(n))for(var u;!(u=n.next()).done&&t(u.value,i++,this)!==!1;);return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=m(r);if(!p(n))return new Ze(function(){return v()});var i=0;return new Ze(function(){var e=n.next();return e.done?e:l(t,i++,e.value)})}},{},nr);var or=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};Ce.createClass(or,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,u=0;i>=u;u++){var a=n[e?i-u:u];if(t(r[a],a,this)===!1)return u+1}return u},__iterator:function(t,e){var r=this._object,n=this._keys,i=n.length-1,u=0;return new Ze(function(){var a=n[e?i-u:u];return u++>i?v():l(t,a,r[a])})}},{},tr);var hr=function(t){this._array=t,this.length=t.length};Ce.createClass(hr,{toArray:function(){return this._array},get:function(t,e){return this.has(t)?this._array[C(this,t)]:e},__iterate:function(t,e){for(var r=this._array,n=r.length-1,i=0;n>=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},__iterator:function(t,e){var r=this._array,n=r.length-1,i=0;return new Ze(function(){return i>n?v():l(t,i,r[e?n-i++:i++])})}},{},nr);var cr=function(t){this._seq=t,this.length=t.length};Ce.createClass(cr,{get:function(t,e){return this._seq.get(t,e)
<del>},has:function(t){return this._seq.has(t)},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this,n=0;return this._seq.__iterate(function(e){return t(e,n++,r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(He,e),n=0;return new Ze(function(){var e=r.next();return e.done?e:l(t,n++,e.value,e)})}},{},nr);var fr=function(t){this._seq=t,this.length=t.length};Ce.createClass(fr,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},valueSeq:function(){return this._seq},reverse:function(){var t=this,e=P(this);return e.valueSeq=function(){return t._seq.reverse()},e},map:function(t,e){var r=this,n=U(this,t,e);return n.valueSeq=function(){return r._seq.map(t,e)},n},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this,n=e?d(this):0;return this._seq.__iterate(function(i){return t(i,e?--n:n++,r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(He,e),n=e?d(this):0;return new Ze(function(){var i=r.next();return i.done?i:l(t,e?--n:n++,i.value,i)})}},{},tr);var _r=function(t){this._seq=t,this.length=t.length};Ce.createClass(_r,{entrySeq:function(){return this._seq},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this;return this._seq.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(He,e);return new Ze(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n)return t===Qe?e:l(t,n[0],n[1],e)}})}},{},tr);var lr=function(t,e,r,n){n=n?n:t.getIn(e),this.length=n instanceof tr?n.length:null,this._rootData=t,this._keyPath=e,this._onChange=r};Ce.createClass(lr,{deref:function(t){return this._rootData.getIn(this._keyPath,t)},get:function(t,e){if(Array.isArray(t)&&0===t.length)return this;var r=this._rootData.getIn(this._keyPath.concat(t),Ue);return r===Ue?e:T(this,t,r)},set:function(t,e){return G(this,function(r){return r.set(t,e)
<del>},t)},remove:function(t){return G(this,function(e){return e.remove(t)},t)},clear:function(){return G(this,function(t){return t.clear()})},update:function(t,e,r){return 1===arguments.length?G(this,t):G(this,function(n){return n.update(t,e,r)},t)},withMutations:function(t){return G(this,function(e){return(e||vr.empty()).withMutations(t)})},cursor:function(t){return Array.isArray(t)&&0===t.length?this:F(this,t)},__iterate:function(t,e){var r=this,n=this,i=n.deref();return i&&i.__iterate?i.__iterate(function(e,i){return t(T(n,i,e),i,r)},e):0}},{},tr),lr.prototype[Ae]=lr.prototype.remove,lr.prototype.getIn=lr.prototype.get;var vr=function(t){var e=gr.empty();return t?t.constructor===gr?t:e.merge(t):e},gr=vr;Ce.createClass(vr,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,o(t),t,e):e},set:function(t,e){return Z(this,t,e)},remove:function(t){return Z(this,t,Ue)},update:function(t,e,r){return 1===arguments.length?this.updateIn([],null,t):this.updateIn([t],e,r)},updateIn:function(t,e,r){var n;return r||(n=[e,r],r=n[0],e=n[1],n),se(this,t,e,r,0)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):gr.empty()},merge:function(){return ie(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return ie(this,t,e)},mergeDeep:function(){return ie(this,ue(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return ie(this,ue(t),e)},cursor:function(t,e){return e||"function"!=typeof t?0===arguments.length?t=[]:Array.isArray(t)||(t=[t]):(e=t,t=[]),new lr(this,t,e)},withMutations:function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new u)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},__iterator:function(t,e){return new xr(this,t,e)
<del>},__iterate:function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},__deepEquals:function(t){var e=this;return t.every(function(t,r){return H(e.get(r,Ue),t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?Y(this.length,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{empty:function(){return Mr||(Mr=Y(0))}},tr);var pr=vr.prototype;pr[Ae]=pr.remove,vr.from=vr;var mr=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},yr=mr;Ce.createClass(mr,{get:function(t,e,r,n){var i=1<<((0===t?e:e>>>t)&Re),u=this.bitmap;return 0===(u&i)?n:this.nodes[oe(u&i-1)].get(t+Ee,e,r,n)},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Re,o=1<<s,h=this.bitmap,c=0!==(h&o);if(!c&&i===Ue)return this;var f=oe(h&o-1),_=this.nodes,l=c?_[f]:null,v=$(l,t,e+Ee,r,n,i,u,a);if(v===l)return this;if(!c&&v&&_.length>=kr)return ne(t,_,h,s,v);if(c&&!v&&2===_.length&&te(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&te(v))return v;var g=t&&t===this.ownerID,p=c?v?h:h^o:h|o,m=c?v?he(_,f,v,g):fe(_,f,g):ce(_,f,v,g);return g?(this.bitmap=p,this.nodes=m,this):new yr(t,p,m)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++)if(r[e?i-n:n].iterate(t,e)===!1)return!1}},{});var dr=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r},wr=dr;Ce.createClass(dr,{get:function(t,e,r,n){var i=(0===t?e:e>>>t)&Re,u=this.nodes[i];return u?u.get(t+Ee,e,r,n):n},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Re,o=i===Ue,h=this.nodes,c=h[s];if(o&&!c)return this;var f=$(c,t,e+Ee,r,n,i,u,a);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,Dr>_))return re(t,h,_,s)}else _++;var l=t&&t===this.ownerID,v=he(h,s,f,l);return l?(this.count=_,this.nodes=v,this):new wr(t,_,v)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var u=r[e?i-n:n];if(u&&u.iterate(t,e)===!1)return!1}}},{});var Sr=function(t,e,r){this.ownerID=t,this.hash=e,this.entries=r},qr=Sr;Ce.createClass(Sr,{get:function(t,e,r,n){for(var i=this.entries,u=0,a=i.length;a>u;u++)if(H(r,i[u][0]))return i[u][1];
<del>return n},update:function(t,e,r,n,u,s,o){var h=u===Ue;if(r!==this.hash)return h?this:(i(o),i(s),ee(this,t,e,r,[n,u]));for(var c=this.entries,f=0,_=c.length;_>f&&!H(n,c[f][0]);f++);var l=_>f;if(h&&!l)return this;if(i(o),(h||!l)&&i(s),h&&2===_)return new br(t,this.hash,c[1^f]);var v=t&&t===this.ownerID,g=v?c:a(c);return l?h?f===_-1?g.pop():g[f]=g.pop():g[f]=[n,u]:g.push([n,u]),v?(this.entries=g,this):new qr(t,this.hash,g)},iterate:function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1}},{});var br=function(t,e,r){this.ownerID=t,this.hash=e,this.entry=r},Ir=br;Ce.createClass(br,{get:function(t,e,r,n){return H(r,this.entry[0])?this.entry[1]:n},update:function(t,e,r,n,u,a,s){var o=u===Ue,h=H(n,this.entry[0]);return(h?u===this.entry[1]:o)?this:(i(s),o?(i(a),null):h?t&&t===this.ownerID?(this.entry[1]=u,this):new Ir(t,r,[n,u]):(i(a),ee(this,t,e,r,[n,u])))},iterate:function(t){return t(this.entry)}},{});var xr=function(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&X(t._root)};Ce.createClass(xr,{next:function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return Q(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return Q(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var u=n.nodes[this._reverse?r-i:i];if(u){if(u.entry)return Q(t,u.entry);e=this._stack=X(u,e)}continue}e=this._stack=this._stack.__prev}return v()}},{},Ze);var Mr,kr=je/2,Dr=je/4,Or=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Cr.from(t)},Cr=Or;Ce.createClass(Or,{toString:function(){return this.__toString("Vector [","]")},get:function(t,e){if(t=C(this,t),0>t||t>=this.length)return e;t+=this._origin;var r=ye(this,t);return r&&r.array[t&Re]},set:function(t,e){return ge(this,t,e)},remove:function(t){return ge(this,t,Ue)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=this._origin=this._size=0,this._level=Ee,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Cr.empty()},push:function(){var t=arguments,e=this.length;
<del>return this.withMutations(function(r){de(r,0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return de(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){de(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return de(this,1)},merge:function(){return we(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return we(this,t,e)},mergeDeep:function(){return we(this,ue(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return we(this,ue(t),e)},setLength:function(t){return de(this,0,t)},slice:function(t,e){var r=Ce.superCall(this,Cr.prototype,"slice",[t,e]);if(r!==this){var n=this,i=n.length;r.toVector=function(){return de(n,0>t?Math.max(0,i+t):i?Math.min(i,t):t,null==e?i:0>e?Math.max(0,i+e):i?Math.min(i,e):e)}}return r},__iterator:function(t,e){return new Rr(this,t,e)},__iterate:function(t,e){var r=this,n=0,i=function(e){return t(e,n++,r)},u=Se(this._size);return e?_e(this._tail,0,u-this._origin,this._size-this._origin,i,e)&&_e(this._root,this._level,-this._origin,u-this._origin,i,e):_e(this._root,this._level,-this._origin,u-this._origin,i,e)&&_e(this._tail,0,u-this._origin,this._size-this._origin,i,e),n},__deepEquals:function(t){var e=this.entries(!0);return t.every(function(t,r){var n=e.next().value;return n&&n[0]===r&&H(n[1],t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?ve(this._origin,this._size,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{empty:function(){return Ur||(Ur=ve(0,0,Ee))},from:function(t){if(!t||0===t.length)return Cr.empty();if(t.constructor===Cr)return t;var e=Array.isArray(t);return t.length>0&&je>t.length?ve(0,t.length,Ee,null,new Er(e?a(t):tr(t).toArray())):(e||(t=tr(t).valueSeq()),Cr.empty().merge(t))}},nr);var Ar=Or.prototype;Ar[Ae]=Ar.remove,Ar.update=pr.update,Ar.updateIn=pr.updateIn,Ar.cursor=pr.cursor,Ar.withMutations=pr.withMutations,Ar.asMutable=pr.asMutable,Ar.asImmutable=pr.asImmutable,Ar.wasAltered=pr.wasAltered;
<del>var Er=function(t,e){this.array=t,this.ownerID=e},jr=Er;Ce.createClass(Er,{removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>eℜif(n>=this.array.length)return new jr([],t);var i,u=0===n;if(e>0){var a=this.array[n];if(i=a&&a.removeBefore(t,e-Ee,r),i===a&&u)return this}if(u&&!i)return this;var s=me(this,t);if(!u)for(var o=0;n>o;o++)s.array[o]=void 0;return i&&(s.array[n]=i),s},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>eℜif(n>=this.array.length)return this;var i,u=n===this.array.length-1;if(e>0){var a=this.array[n];if(i=a&&a.removeAfter(t,e-Ee,r),i===a&&u)return this}if(u&&!i)return this;var s=me(this,t);return u||s.array.pop(),i&&(s.array[n]=i),s}},{});var Rr=function(t,e,r){this._type=e,this._reverse=!!r,this._maxIndex=t.length-1;var n=Se(t._size),i=le(t._root&&t._root.array,t._level,-t._origin,n-t._origin-1),u=le(t._tail&&t._tail.array,0,n-t._origin,t._size-t._origin-1);this._stack=r?u:i,this._stack.__prev=r?i:u};Ce.createClass(Rr,{next:function(){for(var t=this._stack;t;){var e=t.array,r=t.index++;if(this._reverse&&(r=Re-r,r>t.rawMax&&(r=t.rawMax,t.index=je-r)),r>=0&&je>r&&t.rawMax>=r){var n=e&&e[r];if(0===t.level){var i,u=this._type;return 1!==u&&(i=t.offset+(r<<t.level),this._reverse&&(i=this._maxIndex-i)),l(u,i,n)}this._stack=t=le(n&&n.array,t.level-Ee,t.offset+(r<<t.level),t.max,t)}else t=this._stack=this._stack.__prev}return v()}},{},Ze);var Ur,Pr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Wr.from(t)},Wr=Pr;Ce.createClass(Pr,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map.set(t,null);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:qe(e)},remove:function(t){var e=this._map.remove(t);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:0===e.length?Wr.empty():qe(e)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this):Wr.empty()
<del>},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++)tr(t[r]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return tr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.remove(r)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return tr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.remove(r)})})},isSubset:function(t){return t=tr(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=tr(t),t.every(function(t){return e.contains(t)})},wasAltered:function(){return this._map.wasAltered()},hashCode:function(){return this._map.hashCode()},__iterate:function(t,e){var r=this;return this._map.__iterate(function(e,n){return t(n,n,r)},e)},__iterator:function(t,e){return this._map.map(function(t,e){return e}).__iterator(t,e)},__deepEquals:function(t){return this.isSuperset(t)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?qe(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return zr||(zr=qe(vr.empty()))},from:function(t){var e=Wr.empty();return t?t.constructor===Wr?t:e.union(t):e},fromKeys:function(t){return Wr.from(tr(t).flip())}},tr);var Kr=Pr.prototype;Kr[Ae]=Kr.remove,Kr[Ye]=Kr.values,Kr.contains=Kr.has,Kr.mergeDeep=Kr.merge=Kr.union,Kr.mergeDeepWith=Kr.mergeWith=function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];return this.merge.apply(this,t)},Kr.withMutations=pr.withMutations,Kr.asMutable=pr.asMutable,Kr.asImmutable=pr.asImmutable,Kr.__toJS=ur.__toJS,Kr.__toStringMapper=ur.__toStringMapper;var zr,Jr=function(t){var e=Br.empty();return t?t.constructor===Br?t:e.merge(t):e},Br=Jr;Ce.createClass(Jr,{toString:function(){return this.__toString("OrderedMap {","}")
<del>},get:function(t,e){var r=this._map.get(t);return null!=r?this._vector.get(r)[1]:e},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this._vector.clear(),this):Br.empty()},set:function(t,e){return Ie(this,t,e)},remove:function(t){return Ie(this,t,Ue)},wasAltered:function(){return this._map.wasAltered()||this._vector.wasAltered()},__iterate:function(t,e){var r=this;return this._vector.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},__iterator:function(t,e){return this._vector.fromEntrySeq().__iterator(t,e)},__deepEquals:function(t){var e=this.entries();return t.every(function(t,r){var n=e.next().value;return n&&H(n[0],r)&&H(n[1],t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._vector.__ensureOwner(t);return t?be(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._vector=r,this)}},{empty:function(){return Lr||(Lr=be(vr.empty(),Or.empty()))}},vr),Jr.from=Jr,Jr.prototype[Ae]=Jr.prototype.remove;var Lr,Vr=function(t,e){var r=function(t){return this instanceof r?void(this._map=vr(t)):new r(t)};t=tr(t);var n=r.prototype=Object.create(Tr);n.constructor=r,n._name=e,n._defaultValues=t;var i=Object.keys(t);return r.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e)},set:function(t){s(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),r},Nr=Vr;Ce.createClass(Vr,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return Nr._empty||(Nr._empty=xe(this,vr.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:xe(this,r)},remove:function(t){if(null==t||!this.has(t))return this;
<del>var e=this._map.remove(t);return this.__ownerID||e===this._map?this:xe(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterator:function(t,e){return this._map.__iterator(t,e)},__iterate:function(t,e){var r=this;return this._defaultValues.map(function(t,e){return r.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?xe(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},tr);var Tr=Vr.prototype;Tr[Ae]=Tr.remove,Tr.merge=pr.merge,Tr.mergeWith=pr.mergeWith,Tr.mergeDeep=pr.mergeDeep,Tr.mergeDeepWith=pr.mergeDeepWith,Tr.update=pr.update,Tr.updateIn=pr.updateIn,Tr.cursor=pr.cursor,Tr.withMutations=pr.withMutations,Tr.asMutable=pr.asMutable,Tr.asImmutable=pr.asImmutable,Tr.__deepEquals=pr.__deepEquals;var Fr=function(t,e,r){return this instanceof Gr?(s(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&Qr?Qr:(r=null==r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.length=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new Gr(t,e,r)},Gr=Fr;Ce.createClass(Fr,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},get:function(t,e){return t=C(this,t),this.has(t)?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e){return w(t,e,this.length)?this:(t=S(t,this.length),e=q(e,this.length),t>=e?Qr:new Gr(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.length>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,Math.max(0,t))},skip:function(t){return this.slice(Math.max(0,t))},__iterate:function(t,e){for(var r=this.length-1,n=this._step,i=e?this._start+r*n:this._start,u=0;r>=u;u++){if(t(i,u,this)===!1)return u+1;
<del>i+=e?-n:n}return u},__iterator:function(t,e){var r=this.length-1,n=this._step,i=e?this._start+r*n:this._start,u=0;return new Ze(function(){var a=i;return i+=e?-n:n,u>r?v():l(t,u++,a)})},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},nr);var Hr=Fr.prototype;Hr.__toJS=Hr.toArray,Hr.first=Ar.first,Hr.last=Ar.last;var Qr=Fr(0,0),Xr=function(t,e){return 0===e&&$r?$r:this instanceof Yr?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new Yr(t,e)},Yr=Xr;Ce.createClass(Xr,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return this.has(t)?this._value:e},contains:function(t){return H(this._value,t)},slice:function(t,e){var r=this.length;return t=0>t?Math.max(0,r+t):Math.min(r,t),e=null==e?r:e>0?Math.min(r,e):Math.max(0,r+e),e>t?new Yr(this._value,e-t):$r},reverse:function(){return this},indexOf:function(t){return H(this._value,t)?0:-1},lastIndexOf:function(t){return H(this._value,t)?this.length:-1},__iterate:function(t){for(var e=0;this.length>e;e++)if(t(this._value,e,this)===!1)return e+1;return e},__iterator:function(t){var e=this,r=0;return new Ze(function(){return e.length>r?l(t,r++,e._value):v()})},__deepEquals:function(t){return H(this._value,t._value)}},{},nr);var Zr=Xr.prototype;Zr.last=Zr.first,Zr.has=Hr.has,Zr.take=Hr.take,Zr.skip=Hr.skip,Zr.__toJS=Hr.__toJS;var $r=new Xr(void 0,0),tn={Sequence:tr,Map:vr,Vector:Or,Set:Pr,OrderedMap:Jr,Record:Vr,Range:Fr,Repeat:Xr,is:H,fromJS:Me};return tn}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t();
<ide>\ No newline at end of file
<add>}),a},n.__iteratorUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterator(n,i);var a=t.__iterator(Qe,i),s=!0;return new Ze(function(){if(!s)return v();var t=a.next();if(t.done)return t;var i=t.value,o=i[0],h=i[1];return e.call(r,h,o,u)?n===Qe?t:l(n,o,h,t):(s=!1,v())})},n}function B(t,e,r){if(0>=e)return t;var n=t.__makeSequence();return n.length=t.length&&Math.max(0,t.length-e),n.__iterateUncached=function(n,i){var u=this;if(i)return this.cacheResult().__iterate(n,i);var a=0,s=!0,o=0;return t.__iterate(function(t,i){return s&&(s=a++<e)?void 0:(o++,n(t,r?i:o-1,u))}),o},n.__iteratorUncached=function(n,i){if(i)return this.cacheResult().__iterator(n,i);var u=e&&t.__iterator(n,i),a=0,s=0;return new Ze(function(){for(;e>a;)a++,u.next();var t=u.next();return r||n===He?t:n===Ge?l(n,s++,null,t):l(n,s++,t.value[1],t)})},n}function L(t,e,r,n){var i=t.__makeSequence();return i.__iterateUncached=function(i,u){var a=this;if(u)return this.cacheResult().__iterate(i,u);var s=!0,o=0;return t.__iterate(function(t,u,h){return s&&(s=e.call(r,t,u,h))?void 0:(o++,i(t,n?u:o-1,a))}),o},i.__iteratorUncached=function(i,u){var a=this;if(u)return this.cacheResult().__iterator(i,u);var s=t.__iterator(Qe,u),o=!0,h=0;return new Ze(function(){var t,u,c;do{if(t=s.next(),t.done)return n||i===He?t:i===Ge?l(i,h++,null,t):l(i,h++,t.value[1],t);var f=t.value;u=f[0],c=f[1],o&&(o=e.call(r,c,u,a))}while(o);return i===Qe?t:l(i,u,c,t)})},i}function V(t,e,r){var n=[t].concat(e),i=tr(n);return r&&(i=i.toKeyedSeq()),i=i.flatten(),i.length=n.reduce(function(t,e){if(void 0!==t){var r=tr(e).length;if(null!=r)return t+r}},0),i}function N(t,e){var r=t.__makeSequence();return r.__iterateUncached=function(r,n){var i=this,u=0;return t.__iterate(function(t){var a=!1;return tr(t).__iterate(function(t,n){return r(t,e?n:u++,i)===!1?(a=!0,!1):void 0},n),!a},n),u},r.__iteratorUncached=function(r,n){var i,u=t.__iterator(He,n),a=0;return new Ze(function(){for(;;){if(i){var t=i.next();if(!t.done)return e||r===He?t:r===Ge?l(r,a++,null,t):l(r,a++,t.value[1],t)
<add>}var s=u.next();if(s.done)return s;i=tr(s.value).__iterator(r,n)}})},r}function T(t,e,r){return r instanceof tr?F(t,e,r):r}function F(t,e,r){return new lr(t._rootData,t._keyPath.concat(e),t._onChange,r)}function G(t,e,r){var n=t._rootData.updateIn(t._keyPath,r?vr.empty():void 0,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,n,t._rootData,r?i.concat(r):i),new lr(n,t._keyPath,t._onChange)}function H(t,e){return t instanceof lr&&(t=t.deref()),e instanceof lr&&(e=e.deref()),t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof tr?t.equals(e):!1}function Q(t,e){return l(t,e[0],e[1])}function X(t,e){return{node:t,index:0,__prev:e}}function Y(t,e,r,n){var i=Object.create(pr);return i.length=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Z(t,e,r){var i=n(Pe),u=n(We),a=$(t._root,t.__ownerID,0,o(e),e,r,i,u);if(!u.value)return t;var s=t.length+(i.value?r===Ue?-1:1:0);return t.__ownerID?(t.length=s,t._root=a,t.__hash=void 0,t.__altered=!0,t):a?Y(s,a):vr.empty()}function $(t,e,r,n,u,a,s,o){return t?t.update(e,r,n,u,a,s,o):a===Ue?t:(i(o),i(s),new br(e,n,[u,a]))}function te(t){return t.constructor===br||t.constructor===Sr}function ee(t,e,r,n,i){if(t.hash===n)return new Sr(e,n,[t.entry,i]);var u,a=(0===r?t.hash:t.hash>>>r)&Re,s=(0===r?n:n>>>r)&Re,o=a===s?[ee(t,e,r+Ee,n,i)]:(u=new br(e,n,i),s>a?[t,u]:[u,t]);return new mr(e,1<<a|1<<s,o)}function re(t,e,r,n){for(var i=0,u=0,a=Array(r),s=0,o=1,h=e.length;h>s;s++,o<<=1){var c=e[s];null!=c&&s!==n&&(i|=o,a[u++]=c)}return new mr(t,i,a)}function ne(t,e,r,n,i){for(var u=0,a=Array(je),s=0;0!==r;s++,r>>>=1)a[s]=1&r?e[u++]:null;return a[n]=i,new yr(t,u+1,a)}function ie(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u instanceof tr||(u=tr(u),u instanceof nr&&(u=u.fromEntrySeq())),u&&n.push(u)}return ae(t,e,n)}function ue(t){return function(e,r){return e&&e.mergeDeepWith?e.mergeDeepWith(t,r):t?t(e,r):r}}function ae(t,e,r){return 0===r.length?t:t.withMutations(function(t){for(var n=e?function(r,n){var i=t.get(n,Ue);t.set(n,i===Ue?r:e(i,r))}:function(e,r){t.set(r,e)
<add>},i=0;r.length>i;i++)r[i].forEach(n)})}function se(t,e,r,n,i){var u=e.length;if(i===u)return n(t);s(t.set,"updateIn with invalid keyPath");var a=i===u-1?r:vr.empty(),o=e[i],h=t.get(o,a),c=se(h,e,r,n,i+1);return c===h?t:t.set(o,c)}function oe(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function he(t,e,r,n){var i=n?t:a(t);return i[e]=r,i}function ce(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var u=Array(i),a=0,s=0;i>s;s++)s===e?(u[s]=r,a=-1):u[s]=t[s+a];return u}function fe(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=Array(n),u=0,a=0;n>a;a++)a===e&&(u=1),i[a]=t[a+u];return i}function _e(t,e,r,n,i,u){var a,s=t&&t.array;if(0===e){var o=0>r?-r:0,h=n-r;for(h>je&&(h=je),a=o;h>a;a++)if(i(s&&s[u?o+h-1-a:a])===!1)return!1}else{var c=1<<e,f=e-Ee;for(a=0;Re>=a;a++){var _=u?Re-a:a,l=r+(_<<e);if(n>l&&l+c>0){var v=s&&s[_];if(!_e(v,f,l,n,i,u))return!1}}}return!0}function le(t,e,r,n,i){return{array:t,level:e,offset:r,max:n,rawMax:n-r>>e,index:0,__prev:i}}function ve(t,e,r,n,i,u,a){var s=Object.create(Ar);return s.length=e-t,s._origin=t,s._size=e,s._level=r,s._root=n,s._tail=i,s.__ownerID=u,s.__hash=a,s.__altered=!1,s}function ge(t,e,r){if(e=C(t,e),e>=t.length||0>e)return r===Ue?t:t.withMutations(function(t){0>e?ye(t,e).set(0,r):ye(t,0,e+1).set(e,r)});e+=t._origin;var i=t._tail,u=t._root,a=n(We);return e>=Se(t._size)?i=pe(i,t.__ownerID,0,e,r,a):u=pe(u,t.__ownerID,t._level,e,r,a),a.value?t.__ownerID?(t._root=u,t._tail=i,t.__hash=void 0,t.__altered=!0,t):ve(t._origin,t._size,t._level,u,i):t}function pe(t,e,r,n,u,a){var s,o=u===Ue,h=n>>>r&Re,c=t&&t.array.length>h;if(o&&!c)return t;if(r>0){var f=t&&t.array[h],_=pe(f,e,r-Ee,n,u,a);return _===f?t:(s=me(t,e),s.array[h]=_,s)}return!o&&c&&t.array[h]===u?t:(i(a),s=me(t,e),o&&h===s.array.length-1?s.array.pop():s.array[h]=o?void 0:u,s)}function me(t,e){return e&&t&&e===t.ownerID?t:new Er(t?t.array.slice():[],e)}function de(t,e){if(e>=Se(t._size))return t._tail;if(1<<t._level+Ee>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&Re],n-=Ee;
<add>return r}}function ye(t,e,r){var n=t.__ownerID||new u,i=t._origin,a=t._size,s=i+e,o=null==r?a:0>r?a+r:i+r;if(s===i&&o===a)return t;if(s>=o)return t.clear();for(var h=t._level,c=t._root,f=0;0>s+f;)c=new Er(c&&c.array.length?[null,c]:[],n),h+=Ee,f+=1<<h;f&&(s+=f,i+=f,o+=f,a+=f);for(var _=Se(a),l=Se(o);l>=1<<h+Ee;)c=new Er(c&&c.array.length?[c]:[],n),h+=Ee;var v=t._tail,g=_>l?de(t,o-1):l>_?new Er([],n):v;if(v&&l>_&&a>s&&v.array.length){c=me(c,n);for(var p=c,m=h;m>Ee;m-=Ee){var d=_>>>mℜp=p.array[d]=me(p.array[d],n)}p.array[_>>>Ee&Re]=v}if(a>o&&(g=g&&g.removeAfter(n,0,o)),s>=l)s-=l,o-=l,h=Ee,c=null,g=g&&g.removeBefore(n,0,s);else if(s>i||_>l){var y,w;f=0;do y=s>>>h&Re,w=l-1>>>h&Re,y===w&&(y&&(f+=(1<<h)*y),h-=Ee,c=c&&c.array[y]);while(c&&y===w);c&&s>i&&(c=c&&c.removeBefore(n,h,s-f)),c&&_>l&&(c=c&&c.removeAfter(n,h,l-f)),f&&(s-=f,o-=f)}return t.__ownerID?(t.length=o-s,t._origin=s,t._size=o,t._level=h,t._root=c,t._tail=g,t.__hash=void 0,t.__altered=!0,t):ve(s,o,h,c,g)}function we(t,e,r){for(var n=[],i=0;r.length>i;i++){var u=r[i];u&&n.push(tr(u))}var a=Math.max.apply(null,n.map(function(t){return t.length||0}));return a>t.length&&(t=t.setLength(a)),ae(t,e,n)}function Se(t){return je>t?0:t-1>>>Ee<<Ee}function qe(t,e){var r=Object.create(Kr);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}function be(t,e,r,n){var i=Object.create(Jr.prototype);return i.length=t?t.length:0,i._map=t,i._vector=e,i.__ownerID=r,i.__hash=n,i}function Ie(t,e,r){var n=t._map,i=t._vector,u=n.get(e),a=void 0!==u,s=r===Ue;if(!a&&s||a&&r===i.get(u)[1])return t;a||(u=i.length);var o=s?n.remove(e):a?n:n.set(e,u),h=s?i.remove(u):i.set(u,[e,r]);return t.__ownerID?(t.length=o.length,t._map=o,t._vector=h,t.__hash=void 0,t):be(o,h)}function xe(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function Me(t,e){return e?ke(e,t,"",{"":t}):De(t)}function ke(t,e,r,n){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(n,r,tr(e).map(function(r,n){return ke(t,r,n,e)})):e}function De(t){if(t){if(Array.isArray(t))return tr(t).map(De).toVector();
<add>if(t.constructor===Object)return tr(t).map(De).toMap()}return t}var Oe=Object,Ce={};Ce.createClass=t,Ce.superCall=e,Ce.defaultSuperCall=r;var Ae="delete",Ee=5,je=1<<Ee,Re=je-1,Ue={},Pe={value:!1},We={value:!1},Ke=Object.prototype.propertyIsEnumerable,ze=function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}(),Je=2147483647,Be=0,Le="__immutablehash__";"undefined"!=typeof Symbol&&(Le=Symbol(Le));var Ve=16,Ne=255,Te=0,Fe={},Ge=0,He=1,Qe=2,Xe="@@iterator",Ye="undefined"!=typeof Symbol?Symbol.iterator:Xe,Ze=function(t){this.next=t};Ce.createClass(Ze,{toString:function(){return"[Iterator]"}},{});var $e=Ze.prototype;$e.inspect=$e.toSource=function(){return""+this},$e[Ye]=function(){return this};var tr=function(t){return er.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},er=tr;Ce.createClass(tr,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+D(t)},toJS:function(){return this.map(function(t){return t instanceof er?t.toJS():t}).__toJS()},toArray:function(){A(this.length);var t=Array(this.length||0);return this.valueSeq().__iterate(function(e,r){t[r]=e}),t},toObject:function(){A(this.length);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toVector:function(){return A(this.length),Or.from(this)},toMap:function(){return A(this.length),vr.from(this)},toOrderedMap:function(){return A(this.length),Jr.from(this)},toSet:function(){return A(this.length),Pr.from(this)},toKeyedSeq:function(){return this},hashCode:function(){return this.__hash||(this.__hash=1/0===this.length?0:this.reduce(function(t,e,r){return t+(o(e)^(e===r?0:o(r)))&Je},0))},equals:function(t){if(this===t)return!0;if(!(t instanceof er))return!1;if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;if(0===this.length&&0===t.length)return!0}return null!=this.__hash&&null!=t.__hash&&this.__hash!==t.__hash?!1:this.__deepEquals(t)},__deepEquals:function(t){var e=this.entries();
<add>return t.every(function(t,r){var n=e.next().value;return n&&H(r,n[0])&&H(t,n[1])})&&e.next().done},join:function(t){t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!=n?n:""}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.__iterate(M)),this.length)},countBy:function(t,e){var r=this,n={},i=[];return this.__iterate(function(u,a){var s=t.call(e,u,a,r),h=o(s);n.hasOwnProperty(h)?i[n[h]][1]++:(n[h]=i.length,i.push([s,1]))}),er(i).fromEntrySeq()},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return V(this,t,!0)},flatten:function(){return N(this,!0)},flatMap:function(t,e){return this.map(t,e).flatten()},reverse:function(){return P(this)},keySeq:function(){return this.flip().valueSeq()},valueSeq:function(){return new cr(this)},entrySeq:function(){var t=this;if(t._cache)return er(t._cache);var e=t.toKeyedSeq().map(x).valueSeq();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,r){var n,i;return 2>arguments.length?i=!0:n=e,this.__iterate(function(e,u,a){i?(i=!1,n=e):n=t.call(r,n,e,u,a)}),n},reduceRight:function(){var t=this.toKeyedSeq().reverse();return t.reduce.apply(t,arguments)},every:function(t,e){var r=!0;return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?void 0:(r=!1,!1)}),r},some:function(t,e){return!this.every(k(t),e)},first:function(){return this.find(M)},last:function(){return this.findLast(M)},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,Ue)!==Ue},get:function(t,e){return this.find(function(e,r){return H(r,t)},null,e)},getIn:function(t,e){var r=this;if(t)for(var n=0;t.length>n;n++)if(r=r&&r.get?r.get(t[n],Ue):Ue,r===Ue)return e;return r},contains:function(t){return this.find(function(e){return H(e,t)},null,Ue)!==Ue},find:function(t,e,r){var n=r;return this.__iterate(function(r,i,u){return t.call(e,r,i,u)?(n=r,!1):void 0}),n},findKey:function(t,e){var r;
<add>return this.__iterate(function(n,i,u){return t.call(e,n,i,u)?(r=i,!1):void 0}),r},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},flip:function(){return R(this)},map:function(t,e){return U(this,t,e)},mapKeys:function(t,e){var r=this;return this.flip().map(function(n,i){return t.call(e,n,i,r)}).flip()},mapEntries:function(t,e){var r=this;return this.entrySeq().map(function(n,i){return t.call(e,n,i,r)}).fromEntrySeq()},filter:function(t,e){return W(this,t,e,!0)},slice:function(t,e){if(w(t,e,this.length))return this;var r=S(t,this.length),n=q(e,this.length);if(r!==r||n!==n)return this.cacheResult().slice(t,e);var i=0===r?this:this.skip(r);return null==n||n===this.length?i:i.take(n-r)},take:function(t){return z(this,t)},takeLast:function(t){return this.reverse().take(t).reverse()},takeWhile:function(t,e){return J(this,t,e)},takeUntil:function(t,e){return this.takeWhile(k(t),e)},skip:function(t){return B(this,t,!0)},skipLast:function(t){return this.reverse().skip(t).reverse()},skipWhile:function(t,e){return L(this,t,e,!0)},skipUntil:function(t,e){return this.skipWhile(k(t),e)},groupBy:function(t,e){return K(this,t,e,!0)},sort:function(t){return this.sortBy(I,t)},sortBy:function(t,e){e=e||O;var r=this;return er(this.entrySeq().entrySeq().toArray().sort(function(n,i){return e(t(n[1][1],n[1][0],r),t(i[1][1],i[1][0],r))||n[0]-i[0]})).fromEntrySeq().valueSeq().fromEntrySeq()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(A(this.length),this._cache=this.entrySeq().toArray(),null==this.length&&(this.length=this._cache.length)),this},keys:function(){return this.__iterator(Ge)},values:function(){return this.__iterator(He)},entries:function(){return this.__iterator(Qe)},__iterate:function(t,e){return E(this,t,e,!0)},__iterator:function(t,e){return j(this,t,e,!0)},__makeSequence:function(){return Object.create(rr)}},{from:function(t){if(t instanceof er)return t;if(!Array.isArray(t)){if(p(t))return new ar(t);if(g(t))return new sr(t);
<add>if(t&&t.constructor===Object)return new or(t);t=[t]}return new hr(t)}});var rr=tr.prototype;rr[Ye]=rr.entries,rr.toJSON=rr.toJS,rr.__toJS=rr.toObject,rr.inspect=rr.toSource=function(){return""+this},rr.chain=rr.flatMap;var nr=function(){Ce.defaultSuperCall(this,ir.prototype,arguments)},ir=nr;Ce.createClass(nr,{toString:function(){return this.__toString("Seq [","]")},toKeyedSeq:function(){return new fr(this)},valueSeq:function(){return this},fromEntrySeq:function(){return new _r(this)},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return V(this,t,!1)},filter:function(t,e){return W(this,t,e,!1)},get:function(t,e){return t=C(this,t),0>t||1/0===this.length||null!=this.length&&t>this.length?e:this.find(function(e,r){return r===t},null,e)},has:function(t){return t=C(this,t),t>=0&&(null!=this.length?1/0===this.length||this.length>t:-1!==this.indexOf(t))},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},indexOf:function(t){return this.findIndex(function(e){return H(e,t)})},lastIndexOf:function(t){return this.toKeyedSeq().reverse().indexOf(t)},findIndex:function(t,e){var r=this.findKey(t,e);return null==r?-1:r},findLastIndex:function(t,e){return this.toKeyedSeq().reverse().findIndex(t,e)},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=S(t,this.length);var n=this.slice(0,t);return 1===r?n:n.concat(a(arguments,2),this.slice(t+e))},flip:function(){return R(this.toKeyedSeq())},flatten:function(){return N(this,!1)},take:function(t){var e=this,r=z(this,t);return r!==this&&(r.get=function(r,n){return t>r?e.get(r,n):n}),r},skip:function(t){var e=this,r=B(this,t,!1);return r!==this&&(r.get=function(r,n){return e.get(r-t,n)}),r},skipWhile:function(t,e){return L(this,t,e,!1)},groupBy:function(t,e){return K(this,t,e,!1)},sortBy:function(t,e){e=e||O;var r=this;return tr(this.entrySeq().toArray().sort(function(n,i){return e(t(n[1],n[0],r),t(i[1],i[0],r))||n[0]-i[0]})).fromEntrySeq().valueSeq()},__iterate:function(t,e){return E(this,t,e,!1)
<add>},__iterator:function(t,e){return j(this,t,e,!1)},__makeSequence:function(){return Object.create(ur)}},{},tr);var ur=nr.prototype;ur[Ye]=ur.values,ur.__toJS=ur.toArray,ur.__toStringMapper=D;var ar=function(t){this._iterator=t,this._iteratorCache=[]};Ce.createClass(ar,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;n.length>i;)if(t(n[i],i++,this)===!1)return i;for(var u;!(u=r.next()).done;){var a=u.value;if(n[i]=a,t(a,i++,this)===!1)break}return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterator,n=this._iteratorCache,i=0;return new Ze(function(){if(i>=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return l(t,i,n[i++])})}},{},nr);var sr=function(t){this._iterable=t,this.length=t.length||t.size};Ce.createClass(sr,{__iterateUncached:function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=m(r),i=0;if(p(n))for(var u;!(u=n.next()).done&&t(u.value,i++,this)!==!1;);return i},__iteratorUncached:function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=m(r);if(!p(n))return new Ze(function(){return v()});var i=0;return new Ze(function(){var e=n.next();return e.done?e:l(t,i++,e.value)})}},{},nr);var or=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};Ce.createClass(or,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,u=0;i>=u;u++){var a=n[e?i-u:u];if(t(r[a],a,this)===!1)return u+1}return u},__iterator:function(t,e){var r=this._object,n=this._keys,i=n.length-1,u=0;return new Ze(function(){var a=n[e?i-u:u];return u++>i?v():l(t,a,r[a])})}},{},tr);var hr=function(t){this._array=t,this.length=t.length};Ce.createClass(hr,{toArray:function(){return this._array},get:function(t,e){return this.has(t)?this._array[C(this,t)]:e
<add>},__iterate:function(t,e){for(var r=this._array,n=r.length-1,i=0;n>=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},__iterator:function(t,e){var r=this._array,n=r.length-1,i=0;return new Ze(function(){return i>n?v():l(t,i,r[e?n-i++:i++])})}},{},nr);var cr=function(t){this._seq=t,this.length=t.length};Ce.createClass(cr,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this,n=0;return this._seq.__iterate(function(e){return t(e,n++,r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(He,e),n=0;return new Ze(function(){var e=r.next();return e.done?e:l(t,n++,e.value,e)})}},{},nr);var fr=function(t){this._seq=t,this.length=t.length};Ce.createClass(fr,{get:function(t,e){return this._seq.get(t,e)},has:function(t){return this._seq.has(t)},valueSeq:function(){return this._seq},reverse:function(){var t=this,e=P(this);return e.valueSeq=function(){return t._seq.reverse()},e},map:function(t,e){var r=this,n=U(this,t,e);return n.valueSeq=function(){return r._seq.map(t,e)},n},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this,n=e?y(this):0;return this._seq.__iterate(function(i){return t(i,e?--n:n++,r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(He,e),n=e?y(this):0;return new Ze(function(){var i=r.next();return i.done?i:l(t,e?--n:n++,i.value,i)})}},{},tr);var _r=function(t){this._seq=t,this.length=t.length};Ce.createClass(_r,{entrySeq:function(){return this._seq},cacheResult:function(){return this._seq.cacheResult(),this.length=this._seq.length,this},__iterate:function(t,e){var r=this;return this._seq.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},__iterator:function(t,e){var r=this._seq.__iterator(He,e);return new Ze(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n)return t===Qe?e:l(t,n[0],n[1],e)}})}},{},tr);var lr=function(t,e,r,n){n=n?n:t.getIn(e),this.length=n instanceof tr?n.length:null,this._rootData=t,this._keyPath=e,this._onChange=r
<add>};Ce.createClass(lr,{deref:function(t){return this._rootData.getIn(this._keyPath,t)},get:function(t,e){if(Array.isArray(t)&&0===t.length)return this;var r=this._rootData.getIn(this._keyPath.concat(t),Ue);return r===Ue?e:T(this,t,r)},set:function(t,e){return G(this,function(r){return r.set(t,e)},t)},remove:function(t){return G(this,function(e){return e.remove(t)},t)},clear:function(){return G(this,function(t){return t.clear()})},update:function(t,e,r){return 1===arguments.length?G(this,t):G(this,function(n){return n.update(t,e,r)},t)},withMutations:function(t){return G(this,function(e){return(e||vr.empty()).withMutations(t)})},cursor:function(t){return Array.isArray(t)&&0===t.length?this:F(this,t)},__iterate:function(t,e){var r=this,n=this,i=n.deref();return i&&i.__iterate?i.__iterate(function(e,i){return t(T(n,i,e),i,r)},e):0}},{},tr),lr.prototype[Ae]=lr.prototype.remove,lr.prototype.getIn=lr.prototype.get;var vr=function(t){var e=gr.empty();return t?t.constructor===gr?t:e.merge(t):e},gr=vr;Ce.createClass(vr,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return this._root?this._root.get(0,o(t),t,e):e},set:function(t,e){return Z(this,t,e)},remove:function(t){return Z(this,t,Ue)},update:function(t,e,r){return 1===arguments.length?this.updateIn([],null,t):this.updateIn([t],e,r)},updateIn:function(t,e,r){var n;return r||(n=[e,r],r=n[0],e=n[1],n),se(this,t,e,r,0)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):gr.empty()},merge:function(){return ie(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return ie(this,t,e)},mergeDeep:function(){return ie(this,ue(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return ie(this,ue(t),e)},cursor:function(t,e){return e||"function"!=typeof t?0===arguments.length?t=[]:Array.isArray(t)||(t=[t]):(e=t,t=[]),new lr(this,t,e)},withMutations:function(t){var e=this.asMutable();
<add>return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new u)},asImmutable:function(){return this.__ensureOwner()},wasAltered:function(){return this.__altered},__iterator:function(t,e){return new xr(this,t,e)},__iterate:function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},__deepEquals:function(t){var e=this;return t.every(function(t,r){return H(e.get(r,Ue),t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?Y(this.length,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)}},{empty:function(){return Mr||(Mr=Y(0))}},tr);var pr=vr.prototype;pr[Ae]=pr.remove,vr.from=vr;var mr=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r},dr=mr;Ce.createClass(mr,{get:function(t,e,r,n){var i=1<<((0===t?e:e>>>t)&Re),u=this.bitmap;return 0===(u&i)?n:this.nodes[oe(u&i-1)].get(t+Ee,e,r,n)},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Re,o=1<<s,h=this.bitmap,c=0!==(h&o);if(!c&&i===Ue)return this;var f=oe(h&o-1),_=this.nodes,l=c?_[f]:null,v=$(l,t,e+Ee,r,n,i,u,a);if(v===l)return this;if(!c&&v&&_.length>=kr)return ne(t,_,h,s,v);if(c&&!v&&2===_.length&&te(_[1^f]))return _[1^f];if(c&&v&&1===_.length&&te(v))return v;var g=t&&t===this.ownerID,p=c?v?h:h^o:h|o,m=c?v?he(_,f,v,g):fe(_,f,g):ce(_,f,v,g);return g?(this.bitmap=p,this.nodes=m,this):new dr(t,p,m)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++)if(r[e?i-n:n].iterate(t,e)===!1)return!1}},{});var yr=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r},wr=yr;Ce.createClass(yr,{get:function(t,e,r,n){var i=(0===t?e:e>>>t)&Re,u=this.nodes[i];return u?u.get(t+Ee,e,r,n):n},update:function(t,e,r,n,i,u,a){var s=(0===e?r:r>>>e)&Re,o=i===Ue,h=this.nodes,c=h[s];if(o&&!c)return this;var f=$(c,t,e+Ee,r,n,i,u,a);if(f===c)return this;var _=this.count;if(c){if(!f&&(_--,Dr>_))return re(t,h,_,s)}else _++;var l=t&&t===this.ownerID,v=he(h,s,f,l);return l?(this.count=_,this.nodes=v,this):new wr(t,_,v)},iterate:function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var u=r[e?i-n:n];
<add>if(u&&u.iterate(t,e)===!1)return!1}}},{});var Sr=function(t,e,r){this.ownerID=t,this.hash=e,this.entries=r},qr=Sr;Ce.createClass(Sr,{get:function(t,e,r,n){for(var i=this.entries,u=0,a=i.length;a>u;u++)if(H(r,i[u][0]))return i[u][1];return n},update:function(t,e,r,n,u,s,o){var h=u===Ue;if(r!==this.hash)return h?this:(i(o),i(s),ee(this,t,e,r,[n,u]));for(var c=this.entries,f=0,_=c.length;_>f&&!H(n,c[f][0]);f++);var l=_>f;if(h&&!l)return this;if(i(o),(h||!l)&&i(s),h&&2===_)return new br(t,this.hash,c[1^f]);var v=t&&t===this.ownerID,g=v?c:a(c);return l?h?f===_-1?g.pop():g[f]=g.pop():g[f]=[n,u]:g.push([n,u]),v?(this.entries=g,this):new qr(t,this.hash,g)},iterate:function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1}},{});var br=function(t,e,r){this.ownerID=t,this.hash=e,this.entry=r},Ir=br;Ce.createClass(br,{get:function(t,e,r,n){return H(r,this.entry[0])?this.entry[1]:n},update:function(t,e,r,n,u,a,s){var o=u===Ue,h=H(n,this.entry[0]);return(h?u===this.entry[1]:o)?this:(i(s),o?(i(a),null):h?t&&t===this.ownerID?(this.entry[1]=u,this):new Ir(t,r,[n,u]):(i(a),ee(this,t,e,r,[n,u])))},iterate:function(t){return t(this.entry)}},{});var xr=function(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&X(t._root)};Ce.createClass(xr,{next:function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return Q(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return Q(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var u=n.nodes[this._reverse?r-i:i];if(u){if(u.entry)return Q(t,u.entry);e=this._stack=X(u,e)}continue}e=this._stack=this._stack.__prev}return v()}},{},Ze);var Mr,kr=je/2,Dr=je/4,Or=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Cr.from(t)},Cr=Or;Ce.createClass(Or,{toString:function(){return this.__toString("Vector [","]")},get:function(t,e){if(t=C(this,t),0>t||t>=this.length)return e;t+=this._origin;var r=de(this,t);return r&&r.array[t&Re]},set:function(t,e){return ge(this,t,e)},remove:function(t){return ge(this,t,Ue)
<add>},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=this._origin=this._size=0,this._level=Ee,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Cr.empty()},push:function(){var t=arguments,e=this.length;return this.withMutations(function(r){ye(r,0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return ye(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){ye(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return ye(this,1)},merge:function(){return we(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return we(this,t,e)},mergeDeep:function(){return we(this,ue(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return we(this,ue(t),e)},setLength:function(t){return ye(this,0,t)},slice:function(t,e){var r=Ce.superCall(this,Cr.prototype,"slice",[t,e]);if(r!==this){var n=this,i=n.length;r.toVector=function(){return ye(n,0>t?Math.max(0,i+t):i?Math.min(i,t):t,null==e?i:0>e?Math.max(0,i+e):i?Math.min(i,e):e)}}return r},__iterator:function(t,e){return new Rr(this,t,e)},__iterate:function(t,e){var r=this,n=0,i=function(e){return t(e,n++,r)},u=Se(this._size);return e?_e(this._tail,0,u-this._origin,this._size-this._origin,i,e)&&_e(this._root,this._level,-this._origin,u-this._origin,i,e):_e(this._root,this._level,-this._origin,u-this._origin,i,e)&&_e(this._tail,0,u-this._origin,this._size-this._origin,i,e),n},__deepEquals:function(t){var e=this.entries(!0);return t.every(function(t,r){var n=e.next().value;return n&&n[0]===r&&H(n[1],t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?ve(this._origin,this._size,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)}},{empty:function(){return Ur||(Ur=ve(0,0,Ee))},from:function(t){if(!t||0===t.length)return Cr.empty();if(t.constructor===Cr)return t;var e=Array.isArray(t);return t.length>0&&je>t.length?ve(0,t.length,Ee,null,new Er(e?a(t):tr(t).toArray())):(e||(t=tr(t).valueSeq()),Cr.empty().merge(t))
<add>}},nr);var Ar=Or.prototype;Ar[Ae]=Ar.remove,Ar.update=pr.update,Ar.updateIn=pr.updateIn,Ar.cursor=pr.cursor,Ar.withMutations=pr.withMutations,Ar.asMutable=pr.asMutable,Ar.asImmutable=pr.asImmutable,Ar.wasAltered=pr.wasAltered;var Er=function(t,e){this.array=t,this.ownerID=e},jr=Er;Ce.createClass(Er,{removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>eℜif(n>=this.array.length)return new jr([],t);var i,u=0===n;if(e>0){var a=this.array[n];if(i=a&&a.removeBefore(t,e-Ee,r),i===a&&u)return this}if(u&&!i)return this;var s=me(this,t);if(!u)for(var o=0;n>o;o++)s.array[o]=void 0;return i&&(s.array[n]=i),s},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>eℜif(n>=this.array.length)return this;var i,u=n===this.array.length-1;if(e>0){var a=this.array[n];if(i=a&&a.removeAfter(t,e-Ee,r),i===a&&u)return this}if(u&&!i)return this;var s=me(this,t);return u||s.array.pop(),i&&(s.array[n]=i),s}},{});var Rr=function(t,e,r){this._type=e,this._reverse=!!r,this._maxIndex=t.length-1;var n=Se(t._size),i=le(t._root&&t._root.array,t._level,-t._origin,n-t._origin-1),u=le(t._tail&&t._tail.array,0,n-t._origin,t._size-t._origin-1);this._stack=r?u:i,this._stack.__prev=r?i:u};Ce.createClass(Rr,{next:function(){for(var t=this._stack;t;){var e=t.array,r=t.index++;if(this._reverse&&(r=Re-r,r>t.rawMax&&(r=t.rawMax,t.index=je-r)),r>=0&&je>r&&t.rawMax>=r){var n=e&&e[r];if(0===t.level){var i,u=this._type;return 1!==u&&(i=t.offset+(r<<t.level),this._reverse&&(i=this._maxIndex-i)),l(u,i,n)}this._stack=t=le(n&&n.array,t.level-Ee,t.offset+(r<<t.level),t.max,t)}else t=this._stack=this._stack.__prev}return v()}},{},Ze);var Ur,Pr=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Wr.from(t)},Wr=Pr;Ce.createClass(Pr,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map.has(t)},get:function(t,e){return this.has(t)?t:e},add:function(t){var e=this._map.set(t,null);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:qe(e)
<add>},remove:function(t){var e=this._map.remove(t);return this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:0===e.length?Wr.empty():qe(e)},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this):Wr.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++)tr(t[r]).forEach(function(t){return e.add(t)})})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return tr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.remove(r)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return tr(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.remove(r)})})},isSubset:function(t){return t=tr(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=tr(t),t.every(function(t){return e.contains(t)})},wasAltered:function(){return this._map.wasAltered()},hashCode:function(){return this._map.hashCode()},__iterate:function(t,e){var r=this;return this._map.__iterate(function(e,n){return t(n,n,r)},e)},__iterator:function(t,e){return this._map.map(function(t,e){return e}).__iterator(t,e)},__deepEquals:function(t){return this.isSuperset(t)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?qe(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return zr||(zr=qe(vr.empty()))},from:function(t){var e=Wr.empty();return t?t.constructor===Wr?t:e.union(t):e},fromKeys:function(t){return Wr.from(tr(t).flip())}},tr);var Kr=Pr.prototype;Kr[Ae]=Kr.remove,Kr[Ye]=Kr.values,Kr.contains=Kr.has,Kr.mergeDeep=Kr.merge=Kr.union,Kr.mergeDeepWith=Kr.mergeWith=function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];return this.merge.apply(this,t)
<add>},Kr.withMutations=pr.withMutations,Kr.asMutable=pr.asMutable,Kr.asImmutable=pr.asImmutable,Kr.__toJS=ur.__toJS,Kr.__toStringMapper=ur.__toStringMapper;var zr,Jr=function(t){var e=Br.empty();return t?t.constructor===Br?t:e.merge(t):e},Br=Jr;Ce.createClass(Jr,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){var r=this._map.get(t);return null!=r?this._vector.get(r)[1]:e},clear:function(){return 0===this.length?this:this.__ownerID?(this.length=0,this._map.clear(),this._vector.clear(),this):Br.empty()},set:function(t,e){return Ie(this,t,e)},remove:function(t){return Ie(this,t,Ue)},wasAltered:function(){return this._map.wasAltered()||this._vector.wasAltered()},__iterate:function(t,e){var r=this;return this._vector.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},__iterator:function(t,e){return this._vector.fromEntrySeq().__iterator(t,e)},__deepEquals:function(t){var e=this.entries();return t.every(function(t,r){var n=e.next().value;return n&&H(n[0],r)&&H(n[1],t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._vector.__ensureOwner(t);return t?be(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._vector=r,this)}},{empty:function(){return Lr||(Lr=be(vr.empty(),Or.empty()))}},vr),Jr.from=Jr,Jr.prototype[Ae]=Jr.prototype.remove;var Lr,Vr=function(t,e){var r=function(t){return this instanceof r?void(this._map=vr(t)):new r(t)};t=tr(t);var n=r.prototype=Object.create(Tr);n.constructor=r,n._name=e,n._defaultValues=t;var i=Object.keys(t);return r.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e)},set:function(t){s(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),r},Nr=Vr;Ce.createClass(Vr,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;
<add>Object.getPrototypeOf(this).constructor;return Nr._empty||(Nr._empty=xe(this,vr.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:xe(this,r)},remove:function(t){if(null==t||!this.has(t))return this;var e=this._map.remove(t);return this.__ownerID||e===this._map?this:xe(this,e)},keys:function(){return this._map.keys()},values:function(){return this._map.values()},entries:function(){return this._map.entries()},wasAltered:function(){return this._map.wasAltered()},__iterator:function(t,e){return this._map.__iterator(t,e)},__iterate:function(t,e){var r=this;return this._defaultValues.map(function(t,e){return r.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?xe(this,e,t):(this.__ownerID=t,this._map=e,this)}},{},tr);var Tr=Vr.prototype;Tr[Ae]=Tr.remove,Tr.merge=pr.merge,Tr.mergeWith=pr.mergeWith,Tr.mergeDeep=pr.mergeDeep,Tr.mergeDeepWith=pr.mergeDeepWith,Tr.update=pr.update,Tr.updateIn=pr.updateIn,Tr.cursor=pr.cursor,Tr.withMutations=pr.withMutations,Tr.asMutable=pr.asMutable,Tr.asImmutable=pr.asImmutable,Tr.__deepEquals=pr.__deepEquals;var Fr=function(t,e,r){return this instanceof Gr?(s(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&Qr?Qr:(r=null==r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.length=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new Gr(t,e,r)},Gr=Fr;Ce.createClass(Fr,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},get:function(t,e){return t=C(this,t),this.has(t)?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e){return w(t,e,this.length)?this:(t=S(t,this.length),e=q(e,this.length),t>=e?Qr:new Gr(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;
<add>if(r>=0&&this.length>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,Math.max(0,t))},skip:function(t){return this.slice(Math.max(0,t))},__iterate:function(t,e){for(var r=this.length-1,n=this._step,i=e?this._start+r*n:this._start,u=0;r>=u;u++){if(t(i,u,this)===!1)return u+1;i+=e?-n:n}return u},__iterator:function(t,e){var r=this.length-1,n=this._step,i=e?this._start+r*n:this._start,u=0;return new Ze(function(){var a=i;return i+=e?-n:n,u>r?v():l(t,u++,a)})},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},nr);var Hr=Fr.prototype;Hr.__toJS=Hr.toArray,Hr.first=Ar.first,Hr.last=Ar.last;var Qr=Fr(0,0),Xr=function(t,e){return 0===e&&$r?$r:this instanceof Yr?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new Yr(t,e)},Yr=Xr;Ce.createClass(Xr,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return this.has(t)?this._value:e},contains:function(t){return H(this._value,t)},slice:function(t,e){var r=this.length;return t=0>t?Math.max(0,r+t):Math.min(r,t),e=null==e?r:e>0?Math.min(r,e):Math.max(0,r+e),e>t?new Yr(this._value,e-t):$r},reverse:function(){return this},indexOf:function(t){return H(this._value,t)?0:-1},lastIndexOf:function(t){return H(this._value,t)?this.length:-1},__iterate:function(t){for(var e=0;this.length>e;e++)if(t(this._value,e,this)===!1)return e+1;return e},__iterator:function(t){var e=this,r=0;return new Ze(function(){return e.length>r?l(t,r++,e._value):v()})},__deepEquals:function(t){return H(this._value,t._value)}},{},nr);var Zr=Xr.prototype;Zr.last=Zr.first,Zr.has=Hr.has,Zr.take=Hr.take,Zr.skip=Hr.skip,Zr.__toJS=Hr.__toJS;var $r=new Xr(void 0,0),tn={Sequence:tr,Map:vr,Vector:Or,Set:Pr,OrderedMap:Jr,Record:Vr,Range:Fr,Repeat:Xr,is:H,fromJS:Me};return tn}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t();
<ide>\ No newline at end of file
<ide><path>src/Sequence.js
<ide> function skipFactory(sequence, amount, useKeys) {
<ide> }
<ide> var iterator = amount && sequence.__iterator(type, reverse);
<ide> var skipped = 0;
<add> var iterations = 0;
<ide> return new Iterator(() => {
<ide> while (skipped < amount) {
<ide> skipped++;
<ide> iterator.next();
<ide> }
<del> return iterator.next();
<add> var step = iterator.next();
<add> if (useKeys || type === ITERATE_VALUES) {
<add> return step;
<add> } else if (type === ITERATE_KEYS) {
<add> return iteratorValue(type, iterations++, null, step);
<add> } else {
<add> return iteratorValue(type, iterations++, step.value[1], step);
<add> }
<ide> });
<ide> };
<ide> return skipSequence;
<ide> function skipWhileFactory(sequence, predicate, context, useKeys) {
<ide> }
<ide> var iterator = sequence.__iterator(ITERATE_ENTRIES, reverse);
<ide> var skipping = true;
<add> var iterations = 0;
<ide> return new Iterator(() => {
<ide> var step, k, v;
<ide> do {
<ide> step = iterator.next();
<ide> if (step.done) {
<del> return step;
<add> if (useKeys || type === ITERATE_VALUES) {
<add> return step;
<add> } else if (type === ITERATE_KEYS) {
<add> return iteratorValue(type, iterations++, null, step);
<add> } else {
<add> return iteratorValue(type, iterations++, step.value[1], step);
<add> }
<ide> }
<ide> var entry = step.value;
<ide> k = entry[0];
<ide> function flattenFactory(sequence, useKeys) {
<ide> flatSequence.__iteratorUncached = function(type, reverse) {
<ide> var sequenceIterator = sequence.__iterator(ITERATE_VALUES, reverse);
<ide> var iterator;
<add> var iterations = 0;
<ide> return new Iterator(() => {
<ide> while (true) {
<ide> if (iterator) {
<ide> var step = iterator.next();
<ide> if (!step.done) {
<del> return step;
<add> if (useKeys || type === ITERATE_VALUES) {
<add> return step;
<add> } else if (type === ITERATE_KEYS) {
<add> return iteratorValue(type, iterations++, null, step);
<add> } else {
<add> return iteratorValue(type, iterations++, step.value[1], step);
<add> }
<ide> }
<ide> }
<ide> var sequenceStep = sequenceIterator.next(); | 3 |
Javascript | Javascript | remove unnecessary else | 0f14c53d7217ad65c5dfbb043c96f2683a563540 | <ide><path>src/traversing.js
<ide> jQuery.fn.extend({
<ide> if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
<ide> ret.push( cur );
<ide> break;
<del>
<del> } else {
<del> cur = cur.parentNode;
<ide> }
<add> cur = cur.parentNode;
<ide> }
<ide> }
<ide> | 1 |
Python | Python | reduce test flakiness | 7222b95ea5de9e88fbc288b84d3805efc3f5cb9a | <ide><path>tests/keras/backend/backend_test.py
<ide> def test_random_normal(self):
<ide> mean = 0.
<ide> std = 1.
<ide> for k in BACKENDS:
<del> rand = k.eval(k.random_normal((300, 100), mean=mean, stddev=std))
<del> assert rand.shape == (300, 100)
<add> rand = k.eval(k.random_normal((300, 200), mean=mean, stddev=std))
<add> assert rand.shape == (300, 200)
<ide> assert np.abs(np.mean(rand) - mean) < 0.015
<ide> assert np.abs(np.std(rand) - std) < 0.015
<ide> | 1 |
Javascript | Javascript | add normals + groups | df1be793fd36a31b94931265d7c756a274985a94 | <ide><path>src/geometries/ExtrudeGeometry.js
<ide> function ExtrudeBufferGeometry( shapes, options ) {
<ide>
<ide> this.addShapeList( shapes, options );
<ide>
<del> this.computeFaceNormals();
<add> this.computeVertexNormals();
<ide>
<ide> // can't really use automatic vertex normals
<ide> // as then front and back sides get smoothed too
<ide> ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
<ide> ///// Internal functions
<ide>
<ide> function buildLidFaces() {
<add>
<add> var start = verticesArray.length/3;
<ide>
<ide> if ( bevelEnabled ) {
<ide>
<ide> ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
<ide> }
<ide>
<ide> }
<add>
<add> scope.addGroup( start, verticesArray.length/3 -start, 0);
<ide>
<ide> }
<ide>
<ide> // Create faces for the z-sides of the shape
<ide>
<ide> function buildSideFaces() {
<ide>
<add> var start = verticesArray.length/3;
<ide> var layeroffset = 0;
<ide> sidewalls( contour, layeroffset );
<ide> layeroffset += contour.length;
<ide> ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
<ide> layeroffset += ahole.length;
<ide>
<ide> }
<add>
<add> scope.addGroup( start, verticesArray.length/3 -start, 1);
<ide>
<ide> }
<ide> | 1 |
Javascript | Javascript | add note about self-referencing objects in array | 15149c1da1020f139dfcdd50c8e641f8f43088a4 | <ide><path>src/ng/filter/filter.js
<ide> * Selects a subset of items from `array` and returns it as a new array.
<ide> *
<ide> * @param {Array} array The source array.
<add> * <div class="alert alert-info">
<add> * **Note**: If the array contains objects that reference themselves, filtering is not possible.
<add> * </div>
<ide> * @param {string|Object|function()} expression The predicate to be used for selecting items from
<ide> * `array`.
<ide> * | 1 |
Text | Text | use default exports for reducers | 48bed5c2bc6613870102d9cf9b147a7bacab25ec | <ide><path>docs/basics/ExampleTodoList.md
<ide> const todo = (state, action) => {
<ide> }
<ide> }
<ide>
<del>export const todos = (state = [], action) => {
<add>const todos = (state = [], action) => {
<ide> switch (action.type) {
<ide> case 'ADD_TODO':
<ide> return [
<ide> export const todos = (state = [], action) => {
<ide> return state
<ide> }
<ide> }
<add>
<add>export default todos
<ide> ```
<ide>
<ide> #### `reducers/visibilityFilter.js`
<ide>
<ide> ```js
<del>export const visibilityFilter = (
<add>const visibilityFilter = (
<ide> state = 'SHOW_ALL',
<ide> action
<ide> ) => {
<ide> export const visibilityFilter = (
<ide> return state
<ide> }
<ide> }
<add>
<add>export default visibilityFilter
<ide> ```
<ide>
<ide> #### `reducers/index.js`
<ide>
<ide> ```js
<ide> import { combineReducers } from 'redux'
<del>import { todos } from './todos'
<del>import { visibilityFilter } from './visibilityFilter'
<add>import todos from './todos'
<add>import visibilityFilter from './visibilityFilter'
<ide>
<ide> const todoApp = combineReducers({
<ide> todos, | 1 |
PHP | PHP | shorten code by using the cron method | 0951a30303b6580a2bdcce5df78f6fbbb6497c0f | <ide><path>src/Illuminate/Console/Scheduling/Event.php
<ide> public function cron($expression)
<ide> */
<ide> public function hourly()
<ide> {
<del> $this->expression = '0 * * * * *';
<del>
<del> return $this;
<add> return $this->cron('0 * * * * *');
<ide> }
<ide>
<ide> /**
<ide> public function hourly()
<ide> */
<ide> public function daily()
<ide> {
<del> $this->expression = '0 0 * * * *';
<del>
<del> return $this;
<add> return $this->cron('0 0 * * * *');
<ide> }
<ide>
<ide> /**
<ide> public function dailyAt($time)
<ide> */
<ide> public function twiceDaily()
<ide> {
<del> $this->expression = '0 1,13 * * * *';
<del>
<del> return $this;
<add> return $this->cron('0 1,13 * * * *');
<ide> }
<ide>
<ide> /**
<ide> public function sundays()
<ide> */
<ide> public function weekly()
<ide> {
<del> $this->expression = '0 0 * * 0 *';
<del>
<del> return $this;
<add> return $this->cron('0 0 * * 0 *');
<ide> }
<ide>
<ide> /**
<ide> public function weeklyOn($day, $time = '0:0')
<ide> */
<ide> public function monthly()
<ide> {
<del> $this->expression = '0 0 1 * * *';
<del>
<del> return $this;
<add> return $this->cron('0 0 1 * * *');
<ide> }
<ide>
<ide> /**
<ide> public function monthly()
<ide> */
<ide> public function yearly()
<ide> {
<del> $this->expression = '0 0 1 1 * *';
<del>
<del> return $this;
<add> return $this->cron('0 0 1 1 * *');
<ide> }
<ide>
<ide> /**
<ide> public function yearly()
<ide> */
<ide> public function everyFiveMinutes()
<ide> {
<del> $this->expression = '*/5 * * * * *';
<del>
<del> return $this;
<add> return $this->cron('*/5 * * * * *');
<ide> }
<ide>
<ide> /**
<ide> public function everyFiveMinutes()
<ide> */
<ide> public function everyTenMinutes()
<ide> {
<del> $this->expression = '*/10 * * * * *';
<del>
<del> return $this;
<add> return $this->cron('*/10 * * * * *');
<ide> }
<ide>
<ide> /**
<ide> public function everyTenMinutes()
<ide> */
<ide> public function everyThirtyMinutes()
<ide> {
<del> $this->expression = '0,30 * * * * *';
<del>
<del> return $this;
<add> return $this->cron('0,30 * * * * *');
<ide> }
<ide>
<ide> /**
<ide> protected function spliceIntoPosition($position, $value)
<ide>
<ide> $segments[$position - 1] = $value;
<ide>
<del> $this->expression = implode(' ', $segments);
<del>
<del> return $this;
<add> return $this->cron(implode(' ', $segments));
<ide> }
<ide>
<ide> /** | 1 |
Go | Go | remove use of forked reference package for cli | 0421f5173dbdcb4e4eade5267f274302bb6ab97c | <ide><path>cli/command/container/create.go
<ide> import (
<ide> "io"
<ide> "os"
<ide>
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/api/types/container"
<ide> networktypes "github.com/docker/docker/api/types/network"
<ide> import (
<ide> "github.com/docker/docker/cli/command/image"
<ide> apiclient "github.com/docker/docker/client"
<ide> "github.com/docker/docker/pkg/jsonmessage"
<del> // FIXME migrate to docker/distribution/reference
<del> "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/spf13/cobra"
<ide> "github.com/spf13/pflag"
<ide> func runCreate(dockerCli *command.DockerCli, flags *pflag.FlagSet, opts *createO
<ide> }
<ide>
<ide> func pullImage(ctx context.Context, dockerCli *command.DockerCli, image string, out io.Writer) error {
<del> ref, err := reference.ParseNamed(image)
<add> ref, err := reference.ParseNormalizedNamed(image)
<ide> if err != nil {
<ide> return err
<ide> }
<ide> func newCIDFile(path string) (*cidFile, error) {
<ide> func createContainer(ctx context.Context, dockerCli *command.DockerCli, config *container.Config, hostConfig *container.HostConfig, networkingConfig *networktypes.NetworkingConfig, cidfile, name string) (*container.ContainerCreateCreatedBody, error) {
<ide> stderr := dockerCli.Err()
<ide>
<del> var containerIDFile *cidFile
<add> var (
<add> containerIDFile *cidFile
<add> trustedRef reference.Canonical
<add> namedRef reference.Named
<add> )
<add>
<ide> if cidfile != "" {
<ide> var err error
<ide> if containerIDFile, err = newCIDFile(cidfile); err != nil {
<ide> func createContainer(ctx context.Context, dockerCli *command.DockerCli, config *
<ide> defer containerIDFile.Close()
<ide> }
<ide>
<del> var trustedRef reference.Canonical
<del> _, ref, err := reference.ParseIDOrReference(config.Image)
<add> ref, err := reference.ParseAnyReference(config.Image)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<del> if ref != nil {
<del> ref = reference.WithDefaultTag(ref)
<add> if named, ok := ref.(reference.Named); ok {
<add> if reference.IsNameOnly(named) {
<add> namedRef = reference.EnsureTagged(named)
<add> } else {
<add> namedRef = named
<add> }
<ide>
<del> if ref, ok := ref.(reference.NamedTagged); ok && command.IsTrusted() {
<add> if taggedRef, ok := namedRef.(reference.NamedTagged); ok && command.IsTrusted() {
<ide> var err error
<del> trustedRef, err = image.TrustedReference(ctx, dockerCli, ref, nil)
<add> trustedRef, err = image.TrustedReference(ctx, dockerCli, taggedRef, nil)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<del> config.Image = trustedRef.String()
<add> config.Image = reference.FamiliarString(trustedRef)
<ide> }
<ide> }
<ide>
<ide> func createContainer(ctx context.Context, dockerCli *command.DockerCli, config *
<ide>
<ide> //if image not found try to pull it
<ide> if err != nil {
<del> if apiclient.IsErrImageNotFound(err) && ref != nil {
<del> fmt.Fprintf(stderr, "Unable to find image '%s' locally\n", ref.String())
<add> if apiclient.IsErrImageNotFound(err) && namedRef != nil {
<add> fmt.Fprintf(stderr, "Unable to find image '%s' locally\n", reference.FamiliarString(namedRef))
<ide>
<ide> // we don't want to write to stdout anything apart from container.ID
<ide> if err = pullImage(ctx, dockerCli, config.Image, stderr); err != nil {
<ide> return nil, err
<ide> }
<del> if ref, ok := ref.(reference.NamedTagged); ok && trustedRef != nil {
<del> if err := image.TagTrusted(ctx, dockerCli, trustedRef, ref); err != nil {
<add> if taggedRef, ok := namedRef.(reference.NamedTagged); ok && trustedRef != nil {
<add> if err := image.TagTrusted(ctx, dockerCli, trustedRef, taggedRef); err != nil {
<ide> return nil, err
<ide> }
<ide> }
<ide><path>cli/command/formatter/image.go
<ide> import (
<ide> "fmt"
<ide> "time"
<ide>
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/pkg/stringid"
<del> "github.com/docker/docker/reference"
<ide> units "github.com/docker/go-units"
<ide> )
<ide>
<ide> func imageFormat(ctx ImageContext, images []types.ImageSummary, format func(subC
<ide> repoDigests := map[string][]string{}
<ide>
<ide> for _, refString := range append(image.RepoTags) {
<del> ref, err := reference.ParseNamed(refString)
<add> ref, err := reference.ParseNormalizedNamed(refString)
<ide> if err != nil {
<ide> continue
<ide> }
<ide> if nt, ok := ref.(reference.NamedTagged); ok {
<del> repoTags[ref.Name()] = append(repoTags[ref.Name()], nt.Tag())
<add> familiarRef := reference.FamiliarName(ref)
<add> repoTags[familiarRef] = append(repoTags[familiarRef], nt.Tag())
<ide> }
<ide> }
<ide> for _, refString := range append(image.RepoDigests) {
<del> ref, err := reference.ParseNamed(refString)
<add> ref, err := reference.ParseNormalizedNamed(refString)
<ide> if err != nil {
<ide> continue
<ide> }
<ide> if c, ok := ref.(reference.Canonical); ok {
<del> repoDigests[ref.Name()] = append(repoDigests[ref.Name()], c.Digest().String())
<add> familiarRef := reference.FamiliarName(ref)
<add> repoDigests[familiarRef] = append(repoDigests[familiarRef], c.Digest().String())
<ide> }
<ide> }
<ide>
<ide><path>cli/command/image/build.go
<ide> import (
<ide> "regexp"
<ide> "runtime"
<ide>
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api"
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/api/types/container"
<ide> import (
<ide> "github.com/docker/docker/pkg/progress"
<ide> "github.com/docker/docker/pkg/streamformatter"
<ide> "github.com/docker/docker/pkg/urlutil"
<del> "github.com/docker/docker/reference"
<ide> runconfigopts "github.com/docker/docker/runconfig/opts"
<ide> units "github.com/docker/go-units"
<ide> "github.com/spf13/cobra"
<ide> type translatorFunc func(context.Context, reference.NamedTagged) (reference.Cano
<ide>
<ide> // validateTag checks if the given image name can be resolved.
<ide> func validateTag(rawRepo string) (string, error) {
<del> _, err := reference.ParseNamed(rawRepo)
<add> _, err := reference.ParseNormalizedNamed(rawRepo)
<ide> if err != nil {
<ide> return "", err
<ide> }
<ide> func rewriteDockerfileFrom(ctx context.Context, dockerfile io.Reader, translator
<ide> matches := dockerfileFromLinePattern.FindStringSubmatch(line)
<ide> if matches != nil && matches[1] != api.NoBaseImageSpecifier {
<ide> // Replace the line with a resolved "FROM repo@digest"
<del> ref, err := reference.ParseNamed(matches[1])
<add> var ref reference.Named
<add> ref, err = reference.ParseNormalizedNamed(matches[1])
<ide> if err != nil {
<ide> return nil, nil, err
<ide> }
<del> ref = reference.WithDefaultTag(ref)
<add> if reference.IsNameOnly(ref) {
<add> ref = reference.EnsureTagged(ref)
<add> }
<ide> if ref, ok := ref.(reference.NamedTagged); ok && command.IsTrusted() {
<ide> trustedRef, err := translator(ctx, ref)
<ide> if err != nil {
<ide> return nil, nil, err
<ide> }
<ide>
<del> line = dockerfileFromLinePattern.ReplaceAllLiteralString(line, fmt.Sprintf("FROM %s", trustedRef.String()))
<add> line = dockerfileFromLinePattern.ReplaceAllLiteralString(line, fmt.Sprintf("FROM %s", reference.FamiliarString(trustedRef)))
<ide> resolvedTags = append(resolvedTags, &resolvedTag{
<ide> digestRef: trustedRef,
<ide> tagRef: ref,
<ide><path>cli/command/image/pull.go
<ide> import (
<ide>
<ide> "golang.org/x/net/context"
<ide>
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/cli"
<ide> "github.com/docker/docker/cli/command"
<del> "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/spf13/cobra"
<ide> )
<ide> func NewPullCommand(dockerCli *command.DockerCli) *cobra.Command {
<ide> }
<ide>
<ide> func runPull(dockerCli *command.DockerCli, opts pullOptions) error {
<del> distributionRef, err := reference.ParseNamed(opts.remote)
<add> var distributionRef reference.Named
<add> distributionRef, err := reference.ParseNormalizedNamed(opts.remote)
<ide> if err != nil {
<ide> return err
<ide> }
<ide> func runPull(dockerCli *command.DockerCli, opts pullOptions) error {
<ide> }
<ide>
<ide> if !opts.all && reference.IsNameOnly(distributionRef) {
<del> distributionRef = reference.WithDefaultTag(distributionRef)
<del> fmt.Fprintf(dockerCli.Out(), "Using default tag: %s\n", reference.DefaultTag)
<add> taggedRef := reference.EnsureTagged(distributionRef)
<add> fmt.Fprintf(dockerCli.Out(), "Using default tag: %s\n", taggedRef.Tag())
<add> distributionRef = taggedRef
<ide> }
<ide>
<ide> // Resolve the Repository name from fqn to RepositoryInfo
<ide> func runPull(dockerCli *command.DockerCli, opts pullOptions) error {
<ide> if command.IsTrusted() && !isCanonical {
<ide> err = trustedPull(ctx, dockerCli, repoInfo, distributionRef, authConfig, requestPrivilege)
<ide> } else {
<del> err = imagePullPrivileged(ctx, dockerCli, authConfig, distributionRef.String(), requestPrivilege, opts.all)
<add> err = imagePullPrivileged(ctx, dockerCli, authConfig, reference.FamiliarString(distributionRef), requestPrivilege, opts.all)
<ide> }
<ide> if err != nil {
<ide> if strings.Contains(err.Error(), "target is plugin") {
<ide><path>cli/command/image/push.go
<ide> package image
<ide> import (
<ide> "golang.org/x/net/context"
<ide>
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/cli"
<ide> "github.com/docker/docker/cli/command"
<ide> "github.com/docker/docker/pkg/jsonmessage"
<del> "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/spf13/cobra"
<ide> )
<ide> func NewPushCommand(dockerCli *command.DockerCli) *cobra.Command {
<ide> }
<ide>
<ide> func runPush(dockerCli *command.DockerCli, remote string) error {
<del> ref, err := reference.ParseNamed(remote)
<add> ref, err := reference.ParseNormalizedNamed(remote)
<ide> if err != nil {
<ide> return err
<ide> }
<ide> func runPush(dockerCli *command.DockerCli, remote string) error {
<ide> return trustedPush(ctx, dockerCli, repoInfo, ref, authConfig, requestPrivilege)
<ide> }
<ide>
<del> responseBody, err := imagePushPrivileged(ctx, dockerCli, authConfig, ref.String(), requestPrivilege)
<add> responseBody, err := imagePushPrivileged(ctx, dockerCli, authConfig, ref, requestPrivilege)
<ide> if err != nil {
<ide> return err
<ide> }
<ide><path>cli/command/image/trust.go
<ide> import (
<ide> "sort"
<ide>
<ide> "github.com/Sirupsen/logrus"
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/cli/command"
<ide> "github.com/docker/docker/cli/trust"
<ide> "github.com/docker/docker/pkg/jsonmessage"
<del> "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/docker/notary/client"
<ide> "github.com/docker/notary/tuf/data"
<ide> type target struct {
<ide>
<ide> // trustedPush handles content trust pushing of an image
<ide> func trustedPush(ctx context.Context, cli *command.DockerCli, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig types.AuthConfig, requestPrivilege types.RequestPrivilegeFunc) error {
<del> responseBody, err := imagePushPrivileged(ctx, cli, authConfig, ref.String(), requestPrivilege)
<add> responseBody, err := imagePushPrivileged(ctx, cli, authConfig, ref, requestPrivilege)
<ide> if err != nil {
<ide> return err
<ide> }
<ide> func addTargetToAllSignableRoles(repo *client.NotaryRepository, target *client.T
<ide> }
<ide>
<ide> // imagePushPrivileged push the image
<del>func imagePushPrivileged(ctx context.Context, cli *command.DockerCli, authConfig types.AuthConfig, ref string, requestPrivilege types.RequestPrivilegeFunc) (io.ReadCloser, error) {
<add>func imagePushPrivileged(ctx context.Context, cli *command.DockerCli, authConfig types.AuthConfig, ref reference.Named, requestPrivilege types.RequestPrivilegeFunc) (io.ReadCloser, error) {
<ide> encodedAuth, err := command.EncodeAuthToBase64(authConfig)
<ide> if err != nil {
<ide> return nil, err
<ide> func imagePushPrivileged(ctx context.Context, cli *command.DockerCli, authConfig
<ide> PrivilegeFunc: requestPrivilege,
<ide> }
<ide>
<del> return cli.Client().ImagePush(ctx, ref, options)
<add> return cli.Client().ImagePush(ctx, reference.FamiliarString(ref), options)
<ide> }
<ide>
<ide> // trustedPull handles content trust pulling of an image
<ide> func trustedPull(ctx context.Context, cli *command.DockerCli, repoInfo *registry
<ide> // List all targets
<ide> targets, err := notaryRepo.ListTargets(trust.ReleasesRole, data.CanonicalTargetsRole)
<ide> if err != nil {
<del> return trust.NotaryError(repoInfo.FullName(), err)
<add> return trust.NotaryError(ref.Name(), err)
<ide> }
<ide> for _, tgt := range targets {
<ide> t, err := convertTarget(tgt.Target)
<ide> if err != nil {
<del> fmt.Fprintf(cli.Out(), "Skipping target for %q\n", repoInfo.Name())
<add> fmt.Fprintf(cli.Out(), "Skipping target for %q\n", reference.FamiliarName(ref))
<ide> continue
<ide> }
<ide> // Only list tags in the top level targets role or the releases delegation role - ignore
<ide> func trustedPull(ctx context.Context, cli *command.DockerCli, repoInfo *registry
<ide> refs = append(refs, t)
<ide> }
<ide> if len(refs) == 0 {
<del> return trust.NotaryError(repoInfo.FullName(), fmt.Errorf("No trusted tags for %s", repoInfo.FullName()))
<add> return trust.NotaryError(ref.Name(), fmt.Errorf("No trusted tags for %s", ref.Name()))
<ide> }
<ide> } else {
<ide> t, err := notaryRepo.GetTargetByName(tagged.Tag(), trust.ReleasesRole, data.CanonicalTargetsRole)
<ide> if err != nil {
<del> return trust.NotaryError(repoInfo.FullName(), err)
<add> return trust.NotaryError(ref.Name(), err)
<ide> }
<ide> // Only get the tag if it's in the top level targets role or the releases delegation role
<ide> // ignore it if it's in any other delegation roles
<ide> if t.Role != trust.ReleasesRole && t.Role != data.CanonicalTargetsRole {
<del> return trust.NotaryError(repoInfo.FullName(), fmt.Errorf("No trust data for %s", tagged.Tag()))
<add> return trust.NotaryError(ref.Name(), fmt.Errorf("No trust data for %s", tagged.Tag()))
<ide> }
<ide>
<ide> logrus.Debugf("retrieving target for %s role\n", t.Role)
<ide> func trustedPull(ctx context.Context, cli *command.DockerCli, repoInfo *registry
<ide> if displayTag != "" {
<ide> displayTag = ":" + displayTag
<ide> }
<del> fmt.Fprintf(cli.Out(), "Pull (%d of %d): %s%s@%s\n", i+1, len(refs), repoInfo.Name(), displayTag, r.digest)
<add> fmt.Fprintf(cli.Out(), "Pull (%d of %d): %s%s@%s\n", i+1, len(refs), reference.FamiliarName(ref), displayTag, r.digest)
<ide>
<del> ref, err := reference.WithDigest(reference.TrimNamed(repoInfo), r.digest)
<add> trustedRef, err := reference.WithDigest(reference.TrimNamed(ref), r.digest)
<ide> if err != nil {
<ide> return err
<ide> }
<del> if err := imagePullPrivileged(ctx, cli, authConfig, ref.String(), requestPrivilege, false); err != nil {
<add> if err := imagePullPrivileged(ctx, cli, authConfig, reference.FamiliarString(trustedRef), requestPrivilege, false); err != nil {
<ide> return err
<ide> }
<ide>
<del> tagged, err := reference.WithTag(repoInfo, r.name)
<del> if err != nil {
<del> return err
<del> }
<del> trustedRef, err := reference.WithDigest(reference.TrimNamed(repoInfo), r.digest)
<add> tagged, err := reference.WithTag(reference.TrimNamed(ref), r.name)
<ide> if err != nil {
<ide> return err
<ide> }
<add>
<ide> if err := TagTrusted(ctx, cli, trustedRef, tagged); err != nil {
<ide> return err
<ide> }
<ide> func convertTarget(t client.Target) (target, error) {
<ide>
<ide> // TagTrusted tags a trusted ref
<ide> func TagTrusted(ctx context.Context, cli *command.DockerCli, trustedRef reference.Canonical, ref reference.NamedTagged) error {
<del> fmt.Fprintf(cli.Out(), "Tagging %s as %s\n", trustedRef.String(), ref.String())
<add> // Use familiar references when interacting with client and output
<add> familiarRef := reference.FamiliarString(ref)
<add> trustedFamiliarRef := reference.FamiliarString(trustedRef)
<add>
<add> fmt.Fprintf(cli.Out(), "Tagging %s as %s\n", trustedFamiliarRef, familiarRef)
<ide>
<del> return cli.Client().ImageTag(ctx, trustedRef.String(), ref.String())
<add> return cli.Client().ImageTag(ctx, trustedFamiliarRef, familiarRef)
<ide> }
<ide><path>cli/command/plugin/create.go
<ide> import (
<ide> "path/filepath"
<ide>
<ide> "github.com/Sirupsen/logrus"
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/cli"
<ide> "github.com/docker/docker/cli/command"
<ide> "github.com/docker/docker/pkg/archive"
<del> "github.com/docker/docker/reference"
<ide> "github.com/spf13/cobra"
<ide> "golang.org/x/net/context"
<ide> )
<ide>
<ide> // validateTag checks if the given repoName can be resolved.
<ide> func validateTag(rawRepo string) error {
<del> _, err := reference.ParseNamed(rawRepo)
<add> _, err := reference.ParseNormalizedNamed(rawRepo)
<ide>
<ide> return err
<ide> }
<ide><path>cli/command/plugin/install.go
<ide> import (
<ide> "fmt"
<ide> "strings"
<ide>
<del> distreference "github.com/docker/distribution/reference"
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api/types"
<ide> registrytypes "github.com/docker/docker/api/types/registry"
<ide> "github.com/docker/docker/cli"
<ide> "github.com/docker/docker/cli/command"
<ide> "github.com/docker/docker/cli/command/image"
<ide> "github.com/docker/docker/pkg/jsonmessage"
<del> "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/spf13/cobra"
<ide> "golang.org/x/net/context"
<ide> func newInstallCommand(dockerCli *command.DockerCli) *cobra.Command {
<ide> return cmd
<ide> }
<ide>
<del>func getRepoIndexFromUnnormalizedRef(ref distreference.Named) (*registrytypes.IndexInfo, error) {
<del> named, err := reference.ParseNamed(ref.Name())
<add>func getRepoIndexFromUnnormalizedRef(ref reference.Named) (*registrytypes.IndexInfo, error) {
<add> named, err := reference.ParseNormalizedNamed(ref.Name())
<ide> if err != nil {
<ide> return nil, err
<ide> }
<ide> func newRegistryService() registry.Service {
<ide> }
<ide>
<ide> func runInstall(dockerCli *command.DockerCli, opts pluginOptions) error {
<del> // Parse name using distribution reference package to support name
<del> // containing both tag and digest. Names with both tag and digest
<del> // will be treated by the daemon as a pull by digest with
<del> // an alias for the tag (if no alias is provided).
<del> ref, err := distreference.ParseNamed(opts.name)
<add> // Names with both tag and digest will be treated by the daemon
<add> // as a pull by digest with an alias for the tag
<add> // (if no alias is provided).
<add> ref, err := reference.ParseNormalizedNamed(opts.name)
<ide> if err != nil {
<ide> return err
<ide> }
<ide>
<ide> alias := ""
<ide> if opts.alias != "" {
<del> aref, err := reference.ParseNamed(opts.alias)
<add> aref, err := reference.ParseNormalizedNamed(opts.alias)
<ide> if err != nil {
<ide> return err
<ide> }
<del> aref = reference.WithDefaultTag(aref)
<del> if _, ok := aref.(reference.NamedTagged); !ok {
<add> if _, ok := aref.(reference.Canonical); ok {
<ide> return fmt.Errorf("invalid name: %s", opts.alias)
<ide> }
<del> alias = aref.String()
<add> alias = reference.FamiliarString(reference.EnsureTagged(aref))
<ide> }
<ide> ctx := context.Background()
<ide>
<del> index, err := getRepoIndexFromUnnormalizedRef(ref)
<add> repoInfo, err := registry.ParseRepositoryInfo(ref)
<ide> if err != nil {
<ide> return err
<ide> }
<ide>
<ide> remote := ref.String()
<ide>
<del> _, isCanonical := ref.(distreference.Canonical)
<add> _, isCanonical := ref.(reference.Canonical)
<ide> if command.IsTrusted() && !isCanonical {
<ide> if alias == "" {
<del> alias = ref.String()
<add> alias = reference.FamiliarString(ref)
<ide> }
<del> var nt reference.NamedTagged
<del> named, err := reference.ParseNamed(ref.Name())
<del> if err != nil {
<del> return err
<del> }
<del> if tagged, ok := ref.(distreference.Tagged); ok {
<del> nt, err = reference.WithTag(named, tagged.Tag())
<del> if err != nil {
<del> return err
<del> }
<del> } else {
<del> named = reference.WithDefaultTag(named)
<del> nt = named.(reference.NamedTagged)
<add>
<add> nt, ok := ref.(reference.NamedTagged)
<add> if !ok {
<add> nt = reference.EnsureTagged(ref)
<ide> }
<ide>
<ide> trusted, err := image.TrustedReference(ctx, dockerCli, nt, newRegistryService())
<ide> if err != nil {
<ide> return err
<ide> }
<del> remote = trusted.String()
<add> remote = reference.FamiliarString(trusted)
<ide> }
<ide>
<del> authConfig := command.ResolveAuthConfig(ctx, dockerCli, index)
<add> authConfig := command.ResolveAuthConfig(ctx, dockerCli, repoInfo.Index)
<ide>
<ide> encodedAuth, err := command.EncodeAuthToBase64(authConfig)
<ide> if err != nil {
<ide> return err
<ide> }
<ide>
<del> registryAuthFunc := command.RegistryAuthenticationPrivilegedFunc(dockerCli, index, "plugin install")
<add> registryAuthFunc := command.RegistryAuthenticationPrivilegedFunc(dockerCli, repoInfo.Index, "plugin install")
<ide>
<ide> options := types.PluginInstallOptions{
<ide> RegistryAuth: encodedAuth,
<ide><path>cli/command/plugin/push.go
<ide> import (
<ide>
<ide> "golang.org/x/net/context"
<ide>
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/cli"
<ide> "github.com/docker/docker/cli/command"
<ide> "github.com/docker/docker/cli/command/image"
<ide> "github.com/docker/docker/pkg/jsonmessage"
<del> "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/spf13/cobra"
<ide> )
<ide> func newPushCommand(dockerCli *command.DockerCli) *cobra.Command {
<ide> }
<ide>
<ide> func runPush(dockerCli *command.DockerCli, name string) error {
<del> named, err := reference.ParseNamed(name) // FIXME: validate
<add> named, err := reference.ParseNormalizedNamed(name)
<ide> if err != nil {
<ide> return err
<ide> }
<del> if reference.IsNameOnly(named) {
<del> named = reference.WithDefaultTag(named)
<add> if _, ok := named.(reference.Canonical); ok {
<add> return fmt.Errorf("invalid name: %s", name)
<ide> }
<del> ref, ok := named.(reference.NamedTagged)
<add>
<add> taggedRef, ok := named.(reference.NamedTagged)
<ide> if !ok {
<del> return fmt.Errorf("invalid name: %s", named.String())
<add> taggedRef = reference.EnsureTagged(named)
<ide> }
<ide>
<ide> ctx := context.Background()
<ide> func runPush(dockerCli *command.DockerCli, name string) error {
<ide> if err != nil {
<ide> return err
<ide> }
<del> responseBody, err := dockerCli.Client().PluginPush(ctx, ref.String(), encodedAuth)
<add>
<add> responseBody, err := dockerCli.Client().PluginPush(ctx, reference.FamiliarString(taggedRef), encodedAuth)
<ide> if err != nil {
<ide> return err
<ide> }
<ide><path>cli/command/registry.go
<ide> import (
<ide>
<ide> "golang.org/x/net/context"
<ide>
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api/types"
<ide> registrytypes "github.com/docker/docker/api/types/registry"
<ide> "github.com/docker/docker/pkg/term"
<del> "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> )
<ide>
<ide> func RetrieveAuthTokenFromImage(ctx context.Context, cli *DockerCli, image strin
<ide>
<ide> // resolveAuthConfigFromImage retrieves that AuthConfig using the image string
<ide> func resolveAuthConfigFromImage(ctx context.Context, cli *DockerCli, image string) (types.AuthConfig, error) {
<del> registryRef, err := reference.ParseNamed(image)
<add> registryRef, err := reference.ParseNormalizedNamed(image)
<ide> if err != nil {
<ide> return types.AuthConfig{}, err
<ide> }
<ide><path>cli/command/service/trust.go
<ide> import (
<ide> "fmt"
<ide>
<ide> "github.com/Sirupsen/logrus"
<del> distreference "github.com/docker/distribution/reference"
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api/types/swarm"
<ide> "github.com/docker/docker/cli/command"
<ide> "github.com/docker/docker/cli/trust"
<del> "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/docker/notary/tuf/data"
<ide> "github.com/opencontainers/go-digest"
<ide> func resolveServiceImageDigest(dockerCli *command.DockerCli, service *swarm.Serv
<ide> return nil
<ide> }
<ide>
<del> image := service.TaskTemplate.ContainerSpec.Image
<del>
<del> // We only attempt to resolve the digest if the reference
<del> // could be parsed as a digest reference. Specifying an image ID
<del> // is valid but not resolvable. There is no warning message for
<del> // an image ID because it's valid to use one.
<del> if _, err := digest.Parse(image); err == nil {
<del> return nil
<del> }
<del>
<del> ref, err := reference.ParseNamed(image)
<add> ref, err := reference.ParseAnyReference(service.TaskTemplate.ContainerSpec.Image)
<ide> if err != nil {
<del> return fmt.Errorf("Could not parse image reference %s", service.TaskTemplate.ContainerSpec.Image)
<add> return errors.Wrapf(err, "invalid reference %s", service.TaskTemplate.ContainerSpec.Image)
<ide> }
<del> if _, ok := ref.(reference.Canonical); !ok {
<del> ref = reference.WithDefaultTag(ref)
<ide>
<del> taggedRef, ok := ref.(reference.NamedTagged)
<add> // If reference does not have digest (is not canonical nor image id)
<add> if _, ok := ref.(reference.Digested); !ok {
<add> namedRef, ok := ref.(reference.Named)
<ide> if !ok {
<del> // This should never happen because a reference either
<del> // has a digest, or WithDefaultTag would give it a tag.
<del> return errors.New("Failed to resolve image digest using content trust: reference is missing a tag")
<add> return errors.New("failed to resolve image digest using content trust: reference is not named")
<add>
<ide> }
<ide>
<add> taggedRef := reference.EnsureTagged(namedRef)
<add>
<ide> resolvedImage, err := trustedResolveDigest(context.Background(), dockerCli, taggedRef)
<ide> if err != nil {
<del> return fmt.Errorf("Failed to resolve image digest using content trust: %v", err)
<add> return errors.Wrap(err, "failed to resolve image digest using content trust")
<ide> }
<del> logrus.Debugf("resolved image tag to %s using content trust", resolvedImage.String())
<del> service.TaskTemplate.ContainerSpec.Image = resolvedImage.String()
<add> resolvedFamiliar := reference.FamiliarString(resolvedImage)
<add> logrus.Debugf("resolved image tag to %s using content trust", resolvedFamiliar)
<add> service.TaskTemplate.ContainerSpec.Image = resolvedFamiliar
<ide> }
<add>
<ide> return nil
<ide> }
<ide>
<del>func trustedResolveDigest(ctx context.Context, cli *command.DockerCli, ref reference.NamedTagged) (distreference.Canonical, error) {
<add>func trustedResolveDigest(ctx context.Context, cli *command.DockerCli, ref reference.NamedTagged) (reference.Canonical, error) {
<ide> repoInfo, err := registry.ParseRepositoryInfo(ref)
<ide> if err != nil {
<ide> return nil, err
<ide> func trustedResolveDigest(ctx context.Context, cli *command.DockerCli, ref refer
<ide> // Only get the tag if it's in the top level targets role or the releases delegation role
<ide> // ignore it if it's in any other delegation roles
<ide> if t.Role != trust.ReleasesRole && t.Role != data.CanonicalTargetsRole {
<del> return nil, trust.NotaryError(repoInfo.FullName(), fmt.Errorf("No trust data for %s", ref.String()))
<add> return nil, trust.NotaryError(repoInfo.FullName(), fmt.Errorf("No trust data for %s", reference.FamiliarString(ref)))
<ide> }
<ide>
<ide> logrus.Debugf("retrieving target for %s role\n", t.Role)
<ide> func trustedResolveDigest(ctx context.Context, cli *command.DockerCli, ref refer
<ide>
<ide> dgst := digest.NewDigestFromHex("sha256", hex.EncodeToString(h))
<ide>
<del> // Using distribution reference package to make sure that adding a
<del> // digest does not erase the tag. When the two reference packages
<del> // are unified, this will no longer be an issue.
<del> return distreference.WithDigest(ref, dgst)
<add> // Allow returning canonical reference with tag
<add> return reference.WithDigest(ref, dgst)
<ide> }
<ide><path>distribution/push_v2_test.go
<ide> func TestLayerAlreadyExists(t *testing.T) {
<ide> checkOtherRepositories: true,
<ide> metadata: []metadata.V2Metadata{
<ide> {Digest: digest.Digest("apple"), SourceRepository: "docker.io/library/hello-world"},
<del> {Digest: digest.Digest("orange"), SourceRepository: "docker.io/library/busybox/subapp"},
<add> {Digest: digest.Digest("orange"), SourceRepository: "docker.io/busybox/subapp"},
<ide> {Digest: digest.Digest("pear"), SourceRepository: "docker.io/busybox"},
<ide> {Digest: digest.Digest("plum"), SourceRepository: "busybox"},
<ide> {Digest: digest.Digest("banana"), SourceRepository: "127.0.0.1/busybox"},
<ide><path>integration-cli/docker_cli_build_test.go
<ide> func (s *DockerSuite) TestBuildInvalidTag(c *check.C) {
<ide> name := "abcd:" + stringutils.GenerateRandomAlphaOnlyString(200)
<ide> buildImage(name, withDockerfile("FROM "+minimalBaseImage()+"\nMAINTAINER quux\n")).Assert(c, icmd.Expected{
<ide> ExitCode: 125,
<del> Err: "Error parsing reference",
<add> Err: "invalid reference format",
<ide> })
<ide> }
<ide>
<ide><path>integration-cli/docker_cli_create_test.go
<ide> func (s *DockerSuite) TestCreateByImageID(c *check.C) {
<ide> c.Fatalf("expected non-zero exit code; received %d", exit)
<ide> }
<ide>
<del> if expected := "Error parsing reference"; !strings.Contains(out, expected) {
<add> if expected := "invalid reference format"; !strings.Contains(out, expected) {
<ide> c.Fatalf(`Expected %q in output; got: %s`, expected, out)
<ide> }
<ide>
<ide><path>integration-cli/docker_cli_run_test.go
<ide> func (s *DockerSuite) TestRunInvalidReference(c *check.C) {
<ide> c.Fatalf("expected non-zero exist code; received %d", exit)
<ide> }
<ide>
<del> if !strings.Contains(out, "Error parsing reference") {
<del> c.Fatalf(`Expected "Error parsing reference" in output; got: %s`, out)
<add> if !strings.Contains(out, "invalid reference format") {
<add> c.Fatalf(`Expected "invalid reference format" in output; got: %s`, out)
<ide> }
<ide> }
<ide>
<ide><path>plugin/manager.go
<ide> import (
<ide> "sync"
<ide>
<ide> "github.com/Sirupsen/logrus"
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api/types"
<ide> "github.com/docker/docker/image"
<ide> "github.com/docker/docker/layer"
<ide> "github.com/docker/docker/libcontainerd"
<ide> "github.com/docker/docker/pkg/ioutils"
<ide> "github.com/docker/docker/pkg/mount"
<ide> "github.com/docker/docker/plugin/v2"
<del> "github.com/docker/docker/reference"
<ide> "github.com/docker/docker/registry"
<ide> "github.com/opencontainers/go-digest"
<ide> "github.com/pkg/errors"
<ide><path>reference/reference.go
<ide> package reference
<ide>
<ide> import (
<del> "errors"
<ide> "fmt"
<del> "strings"
<ide>
<ide> distreference "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/pkg/stringid"
<ide> "github.com/opencontainers/go-digest"
<add> "github.com/pkg/errors"
<ide> )
<ide>
<ide> const (
<ide> type Canonical interface {
<ide> // returned.
<ide> // If an error was encountered it is returned, along with a nil Reference.
<ide> func ParseNamed(s string) (Named, error) {
<del> named, err := distreference.ParseNamed(s)
<add> named, err := distreference.ParseNormalizedNamed(s)
<ide> if err != nil {
<del> return nil, fmt.Errorf("Error parsing reference: %q is not a valid repository/tag: %s", s, err)
<add> return nil, errors.Wrapf(err, "failed to parse reference %q", s)
<ide> }
<del> r, err := WithName(named.Name())
<del> if err != nil {
<add> if err := validateName(distreference.FamiliarName(named)); err != nil {
<ide> return nil, err
<ide> }
<add>
<add> // Ensure returned reference cannot have tag and digest
<ide> if canonical, isCanonical := named.(distreference.Canonical); isCanonical {
<del> return WithDigest(r, canonical.Digest())
<add> r, err := distreference.WithDigest(distreference.TrimNamed(named), canonical.Digest())
<add> if err != nil {
<add> return nil, err
<add> }
<add> return &canonicalRef{namedRef{r}}, nil
<ide> }
<ide> if tagged, isTagged := named.(distreference.NamedTagged); isTagged {
<del> return WithTag(r, tagged.Tag())
<add> r, err := distreference.WithTag(distreference.TrimNamed(named), tagged.Tag())
<add> if err != nil {
<add> return nil, err
<add> }
<add> return &taggedRef{namedRef{r}}, nil
<ide> }
<del> return r, nil
<add>
<add> return &namedRef{named}, nil
<ide> }
<ide>
<ide> // TrimNamed removes any tag or digest from the named reference
<ide> func TrimNamed(ref Named) Named {
<ide> // WithName returns a named object representing the given string. If the input
<ide> // is invalid ErrReferenceInvalidFormat will be returned.
<ide> func WithName(name string) (Named, error) {
<del> name, err := normalize(name)
<add> r, err := distreference.ParseNormalizedNamed(name)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<del> if err := validateName(name); err != nil {
<add> if err := validateName(distreference.FamiliarName(r)); err != nil {
<ide> return nil, err
<ide> }
<del> r, err := distreference.WithName(name)
<del> if err != nil {
<del> return nil, err
<add> if !distreference.IsNameOnly(r) {
<add> return nil, distreference.ErrReferenceInvalidFormat
<ide> }
<ide> return &namedRef{r}, nil
<ide> }
<ide> type canonicalRef struct {
<ide> namedRef
<ide> }
<ide>
<add>func (r *namedRef) Name() string {
<add> return distreference.FamiliarName(r.Named)
<add>}
<add>
<add>func (r *namedRef) String() string {
<add> return distreference.FamiliarString(r.Named)
<add>}
<add>
<ide> func (r *namedRef) FullName() string {
<del> hostname, remoteName := splitHostname(r.Name())
<del> return hostname + "/" + remoteName
<add> return r.Named.Name()
<ide> }
<ide> func (r *namedRef) Hostname() string {
<del> hostname, _ := splitHostname(r.Name())
<del> return hostname
<add> return distreference.Domain(r.Named)
<ide> }
<ide> func (r *namedRef) RemoteName() string {
<del> _, remoteName := splitHostname(r.Name())
<del> return remoteName
<add> return distreference.Path(r.Named)
<ide> }
<ide> func (r *taggedRef) Tag() string {
<ide> return r.namedRef.Named.(distreference.NamedTagged).Tag()
<ide> func ParseIDOrReference(idOrRef string) (digest.Digest, Named, error) {
<ide> return "", ref, err
<ide> }
<ide>
<del>// splitHostname splits a repository name to hostname and remotename string.
<del>// If no valid hostname is found, the default hostname is used. Repository name
<del>// needs to be already validated before.
<del>func splitHostname(name string) (hostname, remoteName string) {
<del> i := strings.IndexRune(name, '/')
<del> if i == -1 || (!strings.ContainsAny(name[:i], ".:") && name[:i] != "localhost") {
<del> hostname, remoteName = DefaultHostname, name
<del> } else {
<del> hostname, remoteName = name[:i], name[i+1:]
<del> }
<del> if hostname == LegacyDefaultHostname {
<del> hostname = DefaultHostname
<del> }
<del> if hostname == DefaultHostname && !strings.ContainsRune(remoteName, '/') {
<del> remoteName = DefaultRepoPrefix + remoteName
<del> }
<del> return
<del>}
<del>
<del>// normalize returns a repository name in its normalized form, meaning it
<del>// will not contain default hostname nor library/ prefix for official images.
<del>func normalize(name string) (string, error) {
<del> host, remoteName := splitHostname(name)
<del> if strings.ToLower(remoteName) != remoteName {
<del> return "", errors.New("invalid reference format: repository name must be lowercase")
<del> }
<del> if host == DefaultHostname {
<del> if strings.HasPrefix(remoteName, DefaultRepoPrefix) {
<del> return strings.TrimPrefix(remoteName, DefaultRepoPrefix), nil
<del> }
<del> return remoteName, nil
<del> }
<del> return name, nil
<del>}
<del>
<ide> func validateName(name string) error {
<ide> if err := stringid.ValidateID(name); err == nil {
<ide> return fmt.Errorf("Invalid repository name (%s), cannot specify 64-byte hexadecimal strings", name)
<ide><path>registry/config.go
<ide> package registry
<ide>
<ide> import (
<del> "errors"
<ide> "fmt"
<ide> "net"
<ide> "net/url"
<ide> "strings"
<ide>
<ide> "github.com/Sirupsen/logrus"
<add> "github.com/docker/distribution/reference"
<ide> registrytypes "github.com/docker/docker/api/types/registry"
<ide> "github.com/docker/docker/opts"
<del> "github.com/docker/docker/reference"
<add> forkedref "github.com/docker/docker/reference"
<add> "github.com/pkg/errors"
<ide> "github.com/spf13/pflag"
<ide> )
<ide>
<ide> func ValidateMirror(val string) (string, error) {
<ide>
<ide> // ValidateIndexName validates an index name.
<ide> func ValidateIndexName(val string) (string, error) {
<del> if val == reference.LegacyDefaultHostname {
<del> val = reference.DefaultHostname
<add> if val == forkedref.LegacyDefaultHostname {
<add> val = forkedref.DefaultHostname
<ide> }
<ide> if strings.HasPrefix(val, "-") || strings.HasSuffix(val, "-") {
<ide> return "", fmt.Errorf("Invalid index name (%s). Cannot begin or end with a hyphen.", val)
<ide> func GetAuthConfigKey(index *registrytypes.IndexInfo) string {
<ide>
<ide> // newRepositoryInfo validates and breaks down a repository name into a RepositoryInfo
<ide> func newRepositoryInfo(config *serviceConfig, name reference.Named) (*RepositoryInfo, error) {
<del> index, err := newIndexInfo(config, name.Hostname())
<add> index, err := newIndexInfo(config, reference.Domain(name))
<add> if err != nil {
<add> return nil, err
<add> }
<add> official := !strings.ContainsRune(reference.FamiliarName(name), '/')
<add>
<add> // TODO: remove used of forked reference package
<add> nameref, err := forkedref.ParseNamed(name.String())
<ide> if err != nil {
<ide> return nil, err
<ide> }
<del> official := !strings.ContainsRune(name.Name(), '/')
<ide> return &RepositoryInfo{
<del> Named: name,
<add> Named: nameref,
<ide> Index: index,
<ide> Official: official,
<ide> }, nil
<ide><path>registry/registry_test.go
<ide> import (
<ide> "strings"
<ide> "testing"
<ide>
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/distribution/registry/client/transport"
<ide> "github.com/docker/docker/api/types"
<ide> registrytypes "github.com/docker/docker/api/types/registry"
<del> "github.com/docker/docker/reference"
<add> forkedref "github.com/docker/docker/reference"
<ide> )
<ide>
<ide> var (
<ide> func TestGetRemoteImageLayer(t *testing.T) {
<ide>
<ide> func TestGetRemoteTag(t *testing.T) {
<ide> r := spawnTestRegistrySession(t)
<del> repoRef, err := reference.ParseNamed(REPO)
<add> repoRef, err := forkedref.ParseNamed(REPO)
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> func TestGetRemoteTag(t *testing.T) {
<ide> }
<ide> assertEqual(t, tag, imageID, "Expected tag test to map to "+imageID)
<ide>
<del> bazRef, err := reference.ParseNamed("foo42/baz")
<add> bazRef, err := forkedref.ParseNamed("foo42/baz")
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> func TestGetRemoteTag(t *testing.T) {
<ide>
<ide> func TestGetRemoteTags(t *testing.T) {
<ide> r := spawnTestRegistrySession(t)
<del> repoRef, err := reference.ParseNamed(REPO)
<add> repoRef, err := forkedref.ParseNamed(REPO)
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> func TestGetRemoteTags(t *testing.T) {
<ide> assertEqual(t, tags["latest"], imageID, "Expected tag latest to map to "+imageID)
<ide> assertEqual(t, tags["test"], imageID, "Expected tag test to map to "+imageID)
<ide>
<del> bazRef, err := reference.ParseNamed("foo42/baz")
<add> bazRef, err := forkedref.ParseNamed("foo42/baz")
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> func TestGetRepositoryData(t *testing.T) {
<ide> t.Fatal(err)
<ide> }
<ide> host := "http://" + parsedURL.Host + "/v1/"
<del> repoRef, err := reference.ParseNamed(REPO)
<add> repoRef, err := forkedref.ParseNamed(REPO)
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> func TestParseRepositoryInfo(t *testing.T) {
<ide> }
<ide>
<ide> for reposName, expectedRepoInfo := range expectedRepoInfos {
<del> named, err := reference.WithName(reposName)
<add> named, err := reference.ParseNormalizedNamed(reposName)
<ide> if err != nil {
<ide> t.Error(err)
<ide> }
<ide> func TestMirrorEndpointLookup(t *testing.T) {
<ide> if err != nil {
<ide> t.Error(err)
<ide> }
<del> pushAPIEndpoints, err := s.LookupPushEndpoints(imageName.Hostname())
<add> pushAPIEndpoints, err := s.LookupPushEndpoints(reference.Domain(imageName))
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> if containsMirror(pushAPIEndpoints) {
<ide> t.Fatal("Push endpoint should not contain mirror")
<ide> }
<ide>
<del> pullAPIEndpoints, err := s.LookupPullEndpoints(imageName.Hostname())
<add> pullAPIEndpoints, err := s.LookupPullEndpoints(reference.Domain(imageName))
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> func TestMirrorEndpointLookup(t *testing.T) {
<ide>
<ide> func TestPushRegistryTag(t *testing.T) {
<ide> r := spawnTestRegistrySession(t)
<del> repoRef, err := reference.ParseNamed(REPO)
<add> repoRef, err := forkedref.ParseNamed(REPO)
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> func TestPushImageJSONIndex(t *testing.T) {
<ide> Checksum: "sha256:bea7bf2e4bacd479344b737328db47b18880d09096e6674165533aa994f5e9f2",
<ide> },
<ide> }
<del> repoRef, err := reference.ParseNamed(REPO)
<add> repoRef, err := forkedref.ParseNamed(REPO)
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> }
<ide><path>registry/service.go
<ide> import (
<ide> "golang.org/x/net/context"
<ide>
<ide> "github.com/Sirupsen/logrus"
<add> "github.com/docker/distribution/reference"
<ide> "github.com/docker/distribution/registry/client/auth"
<ide> "github.com/docker/docker/api/types"
<ide> registrytypes "github.com/docker/docker/api/types/registry"
<del> "github.com/docker/docker/reference"
<ide> )
<ide>
<ide> const ( | 20 |
Text | Text | replace broken image link | 55670f6e87c21473ef4ae711b8c06583ee56638d | <ide><path>guide/english/typography/anatomy-of-letterforms/index.md
<ide> A typeface refers to a group of characters, such as letters, numbers, and punctu
<ide> ## Font
<ide> Fonts refer to the means by which typefaces are displayed or presented. Helvetica in movable type is a font, as is a TrueType font file.
<ide>
<del>
<add>
<ide>
<ide> ## Type Families
<ide> The different options available within a font make up a type family. Many fonts are at a minimum available in roman, bold and italic. Other families are much larger, such as Helvetica Neue, which is available in options such Condensed Bold, Condensed Black, UltraLight, UltraLight Italic, Light, Light Italic, Regular, etc. | 1 |
Ruby | Ruby | remove useless conditional | e6425f6ecad2a1b771455f73ada9d15f72a687eb | <ide><path>actionpack/lib/abstract_controller/rendering.rb
<ide> def _set_content_type(type) # :nodoc:
<ide> def _normalize_render(*args, &block)
<ide> options = _normalize_args(*args, &block)
<ide> #TODO: remove defined? when we restore AP <=> AV dependency
<del> if defined?(request) && request && request.variant.present?
<add> if defined?(request) && request.variant.present?
<ide> options[:variant] = request.variant
<ide> end
<ide> _normalize_options(options) | 1 |
Javascript | Javascript | add test cases for paramencoding 'explicit' | 76cffddf82603a6060840d5c20064b7aa0a5e9dd | <ide><path>test/parallel/test-crypto-keygen.js
<ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
<ide> testSignVerify(publicKey, privateKey);
<ide> }));
<ide>
<add> // Test async elliptic curve key generation, e.g. for ECDSA, with a SEC1
<add> // private key with paramEncoding explicit.
<add> generateKeyPair('ec', {
<add> namedCurve: 'prime256v1',
<add> paramEncoding: 'explicit',
<add> publicKeyEncoding: {
<add> type: 'spki',
<add> format: 'pem'
<add> },
<add> privateKeyEncoding: {
<add> type: 'sec1',
<add> format: 'pem'
<add> }
<add> }, common.mustCall((err, publicKey, privateKey) => {
<add> assert.ifError(err);
<add>
<add> assert.strictEqual(typeof publicKey, 'string');
<add> assert(spkiExp.test(publicKey));
<add> assert.strictEqual(typeof privateKey, 'string');
<add> assert(sec1Exp.test(privateKey));
<add>
<add> testSignVerify(publicKey, privateKey);
<add> }));
<add>
<ide> // Do the same with an encrypted private key.
<ide> generateKeyPair('ec', {
<ide> namedCurve: 'prime256v1',
<ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
<ide>
<ide> testSignVerify(publicKey, { key: privateKey, passphrase: 'secret' });
<ide> }));
<add>
<add> // Do the same with an encrypted private key with paramEncoding explicit.
<add> generateKeyPair('ec', {
<add> namedCurve: 'prime256v1',
<add> paramEncoding: 'explicit',
<add> publicKeyEncoding: {
<add> type: 'spki',
<add> format: 'pem'
<add> },
<add> privateKeyEncoding: {
<add> type: 'sec1',
<add> format: 'pem',
<add> cipher: 'aes-128-cbc',
<add> passphrase: 'secret'
<add> }
<add> }, common.mustCall((err, publicKey, privateKey) => {
<add> assert.ifError(err);
<add>
<add> assert.strictEqual(typeof publicKey, 'string');
<add> assert(spkiExp.test(publicKey));
<add> assert.strictEqual(typeof privateKey, 'string');
<add> assert(sec1EncExp('AES-128-CBC').test(privateKey));
<add>
<add> // Since the private key is encrypted, signing shouldn't work anymore.
<add> common.expectsError(() => testSignVerify(publicKey, privateKey), {
<add> type: TypeError,
<add> code: 'ERR_MISSING_PASSPHRASE',
<add> message: 'Passphrase required for encrypted key'
<add> });
<add>
<add> testSignVerify(publicKey, { key: privateKey, passphrase: 'secret' });
<add> }));
<ide> }
<ide>
<ide> {
<ide> const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
<ide> passphrase: 'top secret'
<ide> });
<ide> }));
<add>
<add> // Test async elliptic curve key generation, e.g. for ECDSA, with an encrypted
<add> // private key with paramEncoding explicit.
<add> generateKeyPair('ec', {
<add> namedCurve: 'P-256',
<add> paramEncoding: 'explicit',
<add> publicKeyEncoding: {
<add> type: 'spki',
<add> format: 'pem'
<add> },
<add> privateKeyEncoding: {
<add> type: 'pkcs8',
<add> format: 'pem',
<add> cipher: 'aes-128-cbc',
<add> passphrase: 'top secret'
<add> }
<add> }, common.mustCall((err, publicKey, privateKey) => {
<add> assert.ifError(err);
<add>
<add> assert.strictEqual(typeof publicKey, 'string');
<add> assert(spkiExp.test(publicKey));
<add> assert.strictEqual(typeof privateKey, 'string');
<add> assert(pkcs8EncExp.test(privateKey));
<add>
<add> // Since the private key is encrypted, signing shouldn't work anymore.
<add> common.expectsError(() => testSignVerify(publicKey, privateKey), {
<add> type: TypeError,
<add> code: 'ERR_MISSING_PASSPHRASE',
<add> message: 'Passphrase required for encrypted key'
<add> });
<add>
<add> testSignVerify(publicKey, {
<add> key: privateKey,
<add> passphrase: 'top secret'
<add> });
<add> }));
<ide> }
<ide>
<ide> // Test invalid parameter encoding. | 1 |
Ruby | Ruby | simplify the implementation of custom serialziers | ec686a471e0a54194fc9ec72e639785606597704 | <ide><path>activejob/lib/active_job/serializers.rb
<ide> module Serializers
<ide> autoload :ObjectSerializer
<ide> autoload :StandardTypeSerializer
<ide>
<del> included do
<del> class_attribute :_additional_serializers, instance_accessor: false, instance_predicate: false
<del> self._additional_serializers = []
<del> end
<add> mattr_accessor :_additional_serializers
<add> self._additional_serializers = []
<add>
<add> class << self
<add> # Returns serialized representative of the passed object.
<add> # Will look up through all known serializers.
<add> # Raises `ActiveJob::SerializationError` if it can't find a proper serializer.
<add> def serialize(argument)
<add> serializer = serializers.detect { |s| s.serialize?(argument) }
<add> raise SerializationError.new("Unsupported argument type: #{argument.class.name}") unless serializer
<add> serializer.serialize(argument)
<add> end
<add>
<add> # Returns deserialized object.
<add> # Will look up through all known serializers.
<add> # If no serializers found will raise `ArgumentError`
<add> def deserialize(argument)
<add> serializer = serializers.detect { |s| s.deserialize?(argument) }
<add> raise ArgumentError, "Can only deserialize primitive arguments: #{argument.inspect}" unless serializer
<add> serializer.deserialize(argument)
<add> end
<ide>
<del> # Includes the method to list known serializers and to add new ones
<del> module ClassMethods
<ide> # Returns list of known serializers
<ide> def serializers
<del> self._additional_serializers + ActiveJob::Serializers::SERIALIZERS
<add> self._additional_serializers
<ide> end
<ide>
<ide> # Adds a new serializer to a list of known serializers
<ide> def check_duplicate_serializer_keys!(serializers)
<ide> end
<ide> end
<ide>
<del> # :nodoc:
<del> SERIALIZERS = [
<del> ::ActiveJob::Serializers::GlobalIDSerializer,
<del> ::ActiveJob::Serializers::StandardTypeSerializer,
<del> ::ActiveJob::Serializers::HashWithIndifferentAccessSerializer,
<del> ::ActiveJob::Serializers::HashSerializer,
<del> ::ActiveJob::Serializers::ArraySerializer
<del> ].freeze
<del>
<del> class << self
<del> # Returns serialized representative of the passed object.
<del> # Will look up through all known serializers.
<del> # Raises `ActiveJob::SerializationError` if it can't find a proper serializer.
<del> def serialize(argument)
<del> serializer = ::ActiveJob::Base.serializers.detect { |s| s.serialize?(argument) }
<del> raise SerializationError.new("Unsupported argument type: #{argument.class.name}") unless serializer
<del> serializer.serialize(argument)
<del> end
<del>
<del> # Returns deserialized object.
<del> # Will look up through all known serializers.
<del> # If no serializers found will raise `ArgumentError`
<del> def deserialize(argument)
<del> serializer = ::ActiveJob::Base.serializers.detect { |s| s.deserialize?(argument) }
<del> raise ArgumentError, "Can only deserialize primitive arguments: #{argument.inspect}" unless serializer
<del> serializer.deserialize(argument)
<del> end
<del> end
<add> add_serializers GlobalIDSerializer,
<add> StandardTypeSerializer,
<add> HashWithIndifferentAccessSerializer,
<add> HashSerializer,
<add> ArraySerializer
<ide> end
<ide> end
<ide><path>activejob/lib/active_job/serializers/hash_serializer.rb
<ide> def serialize_hash(hash)
<ide> def serialize_hash_key(key)
<ide> raise SerializationError.new("Only string and symbol hash keys may be serialized as job arguments, but #{key.inspect} is a #{key.class}") unless [String, Symbol].include?(key.class)
<ide>
<del> raise SerializationError.new("Can't serialize a Hash with reserved key #{key.inspect}") if ActiveJob::Base.reserved_serializers_keys.include?(key.to_s)
<add> raise SerializationError.new("Can't serialize a Hash with reserved key #{key.inspect}") if ActiveJob::Serializers.reserved_serializers_keys.include?(key.to_s)
<ide>
<ide> key.to_s
<ide> end
<ide><path>activejob/test/cases/serializers_test.rb
<ide> def klass
<ide>
<ide> setup do
<ide> @value_object = DummyValueObject.new 123
<del> ActiveJob::Base._additional_serializers = []
<add> @original_serializers = ActiveJob::Serializers.serializers
<add> end
<add>
<add> teardown do
<add> ActiveJob::Serializers._additional_serializers = @original_serializers
<ide> end
<ide>
<ide> test "can't serialize unknown object" do
<ide> def klass
<ide> end
<ide>
<ide> test "adds new serializer" do
<del> ActiveJob::Base.add_serializers DummySerializer
<del> assert ActiveJob::Base.serializers.include?(DummySerializer)
<add> ActiveJob::Serializers.add_serializers DummySerializer
<add> assert ActiveJob::Serializers.serializers.include?(DummySerializer)
<ide> end
<ide>
<ide> test "can't add serializer with the same key twice" do
<del> ActiveJob::Base.add_serializers DummySerializer
<add> ActiveJob::Serializers.add_serializers DummySerializer
<ide> assert_raises ArgumentError do
<del> ActiveJob::Base.add_serializers DummySerializer
<add> ActiveJob::Serializers.add_serializers DummySerializer
<ide> end
<ide> end
<ide> end | 3 |
PHP | PHP | add typehints to testsuite/fixture & stub | adac03b6ec0c37955b56c95e86b2e7acb3af5070 | <ide><path>src/TestSuite/Fixture/FixtureInjector.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide> public function __construct(FixtureManager $manager)
<ide> * @param \PHPUnit\Framework\TestSuite $suite The test suite
<ide> * @return void
<ide> */
<del> public function startTestSuite(TestSuite $suite)
<add> public function startTestSuite(TestSuite $suite): void
<ide> {
<ide> if (empty($this->_first)) {
<ide> $this->_first = $suite;
<ide> public function startTestSuite(TestSuite $suite)
<ide> * @param \PHPUnit\Framework\TestSuite $suite The test suite
<ide> * @return void
<ide> */
<del> public function endTestSuite(TestSuite $suite)
<add> public function endTestSuite(TestSuite $suite): void
<ide> {
<ide> if ($this->_first === $suite) {
<ide> $this->_fixtureManager->shutDown();
<ide> public function endTestSuite(TestSuite $suite)
<ide> * @param \PHPUnit\Framework\Test $test The test case
<ide> * @return void
<ide> */
<del> public function startTest(Test $test)
<add> public function startTest(Test $test): void
<ide> {
<ide> $test->fixtureManager = $this->_fixtureManager;
<ide> if ($test instanceof TestCase) {
<ide> public function startTest(Test $test)
<ide> * @param float $time current time
<ide> * @return void
<ide> */
<del> public function endTest(Test $test, $time)
<add> public function endTest(Test $test, $time): void
<ide> {
<ide> if ($test instanceof TestCase) {
<ide> $this->_fixtureManager->unload($test);
<ide><path>src/TestSuite/Fixture/FixtureManager.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide> class FixtureManager
<ide> * @param bool $debug Whether or not fixture debug mode is enabled.
<ide> * @return void
<ide> */
<del> public function setDebug($debug)
<add> public function setDebug(bool $debug): void
<ide> {
<ide> $this->_debug = $debug;
<ide> }
<ide> public function setDebug($debug)
<ide> * @param \Cake\TestSuite\TestCase $test The test case to inspect.
<ide> * @return void
<ide> */
<del> public function fixturize($test)
<add> public function fixturize(TestCase $test): void
<ide> {
<ide> $this->_initDb();
<ide> if (empty($test->fixtures) || !empty($this->_processed[get_class($test)])) {
<ide> public function fixturize($test)
<ide> *
<ide> * @return array
<ide> */
<del> public function loaded()
<add> public function loaded(): array
<ide> {
<ide> return $this->_loaded;
<ide> }
<ide> public function loaded()
<ide> *
<ide> * @return void
<ide> */
<del> protected function _aliasConnections()
<add> protected function _aliasConnections(): void
<ide> {
<ide> $connections = ConnectionManager::configured();
<ide> ConnectionManager::alias('test', 'default');
<ide> protected function _aliasConnections()
<ide> *
<ide> * @return void
<ide> */
<del> protected function _initDb()
<add> protected function _initDb(): void
<ide> {
<ide> if ($this->_initialized) {
<ide> return;
<ide> protected function _initDb()
<ide> * @return void
<ide> * @throws \UnexpectedValueException when a referenced fixture does not exist.
<ide> */
<del> protected function _loadFixtures($test)
<add> protected function _loadFixtures(TestCase $test): void
<ide> {
<ide> if (empty($test->fixtures)) {
<ide> return;
<ide> protected function _loadFixtures($test)
<ide> * @param bool $drop whether drop the fixture if it is already created or not
<ide> * @return void
<ide> */
<del> protected function _setupTable($fixture, $db, array $sources, $drop = true)
<add> protected function _setupTable(FixtureInterface $fixture, Connection $db, array $sources, bool $drop = true): void
<ide> {
<ide> $configName = $db->configName();
<ide> $isFixtureSetup = $this->isFixtureSetup($configName, $fixture);
<ide> protected function _setupTable($fixture, $db, array $sources, $drop = true)
<ide> * @return void
<ide> * @throws \Cake\Core\Exception\Exception When fixture records cannot be inserted.
<ide> */
<del> public function load($test)
<add> public function load(TestCase $test): void
<ide> {
<ide> if (empty($test->fixtures)) {
<ide> return;
<ide> public function load($test)
<ide> }
<ide>
<ide> try {
<del> $createTables = function ($db, $fixtures) use ($test) {
<add> $createTables = function ($db, $fixtures) use ($test): void {
<ide> $tables = $db->getSchemaCollection()->listTables();
<ide> $configName = $db->configName();
<ide> if (!isset($this->_insertionMap[$configName])) {
<ide> public function load($test)
<ide> $this->_runOperation($fixtures, $createTables);
<ide>
<ide> // Use a separate transaction because of postgres.
<del> $insert = function ($db, $fixtures) use ($test) {
<add> $insert = function ($db, $fixtures) use ($test): void {
<ide> foreach ($fixtures as $fixture) {
<ide> try {
<ide> $fixture->insert($db);
<ide> public function load($test)
<ide> * @param callable $operation The operation to run on each connection + fixture set.
<ide> * @return void
<ide> */
<del> protected function _runOperation($fixtures, $operation)
<add> protected function _runOperation(array $fixtures, callable $operation): void
<ide> {
<ide> $dbs = $this->_fixtureConnections($fixtures);
<ide> foreach ($dbs as $connection => $fixtures) {
<ide> protected function _runOperation($fixtures, $operation)
<ide> if ($logQueries && !$this->_debug) {
<ide> $db->enableQueryLogging(false);
<ide> }
<del> $db->transactional(function ($db) use ($fixtures, $operation) {
<del> $db->disableConstraints(function ($db) use ($fixtures, $operation) {
<add> $db->transactional(function ($db) use ($fixtures, $operation): void {
<add> $db->disableConstraints(function ($db) use ($fixtures, $operation): void {
<ide> $operation($db, $fixtures);
<ide> });
<ide> });
<ide> protected function _runOperation($fixtures, $operation)
<ide> * @param array $fixtures The array of fixtures a list of connections is needed from.
<ide> * @return array An array of connection names.
<ide> */
<del> protected function _fixtureConnections($fixtures)
<add> protected function _fixtureConnections(array $fixtures): array
<ide> {
<ide> $dbs = [];
<ide> foreach ($fixtures as $f) {
<ide> protected function _fixtureConnections($fixtures)
<ide> * @param \Cake\TestSuite\TestCase $test The test to inspect for fixture unloading.
<ide> * @return void
<ide> */
<del> public function unload($test)
<add> public function unload(TestCase $test): void
<ide> {
<ide> if (empty($test->fixtures)) {
<ide> return;
<ide> }
<del> $truncate = function ($db, $fixtures) {
<add> $truncate = function ($db, $fixtures): void {
<ide> $configName = $db->configName();
<ide>
<ide> foreach ($fixtures as $name => $fixture) {
<ide> public function unload($test)
<ide> * @return void
<ide> * @throws \UnexpectedValueException if $name is not a previously loaded class
<ide> */
<del> public function loadSingle($name, $db = null, $dropTables = true)
<add> public function loadSingle(string $name, ?ConnectionInterface $db = null, bool $dropTables = true): void
<ide> {
<ide> if (!isset($this->_fixtureMap[$name])) {
<ide> throw new UnexpectedValueException(sprintf('Referenced fixture class %s not found', $name));
<ide> public function loadSingle($name, $db = null, $dropTables = true)
<ide> *
<ide> * @return void
<ide> */
<del> public function shutDown()
<add> public function shutDown(): void
<ide> {
<del> $shutdown = function ($db, $fixtures) {
<add> $shutdown = function ($db, $fixtures): void {
<ide> $connection = $db->configName();
<ide> foreach ($fixtures as $fixture) {
<ide> if ($this->isFixtureSetup($connection, $fixture)) {
<ide> public function shutDown()
<ide> * @param \Cake\Datasource\FixtureInterface $fixture The fixture to check.
<ide> * @return bool
<ide> */
<del> public function isFixtureSetup($connection, $fixture)
<add> public function isFixtureSetup(string $connection, FixtureInterface $fixture): bool
<ide> {
<ide> return isset($this->_insertionMap[$connection]) && in_array($fixture, $this->_insertionMap[$connection]);
<ide> }
<ide><path>src/TestSuite/Fixture/TestFixture.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide> public function sourceName(): string
<ide> * @return void
<ide> * @throws \Cake\ORM\Exception\MissingTableClassException When importing from a table that does not exist.
<ide> */
<del> public function init()
<add> public function init(): void
<ide> {
<ide> if ($this->table === null) {
<ide> $this->table = $this->_tableFromClass();
<ide> public function init()
<ide> *
<ide> * @return string
<ide> */
<del> protected function _tableFromClass()
<add> protected function _tableFromClass(): string
<ide> {
<ide> list(, $class) = namespaceSplit(get_class($this));
<ide> preg_match('/^(.*)Fixture$/', $class, $matches);
<ide> protected function _tableFromClass()
<ide> *
<ide> * @return void
<ide> */
<del> protected function _schemaFromFields()
<add> protected function _schemaFromFields(): void
<ide> {
<ide> $connection = ConnectionManager::get($this->connection());
<ide> $this->_schema = new TableSchema($this->table);
<ide> protected function _schemaFromFields()
<ide> * @return void
<ide> * @throws \Cake\Core\Exception\Exception when trying to import from an empty table.
<ide> */
<del> protected function _schemaFromImport()
<add> protected function _schemaFromImport(): void
<ide> {
<ide> if (!is_array($this->import)) {
<ide> return;
<ide> protected function _schemaFromImport()
<ide> * @return void
<ide> * @throws \Cake\Core\Exception\Exception when trying to reflect a table that does not exist
<ide> */
<del> protected function _schemaFromReflection()
<add> protected function _schemaFromReflection(): void
<ide> {
<ide> $db = ConnectionManager::get($this->connection());
<ide> $schemaCollection = $db->getSchemaCollection();
<ide> public function dropConstraints(ConnectionInterface $db): bool
<ide> *
<ide> * @return array
<ide> */
<del> protected function _getRecords()
<add> protected function _getRecords(): array
<ide> {
<ide> $fields = $values = $types = [];
<ide> $columns = $this->_schema->columns();
<ide><path>src/TestSuite/Stub/ConsoleOutput.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<ide> class ConsoleOutput extends ConsoleOutputBase
<ide> * @param int $newlines Number of newlines to append
<ide> * @return void
<ide> */
<del> public function write($message, int $newlines = 1)
<add> public function write($message, int $newlines = 1): void
<ide> {
<ide> foreach ((array)$message as $line) {
<ide> $this->_out[] = $line;
<ide><path>src/TestSuite/Stub/TestExceptionRenderer.php
<ide> <?php
<add>declare(strict_types=1);
<ide> /**
<ide> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<ide> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) | 5 |
PHP | PHP | fix null name | 05dd0e064312bd6e1e193dde7309c363a35ec92d | <ide><path>src/Illuminate/Mail/Message.php
<ide> protected function addAddresses($address, $name, $type)
<ide> if (is_array($address)) {
<ide> $type = lcfirst($type);
<ide>
<del> $addresses = collect($address)->map(function (string|array $address, $key) {
<add> $addresses = collect($address)->map(function ($address, $key) {
<ide> if (is_string($key) && is_string($address)) {
<ide> return new Address($key, $address);
<ide> }
<ide> protected function addAddresses($address, $name, $type)
<ide> return new Address($address['email'] ?? $address['address'], $address['name'] ?? null);
<ide> }
<ide>
<add> if (is_null($address)) {
<add> return new Address($key);
<add> }
<add>
<ide> return $address;
<ide> })->all();
<ide> | 1 |
Text | Text | add link to angular material to resources | e57699d040b6fa0204358fc65e2afb043a0932c5 | <ide><path>guide/english/angular/angular-resources/index.md
<ide> A collection of helpful Angular resources
<ide>
<ide> ### Specific-topic Pages
<ide>
<add>* <a href='https://material.angular.io/' target='_blank' rel='nofollow'>Angular Material</a> - Official Library of Angular Components Implementing Material Design
<ide> * <a href='http://www.sitepoint.com/practical-guide-angularjs-directives/' target='_blank' rel='nofollow'>Directives</a> - Excellent guide going into detail on Angular Directives (Part 1)
<ide>
<ide> | 1 |
Javascript | Javascript | provide module when using module.hot | f77014316415779a1a58c6c55501a526f3d36286 | <ide><path>lib/HotModuleReplacementPlugin.js
<ide> const JavascriptParser = require("./JavascriptParser");
<ide> const {
<ide> evaluateToIdentifier,
<ide> evaluateToString,
<del> skipTraversal,
<ide> toConstantDependency
<ide> } = require("./JavascriptParserHelpers");
<ide> const MainTemplate = require("./MainTemplate");
<ide> const NormalModule = require("./NormalModule");
<ide> const NullFactory = require("./NullFactory");
<ide> const RuntimeGlobals = require("./RuntimeGlobals");
<ide> const Template = require("./Template");
<del>const ConstDependency = require("./dependencies/ConstDependency");
<ide> const ModuleHotAcceptDependency = require("./dependencies/ModuleHotAcceptDependency");
<ide> const ModuleHotDeclineDependency = require("./dependencies/ModuleHotDeclineDependency");
<add>const ModuleHotDependency = require("./dependencies/ModuleHotDependency");
<ide> const { find } = require("./util/SetHelpers");
<ide> const { compareModulesById } = require("./util/comparators");
<ide>
<ide> class HotModuleReplacementPlugin {
<ide> if (!parser.state.compilation.hotUpdateChunkTemplate) {
<ide> return false;
<ide> }
<add> const dep = new ModuleHotDependency(expr.callee.range, "accept");
<add> dep.loc = expr.loc;
<add> parser.state.module.addDependency(dep);
<ide> if (expr.arguments.length >= 1) {
<ide> const arg = parser.evaluateExpression(expr.arguments[0]);
<ide> let params = [];
<ide> class HotModuleReplacementPlugin {
<ide> }
<ide> }
<ide> }
<add> return true;
<ide> });
<ide> parser.hooks.call
<ide> .for("module.hot.decline")
<ide> .tap("HotModuleReplacementPlugin", expr => {
<ide> if (!parser.state.compilation.hotUpdateChunkTemplate) {
<ide> return false;
<ide> }
<add> const dep = new ModuleHotDependency(expr.callee.range, "decline");
<add> dep.loc = expr.loc;
<add> parser.state.module.addDependency(dep);
<ide> if (expr.arguments.length === 1) {
<ide> const arg = parser.evaluateExpression(expr.arguments[0]);
<ide> let params = [];
<ide> class HotModuleReplacementPlugin {
<ide> parser.state.module.addDependency(dep);
<ide> });
<ide> }
<add> return true;
<ide> });
<ide> parser.hooks.expression
<ide> .for("module.hot")
<del> .tap("HotModuleReplacementPlugin", skipTraversal);
<add> .tap("HotModuleReplacementPlugin", expr => {
<add> const dep = new ModuleHotDependency(expr.range);
<add> dep.loc = expr.loc;
<add> parser.state.module.addDependency(dep);
<add> return true;
<add> });
<ide> };
<ide>
<ide> compiler.hooks.compilation.tap(
<ide> class HotModuleReplacementPlugin {
<ide> const hotUpdateChunkTemplate = compilation.hotUpdateChunkTemplate;
<ide> if (!hotUpdateChunkTemplate) return;
<ide>
<del> compilation.dependencyFactories.set(ConstDependency, new NullFactory());
<del> compilation.dependencyTemplates.set(
<del> ConstDependency,
<del> new ConstDependency.Template()
<del> );
<del>
<ide> compilation.dependencyFactories.set(
<ide> ModuleHotAcceptDependency,
<ide> normalModuleFactory
<ide> class HotModuleReplacementPlugin {
<ide> new ModuleHotDeclineDependency.Template()
<ide> );
<ide>
<add> compilation.dependencyFactories.set(
<add> ModuleHotDependency,
<add> new NullFactory()
<add> );
<add> compilation.dependencyTemplates.set(
<add> ModuleHotDependency,
<add> new ModuleHotDependency.Template()
<add> );
<add>
<ide> compilation.hooks.record.tap(
<ide> "HotModuleReplacementPlugin",
<ide> (compilation, records) => {
<ide><path>lib/dependencies/ModuleHotDependency.js
<add>/*
<add> MIT License http://www.opensource.org/licenses/mit-license.php
<add> Author Tobias Koppers @sokra
<add>*/
<add>
<add>"use strict";
<add>
<add>const RuntimeGlobals = require("../RuntimeGlobals");
<add>const makeSerializable = require("../util/makeSerializable");
<add>const NullDependency = require("./NullDependency");
<add>
<add>/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
<add>/** @typedef {import("../Dependency")} Dependency */
<add>/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
<add>
<add>class ModuleHotDependency extends NullDependency {
<add> constructor(range, apiMethod) {
<add> super();
<add>
<add> this.range = range;
<add> this.apiMethod = apiMethod;
<add> }
<add>
<add> get type() {
<add> return "module.hot";
<add> }
<add>
<add> serialize(context) {
<add> const { write } = context;
<add>
<add> write(this.range);
<add> write(this.apiMethod);
<add>
<add> super.serialize(context);
<add> }
<add>
<add> deserialize(context) {
<add> const { read } = context;
<add>
<add> this.range = read();
<add> this.apiMethod = read();
<add>
<add> super.deserialize(context);
<add> }
<add>}
<add>
<add>makeSerializable(
<add> ModuleHotDependency,
<add> "webpack/lib/dependencies/ModuleHotDependency"
<add>);
<add>
<add>ModuleHotDependency.Template = class ModuleHotDependencyTemplate extends NullDependency.Template {
<add> /**
<add> * @param {Dependency} dependency the dependency for which the template should be applied
<add> * @param {ReplaceSource} source the current replace source which can be modified
<add> * @param {DependencyTemplateContext} templateContext the context object
<add> * @returns {void}
<add> */
<add> apply(dependency, source, { module, runtimeRequirements }) {
<add> const dep = /** @type {ModuleHotDependency} */ (dependency);
<add> runtimeRequirements.add(RuntimeGlobals.module);
<add> source.replace(
<add> dep.range[0],
<add> dep.range[1] - 1,
<add> `${module.moduleArgument}.hot${dep.apiMethod ? `.${dep.apiMethod}` : ""}`
<add> );
<add> }
<add>};
<add>
<add>module.exports = ModuleHotDependency; | 2 |
PHP | PHP | use inline constructors | 3cc489eb1f35a442f73a19c59b53d3fde03d8264 | <ide><path>App/Config/bootstrap.php
<ide> * that changes from configuration that does not. This makes deployment simpler.
<ide> */
<ide> try {
<del> $reader = new PhpConfig();
<del> Configure::config('default', $reader);
<add> Configure::config('default', new PhpConfig());
<ide> Configure::load('app.php', 'default', false);
<ide> } catch (\Exception $e) {
<ide> die('Unable to load Config/app.php ensure it exists.');
<ide> * Register application error and exception handlers.
<ide> */
<ide> if (php_sapi_name() == 'cli') {
<del> $errorHandler = new ConsoleErrorHandler(Configure::consume('Error'));
<add> (new ConsoleErrorHandler(Configure::consume('Error')))->register();
<ide> } else {
<del> $errorHandler = new ErrorHandler(Configure::consume('Error'));
<add> (new ErrorHandler(Configure::consume('Error')))->register();
<ide> }
<del>$errorHandler->register();
<del>unset($errorHandler);
<ide>
<ide>
<ide> /** | 1 |
Text | Text | fix markdown links to model garden code base | 2e1a0602d9dc6f440a32b22bd208377f3553c21d | <ide><path>research/object_detection/g3doc/deepmac.md
<ide> segmentation task.
<ide> * The field `allowed_masked_classes_ids` controls which classes recieve mask
<ide> supervision during training.
<ide> * Mask R-CNN based ablations in the paper are implemented in the
<del> [TF model garden]() code base.
<add> [TF model garden](../../../official/vision/beta/projects/deepmac_maskrcnn)
<add> code base.
<ide>
<ide> ## Prerequisites
<ide>
<ide> 1. Follow [TF2 install instructions](tf2.md) to install Object Detection API.
<ide> 2. Generate COCO dataset by using
<del> [create_coco_tf_record.py](../../official/vision/beta/data/create_coco_tf_record.py)
<add> [create_coco_tf_record.py](../../../official/vision/beta/data/create_coco_tf_record.py)
<ide>
<ide> ## Configurations
<ide> | 1 |
Javascript | Javascript | add link to `$http.path()` | 1571950fe39c9e5e86a01233af1ad27dec0cf80b | <ide><path>src/ng/http.js
<ide> function $HttpProvider() {
<ide> * - {@link ng.$http#put $http.put}
<ide> * - {@link ng.$http#delete $http.delete}
<ide> * - {@link ng.$http#jsonp $http.jsonp}
<add> * - {@link ng.$http#patch $http.patch}
<ide> *
<ide> *
<ide> * # Setting HTTP Headers | 1 |
Text | Text | fix couple of typos [ci skip] | fd003846082cb9ce5f8773bb60b36ccbb70eb9e3 | <ide><path>guides/source/6_1_release_notes.md
<ide> Rails 6.1 provides you with the ability to [switch connections per-database](htt
<ide>
<ide> ### Horizontal Sharding
<ide>
<del>Rails 6.0 provided the ability to functionally partition (multiple partitions, different schemas) your database but wasn't able to support horizontal sharding (same schema, multiple partitions). Rails wasn't able to support horizonal sharding because models in Active Record could only have one connection per-role per-class. This is now fixed and [horizontal sharding](https://github.com/rails/rails/pull/38531) with Rails is available.
<add>Rails 6.0 provided the ability to functionally partition (multiple partitions, different schemas) your database but wasn't able to support horizontal sharding (same schema, multiple partitions). Rails wasn't able to support horizontal sharding because models in Active Record could only have one connection per-role per-class. This is now fixed and [horizontal sharding](https://github.com/rails/rails/pull/38531) with Rails is available.
<ide>
<ide> ### Strict Loading Associations
<ide>
<ide><path>guides/source/active_record_querying.md
<ide> class Order < ApplicationRecord
<ide> end
<ide> ```
<ide>
<del>These [scopes](#scopes) are created automatically and can be used to find all objects with or wihout a particular value for `status`:
<add>These [scopes](#scopes) are created automatically and can be used to find all objects with or without a particular value for `status`:
<ide>
<ide> ```irb
<ide> irb> Order.shipped
<ide> irb> Order.not_shipped
<ide> => #<ActiveRecord::Relation> # all orders with status != :shipped
<ide> ```
<ide>
<del>These instace methods are created automatically and query whether the model has that value for the `status` enum:
<add>These instance methods are created automatically and query whether the model has that value for the `status` enum:
<ide>
<ide> ```irb
<ide> irb> order = Order.shipped.first
<ide><path>guides/source/upgrading_ruby_on_rails.md
<ide> prefix = "foo/bar".camelize
<ide>
<ide> This change is backwards compatible for the majority of applications, in which case you do not need to do anything.
<ide>
<del>Technically, however, controllers could configure `helpers_path` to point to a directoy in `$LOAD_PATH` that was not in the autoload paths. That use case is no longer supported out of the box. If the helper module is not autoloadable, the application is responsible for loading it before calling `helper`.
<add>Technically, however, controllers could configure `helpers_path` to point to a directory in `$LOAD_PATH` that was not in the autoload paths. That use case is no longer supported out of the box. If the helper module is not autoloadable, the application is responsible for loading it before calling `helper`.
<ide>
<ide> ### Redirection to HTTPS from HTTP will now use the 308 HTTP status code
<ide> | 3 |
Text | Text | move style guide to findable location | 42dd3ca8690979a53c33f7978adc4426bd1163e4 | <add><path>doc/README.md
<del><path>doc/guides/doc-style-guide.md
<ide> For topics not covered here, refer to the [Microsoft Writing Style Guide][].
<ide> [Use sentence-style capitalization for headings]: https://docs.microsoft.com/en-us/style-guide/scannable-content/headings#formatting-headings
<ide> [Use serial commas]: https://docs.microsoft.com/en-us/style-guide/punctuation/commas
<ide> [`remark-preset-lint-node`]: https://github.com/nodejs/remark-preset-lint-node
<del>[doctools README]: ../../tools/doc/README.md
<add>[doctools README]: ../tools/doc/README.md
<ide> [info string]: https://github.github.com/gfm/#info-string
<ide> [language]: https://github.com/highlightjs/highlight.js/blob/HEAD/SUPPORTED_LANGUAGES.md
<ide> [plugin]: https://editorconfig.org/#download
<ide><path>doc/guides/contributing/pull-requests.md
<ide> If you are modifying code, please be sure to run `make lint` (or
<ide> code style guide.
<ide>
<ide> Any documentation you write (including code comments and API documentation)
<del>should follow the [Style Guide](../doc-style-guide.md). Code samples
<add>should follow the [Style Guide](../../README.md). Code samples
<ide> included in the API docs will also be checked when running `make lint` (or
<ide> `vcbuild.bat lint` on Windows). If you are adding to or deprecating an API,
<ide> add or change the appropriate YAML documentation. Use `REPLACEME` for the | 2 |
Mixed | Javascript | fix default font color for legend | ae04fcf3c3818a2ceb67556a9bde8da29d42b2c3 | <ide><path>docs/docs/configuration/legend.md
<ide> var chart = new Chart(ctx, {
<ide> legend: {
<ide> display: true,
<ide> labels: {
<del> fontColor: 'rgb(255, 99, 132)'
<add> color: 'rgb(255, 99, 132)'
<ide> }
<ide> }
<ide> }
<ide><path>src/plugins/plugin.legend.js
<ide> export class Legend extends Element {
<ide> const rtlHelper = getRtlAdapter(opts.rtl, me.left, me._minSize.width);
<ide> const ctx = me.ctx;
<ide> const labelFont = toFont(labelOpts.font, me.chart.options.font);
<del> const fontColor = labelOpts.color;
<add> const fontColor = labelOpts.color || defaultColor;
<ide> const fontSize = labelFont.size;
<ide> let cursor;
<ide> | 2 |
Text | Text | add article for elixir keyword lists | 9d7ad71964d0488983884b00f836db631793baf9 | <ide><path>guide/english/elixir/keyword-lists/index.md
<ide> title: Keyword Lists
<ide> ---
<ide> ## Keyword Lists
<ide>
<del>This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/elixir/keyword-lists/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<add>Keyword Lists are used for storing the key-value pairs as tuples.
<ide>
<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>.
<add>```shell
<add>iex(1)> iex(3)> kw_list = [{:key1, "Val1"}, {:key2, "Val2"}, {:key1, "It is OK to repeat key1"}]
<add>[key1: "Val1", key2: "Val2", key1: "It is OK to repeat key1"]
<add>```
<add>curly braces can be omitted as seen in the `iex` response on the second line.
<ide>
<del><!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
<add>In Keyword Lists, the Keys :
<add>
<add>- Must be atoms
<add>- Can be repeated
<add>- Are ordered as specified by the developer.
<add>
<add>Keyword lists are default mechanism for passing options to functions in Elixir.
<ide>
<ide> #### More Information:
<del><!-- Please add any articles you think might be helpful to read before writing the article -->
<add> * [Elixir Documentation](https://elixir-lang.org/getting-started/keywords-and-maps.html#keyword-lists)
<add> * [Keyword HexDocs](https://hexdocs.pm/elixir/Keyword.html) | 1 |
Java | Java | give more time to delay tck test | 0ce3c599ca4cb7a6b7009eecc197633a474359c3 | <ide><path>src/test/java/io/reactivex/tck/DelaySubscriptionTckTest.java
<ide> @Test
<ide> public class DelaySubscriptionTckTest extends BaseTck<Integer> {
<ide>
<add> public DelaySubscriptionTckTest() {
<add> super(200L);
<add> }
<add>
<ide> @Override
<ide> public Publisher<Integer> createPublisher(long elements) {
<ide> return FlowableTck.wrap( | 1 |
Python | Python | fix unravel_index integer division | e8a7df65457531e986a65483ffe79c98c7e811a8 | <ide><path>numpy/lib/index_tricks.py
<ide> def unravel_index(x,dims):
<ide> # [dcb,dc,d,1]
<ide> dim_prod = _nx.cumprod([1] + list(dims)[:0:-1])[::-1]
<ide> # Indices become [x/dcb % a, x/dc % b, x/d % c, x/1 % d]
<del> return tuple(x/dim_prod % dims)
<add> return tuple(x//dim_prod % dims)
<ide>
<ide> def ix_(*args):
<ide> """ | 1 |
Go | Go | fix wrong print format | 9b1ceecd8a44e72ad773f7016df09a4b285258b8 | <ide><path>builder/dockerfile/dispatchers_test.go
<ide> func TestArg(t *testing.T) {
<ide> }
<ide>
<ide> if *val != "bar" {
<del> t.Fatalf("%s argument should have default value 'bar', got %s", argName, val)
<add> t.Fatalf("%s argument should have default value 'bar', got %s", argName, *val)
<ide> }
<ide> }
<ide>
<ide><path>cli/command/container/opts_test.go
<ide> func TestParseHealth(t *testing.T) {
<ide> t.Fatalf("--health-cmd: got %#v", health.Test)
<ide> }
<ide> if health.Timeout != 0 {
<del> t.Fatalf("--health-cmd: timeout = %f", health.Timeout)
<add> t.Fatalf("--health-cmd: timeout = %s", health.Timeout)
<ide> }
<ide>
<ide> checkError("--no-healthcheck conflicts with --health-* options", | 2 |
Python | Python | update author email and website url | 0f4fb1dfb847f33a21be035c7199b1add99a9218 | <ide><path>setup.py
<ide> def run(self):
<ide> version=read_version_string(),
<ide> description='A unified interface into many cloud server providers',
<ide> author='Apache Software Foundation',
<del> author_email='libcloud@incubator.apache.org',
<add> author_email='dev@libcloud.apache.org',
<ide> requires=([], ['ssl', 'simplejson'],)[pre_python26],
<ide> packages=[
<ide> 'libcloud',
<ide> def run(self):
<ide> 'libcloud': ['data/*.json']
<ide> },
<ide> license='Apache License (2.0)',
<del> url='http://incubator.apache.org/libcloud/',
<add> url='http://libcloud.apache.org/',
<ide> cmdclass={
<ide> 'test': TestCommand,
<ide> 'apidocs': ApiDocsCommand, | 1 |
Javascript | Javascript | remove unused code | d671cba22fa543123c8eab375684093efa198d73 | <ide><path>packages/learn/src/templates/Challenges/rechallenge/transformers.js
<ide> export const proxyLoggerTransformer = partial(
<ide> })
<ide> );
<ide>
<del>// const addLoopProtect = partial(vinyl.transformContents, contents => {
<del>// /* eslint-disable import/no-unresolved */
<del>// const loopProtect = require('loop-protect');
<del>// /* eslint-enable import/no-unresolved */
<del>// loopProtect.hit = loopProtectHit;
<del>// return loopProtect(contents);
<del>// });
<del>
<del>// export const addLoopProtectHtmlJsJsx = cond([
<del>// [
<del>// overEvery(
<del>// testHTMLJS,
<del>// partial(vinyl.testContents, contents =>
<del>// contents.toLowerCase().includes('<script>')
<del>// )
<del>// ),
<del>// addLoopProtect
<del>// ],
<del>// [testJS$JSX, addLoopProtect],
<del>// [stubTrue, identity]
<del>// ]);
<del>
<ide> export const replaceNBSP = cond([
<ide> [
<ide> testHTMLJS, | 1 |
PHP | PHP | fix cs error | 3b8c85b45b05c16773164082a21254ff74059841 | <ide><path>tests/TestCase/ORM/TableRegistryTest.php
<ide> public function testConfigPlugin() {
<ide> 'entityClass' => 'TestPlugin\Model\Entity\Comment',
<ide> ];
<ide>
<del>
<ide> $result = TableRegistry::config('TestPlugin.TestPluginComments', $data);
<ide> $this->assertEquals($data, $result, 'Returns config data.');
<ide> | 1 |
PHP | PHP | add support for binary request | 1e1f5311f062d62468fe2d3cef1695b8fa338cfb | <ide><path>src/Illuminate/Http/Client/PendingRequest.php
<ide> class PendingRequest
<ide> */
<ide> protected $pendingFiles = [];
<ide>
<add> /**
<add> * The binary for the request.
<add> *
<add> * @var array
<add> */
<add> protected $pendingBinary;
<add>
<ide> /**
<ide> * The request cookies.
<ide> *
<ide> public function asMultipart()
<ide> return $this->bodyFormat('multipart');
<ide> }
<ide>
<add> /**
<add> * Attach a binary to the request.
<add> *
<add> * @param string $content
<add> * @param string $contentType
<add> * @return $this
<add> */
<add> public function binary($content, $contentType)
<add> {
<add> $this->asBinary();
<add>
<add> $this->pendingBinary = $content;
<add>
<add> $this->contentType($contentType);
<add>
<add> return $this;
<add> }
<add>
<add> /**
<add> * Indicate the request contains form parameters.
<add> *
<add> * @return $this
<add> */
<add> public function asBinary()
<add> {
<add> return $this->bodyFormat('body');
<add> }
<add>
<ide> /**
<ide> * Specify the body format of the request.
<ide> *
<ide> public function send(string $method, string $url, array $options = [])
<ide> $options[$this->bodyFormat] = $this->parseMultipartBodyFormat($options[$this->bodyFormat]);
<ide> }
<ide>
<del> $options[$this->bodyFormat] = array_merge(
<del> $options[$this->bodyFormat], $this->pendingFiles
<del> );
<add> if ($this->bodyFormat === 'body') {
<add> $options[$this->bodyFormat] = $this->pendingBinary;
<add> }
<add>
<add> if (is_array($options[$this->bodyFormat])) {
<add> $options[$this->bodyFormat] = array_merge(
<add> $options[$this->bodyFormat], $this->pendingFiles
<add> );
<add> }
<ide> }
<ide>
<ide> $this->pendingFiles = []; | 1 |
Text | Text | add spec documentation | 421cdb41b9e1e6eb812ed4c6efeef9425520ccd9 | <ide><path>docs/writing-specs.md
<add># Writting specs
<add>
<add>Atom uses [Jasmine](http://jasmine.github.io/2.0/introduction.html) as its spec framework. Any new functionality should have specs to guard against regressions.
<add>
<add>## Create a new spec
<add>
<add>[Atom specs](https://github.com/atom/atom/tree/master/spec) and [package specs](https://github.com/atom/markdown-preview/tree/master/spec) are added to their respective `spec` directory. The example below creates a spec for Atom core.
<add>
<add>0. Create a spec file
<add>
<add> Spec files **must** end with `-spec` so add `sample-spec.coffee` to `atom/spec`.
<add>
<add>0. Add one or more `describe` method
<add>
<add> The `describe` method takes two arguments, a description and a function. If the description explains a behavior it typically begins with `when` if it is more like a unit test it begins with the method name.
<add>
<add> ```coffee
<add> describe "when a test is written", ->
<add> # contents
<add> ```
<add>
<add> or
<add>
<add> ```coffee
<add> describe "Editor::moveUp", ->
<add> # contents
<add> ```
<add>
<add>0. Add one or more `it` method
<add>
<add> The `it` method also takes two arugments, a description and a function. Try and make the description flow with the `it` method. For example, a description of `this should work` doesn't read well as `it this should work`. But a description of `should work` sounds great as `it should work`.
<add>
<add> ```coffee
<add> describe "when a test is written", ->
<add> it "has some expectations that should pass", ->
<add> # Expectations
<add> ```
<add>
<add>0. Add one or more expectations
<add>
<add> The best way to learn about expectations is to read the [jamsine documentation](http://jasmine.github.io/2.0/introduction.html#section-Expectations) about them. Below is a simple example.
<add>
<add> ```coffee
<add> describe "when a test is written", ->
<add> it "has some expectations that should pass", ->
<add> expect("apples").toEqual("apples")
<add> expect("oranges").not.toEqual("apples")
<add> ```
<add>
<add>## Runnings specs
<add>
<add>Most of the time you'll want to run specs by triggering the `window:run-package-specs` command. This command is not only to run package specs, it is also for Atom core specs. This will run all the specs in the current project's spec directory. If you want to run the Atom core specs and **all** the default package specs trigger the `window:run-all-specs` command.
<add>
<add>To run a limited subset of specs use the `fdescribe` or `fit` methods. You can use those to focus a single spec or several specs. In the example above, focusing an individual spec looks like this:
<add>
<add>```coffee
<add>describe "when a test is written", ->
<add> fit "has some expectations that should pass", ->
<add> expect("apples").toEqual("apples")
<add> expect("oranges").not.toEqual("apples")
<add>``` | 1 |
Ruby | Ruby | apply active record suppression to all saves | ac002395d87aa7a4bcc3126e67ca3b2808d832a6 | <ide><path>activerecord/lib/active_record/suppressor.rb
<ide> def suppress(&block)
<ide> end
<ide> end
<ide>
<del> # Ignore saving events if we're in suppression mode.
<del> def save!(*args) # :nodoc:
<add> def create_or_update(*args) # :nodoc:
<ide> SuppressorRegistry.suppressed[self.class.name] ? true : super
<ide> end
<ide> end
<ide><path>activerecord/test/cases/suppressor_test.rb
<ide> require 'models/user'
<ide>
<ide> class SuppressorTest < ActiveRecord::TestCase
<del> def test_suppresses_creation_of_record_generated_by_callback
<add> def test_suppresses_create
<add> assert_no_difference -> { Notification.count } do
<add> Notification.suppress do
<add> Notification.create
<add> Notification.create!
<add> Notification.new.save
<add> Notification.new.save!
<add> end
<add> end
<add> end
<add>
<add> def test_suppresses_update
<add> user = User.create! token: 'asdf'
<add>
<add> User.suppress do
<add> user.update token: 'ghjkl'
<add> assert_equal 'asdf', user.reload.token
<add>
<add> user.update! token: 'zxcvbnm'
<add> assert_equal 'asdf', user.reload.token
<add>
<add> user.token = 'qwerty'
<add> user.save
<add> assert_equal 'asdf', user.reload.token
<add>
<add> user.token = 'uiop'
<add> user.save!
<add> assert_equal 'asdf', user.reload.token
<add> end
<add> end
<add>
<add> def test_suppresses_create_in_callback
<ide> assert_difference -> { User.count } do
<ide> assert_no_difference -> { Notification.count } do
<ide> Notification.suppress { UserWithNotification.create! } | 2 |
PHP | PHP | use fqcn in docblocks | 356b1221321be41f0721b29d03a35e1535929643 | <ide><path>src/Illuminate/Conditionable/Traits/Conditionable.php
<ide> trait Conditionable
<ide> * @template TWhenParameter
<ide> * @template TWhenReturnType
<ide> *
<del> * @param (Closure($this): TWhenParameter)|TWhenParameter $value
<add> * @param (\Closure($this): TWhenParameter)|TWhenParameter $value
<ide> * @param (callable($this, TWhenParameter): TWhenReturnType)|null $callback
<ide> * @param (callable($this, TWhenParameter): TWhenReturnType)|null $default
<ide> * @return $this|TWhenReturnType
<ide> public function when($value, callable $callback = null, callable $default = null
<ide> * @template TUnlessParameter
<ide> * @template TUnlessReturnType
<ide> *
<del> * @param (Closure($this): TUnlessParameter)|TUnlessParameter $value
<add> * @param (\Closure($this): TUnlessParameter)|TUnlessParameter $value
<ide> * @param (callable($this, TUnlessParameter): TUnlessReturnType)|null $callback
<ide> * @param (callable($this, TUnlessParameter): TUnlessReturnType)|null $default
<ide> * @return $this|TUnlessReturnType | 1 |
Text | Text | strandize links in projects | dc4eab3297e7c6d751221e359dc97cb09c6ed6d1 | <ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/american-british-translator.md
<ide> dashedName: american-british-translator
<ide>
<ide> # --description--
<ide>
<del>Build a full stack JavaScript app that is functionally similar to this: <https://american-british-translator.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
<add>Build a full stack JavaScript app that is functionally similar to this: <a href="https://american-british-translator.freecodecamp.rocks/" target="_blank" rel="noopener noreferrer nofollow">https://american-british-translator.freecodecamp.rocks/"</a>. Working on this project will involve you writing your code using one of the following methods:
<ide>
<del>- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-american-british-english-translator/) and complete your project locally.
<del>- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-american-british-english-translator) to complete your project.
<add>- Clone <a href="https://github.com/freeCodeCamp/boilerplate-project-american-british-english-translator/" target="_blank" rel="noopener noreferrer nofollow">this GitHub repo</a> and complete your project locally.
<add>- Use <a href="https://replit.com/github/freeCodeCamp/boilerplate-project-american-british-english-translator" target="_blank" rel="noopener noreferrer nofollow">our Replit starter project</a> to complete your project.
<ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
<ide>
<ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
<ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/issue-tracker.md
<ide> dashedName: issue-tracker
<ide>
<ide> # --description--
<ide>
<del>Build a full stack JavaScript app that is functionally similar to this: <https://issue-tracker.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
<add>Build a full stack JavaScript app that is functionally similar to this: <a href="https://issue-tracker.freecodecamp.rocks/" target="_blank" rel="noopener noreferrer nofollow">https://issue-tracker.freecodecamp.rocks/</a>. Working on this project will involve you writing your code using one of the following methods:
<ide>
<del>- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-issuetracker/) and complete your project locally.
<del>- Use [this Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-issuetracker) to complete your project.
<add>- Clone <a href="https://github.com/freeCodeCamp/boilerplate-project-issuetracker/" target="_blank" rel="noopener noreferrer nofollow">this GitHub repo</a> and complete your project locally.
<add>- Use <a href="https://replit.com/github/freeCodeCamp/boilerplate-project-issuetracker" target="_blank" rel="noopener noreferrer nofollow">this Replit starter project</a> to complete your project.
<ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
<ide>
<ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
<ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/metric-imperial-converter.md
<ide> dashedName: metric-imperial-converter
<ide>
<ide> # --description--
<ide>
<del>Build a full stack JavaScript app that is functionally similar to this: <https://metric-imperial-converter.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
<add>Build a full stack JavaScript app that is functionally similar to this: <a href="https://metric-imperial-converter.freecodecamp.rocks/" target="_blank" rel="noopener noreferrer nofollow">https://metric-imperial-converter.freecodecamp.rocks/</a>. Working on this project will involve you writing your code using one of the following methods:
<ide>
<del>- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-metricimpconverter/) and complete your project locally.
<del>- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-metricimpconverter) to complete your project.
<add>- Clone <a href="https://github.com/freeCodeCamp/boilerplate-project-metricimpconverter/" target="_blank" rel="noopener noreferrer nofollow">this GitHub repo</a> and complete your project locally.
<add>- Use <a href="https://replit.com/github/freeCodeCamp/boilerplate-project-metricimpconverter" target="_blank" rel="noopener noreferrer nofollow">our Replit starter project</a> to complete your project.
<ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
<ide>
<ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
<ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/personal-library.md
<ide> dashedName: personal-library
<ide>
<ide> # --description--
<ide>
<del>Build a full stack JavaScript app that is functionally similar to this: <https://personal-library.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
<add>Build a full stack JavaScript app that is functionally similar to this: <a href="https://personal-library.freecodecamp.rocks/" target="_blank" rel="noopener noreferrer nofollow">https://personal-library.freecodecamp.rocks/</a>. Working on this project will involve you writing your code using one of the following methods:
<ide>
<del>- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-library) and complete your project locally.
<del>- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-library) to complete your project.
<add>- Clone <a href="https://github.com/freeCodeCamp/boilerplate-project-library" target="_blank" rel="noopener noreferrer nofollow">this GitHub repo</a> and complete your project locally.
<add>- Use <a href="https://replit.com/github/freeCodeCamp/boilerplate-project-library" target="_blank" rel="noopener noreferrer nofollow">our Replit starter project</a> to complete your project.
<ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
<ide>
<ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
<ide><path>curriculum/challenges/english/06-quality-assurance/quality-assurance-projects/sudoku-solver.md
<ide> dashedName: sudoku-solver
<ide>
<ide> # --description--
<ide>
<del>Build a full stack JavaScript app that is functionally similar to this: <https://sudoku-solver.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
<add>Build a full stack JavaScript app that is functionally similar to this: <a href="https://sudoku-solver.freecodecamp.rocks/" target="_blank" rel="noopener noreferrer nofollow">https://sudoku-solver.freecodecamp.rocks/</a>. Working on this project will involve you writing your code using one of the following methods:
<ide>
<del>- Clone [this GitHub repo](https://github.com/freecodecamp/boilerplate-project-sudoku-solver) and complete your project locally.
<del>- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-sudoku-solver) to complete your project.
<add>- Clone <a href="https://github.com/freecodecamp/boilerplate-project-sudoku-solver" target="_blank" rel="noopener noreferrer nofollow">this GitHub repo</a> and complete your project locally.
<add>- Use <a href="https://replit.com/github/freeCodeCamp/boilerplate-project-sudoku-solver" target="_blank" rel="noopener noreferrer nofollow">our Replit starter project</a> to complete your project.
<ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
<ide>
<ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
<ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter.md
<ide> dashedName: arithmetic-formatter
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-arithmetic-formatter).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-arithmetic-formatter" target="_blank" rel="noopener noreferrer nofollow"> working on this project with our Replit starter code</a>.
<ide>
<ide> # --instructions--
<ide>
<ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/budget-app.md
<ide> dashedName: budget-app
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-budget-app).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-budget-app" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> # --instructions--
<ide>
<ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/polygon-area-calculator.md
<ide> dashedName: polygon-area-calculator
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-polygon-area-calculator).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-polygon-area-calculator" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> # --instructions--
<ide>
<ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md
<ide> dashedName: probability-calculator
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-probability-calculator).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-probability-calculator" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> # --instructions--
<ide>
<ide><path>curriculum/challenges/english/07-scientific-computing-with-python/scientific-computing-with-python-projects/time-calculator.md
<ide> dashedName: time-calculator
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-time-calculator).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-time-calculator" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> # --instructions--
<ide>
<ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/demographic-data-analyzer.md
<ide> dashedName: demographic-data-analyzer
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-demographic-data-analyzer).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-demographic-data-analyzer" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project:
<ide>
<del>- [Python for Everybody Video Course](https://www.freecodecamp.org/news/python-for-everybody/) (14 hours)
<del>- [Learn Python Video Course](https://www.freecodecamp.org/news/learn-python-video-course/) (10 hours)
<add>- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a> (14 hours)
<add>- <a href="https://www.freecodecamp.org/news/learn-python-video-course/" target="_blank" rel="noopener noreferrer nofollow">Learn Python Video Course</a> (10 hours)
<ide>
<ide> # --instructions--
<ide>
<ide> Copy your project's URL and submit it to freeCodeCamp.
<ide>
<ide> ## Dataset Source
<ide>
<del>Dua, D. and Graff, C. (2019). [UCI Machine Learning Repository](http://archive.ics.uci.edu/ml). Irvine, CA: University of California, School of Information and Computer Science.
<add>Dua, D. and Graff, C. (2019). <a href="http://archive.ics.uci.edu/ml" target="_blank" rel="noopener noreferrer nofollow">UCI Machine Learning Repository</a>. Irvine, CA: University of California, School of Information and Computer Science.
<ide>
<ide> # --hints--
<ide>
<ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/mean-variance-standard-deviation-calculator.md
<ide> dashedName: mean-variance-standard-deviation-calculator
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-mean-variance-standard-deviation-calculator).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-mean-variance-standard-deviation-calculator" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project:
<ide>
<del>- [Python for Everybody Video Course](https://www.freecodecamp.org/news/python-for-everybody/) (14 hours)
<del>- [Learn Python Video Course](https://www.freecodecamp.org/news/learn-python-video-course/) (10 hours)
<add>- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
<add>- <a href="https://www.freecodecamp.org/news/learn-python-video-course/" target="_blank" rel="noopener noreferrer nofollow">Learn Python Video Course</a>
<ide>
<ide> # --instructions--
<ide>
<ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/medical-data-visualizer.md
<ide> dashedName: medical-data-visualizer
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-medical-data-visualizer).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-medical-data-visualizer" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project:
<ide>
<del>- [Python for Everybody Video Course](https://www.freecodecamp.org/news/python-for-everybody/) (14 hours)
<del>- [Learn Python Video Course](https://www.freecodecamp.org/news/learn-python-video-course/) (10 hours)
<add>- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
<add>- <a href="https://www.freecodecamp.org/news/learn-python-video-course/" target="_blank" rel="noopener noreferrer nofollow">Learn Python Video Course</a>
<ide>
<ide> # --instructions--
<ide>
<ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer.md
<ide> dashedName: page-view-time-series-visualizer
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-page-view-time-series-visualizer).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-page-view-time-series-visualizer" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project:
<ide>
<del>- [Python for Everybody Video Course](https://www.freecodecamp.org/news/python-for-everybody/) (14 hours)
<del>- [Learn Python Video Course](https://www.freecodecamp.org/news/learn-python-video-course/) (10 hours)
<add>- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
<add>- <a href="https://www.freecodecamp.org/news/learn-python-video-course/" target="_blank" rel="noopener noreferrer nofollow">Learn Python Video Course</a>
<ide>
<ide> # --instructions--
<ide>
<ide><path>curriculum/challenges/english/08-data-analysis-with-python/data-analysis-with-python-projects/sea-level-predictor.md
<ide> dashedName: sea-level-predictor
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-sea-level-predictor).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-sea-level-predictor" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project:
<ide>
<del>- [Python for Everybody Video Course](https://www.freecodecamp.org/news/python-for-everybody/) (14 hours)
<del>- [Learn Python Video Course](https://www.freecodecamp.org/news/learn-python-video-course/) (10 hours)
<add>- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
<add>- <a href="https://www.freecodecamp.org/news/learn-python-video-course/" target="_blank" rel="noopener noreferrer nofollow">Learn Python Video Course</a>
<ide>
<ide> # --instructions--
<ide>
<ide> We imported the tests from `test_module.py` to `main.py` for your convenience. T
<ide> Copy your project's URL and submit it to freeCodeCamp.
<ide>
<ide> ## Data Source
<del>[Global Average Absolute Sea Level Change](https://datahub.io/core/sea-level-rise), 1880-2014 from the US Environmental Protection Agency using data from CSIRO, 2015; NOAA, 2015.
<add><a href="https://datahub.io/core/sea-level-rise" target="_blank" rel="noopener noreferrer nofollow">Global Average Absolute Sea Level Change</a>, 1880-2014 from the US Environmental Protection Agency using data from CSIRO, 2015; NOAA, 2015.
<ide>
<ide>
<ide> # --hints--
<ide><path>curriculum/challenges/english/09-information-security/information-security-projects/anonymous-message-board.md
<ide> dashedName: anonymous-message-board
<ide>
<ide> # --description--
<ide>
<del>Build a full stack JavaScript app that is functionally similar to this: <https://anonymous-message-board.freecodecamp.rocks/>.
<add>Build a full stack JavaScript app that is functionally similar to this: <a href="https://anonymous-message-board.freecodecamp.rocks/" target="_blank" rel="noopener noreferrer nofollow">https://anonymous-message-board.freecodecamp.rocks/</a>.
<ide>
<ide> Working on this project will involve you writing your code using one of the following methods:
<ide>
<del>- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-messageboard/) and complete your project locally.
<del>- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-messageboard) to complete your project.
<add>- Clone <a href="https://github.com/freeCodeCamp/boilerplate-project-messageboard/" target="_blank" rel="noopener noreferrer nofollow">this GitHub repo</a> and complete your project locally.
<add>- Use <a href="https://replit.com/github/freeCodeCamp/boilerplate-project-messageboard" target="_blank" rel="noopener noreferrer nofollow">our Replit starter project</a> to complete your project.
<ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
<ide>
<ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
<ide><path>curriculum/challenges/english/09-information-security/information-security-projects/port-scanner.md
<ide> dashedName: port-scanner
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-port-scanner).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-port-scanner" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project:
<ide>
<del>- [Python for Everybody Video Course](https://www.freecodecamp.org/news/python-for-everybody/) (14 hours)
<add>- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a> (14 hours)
<ide>
<del>- [Learn Python Video Course](https://www.freecodecamp.org/news/learn-python-video-course/) (10 hours)
<add>- <a href="https://www.freecodecamp.org/news/learn-python-video-course/" target="_blank" rel="noopener noreferrer nofollow">Learn Python Video Course</a> (10 hours)
<ide>
<ide> # --instructions--
<ide>
<ide><path>curriculum/challenges/english/09-information-security/information-security-projects/secure-real-time-multiplayer-game.md
<ide> dashedName: secure-real-time-multiplayer-game
<ide>
<ide> # --description--
<ide>
<del>Develop a 2D real time multiplayer game using the HTML Canvas API and Socket.io that is functionally similar to this: <https://secure-real-time-multiplayer-game.freecodecamp.rocks/>. Working on this project will involve you writing your code using one of the following methods:
<add>Develop a 2D real time multiplayer game using the HTML Canvas API and Socket.io that is functionally similar to this: <a href="https://secure-real-time-multiplayer-game.freecodecamp.rocks/" target="_blank" rel="noopener noreferrer nofollow">https://secure-real-time-multiplayer-game.freecodecamp.rocks/</a>. Working on this project will involve you writing your code using one of the following methods:
<ide>
<del>- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game/) and complete your project locally.
<del>- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game) to complete your project.
<add>- Clone <a href="https://github.com/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game/" target="_blank" rel="noopener noreferrer nofollow">this GitHub repo</a> and complete your project locally.
<add>- Use <a href="https://replit.com/github/freeCodeCamp/boilerplate-project-secure-real-time-multiplayer-game" target="_blank" rel="noopener noreferrer nofollow">our Replit starter project</a> to complete your project.
<ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
<ide>
<ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
<ide><path>curriculum/challenges/english/09-information-security/information-security-projects/sha-1-password-cracker.md
<ide> dashedName: sha-1-password-cracker
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-SHA-1-password-cracker).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-SHA-1-password-cracker" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> We are still developing the interactive instructional part of the Python curriculum. For now, here are some videos on the freeCodeCamp.org YouTube channel that will teach you everything you need to know to complete this project:
<ide>
<del>- [Python for Everybody Video Course](https://www.freecodecamp.org/news/python-for-everybody/) (14 hours)
<add>- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a> (14 hours)
<ide>
<del>- [Learn Python Video Course](https://www.freecodecamp.org/news/learn-python-video-course/) (10 hours)
<add>- <a href="https://www.freecodecamp.org/news/learn-python-video-course/" target="_blank" rel="noopener noreferrer nofollow">Learn Python Video Course</a> (10 hours)
<ide>
<ide> # --instructions--
<ide>
<ide> Here are some hashed passwords to test the function with when `use_salts` is set
<ide> - `da5a4e8cf89539e66097acd2f8af128acae2f8ae` should return "q1w2e3r4t5"
<ide> - `ea3f62d498e3b98557f9f9cd0d905028b3b019e1` should return "bubbles1"
<ide>
<del>The `hashlib` library has been imported for you. You should condider using it in your code. [Learn more about "hashlib" here.](https://docs.python.org/3/library/hashlib.html)
<add>The `hashlib` library has been imported for you. You should condider using it in your code. <a href="https://docs.python.org/3/library/hashlib.html" target="_blank" rel="noopener noreferrer nofollow">Learn more about "hashlib" here</a>.
<ide>
<ide> ## Development
<ide>
<ide><path>curriculum/challenges/english/09-information-security/information-security-projects/stock-price-checker.md
<ide> dashedName: stock-price-checker
<ide>
<ide> # --description--
<ide>
<del>Build a full stack JavaScript app that is functionally similar to this: <https://stock-price-checker.freecodecamp.rocks/>.
<add>Build a full stack JavaScript app that is functionally similar to this: <a href="https://stock-price-checker.freecodecamp.rocks/> target="_blank" rel="noopener noreferrer nofollow">https://stock-price-checker.freecodecamp.rocks/</a>.
<ide>
<del>Since all reliable stock price APIs require an API key, we've built a workaround. Use <https://stock-price-checker-proxy.freecodecamp.rocks/> to get up-to-date stock price information without needing to sign up for your own key.
<add>Since all reliable stock price APIs require an API key, we've built a workaround. Use <a href="https://stock-price-checker-proxy.freecodecamp.rocks/" target="_blank" rel="noopener noreferrer nofollow">https://stock-price-checker-proxy.freecodecamp.rocks/</a> to get up-to-date stock price information without needing to sign up for your own key.
<ide>
<ide> Working on this project will involve you writing your code using one of the following methods:
<ide>
<del>- Clone [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-stockchecker/) and complete your project locally.
<del>- Use [our Replit starter project](https://replit.com/github/freeCodeCamp/boilerplate-project-stockchecker) to complete your project.
<add>- Clone <a href="https://github.com/freeCodeCamp/boilerplate-project-stockchecker/" target="_blank" rel="noopener noreferrer nofollow">this GitHub repo</a> and complete your project locally.
<add>- Use <a href="https://replit.com/github/freeCodeCamp/boilerplate-project-stockchecker" target="_blank" rel="noopener noreferrer nofollow">our Replit starter project</a> to complete your project.
<ide> - Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
<ide>
<ide> When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
<ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/book-recommendation-engine-using-knn.md
<ide> dashedName: book-recommendation-engine-using-knn
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with Google Colaboratory](https://colab.research.google.com/github/freeCodeCamp/boilerplate-book-recommendation-engine/blob/master/fcc_book_recommendation_knn.ipynb).
<add>You will be <a href="https://colab.research.google.com/github/freeCodeCamp/boilerplate-book-recommendation-engine/blob/master/fcc_book_recommendation_knn.ipynb" target="_blank" rel="noopener noreferrer nofollow">working on this project with Google Colaboratory</a>.
<ide>
<ide> After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link."
<ide>
<ide> We are still developing the interactive instructional content for the machine le
<ide>
<ide> In this challenge, you will create a book recommendation algorithm using **K-Nearest Neighbors**.
<ide>
<del>You will use the [Book-Crossings dataset](http://www2.informatik.uni-freiburg.de/~cziegler/BX/). This dataset contains 1.1 million ratings (scale of 1-10) of 270,000 books by 90,000 users.
<add>You will use the <a href="http://www2.informatik.uni-freiburg.de/~cziegler/BX/" target="_blank" rel="noopener noreferrer nofollow">Book-Crossings dataset</a>. This dataset contains 1.1 million ratings (scale of 1-10) of 270,000 books by 90,000 users.
<ide>
<ide> After importing and cleaning the data, use `NearestNeighbors` from `sklearn.neighbors` to develop a model that shows books that are similar to a given book. The Nearest Neighbors algorithm measures the distance to determine the “closeness” of instances.
<ide>
<ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier.md
<ide> dashedName: cat-and-dog-image-classifier
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with Google Colaboratory](https://colab.research.google.com/github/freeCodeCamp/boilerplate-cat-and-dog-image-classifier/blob/master/fcc_cat_dog.ipynb).
<add>You will be <a href="https://colab.research.google.com/github/freeCodeCamp/boilerplate-cat-and-dog-image-classifier/blob/master/fcc_cat_dog.ipynb" target="_blank" rel="noopener noreferrer nofollow">working on this project with Google Colaboratory</a>.
<ide>
<ide> After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link."
<ide>
<ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/linear-regression-health-costs-calculator.md
<ide> dashedName: linear-regression-health-costs-calculator
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with Google Colaboratory](https://colab.research.google.com/github/freeCodeCamp/boilerplate-linear-regression-health-costs-calculator/blob/master/fcc_predict_health_costs_with_regression.ipynb).
<add>You will be <a href="https://colab.research.google.com/github/freeCodeCamp/boilerplate-linear-regression-health-costs-calculator/blob/master/fcc_predict_health_costs_with_regression.ipynb" target="_blank" rel="noopener noreferrer nofollow">working on this project with Google Colaboratory</a>.
<ide>
<ide> After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link."
<ide>
<ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/neural-network-sms-text-classifier.md
<ide> dashedName: neural-network-sms-text-classifier
<ide>
<ide> # --description--
<ide>
<del>You will be [working on this project with Google Colaboratory](https://colab.research.google.com/github/freeCodeCamp/boilerplate-neural-network-sms-text-classifier/blob/master/fcc_sms_text_classification.ipynb).
<add>You will be <a href="https://colab.research.google.com/github/freeCodeCamp/boilerplate-neural-network-sms-text-classifier/blob/master/fcc_sms_text_classification.ipynb" target="_blank" rel="noopener noreferrer nofollow">working on this project with Google Colaboratory</a>.
<ide>
<ide> After going to that link, create a copy of the notebook either in your own account or locally. Once you complete the project and it passes the test (included at that link), submit your project link below. If you are submitting a Google Colaboratory link, make sure to turn on link sharing for "anyone with the link."
<ide>
<ide> In this challenge, you need to create a machine learning model that will classif
<ide>
<ide> You should create a function called `predict_message` that takes a message string as an argument and returns a list. The first element in the list should be a number between zero and one that indicates the likeliness of "ham" (0) or "spam" (1). The second element in the list should be the word "ham" or "spam", depending on which is most likely.
<ide>
<del>For this challenge, you will use the [SMS Spam Collection](http://www.dt.fee.unicamp.br/~tiago/smsspamcollection/) dataset. The dataset has already been grouped into train data and test data.
<add>For this challenge, you will use the <a href="http://www.dt.fee.unicamp.br/~tiago/smsspamcollection/" target="_blank" rel="noopener noreferrer nofollow">SMS Spam Collection</a> dataset. The dataset has already been grouped into train data and test data.
<ide>
<ide> The first two cells import the libraries and data. The final cell tests your model and function. Add your code in between these cells.
<ide>
<ide><path>curriculum/challenges/english/11-machine-learning-with-python/machine-learning-with-python-projects/rock-paper-scissors.md
<ide> dashedName: rock-paper-scissors
<ide>
<ide> For this challenge, you will create a program to play Rock, Paper, Scissors. A program that picks at random will usually win 50% of the time. To pass this challenge your program must play matches against four different bots, winning at least 60% of the games in each match.
<ide>
<del>You will be [working on this project with our Replit starter code](https://replit.com/github/freeCodeCamp/boilerplate-rock-paper-scissors).
<add>You will be <a href="https://replit.com/github/freeCodeCamp/boilerplate-rock-paper-scissors" target="_blank" rel="noopener noreferrer nofollow">working on this project with our Replit starter code</a>.
<ide>
<ide> We are still developing the interactive instructional part of the machine learning curriculum. For now, you will have to use other resources to learn how to pass this challenge.
<ide> | 25 |
Ruby | Ruby | update #resources documentation [ci skip] | c5fcc9ad1cd95854c3c8129f453982c6acd8fd61 | <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb
<ide> def resource(*resources, &block)
<ide> # sekret_comment PATCH/PUT /comments/:id(.:format)
<ide> # sekret_comment DELETE /comments/:id(.:format)
<ide> #
<add> # [:format]
<add> # Allows you to specify default value for optional +format+ segment
<add> # or disable it if you supply +false+
<add> #
<ide> # === Examples
<ide> #
<ide> # # routes call <tt>Admin::PostsController</tt> | 1 |
PHP | PHP | apply fixes from styleci | 2a6902866e4db7a0de65cbaf33a6cbd20b77834e | <ide><path>src/Illuminate/Foundation/Console/Kernel.php
<ide> use Illuminate\Contracts\Debug\ExceptionHandler;
<ide> use Illuminate\Contracts\Foundation\Application;
<ide> use Illuminate\Contracts\Cache\Repository as Cache;
<del>use Illuminate\Contracts\Queue\Queue as QueueContract;
<ide> use Illuminate\Contracts\Console\Kernel as KernelContract;
<ide> use Symfony\Component\Debug\Exception\FatalThrowableError;
<ide>
<ide><path>src/Illuminate/Foundation/Console/QueuedCommand.php
<ide> namespace Illuminate\Foundation\Console;
<ide>
<ide> use Illuminate\Bus\Queueable;
<del>use Illuminate\Foundation\Bus\Dispatchable;
<ide> use Illuminate\Contracts\Queue\ShouldQueue;
<add>use Illuminate\Foundation\Bus\Dispatchable;
<ide> use Illuminate\Contracts\Console\Kernel as KernelContract;
<ide>
<ide> class QueuedCommand implements ShouldQueue | 2 |
Ruby | Ruby | replace map.flatten with flat_map in activerecord | 3413b88a3d6b2b022dfb57e42565446b1e024314 | <ide><path>activerecord/lib/active_record/associations.rb
<ide> def association_instance_set(name, association)
<ide> # end
<ide> #
<ide> # @firm = Firm.first
<del> # @firm.clients.collect { |c| c.invoices }.flatten # select all invoices for all clients of the firm
<del> # @firm.invoices # selects all invoices by going through the Client join model
<add> # @firm.clients.flat_map { |c| c.invoices } # select all invoices for all clients of the firm
<add> # @firm.invoices # selects all invoices by going through the Client join model
<ide> #
<ide> # Similarly you can go through a +has_one+ association on the join model:
<ide> #
<ide><path>activerecord/lib/active_record/associations/preloader/through_association.rb
<ide> def associated_records_by_owner(preloader)
<ide>
<ide> reset_association owners, through_reflection.name
<ide>
<del> middle_records = through_records.map { |(_,rec)| rec }.flatten
<add> middle_records = through_records.flat_map { |(_,rec)| rec }
<ide>
<ide> preloaders = preloader.preload(middle_records,
<ide> source_reflection.name,
<ide><path>activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
<ide> def create_table(table_name, options = {}) #:nodoc:
<ide> end
<ide>
<ide> def bulk_change_table(table_name, operations) #:nodoc:
<del> sqls = operations.map do |command, args|
<add> sqls = operations.flat_map do |command, args|
<ide> table, arguments = args.shift, args
<ide> method = :"#{command}_sql"
<ide>
<ide> def bulk_change_table(table_name, operations) #:nodoc:
<ide> else
<ide> raise "Unknown method called : #{method}(#{arguments.inspect})"
<ide> end
<del> end.flatten.join(", ")
<add> end.join(", ")
<ide>
<ide> execute("ALTER TABLE #{quote_table_name(table_name)} #{sqls}")
<ide> end
<ide><path>activerecord/test/cases/associations/callbacks_test.rb
<ide> def test_has_and_belongs_to_many_remove_callback_on_clear
<ide> activerecord.reload
<ide> assert activerecord.developers_with_callbacks.size == 2
<ide> end
<del> log_array = activerecord.developers_with_callbacks.collect {|d| ["before_removing#{d.id}","after_removing#{d.id}"]}.flatten.sort
<add> log_array = activerecord.developers_with_callbacks.flat_map {|d| ["before_removing#{d.id}","after_removing#{d.id}"]}.sort
<ide> assert activerecord.developers_with_callbacks.clear
<ide> assert_equal log_array, activerecord.developers_log.sort
<ide> end
<ide><path>activerecord/test/cases/autosave_association_test.rb
<ide> def assert_no_difference_when_adding_callbacks_twice_for(model, association_name
<ide> end
<ide>
<ide> def callbacks_for_model(model)
<del> model.instance_variables.grep(/_callbacks$/).map do |ivar|
<add> model.instance_variables.grep(/_callbacks$/).flat_map do |ivar|
<ide> model.instance_variable_get(ivar)
<del> end.flatten
<add> end
<ide> end
<ide> end
<ide> | 5 |
Python | Python | fix activityreg layer | 24501d4361606d6305e9eaeadaf1cd1bbb8dfab6 | <ide><path>keras/layers/core.py
<ide> def __init__(self, l1=0., l2=0., **kwargs):
<ide> self.l1 = l1
<ide> self.l2 = l2
<ide>
<add> super(ActivityRegularization, self).__init__(**kwargs)
<ide> activity_regularizer = ActivityRegularizer(l1=l1, l2=l2)
<ide> activity_regularizer.set_layer(self)
<ide> self.regularizers = [activity_regularizer]
<del> super(ActivityRegularization, self).__init__(**kwargs)
<ide>
<ide> def get_config(self):
<ide> config = {'l1': self.l1, | 1 |
Ruby | Ruby | use the correct default compiler | c90552f66bb174e3c0c69de88ce389acbedbac8b | <ide><path>Library/Homebrew/tab.rb
<ide> def self.empty
<ide> "source_modified_time" => 0,
<ide> "HEAD" => nil,
<ide> "stdlib" => nil,
<del> "compiler" => "clang",
<add> "compiler" => DevelopmentTools.default_compiler,
<ide> "source" => {
<ide> "path" => nil,
<ide> "tap" => nil, | 1 |
Ruby | Ruby | decrease memory allocations in cache.rb | 6da99b4e99c90c63015f0d1cb4bf10983ea26a36 | <ide><path>activesupport/lib/active_support/cache.rb
<ide> def delete_entry(key, options)
<ide> # Merges the default options with ones specific to a method call.
<ide> def merged_options(call_options)
<ide> if call_options
<del> options.merge(call_options)
<add> if options.empty?
<add> call_options
<add> else
<add> options.merge(call_options)
<add> end
<ide> else
<del> options.dup
<add> options
<ide> end
<ide> end
<ide> | 1 |
PHP | PHP | fix quoting of field names containing `-` | e8b5d81fd728725279dd60005d07319bdaa5f4a6 | <ide><path>lib/Cake/Model/Datasource/DboSource.php
<ide> public function fields(Model $model, $alias = null, $fields = array(), $quote =
<ide> }
<ide> $fields = array_values($fields);
<ide> }
<del>
<ide> if (!$quote) {
<ide> if (!empty($virtual)) {
<ide> $fields = array_merge($fields, $this->_constructVirtualFields($model, $alias, $virtual));
<ide> protected function _quoteFields($conditions) {
<ide> $end = preg_quote($this->endQuote);
<ide> }
<ide> $conditions = str_replace(array($start, $end), '', $conditions);
<del> $conditions = preg_replace_callback('/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_' . $start . $end . ']*\\.[a-z0-9_' . $start . $end . ']*)/i', array(&$this, '_quoteMatchedField'), $conditions);
<del>
<add> $conditions = preg_replace_callback(
<add> '/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9\\-_' . $start . $end . ']*\\.[a-z0-9_\\-' . $start . $end . ']*)/i',
<add> array(&$this, '_quoteMatchedField'),
<add> $conditions
<add> );
<ide> if ($conditions !== null) {
<ide> return $conditions;
<ide> }
<ide><path>lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
<ide> public function testLocaleMultiple() {
<ide> )
<ide> )
<ide> );
<del>
<ide> $this->assertEquals($expected, $result);
<add>
<add> $TestModel = new TranslatedItem();
<add> $TestModel->locale = array('pt-br');
<add> $result = $TestModel->find('all');
<add> $this->assertCount(3, $result, '3 records should have been found, no SQL error.');
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
<ide> public function testQuotesInStringConditions() {
<ide> $result = $this->Dbo->conditions('Member.email = "mariano@cricava.com" AND Member.user LIKE "mariano.iglesias%"');
<ide> $expected = ' WHERE `Member`.`email` = "mariano@cricava.com" AND `Member`.`user` LIKE "mariano.iglesias%"';
<ide> $this->assertEquals($expected, $result);
<add>
<add> $result = $this->Dbo->conditions('I18n__title_pt-br.content = "test"');
<add> $this->assertEquals(' WHERE `I18n__title_pt-br`.`content` = "test"', $result);
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
<ide> public function testName() {
<ide> $expected = 'Function(`Something`.`foo`) AS `x`';
<ide> $this->assertEquals($expected, $result);
<ide>
<add> $result = $this->testDb->name('I18n__title__pt-br.locale');
<add> $expected = '`I18n__title__pt-br`.`locale`';
<add> $this->assertEquals($expected, $result);
<add>
<ide> $result = $this->testDb->name('name-with-minus');
<ide> $expected = '`name-with-minus`';
<ide> $this->assertEquals($expected, $result); | 4 |
PHP | PHP | fix failing test | de9c82edcd1c106fd6903e86efa63a4284a0c06e | <ide><path>tests/TestCase/View/Helper/FormHelperTest.php
<ide> public function testDay()
<ide> {
<ide> extract($this->dateRegex);
<ide>
<del> $result = $this->Form->day('Model.field', array('value' => false));
<add> $result = $this->Form->day('Model.field', array('value' => ''));
<ide> $expected = array(
<ide> array('select' => array('name' => 'Model[field][day]')),
<ide> array('option' => array('selected' => 'selected', 'value' => '')), | 1 |
PHP | PHP | fix method annotation | 70faadda5ed8f317134f8c1fbce0eb8a5b1d8067 | <ide><path>src/Datasource/ConnectionInterface.php
<ide> * @method \Cake\Database\StatementInterface prepare($sql)
<ide> * @method \Cake\Database\StatementInterface execute($query, $params = [], array $types = [])
<ide> * @method $this enableQueryLogging($value)
<del> * @method bool isQueryLoggingEnabled(value)
<add> * @method bool isQueryLoggingEnabled()
<ide> * @method string quote($value, $type = null)
<ide> */
<ide> interface ConnectionInterface | 1 |
Javascript | Javascript | add test for requote | ffb445bb1b581dd1e780d043cb130479300e5681 | <ide><path>d3.js
<ide> d3.requote = function(s) {
<ide> return s.replace(d3_requote_re, "\\$&");
<ide> };
<ide>
<del>var d3_requote_re = /[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;
<add>var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
<ide> d3.round = function(x, n) {
<ide> return n
<ide> ? Math.round(x * Math.pow(10, n)) * Math.pow(10, -n)
<ide><path>d3.min.js
<del>(function(){function ct(){return"circle"}function cs(){return 64}function cr(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cq<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cq=!e.f&&!e.e,d.remove()}cq?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cp(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bB;return[c*Math.cos(d),c*Math.sin(d)]}}function co(a){return[a.x,a.y]}function cn(a){return a.endAngle}function cm(a){return a.startAngle}function cl(a){return a.radius}function ck(a){return a.target}function cj(a){return a.source}function ci(a){return function(b,c){return a[c][1]}}function ch(a){return function(b,c){return a[c][0]}}function cg(a){function i(f){if(f.length<1)return null;var i=bI(this,f,b,d),j=bI(this,f,b===c?ch(i):c,d===e?ci(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bJ,c=bJ,d=0,e=bK,f="linear",g=bL[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bL[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cf(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bB,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function ce(a){return a.length<3?bM(a):a[0]+bS(a,cd(a))}function cd(a){var b=[],c,d,e,f,g=cc(a),h=-1,i=a.length-1;while(++h<i)c=cb(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cc(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cb(e,f);while(++b<c)d[b]=g+(g=cb(e=f,f=a[b+1]));d[b]=g;return d}function cb(a,b){return(b[1]-a[1])/(b[0]-a[0])}function ca(a,b,c){a.push("C",bY(bZ,b),",",bY(bZ,c),",",bY(b$,b),",",bY(b$,c),",",bY(b_,b),",",bY(b_,c))}function bY(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bX(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return bU(a)}function bW(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bY(b_,g),",",bY(b_,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),ca(b,g,h);return b.join("")}function bV(a){if(a.length<4)return bM(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(bY(b_,f)+","+bY(b_,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),ca(b,f,g);return b.join("")}function bU(a){if(a.length<3)return bM(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),ca(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),ca(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),ca(b,h,i);return b.join("")}function bT(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bS(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bM(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bR(a,b,c){return a.length<3?bM(a):a[0]+bS(a,bT(a,b))}function bQ(a,b){return a.length<3?bM(a):a[0]+bS((a.push(a[0]),a),bT([a[a.length-2]].concat(a,[a[1]]),b))}function bP(a,b){return a.length<4?bM(a):a[1]+bS(a.slice(1,a.length-1),bT(a,b))}function bO(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bN(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bM(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bK(a){return a[1]}function bJ(a){return a[0]}function bI(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bH(a){function g(d){return d.length<1?null:"M"+e(a(bI(this,d,b,c)),f)}var b=bJ,c=bK,d="linear",e=bL[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bL[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bG(a){return a.endAngle}function bF(a){return a.startAngle}function bE(a){return a.outerRadius}function bD(a){return a.innerRadius}function bw(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bv(a){return a.toPrecision(1)}function bu(a){return-Math.log(-a)/Math.LN10}function bt(a){return Math.log(a)/Math.LN10}function bs(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function br(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bq(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bo(a,b)[2])/Math.LN10+.01))+"f")}function bp(a,b){return d3.range.apply(d3,bo(a,b))}function bo(a,b){var c=bj(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bn(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bm(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bl(){return Math}function bk(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bj(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bi(){}function bg(){var a=null,b=bb,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bb=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bf(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,a>c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bg()-b;d>24?(isFinite(d)&&(clearTimeout(bd),bd=setTimeout(bf,d)),bc=0):(bc=1,bh(bf))}function be(a,b){var c=Date.now(),d=!1,e,f=bb;if(!!isFinite(b)){while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bb={callback:a,then:c,delay:b,next:bb}),bc||(bd=clearTimeout(bd),bc=1,bh(bf))}}function ba(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function _(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!==2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!==c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)if(o=d[p].apply(this,arguments))q[p]=o}o=m(a);for(p in q)q[p].call(this,o);if(a===1){i[l]=2;if(n.active===c){var r=n.owner;r===c&&(delete this.__transition__,f&&this.parentNode&&this.parentNode.removeChild(this)),$=c,g.end.dispatch.apply(this,arguments),$=0,n.owner=r}}}});return h}var b={},c=$||++Z,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),be(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,ba(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,ba(c),d)},b.text=function(a){d.text=function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a};return b},b.select=function(b){var c,d=_(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=_(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function Y(a){return{__data__:a}}function X(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return V(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function V(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return V(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return V(c)}a.select=function(a){return b(function(b){return S(a,b)})},a.selectAll=function(a){return c(function(b){return T(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return V(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=Y(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=V(e);k.enter=function(){return W(d)},k.exit=function(){return V(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){if(a=this.classList)return a.remove(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;d=g(d.replace(e," ")),c?a.baseVal=d:this.className=d}function f(){if(a=this.classList)return a.add(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;e.lastIndex=0,e.test(d)||(d=g(d+" "+b),c?a.baseVal=d:this.className=d)}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){if(a=this.classList)return a.contains(b);var a=this.className;e.lastIndex=0;return e.test(a.baseVal!=null?a.baseVal:a)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e="");if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function e(){this.textContent=b.apply(this,arguments)}function c(){this.textContent=b}if(arguments.length<1)return d(function(){return this.textContent});return a.each(typeof b=="function"?e:c)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=X.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c,d){arguments.length<3&&(d=!1);var e=b.indexOf("."),f=e===-1?b:b.substring(0,e),g="__on"+b;return a.each(function(a,b){function h(a){var d=d3.event;d3.event=a;try{c.call(this,e.__data__,b)}finally{d3.event=d}}this[g]&&this.removeEventListener(f,this[g],d),c&&this.addEventListener(f,this[g]=h,d);var e=this})},a.transition=function(){return _(a)},a.call=h;return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return a?Math.pow(2,10*(a-1))-.001:0}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.29.3"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,e),c=Array(b);++a<b;)for(var d=-1,f,g=c[a]=Array(f);++d<f;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length===1&&(b=a,a=0),c==null&&(c=1);if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,b-c))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length===1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var S=function(a,b){return b.querySelector(a)},T=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(S=function(a,b){return Sizzle(a,b)[0]},T=function(
<add>(function(){function ct(){return"circle"}function cs(){return 64}function cr(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cq<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cq=!e.f&&!e.e,d.remove()}cq?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cp(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bB;return[c*Math.cos(d),c*Math.sin(d)]}}function co(a){return[a.x,a.y]}function cn(a){return a.endAngle}function cm(a){return a.startAngle}function cl(a){return a.radius}function ck(a){return a.target}function cj(a){return a.source}function ci(a){return function(b,c){return a[c][1]}}function ch(a){return function(b,c){return a[c][0]}}function cg(a){function i(f){if(f.length<1)return null;var i=bI(this,f,b,d),j=bI(this,f,b===c?ch(i):c,d===e?ci(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bJ,c=bJ,d=0,e=bK,f="linear",g=bL[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bL[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cf(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bB,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function ce(a){return a.length<3?bM(a):a[0]+bS(a,cd(a))}function cd(a){var b=[],c,d,e,f,g=cc(a),h=-1,i=a.length-1;while(++h<i)c=cb(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cc(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cb(e,f);while(++b<c)d[b]=g+(g=cb(e=f,f=a[b+1]));d[b]=g;return d}function cb(a,b){return(b[1]-a[1])/(b[0]-a[0])}function ca(a,b,c){a.push("C",bY(bZ,b),",",bY(bZ,c),",",bY(b$,b),",",bY(b$,c),",",bY(b_,b),",",bY(b_,c))}function bY(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bX(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return bU(a)}function bW(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bY(b_,g),",",bY(b_,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),ca(b,g,h);return b.join("")}function bV(a){if(a.length<4)return bM(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(bY(b_,f)+","+bY(b_,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),ca(b,f,g);return b.join("")}function bU(a){if(a.length<3)return bM(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),ca(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),ca(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),ca(b,h,i);return b.join("")}function bT(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bS(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bM(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bR(a,b,c){return a.length<3?bM(a):a[0]+bS(a,bT(a,b))}function bQ(a,b){return a.length<3?bM(a):a[0]+bS((a.push(a[0]),a),bT([a[a.length-2]].concat(a,[a[1]]),b))}function bP(a,b){return a.length<4?bM(a):a[1]+bS(a.slice(1,a.length-1),bT(a,b))}function bO(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bN(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bM(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bK(a){return a[1]}function bJ(a){return a[0]}function bI(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bH(a){function g(d){return d.length<1?null:"M"+e(a(bI(this,d,b,c)),f)}var b=bJ,c=bK,d="linear",e=bL[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bL[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bG(a){return a.endAngle}function bF(a){return a.startAngle}function bE(a){return a.outerRadius}function bD(a){return a.innerRadius}function bw(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bv(a){return a.toPrecision(1)}function bu(a){return-Math.log(-a)/Math.LN10}function bt(a){return Math.log(a)/Math.LN10}function bs(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function br(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bq(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bo(a,b)[2])/Math.LN10+.01))+"f")}function bp(a,b){return d3.range.apply(d3,bo(a,b))}function bo(a,b){var c=bj(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bn(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bm(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bl(){return Math}function bk(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bj(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bi(){}function bg(){var a=null,b=bb,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bb=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bf(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,a>c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bg()-b;d>24?(isFinite(d)&&(clearTimeout(bd),bd=setTimeout(bf,d)),bc=0):(bc=1,bh(bf))}function be(a,b){var c=Date.now(),d=!1,e,f=bb;if(!!isFinite(b)){while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bb={callback:a,then:c,delay:b,next:bb}),bc||(bd=clearTimeout(bd),bc=1,bh(bf))}}function ba(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function _(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!==2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!==c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)if(o=d[p].apply(this,arguments))q[p]=o}o=m(a);for(p in q)q[p].call(this,o);if(a===1){i[l]=2;if(n.active===c){var r=n.owner;r===c&&(delete this.__transition__,f&&this.parentNode&&this.parentNode.removeChild(this)),$=c,g.end.dispatch.apply(this,arguments),$=0,n.owner=r}}}});return h}var b={},c=$||++Z,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),be(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,ba(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,ba(c),d)},b.text=function(a){d.text=function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a};return b},b.select=function(b){var c,d=_(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=_(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function Y(a){return{__data__:a}}function X(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return V(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function V(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return V(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return V(c)}a.select=function(a){return b(function(b){return S(a,b)})},a.selectAll=function(a){return c(function(b){return T(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return V(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=Y(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=V(e);k.enter=function(){return W(d)},k.exit=function(){return V(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){if(a=this.classList)return a.remove(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;d=g(d.replace(e," ")),c?a.baseVal=d:this.className=d}function f(){if(a=this.classList)return a.add(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;e.lastIndex=0,e.test(d)||(d=g(d+" "+b),c?a.baseVal=d:this.className=d)}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){if(a=this.classList)return a.contains(b);var a=this.className;e.lastIndex=0;return e.test(a.baseVal!=null?a.baseVal:a)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e="");if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function e(){this.textContent=b.apply(this,arguments)}function c(){this.textContent=b}if(arguments.length<1)return d(function(){return this.textContent});return a.each(typeof b=="function"?e:c)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=X.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c,d){arguments.length<3&&(d=!1);var e=b.indexOf("."),f=e===-1?b:b.substring(0,e),g="__on"+b;return a.each(function(a,b){function h(a){var d=d3.event;d3.event=a;try{c.call(this,e.__data__,b)}finally{d3.event=d}}this[g]&&this.removeEventListener(f,this[g],d),c&&this.addEventListener(f,this[g]=h,d);var e=this})},a.transition=function(){return _(a)},a.call=h;return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return a?Math.pow(2,10*(a-1))-.001:0}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.29.3"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,e),c=Array(b);++a<b;)for(var d=-1,f,g=c[a]=Array(f);++d<f;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length===1&&(b=a,a=0),c==null&&(c=1);if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,b-c))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length===1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var S=function(a,b){return b.querySelector(a)},T=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(S=function(a,b){return Sizzle(a,b)[0]},T=function(
<ide> a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var U=V([[document]]);U[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?U.select(a):V([[a]])},d3.selectAll=function(b){return typeof b=="string"?U.selectAll(b):V([a(b)])},d3.transition=U.transition;var Z=0,$=0,bb=null,bc,bd;d3.timer=function(a){be(a,0)},d3.timer.flush=function(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bg()};var bh=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function h(a){return e(a)}function g(){var g=a.length==2?br:bs,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var a=[0,1],b=[0,1],c=d3.interpolate,d=!1,e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bp(a,b)},h.tickFormat=function(b){return bq(a,b)},h.nice=function(){bk(a,bn);return g()};return g()},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bt,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bu:bt,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bk(a.domain(),bl));return d},d.ticks=function(){var d=bj(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bu){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bv};return bm(d,a)},bt.pow=function(a){return Math.pow(10,a)},bu.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function e(b){return a(c(b))}var a=d3.scale.linear(),b=1,c=Number,d=c;e.invert=function(b){return d(a.invert(b))},e.domain=function(f){if(!arguments.length)return a.domain().map(d);c=bw(b),d=bw(1/b),a.domain(f.map(c));return e},e.ticks=function(a){return bp(e.domain(),a)},e.tickFormat=function(a){return bq(e.domain(),a)},e.nice=function(){return e.domain(bk(e.domain(),bn))},e.exponent=function(a){if(!arguments.length)return b;var c=e.domain();b=a;return e.domain(c)};return bm(e,a)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function f(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0,e=bi;f.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,g=-1,h=a.length;while(++d<h)c=a[d],c in b||(b[c]=++g);e();return f},f.range=function(a){if(!arguments.length)return c;c=a,e=bi;return f},f.rangePoints=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=(f-e)/(a.length-1+g);c=a.length==1?[(e+f)/2]:d3.range(e+h*g/2,f+h/2,h),d=0})();return f},f.rangeBands=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=(f-e)/(a.length+g);c=d3.range(e+h*g,f,h),d=h*(1-g)})();return f},f.rangeRoundBands=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=f-e,i=Math.floor(h/(a.length+g)),j=h-(a.length-g)*i;c=d3.range(e+Math.round(j/2),f,i),d=Math.round(i*(1-g))})();return f},f.rangeBand=function(){return d};return f},d3.scale.category10=function(){return d3.scale.ordinal().range(bx)},d3.scale.category20=function(){return d3.scale.ordinal().range(by)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bz)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bA)};var bx=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],by=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bz=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bA=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function e(a){if(isNaN(a=+a))return NaN;return b[d3.bisect(c,a)]}function d(){var d=0,e=a.length,f=b.length;c.length=Math.max(0,f-1);while(++d<f)c[d-1]=d3.quantile(a,d/f)}var a=[],b=[],c=[];e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return e},e.range=function(a){if(!arguments.length)return b;b=a,d();return e},e.quantiles=function(){return c};return e},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bB,h=d.apply(this,arguments)+bB,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bC?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bD,b=bE,c=bF,d=bG;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bB;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bB=-Math.PI/2,bC=2*Math.PI-1e-6;d3.svg.line=function(){return bH(Object)};var bL={linear:bM,"step-before":bN,"step-after":bO,basis:bU,"basis-open":bV,"basis-closed":bW,bundle:bX,cardinal:bR,"cardinal-open":bP,"cardinal-closed":bQ,monotone:ce},bZ=[0,2/3,1/3,0],b$=[0,1/3,2/3,0],b_=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bH(cf);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cg(Object)},d3.svg.area.radial=function(){var a=cg(cf);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bB,k=e.call(a,h,g)+bB;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cj,b=ck,c=cl,d=bF,e=bG;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cj,b=ck,c=co;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=co,c=a.projection;a.projection=function(a){return arguments.length?c(cp(b=a)):b};return a},d3.svg.mouse=function(a){return cr(a,d3.event)};var cq=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=cr(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cu[a.call(this,c,d)]||cu.circle)(b.call(this,c,d))}var a=ct,b=cs;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cu={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cw)),c=b*cw;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cv),c=b*cv/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cv),c=b*cv/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cu);var cv=Math.sqrt(3),cw=Math.tan(30*Math.PI/180)})()
<ide>\ No newline at end of file
<ide><path>src/core/requote.js
<ide> d3.requote = function(s) {
<ide> return s.replace(d3_requote_re, "\\$&");
<ide> };
<ide>
<del>var d3_requote_re = /[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;
<add>var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
<ide><path>test/core/requote-test.js
<add>require("../env");
<add>require("../../d3");
<add>
<add>var vows = require("vows"),
<add> assert = require("assert");
<add>
<add>var suite = vows.describe("d3.requote");
<add>
<add>suite.addBatch({
<add> "requote": {
<add> topic: function() {
<add> return d3.requote;
<add> },
<add> "quotes backslashes": function(quote) {
<add> assert.equal(quote("\\"), "\\\\");
<add> },
<add> "quotes carets": function(quote) {
<add> assert.equal(quote("^"), "\\^");
<add> },
<add> "quotes dollar signs": function(quote) {
<add> assert.equal(quote("$"), "\\$");
<add> },
<add> "quotes stars": function(quote) {
<add> assert.equal(quote("*"), "\\*");
<add> },
<add> "quotes plusses": function(quote) {
<add> assert.equal(quote("+"), "\\+");
<add> },
<add> "quotes question marks": function(quote) {
<add> assert.equal(quote("?"), "\\?");
<add> },
<add> "quotes periods": function(quote) {
<add> assert.equal(quote("."), "\\.");
<add> },
<add> "quotes parentheses": function(quote) {
<add> assert.equal(quote("("), "\\(");
<add> assert.equal(quote(")"), "\\)");
<add> },
<add> "quotes pipes": function(quote) {
<add> assert.equal(quote("|"), "\\|");
<add> },
<add> "quotes curly braces": function(quote) {
<add> assert.equal(quote("{"), "\\{");
<add> assert.equal(quote("}"), "\\}");
<add> },
<add> "quotes square brackets": function(quote) {
<add> assert.equal(quote("["), "\\[");
<add> assert.equal(quote("]"), "\\]");
<add> }
<add> }
<add>});
<add>
<add>suite.export(module); | 4 |
Javascript | Javascript | correct error message for invalid trailer | 31bef6b704d7018b4e11778520accfe1e6001b73 | <ide><path>lib/_http_outgoing.js
<ide> OutgoingMessage.prototype.addTrailers = function(headers) {
<ide> 'Trailer name must be a valid HTTP Token ["' + field + '"]');
<ide> }
<ide> if (common._checkInvalidHeaderChar(value) === true) {
<del> throw new TypeError('The header content contains invalid characters');
<add> throw new TypeError('The trailer content contains invalid characters');
<ide> }
<ide> this._trailer += field + ': ' + escapeHeaderValue(value) + CRLF;
<ide> } | 1 |
Java | Java | fix javadoc comments to match behaviour | cc87fbcb7fba7c4f630842d5f88692ae1228a7b3 | <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java
<ide> * </tr>
<ide> * <tr class="altColor">
<ide> * <td><p>MissingServletRequestParameterException</p></td>
<del> * <td><p>500 (SC_INTERNAL_SERVER_ERROR)</p></td>
<add> * <td><p>400 (SC_BAD_REQUEST)</p></td>
<ide> * </tr>
<ide> * <tr class="rowColor">
<ide> * <td><p>ServletRequestBindingException</p></td>
<ide> protected ModelAndView handleServletRequestBindingException(ServletRequestBindin
<ide> /**
<ide> * Handle the case when a {@link org.springframework.web.bind.WebDataBinder} conversion cannot occur.
<ide> * <p>The default implementation sends an HTTP 500 error, and returns an empty {@code ModelAndView}.
<del> * Alternatively, a fallback view could be chosen, or the TypeMismatchException could be rethrown as-is.
<add> * Alternatively, a fallback view could be chosen, or the ConversionNotSupportedException could be
<add> * rethrown as-is.
<ide> * @param ex the ConversionNotSupportedException to be handled
<ide> * @param request current HTTP request
<ide> * @param response current HTTP response
<ide> protected ModelAndView handleTypeMismatch(TypeMismatchException ex,
<ide> * Handle the case where a {@linkplain org.springframework.http.converter.HttpMessageConverter message converter}
<ide> * cannot read from a HTTP request.
<ide> * <p>The default implementation sends an HTTP 400 error, and returns an empty {@code ModelAndView}.
<del> * Alternatively, a fallback view could be chosen, or the HttpMediaTypeNotSupportedException could be
<add> * Alternatively, a fallback view could be chosen, or the HttpMessageNotReadableException could be
<ide> * rethrown as-is.
<ide> * @param ex the HttpMessageNotReadableException to be handled
<ide> * @param request current HTTP request
<ide> protected ModelAndView handleHttpMessageNotReadable(HttpMessageNotReadableExcept
<ide> * {@linkplain org.springframework.http.converter.HttpMessageConverter message converter}
<ide> * cannot write to a HTTP request.
<ide> * <p>The default implementation sends an HTTP 500 error, and returns an empty {@code ModelAndView}.
<del> * Alternatively, a fallback view could be chosen, or the HttpMediaTypeNotSupportedException could
<add> * Alternatively, a fallback view could be chosen, or the HttpMessageNotWritableException could
<ide> * be rethrown as-is.
<ide> * @param ex the HttpMessageNotWritableException to be handled
<ide> * @param request current HTTP request | 1 |
Javascript | Javascript | avoid drain for sync streams | 003fb53c9a38520e84bd18beb7719f1a47af8c43 | <ide><path>benchmark/streams/writable-manywrites.js
<ide> const bench = common.createBenchmark(main, {
<ide> n: [2e6],
<ide> sync: ['yes', 'no'],
<ide> writev: ['yes', 'no'],
<del> callback: ['yes', 'no']
<add> callback: ['yes', 'no'],
<add> len: [1024, 32 * 1024]
<ide> });
<ide>
<del>function main({ n, sync, writev, callback }) {
<del> const b = Buffer.allocUnsafe(1024);
<add>function main({ n, sync, writev, callback, len }) {
<add> const b = Buffer.allocUnsafe(len);
<ide> const s = new Writable();
<ide> sync = sync === 'yes';
<ide>
<ide><path>lib/_stream_writable.js
<ide> function writeOrBuffer(stream, state, chunk, encoding, callback) {
<ide>
<ide> state.length += len;
<ide>
<del> const ret = state.length < state.highWaterMark;
<del> // We must ensure that previous needDrain will not be reset to false.
<del> if (!ret)
<del> state.needDrain = true;
<del>
<ide> if (state.writing || state.corked || state.errored) {
<ide> state.buffered.push({ chunk, encoding, callback });
<ide> if (state.allBuffers && encoding !== 'buffer') {
<ide> function writeOrBuffer(stream, state, chunk, encoding, callback) {
<ide> state.sync = false;
<ide> }
<ide>
<add> const ret = state.length < state.highWaterMark;
<add>
<add> // We must ensure that previous needDrain will not be reset to false.
<add> if (!ret)
<add> state.needDrain = true;
<add>
<ide> // Return false if errored or destroyed in order to break
<ide> // any synchronous while(stream.write(data)) loops.
<ide> return ret && !state.errored && !state.destroyed;
<ide><path>test/parallel/test-stream-big-packet.js
<ide> class TestStream extends stream.Transform {
<ide> }
<ide> }
<ide>
<del>const s1 = new stream.PassThrough();
<add>const s1 = new stream.Transform({
<add> transform(chunk, encoding, cb) {
<add> process.nextTick(cb, null, chunk);
<add> }
<add>});
<ide> const s2 = new stream.PassThrough();
<ide> const s3 = new TestStream();
<ide> s1.pipe(s3);
<ide><path>test/parallel/test-stream-catch-rejections.js
<ide> const assert = require('assert');
<ide> captureRejections: true,
<ide> highWaterMark: 1,
<ide> write(chunk, enc, cb) {
<del> cb();
<add> process.nextTick(cb);
<ide> }
<ide> });
<ide>
<ide><path>test/parallel/test-stream-pipe-await-drain-push-while-write.js
<ide> const writable = new stream.Writable({
<ide> });
<ide> }
<ide>
<del> cb();
<add> process.nextTick(cb);
<ide> }, 3)
<ide> });
<ide>
<ide><path>test/parallel/test-stream-pipe-await-drain.js
<ide> reader._read = () => {};
<ide>
<ide> writer1._write = common.mustCall(function(chunk, encoding, cb) {
<ide> this.emit('chunk-received');
<del> cb();
<add> process.nextTick(cb);
<ide> }, 1);
<ide>
<ide> writer1.once('chunk-received', () => {
<ide> writer2._write = common.mustCall((chunk, encoding, cb) => {
<ide> reader._readableState.awaitDrainWriters.size,
<ide> 1,
<ide> 'awaitDrain should be 1 after first push, actual is ' +
<del> reader._readableState.awaitDrainWriters
<add> reader._readableState.awaitDrainWriters.size
<ide> );
<ide> // Not calling cb here to "simulate" slow stream.
<ide> // This should be called exactly once, since the first .write() call
<ide> writer3._write = common.mustCall((chunk, encoding, cb) => {
<ide> reader._readableState.awaitDrainWriters.size,
<ide> 2,
<ide> 'awaitDrain should be 2 after second push, actual is ' +
<del> reader._readableState.awaitDrainWriters
<add> reader._readableState.awaitDrainWriters.size
<ide> );
<ide> // Not calling cb here to "simulate" slow stream.
<ide> // This should be called exactly once, since the first .write() call
<ide><path>test/parallel/test-stream-writable-needdrain-state.js
<ide> const transform = new stream.Transform({
<ide> });
<ide>
<ide> function _transform(chunk, encoding, cb) {
<del> assert.strictEqual(transform._writableState.needDrain, true);
<del> cb();
<add> process.nextTick(() => {
<add> assert.strictEqual(transform._writableState.needDrain, true);
<add> cb();
<add> });
<ide> }
<ide>
<ide> assert.strictEqual(transform._writableState.needDrain, false);
<ide><path>test/parallel/test-stream2-finish-pipe.js
<ide> r._read = function(size) {
<ide>
<ide> const w = new stream.Writable();
<ide> w._write = function(data, encoding, cb) {
<del> cb(null);
<add> process.nextTick(cb, null);
<ide> };
<ide>
<ide> r.pipe(w); | 8 |
PHP | PHP | remove hyphen on email | ffc74ba143a7de4a89f2c3fd525a5621ca879e38 | <ide><path>resources/lang/en/passwords.php
<ide> */
<ide>
<ide> 'reset' => 'Your password has been reset!',
<del> 'sent' => 'We have e-mailed your password reset link!',
<add> 'sent' => 'We have emailed your password reset link!',
<ide> 'throttled' => 'Please wait before retrying.',
<ide> 'token' => 'This password reset token is invalid.',
<del> 'user' => "We can't find a user with that e-mail address.",
<add> 'user' => "We can't find a user with that email address.",
<ide>
<ide> ]; | 1 |
Ruby | Ruby | expose the request.parameter_filter | 365df75346cfda0c6abbe7ea1951393ce783f962 | <ide><path>actionpack/lib/action_dispatch/http/filter_parameters.rb
<ide> def initialize
<ide> @filtered_parameters = nil
<ide> @filtered_env = nil
<ide> @filtered_path = nil
<add> @parameter_filter = nil
<ide> end
<ide>
<ide> # Returns a hash of parameters with all sensitive data replaced.
<ide> def filtered_path
<ide> @filtered_path ||= query_string.empty? ? path : "#{path}?#{filtered_query_string}"
<ide> end
<ide>
<del> private
<del> def parameter_filter # :doc:
<del> parameter_filter_for fetch_header("action_dispatch.parameter_filter") {
<del> return NULL_PARAM_FILTER
<del> }
<add> # Returns the +ActiveSupport::ParameterFilter+ object used to filter in this request.
<add> def parameter_filter
<add> @parameter_filter ||= if has_header?("action_dispatch.parameter_filter")
<add> parameter_filter_for get_header("action_dispatch.parameter_filter")
<add> else
<add> NULL_PARAM_FILTER
<add> end
<ide> end
<ide>
<add> private
<ide> def env_filter # :doc:
<ide> user_key = fetch_header("action_dispatch.parameter_filter") {
<ide> return NULL_ENV_FILTER
<ide><path>actionpack/test/dispatch/request_test.rb
<ide> class RequestParameterFilter < BaseRequestTest
<ide> path = request.filtered_path
<ide> assert_equal request.script_name + "/authenticate?secret", path
<ide> end
<add>
<add> test "parameter_filter returns the same instance of ActiveSupport::ParameterFilter" do
<add> request = stub_request(
<add> "action_dispatch.parameter_filter" => [:secret]
<add> )
<add>
<add> filter = request.parameter_filter
<add>
<add> assert_kind_of ActiveSupport::ParameterFilter, filter
<add> assert_equal({ "secret" => "[FILTERED]", "something" => "bar" }, filter.filter("secret" => "foo", "something" => "bar"))
<add> assert_same filter, request.parameter_filter
<add> end
<ide> end
<ide>
<ide> class RequestEtag < BaseRequestTest | 2 |
Ruby | Ruby | use latest web-console when using --dev or --edge | 8275b65987e6ee6114463273485917e0c8db4397 | <ide><path>railties/lib/rails/generators/app_base.rb
<ide> def gemfile_entries
<ide> jbuilder_gemfile_entry,
<ide> sdoc_gemfile_entry,
<ide> psych_gemfile_entry,
<add> console_gemfile_entry,
<ide> @extra_entries].flatten.find_all(&@gem_filter)
<ide> end
<ide>
<ide> def sdoc_gemfile_entry
<ide> GemfileEntry.new('sdoc', '~> 0.4.0', comment, group: :doc)
<ide> end
<ide>
<add> def console_gemfile_entry
<add> comment = 'Use Rails Console on the Browser'
<add> if options.dev? || options.edge?
<add> GemfileEntry.github 'web-console', 'rails/web-console', comment
<add> else
<add> []
<add> end
<add> end
<add>
<ide> def coffee_gemfile_entry
<ide> comment = 'Use CoffeeScript for .coffee assets and views'
<ide> if options.dev? || options.edge? | 1 |
Text | Text | specify the stance on mocks in test blocks | 957f318f2cfb9e83f440572b12fd8b45a39e0776 | <ide><path>docs/Formula-Cookbook.md
<ide> Some advice for specific cases:
<ide> * If the formula is a library, compile and run some simple code that links against it. It could be taken from upstream's documentation / source examples.
<ide> A good example is [`tinyxml2`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/tinyxml2.rb), which writes a small C++ source file into the test directory, compiles and links it against the tinyxml2 library and finally checks that the resulting program runs successfully.
<ide> * If the formula is for a GUI program, try to find some function that runs as command-line only, like a format conversion, reading or displaying a config file, etc.
<del>* If the software cannot function without credentials or requires a virtual machine, docker instance, etc. to run, a test could be to try to connect with invalid credentials (or without credentials) and confirm that it fails as expected.
<add>* If the software cannot function without credentials or requires a virtual machine, docker instance, etc. to run, a test could be to try to connect with invalid credentials (or without credentials) and confirm that it fails as expected. This is prefered over mocking a dependency.
<ide> * Homebrew comes with a number of [standard test fixtures](https://github.com/Homebrew/brew/tree/master/Library/Homebrew/test/support/fixtures), including numerous sample images, sounds, and documents in various formats. You can get the file path to a test fixture with `test_fixtures("test.svg")`.
<ide> * If your test requires a test file that isn't a standard test fixture, you can install it from a source repository during the `test` phase with a resource block, like this:
<ide> | 1 |
Python | Python | fix code sample for leg2poly | b516cc24ec81fbc093f080c126dba9f360ceca52 | <ide><path>numpy/polynomial/legendre.py
<ide> def leg2poly(c):
<ide> >>> p = c.convert(kind=P.Polynomial)
<ide> >>> p
<ide> Polynomial([-1. , -3.5, 3. , 7.5], domain=[-1., 1.], window=[-1., 1.])
<del> >>> P.leg2poly(range(4))
<add> >>> P.legendre.leg2poly(range(4))
<ide> array([-1. , -3.5, 3. , 7.5])
<ide>
<ide> | 1 |
Java | Java | ignore fragile test dependent on debug symbols | 6f80578a387098bcf054249c512025ec81ae182b | <ide><path>org.springframework.core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java
<ide>
<ide> import junit.framework.TestCase;
<ide>
<add>import org.junit.Ignore;
<ide> import org.springframework.beans.TestBean;
<ide>
<ide> /**
<ide> public void testGenerifiedClass() throws Exception {
<ide> //System.in.read();
<ide> }
<ide>
<del> public void testMemUsage() throws Exception {
<add> /**
<add> * Ignored because Ubuntu packages OpenJDK with debug symbols enabled.
<add> * See SPR-8078.
<add> */
<add> @Ignore
<add> public void ignore_testClassesWithoutDebugSymbols() throws Exception {
<ide> // JDK classes don't have debug information (usually)
<ide> Class clazz = Component.class;
<ide> String methodName = "list"; | 1 |
Javascript | Javascript | prevent timeout errors | 01a03f2961f86cd08c6c90335101b0d10d141cad | <ide><path>client/src/templates/Challenges/utils/worker-executor.js
<ide> class WorkerExecutor {
<ide> constructor(
<ide> workerName,
<del> { location = '/js/', concurrency = 2, terminateWorker = false } = {}
<add> { location = '/js/', maxWorkers = 2, terminateWorker = false } = {}
<ide> ) {
<del> this._workerName = workerName;
<del> this._workers = [];
<del> this._queue = [];
<del> this._running = 0;
<del> this._concurrency = concurrency;
<add> this._workerPool = [];
<add> this._taskQueue = [];
<add> this._workersInUse = 0;
<add> this._maxWorkers = maxWorkers;
<ide> this._terminateWorker = terminateWorker;
<del> this._location = location;
<add> this._scriptURL = `${location}${workerName}.js`;
<ide>
<ide> this._getWorker = this._getWorker.bind(this);
<ide> }
<ide>
<ide> async _getWorker() {
<del> let worker;
<del> if (this._workers.length) {
<del> worker = this._workers.shift();
<del> } else {
<del> worker = await new Promise((resolve, reject) => {
<del> const worker = new Worker(`${this._location}${this._workerName}.js`);
<del> worker.onmessage = e => {
<del> if (e.data && e.data.type && e.data.type === 'contentLoaded') {
<del> resolve(worker);
<del> }
<del> };
<del> worker.onerror = err => reject(err);
<del> });
<del> }
<del> return worker;
<add> return this._workerPool.length
<add> ? this._workerPool.shift()
<add> : this._createWorker();
<ide> }
<ide>
<del> _pushTask(task) {
<del> this._queue.push(task);
<del> this._next();
<add> _createWorker() {
<add> return new Promise((resolve, reject) => {
<add> const newWorker = new Worker(this._scriptURL);
<add> newWorker.onmessage = e => {
<add> if (e.data?.type === 'contentLoaded') {
<add> resolve(newWorker);
<add> }
<add> };
<add> newWorker.onerror = err => reject(err);
<add> });
<ide> }
<ide>
<ide> _handleTaskEnd(task) {
<ide> return () => {
<del> this._running--;
<del> if (task._worker) {
<del> const worker = task._worker;
<add> this._workersInUse--;
<add> const worker = task._worker;
<add> if (worker) {
<ide> if (this._terminateWorker) {
<ide> worker.terminate();
<ide> } else {
<ide> worker.onmessage = null;
<ide> worker.onerror = null;
<del> this._workers.push(worker);
<add> this._workerPool.push(worker);
<ide> }
<ide> }
<del> this._next();
<add> this._processQueue();
<ide> };
<ide> }
<ide>
<del> _next() {
<del> while (this._running < this._concurrency && this._queue.length) {
<del> const task = this._queue.shift();
<add> _processQueue() {
<add> while (this._workersInUse < this._maxWorkers && this._taskQueue.length) {
<add> const task = this._taskQueue.shift();
<ide> const handleTaskEnd = this._handleTaskEnd(task);
<ide> task._execute(this._getWorker).done.then(handleTaskEnd, handleTaskEnd);
<del> this._running++;
<add> this._workersInUse++;
<ide> }
<ide> }
<ide>
<ide> class WorkerExecutor {
<ide> }, timeout);
<ide>
<ide> worker.onmessage = e => {
<del> if (e.data && e.data.type) {
<add> clearTimeout(timeoutId);
<add> // data.type is undefined when the message has been processed
<add> // successfully and defined when something else has happened (e.g.
<add> // an error occurred)
<add> if (e.data?.type) {
<ide> this.emit(e.data.type, e.data.data);
<del> return;
<add> } else {
<add> this.emit('done', e.data);
<ide> }
<del> clearTimeout(timeoutId);
<del> this.emit('done', e.data);
<ide> };
<ide>
<ide> worker.onerror = e => {
<ide> class WorkerExecutor {
<ide> .once('error', err => reject(err.message));
<ide> });
<ide>
<del> this._pushTask(task);
<add> this._taskQueue.push(task);
<add> this._processQueue();
<ide> return task;
<ide> }
<ide> }
<ide>
<add>// Error and completion handling
<ide> const eventify = self => {
<ide> self._events = {};
<ide>
<ide><path>client/src/templates/Challenges/utils/worker-executor.test.js
<ide> it('Worker executor should successfully execute 3 tasks, use 3 workers and termi
<ide> // eslint-disable-next-line max-len
<ide> it('Worker executor should successfully execute 3 tasks in parallel and use 3 workers', async () => {
<ide> mockWorker();
<del> const testWorker = createWorker('test', { concurrency: 3 });
<add> const testWorker = createWorker('test', { maxWorkers: 3 });
<ide>
<ide> const task1 = testWorker.execute('test1');
<ide> const task2 = testWorker.execute('test2');
<ide> it('Worker executor should successfully execute 3 tasks in parallel and use 3 wo
<ide> // eslint-disable-next-line max-len
<ide> it('Worker executor should successfully execute 3 tasks and use 1 worker', async () => {
<ide> mockWorker();
<del> const testWorker = createWorker('test', { concurrency: 1 });
<add> const testWorker = createWorker('test', { maxWorkers: 1 });
<ide>
<ide> const task1 = testWorker.execute('test1');
<ide> const task2 = testWorker.execute('test2'); | 2 |
Python | Python | switch map_index back to use server_default | 66276e68ba37abb2991cb0e03ca93c327fc63a09 | <ide><path>airflow/migrations/versions/e655c0453f75_add_taskmap_and_map_id_on_taskinstance.py
<ide> """
<ide>
<ide> from alembic import op
<del>from sqlalchemy import Column, ForeignKeyConstraint, Integer
<add>from sqlalchemy import Column, ForeignKeyConstraint, Integer, text
<ide>
<ide> from airflow.models.base import StringID
<ide> from airflow.utils.sqlalchemy import ExtendedJSON
<ide> def upgrade():
<ide> with op.batch_alter_table("task_instance") as batch_op:
<ide> # I think we always use this name for TaskInstance after 7b2661a43ba3?
<ide> batch_op.drop_constraint("task_instance_pkey", type_="primary")
<del> batch_op.add_column(Column("map_index", Integer, nullable=False, default=-1))
<add> batch_op.add_column(Column("map_index", Integer, nullable=False, server_default=text("-1")))
<ide> batch_op.create_primary_key("task_instance_pkey", ["dag_id", "task_id", "run_id", "map_index"])
<ide>
<ide> # Re-create task_reschedule's constraints.
<ide> with op.batch_alter_table("task_reschedule") as batch_op:
<del> batch_op.add_column(Column("map_index", Integer, nullable=False, default=-1))
<add> batch_op.add_column(Column("map_index", Integer, nullable=False, server_default=text("-1")))
<ide> batch_op.create_foreign_key(
<ide> "task_reschedule_ti_fkey",
<ide> "task_instance",
<ide><path>airflow/models/taskinstance.py
<ide> func,
<ide> inspect,
<ide> or_,
<add> text,
<ide> tuple_,
<ide> )
<ide> from sqlalchemy.ext.associationproxy import association_proxy
<ide> class TaskInstance(Base, LoggingMixin):
<ide> task_id = Column(String(ID_LEN, **COLLATION_ARGS), primary_key=True, nullable=False)
<ide> dag_id = Column(String(ID_LEN, **COLLATION_ARGS), primary_key=True, nullable=False)
<ide> run_id = Column(String(ID_LEN, **COLLATION_ARGS), primary_key=True, nullable=False)
<del> map_index = Column(Integer, primary_key=True, nullable=False, default=-1)
<add> map_index = Column(Integer, primary_key=True, nullable=False, server_default=text("-1"))
<ide>
<ide> start_date = Column(UtcDateTime)
<ide> end_date = Column(UtcDateTime)
<ide><path>airflow/models/taskreschedule.py
<ide> import datetime
<ide> from typing import TYPE_CHECKING
<ide>
<del>from sqlalchemy import Column, ForeignKeyConstraint, Index, Integer, String, asc, desc
<add>from sqlalchemy import Column, ForeignKeyConstraint, Index, Integer, String, asc, desc, text
<ide> from sqlalchemy.ext.associationproxy import association_proxy
<ide> from sqlalchemy.orm import relationship
<ide>
<ide> class TaskReschedule(Base):
<ide> task_id = Column(String(ID_LEN, **COLLATION_ARGS), nullable=False)
<ide> dag_id = Column(String(ID_LEN, **COLLATION_ARGS), nullable=False)
<ide> run_id = Column(String(ID_LEN, **COLLATION_ARGS), nullable=False)
<del> map_index = Column(Integer, nullable=False, default=-1)
<add> map_index = Column(Integer, nullable=False, server_default=text("-1"))
<ide> try_number = Column(Integer, nullable=False)
<ide> start_date = Column(UtcDateTime, nullable=False)
<ide> end_date = Column(UtcDateTime, nullable=False) | 3 |
Text | Text | add more information about list | 6533b99fcdbd6c4fea8ca6404558d8a946247443 | <ide><path>guide/english/html/lists/index.md
<ide> List can be nested (lists inside lists):
<ide> #### More Information:
<ide>
<ide> * [HTML lists on w3schools](https://www.w3schools.com/html/html_lists.asp)
<add>* [HTML list on tutorialspoint](https://www.tutorialspoint.com/html/html_lists.htm)
<ide> * [HTML lists on WebPlatform](https://webplatform.github.io/docs/guides/html_lists/)
<del> | 1 |
Text | Text | update response after calling add_pipe | ba1ff00370db6c8e9a4414b4da58be5fb693b1fa | <ide><path>.github/contributors/henry860916.md
<add># spaCy contributor agreement
<add>
<add>This spaCy Contributor Agreement (**"SCA"**) is based on the
<add>[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf).
<add>The SCA applies to any contribution that you make to any product or project
<add>managed by us (the **"project"**), and sets out the intellectual property rights
<add>you grant to us in the contributed materials. The term **"us"** shall mean
<add>[ExplosionAI UG (haftungsbeschränkt)](https://explosion.ai/legal). The term
<add>**"you"** shall mean the person or entity identified below.
<add>
<add>If you agree to be bound by these terms, fill in the information requested
<add>below and include the filled-in version with your first pull request, under the
<add>folder [`.github/contributors/`](/.github/contributors/). The name of the file
<add>should be your GitHub username, with the extension `.md`. For example, the user
<add>example_user would create the file `.github/contributors/example_user.md`.
<add>
<add>Read this agreement carefully before signing. These terms and conditions
<add>constitute a binding legal agreement.
<add>
<add>## Contributor Agreement
<add>
<add>1. The term "contribution" or "contributed materials" means any source code,
<add>object code, patch, tool, sample, graphic, specification, manual,
<add>documentation, or any other material posted or submitted by you to the project.
<add>
<add>2. With respect to any worldwide copyrights, or copyright applications and
<add>registrations, in your contribution:
<add>
<add> * you hereby assign to us joint ownership, and to the extent that such
<add> assignment is or becomes invalid, ineffective or unenforceable, you hereby
<add> grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge,
<add> royalty-free, unrestricted license to exercise all rights under those
<add> copyrights. This includes, at our option, the right to sublicense these same
<add> rights to third parties through multiple levels of sublicensees or other
<add> licensing arrangements;
<add>
<add> * you agree that each of us can do all things in relation to your
<add> contribution as if each of us were the sole owners, and if one of us makes
<add> a derivative work of your contribution, the one who makes the derivative
<add> work (or has it made will be the sole owner of that derivative work;
<add>
<add> * you agree that you will not assert any moral rights in your contribution
<add> against us, our licensees or transferees;
<add>
<add> * you agree that we may register a copyright in your contribution and
<add> exercise all ownership rights associated with it; and
<add>
<add> * you agree that neither of us has any duty to consult with, obtain the
<add> consent of, pay or render an accounting to the other for any use or
<add> distribution of your contribution.
<add>
<add>3. With respect to any patents you own, or that you can license without payment
<add>to any third party, you hereby grant to us a perpetual, irrevocable,
<add>non-exclusive, worldwide, no-charge, royalty-free license to:
<add>
<add> * make, have made, use, sell, offer to sell, import, and otherwise transfer
<add> your contribution in whole or in part, alone or in combination with or
<add> included in any product, work or materials arising out of the project to
<add> which your contribution was submitted, and
<add>
<add> * at our option, to sublicense these same rights to third parties through
<add> multiple levels of sublicensees or other licensing arrangements.
<add>
<add>4. Except as set out above, you keep all right, title, and interest in your
<add>contribution. The rights that you grant to us under these terms are effective
<add>on the date you first submitted a contribution to us, even if your submission
<add>took place before the date you sign these terms.
<add>
<add>5. You covenant, represent, warrant and agree that:
<add>
<add> * Each contribution that you submit is and shall be an original work of
<add> authorship and you can legally grant the rights set out in this SCA;
<add>
<add> * to the best of your knowledge, each contribution will not violate any
<add> third party's copyrights, trademarks, patents, or other intellectual
<add> property rights; and
<add>
<add> * each contribution shall be in compliance with U.S. export control laws and
<add> other applicable export and import laws. You agree to notify us if you
<add> become aware of any circumstance which would make any of the foregoing
<add> representations inaccurate in any respect. We may publicly disclose your
<add> participation in the project, including the fact that you have signed the SCA.
<add>
<add>6. This SCA is governed by the laws of the State of California and applicable
<add>U.S. Federal law. Any choice of law rules will not apply.
<add>
<add>7. Please place an “x” on one of the applicable statement below. Please do NOT
<add>mark both statements:
<add>
<add> * [x] I am signing on behalf of myself as an individual and no other person
<add> or entity, including my employer, has or will have rights with respect to my
<add> contributions.
<add>
<add> * [ ] I am signing on behalf of my employer or a legal entity and I have the
<add> actual authority to contractually bind that entity.
<add>
<add>## Contributor Details
<add>
<add>| Field | Entry |
<add>|------------------------------- | ------------------------ |
<add>| Name | Henry Zhang |
<add>| Company name (if applicable) | |
<add>| Title or role (if applicable) | |
<add>| Date | 2019-04-30 |
<add>| GitHub username | henry860916 |
<add>| Website (optional) | |
<ide><path>website/docs/usage/processing-pipelines.md
<ide> def my_component(doc):
<ide>
<ide> nlp = spacy.load("en_core_web_sm")
<ide> nlp.add_pipe(my_component, name="print_info", last=True)
<del>print(nlp.pipe_names) # ['print_info', 'tagger', 'parser', 'ner']
<add>print(nlp.pipe_names) # ['tagger', 'parser', 'ner', 'print_info']
<ide> doc = nlp(u"This is a sentence.")
<ide>
<ide> ``` | 2 |
Ruby | Ruby | remove redundant join and call to html_safe | c5a52850b3e2d0d1823f36d8d3afd9dc849cfddd | <ide><path>actionpack/lib/sprockets/helpers/rails_helper.rb
<ide> def javascript_include_tag(*sources)
<ide> if debug && asset = asset_paths.asset_for(source, 'js')
<ide> asset.to_a.map { |dep|
<ide> javascript_include_tag(dep, :debug => false, :body => true)
<del> }.join("\n").html_safe
<add> }
<ide> else
<ide> tag_options = {
<ide> 'type' => "text/javascript",
<ide> def stylesheet_link_tag(*sources)
<ide> if debug && asset = asset_paths.asset_for(source, 'css')
<ide> asset.to_a.map { |dep|
<ide> stylesheet_link_tag(dep, :media => media, :debug => false, :body => true)
<del> }.join("\n").html_safe
<add> }
<ide> else
<ide> tag_options = {
<ide> 'rel' => "stylesheet", | 1 |
PHP | PHP | update code in log.php | c78aec97958fa8aabbf801503899fdf07cf9e821 | <ide><path>src/Log/Log.php
<ide> public static function write($level, $message, $context = [])
<ide> */
<ide> public static function emergency($message, $context = [])
<ide> {
<del> return static::write('emergency', $message, $context);
<add> return static::write(__FUNCTION__, $message, $context);
<ide> }
<ide>
<ide> /**
<ide> public static function emergency($message, $context = [])
<ide> */
<ide> public static function alert($message, $context = [])
<ide> {
<del> return static::write('alert', $message, $context);
<add> return static::write(__FUNCTION__, $message, $context);
<ide> }
<ide>
<ide> /**
<ide> public static function alert($message, $context = [])
<ide> */
<ide> public static function critical($message, $context = [])
<ide> {
<del> return static::write('critical', $message, $context);
<add> return static::write(__FUNCTION__, $message, $context);
<ide> }
<ide>
<ide> /**
<ide> public static function critical($message, $context = [])
<ide> */
<ide> public static function error($message, $context = [])
<ide> {
<del> return static::write('error', $message, $context);
<add> return static::write(__FUNCTION__, $message, $context);
<ide> }
<ide>
<ide> /**
<ide> public static function error($message, $context = [])
<ide> */
<ide> public static function warning($message, $context = [])
<ide> {
<del> return static::write('warning', $message, $context);
<add> return static::write(__FUNCTION__, $message, $context);
<ide> }
<ide>
<ide> /**
<ide> public static function warning($message, $context = [])
<ide> */
<ide> public static function notice($message, $context = [])
<ide> {
<del> return static::write('notice', $message, $context);
<add> return static::write(__FUNCTION__, $message, $context);
<ide> }
<ide>
<ide> /**
<ide> public static function notice($message, $context = [])
<ide> */
<ide> public static function debug($message, $context = [])
<ide> {
<del> return static::write('debug', $message, $context);
<add> return static::write(__FUNCTION__, $message, $context);
<ide> }
<ide>
<ide> /**
<ide> public static function debug($message, $context = [])
<ide> */
<ide> public static function info($message, $context = [])
<ide> {
<del> return static::write('info', $message, $context);
<add> return static::write(__FUNCTION__, $message, $context);
<ide> }
<ide> } | 1 |
Go | Go | remove redundant error check | 7b13076f56ab1cb77579b776c41110e707c47a5a | <ide><path>daemon/network.go
<ide> func (daemon *Daemon) CreateManagedNetwork(create clustertypes.NetworkCreateRequ
<ide>
<ide> // CreateNetwork creates a network with the given name, driver and other optional parameters
<ide> func (daemon *Daemon) CreateNetwork(create types.NetworkCreateRequest) (*types.NetworkCreateResponse, error) {
<del> resp, err := daemon.createNetwork(create, "", false)
<del> if err != nil {
<del> return nil, err
<del> }
<del> return resp, err
<add> return daemon.createNetwork(create, "", false)
<ide> }
<ide>
<ide> func (daemon *Daemon) createNetwork(create types.NetworkCreateRequest, id string, agent bool) (*types.NetworkCreateResponse, error) { | 1 |
Text | Text | clarify section introducing `props` | 255f238ceea13f61ec41ab49e7a74cb697f90dbc | <ide><path>docs/docs/tutorial.md
<ide> var CommentList = React.createClass({
<ide> });
<ide> ```
<ide>
<del>Note that we have passed some data from the parent `CommentList` component to the child `Comment` component as both XML-like children and attributes. Data passed from parent to child is called **props**, short for properties.
<add>Note that we have passed some data from the parent `CommentList` component to the child `Comment` components. For example, we passed *Pete Hunt* (via an attribute) and *This is one comment* (via an XML-like child node) to the first `Comment`. Data passed from parent to children components is called **props**, short for properties.
<ide>
<ide> ### Using props
<ide>
<del>Let's create the Comment component. It will read the data passed to it from the CommentList and render some markup:
<add>Let's create the Comment component. Using **props** we will be able to read the data passed to it from the `CommentList`, and render some markup:
<ide>
<ide> ```javascript
<ide> // tutorial5.js | 1 |
Python | Python | fix decode error when building and get rid of warn | dd45d84929318202580bd2b8d6787ec360ed0551 | <ide><path>numpy/distutils/ccompiler_opt.py
<ide> def _dist_test_spawn_paths(self, cmd, display=None):
<ide> # intel and msvc compilers don't raise
<ide> # fatal errors when flags are wrong or unsupported
<ide> ".*("
<del> "ignoring unknown option|" # msvc
<add> "warning D9002|" # msvc, it should be work with any language.
<ide> "invalid argument for option" # intel
<ide> ").*"
<ide> )
<ide> @staticmethod
<ide> def _dist_test_spawn(cmd, display=None):
<ide> from distutils.errors import CompileError
<ide> try:
<del> o = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
<del> if isinstance(o, bytes):
<del> o = o.decode()
<add> o = subprocess.check_output(cmd, stderr=subprocess.STDOUT,
<add> universal_newlines=True)
<ide> if o and re.match(_Distutils._dist_warn_regex, o):
<ide> _Distutils.dist_error(
<ide> "Flags in command", cmd ,"aren't supported by the compiler"
<ide> def _dist_test_spawn(cmd, display=None):
<ide> s = 127
<ide> else:
<ide> return None
<del> o = o.decode()
<ide> _Distutils.dist_error(
<ide> "Command", cmd, "failed with exit status %d output -> \n%s" % (
<ide> s, o | 1 |
Javascript | Javascript | update array#lastindexof documentation | 5bafc9c5126fdeedff94ccaa834e126322cdb0c3 | <ide><path>packages/ember-runtime/lib/mixins/array.js
<ide> Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
<ide> @returns {Number} index or -1 if not found
<ide>
<ide> @example
<del> arr = ["a", "b", "c", "d", "a"];
<add> var arr = ["a", "b", "c", "d", "a"];
<ide> arr.indexOf("a"); => 0
<ide> arr.indexOf("z"); => -1
<ide> arr.indexOf("a", 2); => 4
<ide> Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
<ide> },
<ide>
<ide> /**
<del> Returns the last index for a particular object in the index.
<add> Returns the index of the given object's last occurrence.
<add> If no startAt argument is given, the starting location to
<add> search is 0. If it's negative, will count backward from
<add> the end of the array. Returns -1 if no match is found.
<ide>
<ide> @param {Object} object the item to search for
<del> @param {NUmber} startAt optional starting location to search, default 0
<del> @returns {Number} index of -1 if not found
<add> @param {Number} startAt optional starting location to search, default 0
<add> @returns {Number} index or -1 if not found
<add>
<add> @example
<add> var arr = ["a", "b", "c", "d", "a"];
<add> arr.lastIndexOf("a"); => 4
<add> arr.lastIndexOf("z"); => -1
<add> arr.lastIndexOf("a", 2); => 0
<add> arr.lastIndexOf("a", -1); => 4
<add> arr.lastIndexOf("b", 3); => 1
<add> arr.lastIndexOf("a", 100); => 4
<ide> */
<ide> lastIndexOf: function(object, startAt) {
<ide> var idx, len = get(this, 'length'); | 1 |
Javascript | Javascript | use common.mustcall() instead of exit handle | 2e864df6bf48cccb58e74b195b3a36f37d11f3d1 | <ide><path>test/parallel/test-http-server-keep-alive-timeout.js
<ide> 'use strict';
<ide>
<ide> const common = require('../common');
<del>const assert = require('assert');
<ide> const http = require('http');
<ide> const net = require('net');
<ide>
<ide> function run() {
<ide> }
<ide>
<ide> test(function serverEndKeepAliveTimeoutWithPipeline(cb) {
<del> let requestCount = 0;
<del> process.on('exit', () => {
<del> assert.strictEqual(requestCount, 3);
<del> });
<del> const server = http.createServer((req, res) => {
<del> requestCount++;
<add> const server = http.createServer(common.mustCall((req, res) => {
<ide> res.end();
<del> });
<add> }, 3));
<ide> server.setTimeout(500, common.mustCall((socket) => {
<ide> // End this test and call `run()` for the next test (if any).
<ide> socket.destroy();
<ide> test(function serverEndKeepAliveTimeoutWithPipeline(cb) {
<ide> });
<ide>
<ide> test(function serverNoEndKeepAliveTimeoutWithPipeline(cb) {
<del> let requestCount = 0;
<del> process.on('exit', () => {
<del> assert.strictEqual(requestCount, 3);
<del> });
<del> const server = http.createServer((req, res) => {
<del> requestCount++;
<del> });
<add> const server = http.createServer(common.mustCall(3));
<ide> server.setTimeout(500, common.mustCall((socket) => {
<ide> // End this test and call `run()` for the next test (if any).
<ide> socket.destroy();
<ide><path>test/parallel/test-https-server-keep-alive-timeout.js
<ide> const common = require('../common');
<ide> if (!common.hasCrypto)
<ide> common.skip('missing crypto');
<ide>
<del>const assert = require('assert');
<ide> const https = require('https');
<ide> const tls = require('tls');
<ide> const fs = require('fs');
<ide> function run() {
<ide> }
<ide>
<ide> test(function serverKeepAliveTimeoutWithPipeline(cb) {
<del> let requestCount = 0;
<del> process.on('exit', function() {
<del> assert.strictEqual(requestCount, 3);
<del> });
<del> const server = https.createServer(serverOptions, (req, res) => {
<del> requestCount++;
<del> res.end();
<del> });
<add> const server = https.createServer(
<add> serverOptions,
<add> common.mustCall((req, res) => {
<add> res.end();
<add> }, 3));
<ide> server.setTimeout(500, common.mustCall((socket) => {
<ide> // End this test and call `run()` for the next test (if any).
<ide> socket.destroy();
<ide> test(function serverKeepAliveTimeoutWithPipeline(cb) {
<ide> });
<ide>
<ide> test(function serverNoEndKeepAliveTimeoutWithPipeline(cb) {
<del> let requestCount = 0;
<del> process.on('exit', () => {
<del> assert.strictEqual(requestCount, 3);
<del> });
<del> const server = https.createServer(serverOptions, (req, res) => {
<del> requestCount++;
<del> });
<add> const server = https.createServer(serverOptions, common.mustCall(3));
<ide> server.setTimeout(500, common.mustCall((socket) => {
<ide> // End this test and call `run()` for the next test (if any).
<ide> socket.destroy(); | 2 |
Java | Java | add servlet 3.1 methods to mock request | c553d681f14bb19fac3bc25d8ecec83ae7347071 | <ide><path>spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java
<ide> public int getContentLength() {
<ide> return (this.content != null ? this.content.length : -1);
<ide> }
<ide>
<add> public long getContentLengthLong() {
<add> return getContentLength();
<add> }
<add>
<ide> public void setContentType(String contentType) {
<ide> this.contentType = contentType;
<ide> if (contentType != null) {
<ide> public HttpSession getSession() {
<ide> return getSession(true);
<ide> }
<ide>
<add> /**
<add> * The implementation of this (Servlet 3.1+) method calls
<add> * {@link MockHttpSession#changeSessionId()} if the session is a mock session.
<add> * Otherwise it simply returns the current session id.
<add> * @since 4.0.3
<add> */
<add> public String changeSessionId() {
<add> Assert.isTrue(this.session != null, "The request does not have a session");
<add> if (this.session instanceof MockHttpSession) {
<add> return ((MockHttpSession) session).changeSessionId();
<add> }
<add> return this.session.getId();
<add> }
<add>
<ide> public void setRequestedSessionIdValid(boolean requestedSessionIdValid) {
<ide> this.requestedSessionIdValid = requestedSessionIdValid;
<ide> }
<ide><path>spring-test/src/main/java/org/springframework/mock/web/MockHttpSession.java
<ide> public class MockHttpSession implements HttpSession {
<ide>
<ide> private static int nextId = 1;
<ide>
<del> private final String id;
<add> private String id;
<ide>
<ide> private final long creationTime = System.currentTimeMillis();
<ide>
<ide> public String getId() {
<ide> return this.id;
<ide> }
<ide>
<add> /**
<add> * As of Servlet 3.1 the id of a session can be changed.
<add> * @return the new session id.
<add> * @since 4.0.3
<add> */
<add> public String changeSessionId() {
<add> this.id = Integer.toString(nextId++);
<add> return this.id;
<add> }
<add>
<ide> public void access() {
<ide> this.lastAccessedTime = System.currentTimeMillis();
<ide> this.isNew = false;
<ide><path>spring-web/src/test/java/org/springframework/mock/web/test/MockHttpServletRequest.java
<ide> public int getContentLength() {
<ide> return (this.content != null ? this.content.length : -1);
<ide> }
<ide>
<add> public long getContentLengthLong() {
<add> return getContentLength();
<add> }
<add>
<ide> public void setContentType(String contentType) {
<ide> this.contentType = contentType;
<ide> if (contentType != null) {
<ide> public HttpSession getSession() {
<ide> return getSession(true);
<ide> }
<ide>
<add> /**
<add> * The implementation of this (Servlet 3.1+) method calls
<add> * {@link MockHttpSession#changeSessionId()} if the session is a mock session.
<add> * Otherwise it simply returns the current session id.
<add> * @since 4.0.3
<add> */
<add> public String changeSessionId() {
<add> Assert.isTrue(this.session != null, "The request does not have a session");
<add> if (this.session instanceof MockHttpSession) {
<add> return ((MockHttpSession) session).changeSessionId();
<add> }
<add> return this.session.getId();
<add> }
<add>
<ide> public void setRequestedSessionIdValid(boolean requestedSessionIdValid) {
<ide> this.requestedSessionIdValid = requestedSessionIdValid;
<ide> }
<ide><path>spring-web/src/test/java/org/springframework/mock/web/test/MockHttpSession.java
<ide> /*
<del> * Copyright 2002-2013 the original author or authors.
<add> * Copyright 2002-2014 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public class MockHttpSession implements HttpSession {
<ide>
<ide> private static int nextId = 1;
<ide>
<del> private final String id;
<add> private String id;
<ide>
<ide> private final long creationTime = System.currentTimeMillis();
<ide>
<ide> public String getId() {
<ide> return this.id;
<ide> }
<ide>
<add> /**
<add> * As of Servlet 3.1 the id of a session can be changed.
<add> * @return the new session id.
<add> * @since 4.0.3
<add> */
<add> public String changeSessionId() {
<add> this.id = Integer.toString(nextId++);
<add> return this.id;
<add> }
<add>
<ide> public void access() {
<ide> this.lastAccessedTime = System.currentTimeMillis();
<ide> this.isNew = false; | 4 |
Java | Java | add protected yamlprocessor.getflattenedmap method | 87f1512e8867a884615d79ab52bf1283f7c573e1 | <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java
<ide> private Map<String, Object> asMap(Object object) {
<ide>
<ide> private boolean process(Map<String, Object> map, MatchCallback callback) {
<ide> Properties properties = new Properties();
<del> assignProperties(properties, map, null);
<add> properties.putAll(getFlattenedMap(map));
<ide>
<ide> if (this.documentMatchers.isEmpty()) {
<ide> if (this.logger.isDebugEnabled()) {
<ide> private boolean process(Map<String, Object> map, MatchCallback callback) {
<ide> return false;
<ide> }
<ide>
<del> private void assignProperties(Properties properties, Map<String, Object> input, String path) {
<del> for (Entry<String, Object> entry : input.entrySet()) {
<add> /**
<add> * Return a flattened version of the given map, recursively following any nested Map
<add> * or Collection values. Entries from the resulting map retain the same order as the
<add> * source. When called with the Map from a {@link MatchCallback} the result will
<add> * contain the same values as the {@link MatchCallback} Properties.
<add> * @param source the source map
<add> * @return a flattened map
<add> * @since 4.2.3
<add> */
<add> protected final Map<String, Object> getFlattenedMap(Map<String, Object> source) {
<add> Map<String, Object> result = new LinkedHashMap<String, Object>();
<add> buildFlattenedMap(result, source, null);
<add> return result;
<add> }
<add>
<add> private void buildFlattenedMap(Map<String, Object> result, Map<String, Object> source, String path) {
<add> for (Entry<String, Object> entry : source.entrySet()) {
<ide> String key = entry.getKey();
<ide> if (StringUtils.hasText(path)) {
<ide> if (key.startsWith("[")) {
<ide> private void assignProperties(Properties properties, Map<String, Object> input,
<ide> }
<ide> Object value = entry.getValue();
<ide> if (value instanceof String) {
<del> properties.put(key, value);
<add> result.put(key, value);
<ide> }
<ide> else if (value instanceof Map) {
<ide> // Need a compound key
<ide> @SuppressWarnings("unchecked")
<ide> Map<String, Object> map = (Map<String, Object>) value;
<del> assignProperties(properties, map, key);
<add> buildFlattenedMap(result, map, key);
<ide> }
<ide> else if (value instanceof Collection) {
<ide> // Need a compound key
<ide> @SuppressWarnings("unchecked")
<ide> Collection<Object> collection = (Collection<Object>) value;
<ide> int count = 0;
<ide> for (Object object : collection) {
<del> assignProperties(properties,
<add> buildFlattenedMap(result,
<ide> Collections.singletonMap("[" + (count++) + "]", object), key);
<ide> }
<ide> }
<ide> else {
<del> properties.put(key, value == null ? "" : value);
<add> result.put(key, value == null ? "" : value);
<ide> }
<ide> }
<ide> }
<ide><path>spring-beans/src/test/java/org/springframework/beans/factory/config/YamlProcessorTests.java
<ide> */
<ide> package org.springframework.beans.factory.config;
<ide>
<add>import java.util.LinkedHashMap;
<ide> import java.util.Map;
<ide> import java.util.Properties;
<ide>
<ide> import org.junit.rules.ExpectedException;
<ide> import org.yaml.snakeyaml.parser.ParserException;
<ide> import org.yaml.snakeyaml.scanner.ScannerException;
<del>
<ide> import org.springframework.core.io.ByteArrayResource;
<ide>
<ide> import static org.junit.Assert.*;
<ide> public void process(Properties properties, Map<String, Object> map) {
<ide> }
<ide> });
<ide> }
<add>
<add> @Test
<add> @SuppressWarnings("unchecked")
<add> public void flattenedMapIsSameAsPropertiesButOrdered() {
<add> this.processor.setResources(new ByteArrayResource(
<add> "foo: bar\nbar:\n spam: bucket".getBytes()));
<add> this.processor.process(new MatchCallback() {
<add> @Override
<add> public void process(Properties properties, Map<String, Object> map) {
<add> assertEquals("bucket", properties.get("bar.spam"));
<add> assertEquals(2, properties.size());
<add> Map<String, Object> flattenedMap = processor.getFlattenedMap(map);
<add> assertEquals("bucket", flattenedMap.get("bar.spam"));
<add> assertEquals(2, flattenedMap.size());
<add> assertTrue(flattenedMap instanceof LinkedHashMap);
<add> Map<String, Object> bar = (Map<String, Object>) map.get("bar");
<add> assertEquals("bucket", bar.get("spam"));
<add> }
<add> });
<add> }
<ide> } | 2 |
Text | Text | perform minor cleanup on cli.md | 4109903098a1224601af8290474df222498d0009 | <ide><path>doc/api/cli.md
<ide> To view this documentation as a manual page in a terminal, run `man node`.
<ide>
<ide> Execute without arguments to start the [REPL][].
<ide>
<del>_For more info about `node inspect`, please see the [debugger][] documentation._
<add>For more info about `node inspect`, see the [debugger][] documentation.
<ide>
<ide> ## Options
<ide> <!-- YAML
<ide> changes:
<ide> -->
<ide>
<ide> All options, including V8 options, allow words to be separated by both
<del>dashes (`-`) or underscores (`_`).
<add>dashes (`-`) or underscores (`_`). For example, `--pending-deprecation` is
<add>equivalent to `--pending_deprecation`.
<ide>
<del>For example, `--pending-deprecation` is equivalent to `--pending_deprecation`.
<del>
<del>If an option that takes a single value, for example `--max-http-header-size`,
<del>is passed more than once, then the last passed value will be used. Options
<del>from the command line take precedence over options passed through the
<del>[`NODE_OPTIONS`][] environment variable.
<add>If an option that takes a single value (such as `--max-http-header-size`) is
<add>passed more than once, then the last passed value is used. Options from the
<add>command line take precedence over options passed through the [`NODE_OPTIONS`][]
<add>environment variable.
<ide>
<ide> ### `-`
<ide> <!-- YAML
<ide> added: v8.0.0
<ide> -->
<ide>
<ide> Alias for stdin. Analogous to the use of `-` in other command line utilities,
<del>meaning that the script will be read from stdin, and the rest of the options
<add>meaning that the script is read from stdin, and the rest of the options
<ide> are passed to that script.
<ide>
<ide> ### `--`
<ide> added: v6.11.0
<ide>
<ide> Indicate the end of node options. Pass the rest of the arguments to the script.
<ide> If no script filename or eval/print script is supplied prior to this, then
<del>the next argument will be used as a script filename.
<add>the next argument is used as a script filename.
<ide>
<ide> ### `--abort-on-uncaught-exception`
<ide> <!-- YAML
<ide> added: v12.0.0
<ide> Starts the V8 CPU profiler on start up, and writes the CPU profile to disk
<ide> before exit.
<ide>
<del>If `--cpu-prof-dir` is not specified, the generated profile will be placed
<add>If `--cpu-prof-dir` is not specified, the generated profile is placed
<ide> in the current working directory.
<ide>
<del>If `--cpu-prof-name` is not specified, the generated profile will be
<add>If `--cpu-prof-name` is not specified, the generated profile is
<ide> named `CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile`.
<ide>
<ide> ```console
<ide> Specify the file name of the CPU profile generated by `--cpu-prof`.
<ide>
<ide> ### `--diagnostic-dir=directory`
<ide>
<del>Set the directory to which all diagnostic output files will be written to.
<add>Set the directory to which all diagnostic output files are written.
<ide> Defaults to current working directory.
<ide>
<ide> Affects the default output directory of:
<ide> added:
<ide> -->
<ide>
<ide> Disable the `Object.prototype.__proto__` property. If `mode` is `delete`, the
<del>property will be removed entirely. If `mode` is `throw`, accesses to the
<del>property will throw an exception with the code `ERR_PROTO_ACCESS`.
<add>property is removed entirely. If `mode` is `throw`, accesses to the
<add>property throw an exception with the code `ERR_PROTO_ACCESS`.
<ide>
<ide> ### `--disallow-code-generation-from-strings`
<ide> <!-- YAML
<ide> Sets the resolution algorithm for resolving ES module specifiers. Valid options
<ide> are `explicit` and `node`.
<ide>
<ide> The default is `explicit`, which requires providing the full path to a
<del>module. The `node` mode will enable support for optional file extensions and
<add>module. The `node` mode enables support for optional file extensions and
<ide> the ability to import a directory that has an index file.
<ide>
<del>Please see [customizing ESM specifier resolution][] for example usage.
<add>See [customizing ESM specifier resolution][] for example usage.
<ide>
<ide> ### `--experimental-vm-modules`
<ide> <!-- YAML
<ide> added: v12.4.0
<ide> Starts the V8 heap profiler on start up, and writes the heap profile to disk
<ide> before exit.
<ide>
<del>If `--heap-prof-dir` is not specified, the generated profile will be placed
<add>If `--heap-prof-dir` is not specified, the generated profile is placed
<ide> in the current working directory.
<ide>
<del>If `--heap-prof-name` is not specified, the generated profile will be
<add>If `--heap-prof-name` is not specified, the generated profile is
<ide> named `Heap.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.heapprofile`.
<ide>
<ide> ```console
<ide> This flag exists so that the main module can be opted-in to the same behavior
<ide> that `--preserve-symlinks` gives to all other imports; they are separate flags,
<ide> however, for backward compatibility with older Node.js versions.
<ide>
<del>`--preserve-symlinks-main` does not imply `--preserve-symlinks`; it
<del>is expected that `--preserve-symlinks-main` will be used in addition to
<add>`--preserve-symlinks-main` does not imply `--preserve-symlinks`; use
<add>`--preserve-symlinks-main` in addition to
<ide> `--preserve-symlinks` when it is not desirable to follow symlinks before
<ide> resolving relative paths.
<ide>
<ide> compound after anything in `options...`. Node.js will exit with an error if
<ide> an option that is not allowed in the environment is used, such as `-p` or a
<ide> script file.
<ide>
<del>In case an option value happens to contain a space (for example a path listed
<del>in `--require`), it must be escaped using double quotes. For example:
<add>If an option value contains a space, it can be escaped using double quotes:
<ide>
<ide> ```bash
<ide> NODE_OPTIONS='--require "./my path/file.js"'
<ide> On a machine with 2GB of memory, consider setting this to
<ide> $ node --max-old-space-size=1536 index.js
<ide> ```
<ide>
<add>[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/
<add>[REPL]: repl.html
<add>[ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage
<add>[Source Map]: https://sourcemaps.info/spec.html
<add>[Subresource Integrity]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
<add>[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html
<ide> [`--openssl-config`]: #cli_openssl_config_file
<ide> [`Atomics.wait()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait
<ide> [`Buffer`]: buffer.html#buffer_class_buffer
<del>[`SlowBuffer`]: buffer.html#buffer_class_slowbuffer
<ide> [`NODE_OPTIONS`]: #cli_node_options_options
<add>[`SlowBuffer`]: buffer.html#buffer_class_slowbuffer
<ide> [`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
<ide> [`tls.DEFAULT_MAX_VERSION`]: tls.html#tls_tls_default_max_version
<ide> [`tls.DEFAULT_MIN_VERSION`]: tls.html#tls_tls_default_min_version
<ide> [`unhandledRejection`]: process.html#process_event_unhandledrejection
<ide> [`worker_threads.threadId`]: worker_threads.html#worker_threads_worker_threadid
<del>[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/
<del>[REPL]: repl.html
<del>[ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage
<del>[Source Map]: https://sourcemaps.info/spec.html
<del>[Subresource Integrity]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
<del>[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html
<ide> [context-aware]: addons.html#addons_context_aware_addons
<ide> [customizing ESM specifier resolution]: esm.html#esm_customizing_esm_specifier_resolution_algorithm
<ide> [debugger]: debugger.html | 1 |
Javascript | Javascript | delete some old line in list.js | b4416217c4b33e8e557f321aa79a769e117deb2a | <ide><path>docs/list.js
<ide> var list = {
<ide>
<ide> "Plugins": {
<ide> "LookupTable": "examples/Lut",
<del> "SpriteCanvasMaterial": "examples/SpriteCanvasMaterial"
<ide> },
<ide>
<ide> "QuickHull": {
<ide> var list = {
<ide> },
<ide>
<ide> "Renderers": {
<del> "CSS2DRenderer": "examples/renderers/CSS2DRenderer",
<add> "CSS2DRenderer": "examples/renderers/CSS2DRenderer",
<ide> "CSS3DRenderer": "examples/renderers/CSS3DRenderer",
<ide> "SVGRenderer": "examples/renderers/SVGRenderer"
<ide>
<ide> var list = {
<ide>
<ide> "插件": {
<ide> "LookupTable": "examples/Lut",
<del> "SpriteCanvasMaterial": "examples/SpriteCanvasMaterial"
<ide> },
<ide>
<ide> "QuickHull": {
<ide> var list = {
<ide> },
<ide>
<ide> "渲染器": {
<del> "CSS2DRenderer": "examples/renderers/CSS2DRenderer",
<add> "CSS2DRenderer": "examples/renderers/CSS2DRenderer",
<ide> "CSS3DRenderer": "examples/renderers/CSS3DRenderer",
<ide> "SVGRenderer": "examples/renderers/SVGRenderer"
<ide> | 1 |
Python | Python | remove a version check for > python 2.1 | 42fd3467cb4d3bbf7b79b1577f23dfed05746470 | <ide><path>numpy/distutils/exec_command.py
<ide> def find_executable(exe, path=None, _cache={}):
<ide>
<ide> if path is None:
<ide> path = os.environ.get('PATH',os.defpath)
<del> if os.name=='posix' and sys.version[:3]>'2.1':
<add> if os.name=='posix':
<ide> realpath = os.path.realpath
<ide> else:
<ide> realpath = lambda a:a | 1 |
Javascript | Javascript | apply codemod for react -> reactdom split | 9adcff442a56ea9cb1f9aa4575202e028cbe7782 | <ide><path>src/addons/__tests__/ReactFragment-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactFragment;
<ide>
<ide> describe('ReactFragment', function() {
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactFragment = require('ReactFragment');
<ide> });
<ide>
<ide> describe('ReactFragment', function() {
<ide> var element = <div>{[children]}</div>;
<ide> expect(console.error.calls.length).toBe(0);
<ide> var container = document.createElement('div');
<del> React.render(element, container);
<add> ReactDOM.render(element, container);
<ide> expect(console.error.calls.length).toBe(1);
<ide> expect(console.error.calls[0].args[0]).toContain(
<ide> 'Any use of a keyed object'
<ide> describe('ReactFragment', function() {
<ide> }
<ide> expect(console.error.calls.length).toBe(0);
<ide> var container = document.createElement('div');
<del> React.render(<Foo />, container);
<add> ReactDOM.render(<Foo />, container);
<ide> expect(console.error.calls.length).toBe(1);
<ide> expect(console.error.calls[0].args[0]).toContain(
<ide> 'Any use of a keyed object'
<ide><path>src/addons/transitions/ReactCSSTransitionGroupChild.js
<ide> 'use strict';
<ide>
<ide> var React = require('React');
<add>var ReactDOM = require('ReactDOM');
<ide>
<ide> var CSSCore = require('CSSCore');
<ide> var ReactTransitionEvents = require('ReactTransitionEvents');
<ide> var ReactCSSTransitionGroupChild = React.createClass({
<ide> displayName: 'ReactCSSTransitionGroupChild',
<ide>
<ide> transition: function(animationType, finishCallback) {
<del> var node = React.findDOMNode(this);
<add> var node = ReactDOM.findDOMNode(this);
<ide>
<ide> if (!node) {
<ide> if (finishCallback) {
<ide> var ReactCSSTransitionGroupChild = React.createClass({
<ide> flushClassNameQueue: function() {
<ide> if (this.isMounted()) {
<ide> this.classNameQueue.forEach(
<del> CSSCore.addClass.bind(CSSCore, React.findDOMNode(this))
<add> CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this))
<ide> );
<ide> }
<ide> this.classNameQueue.length = 0;
<ide><path>src/addons/transitions/__tests__/ReactCSSTransitionGroup-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactCSSTransitionGroup;
<ide>
<ide> // Most of the real functionality is covered in other unit tests, this just
<ide> describe('ReactCSSTransitionGroup', function() {
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactCSSTransitionGroup = require('ReactCSSTransitionGroup');
<ide>
<ide> container = document.createElement('div');
<ide> spyOn(console, 'error');
<ide> });
<ide>
<ide> it('should warn after time with no transitionend', function() {
<del> var a = React.render(
<add> var a = ReactDOM.render(
<ide> <ReactCSSTransitionGroup transitionName="yolo">
<ide> <span key="one" id="one" />
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<del> expect(React.findDOMNode(a).childNodes.length).toBe(1);
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
<ide>
<ide> setTimeout.mock.calls.length = 0;
<ide>
<del> React.render(
<add> ReactDOM.render(
<ide> <ReactCSSTransitionGroup transitionName="yolo">
<ide> <span key="two" id="two" />
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<del> expect(React.findDOMNode(a).childNodes.length).toBe(2);
<del> expect(React.findDOMNode(a).childNodes[0].id).toBe('two');
<del> expect(React.findDOMNode(a).childNodes[1].id).toBe('one');
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(2);
<add> expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('two');
<add> expect(ReactDOM.findDOMNode(a).childNodes[1].id).toBe('one');
<ide>
<ide> // For some reason jst is adding extra setTimeout()s and grunt test isn't,
<ide> // so we need to do this disgusting hack.
<ide> describe('ReactCSSTransitionGroup', function() {
<ide> }
<ide> }
<ide>
<del> expect(React.findDOMNode(a).childNodes.length).toBe(2);
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(2);
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> });
<ide>
<ide> it('should keep both sets of DOM nodes around', function() {
<del> var a = React.render(
<add> var a = ReactDOM.render(
<ide> <ReactCSSTransitionGroup transitionName="yolo">
<ide> <span key="one" id="one" />
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<del> expect(React.findDOMNode(a).childNodes.length).toBe(1);
<del> React.render(
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
<add> ReactDOM.render(
<ide> <ReactCSSTransitionGroup transitionName="yolo">
<ide> <span key="two" id="two" />
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<del> expect(React.findDOMNode(a).childNodes.length).toBe(2);
<del> expect(React.findDOMNode(a).childNodes[0].id).toBe('two');
<del> expect(React.findDOMNode(a).childNodes[1].id).toBe('one');
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(2);
<add> expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('two');
<add> expect(ReactDOM.findDOMNode(a).childNodes[1].id).toBe('one');
<ide> });
<ide>
<ide> it('should switch transitionLeave from false to true', function() {
<del> var a = React.render(
<add> var a = ReactDOM.render(
<ide> <ReactCSSTransitionGroup
<ide> transitionName="yolo"
<ide> transitionEnter={false}
<ide> describe('ReactCSSTransitionGroup', function() {
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<del> expect(React.findDOMNode(a).childNodes.length).toBe(1);
<del> React.render(
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
<add> ReactDOM.render(
<ide> <ReactCSSTransitionGroup
<ide> transitionName="yolo"
<ide> transitionEnter={false}
<ide> describe('ReactCSSTransitionGroup', function() {
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<del> expect(React.findDOMNode(a).childNodes.length).toBe(1);
<del> React.render(
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
<add> ReactDOM.render(
<ide> <ReactCSSTransitionGroup
<ide> transitionName="yolo"
<ide> transitionEnter={false}
<ide> describe('ReactCSSTransitionGroup', function() {
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<del> expect(React.findDOMNode(a).childNodes.length).toBe(2);
<del> expect(React.findDOMNode(a).childNodes[0].id).toBe('three');
<del> expect(React.findDOMNode(a).childNodes[1].id).toBe('two');
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(2);
<add> expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('three');
<add> expect(ReactDOM.findDOMNode(a).childNodes[1].id).toBe('two');
<ide> });
<ide>
<ide> it('should work with no children', function() {
<del> React.render(
<add> ReactDOM.render(
<ide> <ReactCSSTransitionGroup transitionName="yolo" />,
<ide> container
<ide> );
<ide> });
<ide>
<ide> it('should work with a null child', function() {
<del> React.render(
<add> ReactDOM.render(
<ide> <ReactCSSTransitionGroup transitionName="yolo">
<ide> {[null]}
<ide> </ReactCSSTransitionGroup>,
<ide> describe('ReactCSSTransitionGroup', function() {
<ide> });
<ide>
<ide> it('should transition from one to null', function() {
<del> var a = React.render(
<add> var a = ReactDOM.render(
<ide> <ReactCSSTransitionGroup transitionName="yolo">
<ide> <span key="one" id="one" />
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<del> expect(React.findDOMNode(a).childNodes.length).toBe(1);
<del> React.render(
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
<add> ReactDOM.render(
<ide> <ReactCSSTransitionGroup transitionName="yolo">
<ide> {null}
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<ide> // (Here, we expect the original child to stick around but test that no
<ide> // exception is thrown)
<del> expect(React.findDOMNode(a).childNodes.length).toBe(1);
<del> expect(React.findDOMNode(a).childNodes[0].id).toBe('one');
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
<add> expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('one');
<ide> });
<ide>
<ide> it('should transition from false to one', function() {
<del> var a = React.render(
<add> var a = ReactDOM.render(
<ide> <ReactCSSTransitionGroup transitionName="yolo">
<ide> {false}
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<del> expect(React.findDOMNode(a).childNodes.length).toBe(0);
<del> React.render(
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(0);
<add> ReactDOM.render(
<ide> <ReactCSSTransitionGroup transitionName="yolo">
<ide> <span key="one" id="one" />
<ide> </ReactCSSTransitionGroup>,
<ide> container
<ide> );
<del> expect(React.findDOMNode(a).childNodes.length).toBe(1);
<del> expect(React.findDOMNode(a).childNodes[0].id).toBe('one');
<add> expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1);
<add> expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('one');
<ide> });
<ide>
<ide> });
<ide><path>src/addons/transitions/__tests__/ReactTransitionGroup-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTransitionGroup;
<ide>
<ide> // Most of the real functionality is covered in other unit tests, this just
<ide> describe('ReactTransitionGroup', function() {
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTransitionGroup = require('ReactTransitionGroup');
<ide>
<ide> container = document.createElement('div');
<ide> describe('ReactTransitionGroup', function() {
<ide> },
<ide> });
<ide>
<del> var instance = React.render(<Component />, container);
<add> var instance = ReactDOM.render(<Component />, container);
<ide> expect(log).toEqual(['didMount', 'willAppear', 'didAppear']);
<ide>
<ide> log = [];
<ide> describe('ReactTransitionGroup', function() {
<ide> },
<ide> });
<ide>
<del> var instance = React.render(<Component />, container);
<add> var instance = ReactDOM.render(<Component />, container);
<ide> expect(log).toEqual(['didMount']);
<ide> instance.setState({count: 2});
<ide> expect(log).toEqual(['didMount', 'didMount', 'willEnter']);
<ide> describe('ReactTransitionGroup', function() {
<ide> },
<ide> });
<ide>
<del> var instance = React.render(<Component />, container);
<add> var instance = ReactDOM.render(<Component />, container);
<ide> expect(log).toEqual(['didMount']);
<ide> instance.setState({count: 2});
<ide> expect(log).toEqual(['didMount', 'didMount', 'willEnter']);
<ide> describe('ReactTransitionGroup', function() {
<ide> },
<ide> });
<ide>
<del> var instance = React.render(<Component />, container);
<add> var instance = ReactDOM.render(<Component />, container);
<ide> expect(log).toEqual(['didMount0']);
<ide> log = [];
<ide>
<ide><path>src/isomorphic/classic/__tests__/ReactContextValidator-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> var reactComponentExpect;
<ide> describe('ReactContextValidator', function() {
<ide> require('mock-modules').dumpCache();
<ide>
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> reactComponentExpect = require('reactComponentExpect');
<ide>
<ide> describe('ReactContextValidator', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> React.render(<Parent foo="abc" />, container);
<del> React.render(<Parent foo="def" />, container);
<add> ReactDOM.render(<Parent foo="abc" />, container);
<add> ReactDOM.render(<Parent foo="def" />, container);
<ide> expect(actualComponentWillReceiveProps).toEqual({foo: 'def'});
<ide> expect(actualShouldComponentUpdate).toEqual({foo: 'def'});
<ide> expect(actualComponentWillUpdate).toEqual({foo: 'def'});
<ide><path>src/isomorphic/classic/class/__tests__/ReactClass-test.js
<ide> var mocks = require('mocks');
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> describe('ReactClass-spec', function() {
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> spyOn(console, 'error');
<ide> });
<ide> describe('ReactClass-spec', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> React.render(<Outer />, container);
<add> ReactDOM.render(<Outer />, container);
<ide> expect(container.firstChild.className).toBe('foo');
<ide> });
<ide>
<ide> describe('ReactClass-spec', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> var instance = React.render(<MyComponent />, container);
<add> var instance = ReactDOM.render(<MyComponent />, container);
<ide>
<ide> instance.getDOMNode();
<ide>
<ide><path>src/isomorphic/classic/element/__tests__/ReactElement-test.js
<ide> // classic JS without JSX.
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> describe('ReactElement', function() {
<ide> describe('ReactElement', function() {
<ide> require('mock-modules').dumpCache();
<ide>
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> ComponentClass = React.createClass({
<ide> render: function() {
<ide> describe('ReactElement', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> var instance = React.render(
<add> var instance = ReactDOM.render(
<ide> React.createElement(Component, {fruit: 'mango'}),
<ide> container
<ide> );
<ide> expect(instance.props.fruit).toBe('mango');
<ide>
<del> React.render(React.createElement(Component), container);
<add> ReactDOM.render(React.createElement(Component), container);
<ide> expect(instance.props.fruit).toBe('persimmon');
<ide> });
<ide>
<ide> describe('ReactElement', function() {
<ide> },
<ide> });
<ide> var outer = ReactTestUtils.renderIntoDocument(<Outer color="orange" />);
<del> expect(React.findDOMNode(outer).className).toBe('moo');
<add> expect(ReactDOM.findDOMNode(outer).className).toBe('moo');
<ide> });
<ide>
<ide> it('throws when adding a prop (in dev) after element creation', function() {
<ide> describe('ReactElement', function() {
<ide> return el;
<ide> },
<ide> });
<del> var outer = React.render(<Outer />, container);
<del> expect(React.findDOMNode(outer).textContent).toBe('meow');
<del> expect(React.findDOMNode(outer).className).toBe('');
<add> var outer = ReactDOM.render(<Outer />, container);
<add> expect(ReactDOM.findDOMNode(outer).textContent).toBe('meow');
<add> expect(ReactDOM.findDOMNode(outer).className).toBe('');
<ide> });
<ide>
<ide> it('does not warn for NaN props', function() {
<ide><path>src/isomorphic/classic/element/__tests__/ReactElementClone-test.js
<ide> require('mock-modules');
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> describe('ReactElementClone', function() {
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> });
<ide>
<ide> describe('ReactElementClone', function() {
<ide> },
<ide> });
<ide> var component = ReactTestUtils.renderIntoDocument(<Grandparent />);
<del> expect(React.findDOMNode(component).childNodes[0].className).toBe('xyz');
<add> expect(ReactDOM.findDOMNode(component).childNodes[0].className).toBe('xyz');
<ide> });
<ide>
<ide> it('should clone a composite component with new props', function() {
<ide> describe('ReactElementClone', function() {
<ide> },
<ide> });
<ide> var component = ReactTestUtils.renderIntoDocument(<Grandparent />);
<del> expect(React.findDOMNode(component).childNodes[0].className).toBe('xyz');
<add> expect(ReactDOM.findDOMNode(component).childNodes[0].className).toBe('xyz');
<ide> });
<ide>
<ide> it('should keep the original ref if it is not overridden', function() {
<ide><path>src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js
<ide> // classic JS without JSX.
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactFragment;
<ide> var ReactTestUtils;
<ide>
<ide> describe('ReactElementValidator', function() {
<ide> require('mock-modules').dumpCache();
<ide>
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactFragment = require('ReactFragment');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> ComponentClass = React.createClass({
<ide> describe('ReactElementValidator', function() {
<ide> return <div />;
<ide> },
<ide> componentDidMount: function() {
<del> React.findDOMNode(this).appendChild(this.props.children);
<add> ReactDOM.findDOMNode(this).appendChild(this.props.children);
<ide> },
<ide> });
<ide>
<ide><path>src/isomorphic/deprecated/__tests__/cloneWithProps-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> var onlyChild;
<ide> describe('cloneWithProps', function() {
<ide> beforeEach(function() {
<ide> require('mock-modules').dumpCache();
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> onlyChild = require('onlyChild');
<ide> cloneWithProps = require('cloneWithProps');
<ide> describe('cloneWithProps', function() {
<ide> },
<ide> });
<ide> var component = ReactTestUtils.renderIntoDocument(<Grandparent />);
<del> expect(React.findDOMNode(component).childNodes[0].className)
<add> expect(ReactDOM.findDOMNode(component).childNodes[0].className)
<ide> .toBe('xyz child');
<ide> });
<ide>
<ide> describe('cloneWithProps', function() {
<ide> },
<ide> });
<ide> var component = ReactTestUtils.renderIntoDocument(<Grandparent />);
<del> expect(React.findDOMNode(component).childNodes[0].className)
<add> expect(ReactDOM.findDOMNode(component).childNodes[0].className)
<ide> .toBe('xyz child');
<ide> });
<ide>
<ide><path>src/isomorphic/modern/class/__tests__/ReactES6Class-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide>
<ide> describe('ReactES6Class', function() {
<ide>
<ide> describe('ReactES6Class', function() {
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> container = document.createElement('div');
<ide> attachedListener = null;
<ide> renderedName = null;
<ide> describe('ReactES6Class', function() {
<ide> });
<ide>
<ide> function test(element, expectedTag, expectedClassName) {
<del> var instance = React.render(element, container);
<add> var instance = ReactDOM.render(element, container);
<ide> expect(container.firstChild).not.toBeNull();
<ide> expect(container.firstChild.tagName).toBe(expectedTag);
<ide> expect(container.firstChild.className).toBe(expectedClassName);
<ide> describe('ReactES6Class', function() {
<ide> it('throws if no render function is defined', function() {
<ide> spyOn(console, 'error');
<ide> class Foo extends React.Component { }
<del> expect(() => React.render(<Foo />, container)).toThrow();
<add> expect(() => ReactDOM.render(<Foo />, container)).toThrow();
<ide>
<ide> expect(console.error.calls.length).toBe(1);
<ide> expect(console.error.calls[0].args[0]).toBe(
<ide> describe('ReactES6Class', function() {
<ide> 'did-update', freeze({value: 'foo'}), {},
<ide> ]);
<ide> lifeCycles = []; // reset
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> expect(lifeCycles).toEqual([
<ide> 'will-unmount',
<ide> ]);
<ide> describe('ReactES6Class', function() {
<ide>
<ide> it('supports drilling through to the DOM using findDOMNode', function() {
<ide> var instance = test(<Inner name="foo" />, 'DIV', 'foo');
<del> var node = React.findDOMNode(instance);
<add> var node = ReactDOM.findDOMNode(instance);
<ide> expect(node).toBe(container.firstChild);
<ide> });
<ide>
<ide><path>src/isomorphic/modern/element/__tests__/ReactJSXElement-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> describe('ReactJSXElement', function() {
<ide> describe('ReactJSXElement', function() {
<ide> require('mock-modules').dumpCache();
<ide>
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> Component = class {
<ide> render() {
<ide> describe('ReactJSXElement', function() {
<ide> Component.defaultProps = {fruit: 'persimmon'};
<ide>
<ide> var container = document.createElement('div');
<del> var instance = React.render(
<add> var instance = ReactDOM.render(
<ide> <Component fruit="mango" />,
<ide> container
<ide> );
<ide> expect(instance.props.fruit).toBe('mango');
<ide>
<del> React.render(<Component />, container);
<add> ReactDOM.render(<Component />, container);
<ide> expect(instance.props.fruit).toBe('persimmon');
<ide> });
<ide>
<ide><path>src/renderers/dom/client/__tests__/ReactDOM-test.js
<ide> 'use strict';
<ide>
<ide> var React = require('React');
<add>var ReactDOM = require('ReactDOM');
<ide> var ReactTestUtils = require('ReactTestUtils');
<ide> var div = React.createFactory('div');
<ide>
<ide> describe('ReactDOM', function() {
<ide> it('allows a DOM element to be used with a string', function() {
<ide> var element = React.createElement('div', {className: 'foo'});
<ide> var instance = ReactTestUtils.renderIntoDocument(element);
<del> expect(React.findDOMNode(instance).tagName).toBe('DIV');
<add> expect(ReactDOM.findDOMNode(instance).tagName).toBe('DIV');
<ide> });
<ide>
<ide> it('should allow children to be passed as an argument', function() {
<ide> var argDiv = ReactTestUtils.renderIntoDocument(
<ide> div(null, 'child')
<ide> );
<del> var argNode = React.findDOMNode(argDiv);
<add> var argNode = ReactDOM.findDOMNode(argDiv);
<ide> expect(argNode.innerHTML).toBe('child');
<ide> });
<ide>
<ide> it('should overwrite props.children with children argument', function() {
<ide> var conflictDiv = ReactTestUtils.renderIntoDocument(
<ide> div({children: 'fakechild'}, 'child')
<ide> );
<del> var conflictNode = React.findDOMNode(conflictDiv);
<add> var conflictNode = ReactDOM.findDOMNode(conflictDiv);
<ide> expect(conflictNode.innerHTML).toBe('child');
<ide> });
<ide>
<ide> describe('ReactDOM', function() {
<ide> <div key="theBird" className="bird" />,
<ide> </div>
<ide> );
<del> var root = React.findDOMNode(myDiv);
<add> var root = ReactDOM.findDOMNode(myDiv);
<ide> var dog = root.childNodes[0];
<ide> expect(dog.className).toBe('bigdog');
<ide> });
<ide><path>src/renderers/dom/client/__tests__/ReactDOMSVG-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOMServer;
<ide>
<ide> describe('ReactDOMSVG', function() {
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOMServer = require('ReactDOMServer');
<ide> });
<ide>
<ide> it('creates initial namespaced markup', function() {
<del> var markup = React.renderToString(
<add> var markup = ReactDOMServer.renderToString(
<ide> <svg>
<ide> <image xlinkHref="http://i.imgur.com/w7GCRPb.png" />
<ide> </svg>
<ide><path>src/renderers/dom/client/__tests__/ReactEventListener-test.js
<ide> var EVENT_TARGET_PARAM = 1;
<ide> describe('ReactEventListener', function() {
<ide> var React;
<ide>
<add> var ReactDOM;
<add>
<ide> var ReactMount;
<ide> var ReactEventListener;
<ide> var ReactTestUtils;
<ide> describe('ReactEventListener', function() {
<ide> require('mock-modules').dumpCache();
<ide> React = require('React');
<ide>
<add> ReactDOM = require('ReactDOM');
<add>
<ide> ReactMount = require('ReactMount');
<ide> ReactEventListener = require('ReactEventListener');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> describe('ReactEventListener', function() {
<ide> fromElement: otherNode,
<ide> target: otherNode,
<ide> srcElement: otherNode,
<del> toElement: React.findDOMNode(component),
<del> relatedTarget: React.findDOMNode(component),
<add> toElement: ReactDOM.findDOMNode(component),
<add> relatedTarget: ReactDOM.findDOMNode(component),
<ide> view: window,
<ide> path: [otherNode, otherNode],
<ide> },
<ide> describe('ReactEventListener', function() {
<ide> childControl = ReactMount.render(childControl, childContainer);
<ide> parentControl =
<ide> ReactMount.render(parentControl, parentContainer);
<del> React.findDOMNode(parentControl).appendChild(childContainer);
<add> ReactDOM.findDOMNode(parentControl).appendChild(childContainer);
<ide>
<ide> var callback = ReactEventListener.dispatchEvent.bind(null, 'test');
<ide> callback({
<del> target: React.findDOMNode(childControl),
<add> target: ReactDOM.findDOMNode(childControl),
<ide> });
<ide>
<ide> var calls = handleTopLevel.mock.calls;
<ide> expect(calls.length).toBe(2);
<ide> expect(calls[0][EVENT_TARGET_PARAM])
<del> .toBe(React.findDOMNode(childControl));
<add> .toBe(ReactDOM.findDOMNode(childControl));
<ide> expect(calls[1][EVENT_TARGET_PARAM])
<del> .toBe(React.findDOMNode(parentControl));
<add> .toBe(ReactDOM.findDOMNode(parentControl));
<ide> });
<ide>
<ide> it('should propagate events two levels down', function() {
<ide> describe('ReactEventListener', function() {
<ide> ReactMount.render(parentControl, parentContainer);
<ide> grandParentControl =
<ide> ReactMount.render(grandParentControl, grandParentContainer);
<del> React.findDOMNode(parentControl).appendChild(childContainer);
<del> React.findDOMNode(grandParentControl).appendChild(parentContainer);
<add> ReactDOM.findDOMNode(parentControl).appendChild(childContainer);
<add> ReactDOM.findDOMNode(grandParentControl).appendChild(parentContainer);
<ide>
<ide> var callback = ReactEventListener.dispatchEvent.bind(null, 'test');
<ide> callback({
<del> target: React.findDOMNode(childControl),
<add> target: ReactDOM.findDOMNode(childControl),
<ide> });
<ide>
<ide> var calls = handleTopLevel.mock.calls;
<ide> expect(calls.length).toBe(3);
<ide> expect(calls[0][EVENT_TARGET_PARAM])
<del> .toBe(React.findDOMNode(childControl));
<add> .toBe(ReactDOM.findDOMNode(childControl));
<ide> expect(calls[1][EVENT_TARGET_PARAM])
<del> .toBe(React.findDOMNode(parentControl));
<add> .toBe(ReactDOM.findDOMNode(parentControl));
<ide> expect(calls[2][EVENT_TARGET_PARAM])
<del> .toBe(React.findDOMNode(grandParentControl));
<add> .toBe(ReactDOM.findDOMNode(grandParentControl));
<ide> });
<ide>
<ide> it('should not get confused by disappearing elements', function() {
<ide> describe('ReactEventListener', function() {
<ide> childControl = ReactMount.render(childControl, childContainer);
<ide> parentControl =
<ide> ReactMount.render(parentControl, parentContainer);
<del> React.findDOMNode(parentControl).appendChild(childContainer);
<add> ReactDOM.findDOMNode(parentControl).appendChild(childContainer);
<ide>
<ide> // ReactBrowserEventEmitter.handleTopLevel might remove the
<ide> // target from the DOM. Here, we have handleTopLevel remove the
<ide> // node when the first event handlers are called; we'll still
<ide> // expect to receive a second call for the parent control.
<del> var childNode = React.findDOMNode(childControl);
<add> var childNode = ReactDOM.findDOMNode(childControl);
<ide> handleTopLevel.mockImplementation(
<ide> function(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
<ide> if (topLevelTarget === childNode) {
<ide> describe('ReactEventListener', function() {
<ide> expect(calls.length).toBe(2);
<ide> expect(calls[0][EVENT_TARGET_PARAM]).toBe(childNode);
<ide> expect(calls[1][EVENT_TARGET_PARAM])
<del> .toBe(React.findDOMNode(parentControl));
<add> .toBe(ReactDOM.findDOMNode(parentControl));
<ide> });
<ide>
<ide> it('should batch between handlers from different roots', function() {
<ide> describe('ReactEventListener', function() {
<ide> <div>Parent</div>,
<ide> parentContainer
<ide> );
<del> React.findDOMNode(parentControl).appendChild(childContainer);
<add> ReactDOM.findDOMNode(parentControl).appendChild(childContainer);
<ide>
<ide> // Suppose an event handler in each root enqueues an update to the
<ide> // childControl element -- the two updates should get batched together.
<del> var childNode = React.findDOMNode(childControl);
<add> var childNode = ReactDOM.findDOMNode(childControl);
<ide> handleTopLevel.mockImplementation(
<ide> function(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
<ide> ReactMount.render(
<ide> describe('ReactEventListener', function() {
<ide>
<ide> var callback = ReactEventListener.dispatchEvent.bind(null, 'test');
<ide> callback({
<del> target: React.findDOMNode(instance.getInner()),
<add> target: ReactDOM.findDOMNode(instance.getInner()),
<ide> });
<ide>
<ide> var calls = handleTopLevel.mock.calls;
<ide> expect(calls.length).toBe(1);
<ide> expect(calls[0][EVENT_TARGET_PARAM])
<del> .toBe(React.findDOMNode(instance.getInner()));
<add> .toBe(ReactDOM.findDOMNode(instance.getInner()));
<ide> });
<ide> });
<ide><path>src/renderers/dom/client/__tests__/ReactMount-test.js
<ide> var mocks = require('mocks');
<ide>
<ide> describe('ReactMount', function() {
<ide> var React = require('React');
<add> var ReactDOM = require('ReactDOM');
<add> var ReactDOMServer = require('ReactDOMServer');
<ide> var ReactMount = require('ReactMount');
<ide> var ReactTestUtils = require('ReactTestUtils');
<ide> var WebComponents = WebComponents;
<ide> describe('ReactMount', function() {
<ide> it('throws when given a non-node', function() {
<ide> var nodeArray = document.getElementsByTagName('div');
<ide> expect(function() {
<del> React.unmountComponentAtNode(nodeArray);
<add> ReactDOM.unmountComponentAtNode(nodeArray);
<ide> }).toThrow(
<ide> 'Invariant Violation: unmountComponentAtNode(...): Target container ' +
<ide> 'is not a DOM element.'
<ide> describe('ReactMount', function() {
<ide>
<ide> it('should reuse markup if rendering to the same target twice', function() {
<ide> var container = document.createElement('container');
<del> var instance1 = React.render(<div />, container);
<del> var instance2 = React.render(<div />, container);
<add> var instance1 = ReactDOM.render(<div />, container);
<add> var instance2 = ReactDOM.render(<div />, container);
<ide>
<ide> expect(instance1 === instance2).toBe(true);
<ide> });
<ide>
<ide> it('should warn if mounting into dirty rendered markup', function() {
<ide> var container = document.createElement('container');
<del> container.innerHTML = React.renderToString(<div />) + ' ';
<add> container.innerHTML = ReactDOMServer.renderToString(<div />) + ' ';
<ide>
<ide> spyOn(console, 'error');
<ide> ReactMount.render(<div />, container);
<ide> expect(console.error.calls.length).toBe(1);
<ide>
<del> container.innerHTML = ' ' + React.renderToString(<div />);
<add> container.innerHTML = ' ' + ReactDOMServer.renderToString(<div />);
<ide>
<ide> ReactMount.render(<div />, container);
<ide> expect(console.error.calls.length).toBe(2);
<ide> describe('ReactMount', function() {
<ide>
<ide> it('should account for escaping on a checksum mismatch', function () {
<ide> var div = document.createElement('div');
<del> var markup = React.renderToString(
<add> var markup = ReactDOMServer.renderToString(
<ide> <div>This markup contains an nbsp entity: server text</div>);
<ide> div.innerHTML = markup;
<ide>
<ide> spyOn(console, 'error');
<del> React.render(
<add> ReactDOM.render(
<ide> <div>This markup contains an nbsp entity: client text</div>,
<ide> div
<ide> );
<ide> describe('ReactMount', function() {
<ide> createdCallback: {
<ide> value: function() {
<ide> shadowRoot = this.createShadowRoot();
<del> React.render(<div>Hi, from within a WC!</div>, shadowRoot);
<add> ReactDOM.render(<div>Hi, from within a WC!</div>, shadowRoot);
<ide> expect(shadowRoot.firstChild.tagName).toBe('DIV');
<del> React.render(<span>Hi, from within a WC!</span>, shadowRoot);
<add> ReactDOM.render(<span>Hi, from within a WC!</span>, shadowRoot);
<ide> expect(shadowRoot.firstChild.tagName).toBe('SPAN');
<ide> },
<ide> },
<ide> });
<ide> proto.unmount = function() {
<del> React.unmountComponentAtNode(shadowRoot);
<add> ReactDOM.unmountComponentAtNode(shadowRoot);
<ide> };
<ide> document.registerElement('x-foo', {prototype: proto});
<ide> var element = document.createElement('x-foo');
<ide><path>src/renderers/dom/client/__tests__/ReactMountDestruction-test.js
<ide> 'use strict';
<ide>
<ide> var React = require('React');
<add>var ReactDOM = require('ReactDOM');
<ide>
<ide> describe('ReactMount', function() {
<ide> it('should destroy a react root upon request', function() {
<ide> describe('ReactMount', function() {
<ide> );
<ide> var firstRootDiv = document.createElement('div');
<ide> mainContainerDiv.appendChild(firstRootDiv);
<del> React.render(instanceOne, firstRootDiv);
<add> ReactDOM.render(instanceOne, firstRootDiv);
<ide>
<ide> var instanceTwo = (
<ide> <div className="secondReactDiv">
<ide> </div>
<ide> );
<ide> var secondRootDiv = document.createElement('div');
<ide> mainContainerDiv.appendChild(secondRootDiv);
<del> React.render(instanceTwo, secondRootDiv);
<add> ReactDOM.render(instanceTwo, secondRootDiv);
<ide>
<ide> // Test that two react roots are rendered in isolation
<ide> expect(firstRootDiv.firstChild.className).toBe('firstReactDiv');
<ide> expect(secondRootDiv.firstChild.className).toBe('secondReactDiv');
<ide>
<ide> // Test that after unmounting each, they are no longer in the document.
<del> React.unmountComponentAtNode(firstRootDiv);
<add> ReactDOM.unmountComponentAtNode(firstRootDiv);
<ide> expect(firstRootDiv.firstChild).toBeNull();
<del> React.unmountComponentAtNode(secondRootDiv);
<add> ReactDOM.unmountComponentAtNode(secondRootDiv);
<ide> expect(secondRootDiv.firstChild).toBeNull();
<ide> });
<ide> });
<ide><path>src/renderers/dom/client/__tests__/ReactRenderDocument-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<add>var ReactDOMServer;
<ide> var ReactInstanceMap;
<ide> var ReactMount;
<ide>
<ide> describe('rendering React components at document', function() {
<ide> require('mock-modules').dumpCache();
<ide>
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<add> ReactDOMServer = require('ReactDOMServer');
<ide> ReactInstanceMap = require('ReactInstanceMap');
<ide> ReactMount = require('ReactMount');
<ide> getTestDocument = require('getTestDocument');
<ide> describe('rendering React components at document', function() {
<ide> },
<ide> });
<ide>
<del> var markup = React.renderToString(<Root />);
<add> var markup = ReactDOMServer.renderToString(<Root />);
<ide> testDocument = getTestDocument(markup);
<del> var component = React.render(<Root />, testDocument);
<add> var component = ReactDOM.render(<Root />, testDocument);
<ide> expect(testDocument.body.innerHTML).toBe('Hello world');
<ide>
<ide> // TODO: This is a bad test. I have no idea what this is testing.
<ide> describe('rendering React components at document', function() {
<ide> },
<ide> });
<ide>
<del> var markup = React.renderToString(<Root />);
<add> var markup = ReactDOMServer.renderToString(<Root />);
<ide> testDocument = getTestDocument(markup);
<del> React.render(<Root />, testDocument);
<add> ReactDOM.render(<Root />, testDocument);
<ide> expect(testDocument.body.innerHTML).toBe('Hello world');
<ide>
<ide> expect(function() {
<del> React.unmountComponentAtNode(testDocument);
<add> ReactDOM.unmountComponentAtNode(testDocument);
<ide> }).toThrow(UNMOUNT_INVARIANT_MESSAGE);
<ide>
<ide> expect(testDocument.body.innerHTML).toBe('Hello world');
<ide> describe('rendering React components at document', function() {
<ide> },
<ide> });
<ide>
<del> var markup = React.renderToString(<Component />);
<add> var markup = ReactDOMServer.renderToString(<Component />);
<ide> testDocument = getTestDocument(markup);
<ide>
<del> React.render(<Component />, testDocument);
<add> ReactDOM.render(<Component />, testDocument);
<ide>
<ide> expect(testDocument.body.innerHTML).toBe('Hello world');
<ide>
<ide> // Reactive update
<ide> expect(function() {
<del> React.render(<Component2 />, testDocument);
<add> ReactDOM.render(<Component2 />, testDocument);
<ide> }).toThrow(UNMOUNT_INVARIANT_MESSAGE);
<ide>
<ide> expect(testDocument.body.innerHTML).toBe('Hello world');
<ide> describe('rendering React components at document', function() {
<ide> },
<ide> });
<ide>
<del> var markup = React.renderToString(
<add> var markup = ReactDOMServer.renderToString(
<ide> <Component text="Hello world" />
<ide> );
<ide> testDocument = getTestDocument(markup);
<ide>
<del> React.render(<Component text="Hello world" />, testDocument);
<add> ReactDOM.render(<Component text="Hello world" />, testDocument);
<ide>
<ide> expect(testDocument.body.innerHTML).toBe('Hello world');
<ide> });
<ide> describe('rendering React components at document', function() {
<ide> },
<ide> });
<ide>
<del> var markup = React.renderToString(
<add> var markup = ReactDOMServer.renderToString(
<ide> <Component text="Goodbye world" />
<ide> );
<ide> testDocument = getTestDocument(markup);
<ide>
<ide> expect(function() {
<ide> // Notice the text is different!
<del> React.render(<Component text="Hello world" />, testDocument);
<add> ReactDOM.render(<Component text="Hello world" />, testDocument);
<ide> }).toThrow(
<ide> 'Invariant Violation: ' +
<ide> 'You\'re trying to render a component to the document using ' +
<ide> describe('rendering React components at document', function() {
<ide> });
<ide>
<ide> expect(function() {
<del> React.render(<Component />, container);
<add> ReactDOM.render(<Component />, container);
<ide> }).toThrow(
<ide> 'Invariant Violation: You\'re trying to render a component to the ' +
<ide> 'document but you didn\'t use server rendering. We can\'t do this ' +
<ide> describe('rendering React components at document', function() {
<ide> </body>
<ide> </html>;
<ide>
<del> var markup = React.renderToString(tree);
<add> var markup = ReactDOMServer.renderToString(tree);
<ide> testDocument = getTestDocument(markup);
<del> var component = React.render(tree, testDocument);
<add> var component = ReactDOM.render(tree, testDocument);
<ide> expect(testDocument.body.innerHTML).toBe('Hello world');
<del> expect(React.findDOMNode(component).tagName).toBe('HTML');
<add> expect(ReactDOM.findDOMNode(component).tagName).toBe('HTML');
<ide> });
<ide> });
<ide><path>src/renderers/dom/client/__tests__/findDOMNode-test.js
<ide> 'use strict';
<ide>
<ide> var React = require('React');
<add>var ReactDOM = require('ReactDOM');
<ide> var ReactTestUtils = require('ReactTestUtils');
<ide>
<ide> describe('findDOMNode', function() {
<ide> it('findDOMNode should return null if passed null', function() {
<del> expect(React.findDOMNode(null)).toBe(null);
<add> expect(ReactDOM.findDOMNode(null)).toBe(null);
<ide> });
<ide>
<ide> it('findDOMNode should find dom element', function() {
<ide> describe('findDOMNode', function() {
<ide> });
<ide>
<ide> var myNode = ReactTestUtils.renderIntoDocument(<MyNode />);
<del> var myDiv = React.findDOMNode(myNode);
<del> var mySameDiv = React.findDOMNode(myDiv);
<add> var myDiv = ReactDOM.findDOMNode(myNode);
<add> var mySameDiv = ReactDOM.findDOMNode(myDiv);
<ide> expect(myDiv.tagName).toBe('DIV');
<ide> expect(mySameDiv).toBe(myDiv);
<ide> });
<ide>
<ide> it('findDOMNode should reject random objects', function() {
<ide> expect(function() {
<del> React.findDOMNode({foo: 'bar'});
<add> ReactDOM.findDOMNode({foo: 'bar'});
<ide> })
<ide> .toThrow('Invariant Violation: Element appears to be neither ' +
<ide> 'ReactComponent nor DOMNode (keys: foo)'
<ide> describe('findDOMNode', function() {
<ide>
<ide> it('findDOMNode should reject unmounted objects with render func', function() {
<ide> expect(function() {
<del> React.findDOMNode({render: function() {}});
<add> ReactDOM.findDOMNode({render: function() {}});
<ide> })
<ide> .toThrow('Invariant Violation: Component (with keys: render) ' +
<ide> 'contains `render` method but is not mounted in the DOM'
<ide><path>src/renderers/dom/client/eventPlugins/__tests__/EnterLeaveEventPlugin-test.js
<ide> var EnterLeaveEventPlugin;
<ide> var EventConstants;
<ide> var React;
<add>var ReactDOM;
<ide> var ReactMount;
<ide>
<ide> var topLevelTypes;
<ide> describe('EnterLeaveEventPlugin', function() {
<ide> EnterLeaveEventPlugin = require('EnterLeaveEventPlugin');
<ide> EventConstants = require('EventConstants');
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactMount = require('ReactMount');
<ide>
<ide> topLevelTypes = EventConstants.topLevelTypes;
<ide> describe('EnterLeaveEventPlugin', function() {
<ide> );
<ide> iframeDocument.close();
<ide>
<del> var component = React.render(<div />, iframeDocument.body.getElementsByTagName('div')[0]);
<del> var div = React.findDOMNode(component);
<add> var component = ReactDOM.render(<div />, iframeDocument.body.getElementsByTagName('div')[0]);
<add> var div = ReactDOM.findDOMNode(component);
<ide>
<ide> var extracted = EnterLeaveEventPlugin.extractEvents(
<ide> topLevelTypes.topMouseOver,
<ide><path>src/renderers/dom/client/eventPlugins/__tests__/SelectEventPlugin-test.js
<ide>
<ide> var EventConstants;
<ide> var React;
<add>var ReactDOM;
<ide> var ReactMount;
<ide> var ReactTestUtils;
<ide> var SelectEventPlugin;
<ide> describe('SelectEventPlugin', function() {
<ide> beforeEach(function() {
<ide> EventConstants = require('EventConstants');
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactMount = require('ReactMount');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> SelectEventPlugin = require('SelectEventPlugin');
<ide> describe('SelectEventPlugin', function() {
<ide> });
<ide>
<ide> var rendered = ReactTestUtils.renderIntoDocument(<WithoutSelect />);
<del> var node = React.findDOMNode(rendered);
<add> var node = ReactDOM.findDOMNode(rendered);
<ide> node.focus();
<ide>
<ide> var mousedown = extract(node, topLevelTypes.topMouseDown);
<ide> describe('SelectEventPlugin', function() {
<ide> var rendered = ReactTestUtils.renderIntoDocument(
<ide> <WithSelect onSelect={cb} />
<ide> );
<del> var node = React.findDOMNode(rendered);
<add> var node = ReactDOM.findDOMNode(rendered);
<ide>
<ide> node.selectionStart = 0;
<ide> node.selectionEnd = 0;
<ide><path>src/renderers/dom/client/wrappers/__tests__/ReactDOMButton-test.js
<ide> var mocks = require('mocks');
<ide>
<ide> describe('ReactDOMButton', function() {
<ide> var React;
<add> var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> var onClick = mocks.getMockFunction();
<ide>
<ide> function expectClickThru(button) {
<ide> onClick.mockClear();
<del> ReactTestUtils.Simulate.click(React.findDOMNode(button));
<add> ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(button));
<ide> expect(onClick.mock.calls.length).toBe(1);
<ide> }
<ide>
<ide> function expectNoClickThru(button) {
<ide> onClick.mockClear();
<del> ReactTestUtils.Simulate.click(React.findDOMNode(button));
<add> ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(button));
<ide> expect(onClick.mock.calls.length).toBe(0);
<ide> }
<ide>
<ide> describe('ReactDOMButton', function() {
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> });
<ide>
<ide> describe('ReactDOMButton', function() {
<ide>
<ide> it('should forward clicks when it becomes not disabled', function() {
<ide> var container = document.createElement('div');
<del> var btn = React.render(
<add> var btn = ReactDOM.render(
<ide> <button disabled={true} onClick={onClick} />,
<ide> container
<ide> );
<del> btn = React.render(
<add> btn = ReactDOM.render(
<ide> <button onClick={onClick} />,
<ide> container
<ide> );
<ide> describe('ReactDOMButton', function() {
<ide>
<ide> it('should not forward clicks when it becomes disabled', function() {
<ide> var container = document.createElement('div');
<del> var btn = React.render(
<add> var btn = ReactDOM.render(
<ide> <button onClick={onClick} />,
<ide> container
<ide> );
<del> btn = React.render(
<add> btn = ReactDOM.render(
<ide> <button disabled={true} onClick={onClick} />,
<ide> container
<ide> );
<ide> describe('ReactDOMButton', function() {
<ide>
<ide> it('should work correctly if the listener is changed', function() {
<ide> var container = document.createElement('div');
<del> var btn = React.render(
<add> var btn = ReactDOM.render(
<ide> <button disabled={true} onClick={function() {}} />,
<ide> container
<ide> );
<del> btn = React.render(
<add> btn = ReactDOM.render(
<ide> <button disabled={false} onClick={onClick} />,
<ide> container
<ide> );
<ide><path>src/renderers/dom/client/wrappers/__tests__/ReactDOMIframe-test.js
<ide>
<ide> describe('ReactDOMIframe', function() {
<ide> var React;
<add> var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> });
<ide>
<ide> describe('ReactDOMIframe', function() {
<ide> var loadEvent = document.createEvent('Event');
<ide> loadEvent.initEvent('load', false, false);
<ide>
<del> React.findDOMNode(iframe).dispatchEvent(loadEvent);
<add> ReactDOM.findDOMNode(iframe).dispatchEvent(loadEvent);
<ide>
<ide> expect(onLoadSpy).toHaveBeenCalled();
<ide> });
<ide><path>src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js
<ide> var mocks = require('mocks');
<ide> describe('ReactDOMInput', function() {
<ide> var EventConstants;
<ide> var React;
<add> var ReactDOM;
<ide> var ReactLink;
<ide> var ReactTestUtils;
<ide>
<ide> beforeEach(function() {
<ide> require('mock-modules').dumpCache();
<ide> EventConstants = require('EventConstants');
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactLink = require('ReactLink');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> spyOn(console, 'error');
<ide> describe('ReactDOMInput', function() {
<ide> it('should display `defaultValue` of number 0', function() {
<ide> var stub = <input type="text" defaultValue={0} />;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('0');
<ide> });
<ide>
<ide> it('should display "true" for `defaultValue` of `true`', function() {
<ide> var stub = <input type="text" defaultValue={true} />;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('true');
<ide> });
<ide>
<ide> it('should display "false" for `defaultValue` of `false`', function() {
<ide> var stub = <input type="text" defaultValue={false} />;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('false');
<ide> });
<ide> describe('ReactDOMInput', function() {
<ide>
<ide> var stub = <input type="text" defaultValue={objToString} />;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('foobar');
<ide> });
<ide>
<ide> it('should display `value` of number 0', function() {
<ide> var stub = <input type="text" value={0} />;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('0');
<ide> });
<ide>
<ide> it('should allow setting `value` to `true`', function() {
<ide> var container = document.createElement('div');
<ide> var stub = <input type="text" value="yolo" onChange={emptyFunction} />;
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('yolo');
<ide>
<del> stub = React.render(
<add> stub = ReactDOM.render(
<ide> <input type="text" value={true} onChange={emptyFunction} />,
<ide> container
<ide> );
<ide> describe('ReactDOMInput', function() {
<ide> it('should allow setting `value` to `false`', function() {
<ide> var container = document.createElement('div');
<ide> var stub = <input type="text" value="yolo" onChange={emptyFunction} />;
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('yolo');
<ide>
<del> stub = React.render(
<add> stub = ReactDOM.render(
<ide> <input type="text" value={false} onChange={emptyFunction} />,
<ide> container
<ide> );
<ide> describe('ReactDOMInput', function() {
<ide> it('should allow setting `value` to `objToString`', function() {
<ide> var container = document.createElement('div');
<ide> var stub = <input type="text" value="foo" onChange={emptyFunction} />;
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('foo');
<ide>
<ide> describe('ReactDOMInput', function() {
<ide> return 'foobar';
<ide> },
<ide> };
<del> stub = React.render(
<add> stub = ReactDOM.render(
<ide> <input type="text" value={objToString} onChange={emptyFunction} />,
<ide> container
<ide> );
<ide> describe('ReactDOMInput', function() {
<ide> it('should properly control a value of number `0`', function() {
<ide> var stub = <input type="text" value={0} onChange={emptyFunction} />;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> node.value = 'giraffe';
<ide> ReactTestUtils.Simulate.change(node);
<ide> describe('ReactDOMInput', function() {
<ide> };
<ide> var stub = <input type="text" value={0} onChange={handler} />;
<ide> var container = document.createElement('div');
<del> var node = React.render(stub, container);
<add> var node = ReactDOM.render(stub, container);
<ide>
<ide> node.value = 'giraffe';
<ide>
<ide> describe('ReactDOMInput', function() {
<ide> it('should not set a value for submit buttons unnecessarily', function() {
<ide> var stub = <input type="submit" />;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> // The value shouldn't be '', or else the button will have no text; it
<ide> // should have the default "Submit" or "Submit Query" label. Most browsers
<ide> describe('ReactDOMInput', function() {
<ide> });
<ide>
<ide> var stub = ReactTestUtils.renderIntoDocument(<RadioGroup />);
<del> var aNode = React.findDOMNode(stub.refs.a);
<del> var bNode = React.findDOMNode(stub.refs.b);
<del> var cNode = React.findDOMNode(stub.refs.c);
<add> var aNode = ReactDOM.findDOMNode(stub.refs.a);
<add> var bNode = ReactDOM.findDOMNode(stub.refs.b);
<add> var cNode = ReactDOM.findDOMNode(stub.refs.c);
<ide>
<ide> expect(aNode.checked).toBe(true);
<ide> expect(bNode.checked).toBe(false);
<ide> describe('ReactDOMInput', function() {
<ide>
<ide> instance = ReactTestUtils.renderIntoDocument(instance);
<ide>
<del> expect(React.findDOMNode(instance).value).toBe('yolo');
<add> expect(ReactDOM.findDOMNode(instance).value).toBe('yolo');
<ide> expect(link.value).toBe('yolo');
<ide> expect(link.requestChange.mock.calls.length).toBe(0);
<ide>
<del> React.findDOMNode(instance).value = 'test';
<del> ReactTestUtils.Simulate.change(React.findDOMNode(instance));
<add> ReactDOM.findDOMNode(instance).value = 'test';
<add> ReactTestUtils.Simulate.change(ReactDOM.findDOMNode(instance));
<ide>
<ide> expect(link.requestChange.mock.calls.length).toBe(1);
<ide> expect(link.requestChange.mock.calls[0][0]).toEqual('test');
<ide> describe('ReactDOMInput', function() {
<ide> var link = new ReactLink('yolo', mocks.getMockFunction());
<ide> var instance = <input type="text" valueLink={link} />;
<ide>
<del> expect(() => React.render(instance, node)).not.toThrow();
<add> expect(() => ReactDOM.render(instance, node)).not.toThrow();
<ide>
<ide> instance =
<ide> <input
<ide> describe('ReactDOMInput', function() {
<ide> value="test"
<ide> onChange={emptyFunction}
<ide> />;
<del> expect(() => React.render(instance, node)).toThrow();
<add> expect(() => ReactDOM.render(instance, node)).toThrow();
<ide>
<ide> instance = <input type="text" valueLink={link} onChange={emptyFunction} />;
<del> expect(() => React.render(instance, node)).toThrow();
<add> expect(() => ReactDOM.render(instance, node)).toThrow();
<ide>
<ide> });
<ide>
<ide> describe('ReactDOMInput', function() {
<ide>
<ide> instance = ReactTestUtils.renderIntoDocument(instance);
<ide>
<del> expect(React.findDOMNode(instance).checked).toBe(true);
<add> expect(ReactDOM.findDOMNode(instance).checked).toBe(true);
<ide> expect(link.value).toBe(true);
<ide> expect(link.requestChange.mock.calls.length).toBe(0);
<ide>
<del> React.findDOMNode(instance).checked = false;
<del> ReactTestUtils.Simulate.change(React.findDOMNode(instance));
<add> ReactDOM.findDOMNode(instance).checked = false;
<add> ReactTestUtils.Simulate.change(ReactDOM.findDOMNode(instance));
<ide>
<ide> expect(link.requestChange.mock.calls.length).toBe(1);
<ide> expect(link.requestChange.mock.calls[0][0]).toEqual(false);
<ide> describe('ReactDOMInput', function() {
<ide> it('should warn with checked and no onChange handler', function() {
<ide> var node = document.createElement('div');
<ide> var link = new ReactLink(true, mocks.getMockFunction());
<del> React.render(<input type="checkbox" checkedLink={link} />, node);
<add> ReactDOM.render(<input type="checkbox" checkedLink={link} />, node);
<ide> expect(console.error.argsForCall.length).toBe(0);
<ide>
<ide> ReactTestUtils.renderIntoDocument(
<ide> describe('ReactDOMInput', function() {
<ide> var link = new ReactLink(true, mocks.getMockFunction());
<ide> var instance = <input type="checkbox" checkedLink={link} />;
<ide>
<del> expect(() => React.render(instance, node)).not.toThrow();
<add> expect(() => ReactDOM.render(instance, node)).not.toThrow();
<ide>
<ide> instance =
<ide> <input
<ide> describe('ReactDOMInput', function() {
<ide> checked="false"
<ide> onChange={emptyFunction}
<ide> />;
<del> expect(() => React.render(instance, node)).toThrow();
<add> expect(() => ReactDOM.render(instance, node)).toThrow();
<ide>
<ide> instance =
<ide> <input type="checkbox" checkedLink={link} onChange={emptyFunction} />;
<del> expect(() => React.render(instance, node)).toThrow();
<add> expect(() => ReactDOM.render(instance, node)).toThrow();
<ide>
<ide> });
<ide>
<ide> describe('ReactDOMInput', function() {
<ide> var link = new ReactLink(true, mocks.getMockFunction());
<ide> var instance = <input type="checkbox" checkedLink={link} />;
<ide>
<del> expect(() => React.render(instance, node)).not.toThrow();
<add> expect(() => ReactDOM.render(instance, node)).not.toThrow();
<ide>
<ide> instance = <input type="checkbox" valueLink={link} />;
<del> expect(() => React.render(instance, node)).not.toThrow();
<add> expect(() => ReactDOM.render(instance, node)).not.toThrow();
<ide>
<ide> instance =
<ide> <input type="checkbox" checkedLink={link} valueLink={emptyFunction} />;
<del> expect(() => React.render(instance, node)).toThrow();
<add> expect(() => ReactDOM.render(instance, node)).toThrow();
<ide> });
<ide> });
<ide><path>src/renderers/dom/client/wrappers/__tests__/ReactDOMOption-test.js
<ide>
<ide> describe('ReactDOMOption', function() {
<ide> var React;
<add> var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> });
<ide>
<ide> it('should flatten children to a string', function() {
<ide> var stub = <option>{1} {'foo'}</option>;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.innerHTML).toBe('1 foo');
<ide> });
<ide> describe('ReactDOMOption', function() {
<ide> spyOn(console, 'error');
<ide> var stub = <option>{1} <div /> {2}</option>;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.innerHTML).toBe('1 2');
<ide> expect(console.error.calls.length).toBe(1);
<ide> describe('ReactDOMOption', function() {
<ide> spyOn(console, 'error');
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<ide>
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(console.error.calls.length).toBe(0);
<ide> expect(node.innerHTML).toBe('1 2');
<ide> });
<del>
<ide> });
<ide><path>src/renderers/dom/client/wrappers/__tests__/ReactDOMSelect-test.js
<ide> var mocks = require('mocks');
<ide>
<ide> describe('ReactDOMSelect', function() {
<ide> var React;
<add> var ReactDOM;
<add> var ReactDOMServer;
<ide> var ReactLink;
<ide> var ReactTestUtils;
<ide>
<ide> var noop = function() {};
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<add> ReactDOMServer = require('ReactDOMServer');
<ide> ReactLink = require('ReactLink');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> });
<ide> describe('ReactDOMSelect', function() {
<ide> </select>;
<ide> var options = stub.props.children;
<ide> var container = document.createElement('div');
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('giraffe');
<ide>
<ide> // Changing `defaultValue` should do nothing.
<del> React.render(
<add> ReactDOM.render(
<ide> <select defaultValue="gorilla">{options}</select>,
<ide> container
<ide> );
<ide> describe('ReactDOMSelect', function() {
<ide> <option value="gorilla">A gorilla!</option>
<ide> </select>;
<ide> var container = document.createElement('div');
<del> var stub = React.render(el, container);
<del> var node = React.findDOMNode(stub);
<add> var stub = ReactDOM.render(el, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('giraffe');
<ide>
<ide> node.value = 'monkey';
<del> React.render(el, container);
<add> ReactDOM.render(el, container);
<ide> // Uncontrolled selects shouldn't change the value after first mounting
<ide> expect(node.value).toEqual('monkey');
<ide> });
<ide> describe('ReactDOMSelect', function() {
<ide> </select>;
<ide> var options = stub.props.children;
<ide> var container = document.createElement('div');
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(true); // giraffe
<ide> expect(node.options[2].selected).toBe(true); // gorilla
<ide>
<ide> // Changing `defaultValue` should do nothing.
<del> React.render(
<add> ReactDOM.render(
<ide> <select multiple={true} defaultValue={['monkey']}>{options}</select>,
<ide> container
<ide> );
<ide> describe('ReactDOMSelect', function() {
<ide> </select>;
<ide> var options = stub.props.children;
<ide> var container = document.createElement('div');
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('giraffe');
<ide>
<ide> // Changing the `value` prop should change the selected option.
<del> React.render(
<add> ReactDOM.render(
<ide> <select value="gorilla" onChange={noop}>{options}</select>,
<ide> container
<ide> );
<ide> describe('ReactDOMSelect', function() {
<ide> </select>;
<ide> var options = stub.props.children;
<ide> var container = document.createElement('div');
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(true); // giraffe
<ide> expect(node.options[2].selected).toBe(true); // gorilla
<ide>
<ide> // Changing the `value` prop should change the selected options.
<del> React.render(
<add> ReactDOM.render(
<ide> <select multiple={true} value={['monkey']} onChange={noop}>
<ide> {options}
<ide> </select>,
<ide> describe('ReactDOMSelect', function() {
<ide> <option value="12">twelve</option>
<ide> </select>;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // one
<ide> expect(node.options[1].selected).toBe(false); // two
<ide> describe('ReactDOMSelect', function() {
<ide> it('should reset child options selected when they are changed and `value` is set', function() {
<ide> var stub = <select multiple={true} value={['a', 'b']} onChange={noop} />;
<ide> var container = document.createElement('div');
<del> stub = React.render(stub, container);
<add> stub = ReactDOM.render(stub, container);
<ide>
<del> React.render(
<add> ReactDOM.render(
<ide> <select multiple={true} value={['a', 'b']} onChange={noop}>
<ide> <option value="a">a</option>
<ide> <option value="b">b</option>
<ide> describe('ReactDOMSelect', function() {
<ide> container
<ide> );
<ide>
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.options[0].selected).toBe(true); // a
<ide> expect(node.options[1].selected).toBe(true); // b
<ide> describe('ReactDOMSelect', function() {
<ide> <option value="gorilla">A gorilla!</option>
<ide> </select>;
<ide> var container = document.createElement('div');
<del> var stub = React.render(el, container);
<del> var node = React.findDOMNode(stub);
<add> var stub = ReactDOM.render(el, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(true); // giraffe
<ide> expect(node.options[2].selected).toBe(false); // gorilla
<ide>
<ide> // Changing the `value` prop should change the selected options.
<ide> objectToString.animal = 'monkey';
<del> React.render(el, container);
<add> ReactDOM.render(el, container);
<ide>
<ide> expect(node.options[0].selected).toBe(true); // monkey
<ide> expect(node.options[1].selected).toBe(false); // giraffe
<ide> describe('ReactDOMSelect', function() {
<ide> </select>;
<ide> var options = stub.props.children;
<ide> var container = document.createElement('div');
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(true); // giraffe
<ide> expect(node.options[2].selected).toBe(false); // gorilla
<ide>
<ide> // When making it multiple, giraffe and gorilla should be selected
<del> React.render(
<add> ReactDOM.render(
<ide> <select multiple={true} defaultValue={['giraffe', 'gorilla']}>
<ide> {options}
<ide> </select>,
<ide> describe('ReactDOMSelect', function() {
<ide> </select>;
<ide> var options = stub.props.children;
<ide> var container = document.createElement('div');
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(true); // giraffe
<ide> expect(node.options[2].selected).toBe(true); // gorilla
<ide>
<ide> // When removing multiple, defaultValue is applied again, being omitted
<ide> // means that "monkey" will be selected
<del> React.render(
<add> ReactDOM.render(
<ide> <select defaultValue="gorilla">{options}</select>,
<ide> container
<ide> );
<ide> describe('ReactDOMSelect', function() {
<ide> </select>;
<ide> var options = stub.props.children;
<ide> var container = document.createElement('div');
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(true); // giraffe
<ide> expect(node.options[2].selected).toBe(false); // gorilla
<ide>
<del> React.render(<select>{options}</select>, container);
<add> ReactDOM.render(<select>{options}</select>, container);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(true); // giraffe
<ide> describe('ReactDOMSelect', function() {
<ide> </select>;
<ide> var options = stub.props.children;
<ide> var container = document.createElement('div');
<del> stub = React.render(stub, container);
<del> var node = React.findDOMNode(stub);
<add> stub = ReactDOM.render(stub, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<del> React.render(
<add> ReactDOM.render(
<ide> <select value="gorilla" onChange={noop}>{options}</select>,
<ide> container
<ide> );
<ide> describe('ReactDOMSelect', function() {
<ide> expect(node.options[1].selected).toBe(false); // giraffe
<ide> expect(node.options[2].selected).toBe(true); // gorilla
<ide>
<del> React.render(<select>{options}</select>, container);
<add> ReactDOM.render(<select>{options}</select>, container);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(false); // giraffe
<ide> describe('ReactDOMSelect', function() {
<ide> <option value="gorilla">A gorilla!</option>
<ide> </select>;
<ide> stub = ReactTestUtils.renderIntoDocument(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(true); // giraffe
<ide> describe('ReactDOMSelect', function() {
<ide> <option value="giraffe">A giraffe!</option>
<ide> <option value="gorilla">A gorilla!</option>
<ide> </select>;
<del> var markup = React.renderToString(stub);
<add> var markup = ReactDOMServer.renderToString(stub);
<ide> expect(markup).toContain('<option selected="" value="giraffe"');
<ide> expect(markup).not.toContain('<option selected="" value="monkey"');
<ide> expect(markup).not.toContain('<option selected="" value="gorilla"');
<ide> describe('ReactDOMSelect', function() {
<ide> <option value="giraffe">A giraffe!</option>
<ide> <option value="gorilla">A gorilla!</option>
<ide> </select>;
<del> var markup = React.renderToString(stub);
<add> var markup = ReactDOMServer.renderToString(stub);
<ide> expect(markup).toContain('<option selected="" value="giraffe"');
<ide> expect(markup).not.toContain('<option selected="" value="monkey"');
<ide> expect(markup).not.toContain('<option selected="" value="gorilla"');
<ide> describe('ReactDOMSelect', function() {
<ide> <option value="giraffe">A giraffe!</option>
<ide> <option value="gorilla">A gorilla!</option>
<ide> </select>;
<del> var markup = React.renderToString(stub);
<add> var markup = ReactDOMServer.renderToString(stub);
<ide> expect(markup).toContain('<option selected="" value="giraffe"');
<ide> expect(markup).toContain('<option selected="" value="gorilla"');
<ide> expect(markup).not.toContain('<option selected="" value="monkey"');
<ide> describe('ReactDOMSelect', function() {
<ide> it('should not control defaultValue if readding options', function() {
<ide> var container = document.createElement('div');
<ide>
<del> var select = React.render(
<add> var select = ReactDOM.render(
<ide> <select multiple={true} defaultValue={['giraffe']}>
<ide> <option key="monkey" value="monkey">A monkey!</option>
<ide> <option key="giraffe" value="giraffe">A giraffe!</option>
<ide> <option key="gorilla" value="gorilla">A gorilla!</option>
<ide> </select>,
<ide> container
<ide> );
<del> var node = React.findDOMNode(select);
<add> var node = ReactDOM.findDOMNode(select);
<ide>
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(true); // giraffe
<ide> expect(node.options[2].selected).toBe(false); // gorilla
<ide>
<del> React.render(
<add> ReactDOM.render(
<ide> <select multiple={true} defaultValue={['giraffe']}>
<ide> <option key="monkey" value="monkey">A monkey!</option>
<ide> <option key="gorilla" value="gorilla">A gorilla!</option>
<ide> describe('ReactDOMSelect', function() {
<ide> expect(node.options[0].selected).toBe(false); // monkey
<ide> expect(node.options[1].selected).toBe(false); // gorilla
<ide>
<del> React.render(
<add> ReactDOM.render(
<ide> <select multiple={true} defaultValue={['giraffe']}>
<ide> <option key="monkey" value="monkey">A monkey!</option>
<ide> <option key="giraffe" value="giraffe">A giraffe!</option>
<ide><path>src/renderers/dom/client/wrappers/__tests__/ReactDOMTextarea-test.js
<ide> var mocks = require('mocks');
<ide>
<ide> describe('ReactDOMTextarea', function() {
<ide> var React;
<add> var ReactDOM;
<ide> var ReactLink;
<ide> var ReactTestUtils;
<ide>
<ide> var renderTextarea;
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactLink = require('ReactLink');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide>
<ide> renderTextarea = function(component, container) {
<ide> if (!container) {
<ide> container = document.createElement('div');
<ide> }
<del> var stub = React.render(component, container);
<del> var node = React.findDOMNode(stub);
<add> var stub = ReactDOM.render(component, container);
<add> var node = ReactDOM.findDOMNode(stub);
<ide> // Fixing jsdom's quirky behavior -- in reality, the parser should strip
<ide> // off the leading newline but we need to do it by hand here.
<ide> node.value = node.innerHTML.replace(/^\n/, '');
<ide> describe('ReactDOMTextarea', function() {
<ide> it('should allow setting `defaultValue`', function() {
<ide> var container = document.createElement('div');
<ide> var stub = renderTextarea(<textarea defaultValue="giraffe" />, container);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('giraffe');
<ide>
<ide> describe('ReactDOMTextarea', function() {
<ide> it('should display `defaultValue` of number 0', function() {
<ide> var stub = <textarea defaultValue={0} />;
<ide> stub = renderTextarea(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('0');
<ide> });
<ide>
<ide> it('should display "false" for `defaultValue` of `false`', function() {
<ide> var stub = <textarea type="text" defaultValue={false} />;
<ide> stub = renderTextarea(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('false');
<ide> });
<ide> describe('ReactDOMTextarea', function() {
<ide>
<ide> var stub = <textarea type="text" defaultValue={objToString} />;
<ide> stub = renderTextarea(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('foobar');
<ide> });
<ide>
<ide> it('should not render value as an attribute', function() {
<ide> var stub = <textarea value="giraffe" onChange={emptyFunction} />;
<ide> stub = renderTextarea(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.getAttribute('value')).toBe(null);
<ide> });
<ide>
<ide> it('should display `value` of number 0', function() {
<ide> var stub = <textarea value={0} />;
<ide> stub = renderTextarea(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('0');
<ide> });
<ide> describe('ReactDOMTextarea', function() {
<ide> var container = document.createElement('div');
<ide> var stub = <textarea value="giraffe" onChange={emptyFunction} />;
<ide> stub = renderTextarea(stub, container);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('giraffe');
<ide>
<del> stub = React.render(
<add> stub = ReactDOM.render(
<ide> <textarea value="gorilla" onChange={emptyFunction} />,
<ide> container
<ide> );
<ide> describe('ReactDOMTextarea', function() {
<ide> var container = document.createElement('div');
<ide> var stub = <textarea value="giraffe" onChange={emptyFunction} />;
<ide> stub = renderTextarea(stub, container);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('giraffe');
<ide>
<del> stub = React.render(
<add> stub = ReactDOM.render(
<ide> <textarea value={true} onChange={emptyFunction} />,
<ide> container
<ide> );
<ide> describe('ReactDOMTextarea', function() {
<ide> var container = document.createElement('div');
<ide> var stub = <textarea value="giraffe" onChange={emptyFunction} />;
<ide> stub = renderTextarea(stub, container);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('giraffe');
<ide>
<del> stub = React.render(
<add> stub = ReactDOM.render(
<ide> <textarea value={false} onChange={emptyFunction} />,
<ide> container
<ide> );
<ide> describe('ReactDOMTextarea', function() {
<ide> var container = document.createElement('div');
<ide> var stub = <textarea value="giraffe" onChange={emptyFunction} />;
<ide> stub = renderTextarea(stub, container);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(node.value).toBe('giraffe');
<ide>
<ide> describe('ReactDOMTextarea', function() {
<ide> return 'foo';
<ide> },
<ide> };
<del> stub = React.render(
<add> stub = ReactDOM.render(
<ide> <textarea value={objToString} onChange={emptyFunction} />,
<ide> container
<ide> );
<ide> describe('ReactDOMTextarea', function() {
<ide> it('should properly control a value of number `0`', function() {
<ide> var stub = <textarea value={0} onChange={emptyFunction} />;
<ide> stub = renderTextarea(stub);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> node.value = 'giraffe';
<ide> ReactTestUtils.Simulate.change(node);
<ide> describe('ReactDOMTextarea', function() {
<ide> var container = document.createElement('div');
<ide> var stub = <textarea>giraffe</textarea>;
<ide> stub = renderTextarea(stub, container);
<del> var node = React.findDOMNode(stub);
<add> var node = ReactDOM.findDOMNode(stub);
<ide>
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(node.value).toBe('giraffe');
<ide>
<ide> // Changing children should do nothing, it functions like `defaultValue`.
<del> stub = React.render(<textarea>gorilla</textarea>, container);
<add> stub = ReactDOM.render(<textarea>gorilla</textarea>, container);
<ide> expect(node.value).toEqual('giraffe');
<ide> });
<ide>
<ide> it('should allow numbers as children', function() {
<ide> spyOn(console, 'error');
<del> var node = React.findDOMNode(renderTextarea(<textarea>{17}</textarea>));
<add> var node = ReactDOM.findDOMNode(renderTextarea(<textarea>{17}</textarea>));
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(node.value).toBe('17');
<ide> });
<ide>
<ide> it('should allow booleans as children', function() {
<ide> spyOn(console, 'error');
<del> var node = React.findDOMNode(renderTextarea(<textarea>{false}</textarea>));
<add> var node = ReactDOM.findDOMNode(renderTextarea(<textarea>{false}</textarea>));
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(node.value).toBe('false');
<ide> });
<ide> describe('ReactDOMTextarea', function() {
<ide> return 'sharkswithlasers';
<ide> },
<ide> };
<del> var node = React.findDOMNode(renderTextarea(<textarea>{obj}</textarea>));
<add> var node = ReactDOM.findDOMNode(renderTextarea(<textarea>{obj}</textarea>));
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(node.value).toBe('sharkswithlasers');
<ide> });
<ide> describe('ReactDOMTextarea', function() {
<ide>
<ide> var node;
<ide> expect(function() {
<del> node = React.findDOMNode(renderTextarea(<textarea><strong /></textarea>));
<add> node = ReactDOM.findDOMNode(renderTextarea(<textarea><strong /></textarea>));
<ide> }).not.toThrow();
<ide>
<ide> expect(node.value).toBe('[object Object]');
<ide> describe('ReactDOMTextarea', function() {
<ide>
<ide> instance = renderTextarea(instance);
<ide>
<del> expect(React.findDOMNode(instance).value).toBe('yolo');
<add> expect(ReactDOM.findDOMNode(instance).value).toBe('yolo');
<ide> expect(link.value).toBe('yolo');
<ide> expect(link.requestChange.mock.calls.length).toBe(0);
<ide>
<del> React.findDOMNode(instance).value = 'test';
<del> ReactTestUtils.Simulate.change(React.findDOMNode(instance));
<add> ReactDOM.findDOMNode(instance).value = 'test';
<add> ReactTestUtils.Simulate.change(ReactDOM.findDOMNode(instance));
<ide>
<ide> expect(link.requestChange.mock.calls.length).toBe(1);
<ide> expect(link.requestChange.mock.calls[0][0]).toEqual('test');
<ide> describe('ReactDOMTextarea', function() {
<ide> it('should unmount', function() {
<ide> var container = document.createElement('div');
<ide> renderTextarea(<textarea />, container);
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> });
<ide> });
<ide><path>src/renderers/dom/server/__tests__/ReactServerRendering-test.js
<ide> var mocks = require('mocks');
<ide>
<ide> var ExecutionEnvironment;
<ide> var React;
<add>var ReactDOM;
<ide> var ReactMarkupChecksum;
<ide> var ReactReconcileTransaction;
<ide> var ReactTestUtils;
<ide> describe('ReactServerRendering', function() {
<ide> beforeEach(function() {
<ide> require('mock-modules').dumpCache();
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactMarkupChecksum = require('ReactMarkupChecksum');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> ReactReconcileTransaction = require('ReactReconcileTransaction');
<ide> describe('ReactServerRendering', function() {
<ide> });
<ide>
<ide> var element = document.createElement('div');
<del> React.render(<TestComponent />, element);
<add> ReactDOM.render(<TestComponent />, element);
<ide>
<ide> var lastMarkup = element.innerHTML;
<ide>
<ide> // Exercise the update path. Markup should not change,
<ide> // but some lifecycle methods should be run again.
<del> React.render(<TestComponent name="x" />, element);
<add> ReactDOM.render(<TestComponent name="x" />, element);
<ide> expect(mountCount).toEqual(1);
<ide>
<ide> // Unmount and remount. We should get another mount event and
<ide> // we should get different markup, as the IDs are unique each time.
<del> React.unmountComponentAtNode(element);
<add> ReactDOM.unmountComponentAtNode(element);
<ide> expect(element.innerHTML).toEqual('');
<del> React.render(<TestComponent name="x" />, element);
<add> ReactDOM.render(<TestComponent name="x" />, element);
<ide> expect(mountCount).toEqual(2);
<ide> expect(element.innerHTML).not.toEqual(lastMarkup);
<ide>
<ide> // Now kill the node and render it on top of server-rendered markup, as if
<ide> // we used server rendering. We should mount again, but the markup should
<ide> // be unchanged. We will append a sentinel at the end of innerHTML to be
<ide> // sure that innerHTML was not changed.
<del> React.unmountComponentAtNode(element);
<add> ReactDOM.unmountComponentAtNode(element);
<ide> expect(element.innerHTML).toEqual('');
<ide>
<ide> ExecutionEnvironment.canUseDOM = false;
<ide> describe('ReactServerRendering', function() {
<ide> ExecutionEnvironment.canUseDOM = true;
<ide> element.innerHTML = lastMarkup;
<ide>
<del> React.render(<TestComponent name="x" />, element);
<add> ReactDOM.render(<TestComponent name="x" />, element);
<ide> expect(mountCount).toEqual(3);
<ide> expect(element.innerHTML).toBe(lastMarkup);
<del> React.unmountComponentAtNode(element);
<add> ReactDOM.unmountComponentAtNode(element);
<ide> expect(element.innerHTML).toEqual('');
<ide>
<ide> // Now simulate a situation where the app is not idempotent. React should
<ide> // warn but do the right thing.
<ide> element.innerHTML = lastMarkup;
<del> var instance = React.render(<TestComponent name="y" />, element);
<add> var instance = ReactDOM.render(<TestComponent name="y" />, element);
<ide> expect(mountCount).toEqual(4);
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(element.innerHTML.length > 0).toBe(true);
<ide> expect(element.innerHTML).not.toEqual(lastMarkup);
<ide>
<ide> // Ensure the events system works
<ide> expect(numClicks).toEqual(0);
<del> ReactTestUtils.Simulate.click(React.findDOMNode(instance.refs.span));
<add> ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
<ide> expect(numClicks).toEqual(1);
<ide> });
<ide>
<ide><path>src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js
<ide> 'use strict';
<ide>
<ide> var React = require('React');
<add>var ReactDOM = require('ReactDOM');
<ide>
<ide> describe('CSSPropertyOperations', function() {
<ide> var CSSPropertyOperations;
<ide> describe('CSSPropertyOperations', function() {
<ide> };
<ide> var div = <div style={styles} />;
<ide> var root = document.createElement('div');
<del> div = React.render(div, root);
<add> div = ReactDOM.render(div, root);
<ide> expect(/style=".*"/.test(root.innerHTML)).toBe(true);
<ide> });
<ide>
<ide> describe('CSSPropertyOperations', function() {
<ide> };
<ide> var div = <div style={styles} />;
<ide> var root = document.createElement('div');
<del> React.render(div, root);
<add> ReactDOM.render(div, root);
<ide> expect(/style=".*"/.test(root.innerHTML)).toBe(false);
<ide> });
<ide>
<ide> describe('CSSPropertyOperations', function() {
<ide> '-webkit-transform': 'translate3d(0, 0, 0)',
<ide> };
<ide>
<del> React.render(<div />, root);
<del> React.render(<div style={styles} />, root);
<add> ReactDOM.render(<div />, root);
<add> ReactDOM.render(<div style={styles} />, root);
<ide>
<ide> expect(console.error.argsForCall.length).toBe(2);
<ide> expect(console.error.argsForCall[0][0]).toContain('msTransform');
<ide><path>src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
<ide> var mocks = require('mocks');
<ide> describe('ReactDOMComponent', function() {
<ide> var React;
<ide>
<add> var ReactDOM;
<add> var ReactDOMServer;
<add>
<ide> beforeEach(function() {
<ide> require('mock-modules').dumpCache();
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<add> ReactDOMServer = require('ReactDOMServer');
<ide> });
<ide>
<ide> describe('updateDOM', function() {
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> it('should handle className', function() {
<ide> var container = document.createElement('div');
<del> React.render(<div style={{}} />, container);
<add> ReactDOM.render(<div style={{}} />, container);
<ide>
<del> React.render(<div className={'foo'} />, container);
<add> ReactDOM.render(<div className={'foo'} />, container);
<ide> expect(container.firstChild.className).toEqual('foo');
<del> React.render(<div className={'bar'} />, container);
<add> ReactDOM.render(<div className={'bar'} />, container);
<ide> expect(container.firstChild.className).toEqual('bar');
<del> React.render(<div className={null} />, container);
<add> ReactDOM.render(<div className={null} />, container);
<ide> expect(container.firstChild.className).toEqual('');
<ide> });
<ide>
<ide> it('should gracefully handle various style value types', function() {
<ide> var container = document.createElement('div');
<del> React.render(<div style={{}} />, container);
<add> ReactDOM.render(<div style={{}} />, container);
<ide> var stubStyle = container.firstChild.style;
<ide>
<ide> // set initial style
<ide> var setup = {display: 'block', left: '1', top: 2, fontFamily: 'Arial'};
<del> React.render(<div style={setup} />, container);
<add> ReactDOM.render(<div style={setup} />, container);
<ide> expect(stubStyle.display).toEqual('block');
<ide> expect(stubStyle.left).toEqual('1px');
<ide> expect(stubStyle.fontFamily).toEqual('Arial');
<ide>
<ide> // reset the style to their default state
<ide> var reset = {display: '', left: null, top: false, fontFamily: true};
<del> React.render(<div style={reset} />, container);
<add> ReactDOM.render(<div style={reset} />, container);
<ide> expect(stubStyle.display).toEqual('');
<ide> expect(stubStyle.left).toEqual('');
<ide> expect(stubStyle.top).toEqual('');
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> var styles = {display: 'none', fontFamily: 'Arial', lineHeight: 1.2};
<ide> var container = document.createElement('div');
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide>
<ide> var stubStyle = container.firstChild.style;
<ide> stubStyle.display = styles.display;
<ide> stubStyle.fontFamily = styles.fontFamily;
<ide>
<ide> styles.display = 'block';
<ide>
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide> expect(stubStyle.display).toEqual('block');
<ide> expect(stubStyle.fontFamily).toEqual('Arial');
<ide> expect(stubStyle.lineHeight).toEqual('1.2');
<ide>
<ide> styles.fontFamily = 'Helvetica';
<ide>
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide> expect(stubStyle.display).toEqual('block');
<ide> expect(stubStyle.fontFamily).toEqual('Helvetica');
<ide> expect(stubStyle.lineHeight).toEqual('1.2');
<ide>
<ide> styles.lineHeight = 0.5;
<ide>
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide> expect(stubStyle.display).toEqual('block');
<ide> expect(stubStyle.fontFamily).toEqual('Helvetica');
<ide> expect(stubStyle.lineHeight).toEqual('0.5');
<ide>
<del> React.render(<div style={undefined} />, container);
<add> ReactDOM.render(<div style={undefined} />, container);
<ide> expect(stubStyle.display).toBe('');
<ide> expect(stubStyle.fontFamily).toBe('');
<ide> expect(stubStyle.lineHeight).toBe('');
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> style = {background: 'red'};
<ide> var div = document.createElement('div');
<del> React.render(<span style={style}></span>, div);
<add> ReactDOM.render(<span style={style}></span>, div);
<ide> style.background = 'blue';
<del> React.render(<span style={style}></span>, div);
<add> ReactDOM.render(<span style={style}></span>, div);
<ide> expect(console.error.argsForCall.length).toBe(2);
<ide> });
<ide>
<ide> it('should update styles if initially null', function() {
<ide> var styles = null;
<ide> var container = document.createElement('div');
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide>
<ide> var stubStyle = container.firstChild.style;
<ide>
<ide> styles = {display: 'block'};
<ide>
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide> expect(stubStyle.display).toEqual('block');
<ide> });
<ide>
<ide> it('should update styles if updated to null multiple times', function() {
<ide> var styles = null;
<ide> var container = document.createElement('div');
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide>
<ide> styles = {display: 'block'};
<ide> var stubStyle = container.firstChild.style;
<ide>
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide> expect(stubStyle.display).toEqual('block');
<ide>
<del> React.render(<div style={null} />, container);
<add> ReactDOM.render(<div style={null} />, container);
<ide> expect(stubStyle.display).toEqual('');
<ide>
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide> expect(stubStyle.display).toEqual('block');
<ide>
<del> React.render(<div style={null} />, container);
<add> ReactDOM.render(<div style={null} />, container);
<ide> expect(stubStyle.display).toEqual('');
<ide> });
<ide>
<ide> it('should remove attributes', function() {
<ide> var container = document.createElement('div');
<del> React.render(<img height="17" />, container);
<add> ReactDOM.render(<img height="17" />, container);
<ide>
<ide> expect(container.firstChild.hasAttribute('height')).toBe(true);
<del> React.render(<img />, container);
<add> ReactDOM.render(<img />, container);
<ide> expect(container.firstChild.hasAttribute('height')).toBe(false);
<ide> });
<ide>
<ide> it('should remove properties', function() {
<ide> var container = document.createElement('div');
<del> React.render(<div className="monkey" />, container);
<add> ReactDOM.render(<div className="monkey" />, container);
<ide>
<ide> expect(container.firstChild.className).toEqual('monkey');
<del> React.render(<div />, container);
<add> ReactDOM.render(<div />, container);
<ide> expect(container.firstChild.className).toEqual('');
<ide> });
<ide>
<ide> it('should clear a single style prop when changing `style`', function() {
<ide> var styles = {display: 'none', color: 'red'};
<ide> var container = document.createElement('div');
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide>
<ide> var stubStyle = container.firstChild.style;
<ide>
<ide> styles = {color: 'green'};
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide> expect(stubStyle.display).toEqual('');
<ide> expect(stubStyle.color).toEqual('green');
<ide> });
<ide> describe('ReactDOMComponent', function() {
<ide> {'blah" onclick="beevil" noise="hi': 'selected'},
<ide> null
<ide> );
<del> React.render(element, container);
<add> ReactDOM.render(element, container);
<ide> }
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(console.error.argsForCall[0][0]).toEqual(
<ide> describe('ReactDOMComponent', function() {
<ide> for (var i = 0; i < 3; i++) {
<ide> var container = document.createElement('div');
<ide> var beforeUpdate = React.createElement('x-foo-component', {}, null);
<del> React.render(beforeUpdate, container);
<add> ReactDOM.render(beforeUpdate, container);
<ide>
<ide> var afterUpdate = React.createElement(
<ide> 'x-foo-component',
<ide> {'blah" onclick="beevil" noise="hi': 'selected'},
<ide> null
<ide> );
<del> React.render(afterUpdate, container);
<add> ReactDOM.render(afterUpdate, container);
<ide> }
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(console.error.argsForCall[0][0]).toEqual(
<ide> describe('ReactDOMComponent', function() {
<ide> var container = document.createElement('div');
<ide>
<ide> var beforeUpdate = React.createElement('x-foo-component', {}, null);
<del> React.render(beforeUpdate, container);
<add> ReactDOM.render(beforeUpdate, container);
<ide>
<ide> var afterUpdate = <x-foo-component myattr="myval" />;
<del> React.render(afterUpdate, container);
<add> ReactDOM.render(afterUpdate, container);
<ide>
<ide> expect(container.childNodes[0].getAttribute('myattr')).toBe('myval');
<ide> });
<ide>
<ide> it('should clear all the styles when removing `style`', function() {
<ide> var styles = {display: 'none', color: 'red'};
<ide> var container = document.createElement('div');
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide>
<ide> var stubStyle = container.firstChild.style;
<ide>
<del> React.render(<div />, container);
<add> ReactDOM.render(<div />, container);
<ide> expect(stubStyle.display).toEqual('');
<ide> expect(stubStyle.color).toEqual('');
<ide> });
<ide>
<ide> it('should update styles when `style` changes from null to object', function() {
<ide> var container = document.createElement('div');
<ide> var styles = {color: 'red'};
<del> React.render(<div style={styles} />, container);
<del> React.render(<div />, container);
<del> React.render(<div style={styles} />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<add> ReactDOM.render(<div />, container);
<add> ReactDOM.render(<div style={styles} />, container);
<ide>
<ide> var stubStyle = container.firstChild.style;
<ide> expect(stubStyle.color).toEqual('red');
<ide> });
<ide>
<ide> it('should empty element when removing innerHTML', function() {
<ide> var container = document.createElement('div');
<del> React.render(<div dangerouslySetInnerHTML={{__html: ':)'}} />, container);
<add> ReactDOM.render(<div dangerouslySetInnerHTML={{__html: ':)'}} />, container);
<ide>
<ide> expect(container.firstChild.innerHTML).toEqual(':)');
<del> React.render(<div />, container);
<add> ReactDOM.render(<div />, container);
<ide> expect(container.firstChild.innerHTML).toEqual('');
<ide> });
<ide>
<ide> it('should transition from string content to innerHTML', function() {
<ide> var container = document.createElement('div');
<del> React.render(<div>hello</div>, container);
<add> ReactDOM.render(<div>hello</div>, container);
<ide>
<ide> expect(container.firstChild.innerHTML).toEqual('hello');
<del> React.render(
<add> ReactDOM.render(
<ide> <div dangerouslySetInnerHTML={{__html: 'goodbye'}} />,
<ide> container
<ide> );
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> it('should transition from innerHTML to string content', function() {
<ide> var container = document.createElement('div');
<del> React.render(
<add> ReactDOM.render(
<ide> <div dangerouslySetInnerHTML={{__html: 'bonjour'}} />,
<ide> container
<ide> );
<ide>
<ide> expect(container.firstChild.innerHTML).toEqual('bonjour');
<del> React.render(<div>adieu</div>, container);
<add> ReactDOM.render(<div>adieu</div>, container);
<ide> expect(container.firstChild.innerHTML).toEqual('adieu');
<ide> });
<ide>
<ide> it('should transition from innerHTML to children in nested el', function() {
<ide> var container = document.createElement('div');
<del> React.render(
<add> ReactDOM.render(
<ide> <div><div dangerouslySetInnerHTML={{__html: 'bonjour'}} /></div>,
<ide> container
<ide> );
<ide>
<ide> expect(container.textContent).toEqual('bonjour');
<del> React.render(<div><div><span>adieu</span></div></div>, container);
<add> ReactDOM.render(<div><div><span>adieu</span></div></div>, container);
<ide> expect(container.textContent).toEqual('adieu');
<ide> });
<ide>
<ide> it('should transition from children to innerHTML in nested el', function() {
<ide> var container = document.createElement('div');
<del> React.render(<div><div><span>adieu</span></div></div>, container);
<add> ReactDOM.render(<div><div><span>adieu</span></div></div>, container);
<ide>
<ide> expect(container.textContent).toEqual('adieu');
<del> React.render(
<add> ReactDOM.render(
<ide> <div><div dangerouslySetInnerHTML={{__html: 'bonjour'}} /></div>,
<ide> container
<ide> );
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> it('should not incur unnecessary DOM mutations', function() {
<ide> var container = document.createElement('div');
<del> React.render(<div value="" />, container);
<add> ReactDOM.render(<div value="" />, container);
<ide>
<ide> var node = container.firstChild;
<ide> var nodeValue = ''; // node.value always returns undefined
<ide> describe('ReactDOMComponent', function() {
<ide> }),
<ide> });
<ide>
<del> React.render(<div value="" />, container);
<add> ReactDOM.render(<div value="" />, container);
<ide> expect(nodeValueSetter.mock.calls.length).toBe(0);
<ide>
<del> React.render(<div />, container);
<add> ReactDOM.render(<div />, container);
<ide> expect(nodeValueSetter.mock.calls.length).toBe(1);
<ide> });
<ide>
<ide> it('should ignore attribute whitelist for elements with the "is: attribute', function() {
<ide> var container = document.createElement('div');
<del> React.render(<button is="test" cowabunga="chevynova"/>, container);
<add> ReactDOM.render(<button is="test" cowabunga="chevynova"/>, container);
<ide> expect(container.firstChild.hasAttribute('cowabunga')).toBe(true);
<ide> });
<ide> });
<ide> describe('ReactDOMComponent', function() {
<ide> beforeEach(function() {
<ide> mountComponent = function(props) {
<ide> var container = document.createElement('div');
<del> React.render(<div {...props} />, container);
<add> ReactDOM.render(<div {...props} />, container);
<ide> };
<ide> });
<ide>
<ide> describe('ReactDOMComponent', function() {
<ide> return React.createElement('BR', null);
<ide> },
<ide> });
<del> var returnedValue = React.renderToString(<Container/>);
<add> var returnedValue = ReactDOMServer.renderToString(<Container/>);
<ide> expect(returnedValue).not.toContain('</BR>');
<ide> });
<ide>
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> var container = document.createElement('div');
<ide>
<del> React.render(<input>children</input>, container);
<add> ReactDOM.render(<input>children</input>, container);
<ide>
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(console.error.argsForCall[0][0]).toContain('void element');
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> var container = document.createElement('div');
<ide>
<del> React.render(
<add> ReactDOM.render(
<ide> <input dangerouslySetInnerHTML={{__html: 'content'}} />,
<ide> container
<ide> );
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> var container = document.createElement('div');
<ide>
<del> var returnedValue = React.renderToString(<menu><menuitem /></menu>);
<add> var returnedValue = ReactDOMServer.renderToString(<menu><menuitem /></menu>);
<ide>
<ide> expect(returnedValue).toContain('</menuitem>');
<ide>
<del> React.render(<menu><menuitem>children</menuitem></menu>, container);
<add> ReactDOM.render(<menu><menuitem>children</menuitem></menu>, container);
<ide>
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(console.error.argsForCall[0][0]).toContain('void element');
<ide> describe('ReactDOMComponent', function() {
<ide> SimpleEventPlugin.willDeleteListener = mocks.getMockFunction();
<ide>
<ide> var container = document.createElement('div');
<del> React.render(
<add> ReactDOM.render(
<ide> <div onClick={() => true} />,
<ide> container
<ide> );
<ide>
<ide> expect(SimpleEventPlugin.didPutListener.mock.calls.length).toBe(1);
<ide>
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide>
<ide> expect(SimpleEventPlugin.willDeleteListener.mock.calls.length).toBe(1);
<ide> });
<ide> describe('ReactDOMComponent', function() {
<ide> SimpleEventPlugin.willDeleteListener = mocks.getMockFunction();
<ide> var container = document.createElement('div');
<ide>
<del> React.render(<div onClick={null} />, container);
<add> ReactDOM.render(<div onClick={null} />, container);
<ide> expect(SimpleEventPlugin.didPutListener.mock.calls.length).toBe(0);
<ide> expect(SimpleEventPlugin.willDeleteListener.mock.calls.length).toBe(0);
<ide>
<del> React.render(<div onClick={() => 'apple'} />, container);
<add> ReactDOM.render(<div onClick={() => 'apple'} />, container);
<ide> expect(SimpleEventPlugin.didPutListener.mock.calls.length).toBe(1);
<ide> expect(SimpleEventPlugin.willDeleteListener.mock.calls.length).toBe(0);
<ide>
<del> React.render(<div onClick={() => 'banana'} />, container);
<add> ReactDOM.render(<div onClick={() => 'banana'} />, container);
<ide> expect(SimpleEventPlugin.didPutListener.mock.calls.length).toBe(2);
<ide> expect(SimpleEventPlugin.willDeleteListener.mock.calls.length).toBe(0);
<ide>
<del> React.render(<div onClick={null} />, container);
<add> ReactDOM.render(<div onClick={null} />, container);
<ide> expect(SimpleEventPlugin.didPutListener.mock.calls.length).toBe(2);
<ide> expect(SimpleEventPlugin.willDeleteListener.mock.calls.length).toBe(1);
<ide>
<del> React.render(<div />, container);
<add> ReactDOM.render(<div />, container);
<ide> expect(SimpleEventPlugin.didPutListener.mock.calls.length).toBe(2);
<ide> expect(SimpleEventPlugin.willDeleteListener.mock.calls.length).toBe(1);
<ide>
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> expect(SimpleEventPlugin.didPutListener.mock.calls.length).toBe(2);
<ide> expect(SimpleEventPlugin.willDeleteListener.mock.calls.length).toBe(1);
<ide> });
<ide> describe('ReactDOMComponent', function() {
<ide> },
<ide> });
<ide> var container = document.createElement('div');
<del> React.render(<X />, container);
<add> ReactDOM.render(<X />, container);
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(console.error.argsForCall[0][0]).toBe(
<ide> 'Warning: input is a void element tag and must not have `children` ' +
<ide> describe('ReactDOMComponent', function() {
<ide> it('should warn against children for void elements', function() {
<ide> spyOn(console, 'error');
<ide>
<del> React.render(<input />, container);
<del> React.render(<input>children</input>, container);
<add> ReactDOM.render(<input />, container);
<add> ReactDOM.render(<input>children</input>, container);
<ide>
<ide> expect(console.error.argsForCall.length).toBe(1);
<ide> expect(console.error.argsForCall[0][0]).toContain('void element');
<ide> describe('ReactDOMComponent', function() {
<ide> it('should warn against dangerouslySetInnerHTML for void elements', function() {
<ide> spyOn(console, 'error');
<ide>
<del> React.render(<input />, container);
<del> React.render(
<add> ReactDOM.render(<input />, container);
<add> ReactDOM.render(
<ide> <input dangerouslySetInnerHTML={{__html: 'content'}} />,
<ide> container
<ide> );
<ide> describe('ReactDOMComponent', function() {
<ide> });
<ide>
<ide> it('should validate against multiple children props', function() {
<del> React.render(<div></div>, container);
<add> ReactDOM.render(<div></div>, container);
<ide>
<ide> expect(function() {
<del> React.render(
<add> ReactDOM.render(
<ide> <div children="" dangerouslySetInnerHTML={{__html: ''}}></div>,
<ide> container
<ide> );
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> it('should warn about contentEditable and children', function() {
<ide> spyOn(console, 'error');
<del> React.render(
<add> ReactDOM.render(
<ide> <div contentEditable={true}><div /></div>,
<ide> container
<ide> );
<ide> describe('ReactDOMComponent', function() {
<ide> });
<ide>
<ide> it('should validate against invalid styles', function() {
<del> React.render(<div></div>, container);
<add> ReactDOM.render(<div></div>, container);
<ide>
<ide> expect(function() {
<del> React.render(<div style={1}></div>, container);
<add> ReactDOM.render(<div style={1}></div>, container);
<ide> }).toThrow(
<ide> 'Invariant Violation: The `style` prop expects a mapping from style ' +
<ide> 'properties to values, not a string. For example, ' +
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> it('should properly escape text content and attributes values', function() {
<ide> expect(
<del> React.renderToStaticMarkup(
<add> ReactDOMServer.renderToStaticMarkup(
<ide> React.DOM.div({
<ide> title: '\'"<>&',
<ide> style: {
<ide> describe('ReactDOMComponent', function() {
<ide>
<ide> var callback = function() {};
<ide> var instance = <div onClick={callback} />;
<del> instance = React.render(instance, container);
<add> instance = ReactDOM.render(instance, container);
<ide>
<del> var rootNode = React.findDOMNode(instance);
<add> var rootNode = ReactDOM.findDOMNode(instance);
<ide> var rootNodeID = ReactMount.getID(rootNode);
<ide> expect(
<ide> ReactBrowserEventEmitter.getListener(rootNodeID, 'onClick')
<ide> ).toBe(callback);
<del> expect(rootNode).toBe(React.findDOMNode(instance));
<add> expect(rootNode).toBe(ReactDOM.findDOMNode(instance));
<ide>
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide>
<ide> expect(
<ide> ReactBrowserEventEmitter.getListener(rootNodeID, 'onClick')
<ide> describe('ReactDOMComponent', function() {
<ide> it('warns on invalid nesting at root', () => {
<ide> spyOn(console, 'error');
<ide> var p = document.createElement('p');
<del> React.render(<span><p /></span>, p);
<add> ReactDOM.render(<span><p /></span>, p);
<ide>
<ide> expect(console.error.calls.length).toBe(1);
<ide> expect(console.error.calls[0].args[0]).toBe(
<ide> describe('ReactDOMComponent', function() {
<ide> },
<ide> });
<ide> var container = document.createElement('div');
<del> React.render(<Animal />, container);
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.render(<Animal />, container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> expect(innerDiv.isMounted()).toBe(false);
<ide>
<ide> expect(console.error.calls.length).toBe(5);
<ide> describe('ReactDOMComponent', function() {
<ide> expect(typeof node.firstChild.getDOMNode).toBe('undefined');
<ide> });
<ide> });
<del>
<ide> });
<ide><path>src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<add>var ReactDOMServer;
<ide>
<ide> describe('ReactDOMTextComponent', function() {
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<add> ReactDOMServer = require('ReactDOMServer');
<ide> });
<ide>
<ide> it('should escape the rootID', function() {
<ide> var ThisThingShouldBeEscaped = '">>> LULZ <<<"';
<ide> var ThisThingWasBeEscaped = '">>> LULZ <<<"';
<ide> var thing = <div><span key={ThisThingShouldBeEscaped}>LULZ</span></div>;
<del> var html = React.renderToString(thing);
<add> var html = ReactDOMServer.renderToString(thing);
<ide> expect(html).not.toContain(ThisThingShouldBeEscaped);
<ide> expect(html).toContain(ThisThingWasBeEscaped);
<ide> });
<ide>
<ide> it('updates a mounted text component in place', function() {
<ide> var el = document.createElement('div');
<del> var inst = React.render(<div>{'foo'}{'bar'}</div>, el);
<add> var inst = ReactDOM.render(<div>{'foo'}{'bar'}</div>, el);
<ide>
<del> var foo = React.findDOMNode(inst).children[0];
<del> var bar = React.findDOMNode(inst).children[1];
<add> var foo = ReactDOM.findDOMNode(inst).children[0];
<add> var bar = ReactDOM.findDOMNode(inst).children[1];
<ide> expect(foo.tagName).toBe('SPAN');
<ide> expect(bar.tagName).toBe('SPAN');
<ide>
<del> inst = React.render(<div>{'baz'}{'qux'}</div>, el);
<add> inst = ReactDOM.render(<div>{'baz'}{'qux'}</div>, el);
<ide> // After the update, the spans should have stayed in place (as opposed to
<ide> // getting unmounted and remounted)
<del> expect(React.findDOMNode(inst).children[0]).toBe(foo);
<del> expect(React.findDOMNode(inst).children[1]).toBe(bar);
<add> expect(ReactDOM.findDOMNode(inst).children[0]).toBe(foo);
<add> expect(ReactDOM.findDOMNode(inst).children[1]).toBe(bar);
<ide> });
<ide> });
<ide><path>src/renderers/shared/reconciler/__tests__/ReactComponent-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> var mocks;
<ide> describe('ReactComponent', function() {
<ide> beforeEach(function() {
<ide> mocks = require('mocks');
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> });
<ide>
<ide> it('should throw on invalid render targets', function() {
<ide> var container = document.createElement('div');
<ide> // jQuery objects are basically arrays; people often pass them in by mistake
<ide> expect(function() {
<del> React.render(<div></div>, [container]);
<add> ReactDOM.render(<div></div>, [container]);
<ide> }).toThrow(
<ide> 'Invariant Violation: _registerComponent(...): Target container ' +
<ide> 'is not a DOM element.'
<ide> );
<ide>
<ide> expect(function() {
<del> React.render(<div></div>, null);
<add> ReactDOM.render(<div></div>, null);
<ide> }).toThrow(
<ide> 'Invariant Violation: _registerComponent(...): Target container ' +
<ide> 'is not a DOM element.'
<ide> describe('ReactComponent', function() {
<ide> componentDidMount: function() {
<ide> // Check .props.title to make sure we got the right elements back
<ide> expect(this.wrapperRef.getTitle()).toBe('wrapper');
<del> expect(React.findDOMNode(this.innerRef).title).toBe('inner');
<add> expect(ReactDOM.findDOMNode(this.innerRef).title).toBe('inner');
<ide> mounted = true;
<ide> },
<ide> });
<ide> describe('ReactComponent', function() {
<ide> // mount, update, unmount
<ide> var el = document.createElement('div');
<ide> log.push('start mount');
<del> React.render(<Outer />, el);
<add> ReactDOM.render(<Outer />, el);
<ide> log.push('start update');
<del> React.render(<Outer />, el);
<add> ReactDOM.render(<Outer />, el);
<ide> log.push('start unmount');
<del> React.unmountComponentAtNode(el);
<add> ReactDOM.unmountComponentAtNode(el);
<ide>
<ide> expect(log).toEqual([
<ide> 'start mount',
<ide> describe('ReactComponent', function() {
<ide> it('fires the callback after a component is rendered', function() {
<ide> var callback = mocks.getMockFunction();
<ide> var container = document.createElement('div');
<del> React.render(<div />, container, callback);
<add> ReactDOM.render(<div />, container, callback);
<ide> expect(callback.mock.calls.length).toBe(1);
<del> React.render(<div className="foo" />, container, callback);
<add> ReactDOM.render(<div className="foo" />, container, callback);
<ide> expect(callback.mock.calls.length).toBe(2);
<del> React.render(<span />, container, callback);
<add> ReactDOM.render(<span />, container, callback);
<ide> expect(callback.mock.calls.length).toBe(3);
<ide> });
<ide>
<ide> describe('ReactComponent', function() {
<ide> },
<ide> });
<ide> var container = document.createElement('div');
<del> var instance = React.render(<Potato />, container);
<add> var instance = ReactDOM.render(<Potato />, container);
<ide>
<ide> instance.getDOMNode();
<ide>
<ide><path>src/renderers/shared/reconciler/__tests__/ReactComponentLifeCycle-test.js
<ide> var keyMirror = require('keyMirror');
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactInstanceMap;
<ide> var ReactTestUtils;
<ide>
<ide> describe('ReactComponentLifeCycle', function() {
<ide> beforeEach(function() {
<ide> require('mock-modules').dumpCache();
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> ReactInstanceMap = require('ReactInstanceMap');
<ide> });
<ide> describe('ReactComponentLifeCycle', function() {
<ide> },
<ide> });
<ide> var element = <StatefulComponent />;
<del> var firstInstance = React.render(element, container);
<del> React.unmountComponentAtNode(container);
<del> var secondInstance = React.render(element, container);
<add> var firstInstance = ReactDOM.render(element, container);
<add> ReactDOM.unmountComponentAtNode(container);
<add> var secondInstance = ReactDOM.render(element, container);
<ide> expect(firstInstance).not.toBe(secondInstance);
<ide> });
<ide>
<ide> describe('ReactComponentLifeCycle', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> var instance = React.render(<Component />, container);
<add> var instance = ReactDOM.render(<Component />, container);
<ide>
<ide> expect(instance.isMounted()).toBe(true);
<ide>
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide>
<ide> expect(instance.isMounted()).toBe(false);
<ide> });
<ide> describe('ReactComponentLifeCycle', function() {
<ide> },
<ide> render: function() {
<ide> if (this.state.isMounted) {
<del> expect(React.findDOMNode(this).tagName).toBe('DIV');
<add> expect(ReactDOM.findDOMNode(this).tagName).toBe('DIV');
<ide> }
<ide> return <div/>;
<ide> },
<ide> describe('ReactComponentLifeCycle', function() {
<ide> // yet initialized, or rendered.
<ide> //
<ide> var container = document.createElement('div');
<del> var instance = React.render(<LifeCycleComponent />, container);
<add> var instance = ReactDOM.render(<LifeCycleComponent />, container);
<ide>
<ide> // getInitialState
<ide> expect(instance._testJournal.returnedFromGetInitialState).toEqual(
<ide> describe('ReactComponentLifeCycle', function() {
<ide>
<ide> expect(getLifeCycleState(instance)).toBe(ComponentLifeCycle.MOUNTED);
<ide>
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide>
<ide> expect(instance._testJournal.stateAtStartOfWillUnmount)
<ide> .toEqual(WILL_UNMOUNT_STATE);
<ide> describe('ReactComponentLifeCycle', function() {
<ide> updateTooltip: function() {
<ide> // Even though this.props.tooltip has an owner, updating it shouldn't
<ide> // throw here because it's mounted as a root component
<del> React.render(this.props.tooltip, this.container);
<add> ReactDOM.render(this.props.tooltip, this.container);
<ide> },
<ide> });
<ide> var Component = React.createClass({
<ide> describe('ReactComponentLifeCycle', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> React.render(
<add> ReactDOM.render(
<ide> <Component text="uno" tooltipText="one" />,
<ide> container
<ide> );
<ide>
<ide> // Since `instance` is a root component, we can set its props. This also
<ide> // makes Tooltip rerender the tooltip component, which shouldn't throw.
<del> React.render(
<add> ReactDOM.render(
<ide> <Component text="dos" tooltipText="two" />,
<ide> container
<ide> );
<ide> describe('ReactComponentLifeCycle', function() {
<ide>
<ide> var container = document.createElement('div');
<ide> log = [];
<del> React.render(<Outer x={17} />, container);
<add> ReactDOM.render(<Outer x={17} />, container);
<ide> expect(log).toEqual([
<ide> 'outer componentWillMount',
<ide> 'inner componentWillMount',
<ide> describe('ReactComponentLifeCycle', function() {
<ide> ]);
<ide>
<ide> log = [];
<del> React.render(<Outer x={42} />, container);
<add> ReactDOM.render(<Outer x={42} />, container);
<ide> expect(log).toEqual([
<ide> 'outer componentWillReceiveProps',
<ide> 'outer shouldComponentUpdate',
<ide> describe('ReactComponentLifeCycle', function() {
<ide> ]);
<ide>
<ide> log = [];
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> expect(log).toEqual([
<ide> 'outer componentWillUnmount',
<ide> 'inner componentWillUnmount',
<ide><path>src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
<ide> var ChildUpdates;
<ide> var MorphingComponent;
<ide> var React;
<add>var ReactDOM;
<ide> var ReactCurrentOwner;
<ide> var ReactMount;
<ide> var ReactPropTypes;
<ide> describe('ReactCompositeComponent', function() {
<ide> require('mock-modules').dumpCache();
<ide> reactComponentExpect = require('reactComponentExpect');
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactCurrentOwner = require('ReactCurrentOwner');
<ide> ReactPropTypes = require('ReactPropTypes');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> describe('ReactCompositeComponent', function() {
<ide> var container = document.createElement('div');
<ide> container.innerHTML = markup;
<ide>
<del> React.render(<Parent />, container);
<add> ReactDOM.render(<Parent />, container);
<ide> expect(console.error).not.toHaveBeenCalled();
<ide> });
<ide>
<ide> describe('ReactCompositeComponent', function() {
<ide> var instance = <MorphingComponent />;
<ide> instance = ReactTestUtils.renderIntoDocument(instance);
<ide>
<del> expect(React.findDOMNode(instance.refs.x).tagName).toBe('A');
<add> expect(ReactDOM.findDOMNode(instance.refs.x).tagName).toBe('A');
<ide> instance._toggleActivatedState();
<del> expect(React.findDOMNode(instance.refs.x).tagName).toBe('B');
<add> expect(ReactDOM.findDOMNode(instance.refs.x).tagName).toBe('B');
<ide> instance._toggleActivatedState();
<del> expect(React.findDOMNode(instance.refs.x).tagName).toBe('A');
<add> expect(ReactDOM.findDOMNode(instance.refs.x).tagName).toBe('A');
<ide> });
<ide>
<ide> it('should not cache old DOM nodes when switching constructors', function() {
<ide> describe('ReactCompositeComponent', function() {
<ide> // rerender
<ide> instance.setProps({renderAnchor: true, anchorClassOn: false});
<ide> var anchor = instance.getAnchor();
<del> var actualDOMAnchorNode = React.findDOMNode(anchor);
<add> var actualDOMAnchorNode = ReactDOM.findDOMNode(anchor);
<ide> expect(actualDOMAnchorNode.className).toBe('');
<ide> expect(actualDOMAnchorNode).toBe(anchor.getDOMNode());
<ide> });
<ide> describe('ReactCompositeComponent', function() {
<ide> var instance = <Component />;
<ide> expect(instance.forceUpdate).not.toBeDefined();
<ide>
<del> instance = React.render(instance, container);
<add> instance = ReactDOM.render(instance, container);
<ide> instance.forceUpdate();
<ide>
<ide> expect(console.error.calls.length).toBe(0);
<ide>
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide>
<ide> instance.forceUpdate();
<ide> expect(console.error.calls.length).toBe(1);
<ide> describe('ReactCompositeComponent', function() {
<ide> var instance = <Component />;
<ide> expect(instance.setState).not.toBeDefined();
<ide>
<del> instance = React.render(instance, container);
<add> instance = ReactDOM.render(instance, container);
<ide>
<ide> expect(renders).toBe(1);
<ide>
<ide> describe('ReactCompositeComponent', function() {
<ide>
<ide> expect(renders).toBe(2);
<ide>
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> instance.setState({value: 2});
<ide>
<ide> expect(renders).toBe(2);
<ide> describe('ReactCompositeComponent', function() {
<ide> },
<ide> });
<ide>
<del> var instance = React.render(<Component />, container);
<add> var instance = ReactDOM.render(<Component />, container);
<ide>
<ide> instance.setState({value: 1});
<ide> expect(console.error.calls.length).toBe(0);
<ide>
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> expect(console.error.calls.length).toBe(0);
<ide> expect(cbCalled).toBe(false);
<ide> });
<ide> describe('ReactCompositeComponent', function() {
<ide>
<ide> expect(console.error.calls.length).toBe(0);
<ide>
<del> var instance = React.render(<Component />, container);
<add> var instance = ReactDOM.render(<Component />, container);
<ide>
<ide> expect(console.error.calls.length).toBe(1);
<ide> expect(console.error.argsForCall[0][0]).toBe(
<ide> describe('ReactCompositeComponent', function() {
<ide> expect(instance.state.value).toBe(1);
<ide>
<ide> // Forcing a rerender anywhere will cause the update to happen.
<del> var instance2 = React.render(<Component prop={123} />, container);
<add> var instance2 = ReactDOM.render(<Component prop={123} />, container);
<ide> expect(instance).toBe(instance2);
<ide> expect(renderedState).toBe(1);
<ide> expect(instance2.state.value).toBe(1);
<ide> describe('ReactCompositeComponent', function() {
<ide> var instance = <Component />;
<ide> expect(instance.setProps).not.toBeDefined();
<ide>
<del> instance = React.render(instance, container);
<add> instance = ReactDOM.render(instance, container);
<ide> expect(function() {
<ide> instance.setProps({value: 1});
<ide> }).not.toThrow();
<ide> expect(console.error.calls.length).toBe(1); // setProps deprecated
<ide>
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> expect(function() {
<ide> instance.setProps({value: 2});
<ide> }).not.toThrow();
<ide> describe('ReactCompositeComponent', function() {
<ide> innerInstance = this.refs.inner;
<ide> },
<ide> });
<del> React.render(<Component />, container);
<add> ReactDOM.render(<Component />, container);
<ide>
<ide> expect(innerInstance).not.toBe(undefined);
<ide> expect(function() {
<ide> describe('ReactCompositeComponent', function() {
<ide> },
<ide> });
<ide>
<del> React.render(<Component />, container);
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.render(<Component />, container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> expect(innerUnmounted).toBe(true);
<ide>
<ide> // The text and both <div /> elements and their wrappers each call
<ide> describe('ReactCompositeComponent', function() {
<ide> });
<ide>
<ide> var component = ReactTestUtils.renderIntoDocument(<Parent />);
<del> expect(React.findDOMNode(component).innerHTML).toBe('bar');
<add> expect(ReactDOM.findDOMNode(component).innerHTML).toBe('bar');
<ide> });
<ide>
<ide> it('should pass context when re-rendered for static child', function() {
<ide> describe('ReactCompositeComponent', function() {
<ide> });
<ide>
<ide> var div = document.createElement('div');
<del> React.render(<Parent cntxt="noise" />, div);
<add> ReactDOM.render(<Parent cntxt="noise" />, div);
<ide> expect(div.children[0].innerHTML).toBe('noise');
<ide> div.children[0].innerHTML = 'aliens';
<ide> div.children[0].id = 'aliens';
<ide> expect(div.children[0].innerHTML).toBe('aliens');
<ide> expect(div.children[0].id).toBe('aliens');
<del> React.render(<Parent cntxt="bar" />, div);
<add> ReactDOM.render(<Parent cntxt="bar" />, div);
<ide> expect(div.children[0].innerHTML).toBe('bar');
<ide> expect(div.children[0].id).toBe('aliens');
<ide> });
<ide> describe('ReactCompositeComponent', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> var instance = React.render(<Component update={0} />, container);
<add> var instance = ReactDOM.render(<Component update={0} />, container);
<ide> expect(renders).toBe(1);
<ide> expect(instance.state.updated).toBe(false);
<del> React.render(<Component update={1} />, container);
<add> ReactDOM.render(<Component update={1} />, container);
<ide> expect(renders).toBe(2);
<ide> expect(instance.state.updated).toBe(true);
<ide> });
<ide> describe('ReactCompositeComponent', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> var comp = React.render(<Component flipped={false} />, container);
<del> expect(React.findDOMNode(comp.refs.static0).textContent).toBe('A');
<del> expect(React.findDOMNode(comp.refs.static1).textContent).toBe('B');
<add> var comp = ReactDOM.render(<Component flipped={false} />, container);
<add> expect(ReactDOM.findDOMNode(comp.refs.static0).textContent).toBe('A');
<add> expect(ReactDOM.findDOMNode(comp.refs.static1).textContent).toBe('B');
<ide>
<del> expect(React.findDOMNode(comp.refs.static0))
<add> expect(ReactDOM.findDOMNode(comp.refs.static0))
<ide> .toBe(comp.refs.static0.getDOMNode());
<del> expect(React.findDOMNode(comp.refs.static1))
<add> expect(ReactDOM.findDOMNode(comp.refs.static1))
<ide> .toBe(comp.refs.static1.getDOMNode());
<ide>
<ide> // When flipping the order, the refs should update even though the actual
<ide> // contents do not
<del> React.render(<Component flipped={true} />, container);
<del> expect(React.findDOMNode(comp.refs.static0).textContent).toBe('B');
<del> expect(React.findDOMNode(comp.refs.static1).textContent).toBe('A');
<add> ReactDOM.render(<Component flipped={true} />, container);
<add> expect(ReactDOM.findDOMNode(comp.refs.static0).textContent).toBe('B');
<add> expect(ReactDOM.findDOMNode(comp.refs.static1).textContent).toBe('A');
<ide>
<del> expect(React.findDOMNode(comp.refs.static0))
<add> expect(ReactDOM.findDOMNode(comp.refs.static0))
<ide> .toBe(comp.refs.static0.getDOMNode());
<del> expect(React.findDOMNode(comp.refs.static1))
<add> expect(ReactDOM.findDOMNode(comp.refs.static1))
<ide> .toBe(comp.refs.static1.getDOMNode());
<ide> });
<ide>
<ide> describe('ReactCompositeComponent', function() {
<ide> var b = null;
<ide> var Component = React.createClass({
<ide> componentDidMount: function() {
<del> a = React.findDOMNode(this);
<add> a = ReactDOM.findDOMNode(this);
<ide> expect(a).toBe(this.getDOMNode());
<ide> },
<ide> componentWillUnmount: function() {
<del> b = React.findDOMNode(this);
<add> b = ReactDOM.findDOMNode(this);
<ide> expect(b).toBe(this.getDOMNode());
<ide> },
<ide> render: function() {
<ide> describe('ReactCompositeComponent', function() {
<ide> });
<ide> var container = document.createElement('div');
<ide> expect(a).toBe(container.firstChild);
<del> React.render(<Component />, container);
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.render(<Component />, container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> expect(a).toBe(b);
<ide> });
<ide>
<ide> describe('ReactCompositeComponent', function() {
<ide> });
<ide>
<ide> var div = document.createElement('div');
<del> React.render(<Parent><Component /></Parent>, div);
<add> ReactDOM.render(<Parent><Component /></Parent>, div);
<ide>
<ide> expect(console.error.argsForCall.length).toBe(0);
<ide> });
<ide> describe('ReactCompositeComponent', function() {
<ide>
<ide> var Component = React.createClass({
<ide> componentWillMount: function() {
<del> React.render(<div />, layer);
<add> ReactDOM.render(<div />, layer);
<ide> },
<ide>
<ide> componentWillUnmount: function() {
<del> React.unmountComponentAtNode(layer);
<add> ReactDOM.unmountComponentAtNode(layer);
<ide> },
<ide>
<ide> render: function() {
<ide> describe('ReactCompositeComponent', function() {
<ide> },
<ide> });
<ide>
<del> React.render(<Outer><Component /></Outer>, container);
<add> ReactDOM.render(<Outer><Component /></Outer>, container);
<ide>
<ide> expect(console.error.calls.length).toBe(0);
<ide>
<del> React.render(<Outer />, container);
<add> ReactDOM.render(<Outer />, container);
<ide>
<ide> expect(console.error.calls.length).toBe(0);
<ide> });
<ide><path>src/renderers/shared/reconciler/__tests__/ReactCompositeComponentNestedState-test.js
<ide> var mocks = require('mocks');
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> describe('ReactCompositeComponentNestedState-state', function() {
<ide>
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> });
<ide>
<ide> describe('ReactCompositeComponentNestedState-state', function() {
<ide>
<ide> var logger = mocks.getMockFunction();
<ide>
<del> void React.render(
<add> void ReactDOM.render(
<ide> <ParentComponent logger={logger} />,
<ide> container
<ide> );
<ide><path>src/renderers/shared/reconciler/__tests__/ReactCompositeComponentState-test.js
<ide> var mocks = require('mocks');
<ide>
<ide> var React;
<add>var ReactDOM;
<ide>
<ide> var TestComponent;
<ide>
<ide> describe('ReactCompositeComponent-state', function() {
<ide> beforeEach(function() {
<ide> React = require('React');
<ide>
<add> ReactDOM = require('ReactDOM');
<add>
<ide> TestComponent = React.createClass({
<ide> peekAtState: function(from, state) {
<ide> state = state || this.state;
<ide> describe('ReactCompositeComponent-state', function() {
<ide> this.peekAtState('componentWillUnmount');
<ide> },
<ide> });
<del>
<ide> });
<ide>
<ide> it('should support setting state', function() {
<ide> var container = document.createElement('div');
<ide> document.body.appendChild(container);
<ide>
<ide> var stateListener = mocks.getMockFunction();
<del> var instance = React.render(
<add> var instance = ReactDOM.render(
<ide> <TestComponent stateListener={stateListener} />,
<ide> container,
<ide> function peekAtInitialCallback() {
<ide> this.peekAtState('initial-callback');
<ide> }
<ide> );
<del> React.render(
<add> ReactDOM.render(
<ide> <TestComponent stateListener={stateListener} nextColor="green" />,
<ide> container,
<ide> instance.peekAtCallback('setProps')
<ide> );
<ide> instance.setFavoriteColor('blue');
<ide> instance.forceUpdate(instance.peekAtCallback('forceUpdate'));
<ide>
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide>
<ide> expect(stateListener.mock.calls.join('\n')).toEqual([
<ide> // there is no state when getInitialState() is called
<ide> describe('ReactCompositeComponent-state', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> outer = React.render(<Outer />, container);
<add> outer = ReactDOM.render(<Outer />, container);
<ide> expect(() => {
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> }).not.toThrow();
<ide> });
<ide> });
<ide><path>src/renderers/shared/reconciler/__tests__/ReactEmptyComponent-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactEmptyComponent;
<ide> var ReactTestUtils;
<ide> var TogglingComponent;
<ide> describe('ReactEmptyComponent', function() {
<ide> require('mock-modules').dumpCache();
<ide>
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactEmptyComponent = require('ReactEmptyComponent');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide>
<ide> describe('ReactEmptyComponent', function() {
<ide> return {component: this.props.firstComponent};
<ide> },
<ide> componentDidMount: function() {
<del> console.log(React.findDOMNode(this));
<add> console.log(ReactDOM.findDOMNode(this));
<ide> this.setState({component: this.props.secondComponent});
<ide> },
<ide> componentDidUpdate: function() {
<del> console.log(React.findDOMNode(this));
<add> console.log(ReactDOM.findDOMNode(this));
<ide> },
<ide> render: function() {
<ide> var Component = this.state.component;
<ide> describe('ReactEmptyComponent', function() {
<ide> componentDidMount: function() {
<ide> // Make sure the DOM node resolves properly even if we're replacing a
<ide> // `null` component
<del> expect(React.findDOMNode(this)).not.toBe(null);
<add> expect(ReactDOM.findDOMNode(this)).not.toBe(null);
<ide> assertions++;
<ide> },
<ide> componentWillUnmount: function() {
<ide> // Even though we're getting replaced by `null`, we haven't been
<ide> // replaced yet!
<del> expect(React.findDOMNode(this)).not.toBe(null);
<add> expect(ReactDOM.findDOMNode(this)).not.toBe(null);
<ide> assertions++;
<ide> },
<ide> });
<ide> describe('ReactEmptyComponent', function() {
<ide> var component;
<ide>
<ide> // Render the <Inner /> component...
<del> component = React.render(<Wrapper showInner={true} />, el);
<del> expect(React.findDOMNode(component)).not.toBe(null);
<add> component = ReactDOM.render(<Wrapper showInner={true} />, el);
<add> expect(ReactDOM.findDOMNode(component)).not.toBe(null);
<ide>
<ide> // Switch to null...
<del> component = React.render(<Wrapper showInner={false} />, el);
<del> expect(React.findDOMNode(component)).toBe(null);
<add> component = ReactDOM.render(<Wrapper showInner={false} />, el);
<add> expect(ReactDOM.findDOMNode(component)).toBe(null);
<ide>
<ide> // ...then switch back.
<del> component = React.render(<Wrapper showInner={true} />, el);
<del> expect(React.findDOMNode(component)).not.toBe(null);
<add> component = ReactDOM.render(<Wrapper showInner={true} />, el);
<add> expect(ReactDOM.findDOMNode(component)).not.toBe(null);
<ide>
<ide> expect(assertions).toBe(3);
<ide> });
<ide> describe('ReactEmptyComponent', function() {
<ide> // TODO: This should actually work since `null` is a valid ReactNode
<ide> var div = document.createElement('div');
<ide> expect(function() {
<del> React.render(null, div);
<add> ReactDOM.render(null, div);
<ide> }).toThrow(
<ide> 'Invariant Violation: React.render(): Invalid component element.'
<ide> );
<ide><path>src/renderers/shared/reconciler/__tests__/ReactIdentity-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactFragment;
<ide> var ReactTestUtils;
<ide> var ReactMount;
<ide> describe('ReactIdentity', function() {
<ide> beforeEach(function() {
<ide> require('mock-modules').dumpCache();
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactFragment = require('ReactFragment');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> ReactMount = require('ReactMount');
<ide> describe('ReactIdentity', function() {
<ide> })}
<ide> </div>;
<ide>
<del> instance = React.render(instance, document.createElement('div'));
<del> var node = React.findDOMNode(instance);
<add> instance = ReactDOM.render(instance, document.createElement('div'));
<add> var node = ReactDOM.findDOMNode(instance);
<ide> expect(node.childNodes.length).toBe(2);
<ide> checkID(node.childNodes[0], '.0.$first:0');
<ide> checkID(node.childNodes[1], '.0.$second:0');
<ide> describe('ReactIdentity', function() {
<ide> <div key={123} />
<ide> </div>;
<ide>
<del> instance = React.render(instance, document.createElement('div'));
<del> var node = React.findDOMNode(instance);
<add> instance = ReactDOM.render(instance, document.createElement('div'));
<add> var node = ReactDOM.findDOMNode(instance);
<ide> expect(node.childNodes.length).toBe(4);
<ide> checkID(node.childNodes[0], '.0.$apple');
<ide> checkID(node.childNodes[1], '.0.$banana');
<ide> describe('ReactIdentity', function() {
<ide> <Wrapper><span key="chipmunk" /></Wrapper>
<ide> </div>;
<ide>
<del> instance = React.render(instance, document.createElement('div'));
<del> var node = React.findDOMNode(instance);
<add> instance = ReactDOM.render(instance, document.createElement('div'));
<add> var node = ReactDOM.findDOMNode(instance);
<ide> expect(node.childNodes.length).toBe(3);
<ide>
<ide> checkID(node.childNodes[0], '.0.$wrap1');
<ide> describe('ReactIdentity', function() {
<ide>
<ide> });
<ide>
<del> var instance = React.render(<Wrapper />, container);
<add> var instance = ReactDOM.render(<Wrapper />, container);
<ide> var span1 = instance.refs.span1;
<ide> var span2 = instance.refs.span2;
<ide>
<del> expect(React.findDOMNode(span1)).not.toBe(null);
<del> expect(React.findDOMNode(span2)).not.toBe(null);
<add> expect(ReactDOM.findDOMNode(span1)).not.toBe(null);
<add> expect(ReactDOM.findDOMNode(span2)).not.toBe(null);
<ide>
<ide> key = key.replace(/=/g, '=0');
<ide>
<del> checkID(React.findDOMNode(span1), '.0.$' + key);
<del> checkID(React.findDOMNode(span2), '.0.1:$' + key + ':0');
<add> checkID(ReactDOM.findDOMNode(span1), '.0.$' + key);
<add> checkID(ReactDOM.findDOMNode(span2), '.0.1:$' + key + ':0');
<ide> }
<ide>
<ide> it('should allow any character as a key, in a detached parent', function() {
<ide> describe('ReactIdentity', function() {
<ide>
<ide> var wrapped = <TestContainer first={instance0} second={instance1} />;
<ide>
<del> wrapped = React.render(wrapped, document.createElement('div'));
<add> wrapped = ReactDOM.render(wrapped, document.createElement('div'));
<ide>
<del> var beforeID = ReactMount.getID(React.findDOMNode(wrapped).firstChild);
<add> var beforeID = ReactMount.getID(ReactDOM.findDOMNode(wrapped).firstChild);
<ide>
<ide> wrapped.swap();
<ide>
<del> var afterID = ReactMount.getID(React.findDOMNode(wrapped).firstChild);
<add> var afterID = ReactMount.getID(ReactDOM.findDOMNode(wrapped).firstChild);
<ide>
<ide> expect(beforeID).not.toEqual(afterID);
<ide>
<ide><path>src/renderers/shared/reconciler/__tests__/ReactMultiChild-test.js
<ide> var mocks = require('mocks');
<ide> describe('ReactMultiChild', function() {
<ide> var React;
<ide>
<add> var ReactDOM;
<add>
<ide> beforeEach(function() {
<ide> require('mock-modules').dumpCache();
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> });
<ide>
<ide> describe('reconciliation', function() {
<ide> describe('ReactMultiChild', function() {
<ide> expect(mockUpdate.mock.calls.length).toBe(0);
<ide> expect(mockUnmount.mock.calls.length).toBe(0);
<ide>
<del> React.render(<div><MockComponent /></div>, container);
<add> ReactDOM.render(<div><MockComponent /></div>, container);
<ide>
<ide> expect(mockMount.mock.calls.length).toBe(1);
<ide> expect(mockUpdate.mock.calls.length).toBe(0);
<ide> expect(mockUnmount.mock.calls.length).toBe(0);
<ide>
<del> React.render(<div><MockComponent /></div>, container);
<add> ReactDOM.render(<div><MockComponent /></div>, container);
<ide>
<ide> expect(mockMount.mock.calls.length).toBe(1);
<ide> expect(mockUpdate.mock.calls.length).toBe(1);
<ide> describe('ReactMultiChild', function() {
<ide> expect(mockMount.mock.calls.length).toBe(0);
<ide> expect(mockUnmount.mock.calls.length).toBe(0);
<ide>
<del> React.render(<div><MockComponent /></div>, container);
<add> ReactDOM.render(<div><MockComponent /></div>, container);
<ide>
<ide> expect(mockMount.mock.calls.length).toBe(1);
<ide> expect(mockUnmount.mock.calls.length).toBe(0);
<ide>
<del> React.render(<div><span /></div>, container);
<add> ReactDOM.render(<div><span /></div>, container);
<ide>
<ide> expect(mockMount.mock.calls.length).toBe(1);
<ide> expect(mockUnmount.mock.calls.length).toBe(1);
<ide> describe('ReactMultiChild', function() {
<ide> expect(mockMount.mock.calls.length).toBe(0);
<ide> expect(mockUnmount.mock.calls.length).toBe(0);
<ide>
<del> React.render(<WrapperComponent />, container);
<add> ReactDOM.render(<WrapperComponent />, container);
<ide>
<ide> expect(mockMount.mock.calls.length).toBe(1);
<ide> expect(mockUnmount.mock.calls.length).toBe(0);
<ide>
<del> React.render(
<add> ReactDOM.render(
<ide> <WrapperComponent><MockComponent /></WrapperComponent>,
<ide> container
<ide> );
<ide> describe('ReactMultiChild', function() {
<ide> expect(mockMount.mock.calls.length).toBe(0);
<ide> expect(mockUnmount.mock.calls.length).toBe(0);
<ide>
<del> React.render(<div><MockComponent key="A" /></div>, container);
<add> ReactDOM.render(<div><MockComponent key="A" /></div>, container);
<ide>
<ide> expect(mockMount.mock.calls.length).toBe(1);
<ide> expect(mockUnmount.mock.calls.length).toBe(0);
<ide>
<del> React.render(<div><MockComponent key="B" /></div>, container);
<add> ReactDOM.render(<div><MockComponent key="B" /></div>, container);
<ide>
<ide> expect(mockMount.mock.calls.length).toBe(2);
<ide> expect(mockUnmount.mock.calls.length).toBe(1);
<ide> describe('ReactMultiChild', function() {
<ide> it('should only set `innerHTML` once on update', function() {
<ide> var container = document.createElement('div');
<ide>
<del> React.render(
<add> ReactDOM.render(
<ide> <div>
<ide> <p><span /></p>
<ide> <p><span /></p>
<ide> describe('ReactMultiChild', function() {
<ide> container
<ide> );
<ide> // Warm the cache used by `getMarkupWrap`.
<del> React.render(
<add> ReactDOM.render(
<ide> <div>
<ide> <p><span /><span /></p>
<ide> <p><span /><span /></p>
<ide> describe('ReactMultiChild', function() {
<ide> expect(setInnerHTML).toHaveBeenCalled();
<ide> var callCountOnMount = setInnerHTML.calls.length;
<ide>
<del> React.render(
<add> ReactDOM.render(
<ide> <div>
<ide> <p><span /><span /><span /></p>
<ide> <p><span /><span /><span /></p>
<ide><path>src/renderers/shared/reconciler/__tests__/ReactMultiChildReconcile-test.js
<ide> require('mock-modules');
<ide>
<ide> var React = require('React');
<add>var ReactDOM = require('ReactDOM');
<ide> var ReactInstanceMap = require('ReactInstanceMap');
<ide> var ReactMount = require('ReactMount');
<ide>
<ide> function verifyStatesPreserved(lastInternalStates, statusDisplays) {
<ide> * accurately reflects what is in the DOM.
<ide> */
<ide> function verifyDomOrderingAccurate(parentInstance, statusDisplays) {
<del> var containerNode = React.findDOMNode(parentInstance);
<add> var containerNode = ReactDOM.findDOMNode(parentInstance);
<ide> var statusDisplayNodes = containerNode.childNodes;
<ide> var i;
<ide> var orderedDomIDs = [];
<ide> function verifyDomOrderingAccurate(parentInstance, statusDisplays) {
<ide> function testPropsSequence(sequence) {
<ide> var i;
<ide> var container = document.createElement('div');
<del> var parentInstance = React.render(
<add> var parentInstance = ReactDOM.render(
<ide> <FriendsStatusDisplay {...sequence[0]} />,
<ide> container
<ide> );
<ide> function testPropsSequence(sequence) {
<ide> verifyStatuses(statusDisplays, sequence[0]);
<ide>
<ide> for (i = 1; i < sequence.length; i++) {
<del> React.render(
<add> ReactDOM.render(
<ide> <FriendsStatusDisplay {...sequence[i]} />,
<ide> container
<ide> );
<ide> describe('ReactMultiChildReconcile', function() {
<ide> };
<ide>
<ide> var container = document.createElement('div');
<del> var parentInstance = React.render(
<add> var parentInstance = ReactDOM.render(
<ide> <FriendsStatusDisplay {...props} />,
<ide> container
<ide> );
<ide> var statusDisplays = parentInstance.getStatusDisplays();
<ide> var startingInternalState = statusDisplays.jcw.getInternalState();
<ide>
<ide> // Now remove the child.
<del> React.render(
<add> ReactDOM.render(
<ide> <FriendsStatusDisplay />,
<ide> container
<ide> );
<ide> statusDisplays = parentInstance.getStatusDisplays();
<ide> expect(statusDisplays.jcw).toBeFalsy();
<ide>
<ide> // Now reset the props that cause there to be a child
<del> React.render(
<add> ReactDOM.render(
<ide> <FriendsStatusDisplay {...props} />,
<ide> container
<ide> );
<ide><path>src/renderers/shared/reconciler/__tests__/ReactMultiChildText-test.js
<ide> require('mock-modules');
<ide>
<ide> var React = require('React');
<add>var ReactDOM = require('ReactDOM');
<ide> var ReactFragment = require('ReactFragment');
<ide> var ReactTestUtils = require('ReactTestUtils');
<ide>
<ide> var testAllPermutations = function(testCases) {
<ide> var expectedResultAfterUpdate = testCases[j + 1];
<ide>
<ide> var container = document.createElement('div');
<del> var d = React.render(<div>{renderWithChildren}</div>, container);
<add> var d = ReactDOM.render(<div>{renderWithChildren}</div>, container);
<ide> expectChildren(d, expectedResultAfterRender);
<ide>
<del> d = React.render(<div>{updateWithChildren}</div>, container);
<add> d = ReactDOM.render(<div>{updateWithChildren}</div>, container);
<ide> expectChildren(d, expectedResultAfterUpdate);
<ide> }
<ide> }
<ide> };
<ide>
<ide> var expectChildren = function(d, children) {
<del> var outerNode = React.findDOMNode(d);
<add> var outerNode = ReactDOM.findDOMNode(d);
<ide> var textNode;
<ide> if (typeof children === 'string') {
<ide> textNode = outerNode.firstChild;
<ide><path>src/renderers/shared/reconciler/__tests__/ReactUpdates-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTestUtils;
<ide> var ReactUpdates;
<ide>
<ide> describe('ReactUpdates', function() {
<ide> beforeEach(function() {
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> ReactUpdates = require('ReactUpdates');
<ide> });
<ide> describe('ReactUpdates', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> var instance = React.render(<Component x={0} />, container);
<add> var instance = ReactDOM.render(<Component x={0} />, container);
<ide> expect(instance.props.x).toBe(0);
<ide> expect(instance.state.y).toBe(0);
<ide>
<ide> ReactUpdates.batchedUpdates(function() {
<del> React.render(<Component x={1} />, container);
<add> ReactDOM.render(<Component x={1} />, container);
<ide> instance.setState({y: 2});
<ide> expect(instance.props.x).toBe(0);
<ide> expect(instance.state.y).toBe(0);
<ide> describe('ReactUpdates', function() {
<ide>
<ide> // Initial renders aren't batched together yet...
<ide> ReactUpdates.batchedUpdates(function() {
<del> React.render(<Component text="A1" />, containerA);
<del> React.render(<Component text="B1" />, containerB);
<add> ReactDOM.render(<Component text="A1" />, containerA);
<add> ReactDOM.render(<Component text="B1" />, containerB);
<ide> });
<ide> expect(ReconcileTransaction.getPooled.calls.length).toBe(2);
<ide>
<ide> // ...but updates are! Here only one more transaction is used, which means
<ide> // we only have to initialize and close the wrappers once.
<ide> ReactUpdates.batchedUpdates(function() {
<del> React.render(<Component text="A2" />, containerA);
<del> React.render(<Component text="B2" />, containerB);
<add> ReactDOM.render(<Component text="A2" />, containerA);
<add> ReactDOM.render(<Component text="B2" />, containerB);
<ide> });
<ide> expect(ReconcileTransaction.getPooled.calls.length).toBe(3);
<ide> });
<ide> describe('ReactUpdates', function() {
<ide> return {x: 0};
<ide> },
<ide> componentDidUpdate: function() {
<del> expect(React.findDOMNode(b).textContent).toBe('B1');
<add> expect(ReactDOM.findDOMNode(b).textContent).toBe('B1');
<ide> aUpdated = true;
<ide> },
<ide> render: function() {
<ide> describe('ReactUpdates', function() {
<ide> componentDidMount: function() {
<ide> instances.push(this);
<ide> if (this.props.depth < this.props.count) {
<del> React.render(
<add> ReactDOM.render(
<ide> <MockComponent
<ide> depth={this.props.depth + 1}
<ide> count={this.props.count}
<ide> />,
<del> React.findDOMNode(this)
<add> ReactDOM.findDOMNode(this)
<ide> );
<ide> }
<ide> },
<ide> describe('ReactUpdates', function() {
<ide>
<ide> x = ReactTestUtils.renderIntoDocument(<X />);
<ide> y = ReactTestUtils.renderIntoDocument(<Y />);
<del> expect(React.findDOMNode(x).textContent).toBe('0');
<add> expect(ReactDOM.findDOMNode(x).textContent).toBe('0');
<ide>
<ide> y.forceUpdate();
<del> expect(React.findDOMNode(x).textContent).toBe('1');
<add> expect(ReactDOM.findDOMNode(x).textContent).toBe('1');
<ide> });
<ide>
<ide> it('should queue updates from during mount', function() {
<ide> describe('ReactUpdates', function() {
<ide> });
<ide>
<ide> expect(a.state.x).toBe(1);
<del> expect(React.findDOMNode(a).textContent).toBe('A1');
<add> expect(ReactDOM.findDOMNode(a).textContent).toBe('A1');
<ide> });
<ide>
<ide> it('calls componentWillReceiveProps setState callback properly', function() {
<ide> describe('ReactUpdates', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> React.render(<A x={1} />, container);
<del> React.render(<A x={2} />, container);
<add> ReactDOM.render(<A x={1} />, container);
<add> ReactDOM.render(<A x={2} />, container);
<ide> expect(callbackCount).toBe(1);
<ide> });
<ide>
<ide><path>src/renderers/shared/reconciler/__tests__/refs-destruction-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<ide> var ReactTestUtils;
<ide>
<ide> var TestComponent;
<ide> describe('refs-destruction', function() {
<ide> require('mock-modules').dumpCache();
<ide>
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide>
<ide> TestComponent = React.createClass({
<ide> describe('refs-destruction', function() {
<ide>
<ide> it('should remove refs when destroying the parent', function() {
<ide> var container = document.createElement('div');
<del> var testInstance = React.render(<TestComponent />, container);
<add> var testInstance = ReactDOM.render(<TestComponent />, container);
<ide> expect(ReactTestUtils.isDOMComponent(testInstance.refs.theInnerDiv))
<ide> .toBe(true);
<ide> expect(Object.keys(testInstance.refs || {}).length).toEqual(1);
<del> React.unmountComponentAtNode(container);
<add> ReactDOM.unmountComponentAtNode(container);
<ide> expect(Object.keys(testInstance.refs || {}).length).toEqual(0);
<ide> });
<ide>
<ide> it('should remove refs when destroying the child', function() {
<ide> var container = document.createElement('div');
<del> var testInstance = React.render(<TestComponent />, container);
<add> var testInstance = ReactDOM.render(<TestComponent />, container);
<ide> expect(ReactTestUtils.isDOMComponent(testInstance.refs.theInnerDiv))
<ide> .toBe(true);
<ide> expect(Object.keys(testInstance.refs || {}).length).toEqual(1);
<del> React.render(<TestComponent destroy={true} />, container);
<add> ReactDOM.render(<TestComponent destroy={true} />, container);
<ide> expect(Object.keys(testInstance.refs || {}).length).toEqual(0);
<ide> });
<ide> });
<ide><path>src/test/ReactTestUtils.js
<ide> var EventConstants = require('EventConstants');
<ide> var EventPluginHub = require('EventPluginHub');
<ide> var EventPropagators = require('EventPropagators');
<ide> var React = require('React');
<add>var ReactDOM = require('ReactDOM');
<ide> var ReactElement = require('ReactElement');
<ide> var ReactEmptyComponent = require('ReactEmptyComponent');
<ide> var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter');
<ide> var ReactTestUtils = {
<ide> // clean up, so we're going to stop honoring the name of this method
<ide> // (and probably rename it eventually) if no problems arise.
<ide> // document.documentElement.appendChild(div);
<del> return React.render(instance, div);
<add> return ReactDOM.render(instance, div);
<ide> },
<ide>
<ide> isElement: function(element) {
<ide> var ReactTestUtils = {
<ide> scryRenderedDOMComponentsWithClass: function(root, className) {
<ide> return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
<ide> if (ReactTestUtils.isDOMComponent(inst)) {
<del> var instClassName = React.findDOMNode(inst).className;
<add> var instClassName = ReactDOM.findDOMNode(inst).className;
<ide> return (
<ide> instClassName &&
<ide> (('' + instClassName).split(/\s+/)).indexOf(className) !== -1
<ide><path>src/test/__tests__/ReactTestUtils-test.js
<ide> 'use strict';
<ide>
<ide> var React;
<add>var ReactDOM;
<add>var ReactDOMServer;
<ide> var ReactTestUtils;
<ide>
<ide> var mocks;
<ide> describe('ReactTestUtils', function() {
<ide> mocks = require('mocks');
<ide>
<ide> React = require('React');
<add> ReactDOM = require('ReactDOM');
<add> ReactDOMServer = require('ReactDOMServer');
<ide> ReactTestUtils = require('ReactTestUtils');
<ide> });
<ide>
<ide> describe('ReactTestUtils', function() {
<ide> });
<ide>
<ide> var container = document.createElement('div');
<del> React.render(
<add> ReactDOM.render(
<ide> <Wrapper>
<ide> {null}
<ide> <div>purple</div>
<ide> </Wrapper>,
<ide> container
<ide> );
<del> var tree = React.render(
<add> var tree = ReactDOM.render(
<ide> <Wrapper>
<ide> <div>orange</div>
<ide> <div>purple</div>
<ide> describe('ReactTestUtils', function() {
<ide> var log = [];
<ide> ReactTestUtils.findAllInRenderedTree(tree, function(child) {
<ide> if (ReactTestUtils.isDOMComponent(child)) {
<del> log.push(React.findDOMNode(child).textContent);
<add> log.push(ReactDOM.findDOMNode(child).textContent);
<ide> }
<ide> });
<ide>
<ide> describe('ReactTestUtils', function() {
<ide> },
<ide> });
<ide>
<del> var markup = React.renderToString(<Root />);
<add> var markup = ReactDOMServer.renderToString(<Root />);
<ide> var testDocument = getTestDocument(markup);
<del> var component = React.render(<Root />, testDocument);
<add> var component = ReactDOM.render(<Root />, testDocument);
<ide>
<ide> expect(component.refs.html.tagName).toBe('HTML');
<ide> expect(component.refs.head.tagName).toBe('HEAD'); | 45 |
Ruby | Ruby | add description for `--fetch-head` option | c3ba863a30e9b21e42453e103155492d114adc2e | <ide><path>Library/Homebrew/cmd/install.rb
<ide> def install_args
<ide> description: "If <formula> defines it, install the development version."
<ide> switch "--HEAD",
<ide> description: "If <formula> defines it, install the HEAD version, aka master, trunk, unstable."
<del> switch "--fetch-HEAD"
<add> switch "--fetch-HEAD",
<add> description: "Fetch the upstream repository to detect if the HEAD installation of the "\
<add> "formula is outdated. Otherwise, the repository's HEAD will be checked for "\
<add> "updates when a new stable or devel version has been released."
<ide> switch "--keep-tmp",
<ide> description: "Dont delete the temporary files created during installation."
<ide> switch "--build-bottle", | 1 |
Python | Python | fix tf doctests | 6dda14dc47d82f0e32df05fea8ba6444ba52b90a | <ide><path>src/transformers/generation/tf_utils.py
<ide> def greedy_search(
<ide> ... )
<ide>
<ide> >>> outputs = model.greedy_search(input_ids, logits_processor=logits_processor)
<del>
<del> >>> print("Generated:", tokenizer.batch_decode(outputs, skip_special_tokens=True))
<add> >>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
<add> ["Today is a beautiful day, and I'm so happy to be here. I'm so happy to"]
<ide> ```"""
<ide>
<ide> # 1. init greedy_search values
<ide> def sample(
<ide> Examples:
<ide>
<ide> ```python
<add> >>> import tensorflow as tf
<ide> >>> from transformers import (
<ide> ... AutoTokenizer,
<ide> ... TFAutoModelForCausalLM,
<ide> def sample(
<ide> ... ]
<ide> ... )
<ide>
<add> >>> tf.random.set_seed(0)
<ide> >>> outputs = model.sample(input_ids, logits_processor=logits_processor, logits_warper=logits_warper)
<ide>
<del> >>> print("Generated:", tokenizer.batch_decode(outputs, skip_special_tokens=True))
<add> >>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
<add> ['Today is a beautiful day, and it\'s all about the future."\n\nThe announcement comes three']
<ide> ```"""
<ide>
<ide> # 1. init greedy_search values
<ide> def beam_search(
<ide> >>> # lets run beam search using 3 beams
<ide> >>> num_beams = 3
<ide> >>> # define decoder start token ids
<del> >>> input_ids = tf.ones((num_beams, 1), dtype=tf.int64)
<add> >>> input_ids = tf.ones((1, num_beams, 1), dtype=tf.int32)
<ide> >>> input_ids = input_ids * model.config.decoder_start_token_id
<ide>
<ide> >>> # add encoder_outputs to model keyword arguments
<del> >>> model_kwargs = {
<del> ... "encoder_outputs": model.get_encoder()(
<del> ... tf.repeat(encoder_input_ids, num_beams, axis=0), return_dict=True
<del> ... )
<del> ... }
<add> >>> encoder_outputs = model.get_encoder()(encoder_input_ids, return_dict=True)
<add> >>> encoder_outputs.last_hidden_state = tf.repeat(
<add> ... tf.expand_dims(encoder_outputs.last_hidden_state, axis=0), num_beams, axis=1
<add> ... )
<add> >>> model_kwargs = {"encoder_outputs": encoder_outputs}
<ide>
<ide> >>> # instantiate logits processors
<ide> >>> logits_processor = TFLogitsProcessorList(
<ide> def beam_search(
<ide>
<ide> >>> outputs = model.beam_search(input_ids, logits_processor=logits_processor, **model_kwargs)
<ide>
<del> >>> print("Generated:", tokenizer.batch_decode(outputs, skip_special_tokens=True))
<add> >>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
<add> ['Wie alt bist du?']
<ide> ```"""
<ide>
<ide> def flatten_beam_dim(tensor, batch_axis=0): | 1 |
Go | Go | use waitwithcontext for waitstop | 36d6d76a41be4973eed98f64a565f8cf92dc16e0 | <ide><path>container/state.go
<ide> func wait(waitChan <-chan struct{}, timeout time.Duration) error {
<ide> // immediately. If you want wait forever you must supply negative timeout.
<ide> // Returns exit code, that was passed to SetStopped
<ide> func (s *State) WaitStop(timeout time.Duration) (int, error) {
<del> s.Lock()
<del> if !s.Running {
<del> exitCode := s.ExitCodeValue
<del> s.Unlock()
<del> return exitCode, nil
<add> ctx := context.Background()
<add> if timeout >= 0 {
<add> var cancel func()
<add> ctx, cancel = context.WithTimeout(ctx, timeout)
<add> defer cancel()
<ide> }
<del> waitChan := s.waitChan
<del> s.Unlock()
<del> if err := wait(waitChan, timeout); err != nil {
<add> if err := s.WaitWithContext(ctx); err != nil {
<add> if status, ok := err.(*StateStatus); ok {
<add> return status.ExitCode(), nil
<add> }
<ide> return -1, err
<ide> }
<del> s.Lock()
<del> defer s.Unlock()
<del> return s.ExitCode(), nil
<add> return 0, nil
<ide> }
<ide>
<ide> // WaitWithContext waits for the container to stop. Optional context can be
<ide> // passed for canceling the request.
<ide> func (s *State) WaitWithContext(ctx context.Context) error {
<del> // todo(tonistiigi): make other wait functions use this
<ide> s.Lock()
<ide> if !s.Running {
<ide> state := newStateStatus(s.ExitCode(), s.Error()) | 1 |
Python | Python | remove torino from stop words | c105ed10fd5d9eb924f767911dfc6400e0386505 | <ide><path>spacy/lang/it/stop_words.py
<ide> subito successivamente successivo sue sugl sugli sui sul sull sulla sulle
<ide> sullo suo suoi
<ide>
<del>tale tali talvolta tanto te tempo ti titolo torino tra tranne tre trenta
<add>tale tali talvolta tanto te tempo ti titolo tra tranne tre trenta
<ide> troppo trovato tu tua tue tuo tuoi tutta tuttavia tutte tutti tutto
<ide>
<ide> uguali ulteriore ultimo un una uno uomo | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.