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 |
|---|---|---|---|---|---|
Text | Text | extend deprecation cycle to 3 releases by default | 9414955c608834c20e3764e753854e667f2e0cbe | <ide><path>docs/deprecated.md
<ide> weight=80
<ide> # Deprecated Engine Features
<ide>
<ide> The following list of features are deprecated in Engine.
<add>To learn more about Docker Engine's deprecation policy,
<add>see [Feature Deprecation Policy](index.md#feature-deprecation-policy).
<add>
<ide>
<ide> ### Three argument form in `docker import`
<ide> **Deprecated In Release: [v0.6.7](https://github.com/docker/docker/releases/tag/v0.6.7)**
<ide> The `docker import` command format 'file|URL|- [REPOSITORY [TAG]]' is deprecated
<ide>
<ide> **Deprecated In Release: [v1.12.0](https://github.com/docker/docker/releases/)**
<ide>
<del>**Target For Removal In Release: [v1.14.0](https://github.com/docker/docker/releases/)**
<add>**Target For Removal In Release: v1.15**
<ide>
<ide> The shorthand (`-h`) is less common than `--help` on Linux and cannot be used
<ide> on all subcommands (due to it conflicting with, e.g. `-h` / `--hostname` on
<ide> on all subcommands (due to it conflicting with, e.g. `-h` / `--hostname` on
<ide> ### `-e` and `--email` flags on `docker login`
<ide> **Deprecated In Release: [v1.11.0](https://github.com/docker/docker/releases/tag/v1.11.0)**
<ide>
<del>**Target For Removal In Release: v1.13**
<add>**Target For Removal In Release: v1.14**
<ide>
<ide> The docker login command is removing the ability to automatically register for an account with the target registry if the given username doesn't exist. Due to this change, the email flag is no longer required, and will be deprecated.
<ide>
<ide> ### Separator (`:`) of `--security-opt` flag on `docker run`
<ide> **Deprecated In Release: [v1.11.0](https://github.com/docker/docker/releases/tag/v1.11.0)**
<ide>
<del>**Target For Removal In Release: v1.13**
<add>**Target For Removal In Release: v1.14**
<ide>
<ide> The flag `--security-opt` doesn't use the colon separator(`:`) anymore to divide keys and values, it uses the equal symbol(`=`) for consinstency with other similar flags, like `--storage-opt`.
<ide>
<ide> Use `docker ps --filter=before=...` and `docker ps --filter=since=...` instead.
<ide>
<ide> **Deprecated in Release: [v1.12.0](https://github.com/docker/docker/releases/)**
<ide>
<del>**Target For Removal In Release: v1.14**
<add>**Target For Removal In Release: v1.15**
<ide>
<ide> The `docker search --automated` and `docker search --stars` options are deprecated.
<ide> Use `docker search --filter=is-automated=...` and `docker search --filter=stars=...` instead.
<ide><path>docs/index.md
<ide> on the separate [Release Notes page](https://docs.docker.com/release-notes)
<ide> As changes are made to Docker there may be times when existing features
<ide> will need to be removed or replaced with newer features. Before an existing
<ide> feature is removed it will be labeled as "deprecated" within the documentation
<del>and will remain in Docker for, usually, at least 2 releases. After that time
<add>and will remain in Docker for, usually, at least 3 releases. After that time
<ide> it may be removed.
<ide>
<ide> Users are expected to take note of the list of deprecated features each | 2 |
Python | Python | add xfailing test for [ci skip] | 3af0b2dd1c6573dd4a7e993c2ab05fd8c02742d3 | <ide><path>spacy/tests/regression/test_issue1971.py
<ide> def test_issue_1971_2(en_vocab):
<ide> matcher.add("TEST", None, pattern1, pattern2)
<ide> matches = matcher(doc)
<ide> assert len(matches) == 2
<add>
<add>
<add>@pytest.mark.xfail
<add>def test_issue_1971_3(en_vocab):
<add> Token.set_extension("a", default=1)
<add> Token.set_extension("b", default=2)
<add> doc = Doc(en_vocab, words=["hello", "world"])
<add> matcher = Matcher(en_vocab)
<add> matcher.add("A", None, [{"_": {"a": 1}}])
<add> matcher.add("B", None, [{"_": {"b": 2}}])
<add> matches = sorted((en_vocab.strings[m_id], s, e) for m_id, s, e in matcher(doc))
<add> assert len(matches) == 4
<add> assert matches == sorted([("A", 0, 1), ("A", 1, 2), ("B", 0, 1), ("B", 1, 2)]) | 1 |
Python | Python | add another call to gc.collect in break_cycles | 382befec16270beb0b8de3ee15f411d231dbc9ec | <ide><path>numpy/testing/_private/utils.py
<ide> def break_cycles():
<ide>
<ide> gc.collect()
<ide> if IS_PYPY:
<del> # interpreter runs now, to call deleted objects' __del__ methods
<add> # a few more, just to make sure all the finalizers are called
<add> gc.collect()
<ide> gc.collect()
<del> # two more, just to make sure
<ide> gc.collect()
<ide> gc.collect()
<ide> | 1 |
PHP | PHP | fix more doc blocks | 817abe04fa3dcbbd194884c17fc54977bfa46375 | <ide><path>src/ORM/Marshaller.php
<ide> protected function _prepareDataAndOptions($data, $options)
<ide> * @param \Cake\ORM\Association $assoc The association to marshall
<ide> * @param array $value The data to hydrate
<ide> * @param array $options List of options.
<del> * @return mixed
<add> * @return \Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[]|null
<ide> */
<ide> protected function _marshalAssociation($assoc, $value, $options)
<ide> {
<ide> public function mergeMany($entities, array $data, array $options = [])
<ide> /**
<ide> * Creates a new sub-marshaller and merges the associated data.
<ide> *
<del> * @param \Cake\Datasource\EntityInterface $original The original entity
<add> * @param \Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[] $original The original entity
<ide> * @param \Cake\ORM\Association $assoc The association to merge
<ide> * @param array $value The data to hydrate
<ide> * @param array $options List of options.
<del> * @return mixed
<add> * @return \Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[]|null
<ide> */
<ide> protected function _mergeAssociation($original, $assoc, $value, $options)
<ide> { | 1 |
Ruby | Ruby | extract function `intersection_of_dependents` | 281a5986856f3505c23b45c786b5e98ec1643f07 | <ide><path>Library/Homebrew/cmd/uses.rb
<ide> def uses
<ide> end
<ide>
<ide> use_runtime_dependents = args.installed? &&
<add> !used_formulae_missing &&
<ide> !args.include_build? &&
<ide> !args.include_test? &&
<ide> !args.include_optional? &&
<ide> !args.skip_recommended?
<ide>
<add> uses = intersection_of_dependents(use_runtime_dependents, used_formulae, args: args)
<add>
<add> return if uses.empty?
<add>
<add> puts Formatter.columns(uses.map(&:full_name).sort)
<add> odie "Missing formulae should not have dependents!" if used_formulae_missing
<add> end
<add>
<add> def intersection_of_dependents(use_runtime_dependents, used_formulae, args:)
<ide> recursive = args.recursive?
<ide> includes, ignores = args_includes_ignores(args)
<ide>
<del> uses = if use_runtime_dependents && !used_formulae_missing
<add> if use_runtime_dependents
<ide> used_formulae.map(&:runtime_installed_formula_dependents)
<ide> .reduce(&:&)
<ide> .select(&:any_version_installed?) +
<ide> def uses
<ide>
<ide> select_used_dependents(deps, used_formulae, recursive, includes, ignores)
<ide> end
<del>
<del> return if uses.empty?
<del>
<del> puts Formatter.columns(uses.map(&:full_name).sort)
<del> odie "Missing formulae should not have dependents!" if used_formulae_missing
<ide> end
<ide>
<ide> def select_used_dependents(dependents, used_formulae, recursive, includes, ignores) | 1 |
Java | Java | remove redundant isbridgeless() checking | 10830f4db94969b83b4e751be5429cc2fcacd8f0 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java
<ide> protected final ReactApplicationContext getReactApplicationContext() {
<ide> */
<ide> @ThreadConfined(ANY)
<ide> protected @Nullable final ReactApplicationContext getReactApplicationContextIfActiveOrWarn() {
<del> if (mReactApplicationContext.hasActiveReactInstance()
<del> || mReactApplicationContext.isBridgeless()) {
<add> if (mReactApplicationContext.hasActiveReactInstance()) {
<ide> return mReactApplicationContext;
<ide> }
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java
<ide> public void run() {
<ide> });
<ide>
<ide> @Nullable ReactContext context = mCurrentContext;
<del> if (context == null
<del> || (!context.isBridgeless() && !context.hasActiveReactInstance())) {
<add> if (context == null || !context.hasActiveReactInstance()) {
<ide> return;
<ide> }
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/dialog/DialogModule.java
<ide> public AlertFragmentListener(Callback callback) {
<ide> @Override
<ide> public void onClick(DialogInterface dialog, int which) {
<ide> if (!mCallbackConsumed) {
<del> if (getReactApplicationContext().isBridgeless()
<del> || getReactApplicationContext().hasActiveReactInstance()) {
<add> if (getReactApplicationContext().hasActiveReactInstance()) {
<ide> mCallback.invoke(ACTION_BUTTON_CLICKED, which);
<ide> mCallbackConsumed = true;
<ide> }
<ide> public void onClick(DialogInterface dialog, int which) {
<ide> @Override
<ide> public void onDismiss(DialogInterface dialog) {
<ide> if (!mCallbackConsumed) {
<del> if (getReactApplicationContext().isBridgeless()
<del> || getReactApplicationContext().hasActiveReactInstance()) {
<add> if (getReactApplicationContext().hasActiveReactInstance()) {
<ide> mCallback.invoke(ACTION_DISMISSED);
<ide> mCallbackConsumed = true;
<ide> } | 3 |
Javascript | Javascript | remove string literal from strictequal | 4970cd678e524981b6b3ecf5d23bc11c5403f645 | <ide><path>test/parallel/test-stream-pipe-await-drain-push-while-write.js
<ide> const writable = new stream.Writable({
<ide> write: common.mustCall(function(chunk, encoding, cb) {
<ide> assert.strictEqual(
<ide> readable._readableState.awaitDrain,
<del> 0,
<del> 'State variable awaitDrain is not correct.'
<add> 0
<ide> );
<ide>
<ide> if (chunk.length === 32 * 1024) { // first chunk
<ide> readable.push(Buffer.alloc(34 * 1024)); // above hwm
<ide> // We should check if awaitDrain counter is increased in the next
<ide> // tick, because awaitDrain is incremented after this method finished
<ide> process.nextTick(() => {
<del> assert.strictEqual(readable._readableState.awaitDrain, 1,
<del> 'Counter is not increased for awaitDrain');
<add> assert.strictEqual(readable._readableState.awaitDrain, 1);
<ide> });
<ide> }
<ide> | 1 |
PHP | PHP | fix function namespacing | 16a62193fcbdac7394dcde49d567dbde592731b2 | <ide><path>laravel/bootstrap/core.php
<ide> <?php namespace Laravel;
<ide>
<ide> /**
<del> * Define all of the constants used by the framework. All of the
<del> * core paths will be defined, as well as all of the paths which
<del> * derive from those core paths.
<add> * Define all of the constants used by the framework. All of the core
<add> * paths will be defined, as well as all of the paths which derive
<add> * from these core paths.
<ide> */
<ide> define('EXT', '.php');
<ide> define('CRLF', chr(13).chr(10));
<ide> define('VIEW_PATH', APP_PATH.'views/');
<ide>
<ide> /**
<del> * Define the Laravel environment configuration path. This path is
<del> * used by the configuration class to load configuration options
<del> * specific for the server environment.
<add> * Define the Laravel environment configuration path. This path is used
<add> * by the configuration class to load configuration options specific
<add> * for the server environment.
<ide> */
<ide> $environment = '';
<ide>
<ide> require SYS_PATH.'autoloader'.EXT;
<ide>
<ide> /**
<del> * Load a few of the core configuration files that are loaded for
<del> * every request to the application. It is quicker to load them
<del> * manually rather than parse the keys for every request.
<add> * Load a few of the core configuration files that are loaded for every
<add> * request to the application. It is quicker to load them manually each
<add> * request rather than parse the keys for every request.
<ide> */
<ide> Config::load('application');
<ide> Config::load('container');
<ide> Config::load('session');
<ide>
<ide> /**
<del> * Bootstrap the application inversion of control container.
<del> * The IoC container is responsible for resolving classes and
<del> * their dependencies, and helps keep the framework flexible.
<add> * Bootstrap the application inversion of control container. The IoC
<add> * container is responsible for resolving classes, and helps keep the
<add> * framework flexible.
<ide> */
<ide> IoC::bootstrap();
<ide>
<ide> spl_autoload_register(array('Laravel\\Autoloader', 'load'));
<ide>
<ide> /**
<del> * Define a few global convenience functions to make our lives
<del> * as Laravel PHP developers a little more easy and enjoyable.
<add> * Define a few global convenience functions to make our lives as
<add> * Laravel PHP developers a little more easy and enjoyable.
<ide> */
<del>function e($value)
<del>{
<del> return HTML::entities($value);
<del>}
<del>
<del>function __($key, $replacements = array(), $language = null)
<del>{
<del> return Lang::line($key, $replacements, $language);
<del>}
<ide>\ No newline at end of file
<add>require 'functions'.EXT;
<ide>\ No newline at end of file
<ide><path>laravel/bootstrap/errors.php
<ide> <?php namespace Laravel;
<ide>
<ide> /**
<del> * Define a closure that will return a formatted error message
<del> * when given an exception. This function will be used by the
<del> * error handler to create a more readable message.
<add> * Define a closure that will return the formatted error message when
<add> * when given an exception. This function will be used by all of error
<add> * handlers to create a more readable message.
<ide> */
<ide> $message = function($e)
<ide> {
<ide> };
<ide>
<ide> /**
<del> * Define a closure that will return a more readable version of
<del> * the severity of an exception. This function will be used by
<del> * the error handler when parsing exceptions.
<add> * Define a closure that will return a more readable version of the
<add> * severity of an exception. This function will be used by the error
<add> * handler when parsing exceptions.
<ide> */
<ide> $severity = function($e)
<ide> {
<ide><path>laravel/bootstrap/functions.php
<add><?php
<add>
<add>/**
<add> * Convert HTML characters to entities.
<add> *
<add> * The encoding specified in the application configuration file will be used.
<add> *
<add> * @param string $value
<add> * @return string
<add> */
<add>function e($value)
<add>{
<add> return HTML::entities($value);
<add>}
<add>
<add>/**
<add> * Retrieve a language line.
<add> *
<add> * @param string $key
<add> * @param array $replacements
<add> * @param string $language
<add> * @return string
<add> */
<add>function __($key, $replacements = array(), $language = null)
<add>{
<add> return Lang::line($key, $replacements, $language);
<add>}
<ide>\ No newline at end of file | 3 |
Javascript | Javascript | normalize all line endings in an obj file | 89b3d0babe1ce013d2cec1b12f2f6e2ec890e96d | <ide><path>examples/js/loaders/OBJLoader.js
<ide> THREE.OBJLoader.prototype = {
<ide> if ( text.indexOf( '\r\n' ) !== - 1 ) {
<ide>
<ide> // This is faster than String.split with regex that splits on both
<del> text = text.replace( '\r\n', '\n' );
<add> text = text.replace( /\r\n/g, '\n' );
<ide>
<ide> }
<ide> | 1 |
Go | Go | close the file | cf3ef262b161f1c3dd61f5689e2853c2e8ec8b70 | <ide><path>daemon/volumes_unix.go
<ide> func (daemon *Daemon) verifyVolumesInfo(container *container.Container) error {
<ide> if err != nil {
<ide> return errors.Wrap(err, "could not open container config")
<ide> }
<add> defer f.Close()
<ide> var cv volumes
<ide> if err := json.NewDecoder(f).Decode(&cv); err != nil {
<ide> return errors.Wrap(err, "could not decode container config") | 1 |
Python | Python | remove extra blank line | aa99d280524aceb22663c20df68ae724af3cb487 | <ide><path>libcloud/common/base.py
<ide> def makefile(self, *args, **kwargs):
<ide> elif encoding in ['gzip', 'x-gzip']:
<ide> body = decompress_data('gzip', body)
<ide>
<del>
<ide> if r.chunked:
<ide> ht += "%x\r\n" % (len(body))
<ide> ht += u(body) | 1 |
Text | Text | add fs.open() multiple constants example | 38f444060b0527afe5dccc44ee2db55c73c62e57 | <ide><path>doc/api/fs.md
<ide> The following constants are exported by `fs.constants`.
<ide>
<ide> Not every constant will be available on every operating system.
<ide>
<add>To use more than one constant, use the bitwise OR `|` operator.
<add>
<add>Example:
<add>
<add>```js
<add>const fs = require('fs');
<add>
<add>const {
<add> O_RDWR,
<add> O_CREAT,
<add> O_EXCL
<add>} = fs.constants;
<add>
<add>fs.open('/path/to/my/file', O_RDWR | O_CREAT | O_EXCL, (err, fd) => {
<add> // ...
<add>});
<add>```
<add>
<ide> ### File Access Constants
<ide>
<ide> The following constants are meant for use with [`fs.access()`][]. | 1 |
Javascript | Javascript | fix normal_fragment_* examples | e03835d1f2ad4eedeada071fd57aa2ce6e9e487d | <ide><path>examples/js/nodes/materials/PhongNode.js
<ide> THREE.PhongNode.prototype.build = function ( builder ) {
<ide>
<ide> var output = [
<ide> // prevent undeclared normal
<del> "#include <normal_fragment>",
<add> "#include <normal_fragment_begin>",
<ide>
<ide> // prevent undeclared material
<ide> " BlinnPhongMaterial material;",
<ide><path>examples/js/nodes/materials/StandardNode.js
<ide> THREE.StandardNode.prototype.build = function ( builder ) {
<ide>
<ide> var output = [
<ide> // prevent undeclared normal
<del> " #include <normal_fragment>",
<add> " #include <normal_fragment_begin>",
<ide>
<ide> // prevent undeclared material
<ide> " PhysicalMaterial material;", | 2 |
PHP | PHP | call dump autoload when appropriate | 8501a9e89e6a864d6a2a20ff6778d3cdcd51d340 | <ide><path>src/Illuminate/Foundation/Console/RequestMakeCommand.php
<ide> public function fire()
<ide> );
<ide>
<ide> $this->info('Request created successfully.');
<add>
<add> $this->call('dump-autoload');
<ide> }
<ide>
<ide> /**
<ide><path>src/Illuminate/Routing/Console/FilterMakeCommand.php
<ide> public function fire()
<ide> );
<ide>
<ide> $this->info('Filter created successfully.');
<add>
<add> $this->call('dump-autoload');
<ide> }
<ide>
<ide> /** | 2 |
Javascript | Javascript | increase timeout for progressplugin test | 2bad4c7259768ec6f10f1af877d943f44f5eb791 | <ide><path>test/ProgressPlugin.test.js
<ide> const RunCompilerAsync = compiler =>
<ide> });
<ide>
<ide> describe("ProgressPlugin", function () {
<add> jest.setTimeout(10000);
<ide> let stderr;
<ide> let stdout;
<ide> | 1 |
Ruby | Ruby | remove compatibility module from docs [ci skip] | 1db8438d10cfe111963684e3158a2d2adda05849 | <ide><path>actionpack/lib/action_controller/template_assertions.rb
<ide> # frozen_string_literal: true
<ide>
<ide> module ActionController
<del> module TemplateAssertions
<add> module TemplateAssertions # :nodoc:
<ide> def assert_template(options = {}, message = nil)
<ide> raise NoMethodError,
<ide> "assert_template has been extracted to a gem. To continue using it, | 1 |
Text | Text | move changelog entry to the top | 09f941c507455e5523cd2d990117c1fcf4f0ab9c | <ide><path>activerecord/CHANGELOG.md
<add>* Raise `ActiveRecord::RecordNotDestroyed` when a replaced child marked with `dependent: destroy` fails to be destroyed.
<add>
<add> Fix #12812
<add>
<add> *Brian Thomas Storti*
<add>
<ide> * Fix validation on uniqueness of empty association.
<ide>
<ide> *Evgeny Li*
<ide>
<ide> *Slava Markevich*
<ide>
<del>* Raise `ActiveRecord::RecordNotDestroyed` when a replaced child marked with `dependent: destroy` fails to be destroyed.
<del>
<del> Fix #12812
<del>
<del> *Brian Thomas Storti*
<del>
<ide> Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/activerecord/CHANGELOG.md) for previous changes. | 1 |
Python | Python | fix mypy errors for presto provider | 9c05a951175c231478cbc19effb0e2a4cccd7a3b | <ide><path>airflow/providers/presto/hooks/presto.py
<ide> # specific language governing permissions and limitations
<ide> # under the License.
<ide> import os
<del>from typing import Any, Iterable, Optional
<add>from typing import Any, Callable, Iterable, Optional
<ide>
<ide> import prestodb
<ide> from prestodb.exceptions import DatabaseError
<ide> def run(
<ide> hql,
<ide> autocommit: bool = False,
<ide> parameters: Optional[dict] = None,
<add> handler: Optional[Callable] = None,
<ide> ) -> None:
<ide> """Execute the statement against Presto. Can be used to create views."""
<del> return super().run(sql=self._strip_sql(hql), parameters=parameters)
<add> return super().run(sql=self._strip_sql(hql), parameters=parameters, handler=handler)
<ide>
<ide> def insert_rows(
<ide> self, | 1 |
Ruby | Ruby | replace bind values on calls to to_sql | b8264ef0b43802dbd658d947e1c043254c900cf4 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
<ide> def initialize(connection, logger = nil, pool = nil) #:nodoc:
<ide> @prepared_statements = false
<ide> end
<ide>
<add> def bind_substitution_visitor
<add> @bind_sub_visitor ||= visitor.dup.extend(Arel::Visitors::BindVisitor)
<add> end
<add>
<ide> def valid_type?(type)
<ide> true
<ide> end
<ide><path>activerecord/lib/active_record/relation.rb
<ide> def to_sql
<ide> @to_sql ||= begin
<ide> relation = self
<ide> connection = klass.connection
<del> visitor = connection.visitor
<add> visitor = connection.bind_substitution_visitor
<ide>
<ide> if eager_loading?
<ide> find_with_associations { |rel| relation = rel }
<ide> end
<ide>
<del> ast = relation.arel.ast
<del> binds = relation.bind_values.dup
<del> visitor.accept(ast) do
<add> arel = relation.arel
<add> binds = arel.bind_values + relation.bind_values
<add> visitor.accept(arel.ast) do
<ide> connection.quote(*binds.shift.reverse)
<ide> end
<ide> end | 2 |
Javascript | Javascript | add tests verifying we don't swallow exceptions | c08469a7d6647fd1e4f0480713bdf2d9e49a719f | <ide><path>src/renderers/shared/stack/reconciler/__tests__/ReactErrorBoundaries-test.js
<ide> describe('ReactErrorBoundaries', () => {
<ide>
<ide> BrokenComponentDidUpdate = class extends React.Component {
<ide> static defaultProps = {
<del> errorText: 'Hello'
<add> errorText: 'Hello',
<ide> };
<ide> constructor(props) {
<ide> super(props);
<ide> describe('ReactErrorBoundaries', () => {
<ide>
<ide> BrokenComponentWillUnmount = class extends React.Component {
<ide> static defaultProps = {
<del> errorText: 'Hello'
<add> errorText: 'Hello',
<ide> };
<ide> constructor(props) {
<ide> super(props);
<ide> describe('ReactErrorBoundaries', () => {
<ide> };
<ide> });
<ide>
<add> it('does not swallow exceptions on mounting without boundaries', () => {
<add> var container = document.createElement('div');
<add> expect(() => {
<add> ReactDOM.render(<BrokenRender />, container);
<add> }).toThrow('Hello');
<add>
<add> container = document.createElement('div');
<add> expect(() => {
<add> ReactDOM.render(<BrokenComponentWillMount />, container);
<add> }).toThrow('Hello');
<add>
<add> container = document.createElement('div');
<add> expect(() => {
<add> ReactDOM.render(<BrokenComponentDidMount />, container);
<add> }).toThrow('Hello');
<add> });
<add>
<add> it('does not swallow exceptions on updating without boundaries', () => {
<add> var container = document.createElement('div');
<add> ReactDOM.render(<BrokenComponentWillUpdate />, container);
<add> expect(() => {
<add> ReactDOM.render(<BrokenComponentWillUpdate />, container);
<add> }).toThrow('Hello');
<add>
<add> container = document.createElement('div');
<add> ReactDOM.render(<BrokenComponentWillReceiveProps />, container);
<add> expect(() => {
<add> ReactDOM.render(<BrokenComponentWillReceiveProps />, container);
<add> }).toThrow('Hello');
<add>
<add> container = document.createElement('div');
<add> ReactDOM.render(<BrokenComponentDidUpdate />, container);
<add> expect(() => {
<add> ReactDOM.render(<BrokenComponentDidUpdate />, container);
<add> }).toThrow('Hello');
<add> });
<add>
<add> it('does not swallow exceptions on unmounting without boundaries', () => {
<add> var container = document.createElement('div');
<add> ReactDOM.render(<BrokenComponentWillUnmount />, container);
<add> expect(() => {
<add> ReactDOM.unmountComponentAtNode(container);
<add> }).toThrow('Hello');
<add> });
<add>
<add> it('prevents errors from leaking into other roots', () => {
<add> var container1 = document.createElement('div');
<add> var container2 = document.createElement('div');
<add> var container3 = document.createElement('div');
<add>
<add> ReactDOM.render(<span>Before 1</span>, container1);
<add> expect(() => {
<add> ReactDOM.render(<BrokenRender />, container2);
<add> }).toThrow('Hello');
<add> ReactDOM.render(
<add> <ErrorBoundary>
<add> <BrokenRender />
<add> </ErrorBoundary>,
<add> container3
<add> );
<add> expect(container1.firstChild.textContent).toBe('Before 1');
<add> expect(container2.firstChild).toBe(null);
<add> expect(container3.firstChild.textContent).toBe('Caught an error: Hello.');
<add>
<add> ReactDOM.render(<span>After 1</span>, container1);
<add> ReactDOM.render(<span>After 2</span>, container2);
<add> ReactDOM.render(
<add> <ErrorBoundary forceRetry={true}>
<add> After 3
<add> </ErrorBoundary>,
<add> container3
<add> );
<add> expect(container1.firstChild.textContent).toBe('After 1');
<add> expect(container2.firstChild.textContent).toBe('After 2');
<add> expect(container3.firstChild.textContent).toBe('After 3');
<add>
<add> ReactDOM.unmountComponentAtNode(container1);
<add> ReactDOM.unmountComponentAtNode(container2);
<add> ReactDOM.unmountComponentAtNode(container3);
<add> expect(container1.firstChild).toBe(null);
<add> expect(container2.firstChild).toBe(null);
<add> expect(container3.firstChild).toBe(null);
<add> });
<add>
<ide> it('renders an error state if child throws in render', () => {
<ide> var container = document.createElement('div');
<ide> ReactDOM.render( | 1 |
Python | Python | fix a `genericalias` test failure for python 3.9.0 | 263a97c620f9d469f1b35d42af048794b036e03b | <ide><path>numpy/typing/tests/test_generic_alias.py
<ide> class TestGenericAlias:
<ide> ("__call__", lambda n: n(shape=(1,), dtype=np.int64, buffer=BUFFER)),
<ide> ("subclassing", lambda n: _get_subclass_mro(n)),
<ide> ("pickle", lambda n: n == pickle.loads(pickle.dumps(n))),
<del> ("__weakref__", lambda n: n == weakref.ref(n)()),
<ide> ])
<ide> def test_pass(self, name: str, func: FuncType) -> None:
<ide> """Compare `types.GenericAlias` with its numpy-based backport.
<ide> def test_pass(self, name: str, func: FuncType) -> None:
<ide> value_ref = func(NDArray_ref)
<ide> assert value == value_ref
<ide>
<add> def test_weakref(self) -> None:
<add> """Test ``__weakref__``."""
<add> value = weakref.ref(NDArray)()
<add>
<add> if sys.version_info >= (3, 9, 1): # xref bpo-42332
<add> value_ref = weakref.ref(NDArray_ref)()
<add> assert value == value_ref
<add>
<ide> @pytest.mark.parametrize("name", GETATTR_NAMES)
<ide> def test_getattr(self, name: str) -> None:
<ide> """Test that `getattr` wraps around the underlying type, | 1 |
Python | Python | refactor the test to not call internal methods | eaaf69900b59c98ba4e91123869a35f20af0d349 | <ide><path>libcloud/test/compute/test_openstack.py
<ide> def test_auth_host_passed(self):
<ide> ex_tenant_name='admin')
<ide> self.assertEqual(d._ex_force_auth_url, forced_auth)
<ide> with requests_mock.Mocker() as mock:
<add> body1 = ComputeFileFixtures('openstack').load('v1_slug_servers_ips.xml')
<ide> body2 = ComputeFileFixtures('openstack').load('_v2_0__auth.json')
<add>
<add> mock.register_uri('GET', 'https://test_endpoint.com/v2/1337/servers/test/ips', text=body1,
<add> headers={'content-type': 'application/xml; charset=UTF-8'})
<ide> mock.register_uri('POST', 'http://x.y.z.y:5000/v2.0/tokens', text=body2,
<ide> headers={'content-type': 'application/json; charset=UTF-8'})
<del> d.connection._populate_hosts_and_request_paths()
<add> d.ex_list_ip_addresses('test')
<ide> self.assertEqual(d.connection.host, 'test_endpoint.com')
<ide>
<ide> | 1 |
Javascript | Javascript | add test from v0.4 dea49e3 | 49806864e489dd73bdda56ec66a1c8a9450fa4a7 | <ide><path>test/pummel/test-net-write-callbacks.js
<add>// Copyright Joyent, Inc. and other Node contributors.
<add>//
<add>// Permission is hereby granted, free of charge, to any person obtaining a
<add>// copy of this software and associated documentation files (the
<add>// "Software"), to deal in the Software without restriction, including
<add>// without limitation the rights to use, copy, modify, merge, publish,
<add>// distribute, sublicense, and/or sell copies of the Software, and to permit
<add>// persons to whom the Software is furnished to do so, subject to the
<add>// following conditions:
<add>//
<add>// The above copyright notice and this permission notice shall be included
<add>// in all copies or substantial portions of the Software.
<add>//
<add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
<add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
<add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
<add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
<add>// USE OR OTHER DEALINGS IN THE SOFTWARE.
<add>
<add>var common = require('../common');
<add>var net = require('net');
<add>var assert = require('assert');
<add>
<add>var cbcount = 0;
<add>var N = 500000;
<add>
<add>var server = net.Server(function(socket) {
<add> socket.on('data', function(d) {
<add> console.error("got %d bytes", d.length);
<add> });
<add>
<add> socket.on('end', function() {
<add> console.error("end");
<add> socket.destroy();
<add> server.close();
<add> });
<add>});
<add>
<add>server.listen(common.PORT, function() {
<add> var client = net.createConnection(common.PORT);
<add>
<add> client.on('connect', function() {
<add> for (var i = 0; i < N; i++) {
<add> client.write("hello world", function() {
<add> cbcount++;
<add> });
<add> }
<add> client.end();
<add> });
<add>});
<add>
<add>process.on('exit', function() {
<add> assert.equal(N, cbcount);
<add>}); | 1 |
Ruby | Ruby | allow subsecond resolution in `travel_to` helper | 0ab5a3a4abeface5d96432995a5394d305b54303 | <ide><path>activesupport/lib/active_support/testing/time_helpers.rb
<ide> def travel(duration, &block)
<ide> #
<ide> # Note that the usec for the time passed will be set to 0 to prevent rounding
<ide> # errors with external services, like MySQL (which will round instead of floor,
<del> # leading to off-by-one-second errors).
<add> # leading to off-by-one-second errors), unless the <tt>with_usec</tt> argument
<add> # is set to <tt>true</tt>.
<ide> #
<ide> # This method also accepts a block, which will return the current time back to its original
<ide> # state at the end of the block:
<ide> def travel(duration, &block)
<ide> # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
<ide> # end
<ide> # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
<del> def travel_to(date_or_time)
<add> def travel_to(date_or_time, with_usec: false)
<ide> if block_given? && in_block
<ide> travel_to_nested_block_call = <<~MSG
<ide>
<ide> def travel_to(date_or_time)
<ide> now = date_or_time.midnight.to_time
<ide> elsif date_or_time.is_a?(String)
<ide> now = Time.zone.parse(date_or_time)
<add> elsif with_usec
<add> now = date_or_time.to_time
<ide> else
<ide> now = date_or_time.to_time.change(usec: 0)
<ide> end
<ide>
<ide> stubbed_time = Time.now if simple_stubs.stubbing(Time, :now)
<del> simple_stubs.stub_object(Time, :now) { at(now.to_i) }
<add> simple_stubs.stub_object(Time, :now) { at(now.to_f) }
<ide> simple_stubs.stub_object(Date, :today) { jd(now.to_date.jd) }
<ide> simple_stubs.stub_object(DateTime, :now) { jd(now.to_date.jd, now.hour, now.min, now.sec, Rational(now.utc_offset, 86400)) }
<ide>
<ide><path>activesupport/test/time_travel_test.rb
<ide> def test_time_helper_travel_to_with_subsequent_calls
<ide> end
<ide> end
<ide>
<add> def test_time_helper_travel_to_with_usec
<add> Time.stub(:now, Time.now) do
<add> duration_usec = 0.1.seconds
<add> traveled_time = Time.new(2004, 11, 24, 1, 4, 44) + duration_usec
<add> expected_time = Time.new(2004, 11, 24, 1, 4, 44)
<add>
<add> assert_nothing_raised do
<add> travel_to traveled_time
<add>
<add> assert_equal expected_time, Time.now
<add>
<add> travel_back
<add> end
<add> ensure
<add> travel_back
<add> end
<add> end
<add>
<add> def test_time_helper_travel_to_with_usec_true
<add> Time.stub(:now, Time.now) do
<add> duration_usec = 0.1.seconds
<add> expected_time = Time.new(2004, 11, 24, 1, 4, 44) + duration_usec
<add>
<add> assert_nothing_raised do
<add> travel_to expected_time, with_usec: true
<add>
<add> assert_equal expected_time.to_f, Time.now.to_f
<add>
<add> travel_back
<add> end
<add> ensure
<add> travel_back
<add> end
<add> end
<add>
<ide> def test_time_helper_travel_with_subsequent_block
<ide> Time.stub(:now, Time.now) do
<ide> outer_expected_time = Time.new(2004, 11, 24, 1, 4, 44) | 2 |
Javascript | Javascript | fix minimumviewtime in viewabilityhelper | d19d137cc18f10957b5ac64ac727d15fde57f018 | <ide><path>Libraries/Lists/ViewabilityHelper.js
<ide> export type ViewabilityConfig = {|
<ide> class ViewabilityHelper {
<ide> _config: ViewabilityConfig;
<ide> _hasInteracted: boolean = false;
<del> _lastUpdateTime: number = 0;
<ide> _timers: Set<number> = new Set();
<ide> _viewableIndices: Array<number> = [];
<ide> _viewableItems: Map<string, ViewToken> = new Map();
<ide> class ViewabilityHelper {
<ide> }) => void,
<ide> renderRange?: {first: number, last: number}, // Optional optimization to reduce the scan size
<ide> ): void {
<del> const updateTime = Date.now();
<del> if (this._lastUpdateTime === 0 && itemCount > 0 && getFrameMetrics(0)) {
<del> // Only count updates after the first item is rendered and has a frame.
<del> this._lastUpdateTime = updateTime;
<del> }
<del> const updateElapsed = this._lastUpdateTime
<del> ? updateTime - this._lastUpdateTime
<del> : 0;
<del> if (this._config.waitForInteraction && !this._hasInteracted) {
<add> if (
<add> (this._config.waitForInteraction && !this._hasInteracted) ||
<add> itemCount === 0 ||
<add> !getFrameMetrics(0)
<add> ) {
<ide> return;
<ide> }
<ide> let viewableIndices = [];
<ide> class ViewabilityHelper {
<ide> return;
<ide> }
<ide> this._viewableIndices = viewableIndices;
<del> this._lastUpdateTime = updateTime;
<del> if (
<del> this._config.minimumViewTime &&
<del> updateElapsed < this._config.minimumViewTime
<del> ) {
<add> if (this._config.minimumViewTime) {
<ide> const handle = setTimeout(() => {
<ide> this._timers.delete(handle);
<ide> this._onUpdateSync( | 1 |
Python | Python | remove reference to legacy graph model in tests | c0b32a9a04c761e03e082d4ff955702c6aa17003 | <ide><path>tests/keras/test_callbacks.py
<ide> def make_model():
<ide> assert np.allclose(float(K.get_value(model.optimizer.lr)), 0.1, atol=K.epsilon())
<ide>
<ide>
<del>@pytest.mark.skipif((K._BACKEND != 'tensorflow'),
<add>@pytest.mark.skipif((K.backend() != 'tensorflow'),
<ide> reason="Requires tensorflow backend")
<ide> def test_TensorBoard():
<ide> import shutil
<ide> import tensorflow as tf
<ide> import keras.backend.tensorflow_backend as KTF
<del> old_session = KTF.get_session()
<ide> filepath = './logs'
<ide> (X_train, y_train), (X_test, y_test) = get_test_data(nb_train=train_samples,
<ide> nb_test=test_samples,
<ide> def data_generator_graph(train):
<ide> yield {'X_vars': X_test, 'output': y_test}
<ide>
<ide> # case 1 Sequential
<add> model = Sequential()
<add> model.add(Dense(nb_hidden, input_dim=input_dim, activation='relu'))
<add> model.add(Dense(nb_class, activation='softmax'))
<add> model.compile(loss='categorical_crossentropy',
<add> optimizer='sgd',
<add> metrics=['accuracy'])
<ide>
<del> with tf.Graph().as_default():
<del> session = tf.Session('')
<del> KTF.set_session(session)
<del> model = Sequential()
<del> model.add(Dense(nb_hidden, input_dim=input_dim, activation='relu'))
<del> model.add(Dense(nb_class, activation='softmax'))
<del> model.compile(loss='categorical_crossentropy',
<del> optimizer='sgd',
<del> metrics=['accuracy'])
<del>
<del> tsb = callbacks.TensorBoard(log_dir=filepath, histogram_freq=1)
<del> cbks = [tsb]
<del>
<del> # fit with validation data
<del> model.fit(X_train, y_train, batch_size=batch_size,
<del> validation_data=(X_test, y_test), callbacks=cbks, nb_epoch=2)
<del>
<del> # fit with validation data and accuracy
<del> model.fit(X_train, y_train, batch_size=batch_size,
<del> validation_data=(X_test, y_test), callbacks=cbks, nb_epoch=2)
<del>
<del> # fit generator with validation data
<del> model.fit_generator(data_generator(True), len(X_train), nb_epoch=2,
<del> validation_data=(X_test, y_test),
<del> callbacks=cbks)
<del>
<del> # fit generator without validation data
<del> model.fit_generator(data_generator(True), len(X_train), nb_epoch=2,
<del> callbacks=cbks)
<del>
<del> # fit generator with validation data and accuracy
<del> model.fit_generator(data_generator(True), len(X_train), nb_epoch=2,
<del> validation_data=(X_test, y_test),
<del> callbacks=cbks)
<del>
<del> # fit generator without validation data and accuracy
<del> model.fit_generator(data_generator(True), len(X_train), nb_epoch=2,
<del> callbacks=cbks)
<del>
<del> assert os.path.exists(filepath)
<del> shutil.rmtree(filepath)
<del>
<del> # case 2 Graph
<del>
<del> with tf.Graph().as_default():
<del> session = tf.Session('')
<del> KTF.set_session(session)
<del> model = Graph()
<del> model.add_input(name='X_vars', input_shape=(input_dim,))
<del>
<del> model.add_node(Dense(nb_hidden, activation="sigmoid"),
<del> name='Dense1', input='X_vars')
<del> model.add_node(Dense(nb_class, activation="softmax"),
<del> name='last_dense',
<del> input='Dense1')
<del> model.add_output(name='output', input='last_dense')
<del> model.compile(optimizer='sgd', loss={'output': 'mse'})
<add> tsb = callbacks.TensorBoard(log_dir=filepath, histogram_freq=1)
<add> cbks = [tsb]
<ide>
<del> tsb = callbacks.TensorBoard(log_dir=filepath, histogram_freq=1)
<del> cbks = [tsb]
<add> # fit with validation data
<add> model.fit(X_train, y_train, batch_size=batch_size,
<add> validation_data=(X_test, y_test), callbacks=cbks, nb_epoch=2)
<ide>
<del> # fit with validation
<del> model.fit({'X_vars': X_train, 'output': y_train},
<del> batch_size=batch_size,
<del> validation_data={'X_vars': X_test, 'output': y_test},
<del> callbacks=cbks, nb_epoch=2)
<add> # fit with validation data and accuracy
<add> model.fit(X_train, y_train, batch_size=batch_size,
<add> validation_data=(X_test, y_test), callbacks=cbks, nb_epoch=2)
<ide>
<del> # fit wo validation
<del> model.fit({'X_vars': X_train, 'output': y_train},
<del> batch_size=batch_size,
<del> callbacks=cbks, nb_epoch=2)
<add> # fit generator with validation data
<add> model.fit_generator(data_generator(True), len(X_train), nb_epoch=2,
<add> validation_data=(X_test, y_test),
<add> callbacks=cbks)
<ide>
<del> # fit generator with validation
<del> model.fit_generator(data_generator_graph(True), 1000, nb_epoch=2,
<del> validation_data={'X_vars': X_test, 'output': y_test},
<del> callbacks=cbks)
<add> # fit generator without validation data
<add> model.fit_generator(data_generator(True), len(X_train), nb_epoch=2,
<add> callbacks=cbks)
<ide>
<del> # fit generator wo validation
<del> model.fit_generator(data_generator_graph(True), 1000, nb_epoch=2,
<del> callbacks=cbks)
<add> # fit generator with validation data and accuracy
<add> model.fit_generator(data_generator(True), len(X_train), nb_epoch=2,
<add> validation_data=(X_test, y_test),
<add> callbacks=cbks)
<ide>
<del> assert os.path.exists(filepath)
<del> shutil.rmtree(filepath)
<add> # fit generator without validation data and accuracy
<add> model.fit_generator(data_generator(True), len(X_train), nb_epoch=2,
<add> callbacks=cbks)
<ide>
<del> KTF.set_session(old_session)
<add> assert os.path.exists(filepath)
<add> shutil.rmtree(filepath)
<ide>
<ide>
<ide> def test_LambdaCallback():
<ide> def f():
<ide> assert not p.is_alive()
<ide>
<ide>
<del>@pytest.mark.skipif((K._BACKEND != 'tensorflow'),
<add>@pytest.mark.skipif((K.backend() != 'tensorflow'),
<ide> reason="Requires tensorflow backend")
<ide> def test_TensorBoard_with_ReduceLROnPlateau():
<ide> import shutil | 1 |
Mixed | Java | move mpsc queue to rx.internal.util | 5b5d99f27f593155844bc0a9e2eca3a004f2a941 | <add><path>rxjava-core/src/main/java/rx/internal/util/MpscPaddedQueue.java
<del><path>rxjava-core/src/main/java/rx/observers/MpscPaddedQueue.java
<del>/**
<del> * Copyright 2014 Netflix, Inc.
<del> *
<del> * Licensed under the Apache License, Version 2.0 (the "License"); you may not
<del> * use this file except in compliance with the License. You may obtain a copy of
<del> * the License at
<del> *
<del> * http://www.apache.org/licenses/LICENSE-2.0
<del> *
<del> * Unless required by applicable law or agreed to in writing, software
<del> * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
<del> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
<del> * License for the specific language governing permissions and limitations under
<del> * the License.
<del> */
<del>package rx.observers;
<del>
<del>import java.util.concurrent.atomic.AtomicReference;
<del>import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
<del>
<del>/**
<del> * A multiple-producer single consumer queue implementation with padded reference
<del> * to tail to avoid cache-line thrashing.
<del> * Based on Netty's <a href='https://github.com/netty/netty/blob/master/common/src/main/java/io/netty/util/internal/MpscLinkedQueue.java'>MpscQueue implementation</a> but using AtomicReferenceFieldUpdater
<del> * instead of Unsafe.
<del> * @param <E> the element type
<del> */
<del>public final class MpscPaddedQueue<E> extends AtomicReference<MpscPaddedQueue.Node<E>> {
<del> @SuppressWarnings(value = "rawtypes")
<del> static final AtomicReferenceFieldUpdater<PaddedNode, Node> TAIL_UPDATER = AtomicReferenceFieldUpdater.newUpdater(PaddedNode.class, Node.class, "tail");
<del> /** */
<del> private static final long serialVersionUID = 1L;
<del> /** The padded tail reference. */
<del> final PaddedNode<E> tail;
<del> /**
<del> * Initializes the empty queue.
<del> */
<del> public MpscPaddedQueue() {
<del> Node<E> first = new Node<E>(null);
<del> tail = new PaddedNode<E>();
<del> tail.tail = first;
<del> set(first);
<del> }
<del> /**
<del> * Offer a new value.
<del> * @param v the value to offer
<del> */
<del> public void offer(E v) {
<del> Node<E> n = new Node<E>(v);
<del> getAndSet(n).set(n);
<del> }
<del>
<del> /**
<del> * @return Poll a value from the head of the queue or return null if the queue is empty.
<del> */
<del> public E poll() {
<del> Node<E> n = peekNode();
<del> if (n == null) {
<del> return null;
<del> }
<del> E v = n.value;
<del> n.value = null; // do not retain this value as the node still stays in the queue
<del> TAIL_UPDATER.lazySet(tail, n);
<del> return v;
<del> }
<del> /**
<del> * Check if there is a node available without changing anything.
<del> */
<del> private Node<E> peekNode() {
<del> for (;;) {
<del> @SuppressWarnings(value = "unchecked")
<del> Node<E> t = TAIL_UPDATER.get(tail);
<del> Node<E> n = t.get();
<del> if (n != null || get() == t) {
<del> return n;
<del> }
<del> }
<del> }
<del> /**
<del> * Clears the queue.
<del> */
<del> public void clear() {
<del> for (;;) {
<del> if (poll() == null) {
<del> break;
<del> }
<del> }
<del> }
<del> /** Class that contains a Node reference padded around to fit a typical cache line. */
<del> static final class PaddedNode<E> {
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p1;
<del> volatile Node<E> tail;
<del> /** Padding, public to prevent optimizing it away. */
<del> public long p2;
<del> /** Padding, public to prevent optimizing it away. */
<del> public long p3;
<del> /** Padding, public to prevent optimizing it away. */
<del> public long p4;
<del> /** Padding, public to prevent optimizing it away. */
<del> public long p5;
<del> /** Padding, public to prevent optimizing it away. */
<del> public long p6;
<del> }
<del> /**
<del> * Regular node with value and reference to the next node.
<del> */
<del> static final class Node<E> {
<del>
<del> E value;
<del> @SuppressWarnings(value = "rawtypes")
<del> static final AtomicReferenceFieldUpdater<Node, Node> TAIL_UPDATER = AtomicReferenceFieldUpdater.newUpdater(Node.class, Node.class, "tail");
<del> volatile Node<E> tail;
<del>
<del> public Node(E value) {
<del> this.value = value;
<del> }
<del>
<del> public void set(Node<E> newTail) {
<del> TAIL_UPDATER.lazySet(this, newTail);
<del> }
<del>
<del> @SuppressWarnings(value = "unchecked")
<del> public Node<E> get() {
<del> return TAIL_UPDATER.get(this);
<del> }
<del> }
<del>
<del>}
<add>/**
<add> * Copyright 2014 Netflix, Inc.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not
<add> * use this file except in compliance with the License. You may obtain a copy of
<add> * the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
<add> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
<add> * License for the specific language governing permissions and limitations under
<add> * the License.
<add> */
<add>package rx.internal.util;
<add>
<add>import java.util.concurrent.atomic.AtomicReference;
<add>import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
<add>
<add>/**
<add> * A multiple-producer single consumer queue implementation with padded reference
<add> * to tail to avoid cache-line thrashing.
<add> * Based on Netty's <a href='https://github.com/netty/netty/blob/master/common/src/main/java/io/netty/util/internal/MpscLinkedQueue.java'>MpscQueue implementation</a> but using AtomicReferenceFieldUpdater
<add> * instead of Unsafe.
<add> * @param <E> the element type
<add> */
<add>public final class MpscPaddedQueue<E> extends AtomicReference<MpscPaddedQueue.Node<E>> {
<add> @SuppressWarnings(value = "rawtypes")
<add> static final AtomicReferenceFieldUpdater<PaddedNode, Node> TAIL_UPDATER = AtomicReferenceFieldUpdater.newUpdater(PaddedNode.class, Node.class, "tail");
<add> /** */
<add> private static final long serialVersionUID = 1L;
<add> /** The padded tail reference. */
<add> final PaddedNode<E> tail;
<add> /**
<add> * Initializes the empty queue.
<add> */
<add> public MpscPaddedQueue() {
<add> Node<E> first = new Node<E>(null);
<add> tail = new PaddedNode<E>();
<add> tail.tail = first;
<add> set(first);
<add> }
<add> /**
<add> * Offer a new value.
<add> * @param v the value to offer
<add> */
<add> public void offer(E v) {
<add> Node<E> n = new Node<E>(v);
<add> getAndSet(n).set(n);
<add> }
<add>
<add> /**
<add> * @return Poll a value from the head of the queue or return null if the queue is empty.
<add> */
<add> public E poll() {
<add> Node<E> n = peekNode();
<add> if (n == null) {
<add> return null;
<add> }
<add> E v = n.value;
<add> n.value = null; // do not retain this value as the node still stays in the queue
<add> TAIL_UPDATER.lazySet(tail, n);
<add> return v;
<add> }
<add> /**
<add> * Check if there is a node available without changing anything.
<add> */
<add> private Node<E> peekNode() {
<add> for (;;) {
<add> @SuppressWarnings(value = "unchecked")
<add> Node<E> t = TAIL_UPDATER.get(tail);
<add> Node<E> n = t.get();
<add> if (n != null || get() == t) {
<add> return n;
<add> }
<add> }
<add> }
<add> /**
<add> * Clears the queue.
<add> */
<add> public void clear() {
<add> for (;;) {
<add> if (poll() == null) {
<add> break;
<add> }
<add> }
<add> }
<add> /** Class that contains a Node reference padded around to fit a typical cache line. */
<add> static final class PaddedNode<E> {
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p1;
<add> volatile Node<E> tail;
<add> /** Padding, public to prevent optimizing it away. */
<add> public long p2;
<add> /** Padding, public to prevent optimizing it away. */
<add> public long p3;
<add> /** Padding, public to prevent optimizing it away. */
<add> public long p4;
<add> /** Padding, public to prevent optimizing it away. */
<add> public long p5;
<add> /** Padding, public to prevent optimizing it away. */
<add> public long p6;
<add> }
<add> /**
<add> * Regular node with value and reference to the next node.
<add> */
<add> static final class Node<E> {
<add>
<add> E value;
<add> @SuppressWarnings(value = "rawtypes")
<add> static final AtomicReferenceFieldUpdater<Node, Node> TAIL_UPDATER = AtomicReferenceFieldUpdater.newUpdater(Node.class, Node.class, "tail");
<add> volatile Node<E> tail;
<add>
<add> public Node(E value) {
<add> this.value = value;
<add> }
<add>
<add> public void set(Node<E> newTail) {
<add> TAIL_UPDATER.lazySet(this, newTail);
<add> }
<add>
<add> @SuppressWarnings(value = "unchecked")
<add> public Node<E> get() {
<add> return TAIL_UPDATER.get(this);
<add> }
<add> }
<add>
<add>}
<add><path>rxjava-core/src/main/java/rx/internal/util/PaddedAtomicInteger.java
<del><path>rxjava-core/src/main/java/rx/observers/PaddedAtomicInteger.java
<del>/**
<del> * Copyright 2014 Netflix, Inc.
<del> *
<del> * Licensed under the Apache License, Version 2.0 (the "License"); you may not
<del> * use this file except in compliance with the License. You may obtain a copy of
<del> * the License at
<del> *
<del> * http://www.apache.org/licenses/LICENSE-2.0
<del> *
<del> * Unless required by applicable law or agreed to in writing, software
<del> * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
<del> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
<del> * License for the specific language governing permissions and limitations under
<del> * the License.
<del> */
<del>package rx.observers;
<del>
<del>import java.util.concurrent.atomic.AtomicInteger;
<del>
<del>/**
<del> * An AtomicInteger with extra fields to pad it out to fit a typical cache line.
<del> */
<del>public final class PaddedAtomicInteger extends AtomicInteger {
<del> private static final long serialVersionUID = 1L;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p1;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p2;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p3;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p4;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p5;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p6;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p7;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p8;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p9;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p10;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p11;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p12;
<del> /** Padding, public to prevent optimizing it away. */
<del> public int p13;
<del> /** @return prevents optimizing away the fields, most likely. */
<del> public int noopt() {
<del> return p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + p11 + p12 + p13;
<del> }
<del>
<del>}
<add>/**
<add> * Copyright 2014 Netflix, Inc.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not
<add> * use this file except in compliance with the License. You may obtain a copy of
<add> * the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
<add> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
<add> * License for the specific language governing permissions and limitations under
<add> * the License.
<add> */
<add>package rx.internal.util;
<add>
<add>import java.util.concurrent.atomic.AtomicInteger;
<add>
<add>/**
<add> * An AtomicInteger with extra fields to pad it out to fit a typical cache line.
<add> */
<add>public final class PaddedAtomicInteger extends AtomicInteger {
<add> private static final long serialVersionUID = 1L;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p1;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p2;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p3;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p4;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p5;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p6;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p7;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p8;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p9;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p10;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p11;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p12;
<add> /** Padding, public to prevent optimizing it away. */
<add> public int p13;
<add> /** @return prevents optimizing away the fields, most likely. */
<add> public int noopt() {
<add> return p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + p11 + p12 + p13;
<add> }
<add>
<add>}
<ide><path>rxjava-core/src/main/java/rx/internal/util/README.md
<add>This `rx.internal.*` package is for internal use only. Any code here can change at any time and is not considered part of the public API, even if the classes are `public` so as to be used from other packages within `rx.*`.
<add>
<add>If you depend on these classes, your code may break in any future RxJava release, even if it's just a patch release (major.minor.patch).
<ide><path>rxjava-core/src/main/java/rx/observers/SerializedObserver.java
<ide> void drainQueue(FastList list) {
<ide> }
<ide> }
<ide> }
<del>}
<ide>\ No newline at end of file
<add>}
<ide><path>rxjava-core/src/main/java/rx/operators/NotificationLite.java
<ide> public T getValue(Object n) {
<ide> public Throwable getError(Object n) {
<ide> return ((OnErrorSentinel) n).e;
<ide> }
<del>}
<ide>\ No newline at end of file
<add>} | 5 |
Javascript | Javascript | remove worker from local-cli | cbb8d6f6281fc5100ba45fd164103048e927bc59 | <ide><path>local-cli/util/Config.js
<ide> export type ConfigT = {
<ide> /**
<ide> * Returns the path to the worker that is used for transformation.
<ide> */
<del> getWorkerPath: () => string,
<add> getWorkerPath: () => ?string,
<ide>
<ide> /**
<ide> * An optional function that can modify the code and source map of bundle
<ide> const Config = {
<ide> postProcessModules: modules => modules,
<ide> postProcessModulesForBuck: modules => modules,
<ide> transformVariants: () => ({default: {}}),
<del> getWorkerPath: () => require.resolve('./worker.js'),
<add> getWorkerPath: () => null,
<ide> }: ConfigT),
<ide>
<ide> find(startDir: string): ConfigT {
<ide><path>local-cli/util/worker.js
<del>/**
<del> * Copyright (c) 2016-present, Facebook, Inc.
<del> * All rights reserved.
<del> *
<del> * This source code is licensed under the BSD-style license found in the
<del> * LICENSE file in the root directory of this source tree. An additional grant
<del> * of patent rights can be found in the PATENTS file in the same directory.
<del> */
<del>
<del>'use strict';
<del>
<del>require('../../setupBabel')();
<del>module.exports = require('metro-bundler/build/JSTransformer/worker'); | 2 |
Go | Go | use transactions for transactions | e9f37a011872fa89669dc105df27e1c6e16124b6 | <ide><path>pkg/graphdb/graphdb.go
<ide> func NewDatabase(conn *sql.DB) (*Database, error) {
<ide> }
<ide> db := &Database{conn: conn}
<ide>
<del> if _, err := conn.Exec(createEntityTable); err != nil {
<add> // Create root entities
<add> tx, err := conn.Begin()
<add> if err != nil {
<ide> return nil, err
<ide> }
<del> if _, err := conn.Exec(createEdgeTable); err != nil {
<add>
<add> if _, err := tx.Exec(createEntityTable); err != nil {
<ide> return nil, err
<ide> }
<del> if _, err := conn.Exec(createEdgeIndices); err != nil {
<add> if _, err := tx.Exec(createEdgeTable); err != nil {
<ide> return nil, err
<ide> }
<del>
<del> rollback := func() {
<del> conn.Exec("ROLLBACK")
<del> }
<del>
<del> // Create root entities
<del> if _, err := conn.Exec("BEGIN"); err != nil {
<add> if _, err := tx.Exec(createEdgeIndices); err != nil {
<ide> return nil, err
<ide> }
<ide>
<del> if _, err := conn.Exec("DELETE FROM entity where id = ?", "0"); err != nil {
<del> rollback()
<add> if _, err := tx.Exec("DELETE FROM entity where id = ?", "0"); err != nil {
<add> tx.Rollback()
<ide> return nil, err
<ide> }
<ide>
<del> if _, err := conn.Exec("INSERT INTO entity (id) VALUES (?);", "0"); err != nil {
<del> rollback()
<add> if _, err := tx.Exec("INSERT INTO entity (id) VALUES (?);", "0"); err != nil {
<add> tx.Rollback()
<ide> return nil, err
<ide> }
<ide>
<del> if _, err := conn.Exec("DELETE FROM edge where entity_id=? and name=?", "0", "/"); err != nil {
<del> rollback()
<add> if _, err := tx.Exec("DELETE FROM edge where entity_id=? and name=?", "0", "/"); err != nil {
<add> tx.Rollback()
<ide> return nil, err
<ide> }
<ide>
<del> if _, err := conn.Exec("INSERT INTO edge (entity_id, name) VALUES(?,?);", "0", "/"); err != nil {
<del> rollback()
<add> if _, err := tx.Exec("INSERT INTO edge (entity_id, name) VALUES(?,?);", "0", "/"); err != nil {
<add> tx.Rollback()
<ide> return nil, err
<ide> }
<ide>
<del> if _, err := conn.Exec("COMMIT"); err != nil {
<add> if err := tx.Commit(); err != nil {
<ide> return nil, err
<ide> }
<ide>
<ide> func (db *Database) Set(fullPath, id string) (*Entity, error) {
<ide> db.mux.Lock()
<ide> defer db.mux.Unlock()
<ide>
<del> rollback := func() {
<del> db.conn.Exec("ROLLBACK")
<del> }
<del> if _, err := db.conn.Exec("BEGIN EXCLUSIVE"); err != nil {
<add> tx, err := db.conn.Begin()
<add> if err != nil {
<ide> return nil, err
<ide> }
<add>
<ide> var entityID string
<del> if err := db.conn.QueryRow("SELECT id FROM entity WHERE id = ?;", id).Scan(&entityID); err != nil {
<add> if err := tx.QueryRow("SELECT id FROM entity WHERE id = ?;", id).Scan(&entityID); err != nil {
<ide> if err == sql.ErrNoRows {
<del> if _, err := db.conn.Exec("INSERT INTO entity (id) VALUES(?);", id); err != nil {
<del> rollback()
<add> if _, err := tx.Exec("INSERT INTO entity (id) VALUES(?);", id); err != nil {
<add> tx.Rollback()
<ide> return nil, err
<ide> }
<ide> } else {
<del> rollback()
<add> tx.Rollback()
<ide> return nil, err
<ide> }
<ide> }
<ide> e := &Entity{id}
<ide>
<ide> parentPath, name := splitPath(fullPath)
<del> if err := db.setEdge(parentPath, name, e); err != nil {
<del> rollback()
<add> if err := db.setEdge(parentPath, name, e, tx); err != nil {
<add> tx.Rollback()
<ide> return nil, err
<ide> }
<ide>
<del> if _, err := db.conn.Exec("COMMIT"); err != nil {
<add> if err := tx.Commit(); err != nil {
<ide> return nil, err
<ide> }
<ide> return e, nil
<ide> func (db *Database) Exists(name string) bool {
<ide> return e != nil
<ide> }
<ide>
<del>func (db *Database) setEdge(parentPath, name string, e *Entity) error {
<add>func (db *Database) setEdge(parentPath, name string, e *Entity, tx *sql.Tx) error {
<ide> parent, err := db.get(parentPath)
<ide> if err != nil {
<ide> return err
<ide> func (db *Database) setEdge(parentPath, name string, e *Entity) error {
<ide> return fmt.Errorf("Cannot set self as child")
<ide> }
<ide>
<del> if _, err := db.conn.Exec("INSERT INTO edge (parent_id, name, entity_id) VALUES (?,?,?);", parent.id, name, e.id); err != nil {
<add> if _, err := tx.Exec("INSERT INTO edge (parent_id, name, entity_id) VALUES (?,?,?);", parent.id, name, e.id); err != nil {
<ide> return err
<ide> }
<ide> return nil
<ide> func (db *Database) Purge(id string) (int, error) {
<ide> db.mux.Lock()
<ide> defer db.mux.Unlock()
<ide>
<del> rollback := func() {
<del> db.conn.Exec("ROLLBACK")
<del> }
<del>
<del> if _, err := db.conn.Exec("BEGIN"); err != nil {
<add> tx, err := db.conn.Begin()
<add> if err != nil {
<ide> return -1, err
<ide> }
<ide>
<ide> // Delete all edges
<del> rows, err := db.conn.Exec("DELETE FROM edge WHERE entity_id = ?;", id)
<add> rows, err := tx.Exec("DELETE FROM edge WHERE entity_id = ?;", id)
<ide> if err != nil {
<del> rollback()
<add> tx.Rollback()
<ide> return -1, err
<ide> }
<ide>
<ide> func (db *Database) Purge(id string) (int, error) {
<ide> }
<ide>
<ide> // Delete entity
<del> if _, err := db.conn.Exec("DELETE FROM entity where id = ?;", id); err != nil {
<del> rollback()
<add> if _, err := tx.Exec("DELETE FROM entity where id = ?;", id); err != nil {
<add> tx.Rollback()
<ide> return -1, err
<ide> }
<ide>
<del> if _, err := db.conn.Exec("COMMIT"); err != nil {
<add> if err := tx.Commit(); err != nil {
<ide> return -1, err
<ide> }
<add>
<ide> return int(changes), nil
<ide> }
<ide> | 1 |
Ruby | Ruby | simplify buildenvironmentdsl test setup | 9822faa56a1f99ab97b6e44bccf363c005172197 | <ide><path>Library/Homebrew/test/test_build_environment.rb
<ide> def test_env_block_with_argument
<ide>
<ide> class BuildEnvironmentDSLTests < Homebrew::TestCase
<ide> def make_instance(&block)
<del> Class.new do
<del> extend BuildEnvironmentDSL
<del> def env; self.class.env end
<del> class_eval(&block)
<del> end.new
<add> obj = Object.new.extend(BuildEnvironmentDSL)
<add> obj.instance_eval(&block)
<add> obj
<ide> end
<ide>
<ide> def test_env_single_argument | 1 |
Javascript | Javascript | fix issues for eslint 2.7.0 | ffe5c8385eee009940dd59f5dd3832c792b1a7c2 | <ide><path>test/parallel/test-async-wrap-disabled-propagate-parent.js
<ide> const providers = Object.keys(async_wrap.Providers);
<ide> const uidSymbol = Symbol('uid');
<ide>
<ide> let cntr = 0;
<del>let server;
<ide> let client;
<ide>
<ide> function init(uid, type, parentUid, parentHandle) {
<ide> function noop() { }
<ide> async_wrap.setupHooks({ init });
<ide> async_wrap.enable();
<ide>
<del>server = net.createServer(function(c) {
<add>const server = net.createServer(function(c) {
<ide> client = c;
<ide> // Allow init callback to run before closing.
<ide> setImmediate(() => {
<ide><path>test/parallel/test-async-wrap-propagate-parent.js
<ide> const providers = Object.keys(async_wrap.Providers);
<ide> const uidSymbol = Symbol('uid');
<ide>
<ide> let cntr = 0;
<del>let server;
<ide> let client;
<ide>
<ide> function init(uid, type, parentUid, parentHandle) {
<ide> function noop() { }
<ide> async_wrap.setupHooks({ init });
<ide> async_wrap.enable();
<ide>
<del>server = net.createServer(function(c) {
<add>const server = net.createServer(function(c) {
<ide> client = c;
<ide> // Allow init callback to run before closing.
<ide> setImmediate(() => {
<ide><path>test/parallel/test-stream-writev.js
<ide> function test(decode, uncork, multi, next) {
<ide> assert(false, 'Should not call _write');
<ide> };
<ide>
<del> var expectChunks = decode ?
<del> [
<del> { encoding: 'buffer',
<del> chunk: [104, 101, 108, 108, 111, 44, 32] },
<del> { encoding: 'buffer',
<del> chunk: [119, 111, 114, 108, 100] },
<del> { encoding: 'buffer',
<del> chunk: [33] },
<del> { encoding: 'buffer',
<del> chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] },
<del> { encoding: 'buffer',
<del> chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173]}
<del> ] : [
<del> { encoding: 'ascii', chunk: 'hello, ' },
<del> { encoding: 'utf8', chunk: 'world' },
<del> { encoding: 'buffer', chunk: [33] },
<del> { encoding: 'binary', chunk: '\nand then...' },
<del> { encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' }
<del> ];
<add> var expectChunks = decode ? [
<add> { encoding: 'buffer',
<add> chunk: [104, 101, 108, 108, 111, 44, 32] },
<add> { encoding: 'buffer',
<add> chunk: [119, 111, 114, 108, 100] },
<add> { encoding: 'buffer',
<add> chunk: [33] },
<add> { encoding: 'buffer',
<add> chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] },
<add> { encoding: 'buffer',
<add> chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173]}
<add> ] : [
<add> { encoding: 'ascii', chunk: 'hello, ' },
<add> { encoding: 'utf8', chunk: 'world' },
<add> { encoding: 'buffer', chunk: [33] },
<add> { encoding: 'binary', chunk: '\nand then...' },
<add> { encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' }
<add> ];
<ide>
<ide> var actualChunks;
<ide> w._writev = function(chunks, cb) {
<ide><path>test/parallel/test-timers-immediate.js
<ide> var assert = require('assert');
<ide> let immediateA = false;
<ide> let immediateB = false;
<ide> let immediateC = [];
<del>let before;
<ide>
<ide> setImmediate(function() {
<ide> try {
<ide> setImmediate(function() {
<ide> clearImmediate(immediateB);
<ide> });
<ide>
<del>before = process.hrtime();
<add>const before = process.hrtime();
<ide>
<ide> immediateB = setImmediate(function() {
<ide> immediateB = true;
<ide><path>test/parallel/test-timers-unref.js
<ide> let timeout_fired = false;
<ide> let unref_interval = false;
<ide> let unref_timer = false;
<ide> let unref_callbacks = 0;
<del>let interval, check_unref, checks = 0;
<add>let checks = 0;
<ide>
<ide> var LONG_TIME = 10 * 1000;
<ide> var SHORT_TIME = 100;
<ide> setTimeout(function() {
<ide> timeout_fired = true;
<ide> }, LONG_TIME).unref();
<ide>
<del>interval = setInterval(function() {
<add>const interval = setInterval(function() {
<ide> unref_interval = true;
<ide> clearInterval(interval);
<ide> }, SHORT_TIME);
<ide> setTimeout(function() {
<ide> unref_timer = true;
<ide> }, SHORT_TIME).unref();
<ide>
<del>check_unref = setInterval(function() {
<add>const check_unref = setInterval(function() {
<ide> if (checks > 5 || (unref_interval && unref_timer))
<ide> clearInterval(check_unref);
<ide> checks += 1; | 5 |
Javascript | Javascript | sanitize linenumber in launcheditor | ab61a1fbac025e6985ae6b0a1ea34e378996848c | <ide><path>local-cli/server/util/launchEditor.js
<ide> function launchEditor(fileName, lineNumber) {
<ide> return;
<ide> }
<ide>
<add> // Sanitize lineNumber to prevent malicious use on win32
<add> // via: https://github.com/nodejs/node/blob/c3bb4b1aa5e907d489619fb43d233c3336bfc03d/lib/child_process.js#L333
<add> if (lineNumber && isNaN(lineNumber)) {
<add> return;
<add> }
<add>
<ide> var editor = guessEditor();
<ide> if (!editor) {
<ide> printInstructions('PRO TIP'); | 1 |
Python | Python | change parsing format to use ast via redbaron | 8488a3afa97e12297bdb22586e17b4c0ddf54175 | <ide><path>scripts/fix_ext_import.py
<del>from lib2to3.fixer_base import BaseFix
<del>from lib2to3.fixer_util import Name, syms
<del>
<del>
<del>class FixExtImport(BaseFix):
<del>
<del> PATTERN = "fixnode='oldname'"
<del>
<del> def transform(self, node, results):
<del> fixnode = results['fixnode']
<del> fixnode.replace(Name('newname', prefix=fixnode.prefix))
<del>
<del> if node.type == syms.import_from and \
<del> getattr(results['imp'], 'value', None) == 'flask.ext':
<del> return 0
<del> # TODO: Case 2
<del>
<del>
<del># CASE 1 - from flask.ext.foo import bam --> from flask_foo import bam
<del># CASE 2 - from flask.ext import foo --> import flask_foo as foo
<ide><path>scripts/flaskext_migrate.py
<ide> import sys
<ide>
<ide>
<del>with open("test.py", "r") as source_code:
<del> red = RedBaron(source_code.read())
<add>def read_source(input_file):
<add> with open(input_file, "r") as source_code:
<add> red = RedBaron(source_code.read())
<add> return red
<ide>
<del>print red.dumps()
<ide>
<del># with open("code.py", "w") as source_code:
<del># source_code.write(red.dumps())
<add>def write_source(red, input_file):
<add> with open(input_file, "w") as source_code:
<add> source_code.write(red.dumps())
<add>
<add>
<add>def fix_imports(red):
<add> from_imports = red.find_all("FromImport")
<add> for x in range(len(from_imports)):
<add> values = from_imports[x].value
<add> if (values[0].value == 'flask') and (values[1].value == 'ext'):
<add> # Case 1
<add> if len(from_imports[x].value) == 3:
<add> package = values[2].value
<add> modules = from_imports[x].modules()
<add> r = "{}," * len(modules)
<add> print modules
<add> from_imports[x].replace("from flask_%s import %s"
<add> % (package, r.format(*modules)[:-1]))
<add> # Case 2
<add> else:
<add> module = from_imports[x].modules()[0]
<add> from_imports[x].replace("import flask_%s as %s"
<add> % (module, module))
<add>
<add> return red
<add>
<add>
<add>if __name__ == "__main__":
<add> input_file = sys.argv[1]
<add> ast = read_source(input_file)
<add> new_ast = fix_imports(ast)
<add> write_source(new_ast, input_file)
<ide><path>scripts/test.py
<del>from flask.ext.foo import bam
<add>from flask.ext.foo import \
<add> bam, \
<add> crackle
<add>
<add>from flask.ext import foo
<add>
<add>from flask.ext.foo import (bam,
<add> a,
<add> b
<add>)
<add>
<add>
<ide> from flask.ext import foo
<ide>
<add>import sys
<ide>
<ide> def migrate(old_file):
<ide> new_file = open("temp.py", "w")
<ide> def migrate(old_file):
<ide>
<ide> new_file.write(line)
<ide>
<add>
<ide> if __name__ == "__main__":
<del> old_file = open(sys.arv[1])
<ide>\ No newline at end of file
<add> old_file = open(sys.arv[1]) | 3 |
PHP | PHP | remove uneeded assignement | e231709584dbd150d0e00d93fae086737b52132a | <ide><path>src/Controller/Controller.php
<ide> public function render($view = null, $layout = null)
<ide> $builder->template($this->request->params['action']);
<ide> }
<ide>
<del> $this->View = $this->_view = $this->createView();
<del> $this->response->body($this->_view->render($view, $layout));
<add> $this->View = $this->createView();
<add> $this->response->body($this->View->render($view, $layout));
<ide> return $this->response;
<ide> }
<ide> | 1 |
Go | Go | fix a race condition in the integration tests | 23022932440006aca0a954763bf8e3a5882f94d3 | <ide><path>integration/graph_test.go
<ide> func TestInterruptedRegister(t *testing.T) {
<ide> Comment: "testing",
<ide> Created: time.Now(),
<ide> }
<del> go graph.Register(nil, badArchive, image)
<del> time.Sleep(200 * time.Millisecond)
<ide> w.CloseWithError(errors.New("But I'm not a tarball!")) // (Nobody's perfect, darling)
<add> graph.Register(nil, badArchive, image)
<ide> if _, err := graph.Get(image.ID); err == nil {
<ide> t.Fatal("Image should not exist after Register is interrupted")
<ide> } | 1 |
Javascript | Javascript | remove unused profiler | 53c4daa55709564319a41d5b51fd99667b2cca70 | <ide><path>packages/next/build/profiler/profiler.js
<del>import fs from 'fs'
<del>import path from 'path'
<del>
<del>let maybeInspector
<del>try {
<del> maybeInspector = require('inspector')
<del>} catch (e) {
<del> console.log('Unable to CPU profile in < node 8.0')
<del>}
<del>
<del>class Profiler {
<del> constructor(inspector) {
<del> this.session = undefined
<del> this.inspector = inspector
<del> }
<del>
<del> hasSession() {
<del> return this.session !== undefined
<del> }
<del>
<del> startProfiling() {
<del> if (this.inspector === undefined) {
<del> return Promise.resolve()
<del> }
<del>
<del> try {
<del> this.session = new maybeInspector.Session()
<del> this.session.connect()
<del> } catch (_) {
<del> this.session = undefined
<del> return Promise.resolve()
<del> }
<del>
<del> return Promise.all([
<del> this.sendCommand('Profiler.setSamplingInterval', {
<del> interval: 100,
<del> }),
<del> this.sendCommand('Profiler.enable'),
<del> this.sendCommand('Profiler.start'),
<del> ])
<del> }
<del>
<del> sendCommand(method, params) {
<del> if (this.hasSession()) {
<del> return new Promise((resolve, reject) => {
<del> return this.session.post(method, params, (err, sessionParams) => {
<del> if (err !== null) {
<del> reject(err)
<del> } else {
<del> resolve(sessionParams)
<del> }
<del> })
<del> })
<del> } else {
<del> return Promise.resolve()
<del> }
<del> }
<del>
<del> destroy() {
<del> if (this.hasSession()) {
<del> this.session.disconnect()
<del> }
<del>
<del> return Promise.resolve()
<del> }
<del>
<del> stopProfiling() {
<del> return this.sendCommand('Profiler.stop')
<del> }
<del>}
<del>
<del>// eslint-disable-next-line import/no-extraneous-dependencies
<del>const { Tracer } = require('chrome-trace-event')
<del>
<del>/**
<del> * an object that wraps Tracer and Profiler with a counter
<del> * @typedef {Object} Trace
<del> * @property {Tracer} trace instance of Tracer
<del> * @property {number} counter Counter
<del> * @property {Profiler} profiler instance of Profiler
<del> * @property {Function} end the end function
<del> */
<del>
<del>/**
<del> * @param {string} outputPath The location where to write the log.
<del> * @returns {Trace} The trace object
<del> */
<del>export const createTrace = (outputPath) => {
<del> const trace = new Tracer({
<del> noStream: true,
<del> })
<del> const profiler = new Profiler(maybeInspector)
<del> if (/\/|\\/.test(outputPath)) {
<del> const dirPath = path.dirname(outputPath)
<del> fs.mkdirSync(dirPath, { recursive: true })
<del> }
<del> const fsStream = fs.createWriteStream(outputPath)
<del>
<del> let counter = 0
<del>
<del> trace.pipe(fsStream)
<del> // These are critical events that need to be inserted so that tools like
<del> // chrome dev tools can load the profile.
<del> trace.instantEvent({
<del> name: 'TracingStartedInPage',
<del> id: ++counter,
<del> cat: ['disabled-by-default-devtools.timeline'],
<del> args: {
<del> data: {
<del> sessionId: '-1',
<del> page: '0xfff',
<del> frames: [
<del> {
<del> frame: '0xfff',
<del> url: 'webpack',
<del> name: '',
<del> },
<del> ],
<del> },
<del> },
<del> })
<del>
<del> trace.instantEvent({
<del> name: 'TracingStartedInBrowser',
<del> id: ++counter,
<del> cat: ['disabled-by-default-devtools.timeline'],
<del> args: {
<del> data: {
<del> sessionId: '-1',
<del> },
<del> },
<del> })
<del>
<del> return {
<del> trace,
<del> counter,
<del> profiler,
<del> end: (callback) => {
<del> // Wait until the write stream finishes.
<del> fsStream.on('finish', () => {
<del> callback()
<del> })
<del> // Tear down the readable trace stream.
<del> trace.push(null)
<del> },
<del> }
<del>} | 1 |
Java | Java | delete unused imports in spring-test | 2a3e62ddfc9021a9b8340349bd678c25dfd39e7c | <ide><path>spring-test/src/test/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilderTests.java
<ide> import java.io.IOException;
<ide> import java.net.URI;
<ide> import java.net.URISyntaxException;
<del>import java.nio.charset.Charset;
<ide> import java.nio.charset.StandardCharsets;
<ide> import java.security.Principal;
<ide> import java.util.Arrays; | 1 |
Javascript | Javascript | copy the static directory for static file serving | c40ded0c12f4642b13123ba0e5d7170676ab850d | <ide><path>server/export.js
<ide> export default async function (dir, options) {
<ide> join(outDir, '_next', buildStats['app.js'].hash, 'app.js')
<ide> )
<ide>
<add> // Copy static directory
<add> if (existsSync(join(dir, 'static'))) {
<add> log(' copying "static" directory')
<add> await cp(
<add> join(dir, 'static'),
<add> join(outDir, 'static')
<add> )
<add> }
<add>
<ide> await copyPages(nextDir, outDir, buildId)
<ide>
<ide> // Get the exportPathMap from the `next.config.js` | 1 |
Text | Text | fix broken link in animation docs | 9a89edbb226592a773e420a25447ad75e21376ba | <ide><path>docs/docs/09.1-animation.md
<ide> You'll notice that when you try to remove an item `ReactCSSTransitionGroup` keep
<ide>
<ide> ### Animation Group Must Be Mounted To Work
<ide>
<del>In order for it to apply transitions to its children, the `ReactCSSTransitionGroup` must already be mounted in the DOM. The example below would not work, because the `ReactCSSTransitionGroup` is being mounted along with the new item, instead of the new item being mounted within it. Compare this to the [Getting Started](/docs/docs/09.1-animation.md#getting-started) section above to see the difference.
<add>In order for it to apply transitions to its children, the `ReactCSSTransitionGroup` must already be mounted in the DOM. The example below would not work, because the `ReactCSSTransitionGroup` is being mounted along with the new item, instead of the new item being mounted within it. Compare this to the [Getting Started](#getting-started) section above to see the difference.
<ide>
<ide> ```javascript{12-14}
<ide> render: function() { | 1 |
Javascript | Javascript | increase scope of fbxtree variable | 45dc88e930acd883ded7efe93ba375e1e3dd1849 | <ide><path>examples/js/loaders/FBXLoader.js
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<add> var FBXTree;
<add>
<ide> function FBXLoader( manager ) {
<ide>
<ide> this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> parse: function ( FBXBuffer, resourceDirectory ) {
<ide>
<del> var FBXTree;
<del>
<ide> if ( isFbxFormatBinary( FBXBuffer ) ) {
<ide>
<ide> FBXTree = new BinaryParser().parse( FBXBuffer );
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> constructor: FBXTreeParser,
<ide>
<del> parse: function ( FBXTree ) {
<add> parse: function () {
<ide>
<del> this.FBXTree = FBXTree;
<ide> this.connections = this.parseConnections();
<ide>
<ide> var images = this.parseImages();
<ide> var textures = this.parseTextures( images );
<ide> var materials = this.parseMaterials( textures );
<ide> var deformers = this.parseDeformers();
<del> var geometryMap = new GeometryParser( this.FBXTree, this.connections ).parse( deformers );
<add> var geometryMap = new GeometryParser( this.connections ).parse( deformers );
<ide>
<ide> return this.parseScene( deformers, geometryMap, materials );
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var connectionMap = new Map();
<ide>
<del> if ( 'Connections' in this.FBXTree ) {
<add> if ( 'Connections' in FBXTree ) {
<ide>
<del> var rawConnections = this.FBXTree.Connections.connections;
<add> var rawConnections = FBXTree.Connections.connections;
<ide>
<ide> rawConnections.forEach( function ( rawConnection ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> var images = {};
<ide> var blobs = {};
<ide>
<del> if ( 'Video' in this.FBXTree.Objects ) {
<add> if ( 'Video' in FBXTree.Objects ) {
<ide>
<del> var videoNodes = this.FBXTree.Objects.Video;
<add> var videoNodes = FBXTree.Objects.Video;
<ide>
<ide> for ( var nodeID in videoNodes ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var textureMap = new Map();
<ide>
<del> if ( 'Texture' in this.FBXTree.Objects ) {
<add> if ( 'Texture' in FBXTree.Objects ) {
<ide>
<del> var textureNodes = this.FBXTree.Objects.Texture;
<add> var textureNodes = FBXTree.Objects.Texture;
<ide> for ( var nodeID in textureNodes ) {
<ide>
<ide> var texture = this.parseTexture( textureNodes[ nodeID ], images );
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var materialMap = new Map();
<ide>
<del> if ( 'Material' in this.FBXTree.Objects ) {
<add> if ( 'Material' in FBXTree.Objects ) {
<ide>
<del> var materialNodes = this.FBXTree.Objects.Material;
<add> var materialNodes = FBXTree.Objects.Material;
<ide>
<ide> for ( var nodeID in materialNodes ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> getTexture: function ( textureMap, id ) {
<ide>
<ide> // if the texture is a layered texture, just use the first layer and issue a warning
<del> if ( 'LayeredTexture' in this.FBXTree.Objects && id in this.FBXTree.Objects.LayeredTexture ) {
<add> if ( 'LayeredTexture' in FBXTree.Objects && id in FBXTree.Objects.LayeredTexture ) {
<ide>
<ide> console.warn( 'THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.' );
<ide> id = this.connections.get( id ).children[ 0 ].ID;
<ide> THREE.FBXLoader = ( function () {
<ide> var skeletons = {};
<ide> var morphTargets = {};
<ide>
<del> if ( 'Deformer' in this.FBXTree.Objects ) {
<add> if ( 'Deformer' in FBXTree.Objects ) {
<ide>
<del> var DeformerNodes = this.FBXTree.Objects.Deformer;
<add> var DeformerNodes = FBXTree.Objects.Deformer;
<ide>
<ide> for ( var nodeID in DeformerNodes ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var modelMap = this.parseModels( deformers.skeletons, geometryMap, materialMap );
<ide>
<del> var modelNodes = this.FBXTree.Objects.Model;
<add> var modelNodes = FBXTree.Objects.Model;
<ide>
<ide> var self = this;
<ide> modelMap.forEach( function ( model ) {
<ide> THREE.FBXLoader = ( function () {
<ide> parseModels: function ( skeletons, geometryMap, materialMap ) {
<ide>
<ide> var modelMap = new Map();
<del> var modelNodes = this.FBXTree.Objects.Model;
<add> var modelNodes = FBXTree.Objects.Model;
<ide>
<ide> for ( var nodeID in modelNodes ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> var model;
<ide> var cameraAttribute;
<ide>
<del> var self = this;
<ide> relationships.children.forEach( function ( child ) {
<ide>
<del> var attr = self.FBXTree.Objects.NodeAttribute[ child.ID ];
<add> var attr = FBXTree.Objects.NodeAttribute[ child.ID ];
<ide>
<ide> if ( attr !== undefined ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> var model;
<ide> var lightAttribute;
<ide>
<del> var self = this;
<ide> relationships.children.forEach( function ( child ) {
<ide>
<del> var attr = self.FBXTree.Objects.NodeAttribute[ child.ID ];
<add> var attr = FBXTree.Objects.NodeAttribute[ child.ID ];
<ide>
<ide> if ( attr !== undefined ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var children = this.connections.get( model.ID ).children;
<ide>
<del> var self = this;
<ide> children.forEach( function ( child ) {
<ide>
<ide> if ( child.relationship === 'LookAtProperty' ) {
<ide>
<del> var lookAtTarget = self.FBXTree.Objects.Model[ child.ID ];
<add> var lookAtTarget = FBXTree.Objects.Model[ child.ID ];
<ide>
<ide> if ( 'Lcl_Translation' in lookAtTarget ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var bindMatrices = {};
<ide>
<del> if ( 'Pose' in this.FBXTree.Objects ) {
<add> if ( 'Pose' in FBXTree.Objects ) {
<ide>
<del> var BindPoseNode = this.FBXTree.Objects.Pose;
<add> var BindPoseNode = FBXTree.Objects.Pose;
<ide>
<ide> for ( var nodeID in BindPoseNode ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> sceneGraph.animations = [];
<ide>
<del> var rawClips = new AnimationParser( this.FBXTree, this.connections ).parse();
<add> var rawClips = new AnimationParser( this.connections ).parse();
<ide>
<ide> if ( rawClips === undefined ) return;
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> // Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light
<ide> createAmbientLight: function ( sceneGraph ) {
<ide>
<del> if ( 'GlobalSettings' in this.FBXTree && 'AmbientColor' in this.FBXTree.GlobalSettings ) {
<add> if ( 'GlobalSettings' in FBXTree && 'AmbientColor' in FBXTree.GlobalSettings ) {
<ide>
<del> var ambientColor = this.FBXTree.GlobalSettings.AmbientColor.value;
<add> var ambientColor = FBXTree.GlobalSettings.AmbientColor.value;
<ide> var r = ambientColor[ 0 ];
<ide> var g = ambientColor[ 1 ];
<ide> var b = ambientColor[ 2 ];
<ide> THREE.FBXLoader = ( function () {
<ide> };
<ide>
<ide> // parse Geometry data from FBXTree and return map of BufferGeometries and nurbs curves
<del> function GeometryParser( FBXTree, connections ) {
<add> function GeometryParser( connections ) {
<ide>
<del> this.FBXTree = FBXTree;
<ide> this.connections = connections;
<ide>
<ide> }
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> var geometryMap = new Map();
<ide>
<del> if ( 'Geometry' in this.FBXTree.Objects ) {
<add> if ( 'Geometry' in FBXTree.Objects ) {
<ide>
<del> var geoNodes = this.FBXTree.Objects.Geometry;
<add> var geoNodes = FBXTree.Objects.Geometry;
<ide>
<ide> for ( var nodeID in geoNodes ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> var skeletons = deformers.skeletons;
<ide> var morphTargets = deformers.morphTargets;
<ide>
<del> var self = this;
<ide> var modelNodes = relationships.parents.map( function ( parent ) {
<ide>
<del> return self.FBXTree.Objects.Model[ parent.ID ];
<add> return FBXTree.Objects.Model[ parent.ID ];
<ide>
<ide> } );
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> var self = this;
<ide> morphTarget.rawTargets.forEach( function ( rawTarget ) {
<ide>
<del> var morphGeoNode = self.FBXTree.Objects.Geometry[ rawTarget.geoID ];
<add> var morphGeoNode = FBXTree.Objects.Geometry[ rawTarget.geoID ];
<ide>
<ide> if ( morphGeoNode !== undefined ) {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> };
<ide>
<ide> // parse animation data from FBXTree
<del> function AnimationParser( FBXTree, connections ) {
<add> function AnimationParser( connections ) {
<ide>
<del> this.FBXTree = FBXTree;
<ide> this.connections = connections;
<ide>
<ide> }
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> // since the actual transformation data is stored in FBXTree.Objects.AnimationCurve,
<ide> // if this is undefined we can safely assume there are no animations
<del> if ( this.FBXTree.Objects.AnimationCurve === undefined ) return undefined;
<add> if ( FBXTree.Objects.AnimationCurve === undefined ) return undefined;
<ide>
<ide> var curveNodesMap = this.parseAnimationCurveNodes();
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> // and is referenced by an AnimationLayer
<ide> parseAnimationCurveNodes: function () {
<ide>
<del> var rawCurveNodes = this.FBXTree.Objects.AnimationCurveNode;
<add> var rawCurveNodes = FBXTree.Objects.AnimationCurveNode;
<ide>
<ide> var curveNodesMap = new Map();
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> // axis ( e.g. times and values of x rotation)
<ide> parseAnimationCurves: function ( curveNodesMap ) {
<ide>
<del> var rawCurves = this.FBXTree.Objects.AnimationCurve;
<add> var rawCurves = FBXTree.Objects.AnimationCurve;
<ide>
<ide> // TODO: Many values are identical up to roundoff error, but won't be optimised
<ide> // e.g. position times: [0, 0.4, 0. 8]
<ide> THREE.FBXLoader = ( function () {
<ide> // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
<ide> parseAnimationLayers: function ( curveNodesMap ) {
<ide>
<del> var rawLayers = this.FBXTree.Objects.AnimationLayer;
<add> var rawLayers = FBXTree.Objects.AnimationLayer;
<ide>
<ide> var layersMap = new Map();
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide>
<ide> } );
<ide>
<del> var rawModel = self.FBXTree.Objects.Model[ modelID.toString() ];
<add> var rawModel = FBXTree.Objects.Model[ modelID.toString() ];
<ide>
<ide> var node = {
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> // assuming geometry is not used in more than one model
<ide> var modelID = self.connections.get( geoID ).parents[ 0 ].ID;
<ide>
<del> var rawModel = self.FBXTree.Objects.Model[ modelID ];
<add> var rawModel = FBXTree.Objects.Model[ modelID ];
<ide>
<ide> var node = {
<ide>
<ide> modelName: THREE.PropertyBinding.sanitizeNodeName( rawModel.attrName ),
<del> morphName: self.FBXTree.Objects.Deformer[ deformerID ].attrName,
<add> morphName: FBXTree.Objects.Deformer[ deformerID ].attrName,
<ide>
<ide> };
<ide>
<ide> THREE.FBXLoader = ( function () {
<ide> // hierarchy. Each Stack node will be used to create a THREE.AnimationClip
<ide> parseAnimStacks: function ( layersMap ) {
<ide>
<del> var rawStacks = this.FBXTree.Objects.AnimationStack;
<add> var rawStacks = FBXTree.Objects.AnimationStack;
<ide>
<ide> // connect the stacks (clips) up to the layers
<ide> var rawClips = {}; | 1 |
Java | Java | use weak hash map for react scroll view helper | b673e352fb0ea44b545edf5a7e8c1b422180838a | <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.java
<ide> import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
<ide> import com.facebook.react.bridge.ReactContext;
<ide> import com.facebook.react.uimanager.UIManagerHelper;
<del>import java.util.ArrayList;
<del>import java.util.List;
<add>import java.util.Collections;
<add>import java.util.Set;
<add>import java.util.WeakHashMap;
<ide>
<ide> /** Helper class that deals with emitting Scroll Events. */
<ide> public class ReactScrollViewHelper {
<ide> void onScroll(
<ide> }
<ide>
<ide> // Support global native listeners for scroll events
<del> private static List<ScrollListener> sScrollListeners = new ArrayList<>();
<add> private static Set<ScrollListener> sScrollListeners =
<add> Collections.newSetFromMap(new WeakHashMap<ScrollListener, Boolean>());
<ide>
<ide> // If all else fails, this is the hardcoded value in OverScroller.java, in AOSP.
<ide> // The default is defined here (as of this diff):
<ide> public void startScroll(int startX, int startY, int dx, int dy, int duration) {
<ide> }
<ide> }
<ide>
<add> /**
<add> * Adds a scroll listener.
<add> *
<add> * <p>Note that you must keep a reference to this scroll listener because this class only keeps a
<add> * weak reference to it (to prevent memory leaks). This means that code like <code>
<add> * addScrollListener(new ScrollListener() {...})</code> won't work, you need to do this instead:
<add> * <code>
<add> * mScrollListener = new ScrollListener() {...};
<add> * ReactScrollViewHelper.addScrollListener(mScrollListener);
<add> * </code> instead.
<add> *
<add> * @param listener
<add> */
<ide> public static void addScrollListener(ScrollListener listener) {
<ide> sScrollListeners.add(listener);
<ide> } | 1 |
PHP | PHP | apply fixes from styleci | a880574f5ada4c9aa0c9353a8cfae3e71f981e7a | <ide><path>tests/Foundation/Bootstrap/HandleExceptionsTest.php
<ide> use Illuminate\Foundation\Application;
<ide> use Illuminate\Foundation\Bootstrap\HandleExceptions;
<ide> use Illuminate\Log\LogManager;
<del>use Illuminate\Support\Str;
<ide> use Mockery as m;
<ide> use Monolog\Handler\NullHandler;
<ide> use PHPUnit\Framework\TestCase;
<ide> public function testPhpDeprecations()
<ide>
<ide> $logger->shouldReceive('channel')->with('deprecations')->andReturnSelf();
<ide> $logger->shouldReceive('warning')->with(
<del> m::on(fn(string $message) => (bool) preg_match(
<add> m::on(fn (string $message) => (bool) preg_match(
<ide> <<<REGEXP
<ide> #ErrorException: str_contains\(\): Passing null to parameter \#2 \(\\\$needle\) of type string is deprecated in /home/user/laravel/routes/web\.php:17
<ide> Stack trace:
<ide> public function testUserDeprecations()
<ide>
<ide> $logger->shouldReceive('channel')->with('deprecations')->andReturnSelf();
<ide> $logger->shouldReceive('warning')->with(
<del> m::on(fn(string $message) => (bool) preg_match(
<add> m::on(fn (string $message) => (bool) preg_match(
<ide> <<<REGEXP
<ide> #ErrorException: str_contains\(\): Passing null to parameter \#2 \(\\\$needle\) of type string is deprecated in /home/user/laravel/routes/web\.php:17
<ide> Stack trace: | 1 |
Javascript | Javascript | add si prefix formatting to d3.format | 0ca32a8f69b0f8342d582cf930b7e2ef8a9cf7c9 | <ide><path>d3.js
<ide> d3.format = function(specifier) {
<ide> precision = match[8],
<ide> type = match[9],
<ide> percentage = false,
<del> integer = false;
<add> integer = false,
<add> si = false;
<ide>
<ide> if (precision) precision = precision.substring(1);
<ide>
<ide> d3.format = function(specifier) {
<ide> case "%": percentage = true; type = "f"; break;
<ide> case "p": percentage = true; type = "r"; break;
<ide> case "d": integer = true; precision = "0"; break;
<add> case "s": si = true; type = "r"; precision = "3"; break;
<ide> }
<ide>
<ide> type = d3_format_types[type] || d3_format_typeDefault;
<ide>
<ide> return function(value) {
<ide> var number = percentage ? value * 100 : +value,
<ide> negative = (number < 0) && (number = -number) ? "\u2212" : sign;
<add> exponent = si ? d3_format_getExponent(number, 3) : 0,
<add> scale = si ? Math.pow(10, -exponent) : 1,
<add> si_prefixes = ['y','z','a','f','p','n','μ','m','','k','M','G','T','P','E','Z','Y'],
<add> suffix = percentage ? '%' : si ? (Math.abs(exponent) <= 24) ? si_prefixes[(exponent + 24) / 3] : "e" + exponent : '';
<ide>
<ide> // Return the empty string for floats formatted as ints.
<ide> if (integer && (number % 1)) return "";
<ide>
<ide> // Convert the input value to the desired precision.
<del> value = type(number, precision);
<add> value = type(number * scale, precision);
<add>
<add> // if using SI prefix notation, scale and trim insignificant zeros
<add> if (si) {
<add> value = (new Number(value)).toPrecision();
<add> }
<ide>
<ide> // If the fill character is 0, the sign and group is applied after the fill.
<ide> if (zfill) {
<ide> d3.format = function(specifier) {
<ide> var length = value.length;
<ide> if (length < width) value = new Array(width - length + 1).join(fill) + value;
<ide> }
<del> if (percentage) value += "%";
<add> value += suffix;
<add>
<ide>
<ide> return value;
<ide> };
<ide> var d3_format_types = {
<ide> r: function(x, p) {
<ide> var n = 1 + Math.floor(1e-15 + Math.log(x) / Math.LN10);
<ide> return d3.round(x, p - n).toFixed(Math.max(0, Math.min(20, p - n)));
<del> }
<del>};
<add> // },
<add> // s: function(x, p) {
<add> // // copied from gnuplot and modified
<add> // // find exponent and significand
<add> // var l10 = Math.log(x) / Math.LN10,
<add> // exponent = Math.floor(l10),
<add> // mantissa = l10 - exponent,
<add> // significand = Math.pow(10, mantissa);
<add> // // round exponent to integer multiple of 3
<add> // var pr = exponent % 3;
<add> // if (pr < 0) exponent -= 3;
<add> // significand *= Math.pow(10, (3 + pr) % 3); // if 1 or -2, 10. if -1 or 2, 100.
<add> // exponent -= pr;
<add> // // decimal significand fixup
<add> // var tolerance = 1e-2;
<add> // if (significand + tolerance >= 1e3) {
<add> // significand /= 1e3;
<add> // exponent += 3;
<add> // }
<add> // var metric_suffix = (Math.abs(exponent) <= 24) ? si_prefixes[(exponent + 24) / 3] : "e" + exponent;
<add> // // floating point joy
<add> // var sig_round = new Number(d3.format(".3r")(significand));
<add> // return sig_round.toPrecision() + metric_suffix;
<add> }
<add>};
<add>
<add>function d3_format_getExponent(value, mod) {
<add> if (value == 0) return 0;
<add> var l10 = Math.log(value) / Math.LN10,
<add> exponent = Math.floor(l10),
<add> mantissa = l10 - exponent;
<add> significand = Math.pow(10, mantissa),
<add> em = exponent % mod;
<add> if (em < 0) exponent -= 3;
<add> exponent -= em;
<add> // mantissa += (mod + em) % mod;
<add> significand *= Math.pow(10, (3 + em) % 3);
<add> // decimal fixup
<add> var tolerance = .5 + 1e-15;
<add> if (significand + tolerance >= 1e3) exponent += mod;
<add> // if (Math.pow(10, mantissa) + tolerance >= 1e3) exponent += mod;
<add> return exponent;
<add>}
<ide>
<ide> function d3_format_typeDefault(x) {
<ide> return x + "";
<ide><path>d3.min.js
<del>(function(){function dq(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(dc[2]=a)-c[2]),e=dc[0]=b[0]-d*c[0],f=dc[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{dd.apply(de,df)}finally{d3.event=g}g.preventDefault()}function dp(){dh&&(d3.event.stopPropagation(),d3.event.preventDefault(),dh=!1)}function dn(){c$&&(dg&&(dh=!0),dm(),c$=null)}function dm(){c_=null,c$&&(dg=!0,dq(dc[2],d3.svg.mouse(de),c$))}function dl(){var a=d3.svg.touches(de);switch(a.length){case 1:var b=a[0];dq(dc[2],b,da[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=da[c.identifier],g=da[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dq(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dk(){var a=d3.svg.touches(de),b=-1,c=a.length,d;while(++b<c)da[(d=a[b]).identifier]=di(d);return a}function dj(){cZ||(cZ=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{cZ.scrollTop=1e3,cZ.dispatchEvent(a),b=1e3-cZ.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function di(a){return[a[0]-dc[0],a[1]-dc[1],dc[2]]}function cY(){d3.event.stopPropagation(),d3.event.preventDefault()}function cX(){cS&&(cY(),cS=!1)}function cW(){!cO||(cT("dragend"),cO=null,cR&&(cS=!0,cY()))}function cV(){if(!!cO){var a=cO.parentNode;if(!a)return cW();cT("drag"),cY()}}function cU(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cT(a){var b=d3.event,c=cO.parentNode,d=0,e=0;c&&(c=cU(c),d=c[0]-cQ[0],e=c[1]-cQ[1],cQ=c,cR|=d|e);try{d3.event={dx:d,dy:e},cN[a].dispatch.apply(cO,cP)}finally{d3.event=b}b.preventDefault()}function cM(a,b,c){e=[];if(c&&b.length>1){var d=bq(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cL(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cK(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cG(){return"circle"}function cF(){return 64}function cE(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cD<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();cD=!e.f&&!e.e,d.remove()}cD?(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 cC(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bO;return[c*Math.cos(d),c*Math.sin(d)]}}function cB(a){return[a.x,a.y]}function cA(a){return a.endAngle}function cz(a){return a.startAngle}function cy(a){return a.radius}function cx(a){return a.target}function cw(a){return a.source}function cv(a){return function(b,c){return a[c][1]}}function cu(a){return function(b,c){return a[c][0]}}function ct(a){function i(f){if(f.length<1)return null;var i=bV(this,f,b,d),j=bV(this,f,b===c?cu(i):c,d===e?cv(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bW,c=bW,d=0,e=bX,f="linear",g=bY[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=bY[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cs(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bO,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cr(a){return a.length<3?bZ(a):a[0]+cd(a,cq(a))}function cq(a){var b=[],c,d,e,f,g=cp(a),h=-1,i=a.length-1;while(++h<i)c=co(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 cp(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=co(e,f);while(++b<c)d[b]=g+(g=co(e=f,f=a[b+1]));d[b]=g;return d}function co(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cn(a,b,c){a.push("C",cj(ck,b),",",cj(ck,c),",",cj(cl,b),",",cj(cl,c),",",cj(cm,b),",",cj(cm,c))}function cj(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function ci(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 cf(a)}function ch(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=[cj(cm,g),",",cj(cm,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cn(b,g,h);return b.join("")}function cg(a){if(a.length<4)return bZ(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(cj(cm,f)+","+cj(cm,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cn(b,f,g);return b.join("")}function cf(a){if(a.length<3)return bZ(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];cn(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cn(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cn(i,g,h);return i.join("")}function ce(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 cd(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bZ(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 cc(a,b,c){return a.length<3?bZ(a):a[0]+cd(a,ce(a,b))}function cb(a,b){return a.length<3?bZ(a):a[0]+cd((a.push(a[0]),a),ce([a[a.length-2]].concat(a,[a[1]]),b))}function ca(a,b){return a.length<4?bZ(a):a[1]+cd(a.slice(1,a.length-1),ce(a,b))}function b_(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function b$(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function bZ(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function bX(a){return a[1]}function bW(a){return a[0]}function bV(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 bU(a){function g(d){return d.length<1?null:"M"+e(a(bV(this,d,b,c)),f)}var b=bW,c=bX,d="linear",e=bY[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=bY[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bT(a){return a.endAngle}function bS(a){return a.startAngle}function bR(a){return a.outerRadius}function bQ(a){return a.innerRadius}function bN(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bN(a,b,c)};return g()}function bM(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bM(a,b)};return d()}function bH(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}var c,d,e;f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,b={t:"range",x:a};return f},f.rangePoints=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length-1+g);d=a.length<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,b={t:"rangePoints",x:c,p:g};return f},f.rangeBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length+g);d=d3.range(h+j*g,i,j),e=j*(1-g),b={t:"rangeBands",x:c,p:g};return f},f.rangeRoundBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=Math.floor((i-h)/(a.length+g)),k=i-h-(a.length-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),b={t:"rangeRoundBands",x:c,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){return bH(a,b)};return f.domain(a)}function bG(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bF(a,b){function e(b){return a(c(b))}var c=bG(b),d=bG(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bx(e.domain(),a)},e.tickFormat=function(a){return by(e.domain(),a)},e.nice=function(){return e.domain(br(e.domain(),bv))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bG(b=a),d=bG(1/b);return e.domain(f)},e.copy=function(){return bF(a.copy(),b)};return bu(e,a)}function bE(a){return a.toPrecision(1)}function bD(a){return-Math.log(-a)/Math.LN10}function bC(a){return Math.log(a)/Math.LN10}function bB(a,b){function d(c){return a(b(c))}var 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?bD:bC,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(br(a.domain(),bs));return d},d.ticks=function(){var d=bq(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===bD){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 bE},d.copy=function(){return bB(a.copy(),b)};return bu(d,a)}function bA(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 bz(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 by(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bw(a,b)[2])/Math.LN10+.01))+"f")}function bx(a,b){return d3.range.apply(d3,bw(a,b))}function bw(a,b){var c=bq(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 bv(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 bu(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 bt(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?bz:bA,i=d?H:G;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var 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 bx(a,b)},h.tickFormat=function(b){return by(a,b)},h.nice=function(){br(a,bv);return g()},h.copy=function(){return bt(a,b,c,d)};return g()}function bs(){return Math}function br(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 bq(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bp(){}function bn(){var a=null,b=bj,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bj=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bm(){var a,b=Date.now(),c=bj;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bn()-b;d>24?(isFinite(d)&&(clearTimeout(bl),bl=setTimeout(bm,d)),bk=0):(bk=1,bo(bm))}function bi(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bd(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 bc(a,b){d(a,be);var c={},e=d3.dispatch("start","end"),f=bh,g=Date.now();a.id=b,a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return f;f=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bi.call(a,b);e[b].add(c);return a},d3.timer(function(d){a.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c>=1){r(),bg=b,e.end.dispatch.call(l,h,i),bg=0;return 1}}function p(a){if(o.active>b)return r();o.active=b;for(var d in c)(d=c[d].call(l,h,i))&&k.push(d);e.start.dispatch.call(l,h,i),q(a)||d3.timer(q,0,g);return 1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=d?p(d):d3.timer(p,m,g)});return 1},0,g);return a}function ba(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function $(a){d(a,_);return a}function Z(a){return{__data__:a}}function Y(a){return function(){return V(a,this)}}function X(a){return function(){return U(a,this)}}function T(a){d(a,W);return a}function S(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60: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 I(g(a+120),g(a),g(a-120))}function R(a,b,c){this.h=a,this.s=b,this.l=c}function Q(a,b,c){return new R(a,b,c)}function N(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function M(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 Q(g,h,i)}function L(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(N(h[0]),N(h[1]),N(h[2]))}}if(i=O[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 K(a){return a<16?"0"+a.toString(16):a.toString(16)}function J(a,b,c){this.r=a,this.g=b,this.b=c}function I(a,b,c){return new J(a,b,c)}function H(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function G(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function F(a){return a in E||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function C(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 B(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function A(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 z(a){return 1-Math.sqrt(1-a*a)}function y(a){return Math.pow(2,10*(a-1))}function x(a){return 1-Math.cos(a*Math.PI/2)}function w(a){return function(b){return Math.pow(b,a)}}function v(a){return a}function u(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function t(a){return function(b){return 1-a(1-b)}}function s(a){return function(b){return b<=0?0:b>=1?1:a(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){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function g(a){return a==null}function f(a){return a.length}function e(){return this}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.2.0"};var d=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};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(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,f),c=Array(b);++a<b;)for(var d=-1,e,g=c[a]=Array(e);++d<e;)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,f=-1,h=a.length;arguments.length<2&&(b=g);while(++f<h)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));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,Math.min(20,b-c)))}},o=w(2),p=w(3),q={linear:function(){return v},poly:w,quad:function(){return o},cubic:function(){return p},sin:function(){return x},exp:function(){return y},circle:function(){return z},elastic:A,back:B,bounce:function(){return C}},r={"in":function(a){return a},out:t,"in-out":u,"out-in":function(a){return u(t(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 s(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;D.lastIndex=0;for(d=0;c=D.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=D.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=D.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--;return h.length===1?h[0]==null?i[0].x:function(){return b}: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 S(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]=F(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 D=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,E={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 O||/^(#|rgb\(|hsl\()/.test(b):b instanceof J||b instanceof R)&&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?L(""+a,I,S):I(~~a,~~b,~~c)},J.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 I(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return I(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},J.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return I(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},J.prototype.hsl=function(){return M(this.r,this.g,this.b)},J.prototype.toString=function(){return"#"+K(this.r)+K(this.g)+K(this.b)};var O={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 P in O)O[P]=L(O[P],I,S);d3.hsl=function(a,b,c){return arguments.length===1?L(""+a,M,Q):Q(+a,+b,+c)},R.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return Q(this.h,this.s,this.l/a)},R.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return Q(this.h,this.s,a*this.l)},R.prototype.rgb=function(){return S(this.h,this.s,this.l)},R.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var U=function(a,b){return b.querySelector(a)},V=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(U=function(a,b){return Sizzle(a,b)[0]},V=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var W=[];d3.selection=function(){return bb},d3.selection.prototype=W,W.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=X(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return T(b)},W.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=Y(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a.call(d,d.__data__,h)),c.parentNode=d;return T(b)},W.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},W.classed=function(a,b){function i(){(b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=h(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=h(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0
<del>;return c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?i:b?f:g)},W.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},W.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},W.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},W.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},W.append=function(a){function c(){return this.appendChild(document.createElementNS(a.space,a.local))}function b(){return this.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},W.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),U(b,this))}function c(){return this.insertBefore(document.createElement(a),U(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},W.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},W.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Z(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Z(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=Z(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=T(d);j.enter=function(){return $(c)},j.exit=function(){return T(e)};return j};var _=[];_.append=W.append,_.insert=W.insert,_.empty=W.empty,_.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return T(b)},W.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return T(b)},W.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},W.sort=function(a){a=ba.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},W.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},W.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},W.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},W.empty=function(){return!this.node()},W.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},W.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bc(a,bg||++bf)};var bb=T([[document]]);bb[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?bb.select(a):T([[a]])},d3.selectAll=function(a){return typeof a=="string"?bb.selectAll(a):T([a])};var be=[],bf=0,bg=0,bh=d3.ease("cubic-in-out");be.call=W.call,d3.transition=function(){return bb.transition()},d3.transition.prototype=be,be.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=X(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bc(b,this.id).ease(this.ease())},be.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=Y(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a.call(d.node,d.node.__data__,h));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return bc(b,this.id).ease(this.ease())},be.attr=function(a,b){return this.attrTween(a,bd(b))},be.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},be.style=function(a,b,c){arguments.length<3&&(c="");return this.styleTween(a,bd(b),c)},be.styleTween=function(a,b,c){arguments.length<3&&(c="");return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})},be.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},be.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},be.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},be.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},be.transition=function(){return this.select(e)};var bj=null,bk,bl;d3.timer=function(a,b,c){var d=!1,e,f=bj;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bj={callback:a,then:c,delay:b,next:bj}),bk||(bl=clearTimeout(bl),bk=1,bo(bm))},d3.timer.flush=function(){var a,b=Date.now(),c=bj;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bn()};var bo=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bt([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bB(d3.scale.linear(),bC)},bC.pow=function(a){return Math.pow(10,a)},bD.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bF(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bH([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bI)},d3.scale.category20=function(){return d3.scale.ordinal().range(bJ)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bK)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bL)};var bI=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bJ=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bK=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bL=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bM([],[])},d3.scale.quantize=function(){return bN(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bO,h=d.apply(this,arguments)+bO,i=(h<g&&(i=g,g=h,h=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>=bP?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,0 0,"+ -e+"A"+e+","+e+" 0 1,0 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=bQ,b=bR,c=bS,d=bT;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+bO;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bO=-Math.PI/2,bP=2*Math.PI-1e-6;d3.svg.line=function(){return bU(Object)};var bY={linear:bZ,"step-before":b$,"step-after":b_,basis:cf,"basis-open":cg,"basis-closed":ch,bundle:ci,cardinal:cc,"cardinal-open":ca,"cardinal-closed":cb,monotone:cr},ck=[0,2/3,1/3,0],cl=[0,1/3,2/3,0],cm=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bU(cs);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return ct(Object)},d3.svg.area.radial=function(){var a=ct(cs);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)+bO,k=e.call(a,h,g)+bO;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=cw,b=cx,c=cy,d=bS,e=bT;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=cw,b=cx,c=cB;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=cB,c=a.projection;a.projection=function(a){return arguments.length?c(cC(b=a)):b};return a},d3.svg.mouse=function(a){return cE(a,d3.event)};var cD=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?Array.prototype.map.call(b,function(b){var c=cE(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cH[a.call(this,c,d)]||cH.circle)(b.call(this,c,d))}var a=cG,b=cF;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 cH={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*cJ)),c=b*cJ;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/cI),c=b*cI/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cI),c=b*cI/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cH);var cI=Math.sqrt(3),cJ=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cM(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=bq(a.range()),B=n.selectAll(".domain").data([0]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cK,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cK,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cL,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cL,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),cT("dragstart")}function c(){cN=a,cQ=cU((cO=this).parentNode),cR=0,cP=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cV).on("touchmove.drag",cV).on("mouseup.drag",cW,!0).on("touchend.drag",cW,!0).on("click.drag",cX,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cN,cO,cP,cQ,cR,cS;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dk(),c,e=Date.now();b.length===1&&e-db<300&&dq(1+Math.floor(a[2]),c=b[0],da[c.identifier]),db=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(de);dq(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,di(b))}function f(){d.apply(this,arguments),c_||(c_=di(d3.svg.mouse(de))),dq(dj()+a[2],d3.svg.mouse(de),c_)}function e(){d.apply(this,arguments),c$=di(d3.svg.mouse(de)),dg=!1,d3.event.preventDefault(),window.focus()}function d(){dc=a,dd=b.zoom.dispatch,de=this,df=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",f).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dm).on("mouseup.zoom",dn).on("touchmove.zoom",dl).on("touchend.zoom",dk).on("click.zoom",dp,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var cZ,c$,c_,da={},db=0,dc,dd,de,df,dg,dh})()
<ide>\ No newline at end of file
<add>(function(){function dr(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(dd[2]=a)-c[2]),e=dd[0]=b[0]-d*c[0],f=dd[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{de.apply(df,dg)}finally{d3.event=g}g.preventDefault()}function dq(){di&&(d3.event.stopPropagation(),d3.event.preventDefault(),di=!1)}function dp(){c_&&(dh&&(di=!0),dn(),c_=null)}function dn(){da=null,c_&&(dh=!0,dr(dd[2],d3.svg.mouse(df),c_))}function dm(){var a=d3.svg.touches(df);switch(a.length){case 1:var b=a[0];dr(dd[2],b,db[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=db[c.identifier],g=db[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dr(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dl(){var a=d3.svg.touches(df),b=-1,c=a.length,d;while(++b<c)db[(d=a[b]).identifier]=dj(d);return a}function dk(){c$||(c$=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{c$.scrollTop=1e3,c$.dispatchEvent(a),b=1e3-c$.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function dj(a){return[a[0]-dd[0],a[1]-dd[1],dd[2]]}function cZ(){d3.event.stopPropagation(),d3.event.preventDefault()}function cY(){cT&&(cZ(),cT=!1)}function cX(){!cP||(cU("dragend"),cP=null,cS&&(cT=!0,cZ()))}function cW(){if(!!cP){var a=cP.parentNode;if(!a)return cX();cU("drag"),cZ()}}function cV(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cU(a){var b=d3.event,c=cP.parentNode,d=0,e=0;c&&(c=cV(c),d=c[0]-cR[0],e=c[1]-cR[1],cR=c,cS|=d|e);try{d3.event={dx:d,dy:e},cO[a].dispatch.apply(cP,cQ)}finally{d3.event=b}b.preventDefault()}function cN(a,b,c){e=[];if(c&&b.length>1){var d=br(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cM(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cL(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cH(){return"circle"}function cG(){return 64}function cF(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cE<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();cE=!e.f&&!e.e,d.remove()}cE?(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 cD(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bP;return[c*Math.cos(d),c*Math.sin(d)]}}function cC(a){return[a.x,a.y]}function cB(a){return a.endAngle}function cA(a){return a.startAngle}function cz(a){return a.radius}function cy(a){return a.target}function cx(a){return a.source}function cw(a){return function(b,c){return a[c][1]}}function cv(a){return function(b,c){return a[c][0]}}function cu(a){function i(f){if(f.length<1)return null;var i=bW(this,f,b,d),j=bW(this,f,b===c?cv(i):c,d===e?cw(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bX,c=bX,d=0,e=bY,f="linear",g=bZ[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=bZ[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function ct(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bP,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cs(a){return a.length<3?b$(a):a[0]+ce(a,cr(a))}function cr(a){var b=[],c,d,e,f,g=cq(a),h=-1,i=a.length-1;while(++h<i)c=cp(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 cq(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cp(e,f);while(++b<c)d[b]=g+(g=cp(e=f,f=a[b+1]));d[b]=g;return d}function cp(a,b){return(b[1]-a[1])/(b[0]-a[0])}function co(a,b,c){a.push("C",ck(cl,b),",",ck(cl,c),",",ck(cm,b),",",ck(cm,c),",",ck(cn,b),",",ck(cn,c))}function ck(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cj(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 cg(a)}function ci(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=[ck(cn,g),",",ck(cn,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),co(b,g,h);return b.join("")}function ch(a){if(a.length<4)return b$(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(ck(cn,f)+","+ck(cn,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),co(b,f,g);return b.join("")}function cg(a){if(a.length<3)return b$(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];co(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),co(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),co(i,g,h);return i.join("")}function cf(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 ce(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return b$(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 cd(a,b,c){return a.length<3?b$(a):a[0]+ce(a,cf(a,b))}function cc(a,b){return a.length<3?b$(a):a[0]+ce((a.push(a[0]),a),cf([a[a.length-2]].concat(a,[a[1]]),b))}function cb(a,b){return a.length<4?b$(a):a[1]+ce(a.slice(1,a.length-1),cf(a,b))}function ca(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function b_(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function b$(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function bY(a){return a[1]}function bX(a){return a[0]}function bW(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 bV(a){function g(d){return d.length<1?null:"M"+e(a(bW(this,d,b,c)),f)}var b=bX,c=bY,d="linear",e=bZ[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=bZ[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bU(a){return a.endAngle}function bT(a){return a.startAngle}function bS(a){return a.outerRadius}function bR(a){return a.innerRadius}function bO(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bO(a,b,c)};return g()}function bN(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bN(a,b)};return d()}function bI(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}var c,d,e;f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,b={t:"range",x:a};return f},f.rangePoints=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length-1+g);d=a.length<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,b={t:"rangePoints",x:c,p:g};return f},f.rangeBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length+g);d=d3.range(h+j*g,i,j),e=j*(1-g),b={t:"rangeBands",x:c,p:g};return f},f.rangeRoundBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=Math.floor((i-h)/(a.length+g)),k=i-h-(a.length-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),b={t:"rangeRoundBands",x:c,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){return bI(a,b)};return f.domain(a)}function bH(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bG(a,b){function e(b){return a(c(b))}var c=bH(b),d=bH(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return by(e.domain(),a)},e.tickFormat=function(a){return bz(e.domain(),a)},e.nice=function(){return e.domain(bs(e.domain(),bw))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bH(b=a),d=bH(1/b);return e.domain(f)},e.copy=function(){return bG(a.copy(),b)};return bv(e,a)}function bF(a){return a.toPrecision(1)}function bE(a){return-Math.log(-a)/Math.LN10}function bD(a){return Math.log(a)/Math.LN10}function bC(a,b){function d(c){return a(b(c))}var 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?bE:bD,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bs(a.domain(),bt));return d},d.ticks=function(){var d=br(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===bE){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 bF},d.copy=function(){return bC(a.copy(),b)};return bv(d,a)}function bB(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 bA(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 bz(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bx(a,b)[2])/Math.LN10+.01))+"f")}function by(a,b){return d3.range.apply(d3,bx(a,b))}function bx(a,b){var c=br(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 bw(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 bv(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 bu(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?bA:bB,i=d?I:H;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var 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 by(a,b)},h.tickFormat=function(b){return bz(a,b)},h.nice=function(){bs(a,bw);return g()},h.copy=function(){return bu(a,b,c,d)};return g()}function bt(){return Math}function bs(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 br(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bq(){}function bo(){var a=null,b=bk,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bk=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bn(){var a,b=Date.now(),c=bk;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bo()-b;d>24?(isFinite(d)&&(clearTimeout(bm),bm=setTimeout(bn,d)),bl=0):(bl=1,bp(bn))}function bj(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function be(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 bd(a,b){d(a,bf);var c={},e=d3.dispatch("start","end"),f=bi,g=Date.now();a.id=b,a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return f;f=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bj.call(a,b);e[b].add(c);return a},d3.timer(function(d){a.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c>=1){r(),bh=b,e.end.dispatch.call(l,h,i),bh=0;return 1}}function p(a){if(o.active>b)return r();o.active=b;for(var d in c)(d=c[d].call(l,h,i))&&k.push(d);e.start.dispatch.call(l,h,i),q(a)||d3.timer(q,0,g);return 1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=d?p(d):d3.timer(p,m,g)});return 1},0,g);return a}function bb(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function _(a){d(a,ba);return a}function $(a){return{__data__:a}}function Z(a){return function(){return W(a,this)}}function Y(a){return function(){return V(a,this)}}function U(a){d(a,X);return a}function T(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60: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 J(g(a+120),g(a),g(a-120))}function S(a,b,c){this.h=a,this.s=b,this.l=c}function R(a,b,c){return new S(a,b,c)}function O(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function N(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 R(g,h,i)}function M(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(O(h[0]),O(h[1]),O(h[2]))}}if(i=P[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 L(a){return a<16?"0"+a.toString(16):a.toString(16)}function K(a,b,c){this.r=a,this.g=b,this.b=c}function J(a,b,c){return new K(a,b,c)}function I(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function H(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function G(a){return a in F||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function D(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 C(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function B(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 A(a){return 1-Math.sqrt(1-a*a)}function z(a){return Math.pow(2,10*(a-1))}function y(a){return 1-Math.cos(a*Math.PI/2)}function x(a){return function(b){return Math.pow(b,a)}}function w(a){return a}function v(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function u(a){return function(b){return 1-a(1-b)}}function t(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function o(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 n(a){return a+""}function m(a,b){if(a==0)return 0;var c=Math.log(a)/Math.LN10,d=Math.floor(c),e=c-d;significand=Math.pow(10,e),em=d%b,em<0&&(d-=3),d-=em,significand*=Math.pow(10,(3+em)%3);var f=.5+1e-15;significand+f>=1e3&&(d+=b);return d}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){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function g(a){return a==null}function f(a){return a.length}function e(){return this}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.2.0"};var d=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};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(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,f),c=Array(b);++a<b;)for(var d=-1,e,g=c[a]=Array(e);++d<e;)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,f=-1,h=a.length;arguments.length<2&&(b=g);while(++f<h)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));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,p=!1,q=!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":p=!0,h="0";break;case"s":q=!0,i="r",h="3"}i=l[i]||n;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;exponent=q?m(b,3):0,scale=q?Math.pow(10,-exponent):1,si_prefixes=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"],suffix=j?"%":q?Math.abs(exponent)<=24?si_prefixes[(exponent+24)/3]:"e"+exponent:"";if(p&&b%1)return"";a=i(b*scale,h),q&&(a=(new Number(a)).toPrecision());if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=o(a)),a=k+a}else{g&&(a=o(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}a+=suffix;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,Math.min(20,b-c)))}},p=x(2),q=x(3),r={linear:function(){return w},poly:x,quad:function(){return p},cubic:function(){return q},sin:function(){return y},exp:function(){return z},circle:function(){return A},elastic:B,back:C,bounce:function(){return D}},s={"in":function(a){return a},out:u,"in-out":v,"out-in":function(a){return v(u(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 t(s[d](r[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;E.lastIndex=0;for(d=0;c=E.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=E.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=E.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--;return h.length===1?h[0]==null?i[0].x:function(){return b}: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 T(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]=G(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 E=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,F={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 P||/^(#|rgb\(|hsl\()/.test(b):b instanceof K||b instanceof S)&&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?M(""+a,J,T):J(~~a,~~b,~~c)},K.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 J(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return J(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},K.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return J(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},K.prototype.hsl=function(){return N(this.r,this.g,this.b)},K.prototype.toString=function(){return"#"+L(this.r)+L(this.g)+L(this.b)};var P={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 Q in P)P[Q]=M(P[Q],J,T);d3.hsl=function(a,b,c){return arguments.length===1?M(""+a,N,R):R(+a,+b,+c)},S.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return R(this.h,this.s,this.l/a)},S.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return R(this.h,this.s,a*this.l)},S.prototype.rgb=function(){return T(this.h,this.s,this.l)},S.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var V=function(a,b){return b.querySelector(a)},W=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(V=function(a,b){return Sizzle(a,b)[0]},W=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var X=[];d3.selection=function(){return bc},d3.selection.prototype=X,X.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=Y(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return U(b)},X.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=Z(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a.call(d,d.__data__,h)),c.parentNode=d;return U(b)},X.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},X.classed=function(a,b){function i(){(b.apply(this,arguments)?f:
<add>g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=h(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=h(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?i:b?f:g)},X.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},X.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},X.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},X.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},X.append=function(a){function c(){return this.appendChild(document.createElementNS(a.space,a.local))}function b(){return this.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},X.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),V(b,this))}function c(){return this.insertBefore(document.createElement(a),V(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},X.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},X.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=$(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=$(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=$(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=U(d);j.enter=function(){return _(c)},j.exit=function(){return U(e)};return j};var ba=[];ba.append=X.append,ba.insert=X.insert,ba.empty=X.empty,ba.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return U(b)},X.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return U(b)},X.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},X.sort=function(a){a=bb.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},X.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},X.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},X.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},X.empty=function(){return!this.node()},X.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},X.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bd(a,bh||++bg)};var bc=U([[document]]);bc[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?bc.select(a):U([[a]])},d3.selectAll=function(a){return typeof a=="string"?bc.selectAll(a):U([a])};var bf=[],bg=0,bh=0,bi=d3.ease("cubic-in-out");bf.call=X.call,d3.transition=function(){return bc.transition()},d3.transition.prototype=bf,bf.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=Y(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bd(b,this.id).ease(this.ease())},bf.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=Z(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a.call(d.node,d.node.__data__,h));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return bd(b,this.id).ease(this.ease())},bf.attr=function(a,b){return this.attrTween(a,be(b))},bf.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},bf.style=function(a,b,c){arguments.length<3&&(c="");return this.styleTween(a,be(b),c)},bf.styleTween=function(a,b,c){arguments.length<3&&(c="");return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})},bf.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bf.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bf.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bf.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},bf.transition=function(){return this.select(e)};var bk=null,bl,bm;d3.timer=function(a,b,c){var d=!1,e,f=bk;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bk={callback:a,then:c,delay:b,next:bk}),bl||(bm=clearTimeout(bm),bl=1,bp(bn))},d3.timer.flush=function(){var a,b=Date.now(),c=bk;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bo()};var bp=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bu([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bC(d3.scale.linear(),bD)},bD.pow=function(a){return Math.pow(10,a)},bE.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bG(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bI([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bJ)},d3.scale.category20=function(){return d3.scale.ordinal().range(bK)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bL)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bM)};var bJ=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bK=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bL=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bM=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bN([],[])},d3.scale.quantize=function(){return bO(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bP,h=d.apply(this,arguments)+bP,i=(h<g&&(i=g,g=h,h=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>=bQ?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,0 0,"+ -e+"A"+e+","+e+" 0 1,0 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=bR,b=bS,c=bT,d=bU;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+bP;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bP=-Math.PI/2,bQ=2*Math.PI-1e-6;d3.svg.line=function(){return bV(Object)};var bZ={linear:b$,"step-before":b_,"step-after":ca,basis:cg,"basis-open":ch,"basis-closed":ci,bundle:cj,cardinal:cd,"cardinal-open":cb,"cardinal-closed":cc,monotone:cs},cl=[0,2/3,1/3,0],cm=[0,1/3,2/3,0],cn=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bV(ct);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cu(Object)},d3.svg.area.radial=function(){var a=cu(ct);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)+bP,k=e.call(a,h,g)+bP;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=cx,b=cy,c=cz,d=bT,e=bU;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=cx,b=cy,c=cC;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=cC,c=a.projection;a.projection=function(a){return arguments.length?c(cD(b=a)):b};return a},d3.svg.mouse=function(a){return cF(a,d3.event)};var cE=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?Array.prototype.map.call(b,function(b){var c=cF(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cI[a.call(this,c,d)]||cI.circle)(b.call(this,c,d))}var a=cH,b=cG;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 cI={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*cK)),c=b*cK;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/cJ),c=b*cJ/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cJ),c=b*cJ/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cI);var cJ=Math.sqrt(3),cK=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cN(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=br(a.range()),B=n.selectAll(".domain").data([0]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cL,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cL,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cM,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cM,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),cU("dragstart")}function c(){cO=a,cR=cV((cP=this).parentNode),cS=0,cQ=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cW).on("touchmove.drag",cW).on("mouseup.drag",cX,!0).on("touchend.drag",cX,!0).on("click.drag",cY,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cO,cP,cQ,cR,cS,cT;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dl(),c,e=Date.now();b.length===1&&e-dc<300&&dr(1+Math.floor(a[2]),c=b[0],db[c.identifier]),dc=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(df);dr(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dj(b))}function f(){d.apply(this,arguments),da||(da=dj(d3.svg.mouse(df))),dr(dk()+a[2],d3.svg.mouse(df),da)}function e(){d.apply(this,arguments),c_=dj(d3.svg.mouse(df)),dh=!1,d3.event.preventDefault(),window.focus()}function d(){dd=a,de=b.zoom.dispatch,df=this,dg=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",f).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dn).on("mouseup.zoom",dp).on("touchmove.zoom",dm).on("touchend.zoom",dl).on("click.zoom",dq,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var c$,c_,da,db={},dc=0,dd,de,df,dg,dh,di})()
<ide>\ No newline at end of file
<ide><path>src/core/format.js
<ide> d3.format = function(specifier) {
<ide> precision = match[8],
<ide> type = match[9],
<ide> percentage = false,
<del> integer = false;
<add> integer = false,
<add> si = false;
<ide>
<ide> if (precision) precision = precision.substring(1);
<ide>
<ide> d3.format = function(specifier) {
<ide> case "%": percentage = true; type = "f"; break;
<ide> case "p": percentage = true; type = "r"; break;
<ide> case "d": integer = true; precision = "0"; break;
<add> case "s": si = true; type = "r"; precision = "3"; break;
<ide> }
<ide>
<ide> type = d3_format_types[type] || d3_format_typeDefault;
<ide>
<ide> return function(value) {
<ide> var number = percentage ? value * 100 : +value,
<ide> negative = (number < 0) && (number = -number) ? "\u2212" : sign;
<add> exponent = si ? d3_format_getExponent(number, 3) : 0,
<add> scale = si ? Math.pow(10, -exponent) : 1,
<add> si_prefixes = ['y','z','a','f','p','n','μ','m','','k','M','G','T','P','E','Z','Y'],
<add> suffix = percentage ? '%' : si ? (Math.abs(exponent) <= 24) ? si_prefixes[(exponent + 24) / 3] : "e" + exponent : '';
<ide>
<ide> // Return the empty string for floats formatted as ints.
<ide> if (integer && (number % 1)) return "";
<ide>
<ide> // Convert the input value to the desired precision.
<del> value = type(number, precision);
<add> value = type(number * scale, precision);
<add>
<add> // if using SI prefix notation, scale and trim insignificant zeros
<add> if (si) {
<add> value = (new Number(value)).toPrecision();
<add> }
<ide>
<ide> // If the fill character is 0, the sign and group is applied after the fill.
<ide> if (zfill) {
<ide> d3.format = function(specifier) {
<ide> var length = value.length;
<ide> if (length < width) value = new Array(width - length + 1).join(fill) + value;
<ide> }
<del> if (percentage) value += "%";
<add> value += suffix;
<add>
<ide>
<ide> return value;
<ide> };
<ide> var d3_format_types = {
<ide> r: function(x, p) {
<ide> var n = 1 + Math.floor(1e-15 + Math.log(x) / Math.LN10);
<ide> return d3.round(x, p - n).toFixed(Math.max(0, Math.min(20, p - n)));
<add> // },
<add> // s: function(x, p) {
<add> // // copied from gnuplot and modified
<add> // // find exponent and significand
<add> // var l10 = Math.log(x) / Math.LN10,
<add> // exponent = Math.floor(l10),
<add> // mantissa = l10 - exponent,
<add> // significand = Math.pow(10, mantissa);
<add> // // round exponent to integer multiple of 3
<add> // var pr = exponent % 3;
<add> // if (pr < 0) exponent -= 3;
<add> // significand *= Math.pow(10, (3 + pr) % 3); // if 1 or -2, 10. if -1 or 2, 100.
<add> // exponent -= pr;
<add> // // decimal significand fixup
<add> // var tolerance = 1e-2;
<add> // if (significand + tolerance >= 1e3) {
<add> // significand /= 1e3;
<add> // exponent += 3;
<add> // }
<add> // var metric_suffix = (Math.abs(exponent) <= 24) ? si_prefixes[(exponent + 24) / 3] : "e" + exponent;
<add> // // floating point joy
<add> // var sig_round = new Number(d3.format(".3r")(significand));
<add> // return sig_round.toPrecision() + metric_suffix;
<ide> }
<ide> };
<ide>
<add>function d3_format_getExponent(value, mod) {
<add> if (value == 0) return 0;
<add> var l10 = Math.log(value) / Math.LN10,
<add> exponent = Math.floor(l10),
<add> mantissa = l10 - exponent;
<add> significand = Math.pow(10, mantissa),
<add> em = exponent % mod;
<add> if (em < 0) exponent -= 3;
<add> exponent -= em;
<add> // mantissa += (mod + em) % mod;
<add> significand *= Math.pow(10, (3 + em) % 3);
<add> // decimal fixup
<add> var tolerance = .5 + 1e-15;
<add> if (significand + tolerance >= 1e3) exponent += mod;
<add> // if (Math.pow(10, mantissa) + tolerance >= 1e3) exponent += mod;
<add> return exponent;
<add>}
<add>
<ide> function d3_format_typeDefault(x) {
<ide> return x + "";
<ide> }
<ide><path>test/core/format-test.js
<ide> suite.addBatch({
<ide> assert.strictEqual(f(-4200000), "−4.2e+6");
<ide> assert.strictEqual(f(-42000000), "−4.2e+7");
<ide> },
<add> "can output SI prefix notation": function(format) {
<add> var f = format("s");
<add> assert.strictEqual(f(0), "0");
<add> assert.strictEqual(f(1), "1");
<add> assert.strictEqual(f(100), "100");
<add> assert.strictEqual(f(999.5), "1k");
<add> assert.strictEqual(f(1000), "1k");
<add> assert.strictEqual(f(145500000), "146M");
<add> assert.strictEqual(f(145999999.999999347), "146M");
<add> assert.strictEqual(f(.000001), "1μ");
<add> },
<ide> "can output a percentage": function(format) {
<ide> var f = format("%");
<ide> assert.strictEqual(f(0), "0%"); | 4 |
Python | Python | update the typing tests for `np.number` subclasses | b0c37b8ef3f9536608ad78ee94bcb5d8c87d2242 | <ide><path>numpy/typing/tests/data/fail/scalars.py
<add>import sys
<ide> import numpy as np
<ide>
<ide> f2: np.float16
<ide> f8: np.float64
<add>c8: np.complex64
<ide>
<ide> # Construction
<ide>
<ide> def func(a: np.float32) -> None: ...
<ide>
<ide> func(f2) # E: incompatible type
<ide> func(f8) # E: incompatible type
<add>
<add>round(c8) # E: No overload variant
<add>
<add>c8.__getnewargs__() # E: Invalid self argument
<add>f2.__getnewargs__() # E: Invalid self argument
<add>f2.is_integer() # E: Invalid self argument
<add>f2.hex() # E: Invalid self argument
<add>np.float16.fromhex("0x0.0p+0") # E: Invalid self argument
<add>f2.__trunc__() # E: Invalid self argument
<add>f2.__getformat__("float") # E: Invalid self argument
<ide><path>numpy/typing/tests/data/reveal/scalars.py
<add>import sys
<ide> import numpy as np
<ide>
<ide> b: np.bool_
<ide> f8: np.float64
<ide> c8: np.complex64
<ide> c16: np.complex128
<add>m: np.timedelta64
<ide> U: np.str_
<ide> S: np.bytes_
<ide>
<ide> reveal_type(i8.getfield(float)) # E: Any
<ide> reveal_type(i8.getfield(np.float64)) # E: {float64}
<ide> reveal_type(i8.getfield(np.float64, 8)) # E: {float64}
<add>
<add>reveal_type(f8.as_integer_ratio()) # E: Tuple[builtins.int, builtins.int]
<add>reveal_type(f8.is_integer()) # E: bool
<add>reveal_type(f8.__trunc__()) # E: int
<add>reveal_type(f8.__getformat__("float")) # E: str
<add>reveal_type(f8.hex()) # E: str
<add>reveal_type(np.float64.fromhex("0x0.0p+0")) # E: {float64}
<add>
<add>reveal_type(f8.__getnewargs__()) # E: Tuple[builtins.float]
<add>reveal_type(c16.__getnewargs__()) # E: Tuple[builtins.float, builtins.float]
<add>
<add>reveal_type(i8.numerator) # E: {int64}
<add>reveal_type(i8.denominator) # E: Literal[1]
<add>reveal_type(u8.numerator) # E: {uint64}
<add>reveal_type(u8.denominator) # E: Literal[1]
<add>reveal_type(m.numerator) # E: numpy.timedelta64
<add>reveal_type(m.denominator) # E: Literal[1]
<add>
<add>reveal_type(round(i8)) # E: int
<add>reveal_type(round(i8, 3)) # E: {int64}
<add>reveal_type(round(u8)) # E: int
<add>reveal_type(round(u8, 3)) # E: {uint64}
<add>reveal_type(round(f8)) # E: int
<add>reveal_type(round(f8, 3)) # E: {float64}
<add>
<add>if sys.version_info >= (3, 9):
<add> reveal_type(f8.__ceil__()) # E: int
<add> reveal_type(f8.__floor__()) # E: int | 2 |
Javascript | Javascript | flowify libraries/stylesheet and libraries/text | a343c4345e160e322e85451e43b4f0d756e3ea90 | <ide><path>Libraries/StyleSheet/EdgeInsetsPropType.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<ide> * @providesModule EdgeInsetsPropType
<add> * @flow
<ide> */
<ide> 'use strict'
<ide>
<ide><path>Libraries/StyleSheet/LayoutPropTypes.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<ide> * @providesModule LayoutPropTypes
<add> * @flow
<ide> */
<ide> 'use strict';
<ide>
<ide><path>Libraries/StyleSheet/PointPropType.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<ide> * @providesModule PointPropType
<add> * @flow
<ide> */
<ide> 'use strict'
<ide>
<ide><path>Libraries/StyleSheet/StyleSheet.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<ide> * @providesModule StyleSheet
<add> * @flow
<ide> */
<ide> 'use strict';
<ide>
<ide> var StyleSheetValidation = require('StyleSheetValidation');
<ide> * subsequent uses are going to refer an id (not implemented yet).
<ide> */
<ide> class StyleSheet {
<del> static create(obj) {
<add> static create(obj: {[key: string]: any}): {[key: string]: number} {
<ide> var result = {};
<ide> for (var key in obj) {
<ide> StyleSheetValidation.validateStyle(key, obj);
<ide><path>Libraries/StyleSheet/StyleSheetPropType.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<ide> * @providesModule StyleSheetPropType
<add> * @flow
<ide> */
<ide> 'use strict';
<ide>
<ide> var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
<ide> var flattenStyle = require('flattenStyle');
<ide>
<del>function StyleSheetPropType(shape) {
<add>function StyleSheetPropType(
<add> shape: {[key: string]: ReactPropsCheckType}
<add>): ReactPropsCheckType {
<ide> var shapePropType = createStrictShapeTypeChecker(shape);
<del> return function(props, propName, componentName, location) {
<add> return function(props, propName, componentName, location?) {
<ide> var newProps = props;
<ide> if (props[propName]) {
<ide> // Just make a dummy prop object with only the flattened style
<ide><path>Libraries/StyleSheet/StyleSheetRegistry.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<ide> * @providesModule StyleSheetRegistry
<add> * @flow
<ide> */
<ide> 'use strict';
<ide>
<ide> var uniqueID = 1;
<ide> var emptyStyle = {};
<ide>
<ide> class StyleSheetRegistry {
<del> static registerStyle(style) {
<add> static registerStyle(style: Object): number {
<ide> var id = ++uniqueID;
<ide> if (__DEV__) {
<ide> Object.freeze(style);
<ide> class StyleSheetRegistry {
<ide> return id;
<ide> }
<ide>
<del> static getStyleByID(id) {
<add> static getStyleByID(id: number): Object {
<ide> if (!id) {
<ide> // Used in the style={[condition && id]} pattern,
<ide> // we want it to be a no-op when the value is false or null
<ide><path>Libraries/StyleSheet/StyleSheetValidation.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<ide> * @providesModule StyleSheetValidation
<add> * @flow
<ide> */
<ide> 'use strict';
<ide>
<ide> class StyleSheetValidation {
<ide> }
<ide> }
<ide>
<del>var styleError = function(message1, style, caller, message2) {
<add>var styleError = function(message1, style, caller?, message2?) {
<ide> invariant(
<ide> false,
<ide> message1 + '\n' + (caller || '<<unknown>>') + ': ' +
<ide><path>Libraries/StyleSheet/flattenStyle.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<ide> * @providesModule flattenStyle
<add> * @flow
<ide> */
<ide> 'use strict';
<ide>
<ide> var StyleSheetRegistry = require('StyleSheetRegistry');
<add>var invariant = require('invariant');
<ide> var mergeIntoFast = require('mergeIntoFast');
<ide>
<add>type Atom = number | bool | Object | Array<?Atom>
<add>type StyleObj = Atom | Array<?StyleObj>
<add>
<ide> function getStyle(style) {
<ide> if (typeof style === 'number') {
<ide> return StyleSheetRegistry.getStyleByID(style);
<ide> }
<ide> return style;
<ide> }
<ide>
<del>function flattenStyle(style) {
<add>// TODO: Flow 0.7.0 doesn't refine bools properly so we have to use `any` to
<add>// tell it that this can't be a bool anymore. Should be fixed in 0.8.0,
<add>// after which this can take a ?StyleObj.
<add>function flattenStyle(style: any): ?Object {
<ide> if (!style) {
<ide> return undefined;
<ide> }
<add> invariant(style !== true, 'style may be false but not true');
<ide>
<ide> if (!Array.isArray(style)) {
<ide> return getStyle(style);
<ide><path>Libraries/StyleSheet/styleDiffer.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<ide> * @providesModule styleDiffer
<add> * @flow
<ide> */
<ide> 'use strict';
<ide>
<ide> var deepDiffer = require('deepDiffer');
<ide>
<del>function styleDiffer(a, b) {
<add>function styleDiffer(a: any, b: any): bool {
<ide> return !styleEqual(a, b);
<ide> }
<ide>
<del>function styleEqual(a, b) {
<add>function styleEqual(a: any, b: any): bool {
<ide> if (!a) {
<ide> return !b;
<ide> }
<ide><path>Libraries/Text/Text.js
<ide> * of patent rights can be found in the PATENTS file in the same directory.
<ide> *
<ide> * @providesModule Text
<del> * @typechecks static-only
<add> * @flow
<ide> */
<ide> 'use strict';
<ide>
<ide> var Text = React.createClass({
<ide> });
<ide> },
<ide>
<del> onStartShouldSetResponder: function() {
<add> onStartShouldSetResponder: function(): bool {
<ide> var shouldSetFromProps = this.props.onStartShouldSetResponder &&
<ide> this.props.onStartShouldSetResponder();
<ide> return shouldSetFromProps || !!this.props.onPress;
<ide> var Text = React.createClass({
<ide> /*
<ide> * Returns true to allow responder termination
<ide> */
<del> handleResponderTerminationRequest: function() {
<add> handleResponderTerminationRequest: function(): bool {
<ide> // Allow touchable or props.onResponderTerminationRequest to deny
<ide> // the request
<ide> var allowTermination = this.touchableHandleResponderTerminationRequest();
<ide> var Text = React.createClass({
<ide> return allowTermination;
<ide> },
<ide>
<del> handleResponderGrant: function(e, dispatchID) {
<add> handleResponderGrant: function(e: SyntheticEvent, dispatchID: string) {
<ide> this.touchableHandleResponderGrant(e, dispatchID);
<ide> this.props.onResponderGrant &&
<ide> this.props.onResponderGrant.apply(this, arguments);
<ide> },
<ide>
<del> handleResponderMove: function(e) {
<add> handleResponderMove: function(e: SyntheticEvent) {
<ide> this.touchableHandleResponderMove(e);
<ide> this.props.onResponderMove &&
<ide> this.props.onResponderMove.apply(this, arguments);
<ide> },
<ide>
<del> handleResponderRelease: function(e) {
<add> handleResponderRelease: function(e: SyntheticEvent) {
<ide> this.touchableHandleResponderRelease(e);
<ide> this.props.onResponderRelease &&
<ide> this.props.onResponderRelease.apply(this, arguments);
<ide> },
<ide>
<del> handleResponderTerminate: function(e) {
<add> handleResponderTerminate: function(e: SyntheticEvent) {
<ide> this.touchableHandleResponderTerminate(e);
<ide> this.props.onResponderTerminate &&
<ide> this.props.onResponderTerminate.apply(this, arguments);
<ide> var Text = React.createClass({
<ide> this.props.onPress && this.props.onPress();
<ide> },
<ide>
<del> touchableGetPressRectOffset: function() {
<add> touchableGetPressRectOffset: function(): RectOffset {
<ide> return PRESS_RECT_OFFSET;
<ide> },
<ide>
<ide> var Text = React.createClass({
<ide> },
<ide> });
<ide>
<add>type RectOffset = {
<add> top: number;
<add> left: number;
<add> right: number;
<add> bottom: number;
<add>}
<add>
<ide> var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
<ide>
<ide> var RCTText = createReactIOSNativeComponentClass(viewConfig); | 10 |
Python | Python | add input_shape parameter to initial layer | 04ef5c2f3cc2ac899239d5f2b20de986a9153af1 | <ide><path>official/mnist/mnist.py
<ide> def create_model(data_format):
<ide> # (a subclass of tf.keras.Model) makes for a compact description.
<ide> return tf.keras.Sequential(
<ide> [
<del> l.Reshape(input_shape),
<add> l.Reshape(
<add> target_shape=input_shape,
<add> input_shape=(28 * 28,)),
<ide> l.Conv2D(
<ide> 32,
<ide> 5, | 1 |
Python | Python | remove unused import - bowlertool | 02b71f9e8e2d784d11cc57e630c262e560ed1dbe | <ide><path>backport_packages/setup_backport_packages.py
<ide> def change_import_paths_to_deprecated():
<ide> from bowler import LN, TOKEN, Capture, Filename, Query
<ide> from fissix.pytree import Leaf
<ide> from fissix.fixer_util import KeywordArg, Name, Comma
<del> from bowler import BowlerTool
<ide>
<ide> def remove_tags_modifier(node: LN, capture: Capture, filename: Filename) -> None:
<ide> for node in capture['function_arguments'][0].post_order(): | 1 |
Ruby | Ruby | add `shims_path` helper method | 2b6e58063694e2a676d647dfa247d61229623d62 | <ide><path>Library/Homebrew/extend/ENV/super.rb
<ide> def self.extended(base)
<ide> base.run_time_deps = []
<ide> end
<ide>
<add> # The location of Homebrew's shims on this OS.
<add> # @public
<add> sig { returns(Pathname) }
<add> def self.shims_path
<add> HOMEBREW_SHIMS_PATH/"super"
<add> end
<add>
<ide> # @private
<ide> sig { returns(T.nilable(Pathname)) }
<ide> def self.bin; end
<ide><path>Library/Homebrew/extend/os/linux/extend/ENV/super.rb
<ide> module Superenv
<ide> extend T::Sig
<ide>
<add> # The location of Homebrew's shims on Linux.
<add> # @public
<add> def self.shims_path
<add> HOMEBREW_SHIMS_PATH/"linux/super"
<add> end
<add>
<ide> # @private
<ide> def self.bin
<del> (HOMEBREW_SHIMS_PATH/"linux/super").realpath
<add> shims_path.realpath
<ide> end
<ide>
<ide> # @private
<ide><path>Library/Homebrew/extend/os/mac/extend/ENV/super.rb
<ide> module Superenv
<ide> extend T::Sig
<ide>
<ide> class << self
<add> # The location of Homebrew's shims on macOS.
<add> # @public
<add> def shims_path
<add> HOMEBREW_SHIMS_PATH/"mac/super"
<add> end
<add>
<ide> undef bin
<ide>
<ide> # @private
<ide> def bin
<ide> return unless DevelopmentTools.installed?
<ide>
<del> (HOMEBREW_SHIMS_PATH/"mac/super").realpath
<add> shims_path.realpath
<ide> end
<ide> end
<ide> | 3 |
Javascript | Javascript | add cb error test for fs.close() | e22efba812b2a6c2ee6d35f4e11af5b08afd881d | <ide><path>test/parallel/test-fs-close-errors.js
<ide> const fs = require('fs');
<ide> assert.throws(() => fs.close(input), errObj);
<ide> assert.throws(() => fs.closeSync(input), errObj);
<ide> });
<add>
<add>{
<add> // Test error when cb is not a function
<add> const fd = fs.openSync(__filename, 'r');
<add>
<add> const errObj = {
<add> code: 'ERR_INVALID_CALLBACK',
<add> name: 'TypeError'
<add> };
<add>
<add> ['', false, null, {}, []].forEach((input) => {
<add> assert.throws(() => fs.close(fd, input), errObj);
<add> });
<add>
<add> fs.closeSync(fd);
<add>} | 1 |
Python | Python | fix backprop of d_pad | e85e31cfbd43e88184ed08cb977e2acaf5752d86 | <ide><path>spacy/_ml.py
<ide> def _add_padding(self, Yf):
<ide>
<ide> def _backprop_padding(self, dY, ids):
<ide> # (1, nF, nO, nP) += (nN, nF, nO, nP) where IDs (nN, nF) < 0
<del> d_feats = dY[ids]
<del> ids = ids.reshape((ids.shape[0], ids.shape[1], 1, 1))
<del> d_feats *= ids < 0
<del> self.d_pad += d_feats.sum(axis=0, keepdims=True)
<add> for i in range(ids.shape[0]):
<add> for j in range(ids.shape[1]):
<add> if ids[i,j] < 0:
<add> self.d_pad[0,j] += dY[i, j]
<ide> return dY, ids
<ide>
<ide> @staticmethod | 1 |
Python | Python | add a todo comment | 09a4f8c7fc961e9bf536060533a4fd26c35004d8 | <ide><path>numpy/_array_api/_creation_functions.py
<ide> def asarray(obj: Union[Array, bool, int, float, NestedSequence[bool|int|float],
<ide> return obj
<ide> if dtype is None and isinstance(obj, int) and (obj > 2**64 or obj < -2**63):
<ide> # Give a better error message in this case. NumPy would convert this
<del> # to an object array.
<add> # to an object array. TODO: This won't handle large integers in lists.
<ide> raise OverflowError("Integer out of bounds for array dtypes")
<ide> res = np.asarray(obj, dtype=dtype)
<ide> return Array._new(res) | 1 |
Javascript | Javascript | add tests for transition delay and duration | 5764e49992131dae7f572a5dcacd1e5110deb63b | <ide><path>test/core/transition-test-delay.js
<add>require("../env");
<add>require("../../d3");
<add>
<add>var assert = require("assert");
<add>
<add>module.exports = {
<add> topic: function() {
<add> return d3.select("body").selectAll()
<add> .data(["foo", "bar"])
<add> .enter().append("div")
<add> .attr("class", String);
<add> },
<add> "defaults to zero": function(selection) {
<add> var t = selection.transition();
<add> assert.strictEqual(t[0][0].delay, 0);
<add> assert.strictEqual(t[0][1].delay, 0);
<add> },
<add> "can specify delay as a number": function(selection) {
<add> var t = selection.transition().delay(150);
<add> assert.strictEqual(t[0][0].delay, 150);
<add> assert.strictEqual(t[0][1].delay, 150);
<add> t.delay(250);
<add> assert.strictEqual(t[0][0].delay, 250);
<add> assert.strictEqual(t[0][1].delay, 250);
<add> },
<add> "can specify delay as a function": function(selection) {
<add> var dd = [], ii = [], tt = [], t = selection.transition().delay(f);
<add> function f(d, i) { dd.push(d); ii.push(i); tt.push(this); return i * 20; }
<add> assert.strictEqual(t[0][0].delay, 0);
<add> assert.strictEqual(t[0][1].delay, 20);
<add> assert.deepEqual(dd, ["foo", "bar"], "expected data, got {actual}");
<add> assert.deepEqual(ii, [0, 1], "expected index, got {actual}");
<add> assert.domEqual(tt[0], t[0][0].node, "expected this, got {actual}");
<add> assert.domEqual(tt[1], t[0][1].node, "expected this, got {actual}");
<add> },
<add> "coerces delay to a number": function(selection) {
<add> var t = selection.transition().delay("150");
<add> assert.strictEqual(t[0][0].delay, 150);
<add> assert.strictEqual(t[0][1].delay, 150);
<add> }
<add>};
<ide><path>test/core/transition-test-duration.js
<add>require("../env");
<add>require("../../d3");
<add>
<add>var assert = require("assert");
<add>
<add>module.exports = {
<add> topic: function() {
<add> return d3.select("body").selectAll()
<add> .data(["foo", "bar"])
<add> .enter().append("div")
<add> .attr("class", String);
<add> },
<add> "defaults to 250 milliseconds": function(selection) {
<add> var t = selection.transition();
<add> assert.strictEqual(t[0][0].duration, 250);
<add> assert.strictEqual(t[0][1].duration, 250);
<add> },
<add> "can specify duration as a number": function(selection) {
<add> var t = selection.transition().duration(150);
<add> assert.strictEqual(t[0][0].duration, 150);
<add> assert.strictEqual(t[0][1].duration, 150);
<add> t.duration(50);
<add> assert.strictEqual(t[0][0].duration, 50);
<add> assert.strictEqual(t[0][1].duration, 50);
<add> },
<add> "can specify duration as a function": function(selection) {
<add> var dd = [], ii = [], tt = [], t = selection.transition().duration(f);
<add> function f(d, i) { dd.push(d); ii.push(i); tt.push(this); return i * 20; }
<add> assert.strictEqual(t[0][0].duration, 0);
<add> assert.strictEqual(t[0][1].duration, 20);
<add> assert.deepEqual(dd, ["foo", "bar"], "expected data, got {actual}");
<add> assert.deepEqual(ii, [0, 1], "expected index, got {actual}");
<add> assert.domEqual(tt[0], t[0][0].node, "expected this, got {actual}");
<add> assert.domEqual(tt[1], t[0][1].node, "expected this, got {actual}");
<add> },
<add> "coerces duration to a number": function(selection) {
<add> var t = selection.transition().duration("150");
<add> assert.strictEqual(t[0][0].duration, 150);
<add> assert.strictEqual(t[0][1].duration, 150);
<add> }
<add>};
<ide><path>test/core/transition-test.js
<ide> suite.export(module);
<ide> var suite = vows.describe("transition");
<ide>
<ide> suite.addBatch({
<del> "each": require("./transition-test-each"),
<add>
<add> // Subtransitions
<add> // select
<add> // selectAll
<add>
<add> // Content
<ide> "attr": require("./transition-test-attr"),
<del> "style": require("./transition-test-style")
<add> "style": require("./transition-test-style"),
<add> // text
<add> // remove
<add>
<add> // Animation
<add> "delay": require("./transition-test-delay"),
<add> "duration": require("./transition-test-duration"),
<add>
<add> // Control
<add> "each": require("./transition-test-each")
<add> // tween
<add> // call
<add>
<ide> });
<ide>
<ide> suite.export(module); | 3 |
Go | Go | add libtrust key identity management | ea6a480128316be5494284dbb688b58bd65e6f63 | <ide><path>api/client/cli.go
<ide> import (
<ide> flag "github.com/docker/docker/pkg/mflag"
<ide> "github.com/docker/docker/pkg/term"
<ide> "github.com/docker/docker/registry"
<add> "github.com/docker/libtrust"
<ide> )
<ide>
<ide> type DockerCli struct {
<ide> type DockerCli struct {
<ide> in io.ReadCloser
<ide> out io.Writer
<ide> err io.Writer
<add> key libtrust.PrivateKey
<ide> tlsConfig *tls.Config
<ide> scheme string
<ide> // inFd holds file descriptor of the client's STDIN, if it's a valid file
<ide> func (cli *DockerCli) LoadConfigFile() (err error) {
<ide> return err
<ide> }
<ide>
<del>func NewDockerCli(in io.ReadCloser, out, err io.Writer, proto, addr string, tlsConfig *tls.Config) *DockerCli {
<add>func NewDockerCli(in io.ReadCloser, out, err io.Writer, key libtrust.PrivateKey, proto, addr string, tlsConfig *tls.Config) *DockerCli {
<ide> var (
<ide> inFd uintptr
<ide> outFd uintptr
<ide> func NewDockerCli(in io.ReadCloser, out, err io.Writer, proto, addr string, tlsC
<ide> in: in,
<ide> out: out,
<ide> err: err,
<add> key: key,
<ide> inFd: inFd,
<ide> outFd: outFd,
<ide> isTerminalIn: isTerminalIn,
<ide><path>docker/daemon.go
<ide> func mainDaemon() {
<ide> job.Setenv("TlsCa", *flCa)
<ide> job.Setenv("TlsCert", *flCert)
<ide> job.Setenv("TlsKey", *flKey)
<add> job.Setenv("TrustKey", *flTrustKey)
<ide> job.SetenvBool("BufferRequests", true)
<ide> if err := job.Run(); err != nil {
<ide> log.Fatal(err)
<ide><path>docker/docker.go
<ide> import (
<ide> "io/ioutil"
<ide> "log"
<ide> "os"
<add> "path"
<ide> "strings"
<ide>
<ide> "github.com/docker/docker/api"
<ide> import (
<ide> flag "github.com/docker/docker/pkg/mflag"
<ide> "github.com/docker/docker/reexec"
<ide> "github.com/docker/docker/utils"
<add> "github.com/docker/libtrust"
<ide> )
<ide>
<ide> const (
<del> defaultCaFile = "ca.pem"
<del> defaultKeyFile = "key.pem"
<del> defaultCertFile = "cert.pem"
<add> defaultTrustKeyFile = "key.json"
<add> defaultCaFile = "ca.pem"
<add> defaultKeyFile = "key.pem"
<add> defaultCertFile = "cert.pem"
<ide> )
<ide>
<ide> func main() {
<ide> func main() {
<ide> }
<ide> protoAddrParts := strings.SplitN(flHosts[0], "://", 2)
<ide>
<add> err := os.MkdirAll(path.Dir(*flTrustKey), 0700)
<add> if err != nil {
<add> log.Fatal(err)
<add> }
<add> trustKey, keyErr := libtrust.LoadKeyFile(*flTrustKey)
<add> if keyErr == libtrust.ErrKeyFileDoesNotExist {
<add> trustKey, keyErr = libtrust.GenerateECP256PrivateKey()
<add> if keyErr == nil {
<add> keyErr = libtrust.SaveKey(*flTrustKey, trustKey)
<add> }
<add> }
<add> if keyErr != nil {
<add> log.Fatal(keyErr)
<add> }
<ide> var (
<ide> cli *client.DockerCli
<ide> tlsConfig tls.Config
<ide> func main() {
<ide> }
<ide>
<ide> if *flTls || *flTlsVerify {
<del> cli = client.NewDockerCli(os.Stdin, os.Stdout, os.Stderr, protoAddrParts[0], protoAddrParts[1], &tlsConfig)
<add> cli = client.NewDockerCli(os.Stdin, os.Stdout, os.Stderr, trustKey, protoAddrParts[0], protoAddrParts[1], &tlsConfig)
<ide> } else {
<del> cli = client.NewDockerCli(os.Stdin, os.Stdout, os.Stderr, protoAddrParts[0], protoAddrParts[1], nil)
<add> cli = client.NewDockerCli(os.Stdin, os.Stdout, os.Stderr, trustKey, protoAddrParts[0], protoAddrParts[1], nil)
<ide> }
<ide>
<ide> if err := cli.Cmd(flag.Args()...); err != nil {
<ide><path>docker/flags.go
<ide> var (
<ide> flTlsVerify = flag.Bool([]string{"-tlsverify"}, false, "Use TLS and verify the remote (daemon: verify client, client: verify daemon)")
<ide>
<ide> // these are initialized in init() below since their default values depend on dockerCertPath which isn't fully initialized until init() runs
<del> flCa *string
<del> flCert *string
<del> flKey *string
<del> flHosts []string
<add> flTrustKey *string
<add> flCa *string
<add> flCert *string
<add> flKey *string
<add> flHosts []string
<ide> )
<ide>
<ide> func init() {
<add> // placeholder for trust key flag
<add> trustKeyDefault := filepath.Join(dockerCertPath, defaultTrustKeyFile)
<add> flTrustKey = &trustKeyDefault
<add>
<ide> flCa = flag.String([]string{"-tlscacert"}, filepath.Join(dockerCertPath, defaultCaFile), "Trust only remotes providing a certificate signed by the CA given here")
<ide> flCert = flag.String([]string{"-tlscert"}, filepath.Join(dockerCertPath, defaultCertFile), "Path to TLS certificate file")
<ide> flKey = flag.String([]string{"-tlskey"}, filepath.Join(dockerCertPath, defaultKeyFile), "Path to TLS key file")
<ide><path>integration/commands_test.go
<ide> import (
<ide> "github.com/docker/docker/pkg/log"
<ide> "github.com/docker/docker/pkg/term"
<ide> "github.com/docker/docker/utils"
<add> "github.com/docker/libtrust"
<ide> )
<ide>
<ide> func closeWrap(args ...io.Closer) error {
<ide> func TestRunDisconnect(t *testing.T) {
<ide>
<ide> stdin, stdinPipe := io.Pipe()
<ide> stdout, stdoutPipe := io.Pipe()
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<ide>
<del> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
<add> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, key, testDaemonProto, testDaemonAddr, nil)
<ide> defer cleanup(globalEngine, t)
<ide>
<ide> c1 := make(chan struct{})
<ide> func TestRunDisconnectTty(t *testing.T) {
<ide>
<ide> stdin, stdinPipe := io.Pipe()
<ide> stdout, stdoutPipe := io.Pipe()
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<ide>
<del> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
<add> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, key, testDaemonProto, testDaemonAddr, nil)
<ide> defer cleanup(globalEngine, t)
<ide>
<ide> c1 := make(chan struct{})
<ide> func TestRunDetach(t *testing.T) {
<ide>
<ide> stdin, stdinPipe := io.Pipe()
<ide> stdout, stdoutPipe := io.Pipe()
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<ide>
<del> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
<add> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, key, testDaemonProto, testDaemonAddr, nil)
<ide> defer cleanup(globalEngine, t)
<ide>
<ide> ch := make(chan struct{})
<ide> func TestRunDetach(t *testing.T) {
<ide> func TestAttachDetach(t *testing.T) {
<ide> stdin, stdinPipe := io.Pipe()
<ide> stdout, stdoutPipe := io.Pipe()
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<ide>
<del> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
<add> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, key, testDaemonProto, testDaemonAddr, nil)
<ide> defer cleanup(globalEngine, t)
<ide>
<ide> ch := make(chan struct{})
<ide> func TestAttachDetach(t *testing.T) {
<ide>
<ide> stdin, stdinPipe = io.Pipe()
<ide> stdout, stdoutPipe = io.Pipe()
<del> cli = client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
<add> cli = client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, key, testDaemonProto, testDaemonAddr, nil)
<ide>
<ide> ch = make(chan struct{})
<ide> go func() {
<ide> func TestAttachDetach(t *testing.T) {
<ide> func TestAttachDetachTruncatedID(t *testing.T) {
<ide> stdin, stdinPipe := io.Pipe()
<ide> stdout, stdoutPipe := io.Pipe()
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<ide>
<del> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
<add> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, key, testDaemonProto, testDaemonAddr, nil)
<ide> defer cleanup(globalEngine, t)
<ide>
<ide> // Discard the CmdRun output
<ide> func TestAttachDetachTruncatedID(t *testing.T) {
<ide>
<ide> stdin, stdinPipe = io.Pipe()
<ide> stdout, stdoutPipe = io.Pipe()
<del> cli = client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
<add> cli = client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, key, testDaemonProto, testDaemonAddr, nil)
<ide>
<ide> ch := make(chan struct{})
<ide> go func() {
<ide> func TestAttachDetachTruncatedID(t *testing.T) {
<ide> func TestAttachDisconnect(t *testing.T) {
<ide> stdin, stdinPipe := io.Pipe()
<ide> stdout, stdoutPipe := io.Pipe()
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<ide>
<del> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
<add> cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, key, testDaemonProto, testDaemonAddr, nil)
<ide> defer cleanup(globalEngine, t)
<ide>
<ide> go func() {
<ide> func TestAttachDisconnect(t *testing.T) {
<ide>
<ide> // We closed stdin, expect /bin/cat to still be running
<ide> // Wait a little bit to make sure container.monitor() did his thing
<del> _, err := container.WaitStop(500 * time.Millisecond)
<add> _, err = container.WaitStop(500 * time.Millisecond)
<ide> if err == nil || !container.IsRunning() {
<ide> t.Fatalf("/bin/cat is not running after closing stdin")
<ide> }
<ide> func TestAttachDisconnect(t *testing.T) {
<ide> func TestRunAutoRemove(t *testing.T) {
<ide> t.Skip("Fixme. Skipping test for now, race condition")
<ide> stdout, stdoutPipe := io.Pipe()
<del> cli := client.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> cli := client.NewDockerCli(nil, stdoutPipe, ioutil.Discard, key, testDaemonProto, testDaemonAddr, nil)
<ide> defer cleanup(globalEngine, t)
<ide>
<ide> c := make(chan struct{})
<ide> func TestRunAutoRemove(t *testing.T) {
<ide>
<ide> // Expected behaviour: error out when attempting to bind mount non-existing source paths
<ide> func TestRunErrorBindNonExistingSource(t *testing.T) {
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<ide>
<del> cli := client.NewDockerCli(nil, nil, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
<add> cli := client.NewDockerCli(nil, nil, ioutil.Discard, key, testDaemonProto, testDaemonAddr, nil)
<ide> defer cleanup(globalEngine, t)
<ide>
<ide> c := make(chan struct{})
<ide><path>integration/https_test.go
<ide> import (
<ide> "time"
<ide>
<ide> "github.com/docker/docker/api/client"
<add> "github.com/docker/libtrust"
<ide> )
<ide>
<ide> const (
<ide> func getTlsConfig(certFile, keyFile string, t *testing.T) *tls.Config {
<ide>
<ide> // TestHttpsInfo connects via two-way authenticated HTTPS to the info endpoint
<ide> func TestHttpsInfo(t *testing.T) {
<del> cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto,
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, key, testDaemonProto,
<ide> testDaemonHttpsAddr, getTlsConfig("client-cert.pem", "client-key.pem", t))
<ide>
<ide> setTimeout(t, "Reading command output time out", 10*time.Second, func() {
<ide> func TestHttpsInfo(t *testing.T) {
<ide> // TestHttpsInfoRogueCert connects via two-way authenticated HTTPS to the info endpoint
<ide> // by using a rogue client certificate and checks that it fails with the expected error.
<ide> func TestHttpsInfoRogueCert(t *testing.T) {
<del> cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto,
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, key, testDaemonProto,
<ide> testDaemonHttpsAddr, getTlsConfig("client-rogue-cert.pem", "client-rogue-key.pem", t))
<ide>
<ide> setTimeout(t, "Reading command output time out", 10*time.Second, func() {
<ide> func TestHttpsInfoRogueCert(t *testing.T) {
<ide> // TestHttpsInfoRogueServerCert connects via two-way authenticated HTTPS to the info endpoint
<ide> // which provides a rogue server certificate and checks that it fails with the expected error
<ide> func TestHttpsInfoRogueServerCert(t *testing.T) {
<del> cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto,
<add> key, err := libtrust.GenerateECP256PrivateKey()
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, key, testDaemonProto,
<ide> testDaemonRogueHttpsAddr, getTlsConfig("client-cert.pem", "client-key.pem", t))
<ide>
<ide> setTimeout(t, "Reading command output time out", 10*time.Second, func() { | 6 |
Ruby | Ruby | replace `hbc.load` with `caskloader.load` | ed10135da4fbabca2798afe949b6f5af9544ec9f | <ide><path>Library/Homebrew/cask/lib/hbc.rb
<ide> def self.init
<ide> Cache.ensure_cache_exists
<ide> Caskroom.ensure_caskroom_exists
<ide> end
<del>
<del> def self.load(ref)
<del> CaskLoader.load(ref)
<del> end
<ide> end
<ide><path>Library/Homebrew/cask/lib/hbc/cask_dependencies.rb
<ide> def graph_dependencies
<ide> walk = lambda do |acc, deps|
<ide> deps.each do |dep|
<ide> next if acc.key?(dep)
<del> succs = deps_in.call Hbc.load(dep)
<add> succs = deps_in.call CaskLoader.load(dep)
<ide> acc[dep] = succs
<ide> walk.call(acc, succs)
<ide> end
<ide><path>Library/Homebrew/cask/lib/hbc/cli/audit.rb
<ide> def casks_to_audit
<ide> if cask_tokens.empty?
<ide> Hbc.all
<ide> else
<del> cask_tokens.map { |token| Hbc.load(token) }
<add> cask_tokens.map { |token| CaskLoader.load(token) }
<ide> end
<ide> end
<ide>
<ide><path>Library/Homebrew/cask/lib/hbc/cli/fetch.rb
<ide> def self.run(*args)
<ide>
<ide> cask_tokens.each do |cask_token|
<ide> ohai "Downloading external files for Cask #{cask_token}"
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide> downloaded_path = Download.new(cask, force: force).perform
<ide> Verify.all(cask, downloaded_path)
<ide> ohai "Success! Downloaded to -> #{downloaded_path}"
<ide><path>Library/Homebrew/cask/lib/hbc/cli/home.rb
<ide> def self.run(*cask_tokens)
<ide> else
<ide> cask_tokens.each do |cask_token|
<ide> odebug "Opening homepage for Cask #{cask_token}"
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide> system "/usr/bin/open", "--", cask.homepage
<ide> end
<ide> end
<ide><path>Library/Homebrew/cask/lib/hbc/cli/info.rb
<ide> def self.run(*args)
<ide> raise CaskUnspecifiedError if cask_tokens.empty?
<ide> cask_tokens.each do |cask_token|
<ide> odebug "Getting info for Cask #{cask_token}"
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide>
<ide> info(cask)
<ide> end
<ide><path>Library/Homebrew/cask/lib/hbc/cli/install.rb
<ide> def self.install_casks(cask_tokens, force, skip_cask_deps, require_sha)
<ide> count = 0
<ide> cask_tokens.each do |cask_token|
<ide> begin
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide> Installer.new(cask,
<ide> force: force,
<ide> skip_cask_deps: skip_cask_deps,
<ide><path>Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb
<ide> def self.appcask_checkpoint(cask_tokens, calculate)
<ide> count = 0
<ide>
<ide> cask_tokens.each do |cask_token|
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide>
<ide> if cask.appcast.nil?
<ide> opoo "Cask '#{cask}' is missing an `appcast` stanza."
<ide><path>Library/Homebrew/cask/lib/hbc/cli/internal_audit_modified_casks.rb
<ide> def git_filter_cask_files(filter)
<ide>
<ide> def modified_casks
<ide> return @modified_casks if defined? @modified_casks
<del> @modified_casks = modified_cask_files.map { |f| Hbc.load(f) }
<add> @modified_casks = modified_cask_files.map { |f| CaskLoader.load(f) }
<ide> if @modified_casks.any?
<ide> num_modified = @modified_casks.size
<ide> ohai "#{Formatter.pluralize(num_modified, "modified cask")}: " \
<ide><path>Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb
<ide> module Hbc
<ide> class CLI
<ide> class InternalCheckurl < InternalUseBase
<ide> def self.run(*args)
<del> casks_to_check = args.empty? ? Hbc.all : args.map { |arg| Hbc.load(arg) }
<add> casks_to_check = args.empty? ? Hbc.all : args.map { |arg| CaskLoader.load(arg) }
<ide> casks_to_check.each do |cask|
<ide> odebug "Checking URL for Cask #{cask}"
<ide> checker = UrlChecker.new(cask)
<ide><path>Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb
<ide> def self.dump_casks(*cask_tokens)
<ide> count = 0
<ide> cask_tokens.each do |cask_token|
<ide> begin
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide> count += 1
<ide> cask.dumpcask
<ide> rescue StandardError => e
<ide><path>Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
<ide> def self.print_stanzas(stanza, format = nil, table = nil, quiet = nil, *cask_tok
<ide> print "#{cask_token}\t" if table
<ide>
<ide> begin
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide> rescue StandardError
<ide> opoo "Cask '#{cask_token}' was not found" unless quiet
<ide> puts ""
<ide><path>Library/Homebrew/cask/lib/hbc/cli/list.rb
<ide> def self.list(*cask_tokens)
<ide> cask_tokens.each do |cask_token|
<ide> odebug "Listing files for Cask #{cask_token}"
<ide> begin
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide>
<ide> if cask.installed?
<ide> if @options[:one]
<ide><path>Library/Homebrew/cask/lib/hbc/cli/outdated.rb
<ide> def self.run(*args)
<ide> casks_to_check = if cask_tokens.empty?
<ide> Hbc.installed
<ide> else
<del> cask_tokens.map { |token| Hbc.load(token) }
<add> cask_tokens.map { |token| CaskLoader.load(token) }
<ide> end
<ide>
<ide> casks_to_check.each do |cask|
<ide><path>Library/Homebrew/cask/lib/hbc/cli/reinstall.rb
<ide> def self.install_casks(cask_tokens, force, skip_cask_deps, require_sha)
<ide> count = 0
<ide> cask_tokens.each do |cask_token|
<ide> begin
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide>
<ide> installer = Installer.new(cask,
<ide> force: force,
<ide><path>Library/Homebrew/cask/lib/hbc/cli/uninstall.rb
<ide> def self.run(*args)
<ide>
<ide> cask_tokens.each do |cask_token|
<ide> odebug "Uninstalling Cask #{cask_token}"
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide>
<ide> raise CaskNotInstalledError, cask unless cask.installed? || force
<ide>
<ide><path>Library/Homebrew/cask/lib/hbc/cli/zap.rb
<ide> def self.run(*args)
<ide> raise CaskUnspecifiedError if cask_tokens.empty?
<ide> cask_tokens.each do |cask_token|
<ide> odebug "Zapping Cask #{cask_token}"
<del> cask = Hbc.load(cask_token)
<add> cask = CaskLoader.load(cask_token)
<ide> Installer.new(cask).zap
<ide> end
<ide> end
<ide><path>Library/Homebrew/cask/lib/hbc/installer.rb
<ide> def cask_dependencies
<ide> deps = CaskDependencies.new(@cask)
<ide> deps.sorted.each do |dep_token|
<ide> puts "#{dep_token} ..."
<del> dep = Hbc.load(dep_token)
<add> dep = CaskLoader.load(dep_token)
<ide> if dep.installed?
<ide> puts "already installed"
<ide> else
<ide><path>Library/Homebrew/cask/lib/hbc/scopes.rb
<ide> def all_tokens
<ide> end
<ide>
<ide> def installed
<del> # Hbc.load has some DWIM which is slow. Optimize here
<del> # by spoon-feeding Hbc.load fully-qualified paths.
<add> # CaskLoader.load has some DWIM which is slow. Optimize here
<add> # by spoon-feeding CaskLoader.load fully-qualified paths.
<ide> # TODO: speed up Hbc::Source::Tapped (main perf drag is calling Hbc.all_tokens repeatedly)
<del> # TODO: ability to specify expected source when calling Hbc.load (minor perf benefit)
<add> # TODO: ability to specify expected source when calling CaskLoader.load (minor perf benefit)
<ide> Pathname.glob(caskroom.join("*"))
<ide> .map do |caskroom_path|
<ide> token = caskroom_path.basename.to_s
<ide> def installed
<ide> end
<ide>
<ide> if path_to_cask
<del> Hbc.load(path_to_cask.join("#{token}.rb"))
<add> CaskLoader.load(path_to_cask.join("#{token}.rb"))
<ide> else
<del> Hbc.load(token)
<add> CaskLoader.load(token)
<ide> end
<ide> end
<ide> end
<ide><path>Library/Homebrew/test/cask/audit_spec.rb
<ide> def include_msg?(messages, msg)
<ide> end
<ide>
<ide> describe "#run!" do
<del> let(:cask) { Hbc.load(cask_token) }
<add> let(:cask) { Hbc::CaskLoader.load(cask_token) }
<ide> subject { audit.run! }
<ide>
<ide> describe "required stanzas" do
<ide> def include_msg?(messages, msg)
<ide>
<ide> describe "audit of downloads" do
<ide> let(:cask_token) { "with-binary" }
<del> let(:cask) { Hbc.load(cask_token) }
<add> let(:cask) { Hbc::CaskLoader.load(cask_token) }
<ide> let(:download) { instance_double(Hbc::Download) }
<ide> let(:verify) { class_double(Hbc::Verify).as_stubbed_const }
<ide> let(:error_msg) { "Download Failed" }
<ide><path>Library/Homebrew/test/cask/cask_spec.rb
<ide> let(:relative_tap_path) { tap_path.relative_path_from(file_dirname) }
<ide>
<ide> it "returns an instance of the Cask for the given token" do
<del> c = Hbc.load("local-caffeine")
<add> c = Hbc::CaskLoader.load("local-caffeine")
<ide> expect(c).to be_kind_of(Hbc::Cask)
<ide> expect(c.token).to eq("local-caffeine")
<ide> end
<ide>
<ide> it "returns an instance of the Cask from a specific file location" do
<del> c = Hbc.load("#{tap_path}/Casks/local-caffeine.rb")
<add> c = Hbc::CaskLoader.load("#{tap_path}/Casks/local-caffeine.rb")
<ide> expect(c).to be_kind_of(Hbc::Cask)
<ide> expect(c.token).to eq("local-caffeine")
<ide> end
<ide>
<ide> it "returns an instance of the Cask from a url" do
<ide> c = shutup do
<del> Hbc.load("file://#{tap_path}/Casks/local-caffeine.rb")
<add> Hbc::CaskLoader.load("file://#{tap_path}/Casks/local-caffeine.rb")
<ide> end
<ide> expect(c).to be_kind_of(Hbc::Cask)
<ide> expect(c.token).to eq("local-caffeine")
<ide> expect {
<ide> url = "file://#{tap_path}/Casks/notacask.rb"
<ide> shutup do
<del> Hbc.load(url)
<add> Hbc::CaskLoader.load(url)
<ide> end
<ide> }.to raise_error(Hbc::CaskUnavailableError)
<ide> end
<ide>
<ide> it "returns an instance of the Cask from a relative file location" do
<del> c = Hbc.load(relative_tap_path/"Casks/local-caffeine.rb")
<add> c = Hbc::CaskLoader.load(relative_tap_path/"Casks/local-caffeine.rb")
<ide> expect(c).to be_kind_of(Hbc::Cask)
<ide> expect(c.token).to eq("local-caffeine")
<ide> end
<ide>
<ide> it "uses exact match when loading by token" do
<del> expect(Hbc.load("test-opera").token).to eq("test-opera")
<del> expect(Hbc.load("test-opera-mail").token).to eq("test-opera-mail")
<add> expect(Hbc::CaskLoader.load("test-opera").token).to eq("test-opera")
<add> expect(Hbc::CaskLoader.load("test-opera-mail").token).to eq("test-opera-mail")
<ide> end
<ide>
<ide> it "raises an error when attempting to load a Cask that doesn't exist" do
<ide> expect {
<del> Hbc.load("notacask")
<add> Hbc::CaskLoader.load("notacask")
<ide> }.to raise_error(Hbc::CaskUnavailableError)
<ide> end
<ide> end
<ide> describe "metadata" do
<ide> it "proposes a versioned metadata directory name for each instance" do
<ide> cask_token = "local-caffeine"
<del> c = Hbc.load(cask_token)
<add> c = Hbc::CaskLoader.load(cask_token)
<ide> metadata_path = Hbc.caskroom.join(cask_token, ".metadata", c.version)
<ide> expect(c.metadata_versioned_container_path.to_s).to eq(metadata_path.to_s)
<ide> end
<ide> end
<ide>
<ide> describe "outdated" do
<ide> it "ignores the Casks that have auto_updates true (without --greedy)" do
<del> c = Hbc.load("auto-updates")
<add> c = Hbc::CaskLoader.load("auto-updates")
<ide> expect(c).not_to be_outdated
<ide> expect(c.outdated_versions).to be_empty
<ide> end
<ide>
<ide> it "ignores the Casks that have version :latest (without --greedy)" do
<del> c = Hbc.load("version-latest-string")
<add> c = Hbc::CaskLoader.load("version-latest-string")
<ide> expect(c).not_to be_outdated
<ide> expect(c.outdated_versions).to be_empty
<ide> end
<ide><path>Library/Homebrew/test/cask/cli/audit_spec.rb
<ide>
<ide> it "audits specified Casks if tokens are given" do
<ide> cask_token = "nice-app"
<del> expect(Hbc).to receive(:load).with(cask_token).and_return(cask)
<add> expect(Hbc::CaskLoader).to receive(:load).with(cask_token).and_return(cask)
<ide>
<ide> expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
<ide>
<ide>
<ide> describe "rules for downloading a Cask" do
<ide> it "does not download the Cask per default" do
<del> allow(Hbc).to receive(:load).and_return(cask)
<add> allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
<ide> expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
<ide>
<ide> run_audit(["casktoken"], auditor)
<ide> end
<ide>
<ide> it "download a Cask if --download flag is set" do
<del> allow(Hbc).to receive(:load).and_return(cask)
<add> allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
<ide> expect(auditor).to receive(:audit).with(cask, audit_download: true, check_token_conflicts: false)
<ide>
<ide> run_audit(["casktoken", "--download"], auditor)
<ide>
<ide> describe "rules for checking token conflicts" do
<ide> it "does not check for token conflicts per default" do
<del> allow(Hbc).to receive(:load).and_return(cask)
<add> allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
<ide> expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
<ide>
<ide> run_audit(["casktoken"], auditor)
<ide> end
<ide>
<ide> it "checks for token conflicts if --token-conflicts flag is set" do
<del> allow(Hbc).to receive(:load).and_return(cask)
<add> allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
<ide> expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: true)
<ide>
<ide> run_audit(["casktoken", "--token-conflicts"], auditor)
<ide><path>Library/Homebrew/test/cask/cli/list_spec.rb
<ide> describe Hbc::CLI::List, :cask do
<ide> it "lists the installed Casks in a pretty fashion" do
<del> casks = %w[local-caffeine local-transmission].map { |c| Hbc.load(c) }
<add> casks = %w[local-caffeine local-transmission].map { |c| Hbc::CaskLoader.load(c) }
<ide>
<ide> casks.each do |c|
<ide> InstallHelper.install_with_caskfile(c)
<ide> }
<ide>
<ide> before(:each) do
<del> casks.map(&Hbc.method(:load)).each(&InstallHelper.method(:install_with_caskfile))
<add> casks.map(&Hbc::CaskLoader.method(:load)).each(&InstallHelper.method(:install_with_caskfile))
<ide> end
<ide>
<ide> it "of all installed Casks" do
<ide><path>Library/Homebrew/test/cask/cli/zap_spec.rb
<ide> # The above tests that implicitly.
<ide> #
<ide> # it "dispatches both uninstall and zap stanzas" do
<del> # with_zap = Hbc.load('with-zap')
<add> # with_zap = Hbc::CaskLoader.load('with-zap')
<ide> #
<ide> # shutup do
<ide> # Hbc::Installer.new(with_zap).install
<ide><path>Library/Homebrew/test/cask/depends_on_spec.rb
<ide>
<ide> context do
<ide> let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask.rb") }
<del> let(:dependency) { Hbc.load(cask.depends_on.cask.first) }
<add> let(:dependency) { Hbc::CaskLoader.load(cask.depends_on.cask.first) }
<ide>
<ide> it "installs the dependency of a Cask and the Cask itself" do
<ide> expect(subject).not_to raise_error
<ide><path>Library/Homebrew/test/cask/download_strategy_spec.rb
<ide> # does not work yet, because (for unknown reasons), the tar command
<ide> # returns an error code when running under the test suite
<ide> # it 'creates a tarball matching the expected checksum' do
<del> # cask = Hbc.load('svn-download-check-cask')
<add> # cask = Hbc::CaskLoader.load('svn-download-check-cask')
<ide> # downloader = Hbc::SubversionDownloadStrategy.new(cask)
<ide> # # special mocking required for tar to have something to work with
<ide> # def downloader.fetch_repo(target, url, revision = nil, ignore_externals=false)
<ide><path>Library/Homebrew/test/cask/scopes_spec.rb
<ide> describe Hbc::Scopes, :cask do
<ide> describe "installed" do
<ide> it "returns a list installed Casks by loading Casks for all the dirs that exist in the caskroom" do
<del> allow(Hbc).to receive(:load) { |token| "loaded-#{token}" }
<add> allow(Hbc::CaskLoader).to receive(:load) { |token| "loaded-#{token}" }
<ide>
<ide> Hbc.caskroom.join("cask-bar").mkpath
<ide> Hbc.caskroom.join("cask-foo").mkpath
<ide>
<ide> installed_casks = Hbc.installed
<ide>
<del> expect(Hbc).to have_received(:load).with("cask-bar")
<del> expect(Hbc).to have_received(:load).with("cask-foo")
<add> expect(Hbc::CaskLoader).to have_received(:load).with("cask-bar")
<add> expect(Hbc::CaskLoader).to have_received(:load).with("cask-foo")
<ide> expect(installed_casks).to eq(
<ide> %w[
<ide> loaded-cask-bar
<ide> )
<ide> end
<ide>
<del> it "optimizes performance by resolving to a fully qualified path before calling Hbc.load" do
<add> it "optimizes performance by resolving to a fully qualified path before calling Hbc::CaskLoader.load" do
<ide> fake_tapped_cask_dir = Pathname.new(Dir.mktmpdir).join("Casks")
<ide> absolute_path_to_cask = fake_tapped_cask_dir.join("some-cask.rb")
<ide>
<del> allow(Hbc).to receive(:load)
<add> allow(Hbc::CaskLoader).to receive(:load)
<ide> allow(Hbc).to receive(:all_tapped_cask_dirs) { [fake_tapped_cask_dir] }
<ide>
<ide> Hbc.caskroom.join("some-cask").mkdir
<ide>
<ide> Hbc.installed
<ide>
<del> expect(Hbc).to have_received(:load).with(absolute_path_to_cask)
<add> expect(Hbc::CaskLoader).to have_received(:load).with(absolute_path_to_cask)
<ide> end
<ide> end
<ide> end | 27 |
Python | Python | fix typo preventing from launching webserver | 8cb035a7cdd6276c2cdb29882ceadd41ae3d5189 | <ide><path>airflow/bin/cli.py
<ide> class CLIFactory(object):
<ide> 'dag_id', 'task_id', 'execution_date', 'subdir', 'dry_run',
<ide> 'task_params'),
<ide> }, {
<del> 'func': scheduler,
<add> 'func': webserver,
<ide> 'help': "Start a Airflow webserver instance",
<ide> 'args': ('port', 'workers', 'workerclass', 'hostname', 'debug'),
<ide> }, { | 1 |
Javascript | Javascript | allow changing transitionleave from false to true | 5e6e332d677df00b2d97b7caabfe5789b50a28ca | <ide><path>src/addons/transitions/ReactTransitionGroup.js
<ide> var ReactTransitionGroup = React.createClass({
<ide> enter: this.props.transitionEnter,
<ide> onDoneLeaving: this._handleDoneLeaving.bind(this, key)
<ide> }, childMapping[key]);
<add> } else {
<add> // If there's no leave transition and the child has been removed from
<add> // the source children list, we want to remove it immediately from the
<add> // _transitionGroupCurrentKeys cache because _handleDoneLeaving won't
<add> // be called. In normal cases, this prevents a small memory leak; in
<add> // the case of switching transitionLeave from false to true, it
<add> // prevents a confusing bug where ReactTransitionableChild.render()
<add> // returns nothing, throwing an error.
<add> delete currentKeys[key];
<ide> }
<ide> }
<ide>
<ide><path>src/addons/transitions/__tests__/ReactTransitionGroup-test.js
<ide> describe('ReactTransitionGroup', function() {
<ide> expect(a.getDOMNode().childNodes[1].id).toBe('one');
<ide> });
<ide>
<add> it('should switch transitionLeave from false to true', function() {
<add> var a = React.renderComponent(
<add> <ReactTransitionGroup
<add> transitionName="yolo"
<add> transitionEnter={false}
<add> transitionLeave={false}>
<add> <span key="one" id="one" />
<add> </ReactTransitionGroup>,
<add> container
<add> );
<add> expect(a.getDOMNode().childNodes.length).toBe(1);
<add> React.renderComponent(
<add> <ReactTransitionGroup
<add> transitionName="yolo"
<add> transitionEnter={false}
<add> transitionLeave={false}>
<add> <span key="two" id="two" />
<add> </ReactTransitionGroup>,
<add> container
<add> );
<add> expect(a.getDOMNode().childNodes.length).toBe(1);
<add> React.renderComponent(
<add> <ReactTransitionGroup
<add> transitionName="yolo"
<add> transitionEnter={false}
<add> transitionLeave={true}>
<add> <span key="three" id="three" />
<add> </ReactTransitionGroup>,
<add> container
<add> );
<add> expect(a.getDOMNode().childNodes.length).toBe(2);
<add> expect(a.getDOMNode().childNodes[0].id).toBe('three');
<add> expect(a.getDOMNode().childNodes[1].id).toBe('two');
<add> });
<add>
<ide> describe('with an undefined child', function () {
<ide> it('should fail silently', function () {
<ide> React.renderComponent( | 2 |
Javascript | Javascript | use exit code 8 consistently | 6808706c3b8baf8d4b867806acebda949f6d8f38 | <ide><path>src/node.js
<ide> try {
<ide> if (!process._exiting) {
<ide> process._exiting = true;
<del> process.emit('exit', 1);
<add> process.emit('exit', 8);
<ide> }
<ide> } catch (er) {
<ide> // nothing to be done about it at this point.
<ide><path>test/simple/test-process-exit-code.js
<ide> switch (process.argv[2]) {
<ide> return child2();
<ide> case 'child3':
<ide> return child3();
<add> case 'child4':
<add> return child4();
<ide> case undefined:
<ide> return parent();
<ide> default:
<ide> function child3() {
<ide> process.exit(0);
<ide> }
<ide>
<add>function child4() {
<add> process.exitCode = 99;
<add> process.on('exit', function(code) {
<add> if (code !== 8) {
<add> console.log('wrong code! expected 8 for uncaughtException');
<add> process.exit(99);
<add> }
<add> });
<add> throw new Error('ok');
<add>}
<add>
<ide> function parent() {
<ide> test('child1', 42);
<ide> test('child2', 42);
<ide> test('child3', 0);
<add> test('child4', 8);
<ide> }
<ide>
<ide> function test(arg, exit) {
<ide> var spawn = require('child_process').spawn;
<ide> var node = process.execPath;
<ide> var f = __filename;
<del> spawn(node, [f, arg], {stdio: 'inherit'}).on('exit', function(code) {
<add> var option = { stdio: [ 0, 1, 'ignore' ] };
<add> spawn(node, [f, arg], option).on('exit', function(code) {
<ide> assert.equal(code, exit, 'wrong exit for ' +
<ide> arg + '\nexpected:' + exit +
<ide> ' but got:' + code); | 2 |
Text | Text | fix broken links in commit-queue.md | 92167e272be9dff7441f061ef8eac00bafa667e5 | <ide><path>doc/guides/commit-queue.md
<ide> of the commit queue:
<ide>
<ide> ## Implementation
<ide>
<del>The [action](/.github/workflows/commit_queue.yml) will run on scheduler
<add>The [action](../../.github/workflows/commit-queue.yml) will run on scheduler
<ide> events every five minutes. Five minutes is the smallest number accepted by
<ide> the scheduler. The scheduler is not guaranteed to run every five minutes, it
<ide> might take longer between runs.
<ide> a Jenkins token from
<ide> `octokit/graphql-action` is used to fetch all Pull Requests with the
<ide> `commit-queue` label. The output is a JSON payload, so `jq` is used to turn
<ide> that into a list of PR ids we can pass as arguments to
<del>[`commit-queue.sh`](./tools/actions/commit-queue.sh).
<add>[`commit-queue.sh`](../../tools/actions/commit-queue.sh).
<ide>
<ide> > The personal token only needs permission for public repositories and to read
<ide> > profiles, we can use the GITHUB_TOKEN for write operations. Jenkins token is | 1 |
Python | Python | add blank line | 5c1e7ae50d6242ce1f04d1a6482a85f443b6bc1e | <ide><path>numpy/ma/core.py
<ide> def _recursive_or(a, b):
<ide> _recursive_or(af, bf)
<ide> else:
<ide> af |= bf
<add>
<ide> _recursive_or(_data._mask, mask)
<ide> else:
<ide> _data._mask = np.logical_or(mask, _data._mask) | 1 |
Ruby | Ruby | migrate some formula with hard-x11 dependencies | a1ba5a5da6ee62aab11c628b7d427091f8356b42 | <ide><path>Library/Homebrew/tap_migrations.rb
<ide> "apple-gcc42" => "homebrew/dupes",
<ide> "appledoc" => "homebrew/boneyard",
<ide> "appswitch" => "homebrew/binary",
<add> "atari++" => "homebrew/x11",
<ide> "authexec" => "homebrew/boneyard",
<ide> "aws-iam-tools" => "homebrew/boneyard",
<ide> "blackbox" => "homebrew/boneyard",
<add> "bochs" => "homebrew/x11",
<ide> "boost149" => "homebrew/versions",
<ide> "cantera" => "homebrew/science",
<add> "cardpeek" => "homebrew/x11",
<ide> "catdoc" => "homebrew/boneyard",
<ide> "clam" => "homebrew/boneyard",
<ide> "cloudfoundry-cli" => "pivotal/tap",
<add> "clusterit" => "homebrew/x11",
<ide> "cmucl" => "homebrew/binary",
<ide> "comparepdf" => "homebrew/boneyard",
<ide> "connect" => "homebrew/boneyard",
<add> "curlftpfs" => "homebrew/x11",
<add> "cwm" => "homebrew/x11",
<ide> "dart" => "dart-lang/dart",
<add> "ddd" => "homebrew/x11",
<ide> "denyhosts" => "homebrew/boneyard",
<add> "dmenu" => "homebrew/x11",
<ide> "dotwrp" => "homebrew/science",
<ide> "drizzle" => "homebrew/boneyard",
<ide> "drush" => "homebrew/php",
<ide> "dsniff" => "homebrew/boneyard",
<add> "dwm" => "homebrew/x11",
<add> "dzen2" => "homebrew/x11",
<add> "easy-tag" => "homebrew/x11",
<ide> "electric-fence" => "homebrew/boneyard",
<ide> "fceux" => "homebrew/games",
<add> "feh" => "homebrew/x11",
<add> "fox" => "homebrew/x11",
<add> "freeglut" => "homebrew/x11",
<add> "freerdp" => "homebrew/x11",
<add> "fsv" => "homebrew/x11",
<add> "geany" => "homebrew/x11",
<add> "geda-gaf" => "homebrew/x11",
<add> "geeqie" => "homebrew/x11",
<add> "geomview" => "homebrew/x11",
<add> "gerbv" => "homebrew/x11",
<add> "ggobi" => "homebrew/x11",
<add> "giblib" => "homebrew/x11",
<add> "gkrellm" => "homebrew/x11",
<add> "glade" => "homebrew/x11",
<add> "gle" => "homebrew/x11",
<add> "gnumeric" => "homebrew/x11",
<ide> "gnunet" => "homebrew/boneyard",
<add> "gobby" => "homebrew/x11",
<add> "gpredict" => "homebrew/x11",
<add> "grace" => "homebrew/x11",
<ide> "grads" => "homebrew/binary",
<ide> "gromacs" => "homebrew/science",
<add> "gsmartcontrol" => "homebrew/x11",
<add> "gtk-chtheme" => "homebrew/x11",
<add> "gtksourceviewmm" => "homebrew/x11",
<add> "gtksourceviewmm3" => "homebrew/x11",
<add> "gtkwave" => "homebrew/x11",
<add> "gupnp-tools" => "homebrew/x11",
<add> "hatari" => "homebrew/x11",
<ide> "helios" => "spotify/public",
<add> "hexchat" => "homebrew/x11",
<ide> "hllib" => "homebrew/boneyard",
<ide> "hugs98" => "homebrew/boneyard",
<ide> "hwloc" => "homebrew/science",
<add> "imake" => "homebrew/x11",
<add> "inkscape" => "homebrew/x11",
<ide> "ipopt" => "homebrew/science",
<add> "iptux" => "homebrew/x11",
<ide> "itsol" => "homebrew/science",
<ide> "iulib" => "homebrew/boneyard",
<ide> "jscoverage" => "homebrew/boneyard",
<ide> "jsl" => "homebrew/binary",
<ide> "jstalk" => "homebrew/boneyard",
<ide> "justniffer" => "homebrew/boneyard",
<ide> "kerl" => "homebrew/headonly",
<add> "kernagic" => "homebrew/x11",
<ide> "kismet" => "homebrew/boneyard",
<add> "klavaro" => "homebrew/x11",
<ide> "libdlna" => "homebrew/boneyard",
<ide> "libgtextutils" => "homebrew/science",
<ide> "librets" => "homebrew/boneyard",
<ide> "libspotify" => "homebrew/binary",
<ide> "lmutil" => "homebrew/binary",
<add> "meld" => "homebrew/x11",
<add> "mesalib-glw" => "homebrew/x11",
<ide> "mess" => "homebrew/games",
<ide> "metalua" => "homebrew/boneyard",
<add> "mit-scheme" => "homebrew/x11",
<ide> "mlkit" => "homebrew/boneyard",
<ide> "mlton" => "homebrew/boneyard",
<add> "morse" => "homebrew/x11",
<ide> "mpio" => "homebrew/boneyard",
<add> "mscgen" => "homebrew/x11",
<ide> "msgpack-rpc" => "homebrew/boneyard",
<add> "mupdf" => "homebrew/x11",
<ide> "mydumper" => "homebrew/boneyard",
<ide> "nlopt" => "homebrew/science",
<ide> "octave" => "homebrew/science",
<ide> "opencv" => "homebrew/science",
<ide> "openfst" => "homebrew/science",
<ide> "opengrm-ngram" => "homebrew/science",
<ide> "pan" => "homebrew/boneyard",
<add> "pari" => "homebrew/x11",
<add> "pcb" => "homebrew/x11",
<add> "pdf2image" => "homebrew/x11",
<add> "pdf2svg" => "homebrew/x11",
<add> "pgplot" => "homebrew/x11",
<add> "pixie" => "homebrew/x11",
<ide> "pjsip" => "homebrew/boneyard",
<ide> "pocl" => "homebrew/science",
<add> "prooftree" => "homebrew/x11",
<add> "py3cairo" => "homebrew/x11",
<add> "pyxplot" => "homebrew/x11",
<ide> "qfits" => "homebrew/boneyard",
<ide> "qrupdate" => "homebrew/science",
<add> "rdesktop" => "homebrew/x11",
<add> "rxvt-unicode" => "homebrew/x11",
<ide> "salt" => "homebrew/science",
<add> "scantailor" => "homebrew/x11",
<ide> "shark" => "homebrew/boneyard",
<ide> "slicot" => "homebrew/science",
<add> "smartsim" => "homebrew/x11",
<ide> "solfege" => "homebrew/boneyard",
<add> "sptk" => "homebrew/x11",
<ide> "sundials" => "homebrew/science",
<add> "swi-prolog" => "homebrew/x11",
<add> "sxiv" => "homebrew/x11",
<add> "sylpheed" => "homebrew/x11",
<ide> "syslog-ng" => "homebrew/boneyard",
<add> "tabbed" => "homebrew/x11",
<add> "terminator" => "homebrew/x11",
<ide> "tetgen" => "homebrew/science",
<ide> "texmacs" => "homebrew/boneyard",
<add> "tiger-vnc" => "homebrew/x11",
<ide> "tmap" => "homebrew/boneyard",
<add> "transmission-remote-gtk" => "homebrew/x11",
<ide> "ume" => "homebrew/games",
<add> "upnp-router-control" => "homebrew/x11",
<ide> "urweb" => "homebrew/boneyard",
<ide> "ushare" => "homebrew/boneyard",
<add> "viewglob" => "homebrew/x11",
<ide> "wkhtmltopdf" => "homebrew/boneyard",
<add> "wmctrl" => "homebrew/x11",
<add> "xchat" => "homebrew/x11",
<add> "xclip" => "homebrew/x11",
<add> "xdotool" => "homebrew/x11",
<add> "xdu" => "homebrew/x11",
<add> "xournal" => "homebrew/x11",
<add> "xpa" => "homebrew/x11",
<add> "xpdf" => "homebrew/x11",
<add> "xplot" => "homebrew/x11",
<add> "xspringies" => "homebrew/x11",
<add> "yarp" => "homebrew/x11",
<ide> } | 1 |
Javascript | Javascript | remove checks for armv6 | 62321267b05a8bb66915edc30587a421bcc82434 | <ide><path>test/common/index.js
<ide> function platformTimeout(ms) {
<ide>
<ide> const armv = process.config.variables.arm_version;
<ide>
<del> if (armv === '6')
<del> return multipliers.seven * ms; // ARMv6
<del>
<ide> if (armv === '7')
<ide> return multipliers.two * ms; // ARMv7
<ide>
<ide><path>test/pummel/test-crypto-dh-hash-modp18.js
<ide> if (!common.hasCrypto) {
<ide> common.skip('node compiled without OpenSSL.');
<ide> }
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> const assert = require('assert');
<ide><path>test/pummel/test-crypto-dh-hash.js
<ide> if (!common.hasCrypto) {
<ide> common.skip('node compiled without OpenSSL.');
<ide> }
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> const assert = require('assert');
<ide><path>test/pummel/test-crypto-dh-keys.js
<ide> if (!common.hasCrypto) {
<ide> common.skip('node compiled without OpenSSL.');
<ide> }
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> const assert = require('assert');
<ide><path>test/pummel/test-dh-regr.js
<ide> if (!common.hasCrypto) {
<ide> common.skip('missing crypto');
<ide> }
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> const assert = require('assert');
<ide><path>test/pummel/test-fs-watch-system-limit.js
<ide> if (!common.isLinux) {
<ide> common.skip('The fs watch limit is OS-dependent');
<ide> }
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> try {
<ide><path>test/pummel/test-hash-seed.js
<ide> // Check that spawn child doesn't create duplicated entries
<ide> const common = require('../common');
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7'))
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<add>}
<ide>
<ide> const kRepetitions = 2;
<ide> const assert = require('assert');
<ide><path>test/pummel/test-heapsnapshot-near-heap-limit-bounded.js
<ide>
<ide> const common = require('../common');
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> const tmpdir = require('../common/tmpdir');
<ide><path>test/pummel/test-heapsnapshot-near-heap-limit.js
<ide>
<ide> const common = require('../common');
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> const tmpdir = require('../common/tmpdir');
<ide><path>test/pummel/test-net-bytes-per-incoming-chunk-overhead.js
<ide> if (process.config.variables.asan) {
<ide> common.skip('ASAN messes with memory measurements');
<ide> }
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> const assert = require('assert');
<ide><path>test/pummel/test-next-tick-infinite-calls.js
<ide> 'use strict';
<ide> const common = require('../common');
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> let complete = 0;
<ide><path>test/pummel/test-policy-integrity.js
<ide> if (!common.hasCrypto) {
<ide> common.skip('missing crypto');
<ide> }
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> common.requireNoPackageJSONAbove();
<ide><path>test/pummel/test-webcrypto-derivebits-pbkdf2.js
<ide> if (!common.hasCrypto) {
<ide> common.skip('missing crypto');
<ide> }
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7')) {
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<ide> }
<ide>
<ide> const assert = require('assert');
<ide><path>test/sequential/test-child-process-pass-fd.js
<ide> const common = require('../common');
<ide> // This test is basically `test-cluster-net-send` but creating lots of workers
<ide> // so the issue reproduces on OS X consistently.
<ide>
<del>if ((process.config.variables.arm_version === '6') ||
<del> (process.config.variables.arm_version === '7'))
<del> common.skip('Too slow for armv6 and armv7 bots');
<add>if (process.config.variables.arm_version === '7') {
<add> common.skip('Too slow for armv7 bots');
<add>}
<ide>
<ide> const assert = require('assert');
<ide> const { fork } = require('child_process'); | 14 |
Text | Text | add shisama to collaborators | a49b672aad41e5f81a87d3df3d97589f031903e7 | <ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> **Nikolai Vavilov** <vvnicholas@gmail.com>
<ide> * [shigeki](https://github.com/shigeki) -
<ide> **Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him)
<add>* [shisama](https://github.com/shisama) -
<add>**Masashi Hirano** <shisama07@gmail.com> (he/him)
<ide> * [silverwind](https://github.com/silverwind) -
<ide> **Roman Reiss** <me@silverwind.io>
<ide> * [srl295](https://github.com/srl295) - | 1 |
Python | Python | add as_uri method to azure block blob backend | fc689bde77415a04740501a9ff097a15e0529f17 | <ide><path>celery/backends/azureblockblob.py
<ide> __all__ = ("AzureBlockBlobBackend",)
<ide>
<ide> LOGGER = get_logger(__name__)
<add>AZURE_BLOCK_BLOB_CONNECTION_PREFIX = 'azureblockblob://'
<ide>
<ide>
<ide> class AzureBlockBlobBackend(KeyValueStoreBackend):
<ide> def __init__(self,
<ide> self._read_timeout = conf.get('azureblockblob_read_timeout', 120)
<ide>
<ide> @classmethod
<del> def _parse_url(cls, url, prefix="azureblockblob://"):
<add> def _parse_url(cls, url, prefix=AZURE_BLOCK_BLOB_CONNECTION_PREFIX):
<ide> connection_string = url[len(prefix):]
<ide> if not connection_string:
<ide> raise ImproperlyConfigured("Invalid URL")
<ide> def delete(self, key):
<ide> )
<ide>
<ide> blob_client.delete_blob()
<add>
<add> def as_uri(self, include_password=False):
<add> if include_password:
<add> return (
<add> f'{AZURE_BLOCK_BLOB_CONNECTION_PREFIX}'
<add> f'{self._connection_string}'
<add> )
<add>
<add> connection_string_parts = self._connection_string.split(';')
<add> account_key_prefix = 'AccountKey='
<add> redacted_connection_string_parts = [
<add> f'{account_key_prefix}**' if part.startswith(account_key_prefix)
<add> else part
<add> for part in connection_string_parts
<add> ]
<add>
<add> return (
<add> f'{AZURE_BLOCK_BLOB_CONNECTION_PREFIX}'
<add> f'{";".join(redacted_connection_string_parts)}'
<add> )
<ide><path>t/unit/backends/test_azureblockblob.py
<ide> def test_base_path_conf_default(self):
<ide> url=self.url
<ide> )
<ide> assert backend.base_path == ''
<add>
<add>
<add>class test_as_uri:
<add> def setup(self):
<add> self.url = (
<add> "azureblockblob://"
<add> "DefaultEndpointsProtocol=protocol;"
<add> "AccountName=name;"
<add> "AccountKey=account_key;"
<add> "EndpointSuffix=suffix"
<add> )
<add> self.backend = AzureBlockBlobBackend(
<add> app=self.app,
<add> url=self.url
<add> )
<add>
<add> def test_as_uri_include_password(self):
<add> assert self.backend.as_uri(include_password=True) == self.url
<add>
<add> def test_as_uri_exclude_password(self):
<add> assert self.backend.as_uri(include_password=False) == (
<add> "azureblockblob://"
<add> "DefaultEndpointsProtocol=protocol;"
<add> "AccountName=name;"
<add> "AccountKey=**;"
<add> "EndpointSuffix=suffix"
<add> ) | 2 |
Javascript | Javascript | fix linter errors | a46740261a773882d52ead11f3533ac29b759570 | <ide><path>spec/tree-sitter-language-mode-spec.js
<ide> describe('TreeSitterLanguageMode', () => {
<ide> 'template_substitution > "}"': 'interpolation'
<ide> },
<ide> injectionRegExp: 'javascript',
<del> injectionPoints: [HTML_TEMPLATE_LITERAL_INJECTION_POINT, JSDOC_INJECTION_POINT]
<add> injectionPoints: [
<add> HTML_TEMPLATE_LITERAL_INJECTION_POINT,
<add> JSDOC_INJECTION_POINT
<add> ]
<ide> });
<ide>
<ide> htmlGrammar = new TreeSitterGrammar(atom.grammars, htmlGrammarPath, {
<ide> describe('TreeSitterLanguageMode', () => {
<ide> injectionRegExp: 'jsdoc',
<ide> injectionPoints: []
<ide> }
<del> )
<del>
<add> );
<ide> atom.grammars.addGrammar(jsGrammar);
<ide> atom.grammars.addGrammar(jsdocGrammar);
<ide>
<del> // await atom.packages.activatePackage('language-javascript');
<ide> editor.setGrammar(jsGrammar);
<ide> editor.setText('/**\n*/\n{\n}');
<ide>
<ide> const SCRIPT_TAG_INJECTION_POINT = {
<ide>
<ide> const JSDOC_INJECTION_POINT = {
<ide> type: 'comment',
<del> language (comment) {
<del> if (comment.text.startsWith('/**')) return 'jsdoc'
<add> language(comment) {
<add> if (comment.text.startsWith('/**')) return 'jsdoc';
<ide> },
<del> content (comment) {
<del> return comment
<add> content(comment) {
<add> return comment;
<ide> }
<del>}
<add>}; | 1 |
Javascript | Javascript | remove unnecessary quotes from minerr_url | 91e139e52a0a9d2d47337c46c8bd9e04e7466358 | <ide><path>lib/grunt/utils.js
<ide> module.exports = {
<ide> '--language_in ECMASCRIPT5_STRICT ' +
<ide> '--minerr_pass ' +
<ide> '--minerr_errors ' + errorFileName + ' ' +
<del> '--minerr_url \'http://docs.angularjs.org/minerr/\' ' +
<add> '--minerr_url http://docs.angularjs.org/minerr/ ' +
<ide> '--source_map_format=V3 ' +
<ide> '--create_source_map ' + mapFile + ' ' +
<ide> '--js ' + file + ' ' + | 1 |
PHP | PHP | remove useless space | 71647bb8b9f2a0ac9e98cde496751f52a660fb00 | <ide><path>src/Illuminate/Html/FormBuilder.php
<ide> public function submit($value = null, $options = array())
<ide> */
<ide> public function button($value = null, $options = array())
<ide> {
<del> if ( ! array_key_exists('type', $options) )
<add> if ( ! array_key_exists('type', $options))
<ide> {
<ide> $options['type'] = 'button';
<ide> } | 1 |
Python | Python | apply suggestions from code review | 9f9a34843016faea897cd591a5c4c104fa68c883 | <ide><path>numpy/_globals.py
<ide> def __repr__(self):
<ide> class _CopyMode(enum.Enum):
<ide> """
<ide> An enumeration for the copy modes supported
<del> by numpy. The following three modes are supported,
<add> by numpy.copy() and numpy.array(). The following three modes are supported,
<ide>
<ide> - ALWAYS: This means that a deep copy of the input
<ide> array will always be taken. | 1 |
Ruby | Ruby | add a failing test so we can make it happy again | 53737eadd6ee69b81f50029908502fa43dc9fe95 | <ide><path>activerecord/test/callbacks_test.rb
<ide> def before_destroy
<ide> end
<ide> end
<ide>
<add>class CallbackCancellationDeveloper < ActiveRecord::Base
<add> set_table_name 'developers'
<add> def before_create
<add> false
<add> end
<add>end
<add>
<ide> class CallbacksTest < Test::Unit::TestCase
<ide> fixtures :developers
<ide>
<ide> def test_before_save_returning_false
<ide> assert_raises(ActiveRecord::RecordInvalid) { david.save! }
<ide> end
<ide>
<add> def test_before_create_returning_false
<add> someone = CallbackCancellationDeveloper.new
<add> assert someone.valid?
<add> assert !someone.save
<add> end
<add>
<ide> def test_before_destroy_returning_false
<ide> david = ImmutableDeveloper.find(1)
<ide> assert !david.destroy | 1 |
Ruby | Ruby | ensure consistent timezone management | 7ee76b85d5372f4c85e9947495ae4eeaa91436a5 | <ide><path>Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb
<ide> module MacOSZipExtension
<ide>
<ide> sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) }
<ide> def extract_to_dir(unpack_dir, basename:, verbose:)
<del> if merge_xattrs && contains_extended_attributes?(path)
<del> # We use ditto directly, because dot_clean has issues if the __MACOSX
<del> # folder has incorrect permissions.
<del> # (Also, Homebrew's ZIP artifact automatically deletes this folder.)
<del> return system_command! "ditto",
<del> args: ["-x", "-k", path, unpack_dir],
<del> verbose: verbose,
<del> print_stderr: false
<del> end
<add> with_env(TZ: "UTC") do
<add> if merge_xattrs && contains_extended_attributes?(path)
<add> # We use ditto directly, because dot_clean has issues if the __MACOSX
<add> # folder has incorrect permissions.
<add> # (Also, Homebrew's ZIP artifact automatically deletes this folder.)
<add> return system_command! "ditto",
<add> args: ["-x", "-k", path, unpack_dir],
<add> verbose: verbose,
<add> print_stderr: false
<add> end
<ide>
<del> result = begin
<del> T.let(super, T.nilable(SystemCommand::Result))
<del> rescue ErrorDuringExecution => e
<del> raise unless e.stderr.include?("End-of-central-directory signature not found.")
<add> result = begin
<add> T.let(super, T.nilable(SystemCommand::Result))
<add> rescue ErrorDuringExecution => e
<add> raise unless e.stderr.include?("End-of-central-directory signature not found.")
<ide>
<del> system_command! "ditto",
<del> args: ["-x", "-k", path, unpack_dir],
<del> verbose: verbose
<del> nil
<del> end
<add> system_command! "ditto",
<add> args: ["-x", "-k", path, unpack_dir],
<add> verbose: verbose
<add> nil
<add> end
<ide>
<del> return if result.blank?
<add> return if result.blank?
<ide>
<del> volumes = result.stderr.chomp
<del> .split("\n")
<del> .map { |l| l[/\A skipping: (.+) volume label\Z/, 1] }
<del> .compact
<add> volumes = result.stderr.chomp
<add> .split("\n")
<add> .map { |l| l[/\A skipping: (.+) volume label\Z/, 1] }
<add> .compact
<ide>
<del> return if volumes.empty?
<add> return if volumes.empty?
<ide>
<del> Dir.mktmpdir do |tmp_unpack_dir|
<del> tmp_unpack_dir = Pathname(tmp_unpack_dir)
<add> Dir.mktmpdir do |tmp_unpack_dir|
<add> tmp_unpack_dir = Pathname(tmp_unpack_dir)
<ide>
<del> # `ditto` keeps Finder attributes intact and does not skip volume labels
<del> # like `unzip` does, which can prevent disk images from being unzipped.
<del> system_command! "ditto",
<del> args: ["-x", "-k", path, tmp_unpack_dir],
<del> verbose: verbose
<add> # `ditto` keeps Finder attributes intact and does not skip volume labels
<add> # like `unzip` does, which can prevent disk images from being unzipped.
<add> system_command! "ditto",
<add> args: ["-x", "-k", path, tmp_unpack_dir],
<add> verbose: verbose
<ide>
<del> volumes.each do |volume|
<del> FileUtils.mv tmp_unpack_dir/volume, unpack_dir/volume, verbose: verbose
<add> volumes.each do |volume|
<add> FileUtils.mv tmp_unpack_dir/volume, unpack_dir/volume, verbose: verbose
<add> end
<ide> end
<ide> end
<ide> end
<ide><path>Library/Homebrew/unpack_strategy/zip.rb
<ide> def self.can_extract?(path)
<ide> .returns(SystemCommand::Result)
<ide> }
<ide> def extract_to_dir(unpack_dir, basename:, verbose:)
<del> quiet_flags = verbose ? [] : ["-qq"]
<del> result = system_command! "unzip",
<del> args: [*quiet_flags, "-o", path, "-d", unpack_dir],
<del> verbose: verbose,
<del> print_stderr: false
<add> with_env(TZ: "UTC") do
<add> quiet_flags = verbose ? [] : ["-qq"]
<add> result = system_command! "unzip",
<add> args: [*quiet_flags, "-o", path, "-d", unpack_dir],
<add> verbose: verbose,
<add> print_stderr: false
<ide>
<del> FileUtils.rm_rf unpack_dir/"__MACOSX"
<add> FileUtils.rm_rf unpack_dir/"__MACOSX"
<ide>
<del> result
<add> result
<add> end
<ide> end
<ide> end
<ide> end | 2 |
Python | Python | add bloom fixes for contrastive search | 938cb04789afe44169fba3866bfc1d4a3eacd8ee | <ide><path>src/transformers/generation/utils.py
<ide> def _expand_inputs_for_generation(
<ide>
<ide> return input_ids, model_kwargs
<ide>
<del> @staticmethod
<del> def _extract_past_from_model_output(outputs: ModelOutput):
<add> def _extract_past_from_model_output(self, outputs: ModelOutput, standardize_cache_format: bool = False):
<ide> past = None
<ide> if "past_key_values" in outputs:
<ide> past = outputs.past_key_values
<ide> elif "mems" in outputs:
<ide> past = outputs.mems
<ide> elif "past_buckets_states" in outputs:
<ide> past = outputs.past_buckets_states
<add>
<add> # Bloom fix: standardizes the cache format when requested
<add> if standardize_cache_format and hasattr(self, "_convert_to_standard_cache"):
<add> batch_size = outputs.logits.shape[0]
<add> past = self._convert_to_standard_cache(past, batch_size=batch_size)
<ide> return past
<ide>
<ide> def _update_model_kwargs_for_generation(
<del> self, outputs: ModelOutput, model_kwargs: Dict[str, Any], is_encoder_decoder: bool = False
<add> self,
<add> outputs: ModelOutput,
<add> model_kwargs: Dict[str, Any],
<add> is_encoder_decoder: bool = False,
<add> standardize_cache_format: bool = False,
<ide> ) -> Dict[str, Any]:
<ide> # update past
<del> model_kwargs["past"] = self._extract_past_from_model_output(outputs)
<add> model_kwargs["past"] = self._extract_past_from_model_output(
<add> outputs, standardize_cache_format=standardize_cache_format
<add> )
<ide>
<ide> # update token_type_ids with last value
<ide> if "token_type_ids" in model_kwargs:
<ide> def contrastive_search(
<ide> logit_for_next_step = outputs.logits[:, -1, :]
<ide>
<ide> model_kwargs = self._update_model_kwargs_for_generation(
<del> outputs, model_kwargs, is_encoder_decoder=self.config.is_encoder_decoder
<add> outputs,
<add> model_kwargs,
<add> is_encoder_decoder=self.config.is_encoder_decoder,
<add> standardize_cache_format=True,
<ide> )
<ide>
<ide> # Expands model inputs top_k times, for batched forward passes (akin to beam search).
<ide> def contrastive_search(
<ide> outputs = self(
<ide> **next_model_inputs, return_dict=True, output_hidden_states=True, output_attentions=output_attentions
<ide> )
<del> next_past_key_values = self._extract_past_from_model_output(outputs)
<add> next_past_key_values = self._extract_past_from_model_output(outputs, standardize_cache_format=True)
<ide>
<ide> logits = outputs.logits[:, -1, :]
<ide> # name is different for encoder-decoder and decoder-only models
<ide><path>src/transformers/models/bloom/modeling_bloom.py
<ide> def _set_gradient_checkpointing(self, module: nn.Module, value: bool = False):
<ide> if isinstance(module, BloomModel):
<ide> module.gradient_checkpointing = value
<ide>
<add> @staticmethod
<add> def _convert_to_standard_cache(
<add> past_key_value: Tuple[Tuple[torch.Tensor, torch.Tensor]], batch_size: int
<add> ) -> Tuple[Tuple[torch.Tensor, torch.Tensor]]:
<add> """
<add> Standardizes the format of the cache so as to match most implementations, i.e. to tuple(tuple([batch_size,
<add> num_heads, ...]))
<add> """
<add> batch_size_times_num_heads, head_dim, seq_length = past_key_value[0][0].shape
<add> num_heads = batch_size_times_num_heads // batch_size
<add> # key: [batch_size * num_heads, head_dim, seq_length] -> [batch_size, num_heads, head_dim, seq_length]
<add> # value: [batch_size * num_heads, seq_length, head_dim] -> [batch_size, num_heads, seq_length, head_dim]
<add> return tuple(
<add> (
<add> layer_past[0].view(batch_size, num_heads, head_dim, seq_length),
<add> layer_past[1].view(batch_size, num_heads, seq_length, head_dim),
<add> )
<add> for layer_past in past_key_value
<add> )
<add>
<add> @staticmethod
<add> def _convert_to_bloom_cache(
<add> past_key_value: Tuple[Tuple[torch.Tensor, torch.Tensor]]
<add> ) -> Tuple[Tuple[torch.Tensor, torch.Tensor]]:
<add> """
<add> Converts the cache to the format expected by Bloom, i.e. to tuple(tuple([batch_size * num_heads, ...]))
<add> """
<add> batch_size, num_heads, head_dim, seq_length = past_key_value[0][0].shape
<add> batch_size_times_num_heads = batch_size * num_heads
<add> # key: [batch_size, num_heads, head_dim, seq_length] -> [batch_size * num_heads, head_dim, seq_length]
<add> # value: [batch_size, num_heads, seq_length, head_dim] -> [batch_size * num_heads, seq_length, head_dim]
<add> return tuple(
<add> (
<add> layer_past[0].view(batch_size_times_num_heads, head_dim, seq_length),
<add> layer_past[1].view(batch_size_times_num_heads, seq_length, head_dim),
<add> )
<add> for layer_past in past_key_value
<add> )
<add>
<ide>
<ide> BLOOM_START_DOCSTRING = r"""
<ide>
<ide> def prepare_inputs_for_generation(
<ide> if past:
<ide> input_ids = input_ids[:, -1].unsqueeze(-1)
<ide>
<add> # the cache may be in the stardard format (e.g. in contrastive search), convert to bloom's format if needed
<add> if past[0][0].shape[0] == input_ids.shape[0]:
<add> past = self._convert_to_bloom_cache(past)
<add>
<ide> return {
<ide> "input_ids": input_ids,
<ide> "past_key_values": past,
<ide> def forward(
<ide> attentions=transformer_outputs.attentions,
<ide> )
<ide>
<del> @staticmethod
<ide> def _reorder_cache(
<del> past: Tuple[Tuple[torch.Tensor, torch.Tensor], ...], beam_idx: torch.LongTensor
<add> self, past: Tuple[Tuple[torch.Tensor, torch.Tensor], ...], beam_idx: torch.LongTensor
<ide> ) -> Tuple[Tuple[torch.Tensor, torch.Tensor], ...]:
<ide> """
<ide> This function is used to re-order the `past_key_values` cache if [`~PreTrainedModel.beam_search`] or
<ide> def _reorder_cache(
<ide>
<ide> Output shares the same memory storage as `past`.
<ide> """
<del> batch_size_times_num_heads, head_dim, seq_length = past[0][0].shape
<del> batch_size = len(beam_idx)
<del> num_heads = batch_size_times_num_heads // batch_size
<add> standardized_past = self._convert_to_standard_cache(past, batch_size=len(beam_idx))
<add>
<ide> # Get a copy of `beam_idx` on all the devices where we need those indices.
<ide> device_to_beam_idx = {
<ide> past_state.device: beam_idx.to(past_state.device) for layer_past in past for past_state in layer_past
<ide> }
<del> # key: layer_past[0] [batch_size * num_heads, head_dim, seq_length]
<del> # value: layer_past[1] [batch_size * num_heads, seq_length, head_dim]
<del> return tuple(
<add> reordered_past = tuple(
<ide> (
<del> layer_past[0]
<del> .view(batch_size, num_heads, head_dim, seq_length)
<del> .index_select(0, device_to_beam_idx[layer_past[0].device])
<del> .view(batch_size_times_num_heads, head_dim, seq_length),
<del> layer_past[1]
<del> .view(batch_size, num_heads, seq_length, head_dim)
<del> .index_select(0, device_to_beam_idx[layer_past[0].device])
<del> .view(batch_size_times_num_heads, seq_length, head_dim),
<add> layer_past[0].index_select(0, device_to_beam_idx[layer_past[0].device]),
<add> layer_past[1].index_select(0, device_to_beam_idx[layer_past[0].device]),
<ide> )
<del> for layer_past in past
<add> for layer_past in standardized_past
<ide> )
<add> return self._convert_to_bloom_cache(reordered_past)
<ide>
<ide>
<ide> @add_start_docstrings(
<ide><path>tests/generation/test_utils.py
<ide> def test_contrastive_generate(self):
<ide> # check `generate()` and `contrastive_search()` are equal
<ide> for model_class in self.all_generative_model_classes:
<ide>
<del> # TODO: Fix Bloom. Bloom fails because `past` has a different shape.
<ide> # won't fix: FSMT and Reformer have a different cache variable type (and format).
<del> if any(model_name in model_class.__name__.lower() for model_name in ["bloom", "fsmt", "reformer"]):
<add> if any(model_name in model_class.__name__.lower() for model_name in ["fsmt", "reformer"]):
<ide> return
<ide>
<ide> config, input_ids, attention_mask, max_length = self._get_input_ids_and_config()
<ide> def test_contrastive_generate(self):
<ide> def test_contrastive_generate_dict_outputs_use_cache(self):
<ide> for model_class in self.all_generative_model_classes:
<ide>
<del> # TODO: Fix Bloom. Bloom fails because `past` has a different shape.
<ide> # won't fix: FSMT and Reformer have a different cache variable type (and format).
<del> if any(model_name in model_class.__name__.lower() for model_name in ["bloom", "fsmt", "reformer"]):
<add> if any(model_name in model_class.__name__.lower() for model_name in ["fsmt", "reformer"]):
<ide> return
<ide>
<ide> # enable cache | 3 |
Ruby | Ruby | use subdirs to avoid checking for .ds_store | a3312d24a3457d3613ded1ad3db0dc7c794e8c2f | <ide><path>Library/Homebrew/formula.rb
<ide> def to_hash
<ide> end
<ide>
<ide> if rack.directory?
<del> rack.children.each do |keg|
<del> next if keg.basename.to_s == '.DS_Store'
<add> rack.subdirs.each do |keg|
<ide> tab = Tab.for_keg keg
<ide>
<ide> hsh["installed"] << { | 1 |
Ruby | Ruby | remove unnecessary '|| {}' | 93a85ce333db35b96a70ad02418db8866d89fc08 | <ide><path>activerecord/lib/active_record/associations/collection_association.rb
<ide> def insert_record(record, validate = true)
<ide> def build_record(attributes, options)
<ide> record = reflection.build_association
<ide> record.assign_attributes(scoped.scope_for_create, :without_protection => true)
<del> record.assign_attributes(attributes || {}, options)
<add> record.assign_attributes(attributes, options)
<ide> record
<ide> end
<ide> | 1 |
Go | Go | add build tests covering extraction in chroot | e4ba82d50ee4642412a1e1bdf43a7b94fadd2428 | <ide><path>integration-cli/docker_cli_build_test.go
<ide> RUN cat /existing-directory-trailing-slash/test/foo | grep Hi`
<ide> logDone("build - ADD tar")
<ide> }
<ide>
<add>func TestBuildAddTarXz(t *testing.T) {
<add> name := "testbuildaddtarxz"
<add> defer deleteImages(name)
<add>
<add> ctx := func() *FakeContext {
<add> dockerfile := `
<add> FROM busybox
<add> ADD test.tar.xz /
<add> RUN cat /test/foo | grep Hi`
<add> tmpDir, err := ioutil.TempDir("", "fake-context")
<add> testTar, err := os.Create(filepath.Join(tmpDir, "test.tar"))
<add> if err != nil {
<add> t.Fatalf("failed to create test.tar archive: %v", err)
<add> }
<add> defer testTar.Close()
<add>
<add> tw := tar.NewWriter(testTar)
<add>
<add> if err := tw.WriteHeader(&tar.Header{
<add> Name: "test/foo",
<add> Size: 2,
<add> }); err != nil {
<add> t.Fatalf("failed to write tar file header: %v", err)
<add> }
<add> if _, err := tw.Write([]byte("Hi")); err != nil {
<add> t.Fatalf("failed to write tar file content: %v", err)
<add> }
<add> if err := tw.Close(); err != nil {
<add> t.Fatalf("failed to close tar archive: %v", err)
<add> }
<add> xzCompressCmd := exec.Command("xz", "test.tar")
<add> xzCompressCmd.Dir = tmpDir
<add> out, _, err := runCommandWithOutput(xzCompressCmd)
<add> if err != nil {
<add> t.Fatal(err, out)
<add> }
<add>
<add> if err := ioutil.WriteFile(filepath.Join(tmpDir, "Dockerfile"), []byte(dockerfile), 0644); err != nil {
<add> t.Fatalf("failed to open destination dockerfile: %v", err)
<add> }
<add> return &FakeContext{Dir: tmpDir}
<add> }()
<add>
<add> defer ctx.Close()
<add>
<add> if _, err := buildImageFromContext(name, ctx, true); err != nil {
<add> t.Fatalf("build failed to complete for TestBuildAddTarXz: %v", err)
<add> }
<add>
<add> logDone("build - ADD tar.xz")
<add>}
<add>
<add>func TestBuildAddTarXzGz(t *testing.T) {
<add> name := "testbuildaddtarxzgz"
<add> defer deleteImages(name)
<add>
<add> ctx := func() *FakeContext {
<add> dockerfile := `
<add> FROM busybox
<add> ADD test.tar.xz.gz /
<add> RUN ls /test.tar.xz.gz`
<add> tmpDir, err := ioutil.TempDir("", "fake-context")
<add> testTar, err := os.Create(filepath.Join(tmpDir, "test.tar"))
<add> if err != nil {
<add> t.Fatalf("failed to create test.tar archive: %v", err)
<add> }
<add> defer testTar.Close()
<add>
<add> tw := tar.NewWriter(testTar)
<add>
<add> if err := tw.WriteHeader(&tar.Header{
<add> Name: "test/foo",
<add> Size: 2,
<add> }); err != nil {
<add> t.Fatalf("failed to write tar file header: %v", err)
<add> }
<add> if _, err := tw.Write([]byte("Hi")); err != nil {
<add> t.Fatalf("failed to write tar file content: %v", err)
<add> }
<add> if err := tw.Close(); err != nil {
<add> t.Fatalf("failed to close tar archive: %v", err)
<add> }
<add>
<add> xzCompressCmd := exec.Command("xz", "test.tar")
<add> xzCompressCmd.Dir = tmpDir
<add> out, _, err := runCommandWithOutput(xzCompressCmd)
<add> if err != nil {
<add> t.Fatal(err, out)
<add> }
<add>
<add> gzipCompressCmd := exec.Command("gzip", "test.tar.xz")
<add> gzipCompressCmd.Dir = tmpDir
<add> out, _, err = runCommandWithOutput(gzipCompressCmd)
<add> if err != nil {
<add> t.Fatal(err, out)
<add> }
<add>
<add> if err := ioutil.WriteFile(filepath.Join(tmpDir, "Dockerfile"), []byte(dockerfile), 0644); err != nil {
<add> t.Fatalf("failed to open destination dockerfile: %v", err)
<add> }
<add> return &FakeContext{Dir: tmpDir}
<add> }()
<add>
<add> defer ctx.Close()
<add>
<add> if _, err := buildImageFromContext(name, ctx, true); err != nil {
<add> t.Fatalf("build failed to complete for TestBuildAddTarXz: %v", err)
<add> }
<add>
<add> logDone("build - ADD tar.xz.gz")
<add>}
<add>
<ide> func TestBuildFromGIT(t *testing.T) {
<ide> name := "testbuildfromgit"
<ide> defer deleteImages(name)
<ide><path>integration-cli/docker_cli_save_load_test.go
<ide> func TestSaveAndLoadRepoStdout(t *testing.T) {
<ide> logDone("save - do not save to a tty")
<ide> }
<ide>
<add>// save a repo using gz compression and try to load it using stdout
<add>func TestSaveXzAndLoadRepoStdout(t *testing.T) {
<add> tempDir, err := ioutil.TempDir("", "test-save-xz-gz-load-repo-stdout")
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> defer os.RemoveAll(tempDir)
<add>
<add> tarballPath := filepath.Join(tempDir, "foobar-save-load-test.tar.xz.gz")
<add>
<add> runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "true")
<add> out, _, err := runCommandWithOutput(runCmd)
<add> if err != nil {
<add> t.Fatalf("failed to create a container: %v %v", out, err)
<add> }
<add>
<add> cleanedContainerID := stripTrailingCharacters(out)
<add>
<add> repoName := "foobar-save-load-test-xz-gz"
<add>
<add> inspectCmd := exec.Command(dockerBinary, "inspect", cleanedContainerID)
<add> out, _, err = runCommandWithOutput(inspectCmd)
<add> if err != nil {
<add> t.Fatalf("output should've been a container id: %v %v", cleanedContainerID, err)
<add> }
<add>
<add> commitCmd := exec.Command(dockerBinary, "commit", cleanedContainerID, repoName)
<add> out, _, err = runCommandWithOutput(commitCmd)
<add> if err != nil {
<add> t.Fatalf("failed to commit container: %v %v", out, err)
<add> }
<add>
<add> inspectCmd = exec.Command(dockerBinary, "inspect", repoName)
<add> before, _, err := runCommandWithOutput(inspectCmd)
<add> if err != nil {
<add> t.Fatalf("the repo should exist before saving it: %v %v", before, err)
<add> }
<add>
<add> saveCmdTemplate := `%v save %v | xz -c | gzip -c > %s`
<add> saveCmdFinal := fmt.Sprintf(saveCmdTemplate, dockerBinary, repoName, tarballPath)
<add> saveCmd := exec.Command("bash", "-c", saveCmdFinal)
<add> out, _, err = runCommandWithOutput(saveCmd)
<add> if err != nil {
<add> t.Fatalf("failed to save repo: %v %v", out, err)
<add> }
<add>
<add> deleteImages(repoName)
<add>
<add> loadCmdFinal := fmt.Sprintf(`cat %s | docker load`, tarballPath)
<add> loadCmd := exec.Command("bash", "-c", loadCmdFinal)
<add> out, _, err = runCommandWithOutput(loadCmd)
<add> if err == nil {
<add> t.Fatalf("expected error, but succeeded with no error and output: %v", out)
<add> }
<add>
<add> inspectCmd = exec.Command(dockerBinary, "inspect", repoName)
<add> after, _, err := runCommandWithOutput(inspectCmd)
<add> if err == nil {
<add> t.Fatalf("the repo should not exist: %v", after)
<add> }
<add>
<add> deleteContainer(cleanedContainerID)
<add> deleteImages(repoName)
<add>
<add> logDone("load - save a repo with xz compression & load it using stdout")
<add>}
<add>
<add>// save a repo using xz+gz compression and try to load it using stdout
<add>func TestSaveXzGzAndLoadRepoStdout(t *testing.T) {
<add> tempDir, err := ioutil.TempDir("", "test-save-xz-gz-load-repo-stdout")
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> defer os.RemoveAll(tempDir)
<add>
<add> tarballPath := filepath.Join(tempDir, "foobar-save-load-test.tar.xz.gz")
<add>
<add> runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "true")
<add> out, _, err := runCommandWithOutput(runCmd)
<add> if err != nil {
<add> t.Fatalf("failed to create a container: %v %v", out, err)
<add> }
<add>
<add> cleanedContainerID := stripTrailingCharacters(out)
<add>
<add> repoName := "foobar-save-load-test-xz-gz"
<add>
<add> inspectCmd := exec.Command(dockerBinary, "inspect", cleanedContainerID)
<add> out, _, err = runCommandWithOutput(inspectCmd)
<add> if err != nil {
<add> t.Fatalf("output should've been a container id: %v %v", cleanedContainerID, err)
<add> }
<add>
<add> commitCmd := exec.Command(dockerBinary, "commit", cleanedContainerID, repoName)
<add> out, _, err = runCommandWithOutput(commitCmd)
<add> if err != nil {
<add> t.Fatalf("failed to commit container: %v %v", out, err)
<add> }
<add>
<add> inspectCmd = exec.Command(dockerBinary, "inspect", repoName)
<add> before, _, err := runCommandWithOutput(inspectCmd)
<add> if err != nil {
<add> t.Fatalf("the repo should exist before saving it: %v %v", before, err)
<add> }
<add>
<add> saveCmdTemplate := `%v save %v | xz -c | gzip -c > %s`
<add> saveCmdFinal := fmt.Sprintf(saveCmdTemplate, dockerBinary, repoName, tarballPath)
<add> saveCmd := exec.Command("bash", "-c", saveCmdFinal)
<add> out, _, err = runCommandWithOutput(saveCmd)
<add> if err != nil {
<add> t.Fatalf("failed to save repo: %v %v", out, err)
<add> }
<add>
<add> deleteImages(repoName)
<add>
<add> loadCmdFinal := fmt.Sprintf(`cat %s | docker load`, tarballPath)
<add> loadCmd := exec.Command("bash", "-c", loadCmdFinal)
<add> out, _, err = runCommandWithOutput(loadCmd)
<add> if err == nil {
<add> t.Fatalf("expected error, but succeeded with no error and output: %v", out)
<add> }
<add>
<add> inspectCmd = exec.Command(dockerBinary, "inspect", repoName)
<add> after, _, err := runCommandWithOutput(inspectCmd)
<add> if err == nil {
<add> t.Fatalf("the repo should not exist: %v", after)
<add> }
<add>
<add> deleteContainer(cleanedContainerID)
<add> deleteImages(repoName)
<add>
<add> logDone("load - save a repo with xz+gz compression & load it using stdout")
<add>}
<add>
<ide> func TestSaveSingleTag(t *testing.T) {
<ide> repoName := "foobar-save-single-tag-test"
<ide> | 2 |
PHP | PHP | fix the "testasseturlnorewrite" test | 5a6f1259e34273eae8a28cb2aa4e8a5a58547e23 | <ide><path>lib/Cake/Test/Case/View/HelperTest.php
<ide> public function testAssetUrlNoRewrite() {
<ide> 'here' => '/cake_dev/index.php/tasks',
<ide> ));
<ide> $result = $this->Helper->assetUrl('img/cake.icon.png', array('fullBase' => true));
<del> $this->assertEquals('http://localhost/cake_dev/app/webroot/img/cake.icon.png', $result);
<add> $expected = FULL_BASE_URL . '/cake_dev/app/webroot/img/cake.icon.png';
<add> $this->assertEquals($expected, $result);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | add gesture handling for the card stack | caac52095260beabd7038ec82a93847cc38b3f04 | <ide><path>Examples/UIExplorer/NavigationExperimental/NavigationCardStackExample.js
<ide> 'use strict';
<ide>
<ide> const NavigationExampleRow = require('./NavigationExampleRow');
<add>const NavigationRootContainer = require('NavigationRootContainer');
<ide> const React = require('react-native');
<ide>
<ide> const {
<ide> const {
<ide> const NavigationCardStack = NavigationExperimental.CardStack;
<ide> const NavigationStateUtils = NavigationExperimental.StateUtils;
<ide>
<add>function reduceNavigationState(initialState) {
<add> return (currentState, action) => {
<add> switch (action.type) {
<add> case 'RootContainerInitialAction':
<add> return initialState;
<add>
<add> case 'push':
<add> return NavigationStateUtils.push(currentState, {key: action.key});
<add>
<add> case 'back':
<add> case 'pop':
<add> return currentState.index > 0 ?
<add> NavigationStateUtils.pop(currentState) :
<add> currentState;
<add>
<add> default:
<add> return currentState;
<add> }
<add> };
<add>}
<add>
<add>const ExampleReducer = reduceNavigationState({
<add> index: 0,
<add> children: [{key: 'First Route'}],
<add>});
<add>
<ide> class NavigationCardStackExample extends React.Component {
<ide>
<ide> constructor(props, context) {
<ide> super(props, context);
<del> this.state = this._getInitialState();
<add>
<add> this._renderNavigation = this._renderNavigation.bind(this);
<ide> this._renderScene = this._renderScene.bind(this);
<del> this._push = this._push.bind(this);
<del> this._pop = this._pop.bind(this);
<ide> this._toggleDirection = this._toggleDirection.bind(this);
<add>
<add> this.state = {isHorizontal: true};
<ide> }
<ide>
<ide> render() {
<ide> return (
<del> <NavigationCardStack
<del> direction={this.state.isHorizontal ? 'horizontal' : 'vertical'}
<del> navigationState={this.state.navigationState}
<del> renderScene={this._renderScene}
<add> <NavigationRootContainer
<add> reducer={ExampleReducer}
<add> renderNavigation={this._renderNavigation}
<ide> style={styles.main}
<ide> />
<ide> );
<ide> }
<ide>
<del> _getInitialState() {
<del> const navigationState = {
<del> index: 0,
<del> children: [{key: 'First Route'}],
<del> };
<del> return {
<del> isHorizontal: true,
<del> navigationState,
<del> };
<del> }
<del>
<del> _push() {
<del> const state = this.state.navigationState;
<del> const nextState = NavigationStateUtils.push(
<del> state,
<del> {key: 'Route ' + (state.index + 1)},
<add> _renderNavigation(navigationState, onNavigate) {
<add> return (
<add> <NavigationCardStack
<add> direction={this.state.isHorizontal ? 'horizontal' : 'vertical'}
<add> navigationState={navigationState}
<add> onNavigate={onNavigate}
<add> renderScene={this._renderScene}
<add> style={styles.main}
<add> />
<ide> );
<del> this.setState({
<del> navigationState: nextState,
<del> });
<del> }
<del>
<del> _pop() {
<del> const state = this.state.navigationState;
<del> const nextState = state.index > 0 ?
<del> NavigationStateUtils.pop(state) :
<del> state;
<del>
<del> this.setState({
<del> navigationState: nextState,
<del> });
<ide> }
<ide>
<ide> _renderScene(props) {
<add> const {navigationParentState, onNavigate} = props;
<ide> return (
<ide> <ScrollView style={styles.scrollView}>
<ide> <NavigationExampleRow
<ide> class NavigationCardStackExample extends React.Component {
<ide> />
<ide> <NavigationExampleRow
<ide> text="Push Route"
<del> onPress={this._push}
<add> onPress={() => {
<add> onNavigate({
<add> type: 'push',
<add> key: 'Route ' + navigationParentState.children.length,
<add> });
<add> }}
<ide> />
<ide> <NavigationExampleRow
<ide> text="Pop Route"
<del> onPress={this._pop}
<add> onPress={() => {
<add> onNavigate({
<add> type: 'pop',
<add> });
<add> }}
<ide> />
<ide> <NavigationExampleRow
<ide> text="Exit Card Stack Example"
<ide> class NavigationCardStackExample extends React.Component {
<ide> isHorizontal: !this.state.isHorizontal,
<ide> });
<ide> }
<add>
<add> _onNavigate(action) {
<add> if (action && action.type === 'back') {
<add> this._pop();
<add> }
<add> }
<ide> }
<ide>
<ide> const styles = StyleSheet.create({
<ide><path>Libraries/CustomComponents/NavigationExperimental/NavigationCardStack.js
<ide> const Animated = require('Animated');
<ide> const NavigationAnimatedView = require('NavigationAnimatedView');
<ide> const NavigationCardStackItem = require('NavigationCardStackItem');
<ide> const NavigationContainer = require('NavigationContainer');
<add>const NavigationLinearPanResponder = require('NavigationLinearPanResponder');
<ide> const React = require('React');
<ide> const ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin');
<ide> const StyleSheet = require('StyleSheet');
<ide>
<ide> const emptyFunction = require('emptyFunction');
<ide>
<ide> const {PropTypes} = React;
<del>const {Directions} = NavigationCardStackItem;
<add>const {Directions} = NavigationLinearPanResponder;
<ide>
<ide> import type {
<ide> NavigationParentState,
<ide> } from 'NavigationStateUtils';
<ide>
<ide> import type {
<del> Layout,
<ide> NavigationStateRenderer,
<ide> NavigationStateRendererProps,
<ide> Position,
<ide> import type {
<ide> type Props = {
<ide> direction: string,
<ide> navigationState: NavigationParentState,
<del> renderOverlay: NavigationStateRenderer,
<add> renderOverlay: ?NavigationStateRenderer,
<ide> renderScene: NavigationStateRenderer,
<ide> };
<ide>
<ide> class NavigationCardStack extends React.Component {
<ide> layout,
<ide> navigationState,
<ide> position,
<add> navigationParentState,
<ide> } = props;
<ide>
<ide> return (
<ide> class NavigationCardStack extends React.Component {
<ide> index={index}
<ide> key={navigationState.key}
<ide> layout={layout}
<add> navigationParentState={navigationParentState}
<ide> navigationState={navigationState}
<ide> position={position}
<ide> renderScene={this.props.renderScene}
<ide> NavigationCardStack.defaultProps = {
<ide> renderOverlay: emptyFunction.thatReturnsNull,
<ide> };
<ide>
<del>NavigationCardStack.Directions = Directions;
<del>
<ide> const styles = StyleSheet.create({
<ide> animatedView: {
<ide> flex: 1,
<ide><path>Libraries/CustomComponents/NavigationExperimental/NavigationCardStackItem.js
<ide>
<ide> const Animated = require('Animated');
<ide> const NavigationContainer = require('NavigationContainer');
<add>const NavigationLinearPanResponder = require('NavigationLinearPanResponder');
<ide> const React = require('React');
<add>const ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin');
<ide> const StyleSheet = require('StyleSheet');
<ide> const View = require('View');
<del>const ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin');
<ide>
<ide> const {PropTypes} = React;
<add>const {Directions} = NavigationLinearPanResponder;
<ide>
<ide> import type {
<ide> NavigationParentState,
<ide> } from 'NavigationStateUtils';
<ide>
<del>
<ide> import type {
<ide> Layout,
<ide> Position,
<ide> NavigationStateRenderer,
<ide> } from 'NavigationAnimatedView';
<ide>
<add>import type {
<add> Direction,
<add> OnNavigateHandler,
<add>} from 'NavigationLinearPanResponder';
<add>
<ide> type AnimatedValue = Animated.Value;
<ide>
<ide> type Props = {
<del> direction: string,
<add> direction: Direction,
<ide> index: number;
<ide> layout: Layout;
<del> navigationState: NavigationParentState;
<del> position: Position;
<del> renderScene: NavigationStateRenderer;
<add> navigationParentState: NavigationParentState,
<add> navigationState: NavigationParentState,
<add> position: Position,
<add> onNavigate: ?OnNavigateHandler,
<add> renderScene: NavigationStateRenderer,
<ide> };
<ide>
<ide> type State = {
<ide> class AmimatedValueSubscription {
<ide> }
<ide> }
<ide>
<add>/**
<add> * Class that provides the required information for the
<add> * `NavigationLinearPanResponder`. This class must implement
<add> * the interface `NavigationLinearPanResponderDelegate`.
<add> */
<add>class PanResponderDelegate {
<add> _props : Props;
<add>
<add> constructor(props: Props) {
<add> this._props = props;
<add> }
<add>
<add> getDirection(): Direction {
<add> return this._props.direction;
<add> }
<add>
<add> getIndex(): number {
<add> return this._props.navigationParentState.index;
<add> }
<add>
<add> getLayout(): Layout {
<add> return this._props.layout;
<add> }
<add>
<add> getPosition(): Position {
<add> return this._props.position;
<add> }
<add>
<add> onNavigate(action: {type: string}): void {
<add> this._props.onNavigate && this._props.onNavigate(action);
<add> }
<add>}
<add>
<ide> /**
<ide> * Component that renders the scene as card for the <NavigationCardStack />.
<ide> */
<ide> class NavigationCardStackItem extends React.Component {
<ide> const {
<ide> direction,
<ide> index,
<del> navigationState,
<add> navigationParentState,
<ide> position,
<del> layout,
<ide> } = this.props;
<ide> const {
<ide> height,
<ide> class NavigationCardStackItem extends React.Component {
<ide> ],
<ide> };
<ide>
<add> let panHandlers = null;
<add> if (navigationParentState.index === index) {
<add> const delegate = new PanResponderDelegate(this.props);
<add> const panResponder = new NavigationLinearPanResponder(delegate);
<add> panHandlers = panResponder.panHandlers;
<add> }
<add>
<ide> return (
<ide> <Animated.View
<add> {...panHandlers}
<ide> style={[styles.main, animatedStyle]}>
<ide> {this.props.renderScene(this.props)}
<ide> </Animated.View>
<ide> class NavigationCardStackItem extends React.Component {
<ide> }
<ide> }
<ide>
<del>const Directions = {
<del> HORIZONTAL: 'horizontal',
<del> VERTICAL: 'vertical',
<del>};
<del>
<ide> NavigationCardStackItem.propTypes = {
<ide> direction: PropTypes.oneOf([Directions.HORIZONTAL, Directions.VERTICAL]),
<ide> index: PropTypes.number.isRequired,
<ide> layout: PropTypes.object.isRequired,
<ide> navigationState: PropTypes.object.isRequired,
<add> navigationParentState: PropTypes.object.isRequired,
<ide> position: PropTypes.object.isRequired,
<ide> renderScene: PropTypes.func.isRequired,
<ide> };
<ide> NavigationCardStackItem.defaultProps = {
<ide> direction: Directions.HORIZONTAL,
<ide> };
<ide>
<del>NavigationCardStackItem = NavigationContainer.create(NavigationCardStackItem);
<del>
<del>NavigationCardStackItem.Directions = Directions;
<del>
<ide> const styles = StyleSheet.create({
<ide> main: {
<ide> backgroundColor: '#E9E9EF',
<ide> const styles = StyleSheet.create({
<ide> },
<ide> });
<ide>
<del>
<del>
<del>module.exports = NavigationCardStackItem;
<add>module.exports = NavigationContainer.create(NavigationCardStackItem);
<ide><path>Libraries/NavigationExperimental/NavigationAbstractPanResponder.js
<add>/**
<add> * Copyright 2004-present Facebook. All Rights Reserved.
<add> *
<add> * @providesModule NavigationAbstractPanResponder
<add> * @flow
<add> */
<add>'use strict';
<add>
<add>const PanResponder = require('PanResponder');
<add>
<add>const invariant = require('invariant');
<add>
<add>const EmptyPanHandlers = {
<add> onMoveShouldSetPanResponder: null,
<add> onPanResponderGrant: null,
<add> onPanResponderMove: null,
<add> onPanResponderRelease: null,
<add> onPanResponderTerminate: null,
<add>};
<add>
<add>/**
<add> * Abstract class that defines the common interface of PanResponder that handles
<add> * the gesture actions.
<add> */
<add>class NavigationAbstractPanResponder {
<add>
<add> panHandlers: Object;
<add>
<add> constructor() {
<add> const config = {};
<add> Object.keys(EmptyPanHandlers).forEach(name => {
<add> const fn: any = (this: any)[name];
<add>
<add> invariant(
<add> typeof fn === 'function',
<add> 'subclass of `NavigationAbstractPanResponder` must implement method %s',
<add> name
<add> );
<add>
<add> config[name] = fn.bind(this);
<add> }, this);
<add>
<add> this.panHandlers = PanResponder.create(config).panHandlers;
<add> }
<add>}
<add>
<add>module.exports = NavigationAbstractPanResponder;
<ide><path>Libraries/NavigationExperimental/NavigationAnimatedView.js
<ide> type NavigationStateRendererProps = {
<ide> layout: Layout,
<ide> // The state of the the containing navigation view.
<ide> navigationParentState: NavigationParentState,
<add>
<add> onNavigate: (action: any) => void,
<ide> };
<ide>
<ide> type NavigationStateRenderer = (
<ide> type TimingSetter = (
<ide> ) => void;
<ide>
<ide> type Props = {
<del> navigationState: NavigationParentState;
<del> renderScene: NavigationStateRenderer;
<del> renderOverlay: ?NavigationStateRenderer;
<del> style: any;
<del> setTiming: ?TimingSetter;
<add> navigationState: NavigationParentState,
<add> onNavigate: (action: any) => void,
<add> renderScene: NavigationStateRenderer,
<add> renderOverlay: ?NavigationStateRenderer,
<add> style: any,
<add> setTiming: ?TimingSetter,
<ide> };
<ide>
<ide> class NavigationAnimatedView extends React.Component {
<ide> class NavigationAnimatedView extends React.Component {
<ide> layout: this._getLayout(),
<ide> navigationParentState: this.props.navigationState,
<ide> navigationState: scene.state,
<add> onNavigate: this.props.onNavigate,
<ide> position: this.state.position,
<ide> });
<ide> }
<ide> _renderOverlay() {
<del> const {renderOverlay} = this.props;
<add> const {
<add> onNavigate,
<add> renderOverlay,
<add> navigationState,
<add> } = this.props;
<ide> if (renderOverlay) {
<del> const parentState = this.props.navigationState;
<ide> return renderOverlay({
<del> index: parentState.index,
<add> index: navigationState.index,
<ide> layout: this._getLayout(),
<del> navigationParentState: parentState,
<del> navigationState: parentState.children[parentState.index],
<add> navigationParentState: navigationState,
<add> navigationState: navigationState.children[navigationState.index],
<add> onNavigate: onNavigate,
<ide> position: this.state.position,
<ide> });
<ide> }
<ide><path>Libraries/NavigationExperimental/NavigationLinearPanResponder.js
<add>/**
<add> * Copyright 2004-present Facebook. All Rights Reserved.
<add> *
<add> * @providesModule NavigationLinearPanResponder
<add> * @flow
<add> * @typechecks
<add> */
<add>'use strict';
<add>
<add>const Animated = require('Animated');
<add>const NavigationAbstractPanResponder = require('NavigationAbstractPanResponder');
<add>
<add>const clamp = require('clamp');
<add>
<add>/**
<add> * The duration of the card animation in milliseconds.
<add> */
<add>const ANIMATION_DURATION = 250;
<add>
<add>/**
<add> * The threshold to invoke the `onNavigate` action.
<add> * For instance, `1 / 3` means that moving greater than 1 / 3 of the width of
<add> * the view will navigate.
<add> */
<add>const POSITION_THRESHOLD = 1 / 3;
<add>
<add>/**
<add> * The threshold (in pixels) to start the gesture action.
<add> */
<add>const RESPOND_THRESHOLD = 15;
<add>
<add>/**
<add> * The threshold (in speed) to finish the gesture action.
<add> */
<add>const VELOCITY_THRESHOLD = 100;
<add>
<add>/**
<add> * Primitive gesture directions.
<add> */
<add>const Directions = {
<add> 'HORIZONTAL': 'horizontal',
<add> 'VERTICAL': 'vertical',
<add>};
<add>
<add>/**
<add> * Primitive gesture actions.
<add> */
<add>const Actions = {
<add> // The gesture to navigate backward.
<add> // This is done by swiping from the left to the right or from the top to the
<add> // bottom.
<add> BACK: {type: 'back'},
<add>};
<add>
<add>import type {
<add> Layout,
<add> Position,
<add>} from 'NavigationAnimatedView';
<add>
<add>export type OnNavigateHandler = (action: {type: string}) => void;
<add>
<add>export type Direction = $Enum<typeof Directions>;
<add>
<add>/**
<add> * The type interface of the object that provides the information required by
<add> * NavigationLinearPanResponder.
<add> */
<add>export type NavigationLinearPanResponderDelegate = {
<add> getDirection: () => Direction;
<add> getIndex: () => number,
<add> getLayout: () => Layout,
<add> getPosition: () => Position,
<add> onNavigate: OnNavigateHandler,
<add>};
<add>
<add>/**
<add> * Pan responder that handles the One-dimensional gesture (horizontal or
<add> * vertical).
<add> */
<add>class NavigationLinearPanResponder extends NavigationAbstractPanResponder {
<add> static Actions: Object;
<add> static Directions: Object;
<add>
<add> _isResponding: boolean;
<add> _startValue: number;
<add> _delegate: NavigationLinearPanResponderDelegate;
<add>
<add> constructor(delegate: NavigationLinearPanResponderDelegate) {
<add> super();
<add> this._isResponding = false;
<add> this._startValue = 0;
<add> this._delegate = delegate;
<add> }
<add>
<add> onMoveShouldSetPanResponder(event: any, gesture: any): boolean {
<add> const delegate = this._delegate;
<add> const layout = delegate.getLayout();
<add> const isVertical = delegate.getDirection() === Directions.VERTICAL;
<add> const axis = isVertical ? 'dy' : 'dx';
<add> const index = delegate.getIndex();
<add> const distance = isVertical ?
<add> layout.height.__getValue() :
<add> layout.width.__getValue();
<add>
<add> return (
<add> Math.abs(gesture[axis]) > RESPOND_THRESHOLD &&
<add> distance > 0 &&
<add> index > 0
<add> );
<add> }
<add>
<add> onPanResponderGrant(): void {
<add> this._isResponding = false;
<add> this._delegate.getPosition().stopAnimation((value: number) => {
<add> this._isResponding = true;
<add> this._startValue = value;
<add> });
<add> }
<add>
<add> onPanResponderMove(event: any, gesture: any): void {
<add> if (!this._isResponding) {
<add> return;
<add> }
<add>
<add> const delegate = this._delegate;
<add> const layout = delegate.getLayout();
<add> const isVertical = delegate.getDirection() === Directions.VERTICAL;
<add> const axis = isVertical ? 'dy' : 'dx';
<add> const index = delegate.getIndex();
<add> const distance = isVertical ?
<add> layout.height.__getValue() :
<add> layout.width.__getValue();
<add>
<add> const value = clamp(
<add> index - 1,
<add> this._startValue - (gesture[axis] / distance),
<add> index
<add> );
<add>
<add> this._delegate.getPosition().setValue(value);
<add> }
<add>
<add> onPanResponderRelease(event: any, gesture: any): void {
<add> if (!this._isResponding) {
<add> return;
<add> }
<add>
<add> this._isResponding = false;
<add>
<add> const delegate = this._delegate;
<add> const isVertical = delegate.getDirection() === Directions.VERTICAL;
<add> const axis = isVertical ? 'dy' : 'dx';
<add> const index = delegate.getIndex();
<add> const velocity = gesture[axis];
<add>
<add> delegate.getPosition().stopAnimation((value: number) => {
<add> this._reset();
<add> if (velocity > VELOCITY_THRESHOLD || value <= index - POSITION_THRESHOLD) {
<add> delegate.onNavigate(Actions.BACK);
<add> }
<add> });
<add> }
<add>
<add> onPanResponderTerminate(): void {
<add> this._isResponding = false;
<add> this._reset();
<add> }
<add>
<add> _reset(): void {
<add> Animated.timing(
<add> this._delegate.getPosition(),
<add> {
<add> toValue: this._delegate.getIndex(),
<add> duration: ANIMATION_DURATION,
<add> }
<add> ).start();
<add> }
<add>}
<add>
<add>NavigationLinearPanResponder.Actions = Actions;
<add>NavigationLinearPanResponder.Directions = Directions;
<add>
<add>module.exports = NavigationLinearPanResponder; | 6 |
Text | Text | add translation kr/threejs-indexed-textures.md | c99ad7363cb220d8851dd818f5b33c31f5b477b5 | <ide><path>threejs/lessons/kr/threejs-indexed-textures.md
<add>Title: 피킹과 색상에 인덱스 텍스처 사용하기
<add>Description: 인덱스 텍스처를 사용해 피킹을 구현하고, 색상을 정하는 법을 알아봅니다
<add>TOC: 피킹과 색상에 인덱스 텍스처 사용하기
<add>
<add>※ 이 글은 [HTML 요소를 3D로 정렬하기](threejs-align-html-elements-to-3d.html)에서 이어집니다. 이전 글을 읽지 않았다면 먼저 읽고 오기 바랍니다.
<add>
<add>
<add>Three.js를 쓰다보면 창의적인 해결법이 필요할 때가 있습니다. 저도 나름 시리즈를 진행하며 나름 많은 해결법을 찾고, 적어 놓았죠. 혹 필요한 게 있다면 확인해보기 바랍니다. 물론 그게 최적의 해결법이라고 단언할 수는 없지만요.
<add>
<add>[이전 글](threejs-align-html-elements-to-3d.html)에서는 3D 지구본 주위에 나라 이름을 표기했습니다. 여기서 더 나아가 사용자가 나라를 선택하고 자기가 선택한 나라를 보게 한다면 어떨까요? 또 어떻게 구현할 수 있을까요?
<add>
<add>가장 쉽게 떠오르는 방법은 각 나라마다 geometry를 만드는 겁니다. 이전에 했던 것처럼 [피킹(picking)](threejs-picking.html)을 써서 구현할 수 있겠죠. 이미 각 나라의 3D geometry는 만들었으니 사용자가 mesh를 클릭했을 때 어떤 나라를 클릭했는지 알 수 있을 겁니다.
<add>
<add>시험삼아 [이전 글](threejs-align-html-elements-to-3d.html)에서 윤곽선을 만들기 위해 사용했던 데이터로 각 나라마다 3D mesh를 만들어봤습니다. 결과로 15.5MB짜리 GLTF(.glb) 파일이 나왔죠. 사용자가 간단한 지구본을 보려고 15.5MB나 다운 받아야 한다니, 개인적인 의견이지만 너무 과한 듯합니다.
<add>
<add>데이터를 압축할 수 있는 방법이야 많습니다. 예를 들어 특정 알고리즘을 도입해 윤곽선의 해상도를 낮출 수 있죠. 이 글에서는 시도하지 않을 텐데, 이유는 미국의 경우 데이터를 많이 줄일 수 있겠지만 캐나다나 섬이 많은 나라는 그렇지 않을 것이기 때문입니다.
<add>
<add>다른 방법은 실제 데이터를 전부 압축하는 겁니다. 압축 프로그램을 돌려 압축하니 용량이 11MB까지 줄더군요. 30% 정도 줄긴 했지만 여전히 큰 파일입니다.
<add>
<add>32비트 부동 소수 대신 16비트 방식으로 데이터를 저장할 수도 있습니다. 또는 [드레이코 압축기](https://google.github.io/draco/) 같은 프로그램을 사용하는 것만으로 충분히 데이터를 줄일 수 있을지도 모르죠. 전 따로 드레이코 압축기를 사용해보진 않았으니 여러분이 한 번 써보시고 알려주신다면 감사하겠습니다 😅.
<add>
<add>이 글에서는 [피킹에 관한 글](threejs-picking.html) 마지막에서 다뤘던 [GPU 피킹](threejs-picking.html)을 사용해보겠습니다. 각 mesh에 id 역할을 할 고유한 색을 부여하고 해당 mesh를 클릭했을 때 해당 픽셀의 색상값으로 사용자가 어떤 mesh를 클릭했는지 알아내는 방법이죠.
<add>
<add>일단 각 나라에 고유한 색상을 부여한 뒤, 이 색상값을 인덱스로 나라 배열을 만듭니다. 그리고 피킹용 텍스처를 만든 뒤 이걸로 지구본을 렌더링합니다. 이러면 사용자가 클릭한 픽셀을 확인해 어떤 나라를 클릭했는지 알 수 있겠죠.
<add>
<add>먼저 [약간의 코드](https://github.com/gfxfundamentals/threejsfundamentals/blob/master/threejs/lessons/tools/geo-picking/)를 작성해 아래의 텍스처를 만들었습니다.
<add>
<add><div class="threejs_center"><img src="../resources/data/world/country-index-texture.png" style="width: 700px;"></div>
<add>
<add>> 참고: 이 텍스트를 만드는 데 사용한 데이터는 이 [웹사이트](http://thematicmapping.org/downloads/world_borders.php)이며, 라이선스는 [CC-BY-SA](http://creativecommons.org/licenses/by-sa/3.0/)입니다.
<add>
<add>이 이미지는 271KB 정도밖에 되지 않습니다. 나라들의 mesh가 14MB가 넘었던 것에 비하면 훨씬 낫네요. 물론 해상도를 더 낮출 수도 있지만 이 정도면 충분한 것 같네요.
<add>
<add>이제 나라에 피킹을 적용해 봅시다.
<add>
<add>[GPU 피킹 예제](threejs-picking.html)의 코드를 가져와 피킹용 장면(scene)을 따로 만듭니다.
<add>
<add>```js
<add>const pickingScene = new THREE.Scene();
<add>pickingScene.background = new THREE.Color(0);
<add>```
<add>
<add>피킹용 장면에 피킹용 텍스처를 입힌 지구본을 추가합니다.
<add>
<add>```js
<add>{
<add> const loader = new THREE.TextureLoader();
<add> const geometry = new THREE.SphereBufferGeometry(1, 64, 32);
<add>
<add>+ const indexTexture = loader.load('resources/data/world/country-index-texture.png', render);
<add>+ indexTexture.minFilter = THREE.NearestFilter;
<add>+ indexTexture.magFilter = THREE.NearestFilter;
<add>+
<add>+ const pickingMaterial = new THREE.MeshBasicMaterial({ map: indexTexture });
<add>+ pickingScene.add(new THREE.Mesh(geometry, pickingMaterial));
<add>
<add> const texture = loader.load('resources/data/world/country-outlines-4k.png', render);
<add> const material = new THREE.MeshBasicMaterial({ map: texture });
<add> scene.add(new THREE.Mesh(geometry, material));
<add>}
<add>```
<add>
<add>다음으로 `GPUPickHelper`를 통째로 가져와 몇 가지 수정합니다.
<add>
<add>```js
<add>class GPUPickHelper {
<add> constructor() {
<add> // 1x1 픽셀 크기의 렌더 타겟을 생성합니다
<add> this.pickingTexture = new THREE.WebGLRenderTarget(1, 1);
<add> this.pixelBuffer = new Uint8Array(4);
<add>- this.pickedObject = null;
<add>- this.pickedObjectSavedColor = 0;
<add> }
<add> pick(cssPosition, scene, camera) {
<add> const { pickingTexture, pixelBuffer } = this;
<add>
<add> // view offset을 마우스 포인터 아래 1픽셀로 설정합니다
<add> const pixelRatio = renderer.getPixelRatio();
<add> camera.setViewOffset(
<add> renderer.getContext().drawingBufferWidth, // 전체 너비
<add> renderer.getContext().drawingBufferHeight, // 전체 높이
<add> cssPosition.x * pixelRatio | 0, // 사각 x 좌표
<add> cssPosition.y * pixelRatio | 0, // 사각 y 좌표
<add> 1, // 사각 좌표 width
<add> 1, // 사각 좌표 height
<add> );
<add> // 장면을 렌더링합니다
<add> renderer.setRenderTarget(pickingTexture);
<add> renderer.render(scene, camera);
<add> renderer.setRenderTarget(null);
<add> // view offset을 정상으로 돌려 원래의 화면을 렌더링하도록 합니다
<add> camera.clearViewOffset();
<add> // 픽셀을 감지합니다
<add> renderer.readRenderTargetPixels(
<add> pickingTexture,
<add> 0, // x
<add> 0, // y
<add> 1, // width
<add> 1, // height
<add> pixelBuffer);
<add>
<add>+ const id =
<add>+ (pixelBuffer[0] << 16) |
<add>+ (pixelBuffer[1] << 8) |
<add>+ (pixelBuffer[2] << 0);
<add>+
<add>+ return id;
<add>- const id =
<add>- (pixelBuffer[0] << 16) |
<add>- (pixelBuffer[1] << 8) |
<add>- (pixelBuffer[2] );
<add>- const intersectedObject = idToObject[id];
<add>- if (intersectedObject) {
<add>- // 첫 번째 물체가 제일 가까우므로 해당 물체를 고릅니다
<add>- this.pickedObject = intersectedObject;
<add>- // 기존 색을 저장해둡니다
<add>- this.pickedObjectSavedColor = this.pickedObject.material.emissive.getHex();
<add>- // emissive 색을 빨강/노랑으로 빛나게 만듭니다
<add>- this.pickedObject.material.emissive.setHex((time * 8) % 2 > 1 ? 0xFFFF00 : 0xFF0000);
<add>- }
<add> }
<add>}
<add>```
<add>
<add>`GPUPickHelper`를 이용해 나라를 선택하도록 합니다.
<add>
<add>```js
<add>const pickHelper = new GPUPickHelper();
<add>
<add>function getCanvasRelativePosition(event) {
<add> const rect = canvas.getBoundingClientRect();
<add> return {
<add> x: (event.clientX - rect.left) * canvas.width / rect.width,
<add> y: (event.clientY - rect.top ) * canvas.height / rect.height,
<add> };
<add>}
<add>
<add>function pickCountry(event) {
<add> // 아직 데이터를 불러오지 않았을 경우
<add> if (!countryInfos) {
<add> return;
<add> }
<add>
<add> const position = getCanvasRelativePosition(event);
<add> const id = pickHelper.pick(position, pickingScene, camera);
<add> if (id > 0) {
<add> // 나라를 선택했을 때 해당 나라의 'selected' 속성을 바꿉니다.
<add> const countryInfo = countryInfos[id - 1];
<add> const selected = !countryInfo.selected;
<add> // 나라를 클릭했을 때 특수키를 누르지 않았다면 다른 나라의 'selected'
<add> // 속성을 전부 끕니다.
<add> if (selected && !event.shiftKey && !event.ctrlKey && !event.metaKey) {
<add> unselectAllCountries();
<add> }
<add> numCountriesSelected += selected ? 1 : -1;
<add> countryInfo.selected = selected;
<add> } else if (numCountriesSelected) {
<add> // 바다나 하늘을 클릭했을 경우
<add> unselectAllCountries();
<add> }
<add> requestRenderIfNotRequested();
<add>}
<add>
<add>function unselectAllCountries() {
<add> numCountriesSelected = 0;
<add> countryInfos.forEach((countryInfo) => {
<add> countryInfo.selected = false;
<add> });
<add>}
<add>
<add>canvas.addEventListener('mouseup', pickCountry);
<add>
<add>let lastTouch;
<add>canvas.addEventListener('touchstart', (event) => {
<add> // 스크롤 이벤트를 방지합니다.
<add> event.preventDefault();
<add> lastTouch = event.touches[0];
<add>}, { passive: false });
<add>canvas.addEventListener('touchmove', (event) => {
<add> lastTouch = event.touches[0];
<add>});
<add>canvas.addEventListener('touchend', () => {
<add> pickCountry(lastTouch);
<add>});
<add>```
<add>
<add>위 코드는 나라 배열에 속한 나라의 `selected` 속성을 켜고 끕니다. `shift`, `ctrl`, `cmd` 중 하나를 누르면 하나 이상의 나라를 선택할 수 있죠.
<add>
<add>이제 선택한 나라를 보여줄 일만 남았습니다. 지금은 일단 해당 나라의 이름표를 보여주기로 하죠.
<add>
<add>```js
<add>function updateLabels() {
<add> // 아직 데이터를 불러오지 않았을 경우
<add> if (!countryInfos) {
<add> return;
<add> }
<add>
<add> const large = settings.minArea * settings.minArea;
<add> // 카메라의 상대 방향을 나타내는 행렬 좌표를 가져옵니다.
<add> normalMatrix.getNormalMatrix(camera.matrixWorldInverse);
<add> // 카메라의 위치를 가져옵니다.
<add> camera.getWorldPosition(cameraPosition);
<add> for (const countryInfo of countryInfos) {
<add>- const { position, elem, area } = countryInfo;
<add>- // 영역이 특정 값보다 작다면 이름표를 표시하지 않습니다.
<add>- if (area < large) {
<add>+ const { position, elem, area, selected } = countryInfo;
<add>+ const largeEnough = area >= large;
<add>+ const show = selected || (numCountriesSelected === 0 && largeEnough);
<add>+ if (!show) {
<add> elem.style.display = 'none';
<add> continue;
<add> }
<add>
<add> ...
<add>```
<add>
<add>이제 나라를 선택해 볼 수 있습니다.
<add>
<add>{{{example url="../threejs-indexed-textures-picking.html" }}}
<add>
<add>위 예제는 여전히 영역 크기에 따라 나라 이름을 보여주긴 하나, 특정 나라를 클릭하면 해당 나라의 이름만 보여줄 겁니다.
<add>
<add>이만하면 각 나라를 피킹하는 예제로 충분해 보이지만... 선택한 나라의 색을 바꾸려면 어떻게 해야 할까요?
<add>
<add>*컬러 팔레트(color palette)*를 사용하면 이 문제를 해결할 수 있습니다.
<add>
<add>[컬러 팔레트](https://ko.wikipedia.org/wiki/%ED%8C%94%EB%A0%88%ED%8A%B8_(%EC%BB%B4%ED%93%A8%ED%8C%85)) 혹은 [인덱스 팔레트](https://en.wikipedia.org/wiki/Indexed_color)는 아타리 800, Amiga, NES, 슈퍼 닌텐도, 구형 IBM PC 등 구형 시스템에서 사용하던 기법입니다. 비트맵을 색상당 8비트 혹은 24바이트 이상의 RGB 색상으로 적용하는 대신 비트맵을 8비트 이하의 값으로 저장하는 기법이죠. 각 픽셀의 색상값은 팔레트의 인덱스 값으로, 픽셀의 색상값이 3이라면 특정 "팔레트"의 3번 색상을 사용한다는 의미입니다.
<add>
<add>자바스크립트로 설명하자면 아래와 같은 형식을 생각할 수 있습니다.
<add>
<add>```js
<add>const face7x7PixelImageData = [
<add> 0, 1, 1, 1, 1, 1, 0,
<add> 1, 0, 0, 0, 0, 0, 1,
<add> 1, 0, 2, 0, 2, 0, 1,
<add> 1, 0, 0, 0, 0, 0, 1,
<add> 1, 0, 3, 3, 3, 0, 1,
<add> 1, 0, 0, 0, 0, 0, 1,
<add> 0, 1, 1, 1, 1, 1, 1,
<add>];
<add>
<add>const palette = [
<add> [255, 255, 255], // white
<add> [ 0, 0, 0], // black
<add> [ 0, 255, 255], // cyan
<add> [255, 0, 0], // red
<add>];
<add>```
<add>
<add>이미지 데이터의 각 픽셀은 팔레트의 인덱스를 가리킵니다. 위 데이터를 위 팔레트로 해석하면 다음과 같은 이미지가 나오겠죠.
<add>
<add><div class="threejs_center"><img src="resources/images/7x7-indexed-face.png"></div>
<add>
<add>예제의 경우 이미 각 나라별로 고유 색을 부여한 텍스처가 있습니다. 이 텍스처에 팔레트를 적용하면 각 나라에 다른 색을 부여할 수 있겠죠. 또 이 팔레트의 색을 바꾸면 각 나라의 색도 바뀔 겁니다. 그러니 팔레트의 색을 전부 검정으로 바꾼 뒤, 선택한 나라만 다른 색으로 바꾸면 해당 나라를 선택했다는 것을 시각적으로 나타낼 수 있을 겁니다.
<add>
<add>컬러 팔레트 기법을 사용하려면 쉐이더를 직접 만들어야 합니다. Three.js의 내장 쉐이더를 수정해서 사용하면 조명이나 다른 기능도 나중에 사용할 수 있으니 이 방법을 사용하도록 하죠.
<add>
<add>[다중 애니메이션 요소 최적화하기](threejs-optimize-lots-of-objects-animated.html)에서 다뤘듯 재질의 `onBeforeCompile` 속성에 함수를 지정하면 내장 쉐이더를 수정할 수 있습니다.
<add>
<add>아래는 내장 fragment 쉐이더를 수정하기 전입니다.
<add>
<add>```glsl
<add>#include <common>
<add>#include <color_pars_fragment>
<add>#include <uv_pars_fragment>
<add>#include <uv2_pars_fragment>
<add>#include <map_pars_fragment>
<add>#include <alphamap_pars_fragment>
<add>#include <aomap_pars_fragment>
<add>#include <lightmap_pars_fragment>
<add>#include <envmap_pars_fragment>
<add>#include <fog_pars_fragment>
<add>#include <specularmap_pars_fragment>
<add>#include <logdepthbuf_pars_fragment>
<add>#include <clipping_planes_pars_fragment>
<add>void main() {
<add> #include <clipping_planes_fragment>
<add> vec4 diffuseColor = vec4( diffuse, opacity );
<add> #include <logdepthbuf_fragment>
<add> #include <map_fragment>
<add> #include <color_fragment>
<add> #include <alphamap_fragment>
<add> #include <alphatest_fragment>
<add> #include <specularmap_fragment>
<add> ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
<add> #ifdef USE_LIGHTMAP
<add> reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
<add> #else
<add> reflectedLight.indirectDiffuse += vec3( 1.0 );
<add> #endif
<add> #include <aomap_fragment>
<add> reflectedLight.indirectDiffuse *= diffuseColor.rgb;
<add> vec3 outgoingLight = reflectedLight.indirectDiffuse;
<add> #include <envmap_fragment>
<add> gl_FragColor = vec4( outgoingLight, diffuseColor.a );
<add> #include <premultiplied_alpha_fragment>
<add> #include <tonemapping_fragment>
<add> #include <encodings_fragment>
<add> #include <fog_fragment>
<add>}
<add>```
<add>
<add>[위 코드의 쉐이더 조각](https://github.com/mrdoob/three.js/tree/dev/src/renderers/shaders/ShaderChunk)을 일일이 뒤져 보니 Three.js는 `diffuseColor`라는 변수로 재질(material)의 색상값을 제어합니다. 이 변수는 `<color_fragment>`라는 [쉐이더 조각](https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js)에서 선언하니 변수 선언 후에 색상값을 수정하면 되겠네요.
<add>
<add>저 때 `diffuseColor`는 아까 만들었던 윤곽선 텍스처에서 색상을 가져온 상태일 테니, 이 색상값으로 팔레트 텍스처에서 새로운 색상값을 가져 올 수 있을 겁니다.
<add>
<add>[이전에 했던 것](threejs-optimize-lots-of-objects-animated.html)처럼 바꿀 문자열 정보를 배열로 만들어 `Material.onBeforeCompile`에서 쉐이더를 수정하겠습니다.
<add>
<add>```js
<add>{
<add> const loader = new THREE.TextureLoader();
<add> const geometry = new THREE.SphereBufferGeometry(1, 64, 32);
<add>
<add> const indexTexture = loader.load('resources/data/world/country-index-texture.png', render);
<add> indexTexture.minFilter = THREE.NearestFilter;
<add> indexTexture.magFilter = THREE.NearestFilter;
<add>
<add> const pickingMaterial = new THREE.MeshBasicMaterial({ map: indexTexture });
<add> pickingScene.add(new THREE.Mesh(geometry, pickingMaterial));
<add>
<add>+ const fragmentShaderReplacements = [
<add>+ {
<add>+ from: '#include <common>',
<add>+ to: `
<add>+ #include <common>
<add>+ uniform sampler2D indexTexture;
<add>+ uniform sampler2D paletteTexture;
<add>+ uniform float paletteTextureWidth;
<add>+ `,
<add>+ },
<add>+ {
<add>+ from: '#include <color_fragment>',
<add>+ to: `
<add>+ #include <color_fragment>
<add>+ {
<add>+ vec4 indexColor = texture2D(indexTexture, vUv);
<add>+ float index = indexColor.r * 255.0 + indexColor.g * 255.0 * 256.0;
<add>+ vec2 paletteUV = vec2((index + 0.5) / paletteTextureWidth, 0.5);
<add>+ vec4 paletteColor = texture2D(paletteTexture, paletteUV);
<add>+ // diffuseColor.rgb += paletteColor.rgb; // 하얀 윤곽선
<add>+ diffuseColor.rgb = paletteColor.rgb - diffuseColor.rgb; // 검은 윤곽선
<add>+ }
<add>+ `,
<add>+ },
<add>+ ];
<add>
<add> const texture = loader.load('resources/data/world/country-outlines-4k.png', render);
<add> const material = new THREE.MeshBasicMaterial({ map: texture });
<add>+ material.onBeforeCompile = function(shader) {
<add>+ fragmentShaderReplacements.forEach((rep) => {
<add>+ shader.fragmentShader = shader.fragmentShader.replace(rep.from, rep.to);
<add>+ });
<add>+ };
<add> scene.add(new THREE.Mesh(geometry, material));
<add>}
<add>```
<add>
<add>위 코드에서는 `indexTexture`, `paletteTexture`, `paletteTextureWidth`, 총 3개의 균등 변수(uniform)를 사용했습니다. `indexTexture`는 색상값을 불러와 인덱스로 변환하기 위한 것으로, 이때 사용한 `vUv`는 Three.js가 넘겨주는 텍스처 좌표이죠. 그리고 이 인덱스 값으로 컬러 팔레트에서 새로운 색상값을 가져 와 `diffuseColor`와 섞었습니다. 이때 `diffuseColor`는 검은바탕에 하얀색 윤곽선 텍스처이니 두 색을 더해도 하얀 윤곽선이 나올 겁니다. 대신 새로운 색에서 `diffuseColor`를 뺀다면 검은 윤곽선이 나오겠죠.
<add>
<add>다음으로 렌더링 전에 팔레트 텍스처와 3개의 균등 변수를 지정해야 합니다.
<add>
<add>팔레트 텍스처에는 나라당 하나의 색상과 바다의 색상(id = 0) 하나만 필요합니다. 전 세계적으로 약 240여 개의 나라가 있죠. 나라 배열을 불러올 때까지 기다렸다가 정확한 개수를 받아올 수도 있을 겁니다. 하지만 당장 숫자가 크다고 문제가 될 것 같지는 않으니 512 정도의 큰 숫자를 고르기로 합시다.
<add>
<add>아래는 팔레트 텍스처를 만드는 코드입니다.
<add>
<add>```js
<add>const maxNumCountries = 512;
<add>const paletteTextureWidth = maxNumCountries;
<add>const paletteTextureHeight = 1;
<add>const palette = new Uint8Array(paletteTextureWidth * 3);
<add>const paletteTexture = new THREE.DataTexture(
<add> palette, paletteTextureWidth, paletteTextureHeight, THREE.RGBFormat);
<add>paletteTexture.minFilter = THREE.NearestFilter;
<add>paletteTexture.magFilter = THREE.NearestFilter;
<add>```
<add>
<add>`DataTexture`를 쓰면 텍스처를 로우-데이터(raw data) 형식으로 넘길 수 있습니다. 예제의 경우에는 512 RGB 색상을 넘겨주면 되겠죠. 각 값은 3바이트로, 이 바이트는 각각 red, green, blue을 0부터 255까지의 숫자로 나타냅니다.
<add>
<add>일단은 무작위로 색을 지정해 잘 작동하는지 테스트해봅시다.
<add>
<add>```js
<add>for (let i = 1; i < palette.length; ++i) {
<add> palette[i] = Math.random() * 256;
<add>}
<add>// 바다의 색을 지정합니다. (index #0)
<add>palette.set([100, 200, 255], 0);
<add>paletteTexture.needsUpdate = true;
<add>```
<add>
<add>`palette` 배열로 팔레트 텍스처를 업데이트할 때마다 장면을 업데이트해야 하니 `paletteTexture.needsUpdate`를 `true`로 설정합니다.
<add>
<add>다음으로 재질에 균등 변수를 설정해줍니다.
<add>
<add>```js
<add>const geometry = new THREE.SphereBufferGeometry(1, 64, 32);
<add>const material = new THREE.MeshBasicMaterial({ map: texture });
<add>material.onBeforeCompile = function(shader) {
<add> fragmentShaderReplacements.forEach((rep) => {
<add> shader.fragmentShader = shader.fragmentShader.replace(rep.from, rep.to);
<add> });
<add>+ shader.uniforms.paletteTexture = { value: paletteTexture };
<add>+ shader.uniforms.indexTexture = { value: indexTexture };
<add>+ shader.uniforms.paletteTextureWidth = { value: paletteTextureWidth };
<add>};
<add>scene.add(new THREE.Mesh(geometry, material));
<add>```
<add>
<add>이제 예제를 실행하면 각 나라의 색상이 무작위로 지정된 것이 보일 겁니다.
<add>
<add>{{{example url="../threejs-indexed-textures-random-colors.html" }}}
<add>
<add>인덱싱과 팔레트 텍스처가 잘 작동하는 것을 확인했으니, 이제 팔레트를 조작해 선택한 나라의 색상만 바꾸도록 해봅시다.
<add>
<add>먼저 함수를 하나 만듭니다. 이 함수는 Three.js의 `Color`를 매개변수로 받아 팔레트 텍스처에 지정할 수 있는 값을 반환할 겁니다.
<add>
<add>```js
<add>const tempColor = new THREE.Color();
<add>function get255BasedColor(color) {
<add> tempColor.set(color);
<add> return tempColor.toArray().map(v => v * 255);
<add>}
<add>```
<add>
<add>위 함수를 `color = get255BasedColor('red')`와 같은 식으로 호출하면 `[255, 0, 0]` 이런 식의 배열을 반환합니다.
<add>
<add>다음으로 위 함수를 이용해 몇 가지 색을 만들어 팔레트를 채웁니다.
<add>
<add>```js
<add>const selectedColor = get255BasedColor('red');
<add>const unselectedColor = get255BasedColor('#444');
<add>const oceanColor = get255BasedColor('rgb(100,200,255)');
<add>resetPalette();
<add>
<add>function setPaletteColor(index, color) {
<add> palette.set(color, index * 3);
<add>}
<add>
<add>function resetPalette() {
<add> // 모든 팔레트의 색상을 unselectedColor로 바꿉니다.
<add> for (let i = 1; i < maxNumCountries; ++i) {
<add> setPaletteColor(i, unselectedColor);
<add> }
<add>
<add> // 바다의 색을 지정합니다. (index #0)
<add> setPaletteColor(0, oceanColor);
<add> paletteTexture.needsUpdate = true;
<add>}
<add>```
<add>
<add>이제 `resetPalette` 함수를 이용해 나라를 선택했을 때 팔레트를 업데이트합니다.
<add>
<add>```js
<add>function getCanvasRelativePosition(event) {
<add> const rect = canvas.getBoundingClientRect();
<add> return {
<add> x: (event.clientX - rect.left) * canvas.width / rect.width,
<add> y: (event.clientY - rect.top ) * canvas.height / rect.height,
<add> };
<add>}
<add>
<add>function pickCountry(event) {
<add> // 아직 데이터를 불러오지 않았을 경우
<add> if (!countryInfos) {
<add> return;
<add> }
<add>
<add> const position = getCanvasRelativePosition(event);
<add> const id = pickHelper.pick(position, pickingScene, camera);
<add> if (id > 0) {
<add> const countryInfo = countryInfos[id - 1];
<add> const selected = !countryInfo.selected;
<add> if (selected && !event.shiftKey && !event.ctrlKey && !event.metaKey) {
<add> unselectAllCountries();
<add> }
<add> numCountriesSelected += selected ? 1 : -1;
<add> countryInfo.selected = selected;
<add>+ setPaletteColor(id, selected ? selectedColor : unselectedColor);
<add>+ paletteTexture.needsUpdate = true;
<add> } else if (numCountriesSelected) {
<add> unselectAllCountries();
<add> }
<add> requestRenderIfNotRequested();
<add>}
<add>
<add>function unselectAllCountries() {
<add> numCountriesSelected = 0;
<add> countryInfos.forEach((countryInfo) => {
<add> countryInfo.selected = false;
<add> });
<add>+ resetPalette();
<add>}
<add>```
<add>
<add>이제 선택한 나라가 강조되어 보일 겁니다.
<add>
<add>{{{example url="../threejs-indexed-textures-picking-and-highlighting.html" }}}
<add>
<add>잘 작동하는 것 같네요!
<add>
<add>다만 지구본을 돌릴 때도 나라가 선택된다는 게 거슬립니다. 또 나라를 선택하고 지구본을 돌리면 해당 선택이 풀려버리네요.
<add>
<add>마지막으로 이것까지 고쳐봅시다. 2가지 정도를 확인하면 충분할 것 같네요. 하나는 포인터를 누른 후 떼기까지 얼마나 시간이 흘렀는지를 확이하는 것이고, 다른 하나는 포인터가 움직였는지 확인하는 겁니다. 마우스를 떼는 데 시간이 얼마 안 걸렸고 포인터가 움직이지 않았다면 클릭으로 간주하는 것이죠.
<add>
<add>```js
<add>+const maxClickTimeMs = 200;
<add>+const maxMoveDeltaSq = 5 * 5;
<add>+const startPosition = {};
<add>+let startTimeMs;
<add>+
<add>+function recordStartTimeAndPosition(event) {
<add>+ startTimeMs = performance.now();
<add>+ const pos = getCanvasRelativePosition(event);
<add>+ startPosition.x = pos.x;
<add>+ startPosition.y = pos.y;
<add>+}
<add>
<add>function getCanvasRelativePosition(event) {
<add> const rect = canvas.getBoundingClientRect();
<add> return {
<add> x: (event.clientX - rect.left) * canvas.width / rect.width,
<add> y: (event.clientY - rect.top ) * canvas.height / rect.height,
<add> };
<add>}
<add>
<add>function pickCountry(event) {
<add> // 아직 데이터를 불러오지 않았을 경우
<add> if (!countryInfos) {
<add> return;
<add> }
<add>
<add>+ // 포인터를 누른 후 떼기까지 일정 시간 이상 걸렸다면
<add>+ // 선택 액션이 아닌 드래그 액션으로 간주합니다.
<add>+ const clickTimeMs = performance.now() - startTimeMs;
<add>+ if (clickTimeMs > maxClickTimeMs) {
<add>+ return;
<add>+ }
<add>+
<add>+ // 포인터가 움직였다면 드래그로 간주합니다.
<add>+ const position = getCanvasRelativePosition(event);
<add>+ const moveDeltaSq = (startPosition.x - position.x) ** 2 +
<add>+ (startPosition.y - position.y) ** 2;
<add>+ if (moveDeltaSq > maxMoveDeltaSq) {
<add>+ return;
<add>+ }
<add>
<add>- const position = { x: event.clientX, y: event.clientY };
<add> const id = pickHelper.pick(position, pickingScene, camera);
<add> if (id > 0) {
<add> const countryInfo = countryInfos[id - 1];
<add> const selected = !countryInfo.selected;
<add> if (selected && !event.shiftKey && !event.ctrlKey && !event.metaKey) {
<add> unselectAllCountries();
<add> }
<add> numCountriesSelected += selected ? 1 : -1;
<add> countryInfo.selected = selected;
<add> setPaletteColor(id, selected ? selectedColor : unselectedColor);
<add> paletteTexture.needsUpdate = true;
<add> } else if (numCountriesSelected) {
<add> unselectAllCountries();
<add> }
<add> requestRenderIfNotRequested();
<add>}
<add>
<add>function unselectAllCountries() {
<add> numCountriesSelected = 0;
<add> countryInfos.forEach((countryInfo) => {
<add> countryInfo.selected = false;
<add> });
<add> resetPalette();
<add>}
<add>
<add>+canvas.addEventListener('mousedown', recordStartTimeAndPosition);
<add>canvas.addEventListener('mouseup', pickCountry);
<add>
<add>let lastTouch;
<add>canvas.addEventListener('touchstart', (event) => {
<add> // 스크롤 이벤트를 방지합니다.
<add> event.preventDefault();
<add> lastTouch = event.touches[0];
<add>+ recordStartTimeAndPosition(event.touches[0]);
<add>}, { passive: false });
<add>canvas.addEventListener('touchmove', (event) => {
<add> lastTouch = event.touches[0];
<add>});
<add>```
<add>
<add>제 기준에서는 이 정도면 충분한 *듯하네요*.
<add>
<add>{{{example url="../threejs-indexed-textures-picking-debounced.html" }}}
<add>
<add>저는 UX 전문가가 아니니 더 나은 방법이 있을 경우 알려주시면 감사하겠습니다.
<add>
<add>이 글이 인덱스(indexed) 그래픽을 활용하고, Three.js의 쉐이더를 수정해 간단한 효과를 구현하는 데 도움이 되었다면 좋겠네요. 쉐이더를 작성할 때 쓴 GLSL에 대해 다루기에는 너무 내용이 방대하니 [후처리에 관한 글](threejs-post-processing.html)에 있는 링크를 참고하기 바랍니다. | 1 |
Text | Text | update doc about default `cache_store` [ci skip] | 5d3320933584b1ebd3c46a0bab9af5c2ba8a5f16 | <ide><path>guides/source/configuring.md
<ide> These configuration methods are to be called on a `Rails::Railtie` object, such
<ide> * `config.beginning_of_week` sets the default beginning of week for the
<ide> application. Accepts a valid week day symbol (e.g. `:monday`).
<ide>
<del>* `config.cache_store` configures which cache store to use for Rails caching. Options include one of the symbols `:memory_store`, `:file_store`, `:mem_cache_store`, `:null_store`, or an object that implements the cache API. Defaults to `:file_store` if the directory `tmp/cache` exists, and to `:memory_store` otherwise.
<add>* `config.cache_store` configures which cache store to use for Rails caching. Options include one of the symbols `:memory_store`, `:file_store`, `:mem_cache_store`, `:null_store`, or an object that implements the cache API. Defaults to `:file_store`.
<ide>
<ide> * `config.colorize_logging` specifies whether or not to use ANSI color codes when logging information. Defaults to `true`.
<ide> | 1 |
Python | Python | migrate the swao plugin to psutil 2.0 | 7c75dc66d4790958579ba6bd49c9d700273346bb | <ide><path>glances/plugins/glances_memswap.py
<ide> def msg_curse(self, args=None):
<ide> ret.append(self.curse_add_line(msg))
<ide> msg = "{0}".format(format(self.auto_unit(self.stats['used'], '>6')))
<ide> ret.append(self.curse_add_line(
<del> msg, self.get_alert_log(self.stats['used'], max=self.stats['total'])))
<add> msg, self.get_alert_log(self.stats['used'],
<add> ax=self.stats['total'])))
<ide> # New line
<ide> ret.append(self.curse_new_line())
<ide> # Free memory usage | 1 |
Python | Python | add doc about `attention_mask` on gpt2 | 74814574aeab5256ab3c6e428c247739aa0c869d | <ide><path>src/transformers/models/gpt2/modeling_gpt2.py
<ide> class GPT2DoubleHeadsModelOutput(ModelOutput):
<ide> - 1 for tokens that are **not masked**,
<ide> - 0 for tokens that are **masked**.
<ide>
<add> If `past_key_values` is used, `attention_mask` needs to contain the masking strategy that was used for
<add> `past_key_values`. In other words, the `attention_mask` always has to have the length:
<add> `len(past_key_values) + len(input_ids)`
<add>
<ide> [What are attention masks?](../glossary#attention-mask)
<ide> token_type_ids (`torch.LongTensor` of shape `(batch_size, input_ids_length)`, *optional*):
<ide> Segment token indices to indicate first and second portions of the inputs. Indices are selected in `[0,
<ide><path>src/transformers/models/gpt2/modeling_tf_gpt2.py
<ide> class TFGPT2DoubleHeadsModelOutput(ModelOutput):
<ide> - 1 for tokens that are **not masked**,
<ide> - 0 for tokens that are **masked**.
<ide>
<add> If `past_key_values` is used, `attention_mask` needs to contain the masking strategy that was used for
<add> `past_key_values`. In other words, the `attention_mask` always has to have the length:
<add> `len(past_key_values) + len(input_ids)`
<add>
<ide> [What are attention masks?](../glossary#attention-mask)
<ide> token_type_ids (`tf.Tensor` or `Numpy array` of shape `(batch_size, sequence_length)`, *optional*):
<ide> Segment token indices to indicate first and second portions of the inputs. Indices are selected in `[0, | 2 |
Text | Text | add a theme-variables.md doc | a595378850d10c670f667914567a8b5e7c3ddc31 | <ide><path>docs/creating-a-package.md
<ide> the command palette (`cmd-p`) and search for _styleguide_ or just
<ide> `cmd-ctrl-shift-g`.
<ide>
<ide> If you do need styling, we try to keep only structural styles in the package
<del>stylesheets. Colors and sizing should be taken from the active theme's
<del>[ui-variables.less][ui-variables]. If you follow this guideline, your package
<del>will look good out of the box with any theme!
<add>stylesheets. If you must specify colors and sizing, these should be taken from
<add>the active theme's [ui-variables.less][ui-variables]. If you follow this
<add>guideline, your package will look good out of the box with any theme!
<ide>
<ide> An optional `stylesheets` array in your _package.json_ can list the stylesheets
<ide> by name to specify a loading order; otherwise, stylesheets are loaded
<ide><path>docs/theme-variables.md
<add># Style variables
<add>
<add>Atom's UI themes provide a set of variables you can use in your own themes and packages.
<add>
<add>## Use in UI Themes
<add>
<add>The main UI theme must specify a `ui-variables.less` file with all of the
<add>following variables. The top-most theme specified in the theme settings will be
<add>loaded and available for import.
<add>
<add>## Use in packages
<add>
<add>In any of your package's `.less` files, you can get access to the variables
<add>by importing the `ui-variables` file from Atom. The
<add>
<add>Your package should generally only specify structural styling. Your package
<add>should not specify colors or padding size in absolute pixels. You should instead
<add>use these variables. If you follow this guideline, your package will look good
<add>out of the box with any theme!
<add>
<add>```css
<add>@import "ui-variables";
<add>
<add>.my-selector{
<add> background-color: @base-background-color;
<add> padding: @component-padding;
<add>}
<add>```
<add>
<add>## Variables
<add>
<add>### Text colors
<add>
<add>* `@text-color`
<add>* `@text-color-subtle`
<add>* `@text-color-highlight`
<add>* `@text-color-selected`
<add>* `@text-color-info` - A blue
<add>* `@text-color-success`- A green
<add>* `@text-color-warning`- An orange or yellow
<add>* `@text-color-error` - A red
<add>
<add>### Background colors
<add>
<add>* `@background-color-info` - A blue
<add>* `@background-color-success` - A green
<add>* `@background-color-warning` - An orange or yellow
<add>* `@background-color-error` - A red
<add>* `@background-color-highlight`
<add>* `@background-color-selected`
<add>* `@app-background-color` - The app's background under all the editor components
<add>
<add>### Component colors
<add>
<add>* `@base-background-color` -
<add>* `@base-border-color` -
<add>
<add>* `@pane-item-background-color` -
<add>* `@pane-item-border-color` -
<add>
<add>* `@input-background-color` -
<add>* `@input-border-color` -
<add>
<add>* `@tool-panel-background-color` -
<add>* `@tool-panel-border-color` -
<add>
<add>* `@inset-panel-background-color` -
<add>* `@inset-panel-border-color` -
<add>
<add>* `@panel-heading-background-color` -
<add>* `@panel-heading-border-color` -
<add>
<add>* `@overlay-background-color` -
<add>* `@overlay-border-color` -
<add>
<add>* `@button-background-color` -
<add>* `@button-background-color-hover` -
<add>* `@button-background-color-selected` -
<add>* `@button-border-color` -
<add>
<add>* `@tab-bar-background-color` -
<add>* `@tab-bar-border-color` -
<add>* `@tab-background-color` -
<add>* `@tab-background-color-active` -
<add>* `@tab-border-color` -
<add>
<add>* `@tree-view-background-color` -
<add>* `@tree-view-border-color` -
<add>
<add>* `@ui-site-color-1` -
<add>* `@ui-site-color-2` -
<add>* `@ui-site-color-3` -
<add>* `@ui-site-color-4` -
<add>* `@ui-site-color-5` -
<add>
<add>### Component sizes
<add>
<add>* `@disclosure-arrow-size` -
<add>
<add>* `@component-padding` -
<add>* `@component-icon-padding` -
<add>* `@component-icon-size` -
<add>* `@component-line-height` -
<add>* `@component-border-radius` -
<add>
<add>* `@tab-height` -
<add>
<add>### Fonts
<add>
<add>* `@font-size` -
<add>* `@font-family` - | 2 |
Python | Python | add dag_state to cli | 032d64874dceabb912b6a836a9e3f7c18b3e66ba | <ide><path>airflow/bin/cli.py
<ide> from airflow import jobs, settings, utils
<ide> from airflow import configuration
<ide> from airflow.executors import DEFAULT_EXECUTOR
<del>from airflow.models import DagBag, TaskInstance, DagPickle, DagRun
<add>from airflow.models import DagModel, DagBag, TaskInstance, DagPickle, DagRun
<ide> from airflow.utils import AirflowException, State
<ide>
<ide> DAGS_FOLDER = os.path.expanduser(configuration.get('core', 'DAGS_FOLDER'))
<ide> def trigger_dag(args):
<ide> session.commit()
<ide>
<ide>
<add>def dag_state(args):
<add> dagbag = DagBag(process_subdir(args.subdir))
<add> if args.dag_id not in dagbag.dags:
<add> raise AirflowException('dag_id could not be found')
<add> dag = dagbag.dags[args.dag_id]
<add>
<add> if args.pause or args.un_pause is not None:
<add> session = settings.Session()
<add> dm = session.query(DagModel).filter(
<add> DagModel.dag_id == dag.dag_id).first()
<add> dm.is_paused = args.pause or args.un_pause
<add> session.commit()
<add>
<add> msg = "Dag: {}, paused: {}".format(dag, str(dag.is_paused))
<add> print(msg)
<add>
<add>
<ide> def run(args):
<ide>
<ide> utils.pessimistic_connection_handling()
<ide> def get_parser():
<ide> help="Helps to indentify this run")
<ide> parser_trigger_dag.set_defaults(func=trigger_dag)
<ide>
<add> ht = "Get or set the state of a DAG"
<add> parser_dag_state = subparsers.add_parser('dag_state', help=ht)
<add> parser_dag_state.add_argument("dag_id", help="The id of the dag to check")
<add> parser_dag_state.add_argument(
<add> "-sd", "--subdir", help=subdir_help,
<add> default=DAGS_FOLDER)
<add> dag_state_pause_group = parser_dag_state.add_mutually_exclusive_group()
<add> dag_state_pause_group.add_argument(
<add> "-p", "--pause",
<add> help="Pause this dag",
<add> action="store_true")
<add> dag_state_pause_group.add_argument(
<add> "-u", "--un-pause",
<add> help="Unpause this dag",
<add> action="store_false")
<add> parser_dag_state.set_defaults(func=dag_state)
<add>
<ide> ht = "Run a single task instance"
<ide> parser_run = subparsers.add_parser('run', help=ht)
<ide> parser_run.add_argument("dag_id", help="The id of the dag to run")
<ide><path>airflow/models.py
<ide> def concurrency_reached(self, session=None):
<ide> )
<ide> return qry.scalar() >= self.concurrency
<ide>
<add> @property
<add> @provide_session
<add> def is_paused(self, session=None):
<add> """
<add> Returns a boolean as to whether this DAG is paused
<add> """
<add> qry = session.query(DagModel).filter(
<add> DagModel.dag_id == self.dag_id)
<add> return qry.value('is_paused')
<add>
<ide> @property
<ide> def latest_execution_date(self):
<ide> """
<ide><path>tests/core.py
<ide> def test_task_state(self):
<ide> 'task_state', 'example_bash_operator', 'runme_0',
<ide> DEFAULT_DATE.isoformat()]))
<ide>
<add> def test_dag_state(self):
<add> for dag_id in self.dagbag.dags.keys():
<add> args = self.parser.parse_args(['dag_state', dag_id])
<add> cli.dag_state(args)
<add>
<add> args = self.parser.parse_args([
<add> 'dag_state', 'example_bash_operator', '--pause'])
<add> cli.dag_state(args)
<add> assert self.dagbag.dags['example_bash_operator'].is_paused in [True, 1]
<add>
<add> args = self.parser.parse_args([
<add> 'dag_state', 'example_bash_operator', '--un-pause'])
<add> cli.dag_state(args)
<add> assert self.dagbag.dags['example_bash_operator'].is_paused in [False, 0]
<add>
<ide> def test_backfill(self):
<ide> cli.backfill(self.parser.parse_args([
<ide> 'backfill', 'example_bash_operator', | 3 |
Java | Java | expose current cached session count | 0865abef83fedd24a48812e96a336301fba9fbed | <ide><path>spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java
<ide> /*
<del> * Copyright 2002-2020 the original author or authors.
<add> * Copyright 2002-2021 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 boolean isCacheConsumers() {
<ide> }
<ide>
<ide>
<add> /**
<add> * Return a current session count, indicating the number of sessions currently
<add> * cached by this connection factory.
<add> * @since 5.3.7
<add> */
<add> public int getCachedSessionCount() {
<add> int count = 0;
<add> synchronized (this.cachedSessions) {
<add> for (Deque<Session> sessionList : this.cachedSessions.values()) {
<add> synchronized (sessionList) {
<add> count += sessionList.size();
<add> }
<add> }
<add> }
<add> return count;
<add> }
<add>
<ide> /**
<ide> * Resets the Session cache as well.
<ide> */ | 1 |
Javascript | Javascript | add regression coverage for [closes ] | 447b29466ef7bd0692627340b52ffbb565813040 | <ide><path>packages/ember-handlebars/tests/loader_test.js
<del>var originalLookup = Ember.lookup, lookup, Tobias;
<add>var originalLookup = Ember.lookup, lookup, Tobias, App, view;
<ide>
<ide> module("test Ember.Handlebars.bootstrap", {
<ide> setup: function() {
<ide> module("test Ember.Handlebars.bootstrap", {
<ide> teardown: function() {
<ide> Ember.TEMPLATES = {};
<ide> Ember.lookup = originalLookup;
<add> if(App) { Ember.run(App, 'destroy'); }
<add> if (view) { Ember.run(view, 'destroy'); }
<ide> }
<ide> });
<ide>
<ide> test('duplicated template data-template-name should throw exception', function()
<ide> /Template named "[^"]+" already exists\./,
<ide> "duplicate templates should not be allowed");
<ide> });
<add>
<add>test('registerComponents initializer', function(){
<add> Ember.TEMPLATES['components/x-apple'] = 'asdf';
<add>
<add> App = Ember.run(Ember.Application, 'create');
<add>
<add> ok(Ember.Handlebars.helpers['x-apple'], 'x-apple helper is present');
<add> ok(App.__container__.has('component:x-apple'), 'the container is aware of x-apple');
<add>});
<add>
<add>test('registerComponents and ad-hoc components', function(){
<add> Ember.TEMPLATES['components/x-apple'] = 'asdf';
<add>
<add> App = Ember.run(Ember.Application, 'create');
<add> view = App.__container__.lookup('component:x-apple');
<add> equal(view.get('layoutName'), 'components/x-apple', 'has correct layout name');
<add>}); | 1 |
Go | Go | remove loopback setup for native driver | 18ef3cc24a933cbf403c2aaf8b374cfc84a722a4 | <ide><path>pkg/libcontainer/nsinit/mount.go
<ide> func setupNewMountNamespace(rootfs string, bindMounts []libcontainer.Mount, cons
<ide> if err := copyDevNodes(rootfs); err != nil {
<ide> return fmt.Errorf("copy dev nodes %s", err)
<ide> }
<del> // In non-privileged mode, this fails. Discard the error.
<del> setupLoopbackDevices(rootfs)
<ide> if err := setupPtmx(rootfs, console, mountLabel); err != nil {
<ide> return err
<ide> }
<ide> func copyDevNodes(rootfs string) error {
<ide> return nil
<ide> }
<ide>
<del>func setupLoopbackDevices(rootfs string) error {
<del> for i := 0; ; i++ {
<del> if err := copyDevNode(rootfs, fmt.Sprintf("loop%d", i)); err != nil {
<del> if !os.IsNotExist(err) {
<del> return err
<del> }
<del> break
<del> }
<del>
<del> }
<del> return nil
<del>}
<del>
<ide> func copyDevNode(rootfs, node string) error {
<ide> stat, err := os.Stat(filepath.Join("/dev", node))
<ide> if err != nil { | 1 |
Ruby | Ruby | add support for reply-to field in mail_to helper | fecbed6fb136a2f951633bd5b9632e75cc46f804 | <ide><path>actionview/lib/action_view/helpers/url_helper.rb
<ide> def link_to_if(condition, name, options = {}, html_options = {}, &block)
<ide> # * <tt>:body</tt> - Preset the body of the email.
<ide> # * <tt>:cc</tt> - Carbon Copy additional recipients on the email.
<ide> # * <tt>:bcc</tt> - Blind Carbon Copy additional recipients on the email.
<add> # * <tt>:reply_to</tt> - Preset the Reply-To field of the email.
<ide> #
<ide> # ==== Obfuscation
<ide> # Prior to Rails 4.0, +mail_to+ provided options for encoding the address
<ide> def mail_to(email_address, name = nil, html_options = {}, &block)
<ide> html_options, name = name, nil if block_given?
<ide> html_options = (html_options || {}).stringify_keys
<ide>
<del> extras = %w{ cc bcc body subject }.map! { |item|
<add> extras = %w{ cc bcc body subject reply_to }.map! { |item|
<ide> option = html_options.delete(item) || next
<del> "#{item}=#{Rack::Utils.escape_path(option)}"
<add> "#{item.dasherize}=#{Rack::Utils.escape_path(option)}"
<ide> }.compact
<ide> extras = extras.empty? ? '' : '?' + extras.join('&')
<ide>
<ide><path>actionview/test/template/url_helper_test.rb
<ide> def test_mail_to
<ide>
<ide> def test_mail_with_options
<ide> assert_dom_equal(
<del> %{<a href="mailto:me@example.com?cc=ccaddress%40example.com&bcc=bccaddress%40example.com&body=This%20is%20the%20body%20of%20the%20message.&subject=This%20is%20an%20example%20email">My email</a>},
<del> mail_to("me@example.com", "My email", cc: "ccaddress@example.com", bcc: "bccaddress@example.com", subject: "This is an example email", body: "This is the body of the message.")
<add> %{<a href="mailto:me@example.com?cc=ccaddress%40example.com&bcc=bccaddress%40example.com&body=This%20is%20the%20body%20of%20the%20message.&subject=This%20is%20an%20example%20email&reply-to=foo%40bar.com">My email</a>},
<add> mail_to("me@example.com", "My email", cc: "ccaddress@example.com", bcc: "bccaddress@example.com", subject: "This is an example email", body: "This is the body of the message.", reply_to: "foo@bar.com")
<ide> )
<ide> end
<ide> | 2 |
PHP | PHP | add an `is` method to the arr class | 70f1a5ddbaa213650f69d665fcf55d1eb7175084 | <ide><path>src/Illuminate/Support/Arr.php
<ide> public static function first($array, callable $callback, $default = null)
<ide> return value($default);
<ide> }
<ide>
<add> /**
<add> * Determine whether the given value is array-like.
<add> *
<add> * @param mixed $value
<add> * @return bool
<add> */
<add> public static function is($value)
<add> {
<add> return is_array($value) || $value instanceof ArrayAccess;
<add> }
<add>
<ide> /**
<ide> * Return the last element in an array passing a given truth test.
<ide> *
<ide><path>tests/Support/SupportArrayTest.php
<ide> public function testFirst()
<ide> $this->assertEquals(200, $value);
<ide> }
<ide>
<add> public function testIs()
<add> {
<add> $this->assertTrue(Arr::is([]));
<add> $this->assertTrue(Arr::is([1, 2]));
<add> $this->assertTrue(Arr::is(['a' => 1, 'b' => 2]));
<add> $this->assertTrue(Arr::is(new Collection));
<add>
<add> $this->assertFalse(Arr::is(null));
<add> $this->assertFalse(Arr::is('abc'));
<add> $this->assertFalse(Arr::is(new stdClass));
<add> $this->assertFalse(Arr::is((object) ['a' => 1, 'b' => 2]));
<add> }
<add>
<ide> public function testLast()
<ide> {
<ide> $array = [100, 200, 300]; | 2 |
Python | Python | add dag_state option in cli | 9db00511da22c731d10cdc4ea40942c77b1b4008 | <ide><path>airflow/bin/cli.py
<ide> def task_state(args):
<ide> print(ti.current_state())
<ide>
<ide>
<add>def dag_state(args):
<add> """
<add> Returns the state of a DagRun at the command line.
<add>
<add> >>> airflow dag_state tutorial 2015-01-01T00:00:00.000000
<add> running
<add> """
<add> dag = get_dag(args)
<add> dr = DagRun.find(dag.dag_id, execution_date=args.execution_date)
<add> print(dr[0].state if len(dr) > 0 else None)
<add>
<add>
<ide> def list_dags(args):
<ide> dagbag = DagBag(process_subdir(args.subdir))
<ide> s = textwrap.dedent("""\n
<ide> class CLIFactory(object):
<ide> 'func': list_dags,
<ide> 'help': "List all the DAGs",
<ide> 'args': ('subdir', 'report'),
<add> }, {
<add> 'func': dag_state,
<add> 'help': "Get the status of a dag run",
<add> 'args': ('dag_id', 'execution_date', 'subdir'),
<ide> }, {
<ide> 'func': task_state,
<ide> 'help': "Get the status of a task instance",
<ide><path>airflow/models.py
<ide> def refresh_from_db(self, session=None):
<ide>
<ide> @staticmethod
<ide> @provide_session
<del> def find(dag_id, run_id=None, state=None, external_trigger=None, session=None):
<add> def find(dag_id, run_id=None, state=None, external_trigger=None, session=None,
<add> execution_date=None):
<ide> """
<ide> Returns a set of dag runs for the given search criteria.
<ide> :param run_id: defines the the run id for this dag run
<ide> def find(dag_id, run_id=None, state=None, external_trigger=None, session=None):
<ide> :type external_trigger: bool
<ide> :param session: database session
<ide> :type session: Session
<add> :param execution_date: execution date for the dag
<add> :type execution_date: string
<ide> """
<ide> DR = DagRun
<ide>
<ide> def find(dag_id, run_id=None, state=None, external_trigger=None, session=None):
<ide> qry = qry.filter(DR.state == state)
<ide> if external_trigger:
<ide> qry = qry.filter(DR.external_trigger == external_trigger)
<add> if execution_date:
<add> qry = qry.filter(DR.execution_date == execution_date)
<ide> dr = qry.all()
<ide>
<ide> return dr
<ide><path>tests/core.py
<ide> def test_task_state(self):
<ide> 'task_state', 'example_bash_operator', 'runme_0',
<ide> DEFAULT_DATE.isoformat()]))
<ide>
<add> def test_dag_state(self):
<add> self.assertEqual(None, cli.dag_state(self.parser.parse_args([
<add> 'dag_state', 'example_bash_operator', DEFAULT_DATE.isoformat()])))
<add>
<ide> def test_pause(self):
<ide> args = self.parser.parse_args([
<ide> 'pause', 'example_bash_operator']) | 3 |
Javascript | Javascript | fix style in path.js | 6063ea62dfef7dff10b850a5bc8258a2d0df30f6 | <ide><path>lib/path.js
<del>
<ide> function validPathPart (p, keepBlanks) {
<ide> return typeof p === "string" && (p || keepBlanks);
<ide> }
<ide>
<add>
<ide> exports.join = function () {
<ide> var args = Array.prototype.slice.call(arguments);
<ide> // edge case flag to switch into url-resolve-mode
<ide> exports.join = function () {
<ide> var joined = exports.normalizeArray(args, keepBlanks).join("/");
<ide> return joined;
<ide> };
<add>
<add>
<ide> exports.split = function (path, keepBlanks) {
<ide> // split based on /, but only if that / is not at the start or end.
<ide> return exports.normalizeArray(path.split(/^|\/(?!$)/), keepBlanks);
<ide> };
<add>
<add>
<ide> function cleanArray (parts, keepBlanks) {
<ide> var i = 0;
<ide> var l = parts.length - 1;
<ide> var stripped = false;
<add>
<ide> // strip leading empty args
<ide> while (i < l && !validPathPart(parts[i], keepBlanks)) {
<ide> stripped = true;
<ide> i ++;
<ide> }
<add>
<ide> // strip tailing empty args
<ide> while (l >= i && !validPathPart(parts[l], keepBlanks)) {
<ide> stripped = true;
<ide> l --;
<ide> }
<add>
<ide> if (stripped) {
<ide> // if l chopped all the way back to i, then this is empty
<ide> parts = Array.prototype.slice.call(parts, i, l + 1);
<ide> }
<add>
<ide> return parts.filter(function (p) { return validPathPart(p, keepBlanks) })
<ide> .join('/')
<ide> .split(/^|\/(?!$)/);
<ide> }
<add>
<add>
<ide> exports.normalizeArray = function (original, keepBlanks) {
<ide> var parts = cleanArray(original, keepBlanks);
<ide> if (!parts.length || (parts.length === 1 && !parts[0])) return ["."];
<ide> exports.normalizeArray = function (original, keepBlanks) {
<ide> // leading/trailing invalids have been stripped off.
<ide> // if it comes in starting with a slash, or ending with a slash,
<ide> var leadingSlash = (parts[0].charAt(0) === "/");
<add>
<ide> if (leadingSlash) parts[0] = parts[0].substr(1);
<ide> var last = parts.slice(-1)[0];
<ide> var tailingSlash = (last.substr(-1) === "/");
<ide> exports.normalizeArray = function (original, keepBlanks) {
<ide> return directories;
<ide> };
<ide>
<add>
<ide> exports.normalize = function (path, keepBlanks) {
<ide> return exports.join(path, keepBlanks || false);
<ide> };
<ide>
<add>
<ide> exports.dirname = function (path) {
<ide> if (path.length > 1 && '/' === path[path.length-1]) {
<ide> path = path.replace(/\/+$/, '');
<ide> exports.dirname = function (path) {
<ide> }
<ide> };
<ide>
<add>
<ide> exports.basename = function (path, ext) {
<ide> var f = path.substr(path.lastIndexOf("/") + 1);
<ide> if (ext && f.substr(-1 * ext.length) === ext) {
<ide> exports.basename = function (path, ext) {
<ide> return f;
<ide> };
<ide>
<add>
<ide> exports.extname = function (path) {
<ide> var dot = path.lastIndexOf('.'),
<ide> slash = path.lastIndexOf('/');
<ide> exports.extname = function (path) {
<ide> return dot <= slash + 1 ? '' : path.substring(dot);
<ide> };
<ide>
<add>
<ide> exports.exists = function (path, callback) {
<ide> process.binding('fs').stat(path, function (err, stats) {
<ide> if (callback) callback(err ? false : true);
<ide> });
<ide> };
<ide>
<add>
<ide> exports.existsSync = function (path) {
<ide> try {
<ide> process.binding('fs').stat(path); | 1 |
Java | Java | remove duplicate notificationlite | b195ff8aba9239c716f89aed3f7b8f840db3385f | <ide><path>rxjava-core/src/main/java/rx/subjects/AsyncSubject.java
<ide> public static <T> AsyncSubject<T> create() {
<ide> @Override
<ide> public void call(SubjectObserver<T> o) {
<ide> Object v = state.get();
<del> o.accept(v, state.nl);
<del> NotificationLite<T> nl = NotificationLite.instance();
<add> NotificationLite<T> nl = state.nl;
<add> o.accept(v, nl);
<ide> if (v == null || (!nl.isCompleted(v) && !nl.isError(v))) {
<ide> o.onCompleted();
<ide> } | 1 |
Ruby | Ruby | fix typo in documentation | 103a31391b50e930b6cded6e73f721d0b4868697 | <ide><path>actionpack/lib/action_dispatch/routing/url_for.rb
<ide> def initialize(*)
<ide> super
<ide> end
<ide>
<del> # Hook overriden in controller to add request information
<add> # Hook overridden in controller to add request information
<ide> # with `default_url_options`. Application logic should not
<ide> # go into url_options.
<ide> def url_options
<ide><path>activesupport/lib/active_support/callbacks.rb
<ide> def run_callbacks(kind, &block)
<ide> private
<ide>
<ide> # A hook invoked everytime a before callback is halted.
<del> # This can be overriden in AS::Callback implementors in order
<add> # This can be overridden in AS::Callback implementors in order
<ide> # to provide better debugging/logging.
<ide> def halted_callback_hook(filter)
<ide> end | 2 |
Ruby | Ruby | insert questionable syntax hack | 745a1312dce936ddd519c2e151e889459243c543 | <ide><path>Library/Homebrew/cmd/pull.rb
<ide> def verify_bintray_published(formulae_names)
<ide> # We're in the cache; make sure to force re-download
<ide> while true do
<ide> begin
<del> retry_count
<add> retry_count = retry_count
<ide> curl url, "-o", filename
<ide> break
<ide> rescue | 1 |
Ruby | Ruby | use keyword argument in the find_in_batches api | f4e8d67367c7670ac5bbc75f001cd5c2b2deed30 | <ide><path>activerecord/lib/active_record/relation/batches.rb
<ide> module Batches
<ide> #
<ide> # NOTE: You can't set the limit either, that's used to control
<ide> # the batch sizes.
<del> def find_each(options = {})
<add> def find_each(start: nil, batch_size: 1000)
<ide> if block_given?
<del> find_in_batches(options) do |records|
<add> find_in_batches(start: start, batch_size: batch_size) do |records|
<ide> records.each { |record| yield record }
<ide> end
<ide> else
<del> enum_for :find_each, options do
<del> options[:start] ? where(table[primary_key].gteq(options[:start])).size : size
<add> enum_for(:find_each, start: start, batch_size: batch_size) do
<add> start ? where(table[primary_key].gteq(start)).size : size
<ide> end
<ide> end
<ide> end
<ide>
<del> # Yields each batch of records that was found by the find +options+ as
<add> # Yields each batch of records that was found by the find options as
<ide> # an array.
<ide> #
<ide> # Person.where("age > 21").find_in_batches do |group|
<ide> def find_each(options = {})
<ide> #
<ide> # NOTE: You can't set the limit either, that's used to control
<ide> # the batch sizes.
<del> def find_in_batches(options = {})
<del> options.assert_valid_keys(:start, :batch_size)
<del>
<add> def find_in_batches(start: nil, batch_size: 1000)
<ide> relation = self
<del> start = options[:start]
<del> batch_size = options[:batch_size] || 1000
<ide>
<ide> unless block_given?
<del> return to_enum(:find_in_batches, options) do
<add> return to_enum(:find_in_batches, start: start, batch_size: batch_size) do
<ide> total = start ? where(table[primary_key].gteq(start)).size : size
<ide> (total - 1).div(batch_size) + 1
<ide> end | 1 |
Text | Text | remove the phrase as well | de499d6775efb433ff6b6ffb3503f67e18b54ee9 | <ide><path>guides/source/active_job_basics.md
<ide> NOTE: Using the asynchronous queue from a Rake task (for example, to
<ide> send an email using `.deliver_later`) will generally not work because Rake will
<ide> likely end, causing the in-process thread pool to be deleted, before any/all
<ide> of the `.deliver_later` emails are processed. To avoid this problem, use
<del>`.deliver_now` or run a persistent queue in development as well.
<add>`.deliver_now` or run a persistent queue in development.
<ide>
<ide>
<ide> Internationalization | 1 |
Java | Java | remove unused imports | 4368719476f08aa5a2b5ba6e92e2f7079837ae7f | <ide><path>local-cli/templates/HelloWorld/android/app/src/main/java/com/helloworld/MainApplication.java
<ide> package com.helloworld;
<ide>
<ide> import android.app.Application;
<del>import android.util.Log;
<ide>
<ide> import com.facebook.react.ReactApplication;
<del>import com.facebook.react.ReactInstanceManager;
<ide> import com.facebook.react.ReactNativeHost;
<ide> import com.facebook.react.ReactPackage;
<ide> import com.facebook.react.shell.MainReactPackage; | 1 |
Text | Text | update atom banner in readme | b39454059e142ae84a9837270ae30d9ebec96875 | <ide><path>README.md
<del># Atom — Futuristic Text Editing
<add># Atom — Futuristic Text Editing
<ide>
<del>
<add>
<ide>
<ide> ## Building from source
<ide>
<ide> Requirements
<ide>
<ide> **Mountain Lion**
<ide>
<del>**The Setup™**
<add>**The Setup™**
<ide>
<ide> **Xcode** (Get Xcode from the App Store (ugh, I know))
<ide>
<ide> window.keymap.bindKeys '.editor'
<ide> When a keypress matches a pattern on an element that matches the selector, it will be translated to the
<ide> named event, which will bubble up the DOM from the site of the keypress. Extension code can listen for
<ide> the named event and react to it.
<del>
<del> | 1 |
Javascript | Javascript | remove unused variables form http tests | abe8a344a5c00d25dd8a7b4a77085a2c29a5c0c6 | <ide><path>test/parallel/test-http-1.0-keep-alive.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide> var http = require('http');
<ide> var net = require('net');
<ide>
<ide><path>test/parallel/test-http-304.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide>
<ide> var http = require('http');
<ide> var childProcess = require('child_process');
<ide><path>test/parallel/test-http-abort-client.js
<ide> var server = http.Server(function(req, res) {
<ide> var responseClose = false;
<ide>
<ide> server.listen(common.PORT, function() {
<del> var client = http.get({
<add> http.get({
<ide> port: common.PORT,
<ide> headers: { connection: 'keep-alive' }
<ide>
<ide><path>test/parallel/test-http-after-connect.js
<ide> server.listen(common.PORT, function() {
<ide> });
<ide>
<ide> function doRequest(i) {
<del> var req = http.get({
<add> http.get({
<ide> port: common.PORT,
<ide> path: '/request' + i
<ide> }, function(res) {
<ide><path>test/parallel/test-http-agent-keepalive.js
<ide> var common = require('../common');
<ide> var assert = require('assert');
<ide> var http = require('http');
<ide> var Agent = require('_http_agent').Agent;
<del>var EventEmitter = require('events').EventEmitter;
<ide>
<ide> var agent = new Agent({
<ide> keepAlive: true,
<ide><path>test/parallel/test-http-agent-null.js
<ide> var common = require('../common');
<ide> var assert = require('assert');
<ide> var http = require('http');
<del>var net = require('net');
<ide>
<ide> var request = 0;
<ide> var response = 0;
<ide><path>test/parallel/test-http-byteswritten.js
<ide> 'use strict';
<ide> var common = require('../common');
<ide> var assert = require('assert');
<del>var fs = require('fs');
<ide> var http = require('http');
<ide>
<ide> var body = 'hello world\n';
<ide><path>test/parallel/test-http-client-abort2.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide> var http = require('http');
<ide>
<ide> var server = http.createServer(function(req, res) {
<ide><path>test/parallel/test-http-client-encoding.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide>
<ide> var http = require('http');
<ide>
<ide><path>test/parallel/test-http-client-pipe-end.js
<ide> // see https://github.com/joyent/node/issues/3257
<ide>
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide> var http = require('http');
<ide>
<ide> var server = http.createServer(function(req, res) {
<ide><path>test/parallel/test-http-default-port.js
<ide> if (common.hasCrypto) {
<ide> res.end('ok');
<ide> this.close();
<ide> }).listen(SSLPORT, function() {
<del> var req = https.get({
<add> https.get({
<ide> host: 'localhost',
<ide> rejectUnauthorized: false,
<ide> headers: {
<ide><path>test/parallel/test-http-destroyed-socket-write2.js
<ide> var assert = require('assert');
<ide> // where the server has ended the socket.
<ide>
<ide> var http = require('http');
<del>var net = require('net');
<ide> var server = http.createServer(function(req, res) {
<ide> setImmediate(function() {
<ide> res.destroy();
<ide><path>test/parallel/test-http-eof-on-connect.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide> var net = require('net');
<ide> var http = require('http');
<ide>
<ide><path>test/parallel/test-http-exceptions.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide> var http = require('http');
<ide>
<ide> var server = http.createServer(function(req, res) {
<ide> var server = http.createServer(function(req, res) {
<ide> });
<ide>
<ide> server.listen(common.PORT, function() {
<del> var req;
<ide> for (var i = 0; i < 4; i += 1) {
<del> req = http.get({ port: common.PORT, path: '/busy/' + i });
<add> http.get({ port: common.PORT, path: '/busy/' + i });
<ide> }
<ide> });
<ide>
<ide><path>test/parallel/test-http-flush.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide> var http = require('http');
<ide>
<ide> http.createServer(function(req, res) {
<ide><path>test/parallel/test-http-incoming-pipelined-socket-destroy.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide>
<ide> var http = require('http');
<ide> var net = require('net');
<ide><path>test/parallel/test-http-keep-alive.js
<ide> var server = http.createServer(function(req, res) {
<ide> res.end();
<ide> });
<ide>
<del>var connectCount = 0;
<ide> var agent = new http.Agent({maxSockets: 1});
<ide> var headers = {'connection': 'keep-alive'};
<ide> var name = agent.getName({ port: common.PORT });
<ide><path>test/parallel/test-http-localaddress-bind-error.js
<ide> var server = http.createServer(function(req, res) {
<ide> });
<ide>
<ide> server.listen(common.PORT, '127.0.0.1', function() {
<del> var req = http.request({
<add> http.request({
<ide> host: 'localhost',
<ide> port: common.PORT,
<ide> path: '/',
<ide><path>test/parallel/test-http-many-ended-pipelines.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide>
<ide> // no warnings should happen!
<ide> var trace = console.trace;
<ide><path>test/parallel/test-http-no-content-length.js
<ide> var server = net.createServer(function(socket) {
<ide> // Neither Content-Length nor Connection
<ide> socket.end('HTTP/1.1 200 ok\r\n\r\nHello');
<ide> }).listen(common.PORT, function() {
<del> var req = http.get({port: common.PORT}, function(res) {
<add> http.get({port: common.PORT}, function(res) {
<ide> res.setEncoding('utf8');
<ide> res.on('data', function(chunk) {
<ide> body += chunk;
<ide><path>test/parallel/test-http-pipeline-regr-3508.js
<ide> 'use strict';
<ide> const common = require('../common');
<del>const assert = require('assert');
<ide> const http = require('http');
<ide> const net = require('net');
<ide>
<ide><path>test/parallel/test-http-proxy.js
<ide> var backend = http.createServer(function(req, res) {
<ide>
<ide> var proxy = http.createServer(function(req, res) {
<ide> console.error('proxy req headers: ' + JSON.stringify(req.headers));
<del> var proxy_req = http.get({
<add> http.get({
<ide> port: BACKEND_PORT,
<ide> path: url.parse(req.url).pathname
<ide> }, function(proxy_res) {
<ide> function startReq() {
<ide> nlistening++;
<ide> if (nlistening < 2) return;
<ide>
<del> var client = http.get({
<add> http.get({
<ide> port: PROXY_PORT,
<ide> path: '/test'
<ide> }, function(res) {
<ide><path>test/parallel/test-http-raw-headers.js
<ide> http.createServer(function(req, res) {
<ide> ]);
<ide> res.end('x f o o');
<ide> }).listen(common.PORT, function() {
<del> var expectRawHeaders = [
<del> 'Date',
<del> 'Tue, 06 Aug 2013 01:31:54 GMT',
<del> 'Connection',
<del> 'close',
<del> 'Transfer-Encoding',
<del> 'chunked'
<del> ];
<ide> var req = http.request({ port: common.PORT, path: '/' });
<ide> req.addTrailers([
<ide> ['x-bAr', 'yOyOyOy'],
<ide><path>test/parallel/test-http-regr-gh-2821.js
<ide> 'use strict';
<ide> const common = require('../common');
<del>const assert = require('assert');
<ide> const http = require('http');
<ide>
<ide> const server = http.createServer(function(req, res) {
<ide><path>test/parallel/test-http-res-write-after-end.js
<ide> var server = http.Server(function(req, res) {
<ide> });
<ide>
<ide> server.listen(common.PORT, function() {
<del> var req = http.get({port: common.PORT}, function(res) {
<add> http.get({port: common.PORT}, function(res) {
<ide> server.close();
<ide> });
<ide> });
<ide><path>test/parallel/test-http-server-stale-close.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide> var http = require('http');
<ide> var util = require('util');
<ide> var fork = require('child_process').fork;
<ide><path>test/parallel/test-http-timeout.js
<ide> 'use strict';
<ide> var common = require('../common');
<del>var assert = require('assert');
<ide>
<ide> var http = require('http');
<ide>
<ide><path>test/parallel/test-http-unix-socket.js
<ide> 'use strict';
<ide> var common = require('../common');
<ide> var assert = require('assert');
<del>var fs = require('fs');
<ide> var http = require('http');
<ide>
<ide> var status_ok = false; // status code == 200?
<ide><path>test/parallel/test-http-url.parse-https.request.js
<ide> var https = require('https');
<ide>
<ide> var url = require('url');
<ide> var fs = require('fs');
<del>var clientRequest;
<ide>
<ide> // https options
<ide> var httpsOptions = { | 29 |
Text | Text | add fs declarations to stream doc js examples | 755d805bf471423631fb8320b223298c88a61969 | <ide><path>doc/api/stream.md
<ide> Calling the [`stream.write()`][stream-write] method after calling
<ide>
<ide> ```js
<ide> // write 'hello, ' and then end with 'world!'
<add>const fs = require('fs');
<ide> const file = fs.createWriteStream('example.txt');
<ide> file.write('hello, ');
<ide> file.end('world!');
<ide> The following example pipes all of the data from the `readable` into a file
<ide> named `file.txt`:
<ide>
<ide> ```js
<add>const fs = require('fs');
<ide> const readable = getReadableStreamSomehow();
<ide> const writable = fs.createWriteStream('file.txt');
<ide> // All the data from readable goes into 'file.txt'
<ide> The `readable.pipe()` method returns a reference to the *destination* stream
<ide> making it possible to set up chains of piped streams:
<ide>
<ide> ```js
<add>const fs = require('fs');
<ide> const r = fs.createReadStream('file.txt');
<ide> const z = zlib.createGzip();
<ide> const w = fs.createWriteStream('file.txt.gz');
<ide> If the `destination` is specified, but no pipe is set up for it, then
<ide> the method does nothing.
<ide>
<ide> ```js
<add>const fs = require('fs');
<ide> const readable = getReadableStreamSomehow();
<ide> const writable = fs.createWriteStream('file.txt');
<ide> // All the data from readable goes into 'file.txt',
<ide> added: REPLACEME
<ide> Returns an [AsyncIterator][async-iterator] to fully consume the stream.
<ide>
<ide> ```js
<add>const fs = require('fs');
<add>
<ide> async function print(readable) {
<ide> readable.setEncoding('utf8');
<ide> let data = ''; | 1 |
Javascript | Javascript | make promise usage nicer without mixing | 9f8959d4607ba675dec5985412a874aa488d9e58 | <ide><path>packages/ember-runtime/lib/mixins/deferred.js
<ide> var get = Ember.get,
<ide> @namespace Ember
<ide> @extends Ember.Mixin
<ide> */
<del>Ember.Deferred = Ember.Mixin.create({
<del>
<add>Ember.DeferredMixin = Ember.Mixin.create({
<ide> /**
<ide> Add handlers to be called when the Deferred object is resolved or rejected.
<ide>
<ide> Ember.Deferred = Ember.Mixin.create({
<ide> @param {Function} failCallback a callback function to be called when failed
<ide> */
<ide> then: function(doneCallback, failCallback) {
<del> return get(this, 'promise').then(doneCallback, failCallback);
<add> var promise = get(this, 'promise');
<add> promise.then.apply(promise, arguments);
<ide> },
<ide>
<ide> /**
<ide> Ember.Deferred = Ember.Mixin.create({
<ide> return new RSVP.Promise();
<ide> })
<ide> });
<add>
<ide><path>packages/ember-runtime/lib/system.js
<ide> require('ember-runtime/system/object');
<ide> require('ember-runtime/system/set');
<ide> require('ember-runtime/system/string');
<ide> require('ember-runtime/system/promise_chain');
<add>require('ember-runtime/system/deferred');
<ide>
<ide> require('ember-runtime/system/lazy_load');
<ide><path>packages/ember-runtime/lib/system/deferred.js
<add>require("ember-runtime/mixins/deferred");
<add>require("ember-runtime/system/object");
<add>
<add>var DeferredMixin = Ember.DeferredMixin, // mixins/deferred
<add> EmberObject = Ember.Object, // system/object
<add> get = Ember.get;
<add>
<add>var Deferred = Ember.Object.extend(DeferredMixin);
<add>
<add>Deferred.reopenClass({
<add> promise: function(callback, binding) {
<add> var deferred = Deferred.create();
<add> callback.call(binding, deferred);
<add> return get(deferred, 'promise');
<add> }
<add>});
<add>
<add>Ember.Deferred = Deferred;
<ide><path>packages/ember-runtime/tests/mixins/deferred_test.js
<del>module("Ember.Deferred");
<add>module("Ember.DeferredMixin");
<ide>
<ide> test("can resolve deferred", function() {
<ide>
<ide> var deferred, count = 0;
<ide>
<ide> Ember.run(function() {
<del> deferred = Ember.Object.createWithMixins(Ember.Deferred);
<add> deferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
<ide> });
<ide>
<ide> deferred.then(function() {
<ide> test("can reject deferred", function() {
<ide> var deferred, count = 0;
<ide>
<ide> Ember.run(function() {
<del> deferred = Ember.Object.createWithMixins(Ember.Deferred);
<add> deferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
<ide> });
<ide>
<ide> deferred.then(function() {}, function() {
<ide> test("can resolve with then", function() {
<ide> var deferred, count1 = 0 ,count2 = 0;
<ide>
<ide> Ember.run(function() {
<del> deferred = Ember.Object.createWithMixins(Ember.Deferred);
<add> deferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
<ide> });
<ide>
<ide> deferred.then(function() {
<ide> test("can reject with then", function() {
<ide> var deferred, count1 = 0 ,count2 = 0;
<ide>
<ide> Ember.run(function() {
<del> deferred = Ember.Object.createWithMixins(Ember.Deferred);
<add> deferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
<ide> });
<ide>
<ide> deferred.then(function() {
<ide> test("can call resolve multiple times", function() {
<ide> var deferred, count = 0;
<ide>
<ide> Ember.run(function() {
<del> deferred = Ember.Object.createWithMixins(Ember.Deferred);
<add> deferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
<ide> });
<ide>
<ide> deferred.then(function() {
<ide> test("resolve prevent reject", function() {
<ide> var deferred, resolved = false, rejected = false, progress = 0;
<ide>
<ide> Ember.run(function() {
<del> deferred = Ember.Object.createWithMixins(Ember.Deferred);
<add> deferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
<ide> });
<ide>
<ide> deferred.then(function() {
<ide> test("reject prevent resolve", function() {
<ide> var deferred, resolved = false, rejected = false, progress = 0;
<ide>
<ide> Ember.run(function() {
<del> deferred = Ember.Object.createWithMixins(Ember.Deferred);
<add> deferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
<ide> });
<ide>
<ide> deferred.then(function() {
<ide> test("will call callbacks if they are added after resolution", function() {
<ide> var deferred, count1 = 0;
<ide>
<ide> Ember.run(function() {
<del> deferred = Ember.Object.createWithMixins(Ember.Deferred);
<add> deferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
<ide> });
<ide>
<ide> stop();
<ide><path>packages/ember-runtime/tests/system/deferred_test.js
<add>module("Ember.Deferred all-in-one");
<add>
<add>asyncTest("Can resolve a promise", function() {
<add> var value = { value: true };
<add>
<add> var promise = Ember.Deferred.promise(function(deferred) {
<add> setTimeout(function() {
<add> Ember.run(function() { deferred.resolve(value); });
<add> });
<add> });
<add>
<add> promise.then(function(resolveValue) {
<add> start();
<add> equal(resolveValue, value, "The resolved value should be correct");
<add> });
<add>});
<add>
<add>asyncTest("Can reject a promise", function() {
<add> var rejected = { rejected: true };
<add>
<add> var promise = Ember.Deferred.promise(function(deferred) {
<add> setTimeout(function() {
<add> Ember.run(function() { deferred.reject(rejected); });
<add> });
<add> });
<add>
<add> promise.then(null, function(rejectedValue) {
<add> start();
<add> equal(rejectedValue, rejected, "The resolved value should be correct");
<add> });
<add>});
<add>
<add> | 5 |
Mixed | Ruby | return a hash rather than array from fetch_multi | c046e60965d6a9af9083579bcc7d52ca650d885f | <ide><path>activesupport/CHANGELOG.md
<add>* Change the signature of `fetch_multi` to return a hash rather than an
<add> array. This makes it consistent with the output of `read_multi`.
<add>
<add> *Parker Selbert*
<add>
<ide> * Introduce `Concern#class_methods` as a sleek alternative to clunky
<ide> `module ClassMethods`. Add `Kernel#concern` to define at the toplevel
<ide> without chunky `module Foo; extend ActiveSupport::Concern` boilerplate.
<ide><path>activesupport/lib/active_support/cache.rb
<ide> def read_multi(*names)
<ide> #
<ide> # Options are passed to the underlying cache implementation.
<ide> #
<del> # Returns an array with the data for each of the names. For example:
<add> # Returns a hash with the data for each of the names. For example:
<ide> #
<ide> # cache.write("bim", "bam")
<del> # cache.fetch_multi("bim", "boom") {|key| key * 2 }
<del> # # => ["bam", "boomboom"]
<add> # cache.fetch_multi("bim", "boom") { |key| key * 2 }
<add> # # => { "bam" => "bam", "boom" => "boomboom" }
<ide> #
<ide> def fetch_multi(*names)
<ide> options = names.extract_options!
<ide> options = merged_options(options)
<del>
<ide> results = read_multi(*names, options)
<ide>
<del> names.map do |name|
<del> results.fetch(name) do
<add> names.each_with_object({}) do |name, memo|
<add> memo[name] = results.fetch(name) do
<ide> value = yield name
<ide> write(name, value, options)
<ide> value
<ide><path>activesupport/test/caching_test.rb
<ide> def test_fetch_multi
<ide> @cache.write('foo', 'bar')
<ide> @cache.write('fud', 'biz')
<ide>
<del> values = @cache.fetch_multi('foo', 'fu', 'fud') {|value| value * 2 }
<add> values = @cache.fetch_multi('foo', 'fu', 'fud') { |value| value * 2 }
<ide>
<del> assert_equal(["bar", "fufu", "biz"], values)
<del> assert_equal("fufu", @cache.read('fu'))
<add> assert_equal({ 'foo' => 'bar', 'fu' => 'fufu', 'fud' => 'biz' }, values)
<add> assert_equal('fufu', @cache.read('fu'))
<ide> end
<ide>
<ide> def test_multi_with_objects
<del> foo = stub(:title => "FOO!", :cache_key => "foo")
<del> bar = stub(:cache_key => "bar")
<add> foo = stub(:title => 'FOO!', :cache_key => 'foo')
<add> bar = stub(:cache_key => 'bar')
<ide>
<del> @cache.write('bar', "BAM!")
<add> @cache.write('bar', 'BAM!')
<ide>
<del> values = @cache.fetch_multi(foo, bar) {|object| object.title }
<del> assert_equal(["FOO!", "BAM!"], values)
<add> values = @cache.fetch_multi(foo, bar) { |object| object.title }
<add>
<add> assert_equal({ foo => 'FOO!', bar => 'BAM!' }, values)
<ide> end
<ide>
<ide> def test_read_and_write_compressed_small_data | 3 |
Mixed | Javascript | add mediaevent handlers for video/audio components | bdf377ff021b8d1dfabde302f7e4398e394939d4 | <ide><path>docs/docs/ref-05-events.md
<ide> Number deltaX
<ide> Number deltaY
<ide> Number deltaZ
<ide> ```
<add>
<add>### Media Events
<add>
<add>Event names:
<add>
<add>```
<add>onAbort onCanPlay onCanPlayThrough onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting
<add>```
<ide><path>src/renderers/dom/client/ReactBrowserEventEmitter.js
<ide> var reactTopListenersCounter = 0;
<ide> // lower node than `document`), binding at `document` would cause duplicate
<ide> // events so we don't include them here
<ide> var topEventMapping = {
<add> topAbort: 'abort',
<ide> topBlur: 'blur',
<add> topCanPlay: 'canplay',
<add> topCanPlayThrough: 'canplaythrough',
<ide> topChange: 'change',
<ide> topClick: 'click',
<ide> topCompositionEnd: 'compositionend',
<ide> var topEventMapping = {
<ide> topDragOver: 'dragover',
<ide> topDragStart: 'dragstart',
<ide> topDrop: 'drop',
<add> topDurationChange: 'durationchange',
<add> topEmptied: 'emptied',
<add> topEnded: 'ended',
<add> topError: 'error',
<ide> topFocus: 'focus',
<ide> topInput: 'input',
<ide> topKeyDown: 'keydown',
<ide> topKeyPress: 'keypress',
<ide> topKeyUp: 'keyup',
<add> topLoadedData: 'loadeddata',
<add> topLoadedMetadata: 'loadedmetadata',
<add> topLoadStart: 'loadstart',
<ide> topMouseDown: 'mousedown',
<ide> topMouseMove: 'mousemove',
<ide> topMouseOut: 'mouseout',
<ide> topMouseOver: 'mouseover',
<ide> topMouseUp: 'mouseup',
<add> topOnEncrypted: 'onencrypted',
<add> topPause: 'pause',
<ide> topPaste: 'paste',
<add> topPlay: 'play',
<add> topPlaying: 'playing',
<add> topProgress: 'progress',
<add> topRateChange: 'ratechange',
<add> topSeeking: 'seeking',
<add> topSeeked: 'seeked',
<ide> topScroll: 'scroll',
<ide> topSelectionChange: 'selectionchange',
<add> topStalled: 'stalled',
<add> topSuspend: 'suspend',
<ide> topTextInput: 'textInput',
<add> topTimeUpdate: 'timeupdate',
<ide> topTouchCancel: 'touchcancel',
<ide> topTouchEnd: 'touchend',
<ide> topTouchMove: 'touchmove',
<ide> topTouchStart: 'touchstart',
<add> topVolumeChange: 'volumechange',
<add> topWaiting: 'waiting',
<ide> topWheel: 'wheel',
<ide> };
<ide>
<ide><path>src/renderers/dom/client/eventPlugins/SimpleEventPlugin.js
<ide> var warning = require('warning');
<ide> var topLevelTypes = EventConstants.topLevelTypes;
<ide>
<ide> var eventTypes = {
<add> abort: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onAbort: true}),
<add> captured: keyOf({onAbortCapture: true}),
<add> },
<add> },
<ide> blur: {
<ide> phasedRegistrationNames: {
<ide> bubbled: keyOf({onBlur: true}),
<ide> captured: keyOf({onBlurCapture: true}),
<ide> },
<ide> },
<add> canPlay: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onCanPlay: true}),
<add> captured: keyOf({onCanPlayCapture: true}),
<add> },
<add> },
<add> canPlayThrough: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onCanPlayThrough: true}),
<add> captured: keyOf({onCanPlayThroughCapture: true}),
<add> },
<add> },
<ide> click: {
<ide> phasedRegistrationNames: {
<ide> bubbled: keyOf({onClick: true}),
<ide> var eventTypes = {
<ide> captured: keyOf({onDropCapture: true}),
<ide> },
<ide> },
<add> durationChange: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onDurationChange: true}),
<add> captured: keyOf({onDurationChangeCapture: true}),
<add> },
<add> },
<add> emptied: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onEmptied: true}),
<add> captured: keyOf({onEmptiedCapture: true}),
<add> },
<add> },
<add> ended: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onEnded: true}),
<add> captured: keyOf({onEndedCapture: true}),
<add> },
<add> },
<add> error: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onError: true}),
<add> captured: keyOf({onErrorCapture: true}),
<add> },
<add> },
<ide> focus: {
<ide> phasedRegistrationNames: {
<ide> bubbled: keyOf({onFocus: true}),
<ide> var eventTypes = {
<ide> captured: keyOf({onLoadCapture: true}),
<ide> },
<ide> },
<del> error: {
<add> loadedData: {
<ide> phasedRegistrationNames: {
<del> bubbled: keyOf({onError: true}),
<del> captured: keyOf({onErrorCapture: true}),
<add> bubbled: keyOf({onLoadedData: true}),
<add> captured: keyOf({onLoadedDataCapture: true}),
<add> },
<add> },
<add> loadedMetadata: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onLoadedMetadata: true}),
<add> captured: keyOf({onLoadedMetadataCapture: true}),
<add> },
<add> },
<add> loadStart: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onLoadStart: true}),
<add> captured: keyOf({onLoadStartCapture: true}),
<ide> },
<ide> },
<ide> // Note: We do not allow listening to mouseOver events. Instead, use the
<ide> var eventTypes = {
<ide> captured: keyOf({onMouseUpCapture: true}),
<ide> },
<ide> },
<add> onEncrypted: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onEncrypted: true}),
<add> captured: keyOf({onEncryptedCapture: true}),
<add> },
<add> },
<ide> paste: {
<ide> phasedRegistrationNames: {
<ide> bubbled: keyOf({onPaste: true}),
<ide> captured: keyOf({onPasteCapture: true}),
<ide> },
<ide> },
<add> pause: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onPause: true}),
<add> captured: keyOf({onPauseCapture: true}),
<add> },
<add> },
<add> play: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onPlay: true}),
<add> captured: keyOf({onPlayCapture: true}),
<add> },
<add> },
<add> playing: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onPlaying: true}),
<add> captured: keyOf({onPlayingCapture: true}),
<add> },
<add> },
<add> progress: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onProgress: true}),
<add> captured: keyOf({onProgressCapture: true}),
<add> },
<add> },
<add> rateChange: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onRateChange: true}),
<add> captured: keyOf({onRateChangeCapture: true}),
<add> },
<add> },
<ide> reset: {
<ide> phasedRegistrationNames: {
<ide> bubbled: keyOf({onReset: true}),
<ide> var eventTypes = {
<ide> captured: keyOf({onScrollCapture: true}),
<ide> },
<ide> },
<add> seeked: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onSeeked: true}),
<add> captured: keyOf({onSeekedCapture: true}),
<add> },
<add> },
<add> seeking: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onSeeking: true}),
<add> captured: keyOf({onSeekingCapture: true}),
<add> },
<add> },
<add> stalled: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onStalled: true}),
<add> captured: keyOf({onStalledCapture: true}),
<add> },
<add> },
<ide> submit: {
<ide> phasedRegistrationNames: {
<ide> bubbled: keyOf({onSubmit: true}),
<ide> captured: keyOf({onSubmitCapture: true}),
<ide> },
<ide> },
<add> suspend: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onSuspend: true}),
<add> captured: keyOf({onSuspendCapture: true}),
<add> },
<add> },
<add> timeUpdate: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onTimeUpdate: true}),
<add> captured: keyOf({onTimeUpdateCapture: true}),
<add> },
<add> },
<ide> touchCancel: {
<ide> phasedRegistrationNames: {
<ide> bubbled: keyOf({onTouchCancel: true}),
<ide> var eventTypes = {
<ide> captured: keyOf({onTouchStartCapture: true}),
<ide> },
<ide> },
<add> volumeChange: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onVolumeChange: true}),
<add> captured: keyOf({onVolumeChangeCapture: true}),
<add> },
<add> },
<add> waiting: {
<add> phasedRegistrationNames: {
<add> bubbled: keyOf({onWaiting: true}),
<add> captured: keyOf({onWaitingCapture: true}),
<add> },
<add> },
<ide> wheel: {
<ide> phasedRegistrationNames: {
<ide> bubbled: keyOf({onWheel: true}),
<ide> var eventTypes = {
<ide> };
<ide>
<ide> var topLevelEventsToDispatchConfig = {
<del> topBlur: eventTypes.blur,
<del> topClick: eventTypes.click,
<del> topContextMenu: eventTypes.contextMenu,
<del> topCopy: eventTypes.copy,
<del> topCut: eventTypes.cut,
<del> topDoubleClick: eventTypes.doubleClick,
<del> topDrag: eventTypes.drag,
<del> topDragEnd: eventTypes.dragEnd,
<del> topDragEnter: eventTypes.dragEnter,
<del> topDragExit: eventTypes.dragExit,
<del> topDragLeave: eventTypes.dragLeave,
<del> topDragOver: eventTypes.dragOver,
<del> topDragStart: eventTypes.dragStart,
<del> topDrop: eventTypes.drop,
<del> topError: eventTypes.error,
<del> topFocus: eventTypes.focus,
<del> topInput: eventTypes.input,
<del> topKeyDown: eventTypes.keyDown,
<del> topKeyPress: eventTypes.keyPress,
<del> topKeyUp: eventTypes.keyUp,
<del> topLoad: eventTypes.load,
<del> topMouseDown: eventTypes.mouseDown,
<del> topMouseMove: eventTypes.mouseMove,
<del> topMouseOut: eventTypes.mouseOut,
<del> topMouseOver: eventTypes.mouseOver,
<del> topMouseUp: eventTypes.mouseUp,
<del> topPaste: eventTypes.paste,
<del> topReset: eventTypes.reset,
<del> topScroll: eventTypes.scroll,
<del> topSubmit: eventTypes.submit,
<del> topTouchCancel: eventTypes.touchCancel,
<del> topTouchEnd: eventTypes.touchEnd,
<del> topTouchMove: eventTypes.touchMove,
<del> topTouchStart: eventTypes.touchStart,
<del> topWheel: eventTypes.wheel,
<add> topAbort: eventTypes.abort,
<add> topBlur: eventTypes.blur,
<add> topCanPlay: eventTypes.canPlay,
<add> topCanPlayThrough: eventTypes.canPlayThrough,
<add> topClick: eventTypes.click,
<add> topContextMenu: eventTypes.contextMenu,
<add> topCopy: eventTypes.copy,
<add> topCut: eventTypes.cut,
<add> topDoubleClick: eventTypes.doubleClick,
<add> topDrag: eventTypes.drag,
<add> topDragEnd: eventTypes.dragEnd,
<add> topDragEnter: eventTypes.dragEnter,
<add> topDragExit: eventTypes.dragExit,
<add> topDragLeave: eventTypes.dragLeave,
<add> topDragOver: eventTypes.dragOver,
<add> topDragStart: eventTypes.dragStart,
<add> topDrop: eventTypes.drop,
<add> topDurationChange: eventTypes.durationChange,
<add> topEmptied: eventTypes.emptied,
<add> topEnded: eventTypes.ended,
<add> topError: eventTypes.error,
<add> topFocus: eventTypes.focus,
<add> topInput: eventTypes.input,
<add> topKeyDown: eventTypes.keyDown,
<add> topKeyPress: eventTypes.keyPress,
<add> topKeyUp: eventTypes.keyUp,
<add> topLoad: eventTypes.load,
<add> topLoadedData: eventTypes.loadedData,
<add> topLoadedMetadata: eventTypes.loadedMetadata,
<add> topLoadStart: eventTypes.loadStart,
<add> topMouseDown: eventTypes.mouseDown,
<add> topMouseMove: eventTypes.mouseMove,
<add> topMouseOut: eventTypes.mouseOut,
<add> topMouseOver: eventTypes.mouseOver,
<add> topMouseUp: eventTypes.mouseUp,
<add> topOnEncrypted: eventTypes.onEncrypted,
<add> topPause: eventTypes.pause,
<add> topPaste: eventTypes.paste,
<add> topPlay: eventTypes.play,
<add> topPlaying: eventTypes.playing,
<add> topProgress: eventTypes.progress,
<add> topRateChange: eventTypes.rateChange,
<add> topReset: eventTypes.reset,
<add> topSeeked: eventTypes.seeked,
<add> topSeeking: eventTypes.seeking,
<add> topScroll: eventTypes.scroll,
<add> topStalled: eventTypes.stalled,
<add> topSubmit: eventTypes.submit,
<add> topSuspend: eventTypes.suspend,
<add> topTimeUpdate: eventTypes.timeUpdate,
<add> topTouchCancel: eventTypes.touchCancel,
<add> topTouchEnd: eventTypes.touchEnd,
<add> topTouchMove: eventTypes.touchMove,
<add> topTouchStart: eventTypes.touchStart,
<add> topVolumeChange: eventTypes.volumeChange,
<add> topWaiting: eventTypes.waiting,
<add> topWheel: eventTypes.wheel,
<ide> };
<ide>
<ide> for (var type in topLevelEventsToDispatchConfig) {
<ide> var SimpleEventPlugin = {
<ide> }
<ide> var EventConstructor;
<ide> switch (topLevelType) {
<add> case topLevelTypes.topAbort:
<add> case topLevelTypes.topCanPlay:
<add> case topLevelTypes.topCanPlayThrough:
<add> case topLevelTypes.topDurationChange:
<add> case topLevelTypes.topEmptied:
<add> case topLevelTypes.topEnded:
<add> case topLevelTypes.topError:
<ide> case topLevelTypes.topInput:
<ide> case topLevelTypes.topLoad:
<del> case topLevelTypes.topError:
<add> case topLevelTypes.topLoadedData:
<add> case topLevelTypes.topLoadedMetadata:
<add> case topLevelTypes.topLoadStart:
<add> case topLevelTypes.topOnEncrypted:
<add> case topLevelTypes.topPause:
<add> case topLevelTypes.topPlay:
<add> case topLevelTypes.topPlaying:
<add> case topLevelTypes.topProgress:
<add> case topLevelTypes.topRateChange:
<ide> case topLevelTypes.topReset:
<add> case topLevelTypes.topSeeked:
<add> case topLevelTypes.topSeeking:
<add> case topLevelTypes.topStalled:
<ide> case topLevelTypes.topSubmit:
<add> case topLevelTypes.topSuspend:
<add> case topLevelTypes.topTimeUpdate:
<add> case topLevelTypes.topVolumeChange:
<add> case topLevelTypes.topWaiting:
<ide> // HTML Events
<ide> // @see http://www.w3.org/TR/html5/index.html#events-0
<ide> EventConstructor = SyntheticEvent;
<ide><path>src/renderers/dom/shared/ReactDOMComponent.js
<ide> function putListener() {
<ide> );
<ide> }
<ide>
<add>// There are so many media events, it makes sense to just
<add>// maintain a list rather than create a `trapBubbledEvent` for each
<add>var mediaEvents = {
<add> topAbort: 'abort',
<add> topCanPlay: 'canplay',
<add> topCanPlayThrough: 'canplaythrough',
<add> topDurationChange: 'durationchange',
<add> topEmptied: 'emptied',
<add> topEnded: 'ended',
<add> topError: 'error',
<add> topLoadedData: 'loadeddata',
<add> topLoadedMetadata: 'loadedmetadata',
<add> topLoadStart: 'loadstart',
<add> topOnEncrypted: 'onencrypted',
<add> topPause: 'pause',
<add> topPlay: 'play',
<add> topPlaying: 'playing',
<add> topProgress: 'progress',
<add> topRateChange: 'ratechange',
<add> topSeeked: 'seeked',
<add> topSeeking: 'seeking',
<add> topStalled: 'stalled',
<add> topSuspend: 'suspend',
<add> topTimeUpdate: 'timeupdate',
<add> topVolumeChange: 'volumechange',
<add> topWaiting: 'waiting',
<add>};
<add>
<ide> function trapBubbledEventsLocal() {
<ide> var inst = this;
<ide> // If a component renders to null or if another component fatals and causes
<ide> function trapBubbledEventsLocal() {
<ide> node
<ide> ),
<ide> ];
<add> break;
<add> case 'video':
<add> case 'audio':
<add>
<add> inst._wrapperState.listeners = [];
<add> // create listener for each media event
<add> for (var event in mediaEvents) {
<add> if (mediaEvents.hasOwnProperty(event)) {
<add> inst._wrapperState.listeners.push(
<add> ReactBrowserEventEmitter.trapBubbledEvent(
<add> EventConstants.topLevelTypes[event],
<add> mediaEvents[event],
<add> node
<add> )
<add> );
<add> }
<add> }
<add>
<ide> break;
<ide> case 'img':
<ide> inst._wrapperState.listeners = [
<ide> ReactDOMComponent.Mixin = {
<ide> case 'iframe':
<ide> case 'img':
<ide> case 'form':
<add> case 'video':
<add> case 'audio':
<ide> this._wrapperState = {
<ide> listeners: null,
<ide> };
<ide> ReactDOMComponent.Mixin = {
<ide> case 'iframe':
<ide> case 'img':
<ide> case 'form':
<add> case 'video':
<add> case 'audio':
<ide> var listeners = this._wrapperState.listeners;
<ide> if (listeners) {
<ide> for (var i = 0; i < listeners.length; i++) {
<ide><path>src/renderers/shared/event/EventConstants.js
<ide> var PropagationPhases = keyMirror({bubbled: null, captured: null});
<ide> * Types of raw signals from the browser caught at the top level.
<ide> */
<ide> var topLevelTypes = keyMirror({
<add> topAbort: null,
<ide> topBlur: null,
<add> topCanPlay: null,
<add> topCanPlayThrough: null,
<ide> topChange: null,
<ide> topClick: null,
<ide> topCompositionEnd: null,
<ide> var topLevelTypes = keyMirror({
<ide> topDragOver: null,
<ide> topDragStart: null,
<ide> topDrop: null,
<add> topDurationChange: null,
<add> topEmptied: null,
<add> topEnded: null,
<ide> topError: null,
<ide> topFocus: null,
<ide> topInput: null,
<ide> topKeyDown: null,
<ide> topKeyPress: null,
<ide> topKeyUp: null,
<ide> topLoad: null,
<add> topLoadedData: null,
<add> topLoadedMetadata: null,
<add> topLoadStart: null,
<ide> topMouseDown: null,
<ide> topMouseMove: null,
<ide> topMouseOut: null,
<ide> topMouseOver: null,
<ide> topMouseUp: null,
<add> topOnEncrypted: null,
<ide> topPaste: null,
<add> topPause: null,
<add> topPlay: null,
<add> topPlaying: null,
<add> topProgress: null,
<add> topRateChange: null,
<ide> topReset: null,
<ide> topScroll: null,
<add> topSeeked: null,
<add> topSeeking: null,
<ide> topSelectionChange: null,
<add> topStalled: null,
<add> topSuspend: null,
<ide> topSubmit: null,
<ide> topTextInput: null,
<add> topTimeUpdate: null,
<ide> topTouchCancel: null,
<ide> topTouchEnd: null,
<ide> topTouchMove: null,
<ide> topTouchStart: null,
<add> topVolumeChange: null,
<add> topWaiting: null,
<ide> topWheel: null,
<ide> });
<ide> | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.