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 | add eventtarget link to worker_threads | 5f4fa0756b6961cf73a224f4307eaba13b9f9d40 | <ide><path>doc/api/worker_threads.md
<ide> structured data, memory regions and other `MessagePort`s between different
<ide> [`Worker`][]s.
<ide>
<ide> With the exception of `MessagePort`s being [`EventEmitter`][]s rather
<del>than `EventTarget`s, this implementation matches [browser `MessagePort`][]s.
<add>than [`EventTarget`][]s, this implementation matches [browser `MessagePort`][]s.
<ide>
<ide> ### Event: 'close'
<ide> <!-- YAML
<ide> if (isMainThread) {
<ide> * `filename` {string} The path to the Worker’s main script. Must be
<ide> either an absolute path or a relative path (i.e. relative to the
<ide> current working directory) starting with `./` or `../`.
<del> If `options.eval` is true, this is a string containing JavaScript code rather
<del> than a path.
<add> If `options.eval` is `true`, this is a string containing JavaScript code
<add> rather than a path.
<ide> * `options` {Object}
<del> * `eval` {boolean} If true, interpret the first argument to the constructor
<add> * `eval` {boolean} If `true`, interpret the first argument to the constructor
<ide> as a script that is executed once the worker is online.
<ide> * `workerData` {any} Any JavaScript value that will be cloned and made
<ide> available as [`require('worker_threads').workerData`][]. The cloning will
<ide> active handle in the event system. If the worker is already `unref()`ed calling
<ide>
<ide> [`Buffer`]: buffer.html
<ide> [`EventEmitter`]: events.html
<add>[`EventTarget`]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
<ide> [`MessagePort`]: #worker_threads_class_messageport
<ide> [`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
<ide> [`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array | 1 |
Python | Python | fix serialization of hashing layer | a5770601eba163cefbd97de89993ff07cf9cf430 | <ide><path>keras/layers/preprocessing/hashing.py
<ide> from keras.engine import base_preprocessing_layer
<ide> from tensorflow.python.util.tf_export import keras_export
<ide>
<del># Default key from tf.sparse.cross_hashed
<del>_DEFAULT_SALT_KEY = [0xDECAFCAFFE, 0xDECAFCAFFE]
<del>
<ide>
<ide> @keras_export('keras.layers.Hashing',
<ide> 'keras.layers.experimental.preprocessing.Hashing')
<ide> class Hashing(base_layer.Layer):
<ide> def __init__(self, num_bins, mask_value=None, salt=None, **kwargs):
<ide> if num_bins is None or num_bins <= 0:
<ide> raise ValueError('`num_bins` cannot be `None` or non-positive values.')
<del> super(Hashing, self).__init__(**kwargs)
<add> super().__init__(**kwargs)
<ide> base_preprocessing_layer.keras_kpl_gauge.get_cell('Hashing').set(True)
<ide> self.num_bins = num_bins
<ide> self.mask_value = mask_value
<ide> self.strong_hash = True if salt is not None else False
<add> self.salt = None
<ide> if salt is not None:
<ide> if isinstance(salt, (tuple, list)) and len(salt) == 2:
<ide> self.salt = salt
<ide> def __init__(self, num_bins, mask_value=None, salt=None, **kwargs):
<ide> else:
<ide> raise ValueError('`salt can only be a tuple of size 2 integers, or a '
<ide> 'single integer, given {}'.format(salt))
<del> else:
<del> self.salt = _DEFAULT_SALT_KEY
<del>
<del> def _preprocess_input(self, inp):
<del> if isinstance(inp, (list, tuple, np.ndarray)):
<del> inp = tf.convert_to_tensor(inp)
<del> return inp
<ide>
<ide> def call(self, inputs):
<del> inputs = self._preprocess_input(inputs)
<add> if isinstance(inputs, (list, tuple, np.ndarray)):
<add> inputs = tf.convert_to_tensor(inputs)
<ide> if isinstance(inputs, tf.SparseTensor):
<ide> return tf.SparseTensor(
<ide> indices=inputs.indices,
<ide> def compute_output_signature(self, input_spec):
<ide> return tf.TensorSpec(shape=output_shape, dtype=output_dtype)
<ide>
<ide> def get_config(self):
<del> config = {
<add> config = super().get_config()
<add> config.update({
<ide> 'num_bins': self.num_bins,
<ide> 'salt': self.salt,
<ide> 'mask_value': self.mask_value,
<del> }
<del> base_config = super(Hashing, self).get_config()
<del> return dict(list(base_config.items()) + list(config.items()))
<add> })
<add> return config
<ide><path>keras/layers/preprocessing/hashing_test.py
<ide> # ==============================================================================
<ide> """Tests for hashing layer."""
<ide>
<add>import os
<ide> from absl.testing import parameterized
<ide>
<del>import tensorflow.compat.v2 as tf
<del>
<del>import numpy as np
<add>import keras
<ide> from keras import keras_parameterized
<ide> from keras import testing_utils
<ide> from keras.engine import input_layer
<ide> from keras.engine import training
<ide> from keras.layers.preprocessing import hashing
<add>import numpy as np
<add>import tensorflow.compat.v2 as tf
<ide>
<ide>
<ide> @keras_parameterized.run_all_keras_modes(always_skip_v1=True)
<ide> def test_hash_ragged_input_mask_value(self):
<ide>
<ide> def test_hash_ragged_int_input_farmhash(self):
<ide> layer = hashing.Hashing(num_bins=3)
<del> inp_data = tf.ragged.constant([[0, 1, 3, 4], [2, 1, 0]],
<del> dtype=tf.int64)
<add> inp_data = tf.ragged.constant([[0, 1, 3, 4], [2, 1, 0]], dtype=tf.int64)
<ide> out_data = layer(inp_data)
<ide> # Same hashed output as test_hash_sparse_input_farmhash
<ide> expected_output = [[1, 0, 0, 2], [1, 0, 1]]
<ide> def test_hash_ragged_string_input_siphash(self):
<ide>
<ide> def test_hash_ragged_int_input_siphash(self):
<ide> layer = hashing.Hashing(num_bins=3, salt=[133, 137])
<del> inp_data = tf.ragged.constant([[0, 1, 3, 4], [2, 1, 0]],
<del> dtype=tf.int64)
<add> inp_data = tf.ragged.constant([[0, 1, 3, 4], [2, 1, 0]], dtype=tf.int64)
<ide> out_data = layer(inp_data)
<ide> # Same hashed output as test_hash_sparse_input_farmhash
<ide> expected_output = [[1, 1, 0, 1], [2, 1, 1]]
<ide> def test_config_with_custom_name(self):
<ide> layer_1 = hashing.Hashing.from_config(config)
<ide> self.assertEqual(layer_1.name, layer.name)
<ide>
<add> def test_saved_model(self):
<add> input_data = np.array(['omar', 'stringer', 'marlo', 'wire', 'skywalker'])
<add>
<add> inputs = keras.Input(shape=(None,), dtype=tf.string)
<add> outputs = hashing.Hashing(num_bins=100)(inputs)
<add> model = keras.Model(inputs=inputs, outputs=outputs)
<add>
<add> original_output_data = model(input_data)
<add>
<add> # Save the model to disk.
<add> output_path = os.path.join(self.get_temp_dir(), 'tf_keras_saved_model')
<add> model.save(output_path, save_format='tf')
<add> loaded_model = keras.models.load_model(output_path)
<add>
<add> # Ensure that the loaded model is unique (so that the save/load is real)
<add> self.assertIsNot(model, loaded_model)
<add>
<add> # Validate correctness of the new model.
<add> new_output_data = loaded_model(input_data)
<add> self.assertAllClose(new_output_data, original_output_data)
<add>
<ide> @parameterized.named_parameters(
<ide> (
<ide> 'list_input', | 2 |
Javascript | Javascript | remove the constructor in the `stattimer` class | bab1097db31e1d9a2b3588d2db8dcb079e4ba061 | <ide><path>src/display/display_utils.js
<ide> function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
<ide> }
<ide>
<ide> class StatTimer {
<del> constructor() {
<del> this.started = Object.create(null);
<del> this.times = [];
<del> }
<add> started = Object.create(null);
<add>
<add> times = [];
<ide>
<ide> time(name) {
<ide> if (name in this.started) {
<ide> class StatTimer {
<ide> // Find the longest name for padding purposes.
<ide> const outBuf = [];
<ide> let longest = 0;
<del> for (const time of this.times) {
<del> const name = time.name;
<del> if (name.length > longest) {
<del> longest = name.length;
<del> }
<add> for (const { name } of this.times) {
<add> longest = Math.max(name.length, longest);
<ide> }
<del> for (const time of this.times) {
<del> const duration = time.end - time.start;
<del> outBuf.push(`${time.name.padEnd(longest)} ${duration}ms\n`);
<add> for (const { name, start, end } of this.times) {
<add> outBuf.push(`${name.padEnd(longest)} ${end - start}ms\n`);
<ide> }
<ide> return outBuf.join("");
<ide> } | 1 |
Python | Python | add more tests for new memmap object attributes | 20ccf3a5b25f25262bc2b23e092337ae4e7a4f1a | <ide><path>numpy/core/tests/test_memmap.py
<ide> def test_open_with_filename(self):
<ide> del fp
<ide> os.unlink(tmpname)
<ide>
<add> def test_attributes(self):
<add> offset = 1
<add> mode = "w+"
<add> fp = memmap(self.tmpfp, dtype=self.dtype, mode=mode,
<add> shape=self.shape, offset=offset)
<add> self.assertEquals(offset, fp.offset)
<add> self.assertEquals(mode, fp.mode)
<add> del fp
<add>
<ide> def test_filename(self):
<ide> tmpname = mktemp('','mmap')
<ide> fp = memmap(tmpname, dtype=self.dtype, mode='w+',
<ide> shape=self.shape)
<add> abspath = os.path.abspath(tmpname)
<ide> fp[:] = self.data[:]
<del> self.assertEquals(tmpname, fp.filename)
<add> self.assertEquals(abspath, fp.filename)
<ide> b = fp[:1]
<del> self.assertEquals(tmpname, b.filename)
<add> self.assertEquals(abspath, b.filename)
<ide> del fp
<ide> os.unlink(tmpname)
<ide>
<add> def test_filename_fileobj(self):
<add> fp = memmap(self.tmpfp, dtype=self.dtype, mode="w+",
<add> shape=self.shape)
<add> self.assertEquals(fp.filename, self.tmpfp.name)
<ide>
<ide> def test_flush(self):
<ide> fp = memmap(self.tmpfp, dtype=self.dtype, mode='w+', | 1 |
Javascript | Javascript | log used ports | 267fcc999c43bf2b6a50bc531e5f7c2f356fcb96 | <ide><path>lib/browser-stack/start-tunnel.js
<ide> var tunnel = new BrowserStackTunnel({
<ide> hosts: hosts
<ide> });
<ide>
<del>
<add>console.log('Starting tunnel on ports', PORTS.join(', '));
<ide> tunnel.start(function(error) {
<del> console.log('** callback **')
<ide> if (error) {
<ide> console.error('Can not establish the tunnel', error);
<ide> } else { | 1 |
PHP | PHP | add some meta data to the notification mails | 477273c72be8b253b6421c69f3e37b5bf4c3a185 | <ide><path>src/Illuminate/Notifications/Channels/MailChannel.php
<ide> use Illuminate\Contracts\Mail\Mailer;
<ide> use Illuminate\Contracts\Mail\Mailable;
<ide> use Illuminate\Notifications\Notification;
<add>use Illuminate\Contracts\Queue\ShouldQueue;
<ide>
<ide> class MailChannel
<ide> {
<ide> public function send($notifiable, Notification $notification)
<ide>
<ide> $this->mailer->send(
<ide> $this->buildView($message),
<del> $message->data(),
<add> array_merge($message->data(), $this->additionalMessageData($notification)),
<ide> $this->messageBuilder($notifiable, $notification, $message)
<ide> );
<ide> }
<ide> protected function buildView($message)
<ide> ];
<ide> }
<ide>
<add> /**
<add> * Get additional meta-data to pass along with the view data.
<add> *
<add> * @param \Illuminate\Notifications\Notification $notification
<add> * @return array
<add> */
<add> protected function additionalMessageData($notification)
<add> {
<add> return [
<add> '__laravel_notification' => get_class($notification),
<add> '__laravel_notification_queued' => in_array(
<add> ShouldQueue::class, class_implements($notification)
<add> ),
<add> ];
<add> }
<add>
<ide> /**
<ide> * Build the mail message.
<ide> * | 1 |
Javascript | Javascript | remove old require | 86266b27607cafa7678f45cb7047e4a7d974b0fd | <ide><path>packages/ember-routing/lib/helpers.js
<ide> require('ember-routing/helpers/link_to');
<ide> require('ember-routing/helpers/outlet');
<ide> require('ember-routing/helpers/render');
<ide> require('ember-routing/helpers/action');
<del>require('ember-routing/helpers/control'); | 1 |
Javascript | Javascript | increase timeout for test | e81a2d0d5767ded8dfc62733f46abd0ddf783b53 | <ide><path>test/hotCases/chunks/dynamic-system-import/index.js
<ide> it("should import a changed chunk (dynamic import)", function(done) {
<ide> chunk2.value.should.be.eql(2);
<ide> done();
<ide> }).catch(done);
<del> }, 100);
<add> }, 300);
<ide> }).catch(done);
<ide> }); | 1 |
PHP | PHP | use templateparams in basicwidget | 4d33d697cfc66ac32b7d93e55289b2be0e4c2ce6 | <ide><path>src/View/Widget/BasicWidget.php
<ide> public function render(array $data, ContextInterface $context)
<ide> 'val' => null,
<ide> 'type' => 'text',
<ide> 'escape' => true,
<add> 'templateParams' => []
<ide> ];
<ide> $data['value'] = $data['val'];
<ide> unset($data['val']);
<ide>
<ide> return $this->_templates->format('input', [
<ide> 'name' => $data['name'],
<ide> 'type' => $data['type'],
<add> 'templateParams' => $data['templateParams'],
<ide> 'attrs' => $this->_templates->formatAttributes(
<ide> $data,
<ide> ['name', 'type']
<ide><path>tests/TestCase/View/Widget/BasicWidgetTest.php
<ide> public function testRenderAttributes()
<ide> ];
<ide> $this->assertHtml($expected, $result);
<ide> }
<add>
<add> /**
<add> * Test render with template params.
<add> *
<add> * @return void
<add> */
<add> public function testRenderTemplateParams()
<add> {
<add> $text = new BasicWidget(new StringTemplate([
<add> 'input' => '<input type="{{type}}" name="{{name}}"{{attrs}}><span>{{help}}</span>',
<add> ]));
<add> $data = [
<add> 'name' => 'my_input',
<add> 'type' => 'email',
<add> 'class' => 'form-control',
<add> 'required' => true,
<add> 'templateParams' => ['help' => 'SOS']
<add> ];
<add> $result = $text->render($data, $this->context);
<add> $expected = [
<add> 'input' => [
<add> 'type' => 'email',
<add> 'name' => 'my_input',
<add> 'class' => 'form-control',
<add> 'required' => 'required',
<add> ],
<add> '<span', 'SOS', '/span'
<add> ];
<add> $this->assertHtml($expected, $result);
<add> }
<ide> } | 2 |
Ruby | Ruby | add tests for `cleanup_python_site_packages` | c6428d9def384358a48eee9fa87e0273e7662b69 | <ide><path>Library/Homebrew/test/cleanup_spec.rb
<ide> end
<ide> end
<ide> end
<add>
<add> describe "::cleanup_python_site_packages" do
<add> context "when cleaning up Python modules" do
<add> let(:foo_module) { (HOMEBREW_PREFIX/"lib/python3.99/site-packages/foo") }
<add> let(:foo_pycache) { (foo_module/"__pycache__") }
<add> let(:foo_pyc) { (foo_pycache/"foo.cypthon-399.pyc") }
<add>
<add> before do
<add> foo_pycache.mkpath
<add> FileUtils.touch foo_pyc
<add> end
<add>
<add> it "cleans up stray `*.pyc` files" do
<add> cleanup.cleanup_python_site_packages
<add> expect(foo_pyc).not_to exist
<add> end
<add>
<add> it "retains `*.pyc` files of installed modules" do
<add> FileUtils.touch foo_module/"__init__.py"
<add>
<add> cleanup.cleanup_python_site_packages
<add> expect(foo_pyc).to exist
<add> end
<add> end
<add>
<add> it "cleans up stale `*.pyc` files in the top-level `__pycache__`" do
<add> pycache = HOMEBREW_PREFIX/"lib/python3.99/site-packages/__pycache__"
<add> foo_pyc = pycache/"foo.cypthon-3.99.pyc"
<add> pycache.mkpath
<add> FileUtils.touch foo_pyc
<add>
<add> allow_any_instance_of(Pathname).to receive(:ctime).and_return(Time.now - (2 * 60 * 60 * 24))
<add> allow_any_instance_of(Pathname).to receive(:mtime).and_return(Time.now - (2 * 60 * 60 * 24))
<add> described_class.new(days: 1).cleanup_python_site_packages
<add> expect(foo_pyc).not_to exist
<add> end
<add> end
<ide> end | 1 |
Python | Python | fix unexpected behaviour from bad mocking | 305851aa9114653acafbf6e16fde12f2ea55ff99 | <ide><path>t/unit/tasks/test_tasks.py
<ide> def test_apply(self):
<ide> f.get()
<ide>
<ide> def test_apply_simulates_delivery_info(self):
<del> self.task_check_request_context.request_stack.push = Mock()
<del>
<del> self.task_check_request_context.apply(
<del> priority=4,
<del> routing_key='myroutingkey',
<del> exchange='myexchange',
<del> )
<add> task_to_apply = self.task_check_request_context
<add> with patch.object(
<add> task_to_apply.request_stack, "push",
<add> wraps=task_to_apply.request_stack.push,
<add> ) as mock_push:
<add> task_to_apply.apply(
<add> priority=4,
<add> routing_key='myroutingkey',
<add> exchange='myexchange',
<add> )
<ide>
<del> self.task_check_request_context.request_stack.push.assert_called_once()
<add> mock_push.assert_called_once()
<ide>
<del> request = self.task_check_request_context.request_stack.push.call_args[0][0]
<add> request = mock_push.call_args[0][0]
<ide>
<ide> assert request.delivery_info == {
<ide> 'is_eager': True, | 1 |
Ruby | Ruby | fix reference to opt_linked/optlinked | 98248a44a499dc3d55f4ed64eb773f76643bd65e | <ide><path>Library/Homebrew/cask/installer.rb
<ide> def missing_cask_and_formula_dependencies
<ide> else
<ide> cask_or_formula.try(:installed?)
<ide> end
<del> installed && (cask_or_formula.respond_to?(:opt_linked?) ? cask_or_formula.opt_linked? : true)
<add> installed && (cask_or_formula.respond_to?(:optlinked?) ? cask_or_formula.optlinked? : true)
<ide> end
<ide> end
<ide> | 1 |
Ruby | Ruby | remove useless conditional | 68926dd5ee355bab8bc37ed40384126c9f1f2633 | <ide><path>railties/lib/rails/code_statistics.rb
<ide> def print_line(name, statistics)
<ide> m_over_c = (statistics["methods"] / statistics["classes"]) rescue m_over_c = 0
<ide> loc_over_m = (statistics["codelines"] / statistics["methods"]) - 2 rescue loc_over_m = 0
<ide>
<del> start = if TEST_TYPES.include? name
<del> "| #{name.ljust(20)} "
<del> else
<del> "| #{name.ljust(20)} "
<del> end
<del>
<del> puts start +
<add> puts "| #{name.ljust(20)} " +
<ide> "| #{statistics["lines"].to_s.rjust(5)} " +
<ide> "| #{statistics["codelines"].to_s.rjust(5)} " +
<ide> "| #{statistics["classes"].to_s.rjust(7)} " + | 1 |
Text | Text | fix a typo in with-reasonml-todo example | c13d1bca27087512adb491b661e8df6fa726f686 | <ide><path>examples/with-reasonml-todo/README.md
<ide> # Example app using ReasonML & ReasonReact components
<ide>
<del>This example builds upon the original `with-reasonml` example to sho how a
<add>This example builds upon the original `with-reasonml` example to show how a
<ide> global state object can be used to track state across page within the application.
<ide>
<ide> It is intended to show how to build a simple, stateful application using hooks | 1 |
Java | Java | fix wrong javadoc example | 159da04eed43fe643f6df8a0af65f6b3801ca919 | <ide><path>spring-context/src/main/java/org/springframework/context/annotation/Primary.java
<ide> * }
<ide> *
<ide> * @Component
<del> * public class JdbcFooRepository {
<add> * public class JdbcFooRepository extends FooRepository {
<ide> *
<del> * public JdbcFooService(DataSource dataSource) {
<add> * public JdbcFooRepository(DataSource dataSource) {
<ide> * // ...
<ide> * }
<ide> * }
<ide> *
<ide> * @Primary
<ide> * @Component
<del> * public class HibernateFooRepository {
<add> * public class HibernateFooRepository extends FooRepository {
<ide> *
<del> * public HibernateFooService(SessionFactory sessionFactory) {
<add> * public HibernateFooRepository(SessionFactory sessionFactory) {
<ide> * // ...
<ide> * }
<ide> * } | 1 |
Ruby | Ruby | add test to avoid regression of 1bfc5b4 | 974467d70d337d4c60414c792e275d367143217b | <ide><path>actionpack/test/dispatch/routing_test.rb
<ide> def self.call(params, request)
<ide> scope(':version', :version => /.+/) do
<ide> resources :users, :id => /.+?/, :format => /json|xml/
<ide> end
<add>
<add> get "products/list"
<ide> end
<ide>
<ide> get 'sprockets.js' => ::TestRoutingMapper::SprocketsApp
<ide> def test_match_shorthand_inside_namespace
<ide> assert_equal 'account#shorthand', @response.body
<ide> end
<ide>
<add> def test_match_shorthand_inside_namespace_with_controller
<add> assert_equal '/api/products/list', api_products_list_path
<add> get '/api/products/list'
<add> assert_equal 'api/products#list', @response.body
<add> end
<add>
<ide> def test_dynamically_generated_helpers_on_collection_do_not_clobber_resources_url_helper
<ide> assert_equal '/replies', replies_path
<ide> end | 1 |
Javascript | Javascript | bring treemap examples up-to-date | 30ad8bcc551925532d4b90e168fc3b77f2632a2c | <ide><path>examples/treemap/treemap-svg.js
<del>var w = 960,
<del> h = 500,
<add>var width = 960,
<add> height = 500,
<ide> color = d3.scale.category20c();
<ide>
<ide> var treemap = d3.layout.treemap()
<ide> .padding(4)
<del> .size([w, h])
<add> .size([width, height])
<ide> .value(function(d) { return d.size; });
<ide>
<ide> var svg = d3.select("body").append("svg")
<del> .attr("width", w)
<del> .attr("height", h)
<add> .attr("width", width)
<add> .attr("height", height)
<ide> .append("g")
<ide> .attr("transform", "translate(-.5,-.5)");
<ide>
<ide><path>examples/treemap/treemap.js
<del>var w = 960,
<del> h = 500,
<add>var width = 960,
<add> height = 500,
<ide> color = d3.scale.category20c();
<ide>
<ide> var treemap = d3.layout.treemap()
<del> .size([w, h])
<add> .size([width, height])
<ide> .sticky(true)
<ide> .value(function(d) { return d.size; });
<ide>
<ide> var div = d3.select("#chart").append("div")
<ide> .style("position", "relative")
<del> .style("width", w + "px")
<del> .style("height", h + "px");
<add> .style("width", width + "px")
<add> .style("height", height + "px");
<ide>
<ide> d3.json("../data/flare.json", function(json) {
<ide> div.data([json]).selectAll("div") | 2 |
Text | Text | add missing period at the end of a paragraph | 4c26157dac948f83e7ec252520760e66dd26ad85 | <ide><path>README.md
<ide> Laravel is a web application framework with expressive, elegant syntax. We belie
<ide> - [Robust background job processing](https://laravel.com/docs/queues).
<ide> - [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
<ide>
<del>Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation gives you a complete toolset required to build any application with which you are tasked
<add>Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation gives you a complete toolset required to build any application with which you are tasked.
<ide>
<ide> ## Learning Laravel
<ide> | 1 |
Javascript | Javascript | add multiple editors example | 68ceef68e1177dc0d26177aafeca6e11370b66d9 | <ide><path>examples/with-slate/CustomKeygenEditor/index.js
<add>import React from 'react'
<add>import Plain from 'slate-plain-serializer'
<add>import { KeyUtils } from 'slate'
<add>import { Editor } from 'slate-react'
<add>
<add>class CustomKeygenEditor extends React.Component {
<add> constructor (props) {
<add> super(props)
<add> let key = 0
<add> const keygen = () => {
<add> key += 1
<add> return props.uniqueId + key // custom keys
<add> }
<add> KeyUtils.setGenerator(keygen)
<add> this.initialValue = Plain.deserialize(props.content)
<add> }
<add> render () {
<add> return <Editor placeholder='Enter some plain text...' defaultValue={this.initialValue} style={this.props.style} />
<add> }
<add>}
<add>
<add>export default CustomKeygenEditor
<ide><path>examples/with-slate/pages/index.js
<ide> import React from 'react'
<add>import Link from 'next/link'
<ide> import Plain from 'slate-plain-serializer'
<ide> import { Editor } from 'slate-react'
<ide> import { KeyUtils } from 'slate'
<ide> class Index extends React.Component {
<ide>
<ide> render () {
<ide> return (
<del> <Editor
<del> placeholder='Enter some plain text...'
<del> value={this.state.value}
<del> onChange={this.onChange}
<del> />
<add> <React.Fragment>
<add> <Link href='/multiple'>
<add> <a>Go to multiple</a>
<add> </Link>
<add> <Editor
<add> placeholder='Enter some plain text...'
<add> value={this.state.value}
<add> onChange={this.onChange}
<add> />
<add> </React.Fragment>
<ide> )
<ide> }
<ide>
<ide><path>examples/with-slate/pages/multiple.js
<add>import React from 'react'
<add>import Link from 'next/link'
<add>import CustomKeygenEditor from './CustomKeygenEditor'
<add>
<add>const content = {
<add> 'first-editor': 'This example shows how to have multiple instances of the editor.',
<add> 'second-editor': 'Without a custom key generator, you could not focus here.'
<add>}
<add>
<add>class MultipleEditors extends React.Component {
<add> render () {
<add> return (
<add> <React.Fragment>
<add> <Link href='/'>
<add> <a>Go to Home</a>
<add> </Link>
<add> {Object.keys(content).map((key, idx) => (
<add> <CustomKeygenEditor key={idx} uniqueId={key} content={content[key]} style={{ margin: 20 }} />
<add> ))}
<add> </React.Fragment>
<add> )
<add> }
<add>}
<add>
<add>export default MultipleEditors | 3 |
Python | Python | remove cchardet dependency | 3572707af2b44e6211dd60ff821204257842e47f | <ide><path>libcloud/common/base.py
<ide> import binascii
<ide> import time
<ide>
<del>import cchardet
<del>
<ide> from libcloud.utils.py3 import ET
<ide>
<ide> import libcloud
<ide> def request(
<ide> stream=False,
<ide> json=None,
<ide> retry_failed=None,
<del> autodetect_response_encoding=True,
<add> enforce_unicode_response=False,
<ide> ):
<ide> """
<ide> Request a given `action`.
<ide> def request(
<ide> argument can override module level constant and
<ide> environment variable value on per-request basis.
<ide>
<del> :type autodetect_response_encoding: ``bool``
<del> :param autodetect_response_encoding: True to set the response encoding
<del> automatically using the `cchardet` (faster alternative of
<del> the `chardet` library used by the `requests`)
<add> :type enforce_unicode_response: ``bool``
<add> :param enforce_unicode_response: True to set the response encoding
<add> to utf-8
<ide>
<ide> :return: An :class:`Response` instance.
<ide> :rtype: :class:`Response` instance
<ide> def request(
<ide> stream=stream,
<ide> headers=headers,
<ide> data=data,
<del> autodetect_response_encoding=autodetect_response_encoding,
<add> enforce_unicode_response=enforce_unicode_response,
<ide> )
<ide>
<ide> def _retryable_request(
<ide> def _retryable_request(
<ide> method: str,
<ide> raw: bool,
<ide> stream: bool,
<del> autodetect_response_encoding: bool,
<add> enforce_unicode_response: bool,
<ide> ) -> Union[RawResponse, Response]:
<ide> try:
<ide> # @TODO: Should we just pass File object as body to request method
<ide> def _retryable_request(
<ide> self.reset_context()
<ide> raise ssl.SSLError(str(e))
<ide>
<del> if autodetect_response_encoding:
<add> if enforce_unicode_response:
<ide> # Handle problem: https://github.com/psf/requests/issues/2359
<del> self.connection.response.encoding = cchardet.detect(
<del> self.connection.response.content
<del> )["encoding"]
<add> self.connection.response.encoding = "utf-8"
<ide>
<ide> if raw:
<ide> responseCls = self.rawResponseCls
<ide><path>libcloud/container/drivers/kubernetes.py
<ide> def list_containers(self, image=None, all=True):
<ide> :rtype: ``list`` of :class:`libcloud.container.base.Container`
<ide> """
<ide> try:
<del> result = self.connection.request(ROOT_URL + "v1/pods").object
<add> result = self.connection.request(
<add> ROOT_URL + "v1/pods", enforce_unicode_response=True
<add> ).object
<ide> except Exception as exc:
<ide> errno = getattr(exc, "errno", None)
<ide> if errno == 111:
<ide> def create_namespace(self, name, location=None):
<ide> return self._to_namespace(result)
<ide>
<ide> def list_nodes_metrics(self):
<del> return self.connection.request("/apis/metrics.k8s.io/v1beta1/nodes").object[
<del> "items"
<del> ]
<add> return self.connection.request(
<add> "/apis/metrics.k8s.io/v1beta1/nodes", enforce_unicode_response=True
<add> ).object["items"]
<ide>
<ide> def list_pods_metrics(self):
<del> return self.connection.request("/apis/metrics.k8s.io/v1beta1/pods").object[
<del> "items"
<del> ]
<add> return self.connection.request(
<add> "/apis/metrics.k8s.io/v1beta1/pods", enforce_unicode_response=True
<add> ).object["items"]
<ide>
<ide> def list_services(self):
<del> return self.connection.request(ROOT_URL + "v1/services").object["items"]
<add> return self.connection.request(
<add> ROOT_URL + "v1/services", enforce_unicode_response=True
<add> ).object["items"]
<ide>
<ide> def deploy_container(
<ide> self, name, image, namespace=None, parameters=None, start=True
<ide> def ex_list_nodes(self):
<ide>
<ide> :rtype: ``list`` of :class:`.Node`
<ide> """
<del> result = self.connection.request(ROOT_URL + "v1/nodes").object
<add> result = self.connection.request(
<add> ROOT_URL + "v1/nodes", enforce_unicode_response=True
<add> ).object
<ide> return [self._to_node(node) for node in result["items"]]
<ide>
<ide> def _to_node(self, data):
<ide> def ex_list_pods(self):
<ide>
<ide> :rtype: ``list`` of :class:`.KubernetesPod`
<ide> """
<del> result = self.connection.request(ROOT_URL + "v1/pods").object
<add> result = self.connection.request(
<add> ROOT_URL + "v1/pods", enforce_unicode_response=True
<add> ).object
<ide> return [self._to_pod(value) for value in result["items"]]
<ide>
<ide> def ex_destroy_pod(self, namespace, pod_name): | 2 |
PHP | PHP | fix bug with eager loading | 13b93d100e8eae06a633d07883c5f5f5220a7690 | <ide><path>src/Illuminate/Database/Eloquent/Relations/Relation.php
<ide> public function getAndResetWheres()
<ide> */
<ide> public function removeFirstWhereClause()
<ide> {
<del> array_shift($this->getBaseQuery()->wheres);
<add> $first = array_shift($this->getBaseQuery()->wheres);
<add>
<add> $bindings = $this->getBaseQuery()->getBindings();
<ide>
<ide> // When resetting the relation where clause, we want to shift the first element
<ide> // off of the bindings, leaving only the constraints that the developers put
<ide> // as "extra" on the relationships, and not original relation constraints.
<del> $bindings = array_slice($this->getBaseQuery()->getBindings(), 1);
<add> if (array_key_exists('value', $first))
<add> {
<add> $bindings = array_slice($bindings, 1);
<add> }
<ide>
<ide> $this->getBaseQuery()->setBindings(array_values($bindings));
<ide> } | 1 |
Python | Python | update train_ner_standalone example | cbb1fbef80a15fe2f8415cd698d9f8b78c48ef04 | <ide><path>examples/training/train_ner_standalone.py
<ide> from pathlib import Path
<ide> import random
<ide> import json
<add>import tqdm
<add>
<ide> from thinc.neural.optimizers import Adam
<ide> from thinc.neural.ops import NumpyOps
<del>import tqdm
<ide>
<ide> from spacy.vocab import Vocab
<ide> from spacy.pipeline import TokenVectorEncoder, NeuralEntityRecognizer
<ide> from spacy.scorer import Scorer
<ide> import spacy.util
<ide>
<add>
<ide> try:
<ide> unicode
<ide> except NameError:
<ide> def init_vocab():
<ide>
<ide>
<ide> class Pipeline(object):
<del> def __init__(self, vocab=None, tokenizer=None, tensorizer=None, entity=None):
<add> def __init__(self, vocab=None, tokenizer=None, entity=None):
<ide> if vocab is None:
<ide> vocab = init_vocab()
<ide> if tokenizer is None:
<ide> tokenizer = Tokenizer(vocab, {}, None, None, None)
<del> if tensorizer is None:
<del> tensorizer = TokenVectorEncoder(vocab)
<ide> if entity is None:
<ide> entity = NeuralEntityRecognizer(vocab)
<ide> self.vocab = vocab
<ide> self.tokenizer = tokenizer
<del> self.tensorizer = tensorizer
<ide> self.entity = entity
<del> self.pipeline = [tensorizer, self.entity]
<add> self.pipeline = [self.entity]
<ide>
<ide> def begin_training(self):
<ide> for model in self.pipeline:
<ide> def update(self, inputs, annots, sgd, losses=None, drop=0.):
<ide> golds = [self.make_gold(input_, annot) for input_, annot in
<ide> zip(inputs, annots)]
<ide>
<del> tensors, bp_tensors = self.tensorizer.update(docs, golds, drop=drop)
<del> d_tensors = self.entity.update((docs, tensors), golds, drop=drop,
<del> sgd=sgd, losses=losses)
<del> bp_tensors(d_tensors, sgd=sgd)
<add> self.entity.update(docs, golds, drop=drop,
<add> sgd=sgd, losses=losses)
<ide> return losses
<ide>
<ide> def evaluate(self, examples):
<ide> def to_disk(self, path):
<ide> elif not path.is_dir():
<ide> raise IOError("Can't save pipeline to %s\nNot a directory" % path)
<ide> self.vocab.to_disk(path / 'vocab')
<del> self.tensorizer.to_disk(path / 'tensorizer')
<ide> self.entity.to_disk(path / 'ner')
<ide>
<ide> def from_disk(self, path):
<ide> def from_disk(self, path):
<ide> if not path.is_dir():
<ide> raise IOError("Cannot load pipeline from %s\nNot a directory" % path)
<ide> self.vocab = self.vocab.from_disk(path / 'vocab')
<del> self.tensorizer = self.tensorizer.from_disk(path / 'tensorizer')
<ide> self.entity = self.entity.from_disk(path / 'ner')
<ide>
<ide> | 1 |
Ruby | Ruby | remove unused require | f31b4758d9a10c4c4065dc66d9a5322bbdf09f66 | <ide><path>activerecord/lib/active_record/type/adapter_specific_registry.rb
<ide> # frozen_string_literal: true
<ide>
<del>require "active_model/type/registry"
<del>
<ide> module ActiveRecord
<ide> # :stopdoc:
<ide> module Type | 1 |
Text | Text | add missing information regarding callbacks | 52a7873863644905e0e5ce48b8eadbdd6468dbce | <ide><path>guides/source/active_record_querying.md
<ide> The primary operation of `Model.find(options)` can be summarized as:
<ide> * Convert the supplied options to an equivalent SQL query.
<ide> * Fire the SQL query and retrieve the corresponding results from the database.
<ide> * Instantiate the equivalent Ruby object of the appropriate model for every resulting row.
<del>* Run `after_find` callbacks, if any.
<add>* Run `after_find` and then `after_initialize` callbacks, if any.
<ide>
<ide> ### Retrieving a Single Object
<ide> | 1 |
Python | Python | remove usage of exec_command in config.py | 13463193f573cf0356a57383960d4110d8032f88 | <ide><path>numpy/distutils/command/config.py
<ide> import os, signal
<ide> import warnings
<ide> import sys
<add>import subprocess
<ide>
<ide> from distutils.command.config import config as old_config
<ide> from distutils.command.config import LANG_EXT
<ide> from distutils import log
<ide> from distutils.file_util import copy_file
<ide> from distutils.ccompiler import CompileError, LinkError
<ide> import distutils
<del>from numpy.distutils.exec_command import exec_command
<add>from numpy.distutils.exec_command import filepath_from_subprocess_output
<ide> from numpy.distutils.mingw32ccompiler import generate_manifest
<ide> from numpy.distutils.command.autodist import (check_gcc_function_attribute,
<ide> check_gcc_variable_attribute,
<ide> def _link (self, body,
<ide> # correct path when compiling in Cygwin but with
<ide> # normal Win Python
<ide> if d.startswith('/usr/lib'):
<del> s, o = exec_command(['cygpath', '-w', d],
<del> use_tee=False)
<del> if not s: d = o
<add> try:
<add> d = subprocess.check_output(['cygpath',
<add> '-w', d])
<add> except (OSError, subprocess.CalledProcessError):
<add> pass
<add> else:
<add> d = filepath_from_subprocess_output(d)
<ide> library_dirs.append(d)
<ide> for libname in self.fcompiler.libraries or []:
<ide> if libname not in libraries:
<ide> def get_output(self, body, headers=None, include_dirs=None,
<ide> grabber.restore()
<ide> raise
<ide> exe = os.path.join('.', exe)
<del> exitstatus, output = exec_command(exe, execute_in='.',
<del> use_tee=use_tee)
<add> try:
<add> # specify cwd arg for consistency with
<add> # historic usage pattern of exec_command()
<add> # also, note that exe appears to be a string,
<add> # which exec_command() handled, but we now
<add> # use a list for check_output() -- this assumes
<add> # that exe is always a single command
<add> output = subprocess.check_output([exe], cwd='.')
<add> except subprocess.CalledProcessError as exc:
<add> exitstatus = exc.returncode
<add> output = ''
<add> except OSError:
<add> # preserve the EnvironmentError exit status
<add> # used historically in exec_command()
<add> exitstatus = 127
<add> output = ''
<add> else:
<add> output = filepath_from_subprocess_output(output)
<ide> if hasattr(os, 'WEXITSTATUS'):
<ide> exitcode = os.WEXITSTATUS(exitstatus)
<ide> if os.WIFSIGNALED(exitstatus): | 1 |
Python | Python | add note on * import | dfb8225447597fb22544c1e67e2677d15f92d698 | <ide><path>rest_framework/serializers.py
<ide> from django.forms import widgets
<ide> from django.utils.datastructures import SortedDict
<ide> from rest_framework.compat import get_concrete_model
<add>
<add># Note: We do the following so that users of the framework can use this style:
<add>#
<add># example_field = serializers.CharField(...)
<add>#
<add># This helps keep the seperation between model fields, form fields, and
<add># serializer fields more explicit.
<add>
<add>
<ide> from rest_framework.fields import *
<ide>
<ide> | 1 |
Ruby | Ruby | enable partial updates by default | 2ce1be3ac4823ccdfbe36ff5548a562aa5106d2e | <ide><path>activerecord/lib/active_record/dirty.rb
<ide> def self.included(base)
<ide> base.alias_method_chain :reload, :dirty
<ide>
<ide> base.superclass_delegating_accessor :partial_updates
<del> base.partial_updates = false
<add> base.partial_updates = true
<ide> end
<ide>
<ide> # Do any attributes have unsaved changes? | 1 |
Text | Text | add changelog for | d8a53b49a7490eb0115fcf6f7f4c872a5393e251 | <ide><path>activerecord/CHANGELOG.md
<add>* Save many-to-many objects based on association primary key.
<add>
<add> Fixes #20995.
<add>
<add> *himesh-r*
<add>
<ide> * Fix an issue when preloading associations with extensions.
<ide> Previously every association with extension methods was transformed into an
<ide> instance dependent scope. This is no longer the case. | 1 |
Ruby | Ruby | update default app files in app_generator_test | 0b1313b41fc49a387733d327fd95a36b14f65abe | <ide><path>railties/test/generators/app_generator_test.rb
<ide> Gemfile
<ide> Rakefile
<ide> config.ru
<add> app/assets/config/manifest.js
<add> app/assets/images
<ide> app/assets/javascripts
<add> app/assets/javascripts/application.js
<add> app/assets/javascripts/cable.js
<add> app/assets/javascripts/channels
<ide> app/assets/stylesheets
<del> app/assets/images
<add> app/assets/stylesheets/application.css
<add> app/channels/application_cable/channel.rb
<add> app/channels/application_cable/connection.rb
<ide> app/controllers
<add> app/controllers/application_controller.rb
<ide> app/controllers/concerns
<ide> app/helpers
<add> app/helpers/application_helper.rb
<ide> app/mailers
<add> app/mailers/application_mailer.rb
<ide> app/models
<add> app/models/application_record.rb
<ide> app/models/concerns
<ide> app/jobs
<add> app/jobs/application_job.rb
<ide> app/views/layouts
<add> app/views/layouts/application.html.erb
<add> app/views/layouts/mailer.html.erb
<add> app/views/layouts/mailer.text.erb
<ide> bin/bundle
<ide> bin/rails
<ide> bin/rake
<ide> bin/setup
<add> bin/update
<add> bin/yarn
<add> config/application.rb
<add> config/boot.rb
<add> config/cable.yml
<add> config/environment.rb
<ide> config/environments
<add> config/environments/development.rb
<add> config/environments/production.rb
<add> config/environments/test.rb
<ide> config/initializers
<add> config/initializers/application_controller_renderer.rb
<add> config/initializers/assets.rb
<add> config/initializers/backtrace_silencers.rb
<add> config/initializers/cookies_serializer.rb
<add> config/initializers/filter_parameter_logging.rb
<add> config/initializers/inflections.rb
<add> config/initializers/mime_types.rb
<add> config/initializers/wrap_parameters.rb
<ide> config/locales
<del> config/cable.yml
<add> config/locales/en.yml
<ide> config/puma.rb
<add> config/routes.rb
<add> config/secrets.yml
<ide> config/spring.rb
<ide> db
<add> db/seeds.rb
<ide> lib
<ide> lib/tasks
<ide> lib/assets
<ide> log
<add> package.json
<add> public
<add> test/application_system_test_case.rb
<ide> test/test_helper.rb
<ide> test/fixtures
<ide> test/fixtures/files | 1 |
PHP | PHP | add helper for bootstrap 3 | c919402d5847830c1b2a39529cac90251f838709 | <ide><path>src/Illuminate/Pagination/AbstractPaginator.php
<ide> public static function defaultSimpleView($view)
<ide> static::$defaultSimpleView = $view;
<ide> }
<ide>
<add> /**
<add> * Indicate that Bootstrap 3 styling should be used for generated links.
<add> *
<add> * @return void
<add> */
<add> public static function useBootstrapThree()
<add> {
<add> static::defaultView('pagination::default');
<add> static::defaultSimpleView('pagination::simple-default');
<add> }
<add>
<ide> /**
<ide> * Get an iterator for the items.
<ide> * | 1 |
Ruby | Ruby | pass app config to controller helper proxy | 719f1d68e4945332f71dc8ad93141780e60929b5 | <ide><path>actionpack/lib/action_controller/metal/helpers.rb
<ide> def helper_attr(*attrs)
<ide>
<ide> # Provides a proxy to access helpers methods from outside the view.
<ide> def helpers
<del> @helper_proxy ||= ActionView::Base.new.extend(_helpers)
<add> @helper_proxy ||= begin
<add> proxy = ActionView::Base.new
<add> proxy.config = config.inheritable_copy
<add> proxy.extend(_helpers)
<add> end
<ide> end
<ide>
<ide> # Overwrite modules_for_helpers to accept :all as argument, which loads
<ide><path>actionpack/test/controller/helper_test.rb
<ide> def test_helper_proxy
<ide> # fun/pdf_helper.rb
<ide> assert methods.include?(:foobar)
<ide> end
<add>
<add> def test_helper_proxy_config
<add> AllHelpersController.config.my_var = 'smth'
<add>
<add> assert_equal 'smth', AllHelpersController.helpers.config.my_var
<add> end
<ide>
<ide> private
<ide> def expected_helper_methods | 2 |
Java | Java | fix inputstream reading for http range requests | b35d44bd4c4f2f12d6c337bc96f53f246df3c4c0 | <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java
<ide> private void copyRange(InputStream in, OutputStream out, long start, long end) t
<ide> out.write(buffer, 0, (int) bytesToCopy);
<ide> bytesToCopy = 0;
<ide> }
<del> if (bytesRead < buffer.length) {
<add> if (bytesRead == -1) {
<ide> break;
<ide> }
<ide> } | 1 |
Python | Python | change more np.min/np.max to np.amin/np.amax | ad6d423acf45c0b06b478e898a6ddaf358e0c0a3 | <ide><path>numpy/core/fromnumeric.py
<ide> def argmax(a, axis=None, out=None):
<ide>
<ide> >>> x = np.array([[4,2,3], [1,0,3]])
<ide> >>> index_array = np.argmax(x, axis=-1)
<del> >>> # Same as np.max(x, axis=-1, keepdims=True)
<add> >>> # Same as np.amax(x, axis=-1, keepdims=True)
<ide> >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1)
<ide> array([[4],
<ide> [3]])
<del> >>> # Same as np.max(x, axis=-1)
<add> >>> # Same as np.amax(x, axis=-1)
<ide> >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1)
<ide> array([4, 3])
<ide>
<ide> def argmin(a, axis=None, out=None):
<ide>
<ide> >>> x = np.array([[4,2,3], [1,0,3]])
<ide> >>> index_array = np.argmin(x, axis=-1)
<del> >>> # Same as np.min(x, axis=-1, keepdims=True)
<add> >>> # Same as np.amin(x, axis=-1, keepdims=True)
<ide> >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1)
<ide> array([[2],
<ide> [0]])
<del> >>> # Same as np.max(x, axis=-1)
<add> >>> # Same as np.amax(x, axis=-1)
<ide> >>> np.take_along_axis(x, np.expand_dims(index_array, axis=-1), axis=-1).squeeze(axis=-1)
<ide> array([2, 0])
<ide>
<ide> def amax(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
<ide> You can use an initial value to compute the maximum of an empty slice, or
<ide> to initialize it to a different value:
<ide>
<del> >>> np.max([[-50], [10]], axis=-1, initial=0)
<add> >>> np.amax([[-50], [10]], axis=-1, initial=0)
<ide> array([ 0, 10])
<ide>
<ide> Notice that the initial value is used as one of the elements for which the
<ide> maximum is determined, unlike for the default argument Python's max
<ide> function, which is only used for empty iterables.
<ide>
<del> >>> np.max([5], initial=6)
<add> >>> np.amax([5], initial=6)
<ide> 6
<ide> >>> max([5], default=6)
<ide> 5
<ide> def amin(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
<ide> >>> np.nanmin(b)
<ide> 0.0
<ide>
<del> >>> np.min([[-50], [10]], axis=-1, initial=0)
<add> >>> np.amin([[-50], [10]], axis=-1, initial=0)
<ide> array([-50, 0])
<ide>
<ide> Notice that the initial value is used as one of the elements for which the
<ide> def amin(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
<ide>
<ide> Notice that this isn't the same as Python's ``default`` argument.
<ide>
<del> >>> np.min([6], initial=5)
<add> >>> np.amin([6], initial=5)
<ide> 5
<ide> >>> min([6], default=5)
<ide> 6 | 1 |
Python | Python | fix lint errors | cd534f50bf628c855b1cb58317cc4890a52cbd27 | <ide><path>celery/app/trace.py
<ide> # We know what we're doing...
<ide>
<ide>
<del>
<del>
<del>
<ide> __all__ = (
<ide> 'TraceInfo', 'build_tracer', 'trace_task',
<ide> 'setup_worker_optimizations', 'reset_worker_optimizations',
<ide><path>celery/concurrency/eventlet.py
<ide> warnings.warn(RuntimeWarning(W_RACE % side))
<ide>
<ide>
<del>
<del>
<del>
<ide> def apply_target(target, args=(), kwargs={}, callback=None,
<ide> accept_callback=None, getpid=None):
<ide> return base.apply_target(target, args, kwargs, callback, accept_callback,
<ide><path>celery/worker/worker.py
<ide> resource = None # noqa
<ide>
<ide>
<del>
<del>
<ide> __all__ = ('WorkController',)
<ide>
<ide> #: Default socket timeout at shutdown.
<ide><path>t/unit/tasks/test_tasks.py
<ide> from urllib2 import HTTPError
<ide>
<ide>
<del>
<del>
<ide> def return_True(*args, **kwargs):
<ide> # Task run functions can't be closures/lambdas, as they're pickled.
<ide> return True | 4 |
Javascript | Javascript | handle the empty string in errordisplay | 3c0c7165e26ec53bc408a6cca367e11f0433682a | <ide><path>docs/component-spec/errorDisplaySpec.js
<ide> describe("errorDisplay", function () {
<ide> beforeEach(inject(function ($injector) {
<ide> var $rootScope = $injector.get('$rootScope'),
<ide> $compile = $injector.get('$compile');
<del>
<add>
<ide> $location = $injector.get('$location');
<ide>
<ide> compileHTML = function (code) {
<ide> describe("errorDisplay", function () {
<ide> });
<ide>
<ide> it('should interpolate a template with no parameters when search parameters are present', function () {
<del> var elm;
<add> var elm;
<ide>
<ide> spyOn($location, 'search').andReturn({ p0: 'foobaz' });
<ide> elm = compileHTML('<div error-display="This is a test"></div>');
<ide> expect(elm).toInterpolateTo('This is a test');
<ide> });
<ide>
<ide> it('should correctly interpolate search parameters', function () {
<del> var elm;
<add> var elm;
<ide>
<ide> spyOn($location, 'search').andReturn({ p0: '42' });
<ide> elm = compileHTML('<div error-display="The answer is {0}"></div>');
<ide> describe("errorDisplay", function () {
<ide> elm = compileHTML('<div error-display="This {0} is {1} on {2}"></div>');
<ide> expect(elm).toInterpolateTo('This Fooooo is {1} on {2}');
<ide> });
<add>
<add> it('should correctly handle the empty string as an interpolation parameter', function () {
<add> var elm;
<add>
<add> spyOn($location, 'search').andReturn({ p0: 'test', p1: '' });
<add> elm = compileHTML('<div error-display="This {0} is a {1}"></div>');
<add> expect(elm).toInterpolateTo('This test is a ');
<add> });
<ide> });
<ide>\ No newline at end of file
<ide><path>docs/src/templates/js/docs.js
<ide> var docsApp = {
<ide> docsApp.controller.DocsVersionsCtrl = ['$scope', '$window', 'NG_VERSIONS', function($scope, $window, NG_VERSIONS) {
<ide> $scope.versions = expandVersions(NG_VERSIONS);
<ide> $scope.version = ($scope.version || angular.version.full).match(/^([\d\.]+\d+)/)[1]; //match only the number
<del>
<add>
<ide> $scope.jumpToDocsVersion = function(value) {
<ide> var isLastStable,
<ide> version,
<ide> docsApp.directive.errorDisplay = ['$location', function ($location) {
<ide> formatArgs = [attrs.errorDisplay],
<ide> i;
<ide>
<del> for (i = 0; search['p'+i]; i++) {
<add> for (i = 0; angular.isDefined(search['p'+i]); i++) {
<ide> formatArgs.push(search['p'+i]);
<ide> }
<ide> element.text(interpolate.apply(null, formatArgs)); | 2 |
Javascript | Javascript | fix jshint error | bfc5431e664986f8fb2871a066e50d5de4727f74 | <ide><path>packages/ember-views/lib/views/component.js
<ide> import { set } from "ember-metal/property_set";
<ide> import isNone from 'ember-metal/is_none';
<ide>
<ide> import { computed } from "ember-metal/computed";
<del>import { bool } from "ember-metal/computed_macros";
<ide>
<ide> /**
<ide> @module ember | 1 |
Javascript | Javascript | reduce copies done by resource | eefb920d0e0345485a8eb120aeecc3b1aa9f6719 | <ide><path>src/Resource.js
<ide> ResourceFactory.prototype = {
<ide> throw "Expected between 0-3 arguments [params, data, callback], got " + arguments.length + " arguments.";
<ide> }
<ide>
<del> var value = action.isArray ? [] : new Resource(data);
<add> var value = this instanceof Resource ? this : (action.isArray ? [] : new Resource(data));
<ide> self.xhr(
<ide> action.method,
<ide> route.url(extend({}, action.params || {}, extractParams(data), params)),
<ide> ResourceFactory.prototype = {
<ide> };
<ide>
<ide> Resource.prototype['$' + name] = function(a1, a2){
<del> var self = this;
<del> var params = extractParams(self);
<add> var params = extractParams(this);
<ide> var callback = noop;
<ide> switch(arguments.length) {
<ide> case 2: params = a1; callback = a2;
<ide> ResourceFactory.prototype = {
<ide> default:
<ide> throw "Expected between 1-2 arguments [params, callback], got " + arguments.length + " arguments.";
<ide> }
<del> var data = isPostOrPut ? self : _undefined;
<del> Resource[name](params, data, function(response){
<del> copy(response, self);
<del> callback(self);
<del> });
<add> var data = isPostOrPut ? this : _undefined;
<add> Resource[name].call(this, params, data, callback);
<ide> };
<ide> });
<ide> return Resource; | 1 |
Javascript | Javascript | fix prettier 2.8 issues | d324fc9be0823613795f81bb703190204ef3fda2 | <ide><path>tests/node/app-boot-test.js
<ide> QUnit.module('App Boot', function (hooks) {
<ide> hasExistence: true,
<ide> });
<ide>
<del> this.template('components/foo-bar', '\
<add> this.template(
<add> 'components/foo-bar',
<add> '\
<ide> <p>The files are *inside* the computer?!</p>\
<del> ');
<add> '
<add> );
<ide>
<ide> return this.renderToHTML('/').then(function (html) {
<ide> assert.htmlMatches( | 1 |
Javascript | Javascript | remove unused supportmultiview on material | d374632473fa476c94acd0c98f769048c28c5cff | <ide><path>src/materials/Material.js
<ide> function Material() {
<ide> this.visible = true;
<ide>
<ide> this.toneMapped = true;
<del> this.supportsMultiview = true;
<ide> this.userData = {};
<ide>
<ide> this.needsUpdate = true; | 1 |
PHP | PHP | remove throwable type hints | a5b537b3624e228cecd255341edc4314ebceb416 | <ide><path>src/Illuminate/Contracts/Queue/Job.php
<ide>
<ide> namespace Illuminate\Contracts\Queue;
<ide>
<del>use Throwable;
<del>
<ide> interface Job
<ide> {
<ide> /**
<ide> public function getName();
<ide> * @param \Throwable $e
<ide> * @return void
<ide> */
<del> public function failed(Throwable $e);
<add> public function failed($e);
<ide>
<ide> /**
<ide> * Get the name of the queue the job belongs to.
<ide><path>src/Illuminate/Queue/CallQueuedHandler.php
<ide> protected function setJobInstanceIfNecessary(Job $job, $instance)
<ide> * @param \Throwable $e
<ide> * @return void
<ide> */
<del> public function failed(array $data, Throwable $e)
<add> public function failed(array $data, $e)
<ide> {
<ide> $command = unserialize($data['command']);
<ide>
<ide><path>src/Illuminate/Queue/Events/JobFailed.php
<ide>
<ide> namespace Illuminate\Queue\Events;
<ide>
<del>use Throwable;
<del>
<ide> class JobFailed
<ide> {
<ide> /**
<ide> class JobFailed
<ide> * @param \Throwable $throwable
<ide> * @return void
<ide> */
<del> public function __construct($connectionName, $job, Throwable $throwable)
<add> public function __construct($connectionName, $job, $throwable)
<ide> {
<ide> $this->job = $job;
<ide> $this->throwable = $throwable;
<ide><path>src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php
<ide>
<ide> namespace Illuminate\Queue\Failed;
<ide>
<del>use Throwable;
<ide> use Carbon\Carbon;
<ide> use Illuminate\Database\ConnectionResolverInterface;
<ide>
<ide> public function __construct(ConnectionResolverInterface $resolver, $database, $t
<ide> * @param \Throwable $exception
<ide> * @return int|null
<ide> */
<del> public function log($connection, $queue, $payload, Throwable $exception)
<add> public function log($connection, $queue, $payload, $exception)
<ide> {
<ide> $failed_at = Carbon::now();
<ide>
<ide><path>src/Illuminate/Queue/Failed/FailedJobProviderInterface.php
<ide>
<ide> namespace Illuminate\Queue\Failed;
<ide>
<del>use Throwable;
<del>
<ide> interface FailedJobProviderInterface
<ide> {
<ide> /**
<ide> interface FailedJobProviderInterface
<ide> * @param \Throwable $exception
<ide> * @return int|null
<ide> */
<del> public function log($connection, $queue, $payload, Throwable $exception);
<add> public function log($connection, $queue, $payload, $exception);
<ide>
<ide> /**
<ide> * Get a list of all of the failed jobs.
<ide><path>src/Illuminate/Queue/Failed/NullFailedJobProvider.php
<ide>
<ide> namespace Illuminate\Queue\Failed;
<ide>
<del>use Throwable;
<del>
<ide> class NullFailedJobProvider implements FailedJobProviderInterface
<ide> {
<ide> /**
<ide> class NullFailedJobProvider implements FailedJobProviderInterface
<ide> * @param \Throwable $exception
<ide> * @return int|null
<ide> */
<del> public function log($connection, $queue, $payload, Throwable $exception)
<add> public function log($connection, $queue, $payload, $exception)
<ide> {
<ide> //
<ide> }
<ide><path>src/Illuminate/Queue/Jobs/Job.php
<ide> namespace Illuminate\Queue\Jobs;
<ide>
<ide> use DateTime;
<del>use Throwable;
<ide> use Illuminate\Support\Arr;
<ide>
<ide> abstract class Job
<ide> public function isDeletedOrReleased()
<ide> * @param \Throwable $e
<ide> * @return void
<ide> */
<del> public function failed(Throwable $e)
<add> public function failed($e)
<ide> {
<ide> $payload = $this->payload();
<ide>
<ide><path>src/Illuminate/Queue/SyncQueue.php
<ide> public function push($job, $data = '', $queue = null)
<ide> * @param \Throwable $e
<ide> * @return void
<ide> */
<del> protected function handleSyncException($queueJob, Throwable $e)
<add> protected function handleSyncException($queueJob, $e)
<ide> {
<ide> $this->raiseExceptionOccurredJobEvent($queueJob, $e);
<ide>
<ide> protected function raiseAfterJobEvent(Job $job)
<ide> * @param \Throwable $e
<ide> * @return void
<ide> */
<del> protected function raiseExceptionOccurredJobEvent(Job $job, Throwable $e)
<add> protected function raiseExceptionOccurredJobEvent(Job $job, $e)
<ide> {
<ide> if ($this->container->bound('events')) {
<ide> $this->container['events']->fire(new Events\JobExceptionOccurred('sync', $job, $e));
<ide> protected function raiseExceptionOccurredJobEvent(Job $job, Throwable $e)
<ide> * @param \Throwable $e
<ide> * @return array
<ide> */
<del> protected function handleFailedJob(Job $job, Throwable $e)
<add> protected function handleFailedJob(Job $job, $e)
<ide> {
<ide> $job->failed($e);
<ide>
<ide> protected function handleFailedJob(Job $job, Throwable $e)
<ide> * @param \Throwable $e
<ide> * @return void
<ide> */
<del> protected function raiseFailedJobEvent(Job $job, Throwable $e)
<add> protected function raiseFailedJobEvent(Job $job, $e)
<ide> {
<ide> if ($this->container->bound('events')) {
<ide> $this->container['events']->fire(new Events\JobFailed('sync', $job, $e));
<ide><path>src/Illuminate/Queue/Worker.php
<ide> public function process($connectionName, $job, WorkerOptions $options)
<ide> * @param WorkerOptions $options
<ide> * @param \Throwable $e
<ide> * @return void
<del> *
<del> * @throws \Throwable
<add> *Throwable
<add> * @throws \
<ide> */
<del> protected function handleJobException($connectionName, $job, WorkerOptions $options, Throwable $e)
<add> protected function handleJobException($connectionName, $job, WorkerOptions $options, $e)
<ide> {
<ide> // If we catch an exception, we will attempt to release the job back onto the queue
<ide> // so it is not lost entirely. This'll let the job be retried at a later time by
<ide> protected function handleJobException($connectionName, $job, WorkerOptions $opti
<ide> * @return void
<ide> */
<ide> protected function markJobAsFailedIfHasExceededMaxAttempts(
<del> $connectionName, $job, $maxTries, Throwable $e
<add> $connectionName, $job, $maxTries, $e
<ide> ) {
<ide> if ($maxTries === 0 || $job->attempts() < $maxTries) {
<ide> return;
<ide> protected function raiseAfterJobEvent($connectionName, $job)
<ide> * @param \Throwable $e
<ide> * @return void
<ide> */
<del> protected function raiseExceptionOccurredJobEvent($connectionName, $job, Throwable $e)
<add> protected function raiseExceptionOccurredJobEvent($connectionName, $job, $e)
<ide> {
<ide> $this->events->fire(new Events\JobExceptionOccurred(
<ide> $connectionName, $job, $e
<ide> protected function raiseExceptionOccurredJobEvent($connectionName, $job, Throwab
<ide> * @param \Throwable $e
<ide> * @return void
<ide> */
<del> protected function raiseFailedJobEvent($connectionName, $job, Throwable $e)
<add> protected function raiseFailedJobEvent($connectionName, $job, $e)
<ide> {
<ide> $this->events->fire(new Events\JobFailed(
<ide> $connectionName, $job, $e | 9 |
Javascript | Javascript | fix index -> start | b4575e143d7438d0c0d00be65a1a76ce0a87db83 | <ide><path>src/renderers/WebGLRenderer.js
<ide> THREE.WebGLRenderer = function ( parameters ) {
<ide>
<ide> } else {
<ide>
<del> _gl.drawArrays( mode, offsets[i].index, offsets[i].count );
<add> _gl.drawArrays( mode, offsets[ i ].start, offsets[i].count );
<ide>
<ide> }
<ide>
<ide> _this.info.render.calls++;
<del> _this.info.render.vertices += offsets[i].count - offsets[i].index;
<del> _this.info.render.faces += ( offsets[i].count - offsets[i].index ) / 3;
<add> _this.info.render.vertices += offsets[ i ].count - offsets[ i ].start;
<add> _this.info.render.faces += ( offsets[ i ].count - offsets[ i ].start ) / 3;
<ide>
<ide> }
<ide> } | 1 |
Python | Python | use explicit einsum_path whenever it is given | 59fec4619403762a5d785ad83fcbde5a230416fc | <ide><path>numpy/core/einsumfunc.py
<ide> def einsum_path(*operands, optimize='greedy', einsum_call=False):
<ide> if path_type is None:
<ide> path_type = False
<ide>
<add> explicit_einsum_path = False
<ide> memory_limit = None
<ide>
<ide> # No optimization or a named path algorithm
<ide> def einsum_path(*operands, optimize='greedy', einsum_call=False):
<ide>
<ide> # Given an explicit path
<ide> elif len(path_type) and (path_type[0] == 'einsum_path'):
<del> pass
<add> explicit_einsum_path = True
<ide>
<ide> # Path tuple with memory limit
<ide> elif ((len(path_type) == 2) and isinstance(path_type[0], str) and
<ide> def einsum_path(*operands, optimize='greedy', einsum_call=False):
<ide> naive_cost = _flop_count(indices, inner_product, len(input_list), dimension_dict)
<ide>
<ide> # Compute the path
<del> if (path_type is False) or (len(input_list) in [1, 2]) or (indices == output_set):
<add> if explicit_einsum_path:
<add> path = path_type[1:]
<add> elif (
<add> (path_type is False)
<add> or (len(input_list) in [1, 2])
<add> or (indices == output_set)
<add> ):
<ide> # Nothing to be optimized, leave it to einsum
<ide> path = [tuple(range(len(input_list)))]
<ide> elif path_type == "greedy":
<ide> path = _greedy_path(input_sets, output_set, dimension_dict, memory_arg)
<ide> elif path_type == "optimal":
<ide> path = _optimal_path(input_sets, output_set, dimension_dict, memory_arg)
<del> elif path_type[0] == 'einsum_path':
<del> path = path_type[1:]
<ide> else:
<ide> raise KeyError("Path name %s not found", path_type)
<ide>
<ide> def einsum_path(*operands, optimize='greedy', einsum_call=False):
<ide>
<ide> opt_cost = sum(cost_list) + 1
<ide>
<add> if len(input_list) != 1:
<add> # Explicit "einsum_path" is usually trusted, but we detect this kind of
<add> # mistake in order to prevent from returning an intermediate value.
<add> raise RuntimeError(
<add> "Invalid einsum_path is specified: {} more operands has to be "
<add> "contracted.".format(len(input_list) - 1))
<add>
<ide> if einsum_call_arg:
<ide> return (operands, contraction_list)
<ide>
<ide><path>numpy/core/tests/test_einsum.py
<ide> def test_path_type_input(self):
<ide> opt = np.einsum(*path_test, optimize=exp_path)
<ide> assert_almost_equal(noopt, opt)
<ide>
<add> def test_path_type_input_internal_trace(self):
<add> #gh-20962
<add> path_test = self.build_operands('cab,cdd->ab')
<add> exp_path = ['einsum_path', (1,), (0, 1)]
<add>
<add> path, path_str = np.einsum_path(*path_test, optimize=exp_path)
<add> self.assert_path_equal(path, exp_path)
<add>
<add> # Double check einsum works on the input path
<add> noopt = np.einsum(*path_test, optimize=False)
<add> opt = np.einsum(*path_test, optimize=exp_path)
<add> assert_almost_equal(noopt, opt)
<add>
<add> def test_path_type_input_invalid(self):
<add> path_test = self.build_operands('ab,bc,cd,de->ae')
<add> exp_path = ['einsum_path', (2, 3), (0, 1)]
<add> assert_raises(RuntimeError, np.einsum, *path_test, optimize=exp_path)
<add> assert_raises(
<add> RuntimeError, np.einsum_path, *path_test, optimize=exp_path)
<add>
<add> path_test = self.build_operands('a,a,a->a')
<add> exp_path = ['einsum_path', (1,), (0, 1)]
<add> assert_raises(RuntimeError, np.einsum, *path_test, optimize=exp_path)
<add> assert_raises(
<add> RuntimeError, np.einsum_path, *path_test, optimize=exp_path)
<add>
<ide> def test_spaces(self):
<ide> #gh-10794
<ide> arr = np.array([[1]]) | 2 |
Ruby | Ruby | allow plain http mirrors | 629dbb7c593f97538d59691173add17d47657939 | <ide><path>Library/Homebrew/rubocops/extend/formula.rb
<ide> def on_class(node)
<ide> # @param urls [Array] url/mirror method call nodes
<ide> # @param regex [Regexp] pattern to match URLs
<ide> def audit_urls(urls, regex)
<del> urls.each do |url_node|
<add> urls.each_with_index do |url_node, index|
<ide> url_string_node = parameters(url_node).first
<ide> url_string = string_content(url_string_node)
<ide> match_object = regex_match_group(url_string_node, regex)
<ide> next unless match_object
<ide>
<ide> offending_node(url_string_node.parent)
<del> yield match_object, url_string
<add> yield match_object, url_string, index
<ide> end
<ide> end
<ide>
<ide><path>Library/Homebrew/rubocops/urls.rb
<ide> def audit_formula(_node, _class_node, _parent_class_node, body_node)
<ide> %r{^http://(?:[^/]*\.)?archive\.org},
<ide> %r{^http://(?:[^/]*\.)?freedesktop\.org},
<ide> %r{^http://(?:[^/]*\.)?mirrorservice\.org/}])
<del> audit_urls(urls, http_to_https_patterns) do |_, url|
<del> problem "Please use https:// for #{url}"
<add> audit_urls(urls, http_to_https_patterns) do |_, url, index|
<add> # It's fine to have a plain HTTP mirror further down the mirror list.
<add> https_url = url.dup.insert(4, "s")
<add> https_index = nil
<add> audit_urls(urls, https_url) do |_, _, found_https_index|
<add> https_index = found_https_index
<add> end
<add> problem "Please use https:// for #{url}" if !https_index || https_index > index
<ide> end
<ide>
<ide> apache_mirror_pattern = %r{^https?://(?:[^/]*\.)?apache\.org/dyn/closer\.(?:cgi|lua)\?path=/?(.*)}i | 2 |
Javascript | Javascript | add benchmark for node -p | c5817abff5033da7c09302256a331e64473422a8 | <ide><path>benchmark/misc/print.js
<add>'use strict';
<add>const common = require('../common.js');
<add>const { spawn } = require('child_process');
<add>
<add>const bench = common.createBenchmark(main, {
<add> dur: [1],
<add> code: ['1', '"string"', 'process.versions', 'process']
<add>});
<add>
<add>function spawnProcess(code) {
<add> const cmd = process.execPath || process.argv[0];
<add> const argv = ['-p', code];
<add> return spawn(cmd, argv);
<add>}
<add>
<add>function start(state, code, bench, getNode) {
<add> const node = getNode(code);
<add> let stdout = '';
<add> let stderr = '';
<add>
<add> node.stdout.on('data', (data) => {
<add> stdout += data;
<add> });
<add>
<add> node.stderr.on('data', (data) => {
<add> stderr += data;
<add> });
<add>
<add> node.on('exit', (code) => {
<add> if (code !== 0) {
<add> console.error('------ stdout ------');
<add> console.error(stdout);
<add> console.error('------ stderr ------');
<add> console.error(stderr);
<add> throw new Error(`Error during node startup, exit code ${code}`);
<add> }
<add> state.throughput++;
<add>
<add> if (state.go) {
<add> start(state, code, bench, getNode);
<add> } else {
<add> bench.end(state.throughput);
<add> }
<add> });
<add>}
<add>
<add>function main({ dur, code }) {
<add> const state = {
<add> go: true,
<add> throughput: 0
<add> };
<add>
<add> setTimeout(() => {
<add> state.go = false;
<add> }, dur * 1000);
<add>
<add> bench.start();
<add> start(state, code, bench, spawnProcess);
<add>}
<ide><path>test/benchmark/test-benchmark-misc.js
<ide> runBenchmark('misc', [
<ide> 'method=',
<ide> 'n=1',
<ide> 'type=',
<add> 'code=1',
<ide> 'val=magyarország.icom.museum',
<ide> 'script=test/fixtures/semicolon',
<ide> 'mode=worker' | 2 |
Mixed | Ruby | introduce concern#class_methods and kernel#concern | b16c36e688970df2f96f793a759365b248b582ad | <ide><path>activesupport/CHANGELOG.md
<add>* Introduce `Concern#class_methods` as a sleek alternative to clunky
<add> `module ClassMethods`. Add `Kernel#concern` to define at the toplevel
<add> without chunky `module Foo; extend ActiveSupport::Concern` boilerplate.
<add>
<add> # app/models/concerns/authentication.rb
<add> concern :Authentication do
<add> included do
<add> after_create :generate_private_key
<add> end
<add>
<add> class_methods do
<add> def authenticate(credentials)
<add> # ...
<add> end
<add> end
<add>
<add> def generate_private_key
<add> # ...
<add> end
<add> end
<add>
<add> # app/models/user.rb
<add> class User < ActiveRecord::Base
<add> include Authentication
<add> end
<add>
<add> *Jeremy Kemper*
<add>
<ide> * Added `Object#present_in` to simplify value whitelisting.
<ide>
<ide> Before:
<ide><path>activesupport/lib/active_support/concern.rb
<ide> module ActiveSupport
<ide> # scope :disabled, -> { where(disabled: true) }
<ide> # end
<ide> #
<del> # module ClassMethods
<add> # class_methods do
<ide> # ...
<ide> # end
<ide> # end
<ide> def included(base = nil, &block)
<ide> super
<ide> end
<ide> end
<add>
<add> def class_methods(&class_methods_module_definition)
<add> mod = const_defined?(:ClassMethods) ?
<add> const_get(:ClassMethods) :
<add> const_set(:ClassMethods, Module.new)
<add>
<add> mod.module_eval(&class_methods_module_definition)
<add> end
<ide> end
<ide> end
<ide><path>activesupport/lib/active_support/core_ext/kernel.rb
<del>require 'active_support/core_ext/kernel/reporting'
<ide> require 'active_support/core_ext/kernel/agnostics'
<add>require 'active_support/core_ext/kernel/concern'
<ide> require 'active_support/core_ext/kernel/debugger'
<add>require 'active_support/core_ext/kernel/reporting'
<ide> require 'active_support/core_ext/kernel/singleton_class'
<ide><path>activesupport/lib/active_support/core_ext/kernel/concern.rb
<add>require 'active_support/core_ext/module/concerning'
<add>
<add>module Kernel
<add> # A shortcut to define a toplevel concern, not within a module.
<add> #
<add> # See ActiveSupport::CoreExt::Module::Concerning for more.
<add> def concern(topic, &module_definition)
<add> Object.concern topic, &module_definition
<add> end
<add>end
<ide><path>activesupport/test/concern_test.rb
<ide> class ConcernTest < ActiveSupport::TestCase
<ide> module Baz
<ide> extend ActiveSupport::Concern
<ide>
<del> module ClassMethods
<add> class_methods do
<ide> def baz
<ide> "baz"
<ide> end
<ide> module Bar
<ide>
<ide> include Baz
<ide>
<add> module ClassMethods
<add> def baz
<add> "bar's baz + " + super
<add> end
<add> end
<add>
<ide> def bar
<ide> "bar"
<ide> end
<ide> def test_modules_dependencies_are_met
<ide> @klass.send(:include, Bar)
<ide> assert_equal "bar", @klass.new.bar
<ide> assert_equal "bar+baz", @klass.new.baz
<del> assert_equal "baz", @klass.baz
<add> assert_equal "bar's baz + baz", @klass.baz
<ide> assert @klass.included_modules.include?(ConcernTest::Bar)
<ide> end
<ide>
<ide><path>activesupport/test/core_ext/kernel/concern_test.rb
<add>require 'abstract_unit'
<add>require 'active_support/core_ext/kernel/concern'
<add>
<add>class KernelConcernTest < ActiveSupport::TestCase
<add> def test_may_be_defined_at_toplevel
<add> mod = ::TOPLEVEL_BINDING.eval 'concern(:ToplevelConcern) { }'
<add> assert_equal mod, ::ToplevelConcern
<add> assert_kind_of ActiveSupport::Concern, ::ToplevelConcern
<add> assert !Object.ancestors.include?(::ToplevelConcern), mod.ancestors.inspect
<add> Object.send :remove_const, :ToplevelConcern
<add> end
<add>end
<ide><path>activesupport/test/core_ext/module/concerning_test.rb
<ide> require 'abstract_unit'
<ide> require 'active_support/core_ext/module/concerning'
<ide>
<del>class ConcerningTest < ActiveSupport::TestCase
<del> def test_concern_shortcut_creates_a_module_but_doesnt_include_it
<del> mod = Module.new { concern(:Foo) { } }
<del> assert_kind_of Module, mod::Foo
<del> assert mod::Foo.respond_to?(:included)
<del> assert !mod.ancestors.include?(mod::Foo), mod.ancestors.inspect
<add>class ModuleConcerningTest < ActiveSupport::TestCase
<add> def test_concerning_declares_a_concern_and_includes_it_immediately
<add> klass = Class.new { concerning(:Foo) { } }
<add> assert klass.ancestors.include?(klass::Foo), klass.ancestors.inspect
<ide> end
<add>end
<ide>
<add>class ModuleConcernTest < ActiveSupport::TestCase
<ide> def test_concern_creates_a_module_extended_with_active_support_concern
<ide> klass = Class.new do
<del> concern :Foo do
<add> concern :Baz do
<ide> included { @foo = 1 }
<ide> def should_be_public; end
<ide> end
<ide> end
<ide>
<ide> # Declares a concern but doesn't include it
<del> assert_kind_of Module, klass::Foo
<del> assert !klass.ancestors.include?(klass::Foo), klass.ancestors.inspect
<add> assert klass.const_defined?(:Baz, false)
<add> assert !ModuleConcernTest.const_defined?(:Baz)
<add> assert_kind_of ActiveSupport::Concern, klass::Baz
<add> assert !klass.ancestors.include?(klass::Baz), klass.ancestors.inspect
<ide>
<ide> # Public method visibility by default
<del> assert klass::Foo.public_instance_methods.map(&:to_s).include?('should_be_public')
<add> assert klass::Baz.public_instance_methods.map(&:to_s).include?('should_be_public')
<ide>
<ide> # Calls included hook
<del> assert_equal 1, Class.new { include klass::Foo }.instance_variable_get('@foo')
<add> assert_equal 1, Class.new { include klass::Baz }.instance_variable_get('@foo')
<ide> end
<ide>
<del> def test_concerning_declares_a_concern_and_includes_it_immediately
<del> klass = Class.new { concerning(:Foo) { } }
<del> assert klass.ancestors.include?(klass::Foo), klass.ancestors.inspect
<add> class Foo
<add> concerning :Bar do
<add> module ClassMethods
<add> def will_be_orphaned; end
<add> end
<add>
<add> const_set :ClassMethods, Module.new {
<add> def hacked_on; end
<add> }
<add>
<add> # Doesn't overwrite existing ClassMethods module.
<add> class_methods do
<add> def nicer_dsl; end
<add> end
<add>
<add> # Doesn't overwrite previous class_methods definitions.
<add> class_methods do
<add> def doesnt_clobber; end
<add> end
<add> end
<add> end
<add>
<add> def test_using_class_methods_blocks_instead_of_ClassMethods_module
<add> assert !Foo.respond_to?(:will_be_orphaned)
<add> assert Foo.respond_to?(:hacked_on)
<add> assert Foo.respond_to?(:nicer_dsl)
<add> assert Foo.respond_to?(:doesnt_clobber)
<add>
<add> # Orphan in Foo::ClassMethods, not Bar::ClassMethods.
<add> assert Foo.const_defined?(:ClassMethods)
<add> assert Foo::ClassMethods.method_defined?(:will_be_orphaned)
<ide> end
<ide> end | 7 |
Go | Go | add restore network functionality | deffc572ced3909c0ecd77dd21686e0e67c0ea33 | <ide><path>daemon/container.go
<ide> func (container *Container) buildHostnameAndHostsFiles(IP string) error {
<ide> return container.buildHostsFiles(IP)
<ide> }
<ide>
<del>func (container *Container) AllocateNetwork() error {
<add>func (container *Container) AllocateNetwork() (err error) {
<ide> mode := container.hostConfig.NetworkMode
<ide> if container.Config.NetworkDisabled || !mode.IsPrivate() {
<ide> return nil
<ide> }
<ide>
<ide> var (
<ide> env *engine.Env
<del> err error
<ide> eng = container.daemon.eng
<ide> )
<ide>
<ide> func (container *Container) AllocateNetwork() error {
<ide> return err
<ide> }
<ide>
<add> // Error handling: At this point, the interface is allocated so we have to
<add> // make sure that it is always released in case of error, otherwise we
<add> // might leak resources.
<add> defer func() {
<add> if err != nil {
<add> eng.Job("release_interface", container.ID).Run()
<add> }
<add> }()
<add>
<ide> if container.Config.PortSpecs != nil {
<ide> if err := migratePortMappings(container.Config, container.hostConfig); err != nil {
<del> eng.Job("release_interface", container.ID).Run()
<ide> return err
<ide> }
<ide> container.Config.PortSpecs = nil
<ide> if err := container.WriteHostConfig(); err != nil {
<del> eng.Job("release_interface", container.ID).Run()
<ide> return err
<ide> }
<ide> }
<ide> func (container *Container) AllocateNetwork() error {
<ide>
<ide> for port := range portSpecs {
<ide> if err := container.allocatePort(eng, port, bindings); err != nil {
<del> eng.Job("release_interface", container.ID).Run()
<ide> return err
<ide> }
<ide> }
<ide> func (container *Container) ReleaseNetwork() {
<ide> container.NetworkSettings = &NetworkSettings{}
<ide> }
<ide>
<add>func (container *Container) isNetworkAllocated() bool {
<add> return container.NetworkSettings.IPAddress != ""
<add>}
<add>
<add>func (container *Container) RestoreNetwork() error {
<add> mode := container.hostConfig.NetworkMode
<add> // Don't attempt a restore if we previously didn't allocate networking.
<add> // This might be a legacy container with no network allocated, in which case the
<add> // allocation will happen once and for all at start.
<add> if !container.isNetworkAllocated() || container.Config.NetworkDisabled || !mode.IsPrivate() {
<add> return nil
<add> }
<add>
<add> eng := container.daemon.eng
<add>
<add> // Re-allocate the interface with the same IP address.
<add> job := eng.Job("allocate_interface", container.ID)
<add> job.Setenv("RequestedIP", container.NetworkSettings.IPAddress)
<add> if err := job.Run(); err != nil {
<add> return err
<add> }
<add>
<add> // Re-allocate any previously allocated ports.
<add> for port, _ := range container.NetworkSettings.Ports {
<add> if err := container.allocatePort(eng, port, container.NetworkSettings.Ports); err != nil {
<add> return err
<add> }
<add> }
<add> return nil
<add>}
<add>
<ide> // cleanup releases any network resources allocated to the container along with any rules
<ide> // around how containers are linked together. It also unmounts the container's root filesystem.
<ide> func (container *Container) cleanup() { | 1 |
PHP | PHP | add configuration wrapper | eb28bc997df0e4cb44123f90558b1f3f5d1711f8 | <ide><path>src/Core/Configuration.php
<add><?php
<add>declare(strict_types=1);
<add>
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> * @link https://cakephp.org CakePHP(tm) Project
<add> * @since 4.2.0
<add> * @license https://opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Core;
<add>
<add>/**
<add> * Read-only wrapper for configuration data
<add> *
<add> * Intended for use with Cake\Core\Container as
<add> * a typehintable way for services to have application
<add> * confiugration injected as arrays cannot be typehinted.
<add> */
<add>class Configuration
<add>{
<add>
<add> /**
<add> * Read a configuration key
<add> *
<add> * @param string $path The path to read.
<add> * @param mixed $default The default value to use if $path does not exist.
<add> * @return mixed The configuration data or $default value.
<add> */
<add> public function get(string $path, $default = null)
<add> {
<add> return Configure::read($path, $default);
<add> }
<add>
<add> /**
<add> * Check if $path exists and has a non-null value.
<add> *
<add> * @param string $path The path to check.
<add> * @return boolean True if the configuration data exists.
<add> */
<add> public function has(string $key): bool
<add> {
<add> return Configure::check($key);
<add> }
<add>}
<ide><path>tests/TestCase/Core/ConfigurationTest.php
<add><?php
<add>declare(strict_types=1);
<add>
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> * @link https://cakephp.org CakePHP(tm) Project
<add> * @since 4.2.0
<add> * @license https://opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Test\TestCase\Core;
<add>
<add>use Cake\Core\Configure;
<add>use Cake\Core\Configuration;
<add>use Cake\TestSuite\TestCase;
<add>
<add>/**
<add> * ConfigurationTest
<add> */
<add>class ConfigurationTest extends TestCase
<add>{
<add> public function testGet()
<add> {
<add> Configure::write('first', 'first-val');
<add> Configure::write('nested.path', 'nested-val');
<add> $config = new Configuration();
<add>
<add> $this->assertSame('first-val', $config->get('first'));
<add> $this->assertSame('nested-val', $config->get('nested.path'));
<add> $this->assertNull($config->get('nope'));
<add> $this->assertNull($config->get('nope'));
<add> $this->assertSame('default', $config->get('nested.nope', 'default'));
<add> }
<add>
<add> public function testHas()
<add> {
<add> Configure::write('first', 'first-val');
<add> Configure::write('nested.path', 'nested-val');
<add> Configure::write('nullval', null);
<add> $config = new Configuration();
<add>
<add> $this->assertFalse($config->has('nope'));
<add> $this->assertTrue($config->has('first'));
<add> $this->assertTrue($config->has('nested.path'));
<add> $this->assertFalse($config->has('nullval'));
<add> }
<add>} | 2 |
Python | Python | integrate initialize settings | 78396d137fa2faced8a0a612ed5009fa52e3b721 | <ide><path>spacy/language.py
<ide> def initialize(
<ide> name="tokenizer",
<ide> )
<ide> self.tokenizer.initialize(get_examples, nlp=self, **tok_settings)
<add> proc_settings = settings.get("components", {})
<ide> for name, proc in self.pipeline:
<ide> if hasattr(proc, "initialize"):
<del> p_settings = settings.get(name, {})
<add> p_settings = proc_settings.get(name, {})
<ide> p_settings = validate_init_settings(
<ide> proc.initialize, p_settings, section="components", name=name
<ide> )
<ide><path>spacy/training/initialize.py
<ide> def init_nlp(config: Config, *, use_gpu: int = -1, silent: bool = True) -> Langu
<ide> msg.info(f"Resuming training for: {resume_components}")
<ide> nlp.resume_training(sgd=optimizer)
<ide> with nlp.select_pipes(disable=[*frozen_components, *resume_components]):
<del> nlp.initialize(
<del> lambda: train_corpus(nlp), sgd=optimizer, settings=I["components"]
<del> )
<add> nlp.initialize(lambda: train_corpus(nlp), sgd=optimizer, settings=I)
<ide> msg.good("Initialized pipeline components")
<ide> # Verify the config after calling 'initialize' to ensure labels
<ide> # are properly initialized | 2 |
PHP | PHP | remove un-used classes from import | cbda6e1d86b57751ee7dab99ee1d4c32d4abd32a | <ide><path>src/Illuminate/Foundation/Testing/ApplicationTrait.php
<ide> <?php namespace Illuminate\Foundation\Testing;
<ide>
<del>use Illuminate\Http\Request;
<del>use InvalidArgumentException;
<del>use Symfony\Component\DomCrawler\Form;
<del>use Symfony\Component\DomCrawler\Crawler;
<ide> use Illuminate\Contracts\Auth\Authenticatable as UserContract;
<del>use PHPUnit_Framework_ExpectationFailedException as PHPUnitException;
<ide>
<ide> trait ApplicationTrait
<ide> { | 1 |
Python | Python | remove locks for upgrades in mssql | 04ca4ec124020c9970700c573ef52e345667b9fe | <ide><path>airflow/utils/session.py
<ide> def create_global_lock(session=None, pg_lock_id=1, lock_name='init', mysql_lock_
<ide> session.connection().execute(f"select GET_LOCK('{lock_name}',{mysql_lock_timeout});")
<ide>
<ide> if dialect.name == 'mssql':
<del> session.connection().execute(
<del> f"sp_getapplock @Resource = '{lock_name}', @LockMode = 'Exclusive', @LockOwner = 'Session';"
<del> )
<add> # TODO: make locking works for MSSQL
<add> pass
<ide>
<ide> yield None
<ide> finally:
<ide> def create_global_lock(session=None, pg_lock_id=1, lock_name='init', mysql_lock_
<ide> session.connection().execute(f"select RELEASE_LOCK('{lock_name}');")
<ide>
<ide> if dialect.name == 'mssql':
<del> session.connection().execute(
<del> f"sp_releaseapplock @Resource = '{lock_name}', @LockOwner = 'Session';"
<del> )
<add> # TODO: make locking works for MSSQL
<add> pass | 1 |
PHP | PHP | add typehints to mailer | 382d91d1fd47bb3b37966e1d9bbb181b4e249f83 | <ide><path>src/Mailer/AbstractTransport.php
<ide> */
<ide> abstract class AbstractTransport
<ide> {
<del>
<ide> use InstanceConfigTrait;
<ide>
<ide> /**
<ide> abstract class AbstractTransport
<ide> * @param \Cake\Mailer\Email $email Email instance.
<ide> * @return array
<ide> */
<del> abstract public function send(Email $email);
<add> abstract public function send(Email $email): array;
<ide>
<ide> /**
<ide> * Constructor
<ide> *
<ide> * @param array $config Configuration options.
<ide> */
<del> public function __construct($config = [])
<add> public function __construct(array $config = [])
<ide> {
<ide> $this->setConfig($config);
<ide> }
<ide> public function __construct($config = [])
<ide> * @param string $eol End of line string.
<ide> * @return string
<ide> */
<del> protected function _headersToString($headers, $eol = "\r\n")
<add> protected function _headersToString(array $headers, string $eol = "\r\n"): string
<ide> {
<ide> $out = '';
<ide> foreach ($headers as $key => $value) {
<ide><path>src/Mailer/Email.php
<ide> class Email implements JsonSerializable, Serializable
<ide> *
<ide> * @var string
<ide> */
<del> protected $_domain;
<add> protected $_domain = '';
<ide>
<ide> /**
<ide> * The subject of the email
<ide> class Email implements JsonSerializable, Serializable
<ide> * If null, filter_var() will be used. Use the emailPattern() method
<ide> * to set a custom pattern.'
<ide> *
<del> * @var string
<add> * @var string|null
<ide> */
<ide> protected $_emailPattern = self::EMAIL_PATTERN;
<ide>
<ide> public function getReplyTo()
<ide> * @return $this
<ide> * @throws \InvalidArgumentException
<ide> */
<del> public function setReadReceipt($email, $name = null)
<add> public function setReadReceipt($email, ?string $name = null): self
<ide> {
<ide> return $this->_setEmailSingle('_readReceipt', $email, $name, 'Disposition-Notification-To requires only 1 email address.');
<ide> }
<ide> public function setReadReceipt($email, $name = null)
<ide> *
<ide> * @return array
<ide> */
<del> public function getReadReceipt()
<add> public function getReadReceipt(): array
<ide> {
<ide> return $this->_readReceipt;
<ide> }
<ide> public function getReadReceipt()
<ide> * @return $this
<ide> * @throws \InvalidArgumentException
<ide> */
<del> public function setReturnPath($email, $name = null)
<add> public function setReturnPath($email, ?string $name = null): self
<ide> {
<ide> return $this->_setEmailSingle('_returnPath', $email, $name, 'Return-Path requires only 1 email address.');
<ide> }
<ide> public function setReturnPath($email, $name = null)
<ide> *
<ide> * @return array
<ide> */
<del> public function getReturnPath()
<add> public function getReturnPath(): array
<ide> {
<ide> return $this->_returnPath;
<ide> }
<ide> public function getReturnPath()
<ide> * @param string|null $name Name
<ide> * @return $this
<ide> */
<del> public function setTo($email, $name = null)
<add> public function setTo($email, ?string $name = null): self
<ide> {
<ide> return $this->_setEmail('_to', $email, $name);
<ide> }
<ide> public function getTo()
<ide> * @param string|null $name Name
<ide> * @return $this
<ide> */
<del> public function addTo($email, $name = null)
<add> public function addTo($email, ?string $name = null): self
<ide> {
<ide> return $this->_addEmail('_to', $email, $name);
<ide> }
<ide> public function addTo($email, $name = null)
<ide> * @param string|null $name Name
<ide> * @return $this
<ide> */
<del> public function setCc($email, $name = null)
<add> public function setCc($email, ?string $name = null): self
<ide> {
<ide> return $this->_setEmail('_cc', $email, $name);
<ide> }
<ide> public function setCc($email, $name = null)
<ide> *
<ide> * @return array
<ide> */
<del> public function getCc()
<add> public function getCc(): array
<ide> {
<ide> return $this->_cc;
<ide> }
<ide> public function getCc()
<ide> * @param string|null $name Name
<ide> * @return $this
<ide> */
<del> public function addCc($email, $name = null)
<add> public function addCc($email, ?string $name = null): self
<ide> {
<ide> return $this->_addEmail('_cc', $email, $name);
<ide> }
<ide> public function addCc($email, $name = null)
<ide> * @param string|null $name Name
<ide> * @return $this
<ide> */
<del> public function setBcc($email, $name = null)
<add> public function setBcc($email, ?string $name = null): self
<ide> {
<ide> return $this->_setEmail('_bcc', $email, $name);
<ide> }
<ide> public function setBcc($email, $name = null)
<ide> *
<ide> * @return array
<ide> */
<del> public function getBcc()
<add> public function getBcc(): array
<ide> {
<ide> return $this->_bcc;
<ide> }
<ide> public function getBcc()
<ide> * @param string|null $name Name
<ide> * @return $this
<ide> */
<del> public function addBcc($email, $name = null)
<add> public function addBcc($email, ?string $name = null): self
<ide> {
<ide> return $this->_addEmail('_bcc', $email, $name);
<ide> }
<ide>
<ide> /**
<ide> * Charset setter.
<ide> *
<del> * @param string|null $charset Character set.
<add> * @param string $charset Character set.
<ide> * @return $this
<ide> */
<del> public function setCharset($charset)
<add> public function setCharset(string $charset): self
<ide> {
<ide> $this->charset = $charset;
<ide> if (!$this->headerCharset) {
<ide> public function setCharset($charset)
<ide> *
<ide> * @return string Charset
<ide> */
<del> public function getCharset()
<add> public function getCharset(): string
<ide> {
<ide> return $this->charset;
<ide> }
<ide> public function getCharset()
<ide> * @param string|null $charset Character set.
<ide> * @return $this
<ide> */
<del> public function setHeaderCharset($charset)
<add> public function setHeaderCharset(?string $charset): self
<ide> {
<ide> $this->headerCharset = $charset;
<ide>
<ide> public function setHeaderCharset($charset)
<ide> /**
<ide> * HeaderCharset getter.
<ide> *
<del> * @return string Charset
<add> * @return string|null Charset
<ide> */
<del> public function getHeaderCharset()
<add> public function getHeaderCharset(): ?string
<ide> {
<ide> return $this->headerCharset;
<ide> }
<ide> public function getHeaderCharset()
<ide> *
<ide> * @param string|null $encoding Encoding set.
<ide> * @return $this
<add> * @throws \InvalidArgumentException
<ide> */
<del> public function setTransferEncoding($encoding)
<add> public function setTransferEncoding(?string $encoding): self
<ide> {
<ide> $encoding = strtolower($encoding);
<ide> if (!in_array($encoding, $this->_transferEncodingAvailable)) {
<ide> public function setTransferEncoding($encoding)
<ide> *
<ide> * @return string|null Encoding
<ide> */
<del> public function getTransferEncoding()
<add> public function getTransferEncoding(): ?string
<ide> {
<ide> return $this->transferEncoding;
<ide> }
<ide> public function getTransferEncoding()
<ide> * null to unset the pattern and make use of filter_var() instead.
<ide> * @return $this
<ide> */
<del> public function setEmailPattern($regex)
<add> public function setEmailPattern(?string $regex): self
<ide> {
<ide> $this->_emailPattern = $regex;
<ide>
<ide> public function setEmailPattern($regex)
<ide> /**
<ide> * EmailPattern setter/getter
<ide> *
<del> * @return string
<add> * @return string|null
<ide> */
<del> public function getEmailPattern()
<add> public function getEmailPattern(): ?string
<ide> {
<ide> return $this->_emailPattern;
<ide> }
<ide> protected function _addEmail($varName, $email, $name)
<ide> * @param string $subject Subject string.
<ide> * @return $this
<ide> */
<del> public function setSubject($subject)
<add> public function setSubject(string $subject): self
<ide> {
<ide> $this->_subject = $this->_encode($subject);
<ide>
<ide> public function setSubject($subject)
<ide> *
<ide> * @return string
<ide> */
<del> public function getSubject()
<add> public function getSubject(): string
<ide> {
<ide> return $this->_subject;
<ide> }
<ide> public function getSubject()
<ide> *
<ide> * @return string Original subject
<ide> */
<del> public function getOriginalSubject()
<add> public function getOriginalSubject(): string
<ide> {
<ide> return $this->_decode($this->_subject);
<ide> }
<ide> public function getOriginalSubject()
<ide> * @param array $headers Associative array containing headers to be set.
<ide> * @return $this
<ide> */
<del> public function setHeaders(array $headers)
<add> public function setHeaders(array $headers): self
<ide> {
<ide> $this->_headers = $headers;
<ide>
<ide> public function setHeaders(array $headers)
<ide> * @param array $headers Headers to set.
<ide> * @return $this
<ide> */
<del> public function addHeaders(array $headers)
<add> public function addHeaders(array $headers): self
<ide> {
<ide> $this->_headers = array_merge($this->_headers, $headers);
<ide>
<ide> public function addHeaders(array $headers)
<ide> * @param array $include List of headers.
<ide> * @return array
<ide> */
<del> public function getHeaders(array $include = [])
<add> public function getHeaders(array $include = []): array
<ide> {
<ide> if ($include == array_values($include)) {
<ide> $include = array_fill_keys($include, true);
<ide> protected function _formatAddress($address)
<ide> * @param string|null $template Template name or null to not use.
<ide> * @return $this
<ide> */
<del> public function setTemplate($template)
<add> public function setTemplate(?string $template): self
<ide> {
<ide> $this->viewBuilder()->setTemplate($template ?: '');
<ide>
<ide> public function setTemplate($template)
<ide> *
<ide> * @return string
<ide> */
<del> public function getTemplate()
<add> public function getTemplate(): string
<ide> {
<ide> return $this->viewBuilder()->getTemplate();
<ide> }
<ide> public function getTemplate()
<ide> * @param string|null $layout Layout name or null to not use
<ide> * @return $this
<ide> */
<del> public function setLayout($layout)
<add> public function setLayout(?string $layout): self
<ide> {
<ide> $this->viewBuilder()->setLayout($layout ?: false);
<ide>
<ide> public function setLayout($layout)
<ide> *
<ide> * @return string
<ide> */
<del> public function getLayout()
<add> public function getLayout(): string
<ide> {
<ide> return $this->viewBuilder()->getLayout();
<ide> }
<ide> public function getLayout()
<ide> * @param string $viewClass View class name.
<ide> * @return $this
<ide> */
<del> public function setViewRenderer($viewClass)
<add> public function setViewRenderer(string $viewClass): self
<ide> {
<ide> $this->viewBuilder()->setClassName($viewClass);
<ide>
<ide> public function setViewRenderer($viewClass)
<ide> *
<ide> * @return string
<ide> */
<del> public function getViewRenderer()
<add> public function getViewRenderer(): string
<ide> {
<ide> return $this->viewBuilder()->getClassName();
<ide> }
<ide> public function getViewRenderer()
<ide> * @param array $viewVars Variables to set for view.
<ide> * @return $this
<ide> */
<del> public function setViewVars($viewVars)
<add> public function setViewVars(array $viewVars): self
<ide> {
<ide> $this->set($viewVars);
<ide>
<ide> public function setViewVars($viewVars)
<ide> *
<ide> * @return array
<ide> */
<del> public function getViewVars()
<add> public function getViewVars(): array
<ide> {
<ide> return $this->viewVars;
<ide> }
<ide>
<ide> /**
<ide> * Sets theme to use when rendering.
<ide> *
<del> * @param string $theme Theme name.
<add> * @param string|null $theme Theme name.
<ide> * @return $this
<ide> */
<del> public function setTheme($theme)
<add> public function setTheme(?string $theme): self
<ide> {
<ide> $this->viewBuilder()->setTheme($theme);
<ide>
<ide> public function setTheme($theme)
<ide> /**
<ide> * Gets theme to use when rendering.
<ide> *
<del> * @return string
<add> * @return string|null
<ide> */
<del> public function getTheme()
<add> public function getTheme(): ?string
<ide> {
<ide> return $this->viewBuilder()->getTheme();
<ide> }
<ide> public function getTheme()
<ide> * @param array $helpers Helpers list.
<ide> * @return $this
<ide> */
<del> public function setHelpers(array $helpers)
<add> public function setHelpers(array $helpers): self
<ide> {
<ide> $this->viewBuilder()->setHelpers($helpers, false);
<ide>
<ide> public function setHelpers(array $helpers)
<ide> *
<ide> * @return array
<ide> */
<del> public function getHelpers()
<add> public function getHelpers(): array
<ide> {
<ide> return $this->viewBuilder()->getHelpers();
<ide> }
<ide> public function getHelpers()
<ide> * @return $this
<ide> * @throws \InvalidArgumentException
<ide> */
<del> public function setEmailFormat($format)
<add> public function setEmailFormat(string $format): self
<ide> {
<ide> if (!in_array($format, $this->_emailFormatAvailable)) {
<ide> throw new InvalidArgumentException('Format not available.');
<ide> public function setEmailFormat($format)
<ide> *
<ide> * @return string
<ide> */
<del> public function getEmailFormat()
<add> public function getEmailFormat(): string
<ide> {
<ide> return $this->_emailFormat;
<ide> }
<ide> public function getEmailFormat()
<ide> * @throws \LogicException When the chosen transport lacks a send method.
<ide> * @throws \InvalidArgumentException When $name is neither a string nor an object.
<ide> */
<del> public function setTransport($name)
<add> public function setTransport($name): self
<ide> {
<ide> if (is_string($name)) {
<ide> $transport = $this->_constructTransport($name);
<ide> public function setTransport($name)
<ide> /**
<ide> * Gets the transport.
<ide> *
<del> * @return \Cake\Mailer\AbstractTransport
<add> * @return \Cake\Mailer\AbstractTransport|null
<ide> */
<del> public function getTransport()
<add> public function getTransport(): ?AbstractTransport
<ide> {
<ide> return $this->_transport;
<ide> }
<ide> protected function _constructTransport($name)
<ide> * @return $this
<ide> * @throws \InvalidArgumentException
<ide> */
<del> public function setMessageId($message)
<add> public function setMessageId($message): self
<ide> {
<ide> if (is_bool($message)) {
<ide> $this->_messageId = $message;
<ide> public function getMessageId()
<ide> * @param string $domain Manually set the domain for CLI mailing.
<ide> * @return $this
<ide> */
<del> public function setDomain($domain)
<add> public function setDomain(string $domain): self
<ide> {
<ide> $this->_domain = $domain;
<ide>
<ide> public function setDomain($domain)
<ide> *
<ide> * @return string
<ide> */
<del> public function getDomain()
<add> public function getDomain(): string
<ide> {
<ide> return $this->_domain;
<ide> }
<ide> public function getDomain()
<ide> * The `contentDisposition` key allows you to disable the `Content-Disposition` header, this can improve
<ide> * attachment compatibility with outlook email clients.
<ide> *
<del> * @param string|array $attachments String with the filename or array with filenames
<add> * @param array $attachments Array of filenames.
<ide> * @return $this
<ide> * @throws \InvalidArgumentException
<ide> */
<del> public function setAttachments($attachments)
<add> public function setAttachments(array $attachments): self
<ide> {
<ide> $attach = [];
<del> foreach ((array)$attachments as $name => $fileInfo) {
<add> foreach ($attachments as $name => $fileInfo) {
<ide> if (!is_array($fileInfo)) {
<ide> $fileInfo = ['file' => $fileInfo];
<ide> }
<ide> public function setAttachments($attachments)
<ide> *
<ide> * @return array Array of attachments.
<ide> */
<del> public function getAttachments()
<add> public function getAttachments(): array
<ide> {
<ide> return $this->_attachments;
<ide> }
<ide>
<ide> /**
<ide> * Add attachments
<ide> *
<del> * @param string|array $attachments String with the filename or array with filenames
<add> * @param array $attachments Array of filenames.
<ide> * @return $this
<ide> * @throws \InvalidArgumentException
<ide> * @see \Cake\Mailer\Email::setAttachments()
<ide> */
<del> public function addAttachments($attachments)
<add> public function addAttachments(array $attachments): self
<ide> {
<ide> $current = $this->_attachments;
<ide> $this->setAttachments($attachments);
<ide> public function addAttachments($attachments)
<ide> * @param string|null $type Use MESSAGE_* constants or null to return the full message as array
<ide> * @return string|array String if type is given, array if type is null
<ide> */
<del> public function message($type = null)
<add> public function message(?string $type = null)
<ide> {
<ide> switch ($type) {
<ide> case static::MESSAGE_HTML:
<ide> public function message($type = null)
<ide> * @param int|null $priority 1 (highest) to 5 (lowest)
<ide> * @return $this
<ide> */
<del> public function setPriority($priority)
<add> public function setPriority(?int $priority): self
<ide> {
<ide> $this->_priority = $priority;
<ide>
<ide> public function setPriority($priority)
<ide> /**
<ide> * Gets priority.
<ide> *
<del> * @return int
<add> * @return int|null
<ide> */
<del> public function getPriority()
<add> public function getPriority(): ?int
<ide> {
<ide> return $this->_priority;
<ide> }
<ide> public function getPriority()
<ide> * @return void
<ide> * @throws \BadMethodCallException When modifying an existing configuration.
<ide> */
<del> public static function setConfigTransport($key, $config = null)
<add> public static function setConfigTransport($key, $config = null): void
<ide> {
<ide> if (is_array($key)) {
<ide> foreach ($key as $name => $settings) {
<ide> public static function setConfigTransport($key, $config = null)
<ide> * @param string $key The configuration name to read.
<ide> * @return array|null Transport config.
<ide> */
<del> public static function getConfigTransport($key)
<add> public static function getConfigTransport(string $key): ?array
<ide> {
<ide> return isset(static::$_transportConfig[$key]) ? static::$_transportConfig[$key] : null;
<ide> }
<ide> public static function getConfigTransport($key)
<ide> *
<ide> * @return array Array of configurations.
<ide> */
<del> public static function configuredTransport()
<add> public static function configuredTransport(): array
<ide> {
<ide> return array_keys(static::$_transportConfig);
<ide> }
<ide> public static function configuredTransport()
<ide> * @param string $key The transport name to remove.
<ide> * @return void
<ide> */
<del> public static function dropTransport($key)
<add> public static function dropTransport($key): void
<ide> {
<ide> unset(static::$_transportConfig[$key]);
<ide> }
<ide> public static function dropTransport($key)
<ide> * an array with config.
<ide> * @return $this
<ide> */
<del> public function setProfile($config)
<add> public function setProfile($config): self
<ide> {
<del> if (!is_array($config)) {
<del> $config = $config;
<del> }
<ide> $this->_applyConfig($config);
<ide>
<ide> return $this;
<ide> public function setProfile($config)
<ide> /**
<ide> * Gets the configuration profile to use for this instance.
<ide> *
<del> * @return string|array
<add> * @return array
<ide> */
<del> public function getProfile()
<add> public function getProfile(): array
<ide> {
<ide> return $this->_profile;
<ide> }
<ide> public function getProfile()
<ide> * @return array
<ide> * @throws \BadMethodCallException
<ide> */
<del> public function send($content = null)
<add> public function send($content = null): array
<ide> {
<ide> if (empty($this->_from)) {
<ide> throw new BadMethodCallException('From is not specified.');
<ide> protected function flatten($value)
<ide> * @return static Instance of Cake\Mailer\Email
<ide> * @throws \InvalidArgumentException
<ide> */
<del> public static function deliver($to = null, $subject = null, $message = null, $config = 'default', $send = true)
<add> public static function deliver($to = null, ?string $subject = null, $message = null, $config = 'default', bool $send = true): Email
<ide> {
<ide> $class = __CLASS__;
<ide>
<ide> protected function _applyConfig($config)
<ide> *
<ide> * @return $this
<ide> */
<del> public function reset()
<add> public function reset(): self
<ide> {
<ide> $this->_to = [];
<ide> $this->_from = [];
<ide> protected function _getContentTypeCharset()
<ide> * @return array Serializable array of configuration properties.
<ide> * @throws \Exception When a view var object can not be properly serialized.
<ide> */
<del> public function jsonSerialize()
<add> public function jsonSerialize(): array
<ide> {
<ide> $properties = [
<ide> '_to', '_from', '_sender', '_replyTo', '_cc', '_bcc', '_subject',
<ide> public function jsonSerialize()
<ide> * @param mixed $item Reference to the view var value.
<ide> * @param string $key View var key.
<ide> * @return void
<add> * @throws \RuntimeException
<ide> */
<ide> protected function _checkViewVars(&$item, $key)
<ide> {
<ide> protected function _checkViewVars(&$item, $key)
<ide> * @param array $config Email configuration array.
<ide> * @return $this Configured email instance.
<ide> */
<del> public function createFromArray($config)
<add> public function createFromArray(array $config): self
<ide> {
<ide> if (isset($config['viewConfig'])) {
<ide> $this->viewBuilder()->createFromArray($config['viewConfig']);
<ide> public function createFromArray($config)
<ide> *
<ide> * @return string
<ide> */
<del> public function serialize()
<add> public function serialize(): string
<ide> {
<ide> $array = $this->jsonSerialize();
<ide> array_walk_recursive($array, function (&$item, $key) {
<ide> public function serialize()
<ide> * @param string $data Serialized string.
<ide> * @return static Configured email instance.
<ide> */
<del> public function unserialize($data)
<add> public function unserialize($data): self
<ide> {
<ide> return $this->createFromArray(unserialize($data));
<ide> }
<ide><path>src/Mailer/Exception/MissingMailerException.php
<ide> */
<ide> class MissingMailerException extends Exception
<ide> {
<del>
<add> /**
<add> * {@inheritDoc}
<add> */
<ide> protected $_messageTemplate = 'Mailer class "%s" could not be found.';
<ide> }
<ide><path>src/Mailer/Mailer.php
<ide> use Cake\Datasource\ModelAwareTrait;
<ide> use Cake\Event\EventListenerInterface;
<ide> use Cake\Mailer\Exception\MissingActionException;
<add>use Cake\View\ViewBuilder;
<ide>
<ide> /**
<ide> * Mailer base class.
<ide> */
<ide> abstract class Mailer implements EventListenerInterface
<ide> {
<del>
<ide> use ModelAwareTrait;
<ide>
<ide> /**
<ide> abstract class Mailer implements EventListenerInterface
<ide> *
<ide> * @param \Cake\Mailer\Email|null $email Email instance.
<ide> */
<del> public function __construct(Email $email = null)
<add> public function __construct(?Email $email = null)
<ide> {
<ide> if ($email === null) {
<ide> $email = new Email();
<ide> public function __construct(Email $email = null)
<ide> *
<ide> * @return string
<ide> */
<del> public function getName()
<add> public function getName(): string
<ide> {
<ide> if (!static::$name) {
<ide> static::$name = str_replace(
<ide> public function getName()
<ide> *
<ide> * @return \Cake\View\ViewBuilder
<ide> */
<del> public function viewBuilder()
<add> public function viewBuilder(): ViewBuilder
<ide> {
<ide> return $this->_email->viewBuilder();
<ide> }
<ide> public function viewBuilder()
<ide> * @param array $args Method arguments
<ide> * @return $this|mixed
<ide> */
<del> public function __call($method, $args)
<add> public function __call(string $method, array $args)
<ide> {
<ide> $result = $this->_email->$method(...$args);
<ide> if (strpos($method, 'get') === 0) {
<ide> public function __call($method, $args)
<ide> * @param mixed $value View variable value.
<ide> * @return $this
<ide> */
<del> public function set($key, $value = null)
<add> public function set($key, $value = null): self
<ide> {
<ide> $this->_email->setViewVars(is_string($key) ? [$key => $value] : $key);
<ide>
<ide> public function set($key, $value = null)
<ide> * @throws \Cake\Mailer\Exception\MissingActionException
<ide> * @throws \BadMethodCallException
<ide> */
<del> public function send($action, $args = [], $headers = [])
<add> public function send(string $action, array $args = [], array $headers = []): array
<ide> {
<ide> try {
<ide> if (!method_exists($this, $action)) {
<ide> public function send($action, $args = [], $headers = [])
<ide> *
<ide> * @return $this
<ide> */
<del> protected function reset()
<add> protected function reset(): self
<ide> {
<ide> $this->_email = clone $this->_clonedEmail;
<ide>
<ide><path>src/Mailer/MailerAwareTrait.php
<ide> */
<ide> trait MailerAwareTrait
<ide> {
<del>
<ide> /**
<ide> * Returns a mailer instance.
<ide> *
<ide> trait MailerAwareTrait
<ide> * @return \Cake\Mailer\Mailer
<ide> * @throws \Cake\Mailer\Exception\MissingMailerException if undefined mailer class.
<ide> */
<del> protected function getMailer($name, Email $email = null)
<add> protected function getMailer(string $name, ?Email $email = null): Mailer
<ide> {
<ide> if ($email === null) {
<ide> $email = new Email();
<ide><path>src/Mailer/Transport/DebugTransport.php
<ide> class DebugTransport extends AbstractTransport
<ide> * @param \Cake\Mailer\Email $email Cake Email
<ide> * @return array
<ide> */
<del> public function send(Email $email)
<add> public function send(Email $email): array
<ide> {
<ide> $headers = $email->getHeaders(['from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'subject']);
<ide> $headers = $this->_headersToString($headers);
<ide><path>src/Mailer/Transport/MailTransport.php
<ide> class MailTransport extends AbstractTransport
<ide> * @param \Cake\Mailer\Email $email Cake Email
<ide> * @return array
<ide> */
<del> public function send(Email $email)
<add> public function send(Email $email): array
<ide> {
<ide> $eol = PHP_EOL;
<ide> if (isset($this->_config['eol'])) {
<ide> public function send(Email $email)
<ide> * @throws \Cake\Network\Exception\SocketException if mail could not be sent
<ide> * @return void
<ide> */
<del> protected function _mail($to, $subject, $message, $headers, $params = null)
<add> protected function _mail(string $to, string $subject, string $message, string $headers, ?string $params = null): void
<ide> {
<ide> //@codingStandardsIgnoreStart
<ide> if (!@mail($to, $subject, $message, $headers, $params)) {
<ide><path>src/Mailer/Transport/SmtpTransport.php
<ide> */
<ide> class SmtpTransport extends AbstractTransport
<ide> {
<del>
<ide> /**
<ide> * Default config for this class
<ide> *
<ide> public function __destruct()
<ide> *
<ide> * @return void
<ide> */
<del> public function connect()
<add> public function connect(): void
<ide> {
<ide> if (!$this->connected()) {
<ide> $this->_connect();
<ide> public function connect()
<ide> *
<ide> * @return bool
<ide> */
<del> public function connected()
<add> public function connected(): bool
<ide> {
<ide> return $this->_socket !== null && $this->_socket->connected;
<ide> }
<ide> public function connected()
<ide> *
<ide> * @return void
<ide> */
<del> public function disconnect()
<add> public function disconnect(): void
<ide> {
<ide> if ($this->connected()) {
<ide> $this->_disconnect();
<ide> public function disconnect()
<ide> *
<ide> * @return array
<ide> */
<del> public function getLastResponse()
<add> public function getLastResponse(): array
<ide> {
<ide> return $this->_lastResponse;
<ide> }
<ide> public function getLastResponse()
<ide> * @return array
<ide> * @throws \Cake\Network\Exception\SocketException
<ide> */
<del> public function send(Email $email)
<add> public function send(Email $email): array
<ide> {
<ide> if (!$this->connected()) {
<ide> $this->_connect();
<ide> public function send(Email $email)
<ide> * @param array $responseLines Response lines to parse.
<ide> * @return void
<ide> */
<del> protected function _bufferResponseLines(array $responseLines)
<add> protected function _bufferResponseLines(array $responseLines): void
<ide> {
<ide> $response = [];
<ide> foreach ($responseLines as $responseLine) {
<ide> protected function _bufferResponseLines(array $responseLines)
<ide> * @return void
<ide> * @throws \Cake\Network\Exception\SocketException
<ide> */
<del> protected function _connect()
<add> protected function _connect(): void
<ide> {
<ide> $this->_generateSocket();
<ide> if (!$this->_socket->connect()) {
<ide> protected function _connect()
<ide> * @return void
<ide> * @throws \Cake\Network\Exception\SocketException
<ide> */
<del> protected function _auth()
<add> protected function _auth(): void
<ide> {
<ide> if (isset($this->_config['username'], $this->_config['password'])) {
<ide> $replyCode = (string)$this->_smtpSend('AUTH LOGIN', '334|500|502|504');
<ide> protected function _auth()
<ide> * @param string $email The email address to send with the command.
<ide> * @return string
<ide> */
<del> protected function _prepareFromCmd($email)
<add> protected function _prepareFromCmd(string $email): string
<ide> {
<ide> return 'MAIL FROM:<' . $email . '>';
<ide> }
<ide> protected function _prepareFromCmd($email)
<ide> * @param string $email The email address to send with the command.
<ide> * @return string
<ide> */
<del> protected function _prepareRcptCmd($email)
<add> protected function _prepareRcptCmd(string $email): string
<ide> {
<ide> return 'RCPT TO:<' . $email . '>';
<ide> }
<ide> protected function _prepareRcptCmd($email)
<ide> * @param \Cake\Mailer\Email $email Email instance
<ide> * @return array
<ide> */
<del> protected function _prepareFromAddress($email)
<add> protected function _prepareFromAddress(Email $email): array
<ide> {
<ide> $from = $email->getReturnPath();
<ide> if (empty($from)) {
<ide> protected function _prepareFromAddress($email)
<ide> * @param \Cake\Mailer\Email $email Email instance
<ide> * @return array
<ide> */
<del> protected function _prepareRecipientAddresses($email)
<add> protected function _prepareRecipientAddresses(Email $email): array
<ide> {
<ide> $to = $email->getTo();
<ide> $cc = $email->getCc();
<ide> protected function _prepareRecipientAddresses($email)
<ide> * @param \Cake\Mailer\Email $email Email instance
<ide> * @return array
<ide> */
<del> protected function _prepareMessageHeaders($email)
<add> protected function _prepareMessageHeaders(Email $email): array
<ide> {
<ide> return $email->getHeaders(['from', 'sender', 'replyTo', 'readReceipt', 'to', 'cc', 'subject', 'returnPath']);
<ide> }
<ide> protected function _prepareMessageHeaders($email)
<ide> * @param \Cake\Mailer\Email $email Email instance
<ide> * @return string
<ide> */
<del> protected function _prepareMessage($email)
<add> protected function _prepareMessage(Email $email): string
<ide> {
<ide> $lines = $email->message();
<ide> $messages = [];
<ide> protected function _prepareMessage($email)
<ide> /**
<ide> * Send emails
<ide> *
<del> * @return void
<ide> * @param \Cake\Mailer\Email $email Cake Email
<ide> * @throws \Cake\Network\Exception\SocketException
<add> * @return void
<ide> */
<del> protected function _sendRcpt($email)
<add> protected function _sendRcpt(Email $email): void
<ide> {
<ide> $from = $this->_prepareFromAddress($email);
<ide> $this->_smtpSend($this->_prepareFromCmd(key($from)));
<ide> protected function _sendRcpt($email)
<ide> * @return void
<ide> * @throws \Cake\Network\Exception\SocketException
<ide> */
<del> protected function _sendData($email)
<add> protected function _sendData(Email $email): void
<ide> {
<ide> $this->_smtpSend('DATA', '354');
<ide>
<ide> protected function _sendData($email)
<ide> * @return void
<ide> * @throws \Cake\Network\Exception\SocketException
<ide> */
<del> protected function _disconnect()
<add> protected function _disconnect(): void
<ide> {
<ide> $this->_smtpSend('QUIT', false);
<ide> $this->_socket->disconnect();
<ide> protected function _disconnect()
<ide> * @return void
<ide> * @throws \Cake\Network\Exception\SocketException
<ide> */
<del> protected function _generateSocket()
<add> protected function _generateSocket(): void
<ide> {
<ide> $this->_socket = new Socket($this->_config);
<ide> }
<ide> protected function _generateSocket()
<ide> * @return string|null The matched code, or null if nothing matched
<ide> * @throws \Cake\Network\Exception\SocketException
<ide> */
<del> protected function _smtpSend($data, $checkCode = '250')
<add> protected function _smtpSend(?string $data, ?string $checkCode = '250'): ?string
<ide> {
<ide> $this->_lastResponse = [];
<ide>
<ide> protected function _smtpSend($data, $checkCode = '250')
<ide> }
<ide> throw new SocketException(sprintf('SMTP Error: %s', $response));
<ide> }
<add>
<add> return null;
<ide> }
<ide> }
<ide><path>src/TestSuite/TestEmailTransport.php
<ide> *
<ide> * Set this as the email transport to capture emails for later assertions
<ide> *
<del> * @see Cake\TestSuite\EmailTrait
<add> * @see \Cake\TestSuite\EmailTrait
<ide> */
<ide> class TestEmailTransport extends AbstractTransport
<ide> {
<add> /**
<add> * @var array
<add> */
<ide> private static $emails = [];
<ide>
<ide> /**
<ide> * Stores email for later assertions
<ide> *
<del> * @param Email $email Email
<del> * @return bool
<add> * @param \Cake\Mailer\Email $email Email
<add> * @return array
<ide> */
<del> public function send(Email $email)
<add> public function send(Email $email): array
<ide> {
<ide> static::$emails[] = $email;
<ide>
<del> return true;
<add> return [
<add> 'result' => 'Success'
<add> ];
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/Mailer/EmailTest.php
<ide> public function formatAddress($address)
<ide> /**
<ide> * Wrap to protected method
<ide> *
<add> * @param string $text
<add> * @param int $length
<ide> * @return array
<ide> */
<ide> public function wrap($text, $length = Email::LINE_LENGTH_MUST)
<ide> public function testViewVars()
<ide> */
<ide> public function testSetAttachments()
<ide> {
<del> $this->Email->setAttachments(CAKE . 'basics.php');
<add> $this->Email->setAttachments([CAKE . 'basics.php']);
<ide> $expected = [
<ide> 'basics.php' => [
<ide> 'file' => CAKE . 'basics.php',
<ide> public function testSetAttachments()
<ide> $this->Email->setAttachments([
<ide> ['file' => CAKE . 'basics.php', 'mimetype' => 'text/plain']
<ide> ]);
<del> $this->Email->addAttachments(CORE_PATH . 'config' . DS . 'bootstrap.php');
<add> $this->Email->addAttachments([CORE_PATH . 'config' . DS . 'bootstrap.php']);
<ide> $this->Email->addAttachments([CORE_PATH . 'config' . DS . 'bootstrap.php']);
<ide> $this->Email->addAttachments([
<ide> 'other.txt' => CORE_PATH . 'config' . DS . 'bootstrap.php',
<ide> public function testConfigTransport()
<ide> 'className' => 'Debug',
<ide> 'log' => true
<ide> ];
<del> $result = Email::setConfigTransport('debug', $settings);
<del> $this->assertNull($result, 'No return.');
<add> Email::setConfigTransport('debug', $settings);
<ide>
<ide> $result = Email::getConfigTransport('debug');
<ide> $this->assertEquals($settings, $result);
<ide> public function testSendWithLog()
<ide> $this->Email->setSubject('My title');
<ide> $this->Email->setProfile(['log' => 'debug']);
<ide> $result = $this->Email->send($message);
<add>
<add> $this->assertNotEmpty($result);
<ide> }
<ide>
<ide> /**
<ide> public function testReset()
<ide>
<ide> $this->Email->reset();
<ide> $this->assertSame([], $this->Email->getTo());
<del> $this->assertFalse($this->Email->getTheme());
<add> $this->assertSame('', $this->Email->getTheme());
<ide> $this->assertSame(Email::EMAIL_PATTERN, $this->Email->getEmailPattern());
<ide> }
<ide>
<ide> public function testEmailFormat()
<ide> $this->assertEquals('html', $result);
<ide>
<ide> $this->expectException(\InvalidArgumentException::class);
<del> $result = $this->Email->setEmailFormat('invalid');
<add> $this->Email->setEmailFormat('invalid');
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/Mailer/Transport/SmtpTransportTest.php
<ide> public function setSocket(Socket $socket)
<ide> *
<ide> * @return void
<ide> */
<del> protected function _generateSocket()
<add> protected function _generateSocket(): void
<ide> {
<ide> }
<ide>
<ide> /**
<ide> * Magic function to call protected methods
<ide> *
<ide> * @param string $method
<del> * @param string $args
<add> * @param array $args
<ide> * @return mixed
<ide> */
<ide> public function __call($method, $args)
<ide> public function __call($method, $args)
<ide> */
<ide> class SmtpTransportTest extends TestCase
<ide> {
<add> /**
<add> * @var \Cake\Test\TestCase\Mailer\Transport\SmtpTestTransport
<add> */
<add> protected $SmtpTransport;
<add>
<add> /**
<add> * @var \Cake\Network\Socket|\PHPUnit\Framework\MockObject\MockObject
<add> */
<add> protected $socket;
<ide>
<ide> /**
<ide> * Setup
<ide> public function testSendData()
<ide> $email = $this->getMockBuilder('Cake\Mailer\Email')
<ide> ->setMethods(['message'])
<ide> ->getMock();
<add> /** @var \Cake\Mailer\Email $email */
<ide> $email->setFrom('noreply@cakephp.org', 'CakePHP Test');
<ide> $email->setReturnPath('pleasereply@cakephp.org', 'CakePHP Return');
<ide> $email->setTo('cake@cakephp.org', 'CakePHP');
<ide><path>tests/test_app/TestApp/Mailer/TestMailer.php
<ide> public function getEmailForAssertion()
<ide> return $this->_email;
<ide> }
<ide>
<del> public function reset()
<add> protected function reset(): Mailer
<ide> {
<ide> $this->template = $this->viewBuilder()->getTemplate();
<ide> | 12 |
Text | Text | add a missing changelog entry for [ci skip] | ec4b44b1a4052fea1404cf27c8a30f613426e2d8 | <ide><path>activerecord/CHANGELOG.md
<add>* An `ArgumentError` is now raised on a call to `Relation#where.not(nil)`.
<add>
<add> User.where.not(nil)
<add>
<add> # Before
<add> # => 'SELECT `users`.* FROM `users` WHERE (NOT (NULL))'
<add>
<add> # After
<add> # => ArgumentError, 'Invalid argument for .where.not(), got nil.'
<add>
<add> *Kuldeep Aggarwal*
<add>
<ide> * Deprecated use of string argument as a configuration lookup in `ActiveRecord::Base.establish_connection`. Instead, a symbol must be given.
<ide>
<ide> *José Valim* | 1 |
Javascript | Javascript | add test for ease | e3886060b956e5d1ec203bd19b05a1a62c1be4a9 | <ide><path>d3.js
<ide> function d3_ease_sin(t) {
<ide> }
<ide>
<ide> function d3_ease_exp(t) {
<del> return t ? Math.pow(2, 10 * (t - 1)) - 1e-3 : 0;
<add> return Math.pow(2, 10 * (t - 1));
<ide> }
<ide>
<ide> function d3_ease_circle(t) {
<ide><path>d3.min.js
<del>(function(){function ct(){return"circle"}function cs(){return 64}function cr(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cq<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cq=!e.f&&!e.e,d.remove()}cq?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cp(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bB;return[c*Math.cos(d),c*Math.sin(d)]}}function co(a){return[a.x,a.y]}function cn(a){return a.endAngle}function cm(a){return a.startAngle}function cl(a){return a.radius}function ck(a){return a.target}function cj(a){return a.source}function ci(a){return function(b,c){return a[c][1]}}function ch(a){return function(b,c){return a[c][0]}}function cg(a){function i(f){if(f.length<1)return null;var i=bI(this,f,b,d),j=bI(this,f,b===c?ch(i):c,d===e?ci(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bJ,c=bJ,d=0,e=bK,f="linear",g=bL[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bL[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cf(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bB,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function ce(a){return a.length<3?bM(a):a[0]+bS(a,cd(a))}function cd(a){var b=[],c,d,e,f,g=cc(a),h=-1,i=a.length-1;while(++h<i)c=cb(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cc(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cb(e,f);while(++b<c)d[b]=g+(g=cb(e=f,f=a[b+1]));d[b]=g;return d}function cb(a,b){return(b[1]-a[1])/(b[0]-a[0])}function ca(a,b,c){a.push("C",bY(bZ,b),",",bY(bZ,c),",",bY(b$,b),",",bY(b$,c),",",bY(b_,b),",",bY(b_,c))}function bY(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bX(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return bU(a)}function bW(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bY(b_,g),",",bY(b_,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),ca(b,g,h);return b.join("")}function bV(a){if(a.length<4)return bM(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(bY(b_,f)+","+bY(b_,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),ca(b,f,g);return b.join("")}function bU(a){if(a.length<3)return bM(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),ca(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),ca(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),ca(b,h,i);return b.join("")}function bT(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bS(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bM(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bR(a,b,c){return a.length<3?bM(a):a[0]+bS(a,bT(a,b))}function bQ(a,b){return a.length<3?bM(a):a[0]+bS((a.push(a[0]),a),bT([a[a.length-2]].concat(a,[a[1]]),b))}function bP(a,b){return a.length<4?bM(a):a[1]+bS(a.slice(1,a.length-1),bT(a,b))}function bO(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bN(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bM(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bK(a){return a[1]}function bJ(a){return a[0]}function bI(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bH(a){function g(d){return d.length<1?null:"M"+e(a(bI(this,d,b,c)),f)}var b=bJ,c=bK,d="linear",e=bL[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bL[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bG(a){return a.endAngle}function bF(a){return a.startAngle}function bE(a){return a.outerRadius}function bD(a){return a.innerRadius}function bw(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bv(a){return a.toPrecision(1)}function bu(a){return-Math.log(-a)/Math.LN10}function bt(a){return Math.log(a)/Math.LN10}function bs(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function br(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bq(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bo(a,b)[2])/Math.LN10+.01))+"f")}function bp(a,b){return d3.range.apply(d3,bo(a,b))}function bo(a,b){var c=bj(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bn(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bm(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bl(){return Math}function bk(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bj(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bi(){}function bg(){var a=null,b=bb,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bb=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bf(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,a>c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bg()-b;d>24?(isFinite(d)&&(clearTimeout(bd),bd=setTimeout(bf,d)),bc=0):(bc=1,bh(bf))}function be(a,b){var c=Date.now(),d=!1,e,f=bb;if(!!isFinite(b)){while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bb={callback:a,then:c,delay:b,next:bb}),bc||(bd=clearTimeout(bd),bc=1,bh(bf))}}function ba(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function _(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!==2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!==c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)if(o=d[p].apply(this,arguments))q[p]=o}o=m(a);for(p in q)q[p].call(this,o);if(a===1){i[l]=2;if(n.active===c){var r=n.owner;r===c&&(delete this.__transition__,f&&this.parentNode&&this.parentNode.removeChild(this)),$=c,g.end.dispatch.apply(this,arguments),$=0,n.owner=r}}}});return h}var b={},c=$||++Z,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),be(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,ba(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,ba(c),d)},b.text=function(a){d.text=function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a};return b},b.select=function(b){var c,d=_(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=_(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function Y(a){return{__data__:a}}function X(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return V(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function V(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return V(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return V(c)}a.select=function(a){return b(function(b){return S(a,b)})},a.selectAll=function(a){return c(function(b){return T(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return V(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=Y(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=V(e);k.enter=function(){return W(d)},k.exit=function(){return V(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){if(a=this.classList)return a.remove(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;d=g(d.replace(e," ")),c?a.baseVal=d:this.className=d}function f(){if(a=this.classList)return a.add(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;e.lastIndex=0,e.test(d)||(d=g(d+" "+b),c?a.baseVal=d:this.className=d)}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){if(a=this.classList)return a.contains(b);var a=this.className;e.lastIndex=0;return e.test(a.baseVal!=null?a.baseVal:a)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e="");if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function e(){this.textContent=b.apply(this,arguments)}function c(){this.textContent=b}if(arguments.length<1)return d(function(){return this.textContent});return a.each(typeof b=="function"?e:c)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=X.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c,d){arguments.length<3&&(d=!1);var e=b.indexOf("."),f=e===-1?b:b.substring(0,e),g="__on"+b;return a.each(function(a,b){function h(a){var d=d3.event;d3.event=a;try{c.call(this,e.__data__,b)}finally{d3.event=d}}this[g]&&this.removeEventListener(f,this[g],d),c&&this.addEventListener(f,this[g]=h,d);var e=this})},a.transition=function(){return _(a)},a.call=h;return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return a?Math.pow(2,10*(a-1))-.001:0}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.29.3"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,e),c=Array(b);++a<b;)for(var d=-1,f,g=c[a]=Array(f);++d<f;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<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,b-c))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length===1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var S=function(a,b){return b.querySelector(a)},T=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(S=function(a,b){return Sizzle(a,b)
<del>[0]},T=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var U=V([[document]]);U[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?U.select(a):V([[a]])},d3.selectAll=function(b){return typeof b=="string"?U.selectAll(b):V([a(b)])},d3.transition=U.transition;var Z=0,$=0,bb=null,bc,bd;d3.timer=function(a){be(a,0)},d3.timer.flush=function(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bg()};var bh=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function h(a){return e(a)}function g(){var g=a.length==2?br:bs,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var a=[0,1],b=[0,1],c=d3.interpolate,d=!1,e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bp(a,b)},h.tickFormat=function(b){return bq(a,b)},h.nice=function(){bk(a,bn);return g()};return g()},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bt,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bu:bt,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bk(a.domain(),bl));return d},d.ticks=function(){var d=bj(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bu){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bv};return bm(d,a)},bt.pow=function(a){return Math.pow(10,a)},bu.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function e(b){return a(c(b))}var a=d3.scale.linear(),b=1,c=Number,d=c;e.invert=function(b){return d(a.invert(b))},e.domain=function(f){if(!arguments.length)return a.domain().map(d);c=bw(b),d=bw(1/b),a.domain(f.map(c));return e},e.ticks=function(a){return bp(e.domain(),a)},e.tickFormat=function(a){return bq(e.domain(),a)},e.nice=function(){return e.domain(bk(e.domain(),bn))},e.exponent=function(a){if(!arguments.length)return b;var c=e.domain();b=a;return e.domain(c)};return bm(e,a)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function f(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0,e=bi;f.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,g=-1,h=a.length;while(++d<h)c=a[d],c in b||(b[c]=++g);e();return f},f.range=function(a){if(!arguments.length)return c;c=a,e=bi;return f},f.rangePoints=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=(f-e)/(a.length-1+g);c=a.length==1?[(e+f)/2]:d3.range(e+h*g/2,f+h/2,h),d=0})();return f},f.rangeBands=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=(f-e)/(a.length+g);c=d3.range(e+h*g,f,h),d=h*(1-g)})();return f},f.rangeRoundBands=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=f-e,i=Math.floor(h/(a.length+g)),j=h-(a.length-g)*i;c=d3.range(e+Math.round(j/2),f,i),d=Math.round(i*(1-g))})();return f},f.rangeBand=function(){return d};return f},d3.scale.category10=function(){return d3.scale.ordinal().range(bx)},d3.scale.category20=function(){return d3.scale.ordinal().range(by)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bz)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bA)};var bx=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],by=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bz=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bA=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function e(a){if(isNaN(a=+a))return NaN;return b[d3.bisect(c,a)]}function d(){var d=0,e=a.length,f=b.length;c.length=Math.max(0,f-1);while(++d<f)c[d-1]=d3.quantile(a,d/f)}var a=[],b=[],c=[];e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return e},e.range=function(a){if(!arguments.length)return b;b=a,d();return e},e.quantiles=function(){return c};return e},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bB,h=d.apply(this,arguments)+bB,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bC?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bD,b=bE,c=bF,d=bG;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bB;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bB=-Math.PI/2,bC=2*Math.PI-1e-6;d3.svg.line=function(){return bH(Object)};var bL={linear:bM,"step-before":bN,"step-after":bO,basis:bU,"basis-open":bV,"basis-closed":bW,bundle:bX,cardinal:bR,"cardinal-open":bP,"cardinal-closed":bQ,monotone:ce},bZ=[0,2/3,1/3,0],b$=[0,1/3,2/3,0],b_=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bH(cf);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cg(Object)},d3.svg.area.radial=function(){var a=cg(cf);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bB,k=e.call(a,h,g)+bB;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cj,b=ck,c=cl,d=bF,e=bG;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cj,b=ck,c=co;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=co,c=a.projection;a.projection=function(a){return arguments.length?c(cp(b=a)):b};return a},d3.svg.mouse=function(a){return cr(a,d3.event)};var cq=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=cr(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cu[a.call(this,c,d)]||cu.circle)(b.call(this,c,d))}var a=ct,b=cs;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cu={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cw)),c=b*cw;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cv),c=b*cv/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cv),c=b*cv/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cu);var cv=Math.sqrt(3),cw=Math.tan(30*Math.PI/180)})()
<ide>\ No newline at end of file
<add>(function(){function ct(){return"circle"}function cs(){return 64}function cr(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cq<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cq=!e.f&&!e.e,d.remove()}cq?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cp(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bB;return[c*Math.cos(d),c*Math.sin(d)]}}function co(a){return[a.x,a.y]}function cn(a){return a.endAngle}function cm(a){return a.startAngle}function cl(a){return a.radius}function ck(a){return a.target}function cj(a){return a.source}function ci(a){return function(b,c){return a[c][1]}}function ch(a){return function(b,c){return a[c][0]}}function cg(a){function i(f){if(f.length<1)return null;var i=bI(this,f,b,d),j=bI(this,f,b===c?ch(i):c,d===e?ci(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bJ,c=bJ,d=0,e=bK,f="linear",g=bL[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bL[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cf(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bB,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function ce(a){return a.length<3?bM(a):a[0]+bS(a,cd(a))}function cd(a){var b=[],c,d,e,f,g=cc(a),h=-1,i=a.length-1;while(++h<i)c=cb(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cc(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cb(e,f);while(++b<c)d[b]=g+(g=cb(e=f,f=a[b+1]));d[b]=g;return d}function cb(a,b){return(b[1]-a[1])/(b[0]-a[0])}function ca(a,b,c){a.push("C",bY(bZ,b),",",bY(bZ,c),",",bY(b$,b),",",bY(b$,c),",",bY(b_,b),",",bY(b_,c))}function bY(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bX(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return bU(a)}function bW(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bY(b_,g),",",bY(b_,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),ca(b,g,h);return b.join("")}function bV(a){if(a.length<4)return bM(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(bY(b_,f)+","+bY(b_,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),ca(b,f,g);return b.join("")}function bU(a){if(a.length<3)return bM(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),ca(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),ca(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),ca(b,h,i);return b.join("")}function bT(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bS(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bM(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bR(a,b,c){return a.length<3?bM(a):a[0]+bS(a,bT(a,b))}function bQ(a,b){return a.length<3?bM(a):a[0]+bS((a.push(a[0]),a),bT([a[a.length-2]].concat(a,[a[1]]),b))}function bP(a,b){return a.length<4?bM(a):a[1]+bS(a.slice(1,a.length-1),bT(a,b))}function bO(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bN(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bM(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bK(a){return a[1]}function bJ(a){return a[0]}function bI(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bH(a){function g(d){return d.length<1?null:"M"+e(a(bI(this,d,b,c)),f)}var b=bJ,c=bK,d="linear",e=bL[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bL[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bG(a){return a.endAngle}function bF(a){return a.startAngle}function bE(a){return a.outerRadius}function bD(a){return a.innerRadius}function bw(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bv(a){return a.toPrecision(1)}function bu(a){return-Math.log(-a)/Math.LN10}function bt(a){return Math.log(a)/Math.LN10}function bs(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function br(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bq(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bo(a,b)[2])/Math.LN10+.01))+"f")}function bp(a,b){return d3.range.apply(d3,bo(a,b))}function bo(a,b){var c=bj(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bn(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bm(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bl(){return Math}function bk(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bj(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bi(){}function bg(){var a=null,b=bb,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bb=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bf(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,a>c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bg()-b;d>24?(isFinite(d)&&(clearTimeout(bd),bd=setTimeout(bf,d)),bc=0):(bc=1,bh(bf))}function be(a,b){var c=Date.now(),d=!1,e,f=bb;if(!!isFinite(b)){while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bb={callback:a,then:c,delay:b,next:bb}),bc||(bd=clearTimeout(bd),bc=1,bh(bf))}}function ba(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function _(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!==2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!==c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)if(o=d[p].apply(this,arguments))q[p]=o}o=m(a);for(p in q)q[p].call(this,o);if(a===1){i[l]=2;if(n.active===c){var r=n.owner;r===c&&(delete this.__transition__,f&&this.parentNode&&this.parentNode.removeChild(this)),$=c,g.end.dispatch.apply(this,arguments),$=0,n.owner=r}}}});return h}var b={},c=$||++Z,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),be(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,ba(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,ba(c),d)},b.text=function(a){d.text=function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a};return b},b.select=function(b){var c,d=_(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=_(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function Y(a){return{__data__:a}}function X(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return V(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function V(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return V(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return V(c)}a.select=function(a){return b(function(b){return S(a,b)})},a.selectAll=function(a){return c(function(b){return T(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return V(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=Y(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=V(e);k.enter=function(){return W(d)},k.exit=function(){return V(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){if(a=this.classList)return a.remove(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;d=g(d.replace(e," ")),c?a.baseVal=d:this.className=d}function f(){if(a=this.classList)return a.add(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;e.lastIndex=0,e.test(d)||(d=g(d+" "+b),c?a.baseVal=d:this.className=d)}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){if(a=this.classList)return a.contains(b);var a=this.className;e.lastIndex=0;return e.test(a.baseVal!=null?a.baseVal:a)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e="");if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function e(){this.textContent=b.apply(this,arguments)}function c(){this.textContent=b}if(arguments.length<1)return d(function(){return this.textContent});return a.each(typeof b=="function"?e:c)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=X.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c,d){arguments.length<3&&(d=!1);var e=b.indexOf("."),f=e===-1?b:b.substring(0,e),g="__on"+b;return a.each(function(a,b){function h(a){var d=d3.event;d3.event=a;try{c.call(this,e.__data__,b)}finally{d3.event=d}}this[g]&&this.removeEventListener(f,this[g],d),c&&this.addEventListener(f,this[g]=h,d);var e=this})},a.transition=function(){return _(a)},a.call=h;return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return Math.pow(2,10*(a-1))}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.29.3"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,e),c=Array(b);++a<b;)for(var d=-1,f,g=c[a]=Array(f);++d<f;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<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,b-c))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length===1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var S=function(a,b){return b.querySelector(a)},T=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(S=function(a,b){return Sizzle(a,b)[0]},T=function(
<add>a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var U=V([[document]]);U[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?U.select(a):V([[a]])},d3.selectAll=function(b){return typeof b=="string"?U.selectAll(b):V([a(b)])},d3.transition=U.transition;var Z=0,$=0,bb=null,bc,bd;d3.timer=function(a){be(a,0)},d3.timer.flush=function(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bg()};var bh=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function h(a){return e(a)}function g(){var g=a.length==2?br:bs,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var a=[0,1],b=[0,1],c=d3.interpolate,d=!1,e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bp(a,b)},h.tickFormat=function(b){return bq(a,b)},h.nice=function(){bk(a,bn);return g()};return g()},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bt,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bu:bt,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bk(a.domain(),bl));return d},d.ticks=function(){var d=bj(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bu){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bv};return bm(d,a)},bt.pow=function(a){return Math.pow(10,a)},bu.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function e(b){return a(c(b))}var a=d3.scale.linear(),b=1,c=Number,d=c;e.invert=function(b){return d(a.invert(b))},e.domain=function(f){if(!arguments.length)return a.domain().map(d);c=bw(b),d=bw(1/b),a.domain(f.map(c));return e},e.ticks=function(a){return bp(e.domain(),a)},e.tickFormat=function(a){return bq(e.domain(),a)},e.nice=function(){return e.domain(bk(e.domain(),bn))},e.exponent=function(a){if(!arguments.length)return b;var c=e.domain();b=a;return e.domain(c)};return bm(e,a)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function f(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0,e=bi;f.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,g=-1,h=a.length;while(++d<h)c=a[d],c in b||(b[c]=++g);e();return f},f.range=function(a){if(!arguments.length)return c;c=a,e=bi;return f},f.rangePoints=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=(f-e)/(a.length-1+g);c=a.length==1?[(e+f)/2]:d3.range(e+h*g/2,f+h/2,h),d=0})();return f},f.rangeBands=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=(f-e)/(a.length+g);c=d3.range(e+h*g,f,h),d=h*(1-g)})();return f},f.rangeRoundBands=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=f-e,i=Math.floor(h/(a.length+g)),j=h-(a.length-g)*i;c=d3.range(e+Math.round(j/2),f,i),d=Math.round(i*(1-g))})();return f},f.rangeBand=function(){return d};return f},d3.scale.category10=function(){return d3.scale.ordinal().range(bx)},d3.scale.category20=function(){return d3.scale.ordinal().range(by)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bz)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bA)};var bx=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],by=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bz=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bA=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function e(a){if(isNaN(a=+a))return NaN;return b[d3.bisect(c,a)]}function d(){var d=0,e=a.length,f=b.length;c.length=Math.max(0,f-1);while(++d<f)c[d-1]=d3.quantile(a,d/f)}var a=[],b=[],c=[];e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return e},e.range=function(a){if(!arguments.length)return b;b=a,d();return e},e.quantiles=function(){return c};return e},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bB,h=d.apply(this,arguments)+bB,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bC?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bD,b=bE,c=bF,d=bG;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bB;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bB=-Math.PI/2,bC=2*Math.PI-1e-6;d3.svg.line=function(){return bH(Object)};var bL={linear:bM,"step-before":bN,"step-after":bO,basis:bU,"basis-open":bV,"basis-closed":bW,bundle:bX,cardinal:bR,"cardinal-open":bP,"cardinal-closed":bQ,monotone:ce},bZ=[0,2/3,1/3,0],b$=[0,1/3,2/3,0],b_=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bH(cf);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cg(Object)},d3.svg.area.radial=function(){var a=cg(cf);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bB,k=e.call(a,h,g)+bB;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cj,b=ck,c=cl,d=bF,e=bG;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cj,b=ck,c=co;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=co,c=a.projection;a.projection=function(a){return arguments.length?c(cp(b=a)):b};return a},d3.svg.mouse=function(a){return cr(a,d3.event)};var cq=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=cr(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cu[a.call(this,c,d)]||cu.circle)(b.call(this,c,d))}var a=ct,b=cs;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cu={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cw)),c=b*cw;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cv),c=b*cv/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cv),c=b*cv/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cu);var cv=Math.sqrt(3),cw=Math.tan(30*Math.PI/180)})()
<ide>\ No newline at end of file
<ide><path>src/core/ease.js
<ide> function d3_ease_sin(t) {
<ide> }
<ide>
<ide> function d3_ease_exp(t) {
<del> return t ? Math.pow(2, 10 * (t - 1)) - 1e-3 : 0;
<add> return Math.pow(2, 10 * (t - 1));
<ide> }
<ide>
<ide> function d3_ease_circle(t) {
<ide><path>test/core/ease-test.js
<add>require("../env");
<add>require("../../d3");
<add>
<add>var vows = require("vows"),
<add> assert = require("assert");
<add>
<add>var suite = vows.describe("d3.ease");
<add>
<add>suite.addBatch({
<add> "ease": {
<add> topic: function() {
<add> return d3.ease;
<add> },
<add> "supports linear easing": function(ease) {
<add> var e = ease("linear");
<add> assert.inDelta(e(.5), .5, 1e-6);
<add> },
<add> "supports polynomial easing": function(ease) {
<add> var e = ease("poly", 2);
<add> assert.inDelta(e(.5), .25, 1e-6);
<add> },
<add> "supports quadratic easing": function(ease) {
<add> var e = ease("quad");
<add> assert.inDelta(e(.5), .25, 1e-6);
<add> },
<add> "supports cubic easing": function(ease) {
<add> var e = ease("cubic");
<add> assert.inDelta(e(.5), .125, 1e-6);
<add> },
<add> "supports sinusoidal easing": function(ease) {
<add> var e = ease("sin");
<add> assert.inDelta(e(.5), 1 - Math.cos(Math.PI / 4), 1e-6);
<add> },
<add> "supports exponential easing": function(ease) {
<add> var e = ease("exp");
<add> assert.inDelta(e(.5), 0.03125, 1e-6);
<add> },
<add> "supports circular easing": function(ease) {
<add> var e = ease("circle");
<add> assert.inDelta(e(.5), 0.133975, 1e-6);
<add> },
<add> "supports elastic easing": function(ease) {
<add> var e = ease("elastic");
<add> assert.inDelta(e(.5), 0.976061, 1e-6);
<add> },
<add> "supports back easing": function(ease) {
<add> var e = ease("back");
<add> assert.inDelta(e(.5), -0.0876975, 1e-6);
<add> },
<add> "supports bounce easing": function(ease) {
<add> var e = ease("bounce");
<add> assert.inDelta(e(.5), 0.765625, 1e-6);
<add> },
<add> "all easing functions return approximately 0 for t = 0": function(ease) {
<add> assert.inDelta(ease("linear")(0), 0, 1e-9);
<add> assert.inDelta(ease("poly", 2)(0), 0, 1e-9);
<add> assert.inDelta(ease("quad")(0), 0, 1e-9);
<add> assert.inDelta(ease("cubic")(0), 0, 1e-9);
<add> assert.inDelta(ease("sin")(0), 0, 1e-9);
<add> assert.inDelta(ease("exp")(0), 0, 1e-3); // XXX
<add> assert.inDelta(ease("circle")(0), 0, 1e-9);
<add> assert.inDelta(ease("elastic")(0), 0, 1e-9);
<add> assert.inDelta(ease("back")(0), 0, 1e-9);
<add> assert.inDelta(ease("bounce")(0), 0, 1e-9);
<add> },
<add> "all easing functions return approximately 1 for t = 1": function(ease) {
<add> assert.inDelta(ease("linear")(1), 1, 1e-9);
<add> assert.inDelta(ease("poly", 2)(1), 1, 1e-9);
<add> assert.inDelta(ease("quad")(1), 1, 1e-9);
<add> assert.inDelta(ease("cubic")(1), 1, 1e-9);
<add> assert.inDelta(ease("sin")(1), 1, 1e-9);
<add> assert.inDelta(ease("exp")(1), 1, 1e-9);
<add> assert.inDelta(ease("circle")(1), 1, 1e-9);
<add> assert.inDelta(ease("elastic")(1), 1, 1e-3); // XXX
<add> assert.inDelta(ease("back")(1), 1, 1e-9);
<add> assert.inDelta(ease("bounce")(1), 1, 1e-9);
<add> },
<add> "the -in suffix returns the identity": function(ease) {
<add> assert.equal(ease("linear-in"), ease("linear"));
<add> assert.equal(ease("quad-in"), ease("quad"));
<add> },
<add> "the -out suffix returns the reverse": function(ease) {
<add> assert.inDelta(ease("sin-out")(.25), 1 - ease("sin-in")(.75), 1e-6);
<add> assert.inDelta(ease("bounce-out")(.25), 1 - ease("bounce-in")(.75), 1e-6);
<add> assert.inDelta(ease("elastic-out")(.25), 1 - ease("elastic-in")(.75), 1e-6);
<add> },
<add> "the -in-out suffix returns the reflection": function(ease) {
<add> assert.inDelta(ease("sin-in-out")(.25), .5 * ease("sin-in")(.5), 1e-6);
<add> assert.inDelta(ease("bounce-in-out")(.25), .5 * ease("bounce-in")(.5), 1e-6);
<add> assert.inDelta(ease("elastic-in-out")(.25), .5 * ease("elastic-in")(.5), 1e-6);
<add> },
<add> "the -out-in suffix returns the reverse reflection": function(ease) {
<add> assert.inDelta(ease("sin-out-in")(.25), .5 * ease("sin-out")(.5), 1e-6);
<add> assert.inDelta(ease("bounce-out-in")(.25), .5 * ease("bounce-out")(.5), 1e-6);
<add> assert.inDelta(ease("elastic-out-in")(.25), .5 * ease("elastic-out")(.5), 1e-6);
<add> },
<add> "does not clamp input time": function(ease) {
<add> var e = ease("linear");
<add> assert.inDelta(e(-1), -1, 1e-6);
<add> assert.inDelta(e(2), 2, 1e-6);
<add> },
<add> "poly": {
<add> "supports an optional polynomial": function(ease) {
<add> var e = ease("poly", 1);
<add> assert.inDelta(e(.5), .5, 1e-6);
<add> var e = ease("poly", .5);
<add> assert.inDelta(e(.5), Math.SQRT1_2, 1e-6);
<add> }
<add> },
<add> "elastic": {
<add> "supports an optional amplifier (>1)": function(ease) {
<add> var e = ease("elastic", 1.5);
<add> assert.inDelta(e(.5), 0.998519, 1e-6);
<add> },
<add> "supports an optional amplifier (>1) and period (>0)": function(ease) {
<add> var e = ease("elastic", 1.5, .5);
<add> assert.inDelta(e(.5), 0.96875, 1e-6);
<add> }
<add> },
<add> "back": {
<add> "supports an optional speed": function(ease) {
<add> var e = ease("back", 2);
<add> assert.inDelta(e(.5), -0.125, 1e-6);
<add> }
<add> }
<add> }
<add>});
<add>
<add>suite.export(module); | 4 |
Python | Python | use date_extract_sql() for datefields | 1c360dbbf56b76e1df7c945458ae2987306fcfcd | <ide><path>django/db/models/lookups.py
<ide> class Range(Between):
<ide>
<ide>
<ide> class DateLookup(BuiltinLookup):
<del>
<ide> def process_lhs(self, qn, connection, lhs=None):
<add> from django.db.models import DateTimeField
<ide> lhs, params = super(DateLookup, self).process_lhs(qn, connection, lhs)
<del> tzname = timezone.get_current_timezone_name() if settings.USE_TZ else None
<del> sql, tz_params = connection.ops.datetime_extract_sql(self.extract_type, lhs, tzname)
<del> return connection.ops.lookup_cast(self.lookup_name) % sql, tz_params
<add> if isinstance(self.lhs.output_type, DateTimeField):
<add> tzname = timezone.get_current_timezone_name() if settings.USE_TZ else None
<add> sql, tz_params = connection.ops.datetime_extract_sql(self.extract_type, lhs, tzname)
<add> return connection.ops.lookup_cast(self.lookup_name) % sql, tz_params
<add> else:
<add> return connection.ops.date_extract_sql(self.lookup_name, lhs), []
<ide>
<ide> def get_rhs_op(self, connection, rhs):
<ide> return '= %s' % rhs | 1 |
Mixed | Text | update api documentation to add labels in commit | c61fa8471a567b4890e0861f8aaff91a68c42e4f | <ide><path>docs/sources/reference/api/docker_remote_api_v1.19.md
<ide> Create a new image from a container's changes
<ide> "Volumes": {
<ide> "/tmp": {}
<ide> },
<add> "Labels": {
<add> "key1": "value1",
<add> "key2": "value2"
<add> },
<ide> "WorkingDir": "",
<ide> "NetworkDisabled": false,
<ide> "ExposedPorts": {
<ide><path>docs/sources/reference/api/docker_remote_api_v1.20.md
<ide> Create a new image from a container's changes
<ide> "Volumes": {
<ide> "/tmp": {}
<ide> },
<add> "Labels": {
<add> "key1": "value1",
<add> "key2": "value2"
<add> },
<ide> "WorkingDir": "",
<ide> "NetworkDisabled": false,
<ide> "ExposedPorts": {
<ide><path>integration-cli/docker_api_containers_test.go
<ide> func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
<ide> }
<ide> }
<ide>
<add>func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
<add> cName := "testapicommitwithconfig"
<add> out, err := exec.Command(dockerBinary, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test").CombinedOutput()
<add> if err != nil {
<add> c.Fatal(err, out)
<add> }
<add>
<add> config := map[string]interface{}{
<add> "Labels": map[string]string{"key1": "value1", "key2": "value2"},
<add> }
<add>
<add> name := "TestContainerApiCommitWithConfig"
<add> status, b, err := sockRequest("POST", "/commit?repo="+name+"&container="+cName, config)
<add> c.Assert(status, check.Equals, http.StatusCreated)
<add> c.Assert(err, check.IsNil)
<add>
<add> type resp struct {
<add> Id string
<add> }
<add> var img resp
<add> if err := json.Unmarshal(b, &img); err != nil {
<add> c.Fatal(err)
<add> }
<add>
<add> label1, err := inspectFieldMap(img.Id, "Config.Labels", "key1")
<add> if err != nil {
<add> c.Fatal(err)
<add> }
<add> c.Assert(label1, check.Equals, "value1")
<add>
<add> label2, err := inspectFieldMap(img.Id, "Config.Labels", "key2")
<add> if err != nil {
<add> c.Fatal(err)
<add> }
<add> c.Assert(label2, check.Equals, "value2")
<add>
<add> cmd, err := inspectField(img.Id, "Config.Cmd")
<add> if err != nil {
<add> c.Fatal(err)
<add> }
<add> if cmd != "{[/bin/sh -c touch /test]}" {
<add> c.Fatalf("got wrong Cmd from commit: %q", cmd)
<add> }
<add>
<add> // sanity check, make sure the image is what we think it is
<add> out, err = exec.Command(dockerBinary, "run", img.Id, "ls", "/test").CombinedOutput()
<add> if err != nil {
<add> c.Fatalf("error checking committed image: %v - %q", err, string(out))
<add> }
<add>}
<add>
<ide> func (s *DockerSuite) TestContainerApiCreate(c *check.C) {
<ide> config := map[string]interface{}{
<ide> "Image": "busybox", | 3 |
Javascript | Javascript | fix runtime feature flags | 84ff4a84994716a4bf9d6764b0dc0f7d1e3ad025 | <ide><path>broccoli/packages.js
<ide> module.exports.emberLicense = function _emberLicense() {
<ide> module.exports.emberFeaturesES = function _emberFeaturesES(production = false) {
<ide> let FEATURES = production ? RELEASE : DEBUG;
<ide> let content = stripIndent`
<del> const FEATURES = ${JSON.stringify(FEATURES)};
<del> export default FEATURES;
<add> import { ENV } from 'ember-environment';
<add> import { assign } from 'ember-utils';
<add> export const DEFAULT_FEATURES = ${JSON.stringify(FEATURES)};
<add> export const FEATURES = assign(DEFAULT_FEATURES, ENV.FEATURES);
<add>
<ide>
<ide> ${Object.keys(toConst(FEATURES)).map((FEATURE) => {
<ide> return `export const ${FEATURE} = FEATURES["${FEATURE.replace(/_/g, '-').toLowerCase()}"];`
<ide><path>packages/ember-debug/lib/features.js
<del>import { assign } from 'ember-utils';
<ide> import { ENV } from 'ember-environment';
<del>import DEFAULT_FEATURES from 'ember/features';
<add>import * as FLAGS from 'ember/features';
<add>let { FEATURES } = FLAGS;
<ide>
<ide> /**
<ide> The hash of enabled Canary features. Add to this, any canary features
<ide> import DEFAULT_FEATURES from 'ember/features';
<ide> @since 1.1.0
<ide> @public
<ide> */
<del>export const FEATURES = assign(DEFAULT_FEATURES, ENV.FEATURES);
<add>
<add>// Auto-generated
<ide>
<ide> /**
<ide> Determine whether the specified `feature` is enabled. Used by Ember's
<ide> export default function isEnabled(feature) {
<ide> return false;
<ide> }
<ide> }
<del>
<del>export {
<del> DEFAULT_FEATURES
<del>};
<ide><path>packages/ember-debug/lib/index.js
<del>import DEFAULT_FEATURES from 'ember/features';
<ide> import { ENV, environment } from 'ember-environment';
<ide> import Logger from 'ember-console';
<ide> import { isTesting } from './testing';
<ide> import EmberError from './error';
<del>import { default as isFeatureEnabled, FEATURES } from './features';
<add>import { default as isFeatureEnabled } from './features';
<add>import * as FLAGS from 'ember/features';
<add>let { DEFAULT_FEATURES, FEATURES } = FLAGS;
<ide>
<ide> import _deprecate from './deprecate';
<ide> import _warn from './warn';
<ide> export { registerHandler as registerWarnHandler } from './warn';
<ide> export { registerHandler as registerDeprecationHandler } from './deprecate';
<del>export { default as isFeatureEnabled, FEATURES } from './features';
<add>export { default as isFeatureEnabled } from './features';
<ide> export { default as Error } from './error';
<ide> export { isTesting, setTesting } from './testing';
<ide>
<ide><path>packages/ember-template-compiler/lib/index.js
<ide> import _Ember from 'ember-metal';
<del>import { FEATURES } from 'ember-debug';
<add>import * as FLAGS from 'ember/features';
<ide> import { ENV } from 'ember-environment';
<ide> import VERSION from 'ember/version';
<ide>
<ide> // private API used by ember-cli-htmlbars to setup ENV and FEATURES
<ide> if (!_Ember.ENV) { _Ember.ENV = ENV; }
<del>if (!_Ember.FEATURES) { _Ember.FEATURES = FEATURES; }
<add>if (!_Ember.FEATURES) { _Ember.FEATURES = FLAGS.FEATURES; }
<ide> if (!_Ember.VERSION) { _Ember.VERSION = VERSION; }
<ide>
<ide> export { _Ember };
<ide><path>packages/ember/lib/index.js
<ide> import { Registry, Container } from 'container';
<ide>
<ide> // ****ember-metal****
<ide> import Ember, * as metal from 'ember-metal';
<del>import { EMBER_METAL_WEAKMAP } from 'ember/features'
<add>import { EMBER_METAL_WEAKMAP } from 'ember/features';
<add>import * as FLAGS from 'ember/features'
<ide>
<ide> // ember-utils exports
<ide> Ember.getOwner = utils.getOwner;
<ide> Ember.getWithDefault = metal.getWithDefault;
<ide> Ember._getPath = metal._getPath;
<ide> Ember.set = metal.set;
<ide> Ember.trySet = metal.trySet;
<del>Ember.FEATURES = EmberDebug.FEATURES;
<add>Ember.FEATURES = FLAGS.FEATURES;
<ide> Ember.FEATURES.isEnabled = EmberDebug.isFeatureEnabled;
<ide> Ember._Cache = metal.Cache;
<ide> Ember.on = metal.on;
<ide><path>packages/ember/tests/reexports_test.js
<ide> QUnit.module('ember reexports');
<ide> ['onerror', 'ember-metal', { get: 'getOnerror', set: 'setOnerror' }],
<ide> // ['create'], TODO: figure out what to do here
<ide> // ['keys'], TODO: figure out what to do here
<del> ['FEATURES', 'ember-debug'],
<add> ['FEATURES', 'ember/features'],
<ide> ['FEATURES.isEnabled', 'ember-debug', 'isFeatureEnabled'],
<ide> ['Error', 'ember-debug'],
<ide> ['META_DESC', 'ember-metal'], | 6 |
Text | Text | highlight breaking changes in 0.14.0 | 166d68ca1cb8f2604fed4ff60b40a443dc8a12e2 | <ide><path>CHANGELOG.md
<ide>
<ide> ### 0.14.0 (Aug 27, 2016)
<ide>
<del>- Updating TypeScript definitions ([#419](https://github.com/mzabriskie/axios/pull/419))
<add>- **BREAKING** Updating TypeScript definitions ([#419](https://github.com/mzabriskie/axios/pull/419))
<add>- **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/mzabriskie/axios/pull/387))
<add>- **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/mzabriskie/axios/pull/423))
<ide> - Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/mzabriskie/axios/pull/366))
<del>- Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/mzabriskie/axios/pull/387))
<del>- Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/mzabriskie/axios/pull/423))
<ide> - Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/mzabriskie/axios/pull/397))
<ide> - Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/mzabriskie/axios/pull/406))
<ide> | 1 |
Javascript | Javascript | fix verb conjugation in deprecation message | ddfaafa9b0d94daf183390a08e8a4b11d05a65fd | <ide><path>lib/repl.js
<ide> function REPLServer(prompt,
<ide> ObjectDefineProperty(this, 'inputStream', {
<ide> get: pendingDeprecation ?
<ide> deprecate(() => this.input,
<del> 'repl.inputStream and repl.outputStream is deprecated. ' +
<add> 'repl.inputStream and repl.outputStream are deprecated. ' +
<ide> 'Use repl.input and repl.output instead',
<ide> 'DEP0141') :
<ide> () => this.input,
<ide> set: pendingDeprecation ?
<ide> deprecate((val) => this.input = val,
<del> 'repl.inputStream and repl.outputStream is deprecated. ' +
<add> 'repl.inputStream and repl.outputStream are deprecated. ' +
<ide> 'Use repl.input and repl.output instead',
<ide> 'DEP0141') :
<ide> (val) => this.input = val,
<ide> function REPLServer(prompt,
<ide> ObjectDefineProperty(this, 'outputStream', {
<ide> get: pendingDeprecation ?
<ide> deprecate(() => this.output,
<del> 'repl.inputStream and repl.outputStream is deprecated. ' +
<add> 'repl.inputStream and repl.outputStream are deprecated. ' +
<ide> 'Use repl.input and repl.output instead',
<ide> 'DEP0141') :
<ide> () => this.output,
<ide> set: pendingDeprecation ?
<ide> deprecate((val) => this.output = val,
<del> 'repl.inputStream and repl.outputStream is deprecated. ' +
<add> 'repl.inputStream and repl.outputStream are deprecated. ' +
<ide> 'Use repl.input and repl.output instead',
<ide> 'DEP0141') :
<ide> (val) => this.output = val,
<ide><path>test/parallel/test-repl-options.js
<ide> common.expectWarning({
<ide> DeprecationWarning: {
<ide> DEP0142:
<ide> 'repl._builtinLibs is deprecated. Check module.builtinModules instead',
<del> DEP0141: 'repl.inputStream and repl.outputStream is deprecated. ' +
<add> DEP0141: 'repl.inputStream and repl.outputStream are deprecated. ' +
<ide> 'Use repl.input and repl.output instead',
<ide> }
<ide> }); | 2 |
Ruby | Ruby | add error#full_message test; fix typos | 24fee97581824e6c8fde166ef15b3a28038a9ab8 | <ide><path>activemodel/test/cases/errors_test.rb
<ide> def test_has_key?
<ide> test 'full_message should return the given message with the attribute name included' do
<ide> person = Person.new
<ide> assert_equal "name can not be blank", person.errors.full_message(:name, "can not be blank")
<add> assert_equal "name_test can not be blank", person.errors.full_message(:name_test, "can not be blank")
<ide> end
<ide>
<ide> test 'should return a JSON hash representation of the errors' do
<ide><path>activerecord/test/cases/base_test.rb
<ide> def test_dont_clear_sequence_name_when_setting_explicitly
<ide> Joke.reset_sequence_name
<ide> end
<ide>
<del> def test_dont_clear_inheritnce_column_when_setting_explicitly
<add> def test_dont_clear_inheritance_column_when_setting_explicitly
<ide> Joke.inheritance_column = "my_type"
<ide> before_inherit = Joke.inheritance_column
<ide>
<ide><path>activerecord/test/cases/nested_attributes_test.rb
<ide> def test_can_use_symbols_as_object_identifier
<ide> assert_nothing_raised(NoMethodError) { @pirate.save! }
<ide> end
<ide>
<del> def test_numeric_colum_changes_from_zero_to_no_empty_string
<add> def test_numeric_column_changes_from_zero_to_no_empty_string
<ide> Man.accepts_nested_attributes_for(:interests)
<ide>
<ide> repair_validations(Interest) do | 3 |
Ruby | Ruby | add documentation for inflector.inflections | 9546ee299952c86329c4854f9b3776382c0575ff | <ide><path>activesupport/lib/active_support/inflector.rb
<ide> def clear(scope = :all)
<ide>
<ide> extend self
<ide>
<add> # Yields a singleton instance of Inflector::Inflections so you can specify additional
<add> # inflector rules.
<add> #
<add> # Example:
<add> # Inflector.inflections do |inflect|
<add> # inflect.uncountable "rails"
<add> # end
<ide> def inflections
<ide> if block_given?
<ide> yield Inflections.instance | 1 |
Python | Python | change message property | 47b3f5d8337faf2b2e9b5af315709f81f96a4232 | <ide><path>glances/plugins/glances_monitor.py
<ide> def msg_curse(self, args=None):
<ide> msg = "{0:13} ".format(_("RUNNING") if m['count'] >= 1 else _("NOT RUNNING"))
<ide> ret.append(self.curse_add_line(msg))
<ide> msg = "{0}".format(m['result'] if m['count'] >= 1 else "")
<del> ret.append(self.curse_add_line(msg))
<add> ret.append(self.curse_add_line(msg, optional=True, splittable=True))
<ide> ret.append(self.curse_new_line())
<ide>
<ide> # Delete the last empty line | 1 |
Python | Python | add kili tests and also fix a bug in the driver | 08e9162b364249c4505cc66d994315f6ee80d424 | <ide><path>libcloud/compute/drivers/kili.py
<ide> def __init__(self, *args, **kwargs):
<ide> self.region = kwargs.pop('region', None)
<ide> self.get_endpoint_args = kwargs.pop('get_endpoint_args', None)
<ide> super(KiliCloudConnection, self).__init__(*args, **kwargs)
<add> self._auth_version = KiliCloudConnection._auth_version
<ide>
<ide> def get_endpoint(self):
<ide> if not self.get_endpoint_args:
<ide><path>libcloud/test/compute/test_kili.py
<add># Licensed to the Apache Software Foundation (ASF) under one or more
<add># contributor license agreements. See the NOTICE file distributed with
<add># this work for additional information regarding copyright ownership.
<add># The ASF licenses this file to You under the Apache License, Version 2.0
<add># (the "License"); you may not use this file except in compliance with
<add># the License. You may obtain a copy of the License at
<add>#
<add># http://www.apache.org/licenses/LICENSE-2.0
<add>#
<add># Unless required by applicable law or agreed to in writing, software
<add># distributed under the License is distributed on an "AS IS" BASIS,
<add># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add># See the License for the specific language governing permissions and
<add># limitations under the License.
<add>
<add>import unittest
<add>
<add>from libcloud.compute.drivers.kili import KiliCloudNodeDriver, ENDPOINT_ARGS
<add>from libcloud.test.compute.test_openstack import OpenStack_1_1_Tests
<add>
<add>
<add>def _ex_connection_class_kwargs(self):
<add> kwargs = self.openstack_connection_kwargs()
<add> kwargs['get_endpoint_args'] = ENDPOINT_ARGS
<add> kwargs['ex_force_auth_url'] = 'https://api.kili.io/v2.0/tokens'
<add> kwargs['ex_tenant_name'] = self.tenant_name
<add>
<add> return kwargs
<add>
<add>KiliCloudNodeDriver._ex_connection_class_kwargs = _ex_connection_class_kwargs
<add>
<add>
<add>class KiliCloudNodeDriverTests(OpenStack_1_1_Tests, unittest.TestCase):
<add> driver_klass = KiliCloudNodeDriver
<add> driver_type = KiliCloudNodeDriver | 2 |
PHP | PHP | apply fixes from styleci | 9bd19df052be07f33e87242d8c110d0ea5027da4 | <ide><path>src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
<ide> protected function addCastAttributesToArray(array $attributes, array $mutatedAtt
<ide> }
<ide>
<ide> if ($this->isEnumCastable($key)) {
<del> $attributes[$key] = isset($attributes[$key] ) ? $attributes[$key]->value : null;
<add> $attributes[$key] = isset($attributes[$key]) ? $attributes[$key]->value : null;
<ide> }
<ide>
<ide> if ($attributes[$key] instanceof Arrayable) { | 1 |
Ruby | Ruby | keep a cache on the alias object | 621c24323ea3226206ed65a16070b97a24a5bc2f | <ide><path>activerecord/lib/active_record/associations/join_dependency.rb
<ide> def join_constraints
<ide> class Aliases
<ide> def initialize(tables)
<ide> @tables = tables
<add> @alias_cache = tables.each_with_object({}) { |table,h|
<add> h[table.name] = table.columns.each_with_object({}) { |column,i|
<add> i[column.name] = column.alias
<add> }
<add> }
<ide> end
<ide>
<ide> def columns
<del> @tables.flat_map { |t| t.columns }
<add> @tables.flat_map { |t| t.column_aliases }
<add> end
<add>
<add> def column_alias(table, column)
<add> @alias_cache[table][column]
<ide> end
<ide>
<ide> class Table < Struct.new(:name, :alias, :columns)
<ide> def table
<ide> Arel::Nodes::TableAlias.new name, self.alias
<ide> end
<ide>
<del> def columns
<add> def column_aliases
<ide> t = table
<del> super.map { |column| t[column.name].as Arel.sql column.alias }
<add> columns.map { |column| t[column.name].as Arel.sql column.alias }
<ide> end
<ide> end
<ide> Column = Struct.new(:name, :alias)
<ide> def aliases
<ide> }
<ide> end
<ide>
<del> def instantiate(result_set)
<del> primary_key = join_root.aliased_primary_key
<add> def instantiate(result_set, aliases)
<add> primary_key = aliases.column_alias(join_root.table, join_root.primary_key)
<ide> type_caster = result_set.column_type primary_key
<ide>
<ide> seen = Hash.new { |h,parent_klass|
<ide> def instantiate(result_set)
<ide> result_set.each { |row_hash|
<ide> primary_id = type_caster.type_cast row_hash[primary_key]
<ide> parent = parents[primary_id] ||= join_root.instantiate(row_hash)
<del> construct(parent, join_root, row_hash, result_set, seen, model_cache)
<add> construct(parent, join_root, row_hash, result_set, seen, model_cache, aliases)
<ide> }
<ide>
<ide> parents.values
<ide> def build_join_association(reflection, parent, join_type)
<ide> node
<ide> end
<ide>
<del> def construct(ar_parent, parent, row, rs, seen, model_cache)
<add> def construct(ar_parent, parent, row, rs, seen, model_cache, aliases)
<ide> primary_id = ar_parent.id
<ide>
<ide> parent.children.each do |node|
<ide> def construct(ar_parent, parent, row, rs, seen, model_cache)
<ide> else
<ide> if ar_parent.association_cache.key?(node.reflection.name)
<ide> model = ar_parent.association(node.reflection.name).target
<del> construct(model, node, row, rs, seen, model_cache)
<add> construct(model, node, row, rs, seen, model_cache, aliases)
<ide> next
<ide> end
<ide> end
<ide>
<del> id = row[node.aliased_primary_key]
<add> key = aliases.column_alias(node.table, node.primary_key)
<add> id = row[key]
<ide> next if id.nil?
<ide>
<ide> model = seen[parent.base_klass][primary_id][node.base_klass][id]
<ide>
<ide> if model
<del> construct(model, node, row, rs, seen, model_cache)
<add> construct(model, node, row, rs, seen, model_cache, aliases)
<ide> else
<ide> model = construct_model(ar_parent, node, row, model_cache, id)
<ide> seen[parent.base_klass][primary_id][node.base_klass][id] = model
<del> construct(model, node, row, rs, seen, model_cache)
<add> construct(model, node, row, rs, seen, model_cache, aliases)
<ide> end
<ide> end
<ide> end
<ide><path>activerecord/lib/active_record/associations/join_dependency/join_part.rb
<ide> def aliased_table_name
<ide> raise NotImplementedError
<ide> end
<ide>
<del> # The alias for the primary key of the active_record's table
<del> def aliased_primary_key
<del> "#{aliased_prefix}_r0"
<del> end
<del>
<ide> # An array of [column_name, alias] pairs for the table
<ide> def column_names_with_alias
<ide> unless @column_names_with_alias
<ide><path>activerecord/lib/active_record/relation/finder_methods.rb
<ide> def find_with_associations
<ide> []
<ide> else
<ide> rows = connection.select_all(relation.arel, 'SQL', relation.bind_values.dup)
<del> join_dependency.instantiate(rows)
<add> join_dependency.instantiate(rows, aliases)
<ide> end
<ide> end
<ide> end | 3 |
Text | Text | update index.md sentence structure and grammar | c5234cff482c14d0f24bbc39edae0b46a8865202 | <ide><path>guide/english/html/index.md
<ide> To create a link the `<a>` tag is used. The href attribute holds the URL address
<ide>
<ide> **Inputs**
<ide>
<del>There are many possible ways a user can give input/s like:
<add>There are many possible ways a user can give input/s, such as:
<ide>
<ide> ```html
<ide> <input type="text" /> <!-- This is for text input --> | 1 |
Ruby | Ruby | skip this on oracle | a8dae084c9c1250d7d4a5a70800114b57fbceff6 | <ide><path>activerecord/test/cases/calculations_test.rb
<ide> def test_should_limit_calculation_with_offset
<ide> end
<ide>
<ide> def test_limit_with_offset_is_kept
<add> return if current_adapter?(:OracleAdapter)
<add>
<ide> queries = assert_sql { Account.limit(1).offset(1).count }
<ide> assert_equal 1, queries.length
<ide> assert_match(/LIMIT/, queries.first) | 1 |
Java | Java | cancel webasyncmanager thread on request timeout | 8b7a670821793a1bd15cea0fb388deaf88cd2d0e | <ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/CallableInterceptorChain.java
<ide>
<ide> import java.util.List;
<ide> import java.util.concurrent.Callable;
<add>import java.util.concurrent.Future;
<ide>
<ide> import org.apache.commons.logging.Log;
<ide> import org.apache.commons.logging.LogFactory;
<ide> class CallableInterceptorChain {
<ide>
<ide> private int preProcessIndex = -1;
<ide>
<add> private volatile Future<?> taskFuture;
<add>
<ide>
<ide> public CallableInterceptorChain(List<CallableProcessingInterceptor> interceptors) {
<ide> this.interceptors = interceptors;
<ide> }
<ide>
<add>
<add> public void setTaskFuture(Future<?> taskFuture) {
<add> this.taskFuture = taskFuture;
<add> }
<add>
<add>
<ide> public void applyBeforeConcurrentHandling(NativeWebRequest request, Callable<?> task) throws Exception {
<ide> for (CallableProcessingInterceptor interceptor : this.interceptors) {
<ide> interceptor.beforeConcurrentHandling(request, task);
<ide> public Object applyPostProcess(NativeWebRequest request, Callable<?> task, Objec
<ide> }
<ide>
<ide> public Object triggerAfterTimeout(NativeWebRequest request, Callable<?> task) {
<add> cancelTask();
<ide> for (CallableProcessingInterceptor interceptor : this.interceptors) {
<ide> try {
<ide> Object result = interceptor.handleTimeout(request, task);
<ide> else if (result != CallableProcessingInterceptor.RESULT_NONE) {
<ide> return CallableProcessingInterceptor.RESULT_NONE;
<ide> }
<ide>
<add> private void cancelTask() {
<add> Future<?> future = this.taskFuture;
<add> if (future != null) {
<add> try {
<add> future.cancel(true);
<add> }
<add> catch (Throwable ex) {
<add> // Ignore
<add> }
<add> }
<add> }
<add>
<ide> public Object triggerAfterError(NativeWebRequest request, Callable<?> task, Throwable throwable) {
<add> cancelTask();
<ide> for (CallableProcessingInterceptor interceptor : this.interceptors) {
<ide> try {
<ide> Object result = interceptor.handleError(request, task, throwable);
<ide><path>spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java
<ide> import java.util.List;
<ide> import java.util.Map;
<ide> import java.util.concurrent.Callable;
<add>import java.util.concurrent.Future;
<ide> import java.util.concurrent.RejectedExecutionException;
<ide> import javax.servlet.http.HttpServletRequest;
<ide>
<ide> public void startCallableProcessing(final WebAsyncTask<?> webAsyncTask, Object..
<ide> interceptorChain.applyBeforeConcurrentHandling(this.asyncWebRequest, callable);
<ide> startAsyncProcessing(processingContext);
<ide> try {
<del> this.taskExecutor.submit(() -> {
<add> Future<?> future = this.taskExecutor.submit(() -> {
<ide> Object result = null;
<ide> try {
<ide> interceptorChain.applyPreProcess(this.asyncWebRequest, callable);
<ide> public void startCallableProcessing(final WebAsyncTask<?> webAsyncTask, Object..
<ide> }
<ide> setConcurrentResultAndDispatch(result);
<ide> });
<add> interceptorChain.setTaskFuture(future);
<ide> }
<ide> catch (RejectedExecutionException ex) {
<ide> Object result = interceptorChain.applyPostProcess(this.asyncWebRequest, callable, ex);
<ide><path>spring-web/src/test/java/org/springframework/web/context/request/async/WebAsyncManagerTimeoutTests.java
<ide> package org.springframework.web.context.request.async;
<ide>
<ide> import java.util.concurrent.Callable;
<add>import java.util.concurrent.Future;
<ide> import javax.servlet.AsyncEvent;
<ide>
<ide> import org.junit.Before;
<ide>
<ide> import static org.junit.Assert.assertEquals;
<ide> import static org.junit.Assert.assertTrue;
<add>import static org.mockito.ArgumentMatchers.any;
<ide> import static org.mockito.BDDMockito.given;
<ide> import static org.mockito.BDDMockito.mock;
<ide> import static org.mockito.BDDMockito.verify;
<add>import static org.mockito.Mockito.verifyNoMoreInteractions;
<add>import static org.mockito.Mockito.when;
<ide> import static org.springframework.web.context.request.async.CallableProcessingInterceptor.RESULT_NONE;
<ide>
<ide> /**
<ide> public void startCallableProcessingAfterTimeoutException() throws Exception {
<ide> verify(interceptor).beforeConcurrentHandling(this.asyncWebRequest, callable);
<ide> }
<ide>
<add> @SuppressWarnings("unchecked")
<add> @Test
<add> public void startCallableProcessingTimeoutAndCheckThreadInterrupted() throws Exception {
<add>
<add> StubCallable callable = new StubCallable();
<add> Future future = mock(Future.class);
<add>
<add> AsyncTaskExecutor executor = mock(AsyncTaskExecutor.class);
<add> when(executor.submit(any(Runnable.class))).thenReturn(future);
<add>
<add> this.asyncManager.setTaskExecutor(executor);
<add> this.asyncManager.startCallableProcessing(callable);
<add>
<add> this.asyncWebRequest.onTimeout(ASYNC_EVENT);
<add>
<add> assertTrue(this.asyncManager.hasConcurrentResult());
<add>
<add> verify(future).cancel(true);
<add> verifyNoMoreInteractions(future);
<add> }
<add>
<ide> @Test
<ide> public void startDeferredResultProcessingTimeoutAndComplete() throws Exception {
<ide> | 3 |
Text | Text | update translation flood-fill | 45658e77fb5437d94af6b6ebe4d918d0e70e2b0c | <ide><path>guide/portuguese/algorithms/flood-fill/index.md
<ide> localeTitle: Algoritmo de preenchimento de inundações
<ide>
<ide> O preenchimento de inundação é um algoritmo usado principalmente para determinar uma área limitada conectada a um determinado nó em uma matriz multidimensional. Isto é uma grande semelhança com a ferramenta balde em programas de pintura.
<ide>
<del>A implementação mais aproximada do algoritmo é uma função recursiva baseada em pilha, e é sobre isso que vamos falar Próximo.
<add>A implementação mais aproximada do algoritmo é uma função recursiva baseada em pilha, e é sobre isso que vamos falar a seguir.
<ide>
<ide> ### Como funciona?
<ide>
<ide> int wall = -1;
<ide> void flood_fill(int pos_x, int pos_y, int target_color, int color)
<ide> {
<ide>
<del> if(a[pos_x][pos_y] == wall || a[pos_x][pos_y] == color) // if there is no wall or if i haven't been there
<del> return; // already go back
<add> if(a[pos_x][pos_y] == wall || a[pos_x][pos_y] == color) // se não houver parede ou se eu não estiver lá
<add> return; // já volto
<ide>
<del> if(a[pos_x][pos_y] != target_color) // if it's not color go back
<add> if(a[pos_x][pos_y] != target_color) // se não é cor, voltar
<ide> return;
<ide>
<del> a[pos_x][pos_y] = color; // mark the point so that I know if I passed through it.
<add> a[pos_x][pos_y] = color; // marque o ponto para que eu saiba se passei por ele.
<ide>
<del> flood_fill(pos_x + 1, pos_y, color); // then i can either go south
<del> flood_fill(pos_x - 1, pos_y, color); // or north
<del> flood_fill(pos_x, pos_y + 1, color); // or east
<del> flood_fill(pos_x, pos_y - 1, color); // or west
<add> flood_fill(pos_x + 1, pos_y, color); // então eu posso ir para o sul
<add> flood_fill(pos_x - 1, pos_y, color); // ou norte
<add> flood_fill(pos_x, pos_y + 1, color); // ou leste
<add> flood_fill(pos_x, pos_y - 1, color); // ou oeste
<ide>
<ide> return;
<ide>
<ide> Indo para o sul, chegaremos ao ponto (5,4) e a função será executada novament
<ide>
<ide> ### Problema de exercício
<ide>
<del>Eu sempre considerei que resolver um (ou mais) problema / s usando um novo algoritmo aprendido é a melhor maneira de entender completamente o conceito.
<add>Eu sempre considerei que resolver um (ou mais) problema(s) usando um novo algoritmo aprendido é a melhor maneira de entender completamente o conceito.
<ide>
<ide> Então aqui está um:
<ide>
<ide> Você tem a seguinte entrada:
<ide> 2 2 2 2
<ide> ```
<ide>
<del>Para o qual você terá ilha não. 2 como a maior ilha com a área de 5 praças.
<add>Para o qual você terá: ilha 2 como a maior ilha e área de 5 quadrados.
<ide>
<ide> ### Dicas
<ide>
<ide> O problema é bem fácil, mas aqui estão algumas dicas:
<ide> ```
<del>1. Use the flood-fill algorithm whenever you encounter a new island.
<del> 2. As opposed to the sample code, you should go through the area of the island and not on the ocean (0 tiles).
<add>1. Use o algoritmo de preenchimento sempre que encontrar uma nova ilha.
<add>2. Ao contrário do código de exemplo, você deve percorrer a área da ilha e não o oceano (0 peças).
<ide>
<del>```
<ide>\ No newline at end of file
<add>``` | 1 |
Javascript | Javascript | add more settings to test-benchmark-dgram | 098b5b6ee3a2b28e24f3f5adc89615db172d7369 | <ide><path>test/parallel/test-benchmark-dgram.js
<ide> require('../common');
<ide>
<ide> const runBenchmark = require('../common/benchmark');
<ide>
<del>runBenchmark('dgram', ['dur=0.1', 'chunks=2']);
<add>runBenchmark('dgram', ['address=true',
<add> 'chunks=2',
<add> 'dur=0.1',
<add> 'len=1',
<add> 'n=1',
<add> 'num=1',
<add> 'type=send']); | 1 |
Javascript | Javascript | remove unneeded unit test | 46140fbf72674be5e8d5facb24e3d77eea0969d2 | <ide><path>test/Stats.unittest.js
<ide> const packageJson = require("../package.json");
<ide> describe(
<ide> "Stats",
<ide> () => {
<del> describe("formatFilePath", () => {
<del> it("emit the file path and request", () => {
<del> const mockStats = new Stats({
<del> children: [],
<del> errors: ["firstError"],
<del> hash: "1234",
<del> compiler: {
<del> context: ""
<del> }
<del> });
<del> const inputPath =
<del> "./node_modules/ts-loader!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/app.vue";
<del> const expectPath = `./src/app.vue (${inputPath})`;
<del>
<del> expect(mockStats.formatFilePath(inputPath)).toBe(expectPath);
<del> });
<del> });
<del>
<ide> describe("Error Handling", () => {
<ide> describe("does have", () => {
<ide> it("hasErrors", () => { | 1 |
Javascript | Javascript | use global or this instead of window | 265430d2d65cb962896aebf77cd9ba994e4c8f04 | <ide><path>locale/af.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('af', {
<ide><path>locale/ar-ma.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('ar-ma', {
<ide><path>locale/ar-sa.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var symbolMap = {
<ide><path>locale/ar.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var symbolMap = {
<ide><path>locale/az.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var suffixes = {
<ide><path>locale/be.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function plural(word, num) {
<ide><path>locale/bg.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('bg', {
<ide><path>locale/bn.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var symbolMap = {
<ide><path>locale/bo.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var symbolMap = {
<ide><path>locale/br.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function relativeTimeWithMutation(number, withoutSuffix, key) {
<ide><path>locale/bs.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function translate(number, withoutSuffix, key) {
<ide><path>locale/ca.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('ca', {
<ide><path>locale/cs.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'),
<ide><path>locale/cv.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('cv', {
<ide><path>locale/cy.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('cy', {
<ide><path>locale/da.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('da', {
<ide><path>locale/de-at.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function processRelativeTime(number, withoutSuffix, key, isFuture) {
<ide><path>locale/de.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function processRelativeTime(number, withoutSuffix, key, isFuture) {
<ide><path>locale/el.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('el', {
<ide><path>locale/en-au.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('en-au', {
<ide><path>locale/en-ca.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('en-ca', {
<ide><path>locale/en-gb.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('en-gb', {
<ide><path>locale/eo.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('eo', {
<ide><path>locale/es.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'),
<ide><path>locale/et.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function processRelativeTime(number, withoutSuffix, key, isFuture) {
<ide><path>locale/eu.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('eu', {
<ide><path>locale/fa.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var symbolMap = {
<ide><path>locale/fi.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '),
<ide><path>locale/fo.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('fo', {
<ide><path>locale/fr-ca.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('fr-ca', {
<ide><path>locale/fr.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('fr', {
<ide><path>locale/gl.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('gl', {
<ide><path>locale/he.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('he', {
<ide><path>locale/hi.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var symbolMap = {
<ide><path>locale/hr.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function translate(number, withoutSuffix, key) {
<ide><path>locale/hu.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' ');
<ide><path>locale/hy-am.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function monthsCaseReplace(m, format) {
<ide><path>locale/id.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('id', {
<ide><path>locale/is.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function plural(n) {
<ide><path>locale/it.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('it', {
<ide><path>locale/ja.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('ja', {
<ide><path>locale/ka.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function monthsCaseReplace(m, format) {
<ide><path>locale/km.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('km', {
<ide><path>locale/ko.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('ko', {
<ide><path>locale/lb.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function processRelativeTime(number, withoutSuffix, key, isFuture) {
<ide><path>locale/lt.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var units = {
<ide><path>locale/lv.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var units = {
<ide><path>locale/mk.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('mk', {
<ide><path>locale/ml.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('ml', {
<ide><path>locale/mr.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var symbolMap = {
<ide><path>locale/ms-my.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('ms-my', {
<ide><path>locale/my.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var symbolMap = {
<ide><path>locale/nb.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('nb', {
<ide><path>locale/ne.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var symbolMap = {
<ide><path>locale/nl.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
<ide><path>locale/nn.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('nn', {
<ide><path>locale/pl.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'),
<ide><path>locale/pt-br.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('pt-br', {
<ide><path>locale/pt.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('pt', {
<ide><path>locale/ro.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function relativeTimeWithPlural(number, withoutSuffix, key) {
<ide><path>locale/ru.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function plural(word, num) {
<ide><path>locale/sk.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
<ide><path>locale/sl.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function translate(number, withoutSuffix, key) {
<ide><path>locale/sq.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('sq', {
<ide><path>locale/sr-cyrl.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var translator = {
<ide><path>locale/sr.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var translator = {
<ide><path>locale/sv.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('sv', {
<ide><path>locale/ta.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> /*var symbolMap = {
<ide><path>locale/th.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('th', {
<ide><path>locale/tl-ph.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('tl-ph', {
<ide><path>locale/tr.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> var suffixes = {
<ide><path>locale/tzm-latn.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('tzm-latn', {
<ide><path>locale/tzm.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('tzm', {
<ide><path>locale/uk.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> function plural(word, num) {
<ide><path>locale/uz.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('uz', {
<ide><path>locale/vi.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('vi', {
<ide><path>locale/zh-cn.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('zh-cn', {
<ide><path>locale/zh-tw.js
<ide> } else if (typeof exports === 'object') {
<ide> module.exports = factory(require('../moment')); // Node
<ide> } else {
<del> factory(window.moment); // Browser global
<add> factory((typeof global !== undefined ? global : this).moment); // Browser global
<ide> }
<ide> }(function (moment) {
<ide> return moment.defineLocale('zh-tw', { | 78 |
Ruby | Ruby | fix docs for singleton resources | c49cd7f18afb7fdc116290416d744c152018bb6d | <ide><path>actionpack/lib/action_controller/resources.rb
<ide> def resources(*entities, &block)
<ide> # controllers and views. <tt>map.resource :account</tt> produces the following named routes and helpers:
<ide> #
<ide> # Named Route Helpers
<del> # account account_url(id), hash_for_account_url(id),
<del> # account_path(id), hash_for_account_path(id)
<del> # edit_account edit_account_url(id), hash_for_edit_account_url(id),
<del> # edit_account_path(id), hash_for_edit_account_path(id)
<add> # account account_url, hash_for_account_url,
<add> # account_path, hash_for_account_path
<add> # edit_account edit_account_url, hash_for_edit_account_url,
<add> # edit_account_path, hash_for_edit_account_path
<ide> def resource(*entities, &block)
<ide> options = entities.last.is_a?(Hash) ? entities.pop : { }
<ide> entities.each { |entity| map_singleton_resource entity, options.dup, &block } | 1 |
Text | Text | add changelog for 0.70 | 9c05f42d7fb085ff85c964c46b86fbac8bdbbec6 | <ide><path>CHANGELOG.md
<ide> # Changelog
<ide>
<add>## 0.70.0
<add>
<add>### Breaking
<add>
<add>- Remove jest/preprocessor from the react-native package ([0301cb285b](https://github.com/facebook/react-native/commit/0301cb285b2e85b48a397fe58d565196654d9754) by [@motiz88](https://github.com/motiz88))
<add>- Remove nonstandard Promise.prototype.done ([018d5cf985](https://github.com/facebook/react-native/commit/018d5cf985497273dd700b56168cf1cf64f498d5) by [@motiz88](https://github.com/motiz88))
<add>
<add>### Added
<add>
<add>- Support TypeScript array types for turbo module (module only) ([f0c4c291e1](https://github.com/facebook/react-native/commit/f0c4c291e12a8e76f91d3841d65291f0f1f16714) by [@ZihanChen-MSFT](https://github.com/ZihanChen-MSFT))
<add>- Added files for `avn`, `nodenv`, and other managers that set the node.js version in reactive native project including testing ([933fbb1b2b](https://github.com/facebook/react-native/commit/933fbb1b2b4d2b7c802bf1f2be4c47e5b442a850) by [@ramonmedel](https://github.com/ramonmedel))
<add>- Support BigInt in Hermes ([11bae63bb1](https://github.com/facebook/react-native/commit/11bae63bb1f833802ec6ce01342ebdd1d61e9252) by [@jpporto](https://github.com/jpporto))
<add>- The old Hermes instrumented stats migrated to the new one ([c37f719567](https://github.com/facebook/react-native/commit/c37f7195675df67d23c3c008ec5ab5fd7b8d0394) by [@jpporto](https://github.com/jpporto))
<add>- Modified **getDefaultJSExecutorFactory** method ([87cfd386cb](https://github.com/facebook/react-native/commit/87cfd386cb2e02bfa440c94706d9d0274f83070c) by [@KunalFarmah98](https://github.com/KunalFarmah98))
<add>- `EventEmitter#emit` now freezes the set of listeners before iterating over them, meaning listeners that are added or removed will not affect that iteration. ([e5c5dcd9e2](https://github.com/facebook/react-native/commit/e5c5dcd9e26e9443f59864d9763b049e0bda98e7) by [@yungsters](https://github.com/yungsters))
<add>- Added File and Blob globals to eslint community config ([d881c87231](https://github.com/facebook/react-native/commit/d881c872314e55e17b198a41c86528d79092d222) by [@shamilovtim](https://github.com/shamilovtim))
<add>- C++ TurboModule methods can now use mixed types ([3c569f546c](https://github.com/facebook/react-native/commit/3c569f546ca78b23fbcb9773a1273dd9710f8c60) by [@appden](https://github.com/appden))
<add>- Add useNativeDriver as a param for setValue for Animated ([73191edb72](https://github.com/facebook/react-native/commit/73191edb7255b1ba5e9a0955a25c14250186a676) by [@genkikondo](https://github.com/genkikondo))
<add>- Add `Animated.Numeric` Flow type ([9eb7629ac6](https://github.com/facebook/react-native/commit/9eb7629ac66abc23b91b81d420891d68bbd4f578) by [@motiz88](https://github.com/motiz88))
<add>- Add LTI annotations to function params ([c940eb0c49](https://github.com/facebook/react-native/commit/c940eb0c49518b82a3999dcac3027aa70018c763), [e7a4dbcefc](https://github.com/facebook/react-native/commit/e7a4dbcefc9e393c41f4a796d522211bc1e60b6f), [d96744e277](https://github.com/facebook/react-native/commit/d96744e27711c4fa4dfad1b5a796283a232e60af) by [@pieterv](https://github.com/pieterv))
<add>
<add>#### Android specific
<add>
<add>- Accessibility announcement for list and grid in FlatList ([2d5882132f](https://github.com/facebook/react-native/commit/2d5882132fb2c533fe9bbba83576b8fac4aca727), [105a2397b6](https://github.com/facebook/react-native/commit/105a2397b6b187a9669ba1c028508a7bb9664009) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987))
<add>- Add READ_VOICEMAIL and WRITE_VOICEMAIL permissions to PermisionsAndroid library. ([8a2be3e143](https://github.com/facebook/react-native/commit/8a2be3e1438dd145ccb5374d6ef60811047d23aa) by [@zolbooo](https://github.com/zolbooo))
<add>- Add POST_NOTIFICATIONS, NEARBY_WIFI_DEVICES permission ([0a854c7c8b](https://github.com/facebook/react-native/commit/0a854c7c8b7ffc382c43fa460651a4b4de34c3c7) by [@vincent-paing](https://github.com/vincent-paing))
<add>- Extend the React Native Gradle plugin to accept a config from package.json ([5f3c5aa529](https://github.com/facebook/react-native/commit/5f3c5aa529ed75414eb339c3d8fd2c9628534621) by [@cortinico](https://github.com/cortinico))
<add>- Ability to pass a Typeface object to ReactFontManager in addition to a font resource ID ([e2dd2e2a6e](https://github.com/facebook/react-native/commit/e2dd2e2a6ed17b366a3e2ec0942ea1d82a404c5d) by [@thurn](https://github.com/thurn))
<add>- Option to enable lazyViewManager support with `ViewManagerOnDemandReactPackage` ([d4b59cd9d0](https://github.com/facebook/react-native/commit/d4b59cd9d02a8c4eda3ac4bf89cfe8161847adf0) by [@javache](https://github.com/javache))
<add>- Support for dataUri in form data ([c663c0ec9d](https://github.com/facebook/react-native/commit/c663c0ec9deee7281f819f222bb29ad79e99f3b8) by [@hetanthakkar1](https://github.com/hetanthakkar1))
<add>- Add android-only prop documentation at the TextInput js level. ([f2e23215ca](https://github.com/facebook/react-native/commit/f2e23215ca14c3c630aa931cdd114187589ac0fb))
<add>- Update template to gitignore `android/app/.cxx` ([542d43df9d](https://github.com/facebook/react-native/commit/542d43df9d84a88f742c273391f2596546b4c804) by [@leotm](https://github.com/leotm))
<add>
<add>#### iOS specific
<add>
<add>- Add Mac Catalyst compatibility (can be enabled in Podfile) ([2fb6a3393d](https://github.com/facebook/react-native/commit/2fb6a3393d545a93518d1b2906bd9453458660a0) by [@Arkkeeper](https://github.com/Arkkeeper))
<add>- Enabled Hermes Intl ([3fa3aeba93](https://github.com/facebook/react-native/commit/3fa3aeba93f226b97e324f3643b98382947e5985) by [@neildhar](https://github.com/neildhar))
<add>- HTTP Response headers added to the error object passed to JS code. ([9eb2826f9b](https://github.com/facebook/react-native/commit/9eb2826f9beac5b7476f33e68803ca5a024867db))
<add>- Add userInterfaceStyle to Alert to override user interface style for iOS 13+ ([47bd78f64f](https://github.com/facebook/react-native/commit/47bd78f64f334b770edc7fabd4b9cceb07a7a503) by [@luoxuhai](https://github.com/luoxuhai))
<add>- Add function to cleanup codegen folders ([71692889b0](https://github.com/facebook/react-native/commit/71692889b0d89b033c07ef87ee3dbf6d62d79235) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Cocoapods function to add the `CLANG_CXX_LANGUAGE_STANDARD` to all the targets if needed ([ca8174e15f](https://github.com/facebook/react-native/commit/ca8174e15f77cbeecb7ff7a5a583abb668817777) by [@f-meloni](https://github.com/f-meloni))
<add>- Support codegen from a single folder ([05aaba9514](https://github.com/facebook/react-native/commit/05aaba95145df0b7f541e391a9f64ba3402cac35) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Run script phases tests in CI ([c171a6e157](https://github.com/facebook/react-native/commit/c171a6e1572f64b2ab9b26d431c07581d4ae832b) by [@cipolleschi](https://github.com/cipolleschi))
<add>
<add>### Changed
<add>
<add>- Bump React Native Codegen to 0.70.0 ([a22ceecc84](https://github.com/facebook/react-native/commit/a22ceecc849fc62c926643f4d121cf1e4575c693) by [@dmytrorykun](https://github.com/dmytrorykun), [2a274c1a08](https://github.com/facebook/react-native/commit/2a274c1a082c3291d2df1a4b960bf654e217a4dd) by [@cortinico](https://github.com/cortinico), [ce4246a05c](https://github.com/facebook/react-native/commit/ce4246a05c96cd6fe805499960b105267ac044bb) by [@dmytrorykun](https://github.com/dmytrorykun))
<add>- Upgrade RN CLI to v9.0.0, Metro to 0.72.1 ([0c2fe96998](https://github.com/facebook/react-native/commit/0c2fe969984fff0676f99fe034b3e49d38ed7db6) by [@thymikee](https://github.com/thymikee), [7e580b97bf](https://github.com/facebook/react-native/commit/7e580b97bf63436978d053926e04adeb9ae6f75f) by [@kelset](https://github.com/kelset), [c504d038c4](https://github.com/facebook/react-native/commit/c504d038c470f7a13fb345f57261172c7c85248c) by [@thymikee](https://github.com/thymikee), [f1d624823f](https://github.com/facebook/react-native/commit/f1d624823fe23eb3d30de00cf78beb71dc1b8413) by [@kelset](https://github.com/kelset), [2b49ac6f8b](https://github.com/facebook/react-native/commit/2b49ac6f8b04953be4cd5bf0b1325986b117763c) by [@thymikee](https://github.com/thymikee))
<add>- Doc: fix minimum iOS version in requirements section ([ec3c8f4380](https://github.com/facebook/react-native/commit/ec3c8f43800a027a0a717367360421089e7293fd) by [@Simon-TechForm](https://github.com/Simon-TechForm))
<add>- Remove "Early" in Js error reporting pipeline ([0646551d76](https://github.com/facebook/react-native/commit/0646551d7690cd54847eb468f8e43d71ebebdda9) by [@sshic](https://github.com/sshic))
<add>- Update @react-native/eslint-plugin-specs to 0.70.0 ([d07fae9b23](https://github.com/facebook/react-native/commit/d07fae9b23c258a60045b666167efd5259b962ce), [afd76f69c7](https://github.com/facebook/react-native/commit/afd76f69c7d2408654ba67ac2ed4d612abfbe0ce) by [@dmytrorykun](https://github.com/dmytrorykun), [ea8d8e2f49](https://github.com/facebook/react-native/commit/ea8d8e2f49ea3ce15faeab500b661a1cacacf8a8) by [@cortinico](https://github.com/cortinico))
<add>- Do not depend on hermes-engine NPM package anymore ([78cd689f9a](https://github.com/facebook/react-native/commit/78cd689f9a634b152ea09ed6cb4fa858ee26e653) by [@cortinico](https://github.com/cortinico))
<add>- Add ability to pass `ItemSeparatorComponent` as React Element ([5854b11bf9](https://github.com/facebook/react-native/commit/5854b11bf9d42bab9dbe62b9152a3d3a94e42c13) by [@retyui](https://github.com/retyui))
<add>- Hermes version bump. ([0b4b7774e2](https://github.com/facebook/react-native/commit/0b4b7774e2d71259962ed36b7acb5c3989c3be9c) by [@dmytrorykun](https://github.com/dmytrorykun), [8c682ddd59](https://github.com/facebook/react-native/commit/8c682ddd599b75a547975104cb6f90eec8753daf) by [@dmytrorykun](https://github.com/dmytrorykun), [eb6767813a](https://github.com/facebook/react-native/commit/eb6767813a0efe04a9e79955b8f6ee909a4a76bf) by [@cortinico](https://github.com/cortinico))
<add>- Codemod `{...null}` to `{}` in xplat/js ([f392ba6725](https://github.com/facebook/react-native/commit/f392ba67254e95126974fafabf3e4ef0300e24e8) by [@gkz](https://github.com/gkz))
<add>- Fix TextInput dropping text when used as uncontrolled component with `defaultValue` ([51f49ca998](https://github.com/facebook/react-native/commit/51f49ca9982f24de08f5a5654a5210e547bb5b86))
<add>- Suppress errors ahead of launch ([67e12a19cb](https://github.com/facebook/react-native/commit/67e12a19cb236fbe0809fbbc9e516b37a5848a6a) by [@gkz](https://github.com/gkz))
<add>- Suppress missing 'this' annotations ([6c563a507f](https://github.com/facebook/react-native/commit/6c563a507fd8c41e04a1e62e2ba87993c6eb1e2f) by [@pieterv](https://github.com/pieterv))
<add>- Suppress missing annotations ([66c6a75650](https://github.com/facebook/react-native/commit/66c6a75650f91d61e7e87a8e661d87101e26cf9c) by [@pieterv](https://github.com/pieterv))
<add>- Use RuntimeConfig instead of VM Experiment Flag to set up the micro task queue. ([753038cf34](https://github.com/facebook/react-native/commit/753038cf345a45d95ab9b9343447f524e1b36840) by [@fbmal7](https://github.com/fbmal7))
<add>- Update direct Metro dependencies to 0.72.0 ([05dcebc211](https://github.com/facebook/react-native/commit/05dcebc21175a78c6533a8856aed644c45276169) by [@kelset](https://github.com/kelset), [64788cc9fe](https://github.com/facebook/react-native/commit/64788cc9fe42fbedc3e3b1c9c516a079cfa71cd1) by [@huntie](https://github.com/huntie), [bdeb4e0655](https://github.com/facebook/react-native/commit/bdeb4e065532dfb1bb4c9c1e87e8a869a737e48a) by [@jacdebug](https://github.com/jacdebug), [894f652639](https://github.com/facebook/react-native/commit/894f6526399098d825ef32c02eb201cd8ba41873) by [@robhogan](https://github.com/robhogan), [08ebc1cfd8](https://github.com/facebook/react-native/commit/08ebc1cfd88a629389c43abf23b40a2bdf1b1579) by [@arushikesarwani94](https://github.com/arushikesarwani94))
<add>- ECOSYSTEM.md: update Partner entries ([5471afeebf](https://github.com/facebook/react-native/commit/5471afeebf59853ce31df1ade6a4591414b6aa2f) by [@Simek](https://github.com/Simek))
<add>- Move ScrollView's contentOffset to common props ([7c581f3d30](https://github.com/facebook/react-native/commit/7c581f3d3007954413d68daf2e868ce93e120615) by [@genkikondo](https://github.com/genkikondo))
<add>- Upgrade react-native-gradle-plugin to 0.70.2 ([1518f838b7](https://github.com/facebook/react-native/commit/1518f838b70951882f7b414c90407d3eb584cab4), [2176173dcc](https://github.com/facebook/react-native/commit/2176173dcc029ab21bfcdfe5c9e150581db47409) by [@dmytrorykun](https://github.com/dmytrorykun))
<add>- Update a few metro deps as follow up from the commit from main ([7c7ba1babd](https://github.com/facebook/react-native/commit/7c7ba1babd41b6b60f0dc9f48c34d00235d2fef5) by [@kelset](https://github.com/kelset))
<add>
<add>#### Android specific
<add>
<add>- Bump Android Gradle Plugin to 7.2.1 ([53c8fc9488](https://github.com/facebook/react-native/commit/53c8fc94882893dd8c337fd29543ae11fd467267) by [@leotm](https://github.com/leotm), [c274456e5b](https://github.com/facebook/react-native/commit/c274456e5b635825560852baa5787e96640800d8) by [@dulmandakh](https://github.com/dulmandakh))
<add>- Rename NativeModuleCallExceptionHandler to JSExceptionHandler for broader usage ([b6f7689d70](https://github.com/facebook/react-native/commit/b6f7689d701d0409c23ab364356aeb95710c20fa) by [@sshic](https://github.com/sshic))
<add>- Simplify the Android.mk file in the App Template ([7fb0bb40d2](https://github.com/facebook/react-native/commit/7fb0bb40d2206c734a1feb6b555c22d6d5f2436e) by [@cortinico](https://github.com/cortinico))
<add>- Make Hermes the default engine on Android ([a7db8df207](https://github.com/facebook/react-native/commit/a7db8df2076f68ae9451ce1c77d7eb09d8cfeb14) by [@cortinico](https://github.com/cortinico))
<add>- Revamp touch event dispatching methods ([089ff4555a](https://github.com/facebook/react-native/commit/089ff4555af27eec4561b1627298702b4ecee482) by [@sshic](https://github.com/sshic))
<add>- Demonstrating Dark Mode correctly in the `StatusBar` for the starter template App. ([763dc52387](https://github.com/facebook/react-native/commit/763dc5238721a21847b6d6670b5fa268e3bf2ed4) by [@mrbrentkelly](https://github.com/mrbrentkelly))
<add>- Bump Gradle to 7.5.0 ([5c8186623a](https://github.com/facebook/react-native/commit/5c8186623ae15388949cfc4143edae86863a447b) by [@leotm](https://github.com/leotm), [99e7373dd2](https://github.com/facebook/react-native/commit/99e7373dd2f20184153377109e0e8e48b5bf46f7) by [@dulmandakh](https://github.com/dulmandakh))
<add>- Generalized the return type of ViewManagerOnDemandReactPackage.getViewManagerNames ([51e029ec3c](https://github.com/facebook/react-native/commit/51e029ec3ce42ae8df3d367d8f553ec2148eeafc) by [@javache](https://github.com/javache))
<add>- Don't assert on current activity when call startActivityForResult ([bf6884dc90](https://github.com/facebook/react-native/commit/bf6884dc903154ae32daa50ce7983a9f014be781) by [@sshic](https://github.com/sshic))
<add>- Adapt template to new architecture autolinking on Android ([9ad7cbc3eb](https://github.com/facebook/react-native/commit/9ad7cbc3eb365190e0bfe290e1025553a807b298) by [@thymikee](https://github.com/thymikee))
<add>- Replaced reactnativeutilsjni with reactnativejni in the build process to reduce size ([54a4fcbfdc](https://github.com/facebook/react-native/commit/54a4fcbfdcc8111b3010b2c31ed3c1d48632ce4c) by [@SparshaSaha](https://github.com/SparshaSaha))
<add>- Bump Soloader to 0.10.4 ([b9adf2db20](https://github.com/facebook/react-native/commit/b9adf2db20bf9e1436fa58182d886fd9461df9af) by [@mikehardy](https://github.com/mikehardy))
<add>- Update the new app template to use CMake instead of Android.mk ([dfd7f70eff](https://github.com/facebook/react-native/commit/dfd7f70effeacfeb06d9c2d4762a279a079ee004) by [@cortinico](https://github.com/cortinico))
<add>- Refactored usage of kotlin plugin ([be35c6dafb](https://github.com/facebook/react-native/commit/be35c6dafbdb46d2ec165460d4bb12f34de6e878) by [@hurali97](https://github.com/hurali97))
<add>- Bump Gradle to 7.5.1 ([7a911e0730](https://github.com/facebook/react-native/commit/7a911e073094b533cb5a7ce76932c02f83f4fe5d) by [@AlexanderEggers](https://github.com/AlexanderEggers))
<add>- Fix error of release builds with Hermes enabled for Windows users ([7fcdb9d9d8](https://github.com/facebook/react-native/commit/7fcdb9d9d8f964d24a5ec3d423c67f49b7650ed8) by [@JoseLion](https://github.com/JoseLion))
<add>
<add>#### iOS specific
<add>
<add>- Move and test Hermes setup from react_native_pods script into a dedicated file ([468b86bd37](https://github.com/facebook/react-native/commit/468b86bd3710b1d43a492c94fb314cc472f03b86) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Use the correct operator to decide whether Hermes is enabled or not. ([61488449b9](https://github.com/facebook/react-native/commit/61488449b996da5881e4711e0813e9c90b6e57a1) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Hermes is now the default engine on iOS. This setting is controlled via `flags[:hermes_enabled]` in the Podfile. ([1115bc77db](https://github.com/facebook/react-native/commit/1115bc77db1090042effc021837f70b28694fa09) by [@hramos](https://github.com/hramos))
<add>- Move LocalPodspecPatch to dedicated file ([8fe2b591c7](https://github.com/facebook/react-native/commit/8fe2b591c7e073d629e95cd7b67aa1dfa96ece38) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Move the `modify_flags_for_new_architecture` method to separate ruby file ([71da21243c](https://github.com/facebook/react-native/commit/71da21243c85283445c6cefa64d1ace13823ab69) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Refactoring part of the react_native_pods.rb script ([4f732ba9ee](https://github.com/facebook/react-native/commit/4f732ba9ee2a1e162729c97d5c12ea771b3a424a), [7a2704455f](https://github.com/facebook/react-native/commit/7a2704455f3edf203d2ecc8135fabf2667f718d8) by [@cipolleschi](https://github.com/cipolleschi))
<add>- When Hermes is enabled, it will use the same copy of JSI as React Native ([340612a200](https://github.com/facebook/react-native/commit/340612a200505ca829bae1f9bce800d3673dac04) by [@hramos](https://github.com/hramos))
<add>- Move `use_flipper` logic inside `use_react_native` and simplify the Flipper dependencies logic ([0bd5239553](https://github.com/facebook/react-native/commit/0bd523955385a3b1e622077b7ee4ea0df3c5c158) by [@f-meloni](https://github.com/f-meloni))
<add>- Export `flipper.rb` script file ([e07a7eb16b](https://github.com/facebook/react-native/commit/e07a7eb16b97e1222e23f935a3d4bb3dac848ef2) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Use `outputDir` as base directory for the codegen and remove the possibility to customize the intermediate path. The generated code requires specific paths in the `#include` directive. ([e4d0153a67](https://github.com/facebook/react-native/commit/e4d0153a675fbdd8718f433b2e9f8bfdccec4b2f) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Refactor part of the codegen scripts and add tests. ([0465c3fd10](https://github.com/facebook/react-native/commit/0465c3fd102525b005826f3c68923d7e9851d6b8), [305a054865](https://github.com/facebook/react-native/commit/305a0548652a405d9f638fb2c054781951dfc996) by [@cipolleschi](https://github.com/cipolleschi))
<add>- CodeGen now supports the `"all"` library type. ([6718500eaa](https://github.com/facebook/react-native/commit/6718500eaaeb92b8a74320dcee961ac96f6f12fa) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Fix the test_ios_unit test ([fdbe4719e2](https://github.com/facebook/react-native/commit/fdbe4719e2e2b599e86d42c49d42c4da97ef431a) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Update Podfile to allow `PRODUCTION=1 pod install` ([77752fc403](https://github.com/facebook/react-native/commit/77752fc4037e66d5b0a5851bae79c4d3285ed334) by [@leotm](https://github.com/leotm))
<add>- Destruct use_reactnative parameters and ad ddocumentation ([79a37e5a88](https://github.com/facebook/react-native/commit/79a37e5a88e179090ade7145a453a46719c87b3f) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Move codegen in separate files ([7d069b2583](https://github.com/facebook/react-native/commit/7d069b25835ad20654a46ebb1e09631d826598e0) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Silence warning due to react-native internal details. ([a4599225f5](https://github.com/facebook/react-native/commit/a4599225f5a6a2d6801dd80b7728c1bbe5b2ec3a) by [@cipolleschi](https://github.com/cipolleschi))
<add>
<add>### Removed
<add>
<add>- Remove previously deprecated Transform style-attribute props ([7cfd77debd](https://github.com/facebook/react-native/commit/7cfd77debd36f867f5ddfdb9cc44fbe6137aaeba) by [@Zachinquarantine](https://github.com/Zachinquarantine))
<add>- Remove deprecated `isTVOS` constant. ([6075d64acf](https://github.com/facebook/react-native/commit/6075d64acf6f8d74e18ef6568c9438f73fe56d44) by [@Zachinquarantine](https://github.com/Zachinquarantine))
<add>- The diffs renames the required variable which was causing conflicts in names with Apple core SDK's ([086c13dd5f](https://github.com/facebook/react-native/commit/086c13dd5fba3f77acbc70c9bdedc9299118b526) by [@arinjay](https://github.com/arinjay))
<add>- Removed `EventEmitter.prototype.removeSubscription` method. ([870755fa7e](https://github.com/facebook/react-native/commit/870755fa7e7011ac46d269d5fb66d2a1d1543442) by [@yungsters](https://github.com/yungsters))
<add>- Remove deprecated removeListener methods ([2596b2f695](https://github.com/facebook/react-native/commit/2596b2f6954362d2cd34a1be870810ab90cbb916) by [@matinzd](https://github.com/matinzd))
<add>- Remove APPLETVOS variants from BUCk targets. ([cf2e27c388](https://github.com/facebook/react-native/commit/cf2e27c3888ded6f851ba267597ef13f1d0cfd8c) by [@d16r](https://github.com/d16r))
<add>
<add>#### iOS specific
<add>
<add>- Remove `emulateUnlessSupported` ([c73e021a4b](https://github.com/facebook/react-native/commit/c73e021a4b11bbae3a7868670d140fe3d5dac6ae) by [@ken0nek](https://github.com/ken0nek))
<add>- Remove USE_CODEGEN_DISCOVERY flag ([2e720c3610](https://github.com/facebook/react-native/commit/2e720c361001d996ed35d8bfbf4dc67c31fb895d) by [@cipolleschi](https://github.com/cipolleschi))
<add>
<add>### Fixed
<add>
<add>- Throw JSINativeException from asHostObject ([ef6ab3f5ca](https://github.com/facebook/react-native/commit/ef6ab3f5cad968d7b2c9127d834429b0f4e1b2cf) by [@neildhar](https://github.com/neildhar))
<add>- Use new Babel parser instead of deprecated one ([97291bfa31](https://github.com/facebook/react-native/commit/97291bfa3157ac171a2754e19a52d006040961fb) by [@Kerumen](https://github.com/Kerumen))
<add>- Fixed a crash on deserialization of props when using 'px'/'em' units. ([70788313fe](https://github.com/facebook/react-native/commit/70788313fedd40fe2e6d1cf15980ce3cca5adaac) by [@nlutsenko](https://github.com/nlutsenko))
<add>- Fix nullability lost on readonly types in TurboModule specs ([c006722e6c](https://github.com/facebook/react-native/commit/c006722e6cdbe02711cb50ea7a739e0d4d81c7e7) by [@appden](https://github.com/appden))
<add>- Make tests pass for windows ([9596bf045d](https://github.com/facebook/react-native/commit/9596bf045d527e27608ac4b7b2990a4e6846fdeb) by [@cipolleschi](https://github.com/cipolleschi))
<add>- Handle possible null exception on ReactEditText with AppCompat 1.4.0 ([24a1f5c66c](https://github.com/facebook/react-native/commit/24a1f5c66c8633f9b41eef45df3297ffc1d2b606) by [@mikemasam](https://github.com/mikemasam))
<add>- Fixed the disappearance of items when scrolling after zooming VirtualizedList. ([13a72e0ccc](https://github.com/facebook/react-native/commit/13a72e0ccceb2db6aeacd03b4f429d200392c17b) by [@islandryu](https://github.com/islandryu))
<add>- Improved Flow type inference in Animated `.interpolate()` ([7b86fa2b79](https://github.com/facebook/react-native/commit/7b86fa2b795647f5c89e04e4c3ee4b83bc27ef77) by [@motiz88](https://github.com/motiz88))
<add>- Add Jest mock for Vibration module ([79529a1c77](https://github.com/facebook/react-native/commit/79529a1c77e7e1b174fdbe8103a2199c9ac924ff) by [@hduprat](https://github.com/hduprat))
<add>- Allow ReactInstrumentationTest to use custom JSIModules ([eb2a83b0be](https://github.com/facebook/react-native/commit/eb2a83b0be4658654fc6ca6f4671e45f1898798d) by [@christophpurrer](https://github.com/christophpurrer))
<add>- Working around Long paths limitation on Windows ([883a93871c](https://github.com/facebook/react-native/commit/883a93871cb1fbca4434600a322f63afbba333da) by [@mganandraj](https://github.com/mganandraj))
<add>- Fix eslint-plugin-specs prepack npm lifecycle hook now that we use npm 8 ([8441c4a6f7](https://github.com/facebook/react-native/commit/8441c4a6f7bfeda73f89f076fe7d8d1132e4b9be) by [@kelset](https://github.com/kelset))
<add>- Codegen should ignore `.d.ts` files ([0f0d52067c](https://github.com/facebook/react-native/commit/0f0d52067cb89fdb39a99021f0745282ce087fc2) by [@tido64](https://github.com/tido64))
<add>- Avoid full copy of large folly::dynamic objects in JSIExecutor#defaultTimeoutInvoker ([521011d4cc](https://github.com/facebook/react-native/commit/521011d4cc713dfce97dc8872fd0f5171e587b5d) by [@christophpurrer](https://github.com/christophpurrer))
<add>
<add>#### Android specific
<add>
<add>- Fixed HorizontalScrollView API scrollToEnd causing NPE in side-effects. ([e5ba6ab7b4](https://github.com/facebook/react-native/commit/e5ba6ab7b482c380e35765b898e522e9d4e1d3b0) by [@ryancat](https://github.com/ryancat))
<add>- Fix InputAccessoryView crash on Android ([afa5df1764](https://github.com/facebook/react-native/commit/afa5df1764324f2574d102abeae7199d4b02d183) by [@hduprat](https://github.com/hduprat))
<add>- Bring back non-rootview touch handling based on reactTag ([8b837268b4](https://github.com/facebook/react-native/commit/8b837268b49fd4e72a05f955c20702c457a68fab) by [@fkgozali](https://github.com/fkgozali))
<add>- Make Text not focusable by default ([8ced165e53](https://github.com/facebook/react-native/commit/8ced165e53135d9d33cfdc55a9d4660f8eb5b3c5) by [@kacieb](https://github.com/kacieb))
<add>- Revert [PR 33924](https://github.com/facebook/react-native/pull/33924) because of issues with TextInputs with numeric keyboard types not respecting the secureTextEntry prop ([edb27e3aa1](https://github.com/facebook/react-native/commit/edb27e3aa1210ef33d55c1840065457c31b19cb0) by [@charlesbdudley](https://github.com/charlesbdudley))
<add>- Fix edge case when we enqueue a pending event to views on stopped surface ([ea7c9f2ad9](https://github.com/facebook/react-native/commit/ea7c9f2ad9a78b16234306932edc1d78b783ac27) by [@ryancat](https://github.com/ryancat))
<add>- Fix a bug where the keyboard, once set as email, won't change back to default. ([ec307e0167](https://github.com/facebook/react-native/commit/ec307e0167deca7f17640cd3c5a60f6be5f47b62) by [@larkox](https://github.com/larkox))
<add>- NPE in `ReactEditText.setInputType` when React Native is used with some versions of a AppCompat 1.4.x. (and possibly others) ([92ebb298e2](https://github.com/facebook/react-native/commit/92ebb298e2e5ad640754e09ce3a37d3de1d28f58))
<add>- Fix NPE on `ReactEditText` due to null mFabricViewStateManager ([ba6bf5a3ce](https://github.com/facebook/react-native/commit/ba6bf5a3ce7039a7e407a6632ee41aa3d504f833) by [@cortinico](https://github.com/cortinico))
<add>- Scroll views would still receive scroll events when nested in a view with `pointer-events: "none"` ([fced96bf52](https://github.com/facebook/react-native/commit/fced96bf5202e8b89b804ccc1004abacc9f91660) by [@javache](https://github.com/javache))
<add>- Fixed an edge case that event dispatching is failed after pre-allocation of a view and before the view is mounted. ([a093fe5f2f](https://github.com/facebook/react-native/commit/a093fe5f2fae4e9996b0cbffdfccdce8e58e8cf1) by [@ryancat](https://github.com/ryancat))
<add>- Avoid crash by handling missing views in dispatchViewManagerCommand ([ee1a191cb1](https://github.com/facebook/react-native/commit/ee1a191cb1c10085722d57fc276734f83e86a4f3) by [@hsource](https://github.com/hsource))
<add>- Pass react build dir to cmake ([6ab7a99518](https://github.com/facebook/react-native/commit/6ab7a99518f8ba0d53e62e35d230ebec78e50217) by [@janicduplessis](https://github.com/janicduplessis))
<add>- Fix missing space in ReactPropertyException message ([24560b6718](https://github.com/facebook/react-native/commit/24560b67184da00e05491af38289865c4b934ee8) by [@markv](https://github.com/markv))
<add>- Fix import path breakage ([2e1e62f2bf](https://github.com/facebook/react-native/commit/2e1e62f2bf043ea0bf9926e1f5786ca54a22005e) by [@aniketmathur](https://github.com/aniketmathur))
<add>- When `onEndReachedThreshold` is set to 0 `onEndReached` function on `VirtualizedList` properly fires once the user scrolls to the bottom of the list. ([b869680c11](https://github.com/facebook/react-native/commit/b869680c1196a6549154a4b9cb7ffa10eab1989c))
<add>- Fix rendering of transparent borders in RN Android ([a9659ce86d](https://github.com/facebook/react-native/commit/a9659ce86d94dd34768b067763740a5c41917e42) by [@mdvacca](https://github.com/mdvacca))
<add>- Exception with `Cannot load WebView` message will initialising WebView (along with existing checks) ([9e0d8696cc](https://github.com/facebook/react-native/commit/9e0d8696cc68436a0d309cafde252c55fc337be4) by [@rachitmishra](https://github.com/rachitmishra))
<add>- Fix accessibilityState overwriting view's disabled state on Android ([f35d18caa3](https://github.com/facebook/react-native/commit/f35d18caa302351319840ec85337182f4f148e5e) by [@okwasniewski](https://github.com/okwasniewski))
<add>- Make sure *.ts files are considered for task avoidance in the Gradle Plugin ([1a9fb6cb68](https://github.com/facebook/react-native/commit/1a9fb6cb682aa5ff83462e1e2869eb99f3b873fd) by [@cortinico](https://github.com/cortinico))
<add>- Fix missing import on New Architecture build script in template ([a22f30d2ce](https://github.com/facebook/react-native/commit/a22f30d2ce866cb1488b26bb18eee0620a0ac259) by [@cortinico](https://github.com/cortinico))
<add>
<add>#### iOS specific
<add>
<add>- Use `NODE_BINARY` from `.xcode.env` when running packager from Xcode ([ff785dbcf5](https://github.com/facebook/react-native/commit/ff785dbcf5c464a4d850fa738e977702efd8abd3) by [@elsurudo](https://github.com/elsurudo))
<add>- Bug with error message formatting when bundle is missing ([f501979f3d](https://github.com/facebook/react-native/commit/f501979f3d1e5c053eed16967a3d3385eab8e15f) by [@BenLorantfy](https://github.com/BenLorantfy))
<add>- Fix the race condition when calling readAsDataURL after new Blob(blobs) ([bd12e41188](https://github.com/facebook/react-native/commit/bd12e41188c8d85c0acbd713f10f0bd34ea0edca) by [@wood1986](https://github.com/wood1986))
<add>- Fix the way the orientation events are published, to avoid false publish on orientation change when app changes state to inactive ([7d42106d4c](https://github.com/facebook/react-native/commit/7d42106d4ce20c644bda4d928fb0abc163580cee) by [@lbaldy](https://github.com/lbaldy))
<add>- Fix sed error when installing `glog` ([4a7e4b9ca6](https://github.com/facebook/react-native/commit/4a7e4b9ca6ef4fb52611b6c3cb788f624d1f81a4) by [@alphashuro](https://github.com/alphashuro))
<add>- Don't validate ENTRY_FILE in react-native-xcode.sh ([780fe80fca](https://github.com/facebook/react-native/commit/780fe80fcaf213d84d9d087132af933bd02d1349) by [@janicduplessis](https://github.com/janicduplessis))
<add>- `_scrollViewComponentView` is set to `RCTPullToRefreshViewComponentView's` superview ([4e4b9e2111](https://github.com/facebook/react-native/commit/4e4b9e2111faaf5652ae1f5b885730b378f3de98) by [@dmytrorykun](https://github.com/dmytrorykun))
<add>- Use `GCC_PREPROCESSOR_DEFINITIONS` to set `FB_SONARKIT_ENABLED` ([77e6bff629](https://github.com/facebook/react-native/commit/77e6bff629312f20cdacb1e798cd2464ac50db9e) by [@janicduplessis](https://github.com/janicduplessis))
<add>- Fix Hermes not being properly downloaded during pod install ([d5e0659fcc](https://github.com/facebook/react-native/commit/d5e0659fccf2767beb7aae55461e9690ba335c81) by [@cortinico](https://github.com/cortinico))
<add>- Typo in the documation for the `automaticallyAdjustKeyboardInsets` prop ([927b43d47c](https://github.com/facebook/react-native/commit/927b43d47c2cd42538265cb06154b12cb0be6816) by [@jeremybarbet](https://github.com/jeremybarbet))
<add>- Deprecate iOS/tvOS SDK 11.0 support now that 12.4+ is required ([f56d701e56](https://github.com/facebook/react-native/commit/f56d701e567af0c252a2e297bf81cd4add59378a) by [@leotm](https://github.com/leotm))
<add>- Fix blank spaces that don't recover as you scroll when in an RTL locale and e.nativeEvent.zoomScale is -1. ([bc7b5c3011](https://github.com/facebook/react-native/commit/bc7b5c3011460935614a47a03cd077cd1059de72), [2f491bfa9f](https://github.com/facebook/react-native/commit/2f491bfa9f86c3db2e459e331f39bc3cf12e7239))
<add>- Fixed paddingTop not being applied when using padding and paddingVertical in multiline textinput ([2fb107c9a6](https://github.com/facebook/react-native/commit/2fb107c9a63aacd2c880ad6abedaad67ffb6022b) by [@hetanthakkar1](https://github.com/hetanthakkar1))
<add>- Fixed the ability to pass the port to use for Metro when running `react-native run-ios --port <port>`. ([7dc0b5153e](https://github.com/facebook/react-native/commit/7dc0b5153e4eb91c333238a58fe8c75a47cb5f81) by [@lindboe](https://github.com/lindboe))
<add>- Fix missing imports ([c78babac39](https://github.com/facebook/react-native/commit/c78babac39b7c64e03e137d8fddd91e783303426))
<add>- Fix React-bridging headers import not found ([c4b51e8d76](https://github.com/facebook/react-native/commit/c4b51e8d7679c3c20b843072581acd23a931fc83) by [@Kudo](https://github.com/Kudo))
<add>- Fix Hermes executor not available when `use_frameworks` is enabled ([88b7b640a7](https://github.com/facebook/react-native/commit/88b7b640a74bafd918b8b1cd5d58e1f5ddfb730a) by [@Kudo](https://github.com/Kudo))
<add>
<add>### Security
<add>
<add>- Add GitHub token permissions for workflows ([3da3d82320](https://github.com/facebook/react-native/commit/3da3d82320bd035c6bd361a82ea12a70dba4e851) by [@varunsh-coder](https://github.com/varunsh-coder))
<add>- Bump RCT-Folly to 2021-07-22 ([68f3a42fc7](https://github.com/facebook/react-native/commit/68f3a42fc7380051714253f43b42175de361f8bd) by [@luissantana](https://github.com/luissantana))
<add>
<ide> ## v0.69.5
<ide>
<ide> ### Changed
<ide>
<del>- Bump react-native-codegen to 0.69.2 ([df3d52bfbf](https://github.com/facebook/react-native/commit/df3d52bfbf4254cd16e1dc0ca0af2743cd7e11c1) by [@dmitryrykun](https://github.com/dmitryrykun))
<add>- Bump react-native-codegen to 0.69.2 ([df3d52bfbf](https://github.com/facebook/react-native/commit/df3d52bfbf4254cd16e1dc0ca0af2743cd7e11c1) by [@dmytrorykun](https://github.com/dmytrorykun))
<ide>
<ide> #### Android specific
<ide> | 1 |
Text | Text | specify shape of post elements | 7e38ce1dd048d66e4686082d8d2070ea8b38f020 | <ide><path>docs/advanced/ExampleRedditAPI.md
<ide> export default class Posts extends Component {
<ide> }
<ide>
<ide> Posts.propTypes = {
<del> posts: PropTypes.array.isRequired
<add> posts: PropTypes.arrayOf(PropTypes.shape({
<add> title: PropTypes.string.isRequired
<add> }).isRequired).isRequired
<ide> }
<ide> ``` | 1 |
Ruby | Ruby | fix rubocop offense | 1933fbaecf5efa982c4214fed51d88d120ffe236 | <ide><path>activesupport/lib/active_support/subscriber.rb
<ide> def start(name, id, payload)
<ide> end
<ide>
<ide> def finish(name, id, payload)
<del> event = event_stack.pop
<add> event = event_stack.pop
<ide> event.finish!
<ide> event.payload.merge!(payload)
<ide> | 1 |
PHP | PHP | return $this instead of void | aded1d39c0d2d1ea8e22ce8b236169d41db488ca | <ide><path>src/View/Form/ContextFactory.php
<ide> public static function createWithDefaults(array $providers = [])
<ide> * can be used to overwrite existing providers.
<ide> * @param callable $check A callable that returns an object
<ide> * when the form context is the correct type.
<del> * @return void
<add> * @return $this
<ide> */
<ide> public function addProvider($type, callable $check)
<ide> {
<ide> $this->providers = [$type => ['type' => $type, 'callable' => $check]]
<ide> + $this->providers;
<add>
<add> return $this;
<ide> }
<ide>
<ide> /** | 1 |
Python | Python | add equality support for project/modelstate | 05656f2388b1989c9e99e1ff2aae8b2e1c805af2 | <ide><path>django/db/migrations/state.py
<ide> def from_app_cache(cls, app_cache):
<ide> models[(model_state.app_label, model_state.name.lower())] = model_state
<ide> return cls(models)
<ide>
<add> def __eq__(self, other):
<add> if set(self.models.keys()) != set(other.models.keys()):
<add> return False
<add> return all(model == other.models[key] for key, model in self.models.items())
<add>
<add> def __ne__(self, other):
<add> return not (self == other)
<add>
<ide>
<ide> class ModelState(object):
<ide> """
<ide> def get_field_by_name(self, name):
<ide> if fname == name:
<ide> return field
<ide> raise ValueError("No field called %s on model %s" % (name, self.name))
<add>
<add> def __eq__(self, other):
<add> return (
<add> (self.app_label == other.app_label) and
<add> (self.name == other.name) and
<add> (len(self.fields) == len(other.fields)) and
<add> all((k1 == k2 and (f1.deconstruct()[1:] == f2.deconstruct()[1:])) for (k1, f1), (k2, f2) in zip(self.fields, other.fields)) and
<add> (self.options == other.options) and
<add> (self.bases == other.bases)
<add> )
<add>
<add> def __ne__(self, other):
<add> return not (self == other)
<ide><path>tests/migrations/test_state.py
<ide> class Meta:
<ide> project_state.add_model_state(ModelState.from_model(F))
<ide> with self.assertRaises(InvalidBasesError):
<ide> project_state.render()
<add>
<add> def test_equality(self):
<add> """
<add> Tests that == and != are implemented correctly.
<add> """
<add>
<add> # Test two things that should be equal
<add> project_state = ProjectState()
<add> project_state.add_model_state(ModelState(
<add> "migrations",
<add> "Tag",
<add> [
<add> ("id", models.AutoField(primary_key=True)),
<add> ("name", models.CharField(max_length=100)),
<add> ("hidden", models.BooleanField()),
<add> ],
<add> {},
<add> None,
<add> ))
<add> other_state = project_state.clone()
<add> self.assertEqual(project_state, project_state)
<add> self.assertEqual(project_state, other_state)
<add> self.assertEqual(project_state != project_state, False)
<add> self.assertEqual(project_state != other_state, False)
<add>
<add> # Make a very small change (max_len 99) and see if that affects it
<add> project_state = ProjectState()
<add> project_state.add_model_state(ModelState(
<add> "migrations",
<add> "Tag",
<add> [
<add> ("id", models.AutoField(primary_key=True)),
<add> ("name", models.CharField(max_length=99)),
<add> ("hidden", models.BooleanField()),
<add> ],
<add> {},
<add> None,
<add> ))
<add> self.assertNotEqual(project_state, other_state)
<add> self.assertEqual(project_state == other_state, False) | 2 |
Ruby | Ruby | fix rubocop warnings | 990ee4f36c1d65f712c3ff05ba011cf8d92cba32 | <ide><path>Library/Homebrew/cmd/info.rb
<ide> def print_info
<ide> end
<ide> else
<ide> ARGV.named.each_with_index do |f, i|
<del> puts unless i == 0
<add> puts unless i.zero?
<ide> begin
<ide> if f.include?("/") || File.exist?(f)
<ide> info_formula Formulary.factory(f) | 1 |
Javascript | Javascript | use spec reporter to know which specs hang | fe8aabd908d6038b9b0474f6449835807fbcf262 | <ide><path>spec/main-process/mocha-test-runner.js
<ide> import {assert} from 'chai'
<ide> export default function (testPaths) {
<ide> global.assert = assert
<ide>
<del> const mocha = new Mocha({reporter: 'dot'})
<add> const mocha = new Mocha({reporter: 'spec'})
<ide> for (let testPath of testPaths) {
<ide> if (fs.isDirectorySync(testPath)) {
<ide> for (let testFilePath of fs.listTreeSync(testPath)) { | 1 |
Javascript | Javascript | convert the dateadapter to es6 | dac52d189e362fa6463bce2f3985b2cd934bb03d | <ide><path>src/core/core.adapters.js
<ide>
<ide> 'use strict';
<ide>
<del>import helpers from '../helpers';
<add>import {extend} from '../helpers/helpers.core';
<ide>
<add>/**
<add> * @return {*}
<add> */
<ide> function abstract() {
<del> throw new Error(
<del> 'This method is not implemented: either no adapter can ' +
<del> 'be found or an incomplete integration was provided.'
<del> );
<add> throw new Error('This method is not implemented: either no adapter can be found or an incomplete integration was provided.');
<ide> }
<ide>
<ide> /**
<ide> function abstract() {
<ide>
<ide> /**
<ide> * Currently supported unit string values.
<del> * @typedef {('millisecond'|'second'|'minute'|'hour'|'day'|'week'|'month'|'quarter'|'year')}
<add> * @typedef {('millisecond'|'second'|'minute'|'hour'|'day'|'week'|'month'|'quarter'|'year')} Unit
<ide> * @memberof Chart._adapters._date
<del> * @name Unit
<ide> */
<ide>
<del>/**
<del> * @class
<del> */
<del>function DateAdapter(options) {
<del> this.options = options || {};
<del>}
<add>class DateAdapter {
<add>
<add> constructor(options) {
<add> this.options = options || {};
<add> }
<ide>
<del>helpers.extend(DateAdapter.prototype, /** @lends DateAdapter */ {
<ide> /**
<ide> * Returns a map of time formats for the supported formatting units defined
<ide> * in Unit as well as 'datetime' representing a detailed date/time string.
<ide> * @returns {{string: string}}
<ide> */
<del> formats: abstract,
<add> formats() {
<add> return abstract();
<add> }
<ide>
<ide> /**
<ide> * Parses the given `value` and return the associated timestamp.
<ide> * @param {any} value - the value to parse (usually comes from the data)
<ide> * @param {string} [format] - the expected data format
<ide> * @returns {(number|null)}
<del> * @function
<ide> */
<del> parse: abstract,
<add> parse(value, format) { // eslint-disable-line no-unused-vars
<add> return abstract();
<add> }
<ide>
<ide> /**
<ide> * Returns the formatted date in the specified `format` for a given `timestamp`.
<ide> * @param {number} timestamp - the timestamp to format
<ide> * @param {string} format - the date/time token
<ide> * @return {string}
<del> * @function
<ide> */
<del> format: abstract,
<add> format(timestamp, format) { // eslint-disable-line no-unused-vars
<add> return abstract();
<add> }
<ide>
<ide> /**
<ide> * Adds the specified `amount` of `unit` to the given `timestamp`.
<ide> * @param {number} timestamp - the input timestamp
<ide> * @param {number} amount - the amount to add
<ide> * @param {Unit} unit - the unit as string
<ide> * @return {number}
<del> * @function
<ide> */
<del> add: abstract,
<add> add(timestamp, amount, unit) { // eslint-disable-line no-unused-vars
<add> return abstract();
<add> }
<ide>
<ide> /**
<ide> * Returns the number of `unit` between the given timestamps.
<del> * @param {number} max - the input timestamp (reference)
<del> * @param {number} min - the timestamp to substract
<add> * @param {number} a - the input timestamp (reference)
<add> * @param {number} b - the timestamp to subtract
<ide> * @param {Unit} unit - the unit as string
<ide> * @return {number}
<del> * @function
<ide> */
<del> diff: abstract,
<add> diff(a, b, unit) { // eslint-disable-line no-unused-vars
<add> return abstract();
<add> }
<ide>
<ide> /**
<ide> * Returns start of `unit` for the given `timestamp`.
<ide> * @param {number} timestamp - the input timestamp
<ide> * @param {Unit} unit - the unit as string
<ide> * @param {number} [weekday] - the ISO day of the week with 1 being Monday
<ide> * and 7 being Sunday (only needed if param *unit* is `isoWeek`).
<del> * @function
<add> * @return {number}
<ide> */
<del> startOf: abstract,
<add> startOf(timestamp, unit, weekday) { // eslint-disable-line no-unused-vars
<add> return abstract();
<add> }
<ide>
<ide> /**
<ide> * Returns end of `unit` for the given `timestamp`.
<ide> * @param {number} timestamp - the input timestamp
<ide> * @param {Unit} unit - the unit as string
<del> * @function
<add> * @return {number}
<ide> */
<del> endOf: abstract
<del>});
<add> endOf(timestamp, unit) { // eslint-disable-line no-unused-vars
<add> return abstract();
<add> }
<add>
<add>}
<ide>
<ide> DateAdapter.override = function(members) {
<del> helpers.extend(DateAdapter.prototype, members);
<add> extend(DateAdapter.prototype, members);
<ide> };
<ide>
<ide> export default { | 1 |
Text | Text | add html example code and a codepen link | bc5d441b217d931d5a913c5b04d19f4781fb41d3 | <ide><path>guide/english/certifications/responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field/index.md
<ide> title: Add Placeholder Text to a Text Field
<ide>
<ide> `placeholder` is an attribute, not a tag. It can be used together with the attribute `text` of the `input` tag to create a text to visualize when the input box is empty.
<ide>
<add>```HTML
<add> <input type=text placeholder="This is a placeholder text">
<add>```
<add>
<ide> If you're stuck check for these issues:
<ide> - you should add the `placeholder` attribute to the `input` tag already present in the code without removing anything; if by accident you removed or modified something remember that you can restart with a clean code by clicking `reset all code` button
<ide> - the syntax is the same of every attribute: `<tag attributeName="attributeValue" >` and the value to insert is indicated by the challenge's instructions (check for typos). | 1 |
Javascript | Javascript | avoid bool coercion in `registry` | a8a8059de482d6f636b99d1d1c82c5341a4da684 | <ide><path>packages/container/lib/registry.js
<ide> export default class Registry {
<ide> resolve(fullName, options) {
<ide> assert('fullName must be a proper full name', this.validateFullName(fullName));
<ide> let factory = resolve(this, this.normalize(fullName), options);
<del> if (factory === undefined && this.fallback) {
<add> if (factory === undefined && this.fallback !== null) {
<ide> factory = this.fallback.resolve(...arguments);
<ide> }
<ide> return factory;
<ide> export default class Registry {
<ide> @return {string} described fullName
<ide> */
<ide> describe(fullName) {
<del> if (this.resolver && this.resolver.lookupDescription) {
<add> if (this.resolver !== null && this.resolver.lookupDescription) {
<ide> return this.resolver.lookupDescription(fullName);
<del> } else if (this.fallback) {
<add> } else if (this.fallback !== null) {
<ide> return this.fallback.describe(fullName);
<ide> } else {
<ide> return fullName;
<ide> export default class Registry {
<ide> @return {string} normalized fullName
<ide> */
<ide> normalizeFullName(fullName) {
<del> if (this.resolver && this.resolver.normalize) {
<add> if (this.resolver !== null && this.resolver.normalize) {
<ide> return this.resolver.normalize(fullName);
<del> } else if (this.fallback) {
<add> } else if (this.fallback !== null) {
<ide> return this.fallback.normalizeFullName(fullName);
<ide> } else {
<ide> return fullName;
<ide> export default class Registry {
<ide> @return {function} toString function
<ide> */
<ide> makeToString(factory, fullName) {
<del> if (this.resolver && this.resolver.makeToString) {
<add> if (this.resolver !== null && this.resolver.makeToString) {
<ide> return this.resolver.makeToString(factory, fullName);
<del> } else if (this.fallback) {
<add> } else if (this.fallback !== null) {
<ide> return this.fallback.makeToString(factory, fullName);
<ide> } else {
<ide> return factory.toString();
<ide> export default class Registry {
<ide>
<ide> getOptionsForType(type) {
<ide> let optionsForType = this._typeOptions[type];
<del> if (optionsForType === undefined && this.fallback) {
<add> if (optionsForType === undefined && this.fallback !== null) {
<ide> optionsForType = this.fallback.getOptionsForType(type);
<ide> }
<ide> return optionsForType;
<ide> export default class Registry {
<ide> let normalizedName = this.normalize(fullName);
<ide> let options = this._options[normalizedName];
<ide>
<del> if (options === undefined && this.fallback) {
<add> if (options === undefined && this.fallback !== null) {
<ide> options = this.fallback.getOptions(fullName);
<ide> }
<ide> return options;
<ide> export default class Registry {
<ide>
<ide> if (options && options[optionName] !== undefined) {
<ide> return options[optionName];
<del> } else if (this.fallback) {
<add> } else if (this.fallback !== null) {
<ide> return this.fallback.getOption(fullName, optionName);
<ide> }
<ide> }
<ide> export default class Registry {
<ide> }
<ide> }
<ide>
<del> if (this.fallback) {
<add> if (this.fallback !== null) {
<ide> fallbackKnown = this.fallback.knownForType(type);
<ide> }
<ide>
<del> if (this.resolver && this.resolver.knownForType) {
<add> if (this.resolver !== null && this.resolver.knownForType) {
<ide> resolverKnown = this.resolver.knownForType(type);
<ide> }
<ide>
<ide> export default class Registry {
<ide>
<ide> getInjections(fullName) {
<ide> let injections = this._injections[fullName] || [];
<del> if (this.fallback) {
<add> if (this.fallback !== null) {
<ide> injections = injections.concat(this.fallback.getInjections(fullName));
<ide> }
<ide> return injections;
<ide> }
<ide>
<ide> getTypeInjections(type) {
<ide> let injections = this._typeInjections[type] || [];
<del> if (this.fallback) {
<add> if (this.fallback !== null) {
<ide> injections = injections.concat(this.fallback.getTypeInjections(type));
<ide> }
<ide> return injections;
<ide> export default class Registry {
<ide> @return {String} fullName
<ide> */
<ide> expandLocalLookup(fullName, options) {
<del> if (this.resolver && this.resolver.expandLocalLookup) {
<add> if (this.resolver !== null && this.resolver.expandLocalLookup) {
<ide> assert('fullName must be a proper full name', this.validateFullName(fullName));
<ide> assert('options.source must be provided to expandLocalLookup', options && options.source);
<ide> assert('options.source must be a proper full name', this.validateFullName(options.source));
<ide> export default class Registry {
<ide> let normalizedSource = this.normalize(options.source);
<ide>
<ide> return expandLocalLookup(this, normalizedFullName, normalizedSource);
<del> } else if (this.fallback) {
<add> } else if (this.fallback !== null) {
<ide> return this.fallback.expandLocalLookup(fullName, options);
<ide> } else {
<ide> return null; | 1 |
Javascript | Javascript | remove registerwidget and use event instead | e0c9551fd7c716d9d71ed6f4f1d2f5911f53032c | <ide><path>src/directive/form.js
<ide> function FormController($scope, name) {
<ide> $scope.$on('$destroy', function(event, widget) {
<ide> if (!widget) return;
<ide>
<del> if (widget.widgetId) {
<add> if (widget.widgetId && form[widget.widgetId] === widget) {
<ide> delete form[widget.widgetId];
<ide> }
<ide> forEach(errors, removeWidget, widget);
<ide> function FormController($scope, name) {
<ide> form.pristine = false;
<ide> });
<ide>
<add> $scope.$on('$newFormControl', function(event, widget) {
<add> if (widget.widgetId && !form.hasOwnProperty(widget.widgetId)) {
<add> form[widget.widgetId] = widget;
<add> }
<add> });
<add>
<ide> // init state
<ide> form.dirty = false;
<ide> form.pristine = true;
<ide> function FormController($scope, name) {
<ide> }
<ide> }
<ide>
<del>/**
<del> * @ngdoc function
<del> * @name angular.module.ng.$compileProvider.directive.form.FormController#registerWidget
<del> * @methodOf angular.module.ng.$compileProvider.directive.form.FormController
<del> * @function
<del> *
<del> * @param {Object} widget Widget to register (controller of a widget)
<del> * @param {string=} alias Name alias of the widget.
<del> * (If specified, widget will be accesible as a form property)
<del> *
<del> * @description
<del> *
<del> */
<del>FormController.prototype.registerWidget = function(widget, alias) {
<del> if (alias && !this.hasOwnProperty(alias)) {
<del> widget.widgetId = alias;
<del> this[alias] = widget;
<del> }
<del>};
<del>
<ide>
<ide> /**
<ide> * @ngdoc directive
<ide><path>src/directive/input.js
<ide> var inputDirective = [function() {
<ide> * @description
<ide> *
<ide> */
<del>var NgModelController = ['$scope', '$exceptionHandler', 'ngModel',
<del> function($scope, $exceptionHandler, ngModel) {
<add>var NgModelController = ['$scope', '$exceptionHandler', '$attrs', 'ngModel',
<add> function($scope, $exceptionHandler, $attr, ngModel) {
<ide> this.viewValue = Number.NaN;
<ide> this.modelValue = Number.NaN;
<ide> this.parsers = [];
<ide> var NgModelController = ['$scope', '$exceptionHandler', 'ngModel',
<ide> this.valid = true;
<ide> this.invalid = false;
<ide> this.render = noop;
<add> this.widgetId = $attr.name;
<ide>
<ide>
<ide> /**
<ide> var ngModelDirective = [function() {
<ide> inject: {
<ide> ngModel: 'accessor'
<ide> },
<del> require: ['ngModel', '^?form'],
<add> require: 'ngModel',
<ide> controller: NgModelController,
<del> link: function(scope, element, attr, controllers) {
<del> var modelController = controllers[0],
<del> formController = controllers[1];
<del>
<del> if (formController) {
<del> formController.registerWidget(modelController, attr.name);
<del> }
<add> link: function(scope, element, attr, ctrl) {
<add> // notify others, especially parent forms
<add> scope.$emit('$newFormControl', ctrl);
<ide>
<ide> forEach(['valid', 'invalid', 'pristine', 'dirty'], function(name) {
<ide> scope.$watch(function() {
<del> return modelController[name];
<add> return ctrl[name];
<ide> }, function(value) {
<ide> element[value ? 'addClass' : 'removeClass']('ng-' + name);
<ide> });
<ide> });
<ide>
<ide> element.bind('$destroy', function() {
<del> scope.$emit('$destroy', modelController);
<add> scope.$emit('$destroy', ctrl);
<ide> });
<ide> }
<ide> };
<ide><path>test/directive/inputSpec.js
<ide> describe('NgModelController', function() {
<ide> var ctrl, scope, ngModelAccessor;
<ide>
<ide> beforeEach(inject(function($rootScope, $controller) {
<add> var attrs = {name: 'testAlias'};
<add>
<ide> scope = $rootScope;
<ide> ngModelAccessor = jasmine.createSpy('ngModel accessor');
<del> ctrl = $controller(NgModelController, {$scope: scope, ngModel: ngModelAccessor});
<add> ctrl = $controller(NgModelController, {$scope: scope, ngModel: ngModelAccessor, $attrs: attrs});
<ide>
<ide> // mock accessor (locals)
<ide> ngModelAccessor.andCallFake(function(val) {
<ide> describe('NgModelController', function() {
<ide>
<ide> expect(ctrl.formatters).toEqual([]);
<ide> expect(ctrl.parsers).toEqual([]);
<add>
<add> expect(ctrl.widgetId).toBe('testAlias');
<ide> });
<ide>
<ide> | 3 |
Go | Go | move pkg/templates away | 9ef3b535974612b137abae062b7a8a0f7e969871 | <ide><path>daemon/logger/awslogs/cloudwatchlogs.go
<ide> package awslogs
<ide>
<ide> import (
<del> "bytes"
<ide> "fmt"
<ide> "os"
<ide> "regexp"
<ide> import (
<ide> "github.com/docker/docker/daemon/logger"
<ide> "github.com/docker/docker/daemon/logger/loggerutils"
<ide> "github.com/docker/docker/dockerversion"
<del> "github.com/docker/docker/pkg/templates"
<ide> "github.com/pkg/errors"
<ide> "github.com/sirupsen/logrus"
<ide> )
<ide> var strftimeToRegex = map[string]string{
<ide> /*milliseconds */ `%L`: `\.\d{3}`,
<ide> }
<ide>
<del>func parseLogGroup(info logger.Info, groupTemplate string) (string, error) {
<del> tmpl, err := templates.NewParse("log-group", groupTemplate)
<del> if err != nil {
<del> return "", err
<del> }
<del> buf := new(bytes.Buffer)
<del> if err := tmpl.Execute(buf, &info); err != nil {
<del> return "", err
<del> }
<del>
<del> return buf.String(), nil
<del>}
<del>
<ide> // newRegionFinder is a variable such that the implementation
<ide> // can be swapped out for unit tests.
<ide> var newRegionFinder = func() regionFinder {
<ide><path>daemon/logger/loggerutils/log_tag.go
<ide> import (
<ide> "bytes"
<ide>
<ide> "github.com/docker/docker/daemon/logger"
<del> "github.com/docker/docker/pkg/templates"
<add> "github.com/docker/docker/daemon/logger/templates"
<ide> )
<ide>
<ide> // DefaultTemplate defines the defaults template logger should use.
<add><path>daemon/logger/templates/templates.go
<del><path>pkg/templates/templates.go
<ide> var basicFunctions = template.FuncMap{
<ide> "truncate": truncateWithLength,
<ide> }
<ide>
<del>// HeaderFunctions are used to created headers of a table.
<del>// This is a replacement of basicFunctions for header generation
<del>// because we want the header to remain intact.
<del>// Some functions like `split` are irrelevant so not added.
<del>var HeaderFunctions = template.FuncMap{
<del> "json": func(v string) string {
<del> return v
<del> },
<del> "title": func(v string) string {
<del> return v
<del> },
<del> "lower": func(v string) string {
<del> return v
<del> },
<del> "upper": func(v string) string {
<del> return v
<del> },
<del> "truncate": func(v string, l int) string {
<del> return v
<del> },
<del>}
<del>
<del>// Parse creates a new anonymous template with the basic functions
<del>// and parses the given format.
<del>func Parse(format string) (*template.Template, error) {
<del> return NewParse("", format)
<del>}
<del>
<ide> // NewParse creates a new tagged template with the basic functions
<ide> // and parses the given format.
<ide> func NewParse(tag, format string) (*template.Template, error) {
<ide><path>daemon/logger/templates/templates_test.go
<add>package templates
<add>
<add>import (
<add> "bytes"
<add> "testing"
<add>
<add> "github.com/stretchr/testify/assert"
<add>)
<add>
<add>func TestNewParse(t *testing.T) {
<add> tm, err := NewParse("foo", "this is a {{ . }}")
<add> assert.NoError(t, err)
<add>
<add> var b bytes.Buffer
<add> assert.NoError(t, tm.Execute(&b, "string"))
<add> want := "this is a string"
<add> assert.Equal(t, want, b.String())
<add>}
<ide><path>pkg/templates/templates_test.go
<del>package templates
<del>
<del>import (
<del> "bytes"
<del> "testing"
<del>
<del> "github.com/stretchr/testify/assert"
<del>)
<del>
<del>// Github #32120
<del>func TestParseJSONFunctions(t *testing.T) {
<del> tm, err := Parse(`{{json .Ports}}`)
<del> assert.NoError(t, err)
<del>
<del> var b bytes.Buffer
<del> assert.NoError(t, tm.Execute(&b, map[string]string{"Ports": "0.0.0.0:2->8/udp"}))
<del> want := "\"0.0.0.0:2->8/udp\""
<del> assert.Equal(t, want, b.String())
<del>}
<del>
<del>func TestParseStringFunctions(t *testing.T) {
<del> tm, err := Parse(`{{join (split . ":") "/"}}`)
<del> assert.NoError(t, err)
<del>
<del> var b bytes.Buffer
<del> assert.NoError(t, tm.Execute(&b, "text:with:colon"))
<del> want := "text/with/colon"
<del> assert.Equal(t, want, b.String())
<del>}
<del>
<del>func TestNewParse(t *testing.T) {
<del> tm, err := NewParse("foo", "this is a {{ . }}")
<del> assert.NoError(t, err)
<del>
<del> var b bytes.Buffer
<del> assert.NoError(t, tm.Execute(&b, "string"))
<del> want := "this is a string"
<del> assert.Equal(t, want, b.String())
<del>}
<del>
<del>func TestParseTruncateFunction(t *testing.T) {
<del> source := "tupx5xzf6hvsrhnruz5cr8gwp"
<del>
<del> testCases := []struct {
<del> template string
<del> expected string
<del> }{
<del> {
<del> template: `{{truncate . 5}}`,
<del> expected: "tupx5",
<del> },
<del> {
<del> template: `{{truncate . 25}}`,
<del> expected: "tupx5xzf6hvsrhnruz5cr8gwp",
<del> },
<del> {
<del> template: `{{truncate . 30}}`,
<del> expected: "tupx5xzf6hvsrhnruz5cr8gwp",
<del> },
<del> {
<del> template: `{{pad . 3 3}}`,
<del> expected: " tupx5xzf6hvsrhnruz5cr8gwp ",
<del> },
<del> }
<del>
<del> for _, testCase := range testCases {
<del> tm, err := Parse(testCase.template)
<del> assert.NoError(t, err)
<del>
<del> t.Run("Non Empty Source Test with template: "+testCase.template, func(t *testing.T) {
<del> var b bytes.Buffer
<del> assert.NoError(t, tm.Execute(&b, source))
<del> assert.Equal(t, testCase.expected, b.String())
<del> })
<del>
<del> t.Run("Empty Source Test with template: "+testCase.template, func(t *testing.T) {
<del> var c bytes.Buffer
<del> assert.NoError(t, tm.Execute(&c, ""))
<del> assert.Equal(t, "", c.String())
<del> })
<del>
<del> t.Run("Nil Source Test with template: "+testCase.template, func(t *testing.T) {
<del> var c bytes.Buffer
<del> assert.Error(t, tm.Execute(&c, nil))
<del> assert.Equal(t, "", c.String())
<del> })
<del> }
<del>}
<ide><path>profiles/apparmor/apparmor.go
<ide> import (
<ide> "os"
<ide> "path"
<ide> "strings"
<add> "text/template"
<ide>
<ide> "github.com/docker/docker/pkg/aaparser"
<del> "github.com/docker/docker/pkg/templates"
<ide> )
<ide>
<ide> var (
<ide> type profileData struct {
<ide>
<ide> // generateDefault creates an apparmor profile from ProfileData.
<ide> func (p *profileData) generateDefault(out io.Writer) error {
<del> compiled, err := templates.NewParse("apparmor_profile", baseTemplate)
<add> compiled, err := template.New("apparmor_profile").Parse(baseTemplate)
<ide> if err != nil {
<ide> return err
<ide> } | 6 |
Python | Python | remove six dependency for dictionnaries iterators | 545b75f9e221d84f4470df657493dd63c92f6c6a | <ide><path>object_detection/utils/visualization_utils.py
<ide> import PIL.ImageColor as ImageColor
<ide> import PIL.ImageDraw as ImageDraw
<ide> import PIL.ImageFont as ImageFont
<del>import six
<ide> import tensorflow as tf
<ide>
<ide>
<ide> def visualize_boxes_and_labels_on_image_array(image,
<ide> classes[i] % len(STANDARD_COLORS)]
<ide>
<ide> # Draw all boxes onto image.
<del> for box, color in six.iteritems(box_to_color_map):
<add> for box, color in box_to_color_map.items():
<ide> ymin, xmin, ymax, xmax = box
<ide> if instance_masks is not None:
<ide> draw_mask_on_image_array( | 1 |
Javascript | Javascript | fix an issue wher buffers don't get deleted | 1c568ed1f547b94b2aa5315ec24a91ec34fe5e13 | <ide><path>src/renderers/webgl/WebGLGeometries.js
<ide> * @author mrdoob / http://mrdoob.com/
<ide> */
<ide>
<del>THREE.WebGLGeometries = function ( gl, info ) {
<add>THREE.WebGLGeometries = function ( gl,properties, info ) {
<ide>
<ide> var geometries = {};
<ide>
<ide> THREE.WebGLGeometries = function ( gl, info ) {
<ide> for ( var name in buffergeometry.attributes ) {
<ide>
<ide> var attribute = buffergeometry.attributes[ name ];
<add> var buffer = getAttributeBuffer(attribute);
<ide>
<del> if ( attribute.buffer !== undefined ) {
<add> if ( buffer !== undefined ) {
<ide>
<del> gl.deleteBuffer( attribute.buffer );
<del>
<del> delete attribute.buffer;
<add> gl.deleteBuffer( buffer );
<add> removeAttributeBuffer(attribute);
<ide>
<ide> }
<ide>
<ide> THREE.WebGLGeometries = function ( gl, info ) {
<ide> info.memory.geometries --;
<ide>
<ide> }
<add>
<add> function getAttributeBuffer( attribute ) {
<add>
<add> if ( attribute instanceof THREE.InterleavedBufferAttribute ) {
<ide>
<add> return properties.get( attribute.data ).__webglBuffer;
<add>
<add> }
<add>
<add> return properties.get( attribute ).__webglBuffer;
<add>
<add> };
<add>
<add> function removeAttributeBuffer( attribute ) {
<add>
<add> if ( attribute instanceof THREE.InterleavedBufferAttribute ) {
<add>
<add> properties.delete( attribute.data );
<add>
<add> } else {
<add>
<add> properties.delete( attribute );
<add>
<add> };
<add>
<add> };
<ide> };
<ide><path>src/renderers/webgl/WebGLObjects.js
<ide> THREE.WebGLObjects = function ( gl, properties, info ) {
<ide>
<ide> var morphInfluences = new Float32Array( 8 );
<ide>
<del> var geometries = new THREE.WebGLGeometries( gl, info );
<add> var geometries = new THREE.WebGLGeometries( gl, properties, info );
<ide>
<ide> //
<ide> | 2 |
Python | Python | add python 3.7 to classifiers. | de3929fb3334262bbf57980fff41d3f8c6f2b8b4 | <ide><path>setup.py
<ide> def get_version(package):
<ide> 'Programming Language :: Python :: 3.4',
<ide> 'Programming Language :: Python :: 3.5',
<ide> 'Programming Language :: Python :: 3.6',
<add> 'Programming Language :: Python :: 3.7',
<ide> 'Topic :: Internet :: WWW/HTTP',
<ide> ]
<ide> ) | 1 |
Ruby | Ruby | use stable branch for --edge option when possible | 776277080552e110df504fe36f6ecb32a8d165de | <ide><path>railties/lib/rails/generators/app_base.rb
<ide> def rails_gemfile_entry
<ide> GemfileEntry.path("rails", Rails::Generators::RAILS_DEV_PATH)
<ide> ]
<ide> elsif options.edge?
<add> edge_branch = Rails.gem_version.prerelease? ? "main" : [*Rails.gem_version.segments.first(2), "stable"].join("-")
<ide> [
<del> GemfileEntry.github("rails", "rails/rails", "main")
<add> GemfileEntry.github("rails", "rails/rails", edge_branch)
<ide> ]
<ide> elsif options.main?
<ide> [
<ide><path>railties/test/generators/app_generator_test.rb
<ide> def test_dev_option
<ide> end
<ide>
<ide> def test_edge_option
<del> generator([destination_root], edge: true, skip_webpack_install: true)
<del> run_generator_instance
<add> Rails.stub(:gem_version, Gem::Version.new("2.1.0")) do
<add> generator([destination_root], edge: true, skip_webpack_install: true)
<add> run_generator_instance
<add> end
<add>
<add> assert_equal 1, @bundle_commands.count("install")
<add> assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["'],\s+branch:\s+["']2-1-stable["']$}
<add> end
<add>
<add> def test_edge_option_during_alpha
<add> Rails.stub(:gem_version, Gem::Version.new("2.1.0.alpha")) do
<add> generator([destination_root], edge: true, skip_webpack_install: true)
<add> run_generator_instance
<add> end
<ide>
<ide> assert_equal 1, @bundle_commands.count("install")
<ide> assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["'],\s+branch:\s+["']main["']$}
<ide><path>railties/test/generators/plugin_generator_test.rb
<ide> def test_dev_option
<ide> end
<ide>
<ide> def test_edge_option
<del> generator([destination_root], edge: true)
<del> run_generator_instance
<add> Rails.stub(:gem_version, Gem::Version.new("2.1.0")) do
<add> generator([destination_root], edge: true)
<add> run_generator_instance
<add> end
<add>
<add> assert_empty @bundle_commands
<add> assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["'],\s+branch:\s+["']2-1-stable["']$}
<add> end
<add>
<add> def test_edge_option_during_alpha
<add> Rails.stub(:gem_version, Gem::Version.new("2.1.0.alpha")) do
<add> generator([destination_root], edge: true)
<add> run_generator_instance
<add> end
<ide>
<ide> assert_empty @bundle_commands
<ide> assert_file "Gemfile", %r{^gem\s+["']rails["'],\s+github:\s+["']#{Regexp.escape("rails/rails")}["'],\s+branch:\s+["']main["']$} | 3 |
Javascript | Javascript | remove rkmodal and portal | 551c154261a29bd0a209bd00f7c086f80664c3ff | <ide><path>Libraries/Portal/Portal.js
<del>/**
<del> * Copyright (c) 2013-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> * @providesModule Portal
<del> * @flow
<del> */
<del>'use strict';
<del>
<del>var Platform = require('Platform');
<del>var React = require('React');
<del>var ReactNative = require('ReactNative');
<del>var StyleSheet = require('StyleSheet');
<del>var UIManager = require('UIManager');
<del>var View = require('View');
<del>
<del>var _portalRef: any;
<del>
<del>// Unique identifiers for modals.
<del>var lastUsedTag = 0;
<del>
<del>/*
<del> * Note: Only intended for Android at the moment. Just use Modal in your iOS
<del> * code.
<del> *
<del> * A container that renders all the modals on top of everything else in the application.
<del> *
<del> * Portal makes it possible for application code to pass modal views all the way up to
<del> * the root element created in `renderApplication`.
<del> *
<del> * Never use `<Portal>` in your code. There is only one Portal instance rendered
<del> * by the top-level `renderApplication`.
<del> */
<del>var Portal = React.createClass({
<del> _modals: {},
<del>
<del> statics: {
<del> /**
<del> * Use this to create a new unique tag for your component that renders
<del> * modals. A good place to allocate a tag is in `componentWillMount`
<del> * of your component.
<del> * See `showModal` and `closeModal`.
<del> */
<del> allocateTag: function(): string {
<del> return '__modal_' + (++lastUsedTag);
<del> },
<del>
<del> /**
<del> * Render a new modal.
<del> * @param tag A unique tag identifying the React component to render.
<del> * This tag can be later used in `closeModal`.
<del> * @param component A React component to be rendered.
<del> */
<del> showModal: function(tag: string, component: any) {
<del> if (!_portalRef) {
<del> console.error('Calling showModal but no Portal has been rendered.');
<del> return;
<del> }
<del> _portalRef._showModal(tag, component);
<del> },
<del>
<del> /**
<del> * Remove a modal from the collection of modals to be rendered.
<del> * @param tag A unique tag identifying the React component to remove.
<del> * Must exactly match the tag previously passed to `showModal`.
<del> */
<del> closeModal: function(tag: string) {
<del> if (!_portalRef) {
<del> console.error('Calling closeModal but no Portal has been rendered.');
<del> return;
<del> }
<del> _portalRef._closeModal(tag);
<del> },
<del>
<del> /**
<del> * Get an array of all the open modals, as identified by their tag string.
<del> */
<del> getOpenModals: function(): Array<string> {
<del> if (!_portalRef) {
<del> console.error('Calling getOpenModals but no Portal has been rendered.');
<del> return [];
<del> }
<del> return _portalRef._getOpenModals();
<del> },
<del>
<del> notifyAccessibilityService: function() {
<del> if (!_portalRef) {
<del> console.error('Calling closeModal but no Portal has been rendered.');
<del> return;
<del> }
<del> _portalRef._notifyAccessibilityService();
<del> },
<del> },
<del>
<del> getInitialState: function() {
<del> this._modals = {};
<del> return {};
<del> },
<del>
<del> _showModal: function(tag: string, component: any) {
<del> // We are about to open first modal, so Portal will appear.
<del> // Let's disable accessibility for background view on Android.
<del> if (this._getOpenModals().length === 0) {
<del> this.props.onModalVisibilityChanged(true);
<del> }
<del>
<del> this._modals[tag] = component;
<del> this.forceUpdate();
<del> },
<del>
<del> _closeModal: function(tag: string) {
<del> if (!this._modals.hasOwnProperty(tag)) {
<del> return;
<del> }
<del> // We are about to close last modal, so Portal will disappear.
<del> // Let's enable accessibility for application view on Android.
<del> if (this._getOpenModals().length === 1) {
<del> this.props.onModalVisibilityChanged(false);
<del> }
<del>
<del> delete this._modals[tag];
<del> this.forceUpdate();
<del> },
<del>
<del> _getOpenModals: function(): Array<string> {
<del> return Object.keys(this._modals);
<del> },
<del>
<del> _notifyAccessibilityService: function() {
<del> if (Platform.OS === 'android') {
<del> // We need to send accessibility event in a new batch, as otherwise
<del> // TextViews have no text set at the moment of populating event.
<del> setTimeout(() => {
<del> if (this._getOpenModals().length > 0) {
<del> UIManager.sendAccessibilityEvent(
<del> ReactNative.findNodeHandle(this),
<del> UIManager.AccessibilityEventTypes.typeWindowStateChanged);
<del> }
<del> }, 0);
<del> }
<del> },
<del>
<del> render: function() {
<del> _portalRef = this;
<del> if (!this._modals) {
<del> return null;
<del> }
<del> var modals = [];
<del> for (var tag in this._modals) {
<del> modals.push(this._modals[tag]);
<del> }
<del> if (modals.length === 0) {
<del> return null;
<del> }
<del> return (
<del> <View
<del> style={styles.modalsContainer}
<del> importantForAccessibility="yes">
<del> {modals}
<del> </View>
<del> );
<del> }
<del>});
<del>
<del>var styles = StyleSheet.create({
<del> modalsContainer: {
<del> position: 'absolute',
<del> left: 0,
<del> top: 0,
<del> right: 0,
<del> bottom: 0,
<del> },
<del>});
<del>
<del>module.exports = Portal;
<ide><path>Libraries/ReactIOS/renderApplication.android.js
<ide> 'use strict';
<ide>
<ide> var Inspector = require('Inspector');
<del>var Portal = require('Portal');
<ide> var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
<ide> var React = require('React');
<ide> var ReactNative = require('ReactNative');
<ide> var AppContainer = React.createClass({
<ide> this._unmounted = true;
<ide> },
<ide>
<del> setRootAccessibility: function(modalVisible) {
<del> if (this._unmounted) {
<del> return;
<del> }
<del>
<del> this.setState({
<del> rootImportanceForAccessibility: modalVisible ? 'no-hide-descendants' : 'auto',
<del> });
<del> },
<del>
<ide> render: function() {
<ide> var RootComponent = this.props.rootComponent;
<ide> var appView =
<ide> var AppContainer = React.createClass({
<ide> {...this.props.initialProps}
<ide> rootTag={this.props.rootTag}
<ide> importantForAccessibility={this.state.rootImportanceForAccessibility}/>
<del> <Portal
<del> onModalVisibilityChanged={this.setRootAccessibility}/>
<ide> </View>;
<ide> return __DEV__ ?
<ide> <View style={styles.appContainer}>
<ide> function renderApplication<D, P, S>(
<ide> }
<ide>
<ide> var styles = StyleSheet.create({
<del> // This is needed so the application covers the whole screen
<del> // and therefore the contents of the Portal are not clipped.
<ide> appContainer: {
<ide> position: 'absolute',
<ide> left: 0, | 2 |
Javascript | Javascript | use async directory processing in cp() | d0c11765331edc457a3f5023c21cbe3f89fa6d17 | <ide><path>lib/internal/fs/cp/cp-sync.js
<ide> const {
<ide> existsSync,
<ide> lstatSync,
<ide> mkdirSync,
<del> readdirSync,
<add> opendirSync,
<ide> readlinkSync,
<ide> statSync,
<ide> symlinkSync,
<ide> function mkDirAndCopy(srcMode, src, dest, opts) {
<ide> }
<ide>
<ide> function copyDir(src, dest, opts) {
<del> readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
<del>}
<add> const dir = opendirSync(src);
<add>
<add> try {
<add> let dirent;
<ide>
<del>function copyDirItem(item, src, dest, opts) {
<del> const srcItem = join(src, item);
<del> const destItem = join(dest, item);
<del> const { destStat } = checkPathsSync(srcItem, destItem, opts);
<del> return startCopy(destStat, srcItem, destItem, opts);
<add> while ((dirent = dir.readSync()) !== null) {
<add> const { name } = dirent;
<add> const srcItem = join(src, name);
<add> const destItem = join(dest, name);
<add> const { destStat } = checkPathsSync(srcItem, destItem, opts);
<add>
<add> startCopy(destStat, srcItem, destItem, opts);
<add> }
<add> } finally {
<add> dir.closeSync();
<add> }
<ide> }
<ide>
<ide> function onLink(destStat, src, dest) {
<ide><path>lib/internal/fs/cp/cp.js
<ide> const {
<ide> copyFile,
<ide> lstat,
<ide> mkdir,
<del> readdir,
<add> opendir,
<ide> readlink,
<ide> stat,
<ide> symlink,
<ide> async function mkDirAndCopy(srcMode, src, dest, opts) {
<ide> }
<ide>
<ide> async function copyDir(src, dest, opts) {
<del> const dir = await readdir(src);
<del> for (let i = 0; i < dir.length; i++) {
<del> const item = dir[i];
<del> const srcItem = join(src, item);
<del> const destItem = join(dest, item);
<add> const dir = await opendir(src);
<add>
<add> for await (const { name } of dir) {
<add> const srcItem = join(src, name);
<add> const destItem = join(dest, name);
<ide> const { destStat } = await checkPaths(srcItem, destItem, opts);
<ide> await startCopy(destStat, srcItem, destItem, opts);
<ide> } | 2 |
Python | Python | use getter setter | 1b21c9c4edd6fcc8a948726c1b3641f18de63354 | <ide><path>keras/optimizer_v2/optimizer_v2.py
<ide> def apply_grad_to_update_var(var, grad):
<ide> # context. (eager updates execute immediately)
<ide> with backend._current_graph(update_ops).as_default(): # pylint: disable=protected-access
<ide> with tf.control_dependencies([tf.group(update_ops)]):
<del> return self._iterations.assign_add(1, read_value=False)
<add> return self.iterations.assign_add(1, read_value=False)
<ide>
<del> return self._iterations.assign_add(1)
<add> return self.iterations.assign_add(1)
<ide>
<ide> def get_gradients(self, loss, params):
<ide> """Returns gradients of `loss` with respect to `params`. | 1 |
Java | Java | replace remaining use of block operator | 4454ffd2b103b939a890ea7330bf192a32eec622 | <ide><path>spring-web/src/test/java/org/springframework/http/server/reactive/MultipartIntegrationTests.java
<ide>
<ide> import org.junit.Test;
<ide> import reactor.core.publisher.Mono;
<add>import reactor.test.StepVerifier;
<ide>
<ide> import org.springframework.core.io.ClassPathResource;
<del>import org.springframework.core.io.buffer.DataBuffer;
<ide> import org.springframework.core.io.buffer.DataBufferUtils;
<ide> import org.springframework.http.HttpEntity;
<ide> import org.springframework.http.HttpHeaders;
<ide> private void assertFooPart(Part part) {
<ide> assertEquals("fooPart", part.name());
<ide> assertTrue(part instanceof FilePart);
<ide> assertEquals("foo.txt", ((FilePart) part).filename());
<del> DataBufferUtils.join(part.content()).subscribe(buffer -> {
<del> assertEquals(12, buffer.readableByteCount());
<del> byte[] byteContent = new byte[12];
<del> buffer.read(byteContent);
<del> assertEquals("Lorem Ipsum.", new String(byteContent));
<del> });
<add>
<add> StepVerifier.create(DataBufferUtils.join(part.content()))
<add> .consumeNextWith(buffer -> {
<add> assertEquals(12, buffer.readableByteCount());
<add> byte[] byteContent = new byte[12];
<add> buffer.read(byteContent);
<add> assertEquals("Lorem Ipsum.", new String(byteContent));
<add> })
<add> .verifyComplete();
<ide> }
<ide>
<ide> private void assertBarPart(Part part) {
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/method/SyncInvocableHandlerMethod.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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> import java.util.List;
<ide> import java.util.stream.Collectors;
<ide>
<add>import reactor.core.publisher.MonoProcessor;
<add>
<ide> import org.springframework.core.DefaultParameterNameDiscoverer;
<ide> import org.springframework.core.ParameterNameDiscoverer;
<ide> import org.springframework.lang.Nullable;
<ide> public ParameterNameDiscoverer getParameterNameDiscoverer() {
<ide> public HandlerResult invokeForHandlerResult(ServerWebExchange exchange,
<ide> BindingContext bindingContext, Object... providedArgs) {
<ide>
<del> // This will not block with only sync resolvers allowed
<del> return this.delegate.invoke(exchange, bindingContext, providedArgs).block();
<add> MonoProcessor<HandlerResult> processor = MonoProcessor.create();
<add> this.delegate.invoke(exchange, bindingContext, providedArgs).subscribeWith(processor);
<add>
<add> if (processor.isTerminated()) {
<add> Throwable error = processor.getError();
<add> if (error != null) {
<add> throw (RuntimeException) error;
<add> }
<add> return processor.peek();
<add> }
<add> else {
<add> // Should never happen...
<add> throw new IllegalStateException(
<add> "SyncInvocableHandlerMethod should have completed synchronously.");
<add> }
<ide> }
<ide>
<ide> }
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MultipartIntegrationTests.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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> import org.springframework.web.reactive.function.client.WebClient;
<ide> import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
<ide>
<del>import static org.junit.Assert.assertEquals;
<add>import static org.junit.Assert.*;
<ide>
<ide> public class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTests {
<ide>
<ide> void requestPart(
<ide>
<ide> assertEquals("fieldValue", fieldPart.value());
<ide> assertEquals("fileParts:foo.txt", partDescription(fileParts));
<del> assertEquals("fileParts:foo.txt", partDescription(filePartsMono.block()));
<del> assertEquals("[fileParts:foo.txt,fileParts:logo.png]", partFluxDescription(filePartsFlux).block());
<ide> assertEquals("Jason", person.getName());
<del> assertEquals("Jason", personMono.block().getName());
<add>
<add> StepVerifier.create(partFluxDescription(filePartsFlux))
<add> .consumeNextWith(content -> assertEquals("[fileParts:foo.txt,fileParts:logo.png]", content))
<add> .verifyComplete();
<add>
<add> StepVerifier.create(filePartsMono)
<add> .consumeNextWith(filePart -> assertEquals("fileParts:foo.txt", partDescription(filePart)))
<add> .verifyComplete();
<add>
<add> StepVerifier.create(personMono)
<add> .consumeNextWith(p -> assertEquals("Jason", p.getName()))
<add> .verifyComplete();
<ide> }
<ide>
<ide> @PostMapping("/requestBodyMap") | 3 |
Javascript | Javascript | use synclane for discrete event hydration | 1fafac002838ad2d75ee9eca527c356b040285ff | <ide><path>packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
<ide> describe('ReactDOMServerPartialHydration', () => {
<ide> expect(container.textContent).toBe('Click meHello');
<ide>
<ide> // We're now partially hydrated.
<del> a.click();
<add> await act(async () => {
<add> a.click();
<add> });
<ide> expect(clicks).toBe(0);
<ide>
<ide> // Resolving the promise so that rendering can complete.
<del> suspend = false;
<del> resolve();
<del> await promise;
<del>
<del> Scheduler.unstable_flushAll();
<del> jest.runAllTimers();
<del>
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide> expect(clicks).toBe(1);
<ide>
<ide> expect(container.textContent).toBe('Hello');
<ide> describe('ReactDOMServerPartialHydration', () => {
<ide> jest.runAllTimers();
<ide>
<ide> // We're now partially hydrated.
<del> a.click();
<add> await act(async () => {
<add> a.click();
<add> });
<ide> // We should not have invoked the event yet because we're not
<ide> // yet hydrated.
<ide> expect(onEvent).toHaveBeenCalledTimes(0);
<ide>
<ide> // Resolving the promise so that rendering can complete.
<del> suspend = false;
<del> resolve();
<del> await promise;
<del>
<del> Scheduler.unstable_flushAll();
<del> jest.runAllTimers();
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide>
<ide> expect(onEvent).toHaveBeenCalledTimes(2);
<ide>
<ide> describe('ReactDOMServerPartialHydration', () => {
<ide> root.render(<App />);
<ide>
<ide> // We'll do one click before hydrating.
<del> a.click();
<add> await act(async () => {
<add> a.click();
<add> });
<ide> // This should be delayed.
<ide> expect(clicks).toBe(0);
<ide>
<ide> Scheduler.unstable_flushAll();
<ide> jest.runAllTimers();
<ide>
<ide> // We're now partially hydrated.
<del> a.click();
<add> await act(async () => {
<add> a.click();
<add> });
<ide> expect(clicks).toBe(0);
<ide>
<ide> // Resolving the promise so that rendering can complete.
<del> suspend = false;
<del> resolve();
<del> await promise;
<del>
<del> Scheduler.unstable_flushAll();
<del> jest.runAllTimers();
<del>
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide> expect(clicks).toBe(2);
<ide>
<ide> document.body.removeChild(container);
<ide> describe('ReactDOMServerPartialHydration', () => {
<ide> jest.runAllTimers();
<ide>
<ide> // We're now partially hydrated.
<del> a.click();
<add> await act(async () => {
<add> a.click();
<add> });
<ide> // We should not have invoked the event yet because we're not
<ide> // yet hydrated.
<ide> expect(onEvent).toHaveBeenCalledTimes(0);
<ide>
<ide> // Resolving the promise so that rendering can complete.
<del> suspend = false;
<del> resolve();
<del> await promise;
<del>
<del> Scheduler.unstable_flushAll();
<del> jest.runAllTimers();
<del>
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide> expect(onEvent).toHaveBeenCalledTimes(2);
<ide>
<ide> document.body.removeChild(container);
<ide> describe('ReactDOMServerPartialHydration', () => {
<ide> jest.runAllTimers();
<ide>
<ide> // We're now partially hydrated.
<del> span.click();
<add> await act(async () => {
<add> span.click();
<add> });
<ide> expect(clicksOnChild).toBe(0);
<ide> expect(clicksOnParent).toBe(0);
<ide>
<ide> // Resolving the promise so that rendering can complete.
<del> suspend = false;
<del> resolve();
<del> await promise;
<del>
<del> Scheduler.unstable_flushAll();
<del> jest.runAllTimers();
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide>
<ide> expect(clicksOnChild).toBe(1);
<ide> // This will be zero due to the stopPropagation.
<ide> describe('ReactDOMServerPartialHydration', () => {
<ide> Scheduler.unstable_flushAll();
<ide>
<ide> // The Suspense boundary is not yet hydrated.
<del> a.click();
<add> await act(async () => {
<add> a.click();
<add> });
<ide> expect(clicks).toBe(0);
<ide>
<ide> // Resolving the promise so that rendering can complete.
<del> suspend = false;
<del> resolve();
<del> await promise;
<del>
<del> Scheduler.unstable_flushAll();
<del> jest.runAllTimers();
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide>
<ide> // We're now full hydrated.
<ide>
<ide> describe('ReactDOMServerPartialHydration', () => {
<ide> expect(container.textContent).toBe('Click meHello');
<ide>
<ide> // We're now partially hydrated.
<del> form.dispatchEvent(
<del> new Event('submit', {
<del> bubbles: true,
<del> }),
<del> );
<add> await act(async () => {
<add> form.dispatchEvent(
<add> new Event('submit', {
<add> bubbles: true,
<add> }),
<add> );
<add> });
<ide> expect(submits).toBe(0);
<ide>
<ide> // Resolving the promise so that rendering can complete.
<del> suspend = false;
<del> resolve();
<del> await promise;
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide>
<del> Scheduler.unstable_flushAll();
<del> jest.runAllTimers();
<ide> expect(submits).toBe(1);
<ide> expect(container.textContent).toBe('Hello');
<ide> document.body.removeChild(container);
<ide><path>packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js
<ide> describe('ReactDOMServerSelectiveHydration', () => {
<ide> expect(Scheduler).toHaveYielded([]);
<ide>
<ide> // This click target cannot be hydrated yet because it's suspended.
<del> const result = dispatchClickEvent(spanD);
<del>
<del> expect(Scheduler).toHaveYielded(['App']);
<del>
<del> expect(result).toBe(true);
<del>
<del> // Continuing rendering will render B next.
<del> expect(Scheduler).toFlushAndYield(['B', 'C']);
<del>
<del> suspend = false;
<del> resolve();
<del> await promise;
<add> await act(async () => {
<add> const result = dispatchClickEvent(spanD);
<add> expect(result).toBe(true);
<add> });
<add> expect(Scheduler).toHaveYielded([
<add> 'App',
<add> // Continuing rendering will render B next.
<add> 'B',
<add> 'C',
<add> ]);
<ide>
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide> // After the click, we should prioritize D and the Click first,
<ide> // and only after that render A and C.
<del> expect(Scheduler).toFlushAndYield(['D', 'Clicked D', 'A']);
<add> expect(Scheduler).toHaveYielded(['D', 'Clicked D', 'A']);
<ide>
<ide> document.body.removeChild(container);
<ide> });
<ide> describe('ReactDOMServerSelectiveHydration', () => {
<ide>
<ide> expect(Scheduler).toHaveYielded(['App']);
<ide>
<del> suspend = false;
<del> resolve();
<del> await promise;
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide>
<ide> // We should prioritize hydrating A, C and D first since we clicked in
<ide> // them. Only after they're done will we hydrate B.
<del> expect(Scheduler).toFlushAndYield([
<add> expect(Scheduler).toHaveYielded([
<ide> 'A',
<ide> 'Clicked A',
<ide> 'C',
<ide> describe('ReactDOMServerSelectiveHydration', () => {
<ide> // Nothing has been hydrated so far.
<ide> expect(Scheduler).toHaveYielded([]);
<ide>
<del> const target = createEventTarget(spanD);
<del> target.virtualclick();
<del>
<del> expect(Scheduler).toHaveYielded(['App']);
<del>
<ide> // Continuing rendering will render B next.
<del> expect(Scheduler).toFlushAndYield(['B', 'C']);
<del>
<del> suspend = false;
<del> resolve();
<del> await promise;
<add> await act(async () => {
<add> const target = createEventTarget(spanD);
<add> target.virtualclick();
<add> });
<add> expect(Scheduler).toHaveYielded(['App', 'B', 'C']);
<ide>
<ide> // After the click, we should prioritize D and the Click first,
<ide> // and only after that render A and C.
<del> expect(Scheduler).toFlushAndYield(['D', 'Clicked D', 'A']);
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<add> expect(Scheduler).toHaveYielded(['D', 'Clicked D', 'A']);
<ide>
<ide> document.body.removeChild(container);
<ide> });
<ide> describe('ReactDOMServerSelectiveHydration', () => {
<ide>
<ide> expect(Scheduler).toHaveYielded(['App']);
<ide>
<del> suspend = false;
<del> resolve();
<del> await promise;
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide>
<ide> // We should prioritize hydrating A, C and D first since we clicked in
<ide> // them. Only after they're done will we hydrate B.
<del> expect(Scheduler).toFlushAndYield([
<add> expect(Scheduler).toHaveYielded([
<ide> 'A',
<ide> 'Clicked A',
<ide> 'C',
<ide> describe('ReactDOMServerSelectiveHydration', () => {
<ide>
<ide> expect(Scheduler).toHaveYielded(['App']);
<ide>
<del> suspend = false;
<del> resolve();
<del> await promise;
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide>
<ide> // We should prioritize hydrating D first because we clicked it.
<ide> // Next we should hydrate C since that's the current hover target.
<ide> // To simplify implementation details we hydrate both B and C at
<ide> // the same time since B was already scheduled.
<ide> // This is ok because it will at least not continue for nested
<ide> // boundary. See the next test below.
<del> expect(Scheduler).toFlushAndYield([
<add> expect(Scheduler).toHaveYielded([
<ide> 'D',
<ide> 'Clicked D',
<ide> 'B', // Ideally this should be later.
<ide><path>packages/react-dom/src/events/__tests__/DOMPluginEventSystem-test.internal.js
<ide> describe('DOMPluginEventSystem', () => {
<ide> ReactDOM = require('react-dom');
<ide> Scheduler = require('scheduler');
<ide> ReactDOMServer = require('react-dom/server');
<add> act = require('react-dom/test-utils').unstable_concurrentAct;
<ide> container = document.createElement('div');
<ide> document.body.appendChild(container);
<ide> startNativeEventListenerClearDown();
<ide> describe('DOMPluginEventSystem', () => {
<ide> Scheduler.unstable_flushAll();
<ide>
<ide> // The Suspense boundary is not yet hydrated.
<del> a.click();
<add> await act(async () => {
<add> a.click();
<add> });
<ide> expect(clicks).toBe(0);
<ide>
<ide> // Resolving the promise so that rendering can complete.
<del> suspend = false;
<del> resolve();
<del> await promise;
<del>
<del> Scheduler.unstable_flushAll();
<del> jest.runAllTimers();
<add> await act(async () => {
<add> suspend = false;
<add> resolve();
<add> await promise;
<add> });
<ide>
<ide> // We're now full hydrated.
<ide>
<ide><path>packages/react-reconciler/src/ReactFiberReconciler.new.js
<ide> import {
<ide> import {StrictLegacyMode} from './ReactTypeOfMode';
<ide> import {
<ide> SyncLane,
<del> InputDiscreteHydrationLane,
<ide> SelectiveHydrationLane,
<ide> NoTimestamp,
<ide> getHighestPriorityPendingLanes,
<ide> export function attemptSynchronousHydration(fiber: Fiber): void {
<ide> // If we're still blocked after this, we need to increase
<ide> // the priority of any promises resolving within this
<ide> // boundary so that they next attempt also has higher pri.
<del> const retryLane = InputDiscreteHydrationLane;
<add> const retryLane = SyncLane;
<ide> markRetryLaneIfNotHydrated(fiber, retryLane);
<ide> break;
<ide> }
<ide> export function attemptDiscreteHydration(fiber: Fiber): void {
<ide> return;
<ide> }
<ide> const eventTime = requestEventTime();
<del> const lane = InputDiscreteHydrationLane;
<add> const lane = SyncLane;
<ide> scheduleUpdateOnFiber(fiber, lane, eventTime);
<ide> markRetryLaneIfNotHydrated(fiber, lane);
<ide> }
<ide><path>packages/react-reconciler/src/ReactFiberReconciler.old.js
<ide> import {
<ide> import {StrictLegacyMode} from './ReactTypeOfMode';
<ide> import {
<ide> SyncLane,
<del> InputDiscreteHydrationLane,
<ide> SelectiveHydrationLane,
<ide> NoTimestamp,
<ide> getHighestPriorityPendingLanes,
<ide> export function attemptSynchronousHydration(fiber: Fiber): void {
<ide> // If we're still blocked after this, we need to increase
<ide> // the priority of any promises resolving within this
<ide> // boundary so that they next attempt also has higher pri.
<del> const retryLane = InputDiscreteHydrationLane;
<add> const retryLane = SyncLane;
<ide> markRetryLaneIfNotHydrated(fiber, retryLane);
<ide> break;
<ide> }
<ide> export function attemptDiscreteHydration(fiber: Fiber): void {
<ide> return;
<ide> }
<ide> const eventTime = requestEventTime();
<del> const lane = InputDiscreteHydrationLane;
<add> const lane = SyncLane;
<ide> scheduleUpdateOnFiber(fiber, lane, eventTime);
<ide> markRetryLaneIfNotHydrated(fiber, lane);
<ide> } | 5 |
Text | Text | clarify http.clientrequest path description | 2e125cc2f3979817bc61c8445af56205935634b2 | <ide><path>doc/api/http.md
<ide> Limits maximum response headers count. If set to 0, no limit will be applied.
<ide> added: v0.4.0
<ide> -->
<ide>
<del>* {string} The request path. Read-only.
<add>* {string} The request path.
<ide>
<ide> ### request.removeHeader(name)
<ide> <!-- YAML | 1 |
Python | Python | fix some doctests | 1763770bd9e0d487cc12fe0624abd30a9c3b4cfb | <ide><path>src/transformers/models/regnet/modeling_regnet.py
<ide>
<ide> # Image classification docstring
<ide> _IMAGE_CLASS_CHECKPOINT = "facebook/regnet-y-040"
<del>_IMAGE_CLASS_EXPECTED_OUTPUT = "'tabby, tabby cat'"
<add>_IMAGE_CLASS_EXPECTED_OUTPUT = "tabby, tabby cat"
<ide>
<ide> REGNET_PRETRAINED_MODEL_ARCHIVE_LIST = [
<ide> "facebook/regnet-y-040",
<ide><path>src/transformers/models/regnet/modeling_tf_regnet.py
<ide>
<ide> # Image classification docstring
<ide> _IMAGE_CLASS_CHECKPOINT = "facebook/regnet-y-040"
<del>_IMAGE_CLASS_EXPECTED_OUTPUT = "'tabby, tabby cat'"
<add>_IMAGE_CLASS_EXPECTED_OUTPUT = "tabby, tabby cat"
<ide>
<ide> TF_REGNET_PRETRAINED_MODEL_ARCHIVE_LIST = [
<ide> "facebook/regnet-y-040",
<ide><path>src/transformers/models/segformer/modeling_segformer.py
<ide> def forward(
<ide> >>> inputs = feature_extractor(images=image, return_tensors="pt")
<ide> >>> outputs = model(**inputs)
<ide> >>> logits = outputs.logits # shape (batch_size, num_labels, height, width)
<del> >>> logits.shape
<del> (1, 150, 128, 128)
<add> >>> list(logits.shape)
<add> [1, 150, 128, 128]
<ide> ```"""
<ide> return_dict = return_dict if return_dict is not None else self.config.use_return_dict
<ide> output_hidden_states = ( | 3 |
Text | Text | update documentation location | c294c94c029259f7e0fa12a45d858950b5d43466 | <ide><path>README.md
<ide>
<ide> 
<ide>
<del>Check out our [documentation on the docs tab](https://github.com/github/atom/docs).
<add>Check out our [documentation in this
<add>repo](https://github.com/github/atom/tree/master/docs). There is also
<add>[API documentation](https://atom-docs.githubapp.com/api/index.html).
<ide>
<ide> ## Installing
<ide>
<ide> It will automatically update when a new release is available.
<ide> 2. `cd ~/github/atom`
<ide>
<ide> 3. `script/build`
<add> | 1 |
Javascript | Javascript | fix merge error | e35332611f8bedbb3ab2ce51c8f8969fa6547072 | <ide><path>packages/ember-handlebars/tests/views/collection_view_test.js
<ide> test("should give its item views the property specified by itemPropertyBinding",
<ide> equal(view.$('ul li').length, 3, "adds 3 itemView");
<ide>
<ide> view.$('ul li').each(function(i, li){
<del> equals($(li).text(), "baz", "creates the li with the property = baz");
<del> })
<add> equal(Ember.$(li).text(), "baz", "creates the li with the property = baz");
<add> });
<ide>
<ide> Ember.run(function() {
<ide> setPath(view, 'baz', "yobaz"); | 1 |
Javascript | Javascript | add tests for camera | 761f98dd5b79868d75468a7388a0cd83c74c4d09 | <ide><path>test/unit/cameras/Camera.js
<ide> module( "Camera" );
<ide>
<ide> test( "lookAt", function() {
<del> var obj = new THREE.Camera();
<del> obj.lookAt(new THREE.Vector3(0, 1, -1));
<add> var cam = new THREE.Camera();
<add> cam.lookAt(new THREE.Vector3(0, 1, -1));
<ide>
<del> ok( obj.rotation.x * (180 / Math.PI) === 45 , "x is equal" );
<add> ok( cam.rotation.x * (180 / Math.PI) === 45 , "x is equal" );
<add>});
<add>
<add>test( "clone", function() {
<add> var cam = new THREE.Camera();
<add> cam.lookAt(new THREE.Vector3(1, 2, 3));
<add>
<add> var clonedCam = cam.clone();
<add>
<add> ok( cam.matrixWorldInverse.equals(clonedCam.matrixWorldInverse) , "matrixWorldInverse is equal" );
<add> ok( cam.projectionMatrix.equals(clonedCam.projectionMatrix) , "projectionMatrix is equal" );
<ide> }); | 1 |
Ruby | Ruby | generate a new key for each service test | 56b9d0fd3a281f97463edf556d0f4b6b283d715d | <ide><path>activestorage/test/service/azure_storage_service_test.rb
<ide> class ActiveStorage::Service::AzureStorageServiceTest < ActiveSupport::TestCase
<ide> include ActiveStorage::Service::SharedServiceTests
<ide>
<ide> test "signed URL generation" do
<del> url = @service.url(FIXTURE_KEY, expires_in: 5.minutes,
<add> url = @service.url(@key, expires_in: 5.minutes,
<ide> disposition: :inline, filename: ActiveStorage::Filename.new("avatar.png"), content_type: "image/png")
<ide>
<ide> assert_match(/(\S+)&rscd=inline%3B\+filename%3D%22avatar\.png%22%3B\+filename\*%3DUTF-8%27%27avatar\.png&rsct=image%2Fpng/, url)
<ide><path>activestorage/test/service/disk_service_test.rb
<ide> class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase
<ide>
<ide> test "url generation" do
<ide> assert_match(/^https:\/\/example.com\/rails\/active_storage\/disk\/.*\/avatar\.png\?content_type=image%2Fpng&disposition=inline/,
<del> @service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: ActiveStorage::Filename.new("avatar.png"), content_type: "image/png"))
<add> @service.url(@key, expires_in: 5.minutes, disposition: :inline, filename: ActiveStorage::Filename.new("avatar.png"), content_type: "image/png"))
<ide> end
<ide>
<ide> test "headers_for_direct_upload generation" do
<del> assert_equal({ "Content-Type" => "application/json" }, @service.headers_for_direct_upload(FIXTURE_KEY, content_type: "application/json"))
<add> assert_equal({ "Content-Type" => "application/json" }, @service.headers_for_direct_upload(@key, content_type: "application/json"))
<ide> end
<ide> end
<ide><path>activestorage/test/service/gcs_service_test.rb
<ide> class ActiveStorage::Service::GCSServiceTest < ActiveSupport::TestCase
<ide>
<ide> test "signed URL generation" do
<ide> assert_match(/storage\.googleapis\.com\/.*response-content-disposition=inline.*test\.txt.*response-content-type=text%2Fplain/,
<del> @service.url(FIXTURE_KEY, expires_in: 2.minutes, disposition: :inline, filename: ActiveStorage::Filename.new("test.txt"), content_type: "text/plain"))
<add> @service.url(@key, expires_in: 2.minutes, disposition: :inline, filename: ActiveStorage::Filename.new("test.txt"), content_type: "text/plain"))
<ide> end
<ide>
<ide> test "signed URL response headers" do
<ide><path>activestorage/test/service/mirror_service_test.rb
<ide> class ActiveStorage::Service::MirrorServiceTest < ActiveSupport::TestCase
<ide> end
<ide>
<ide> test "deleting from all services" do
<del> @service.delete FIXTURE_KEY
<add> @service.delete @key
<ide>
<del> assert_not SERVICE.primary.exist?(FIXTURE_KEY)
<add> assert_not SERVICE.primary.exist?(@key)
<ide> SERVICE.mirrors.each do |mirror|
<del> assert_not mirror.exist?(FIXTURE_KEY)
<add> assert_not mirror.exist?(@key)
<ide> end
<ide> end
<ide>
<ide> test "URL generation in primary service" do
<ide> filename = ActiveStorage::Filename.new("test.txt")
<ide>
<ide> freeze_time do
<del> assert_equal @service.primary.url(FIXTURE_KEY, expires_in: 2.minutes, disposition: :inline, filename: filename, content_type: "text/plain"),
<del> @service.url(FIXTURE_KEY, expires_in: 2.minutes, disposition: :inline, filename: filename, content_type: "text/plain")
<add> assert_equal @service.primary.url(@key, expires_in: 2.minutes, disposition: :inline, filename: filename, content_type: "text/plain"),
<add> @service.url(@key, expires_in: 2.minutes, disposition: :inline, filename: filename, content_type: "text/plain")
<ide> end
<ide> end
<ide> end
<ide><path>activestorage/test/service/s3_service_test.rb
<ide> class ActiveStorage::Service::S3ServiceTest < ActiveSupport::TestCase
<ide> end
<ide>
<ide> test "signed URL generation" do
<del> url = @service.url(FIXTURE_KEY, expires_in: 5.minutes,
<add> url = @service.url(@key, expires_in: 5.minutes,
<ide> disposition: :inline, filename: ActiveStorage::Filename.new("avatar.png"), content_type: "image/png")
<ide>
<ide> assert_match(/s3(-[-a-z0-9]+)?\.(\S+)?amazonaws.com.*response-content-disposition=inline.*avatar\.png.*response-content-type=image%2Fpng/, url)
<ide><path>activestorage/test/service/shared_service_tests.rb
<ide> module ActiveStorage::Service::SharedServiceTests
<ide> extend ActiveSupport::Concern
<ide>
<del> FIXTURE_KEY = SecureRandom.base58(24)
<ide> FIXTURE_DATA = "\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\000\020\000\000\000\020\001\003\000\000\000%=m\"\000\000\000\006PLTE\000\000\000\377\377\377\245\331\237\335\000\000\0003IDATx\234c\370\377\237\341\377_\206\377\237\031\016\2603\334?\314p\1772\303\315\315\f7\215\031\356\024\203\320\275\317\f\367\201R\314\f\017\300\350\377\177\000Q\206\027(\316]\233P\000\000\000\000IEND\256B`\202".dup.force_encoding(Encoding::BINARY)
<ide>
<ide> included do
<ide> setup do
<add> @key = SecureRandom.base58(24)
<ide> @service = self.class.const_get(:SERVICE)
<del> @service.upload FIXTURE_KEY, StringIO.new(FIXTURE_DATA)
<add> @service.upload @key, StringIO.new(FIXTURE_DATA)
<ide> end
<ide>
<ide> teardown do
<del> @service.delete FIXTURE_KEY
<add> @service.delete @key
<ide> end
<ide>
<ide> test "uploading with integrity" do
<ide> module ActiveStorage::Service::SharedServiceTests
<ide> end
<ide>
<ide> test "downloading" do
<del> assert_equal FIXTURE_DATA, @service.download(FIXTURE_KEY)
<add> assert_equal FIXTURE_DATA, @service.download(@key)
<ide> end
<ide>
<ide> test "downloading in chunks" do
<ide> module ActiveStorage::Service::SharedServiceTests
<ide> end
<ide>
<ide> test "downloading partially" do
<del> assert_equal "\x10\x00\x00", @service.download_chunk(FIXTURE_KEY, 19..21)
<del> assert_equal "\x10\x00\x00", @service.download_chunk(FIXTURE_KEY, 19...22)
<add> assert_equal "\x10\x00\x00", @service.download_chunk(@key, 19..21)
<add> assert_equal "\x10\x00\x00", @service.download_chunk(@key, 19...22)
<ide> end
<ide>
<ide> test "existing" do
<del> assert @service.exist?(FIXTURE_KEY)
<del> assert_not @service.exist?(FIXTURE_KEY + "nonsense")
<add> assert @service.exist?(@key)
<add> assert_not @service.exist?(@key + "nonsense")
<ide> end
<ide>
<ide> test "deleting" do
<del> @service.delete FIXTURE_KEY
<del> assert_not @service.exist?(FIXTURE_KEY)
<add> @service.delete @key
<add> assert_not @service.exist?(@key)
<ide> end
<ide>
<ide> test "deleting nonexistent key" do | 6 |
Ruby | Ruby | extract method in github module | 5439813c2712ab02191dfeb77df589d2a001e93b | <ide><path>Library/Homebrew/utils.rb
<ide> def open url, headers={}, &block
<ide> end
<ide> end
<ide>
<add> def each_issue_matching(query, &block)
<add> uri = URI.parse("https://api.github.com/legacy/issues/search/mxcl/homebrew/open/#{query}")
<add> open(uri) { |f| Utils::JSON.load(f.read)['issues'].each(&block) }
<add> end
<add>
<ide> def issues_for_formula name
<ide> # bit basic as depends on the issue at github having the exact name of the
<ide> # formula in it. Which for stuff like objective-caml is unlikely. So we
<ide> def issues_for_formula name
<ide>
<ide> issues = []
<ide>
<del> uri = URI.parse("https://api.github.com/legacy/issues/search/mxcl/homebrew/open/#{name}")
<del>
<del> GitHub.open uri do |f|
<del> Utils::JSON.load(f.read)['issues'].each do |issue|
<del> # don't include issues that just refer to the tool in their body
<del> issues << issue['html_url'] if issue['title'].include? name
<del> end
<add> each_issue_matching(name) do |issue|
<add> # don't include issues that just refer to the tool in their body
<add> issues << issue['html_url'] if issue['title'].include? name
<ide> end
<ide>
<ide> issues
<ide> end
<ide>
<ide> def find_pull_requests rx
<ide> query = rx.source.delete('.*').gsub('\\', '')
<del> uri = URI.parse("https://api.github.com/legacy/issues/search/mxcl/homebrew/open/#{query}")
<ide>
<del> GitHub.open uri do |f|
<del> Utils::JSON.load(f.read)['issues'].each do |pull|
<del> yield pull['pull_request_url'] if rx.match pull['title'] and pull['pull_request_url']
<add> each_issue_matching(query) do |issue|
<add> if rx === issue['title'] && issue.has_key?('pull_request_url')
<add> yield issue['pull_request_url']
<ide> end
<ide> end
<ide> end | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.