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 |
|---|---|---|---|---|---|
Javascript | Javascript | remove unused gruntutils import from docs config | 687981913c8500fe5dc718303fd6be7ffe4035b0 | <ide><path>docs/config/services/gitData.js
<ide> "use strict";
<ide>
<del>var gruntUtils = require('../../../lib/grunt/utils');
<ide> var versionInfo = require('../../../lib/versions/version-info');
<ide>
<ide> /** | 1 |
Go | Go | remove api test for bind mount / | af025f2a95090974eaaf3d8792d5f467d0a637be | <ide><path>integration/api_test.go
<ide> func TestPostContainersStart(t *testing.T) {
<ide> containerKill(eng, containerID, t)
<ide> }
<ide>
<del>// Expected behaviour: using / as a bind mount source should throw an error
<del>func TestRunErrorBindMountRootSource(t *testing.T) {
<del> eng := NewTestEngine(t)
<del> defer mkDaemonFromEngine(eng, t).Nuke()
<del>
<del> containerID := createTestContainer(
<del> eng,
<del> &runconfig.Config{
<del> Image: unitTestImageID,
<del> Cmd: []string{"/bin/cat"},
<del> OpenStdin: true,
<del> },
<del> t,
<del> )
<del>
<del> hostConfigJSON, err := json.Marshal(&runconfig.HostConfig{
<del> Binds: []string{"/:/tmp"},
<del> })
<del>
<del> req, err := http.NewRequest("POST", "/containers/"+containerID+"/start", bytes.NewReader(hostConfigJSON))
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> req.Header.Set("Content-Type", "application/json")
<del>
<del> r := httptest.NewRecorder()
<del> if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
<del> t.Fatal(err)
<del> }
<del> if r.Code != http.StatusInternalServerError {
<del> containerKill(eng, containerID, t)
<del> t.Fatal("should have failed to run when using / as a source for the bind mount")
<del> }
<del>}
<del>
<ide> func TestPostContainersStop(t *testing.T) {
<ide> eng := NewTestEngine(t)
<ide> defer mkDaemonFromEngine(eng, t).Nuke() | 1 |
Javascript | Javascript | fix progresstimestamps update | 80d26ed9b12a21cecb139550d091d763c8ff1c10 | <ide><path>server/boot/challenge.js
<ide> function buildUserUpdate(
<ide> completedDate: oldChallenge.completedDate,
<ide> lastUpdated: completedChallenge.completedDate
<ide> };
<del>
<add> } else {
<ide> updateData.$push = {
<del> timestamp: Date.now(),
<del> completedChallenge: challengeId
<add> progressTimestamps: {
<add> timestamp: Date.now(),
<add> completedChallenge: challengeId
<add> }
<ide> };
<del> } else {
<ide> finalChallenge = completedChallenge;
<ide> }
<ide> | 1 |
Text | Text | fix nock response to return a body | c6c4359ef081f1f16df92cf4ba54743787996fae | <ide><path>docs/recipes/WritingTests.md
<ide> describe('async actions', () => {
<ide> it('creates FETCH_TODOS_SUCCESS when fetching todos has been done', (done) => {
<ide> nock('http://example.com/')
<ide> .get('/todos')
<del> .reply(200, { todos: ['do something'] })
<add> .reply(200, { body: { todos: ['do something'] }})
<ide>
<ide> const expectedActions = [
<ide> { type: types.FETCH_TODOS_REQUEST }, | 1 |
PHP | PHP | add macroabletrait for filesystem | b493e47579abbc8e3d64aa03d2f5b153e960f980 | <ide><path>src/Illuminate/Filesystem/Filesystem.php
<ide>
<ide> use FilesystemIterator;
<ide> use Symfony\Component\Finder\Finder;
<add>use Illuminate\Support\Traits\MacroableTrait;
<ide> use Illuminate\Contracts\Filesystem\FileNotFoundException;
<ide>
<ide> class Filesystem {
<ide>
<add> use MacroableTrait;
<add>
<ide> /**
<ide> * Determine if a file exists.
<ide> *
<ide><path>tests/Filesystem/FilesystemTest.php
<ide> public function testCleanDirectory()
<ide> }
<ide>
<ide>
<add> public function testMacro()
<add> {
<add> file_put_contents(__DIR__.'/foo.txt', 'Hello World');
<add> $files = new Filesystem;
<add> $files->macro('getFoo', function () use ($files) { return $files->get(__DIR__.'/foo.txt'); });
<add> $this->assertEquals('Hello World', $files->getFoo());
<add> @unlink(__DIR__.'/foo.txt');
<add> }
<add>
<add>
<ide> public function testFilesMethod()
<ide> {
<ide> mkdir(__DIR__.'/foo'); | 2 |
Javascript | Javascript | playerresize event on player dimension api calls | e0ed0b5cd762f83dc54a7b56e8774718485e924d | <ide><path>src/js/player.js
<ide> class Player extends Component {
<ide> * @param {number} [value]
<ide> * The value to set the `Player`'s width to.
<ide> *
<add> * @param {boolean} [skipListeners]
<add> * Skip the playerresize event trigger
<add> *
<ide> * @return {number}
<ide> * The current width of the `Player` when getting.
<ide> */
<del> width(value) {
<del> return this.dimension('width', value);
<add> width(value, skipListeners) {
<add> return this.dimension('width', value, skipListeners);
<ide> }
<ide>
<ide> /**
<ide> class Player extends Component {
<ide> * @param {number} [value]
<ide> * The value to set the `Player`'s heigth to.
<ide> *
<add> * @param {boolean} [skipListeners]
<add> * Skip the playerresize event trigger
<add> *
<ide> * @return {number}
<ide> * The current height of the `Player` when getting.
<ide> */
<del> height(value) {
<del> return this.dimension('height', value);
<add> height(value, skipListeners) {
<add> return this.dimension('height', value, skipListeners);
<ide> }
<ide>
<ide> /**
<ide> * A getter/setter for the `Player`'s width & height.
<ide> *
<add> * @fires Player#playerresize
<add> *
<ide> * @param {string} dimension
<ide> * This string can be:
<ide> * - 'width'
<ide> class Player extends Component {
<ide> * @param {number} [value]
<ide> * Value for dimension specified in the first argument.
<ide> *
<add> * @param {boolean} [skipListeners]
<add> * Skip the playerresize event trigger
<add> *
<ide> * @return {number}
<ide> * The dimension arguments value when getting (width/height).
<ide> */
<del> dimension(dimension, value) {
<add> dimension(dimension, value, skipListeners) {
<ide> const privDimension = dimension + '_';
<ide>
<ide> if (value === undefined) {
<ide> class Player extends Component {
<ide>
<ide> this[privDimension] = parsedVal;
<ide> this.updateStyleEl_();
<add>
<add> // skipListeners allows us to avoid triggering the resize event when setting both width and height
<add> if (this.isReady_ && !skipListeners) {
<add> /**
<add> * Triggered when the player is resized.
<add> *
<add> * @event Player#playerresize
<add> * @type {EventTarget~Event}
<add> */
<add> this.trigger('playerresize');
<add> }
<ide> }
<ide>
<ide> /**
<ide><path>test/unit/player.test.js
<ide> QUnit.test('player.duration() sets the value of player.cache_.duration', functio
<ide> player.duration(200);
<ide> assert.equal(player.duration(), 200, 'duration() set and get integer duration value');
<ide> });
<add>
<add>QUnit.test('should fire playerresize when player is resized', function(assert) {
<add> assert.expect(2);
<add>
<add> const player = TestHelpers.makePlayer();
<add>
<add> player.on('playerresize', function() {
<add> assert.ok(true, 'playerresize fired');
<add> });
<add>
<add> player.width(400);
<add> player.height(300);
<add>
<add> player.dispose();
<add>});
<add>
<add>QUnit.test('should fire playerresize exactly once for a two-dimensional resize', function(assert) {
<add> assert.expect(1);
<add>
<add> const player = TestHelpers.makePlayer();
<add>
<add> player.on('playerresize', function() {
<add> assert.ok(true, 'playerresize fired once');
<add> });
<add>
<add> player.dimensions(400, 300);
<add>
<add> player.dispose();
<add>}); | 2 |
Javascript | Javascript | allow specific description for cli options | 5c76d8d39df20abd039293429a1e33d175261df0 | <ide><path>lib/cli.js
<ide> const getArguments = (schema = webpackSchema) => {
<ide> const getDescription = path => {
<ide> for (const { schema } of path) {
<ide> if (schema.cli && schema.cli.helper) continue;
<add> if (schema.cliDescription) return schema.cliDescription;
<ide> if (schema.description) return schema.description;
<ide> }
<ide> }; | 1 |
PHP | PHP | fix strict typing errors | c549c091a98ed7c07eadeb9c0797a9e67e258e98 | <ide><path>src/Mailer/Transport/MailTransport.php
<ide> public function send(Message $message): array
<ide>
<ide> $message = implode($eol, (array)$message->getBody());
<ide>
<del> $params = $this->_config['additionalParameters'] ?? null;
<add> $params = $this->_config['additionalParameters'] ?? '';
<ide> $this->_mail($to, $subject, $message, $headers, $params);
<ide>
<ide> $headers .= $eol . 'To: ' . $to;
<ide> public function send(Message $message): array
<ide> * @param string $subject email's subject
<ide> * @param string $message email's body
<ide> * @param string $headers email's custom headers
<del> * @param string|null $params additional params for sending email
<add> * @param string $params additional params for sending email
<ide> * @throws \Cake\Network\Exception\SocketException if mail could not be sent
<ide> * @return void
<ide> */
<ide> protected function _mail(
<ide> string $to,
<ide> string $subject,
<ide> string $message,
<del> string $headers,
<del> ?string $params = null
<add> string $headers = '',
<add> string $params = ''
<ide> ): void {
<ide> // phpcs:disable
<ide> if (!@mail($to, $subject, $message, $headers, $params)) { | 1 |
Ruby | Ruby | use a whitelist to delegate methods to array | aa85bdba68eb981588cecfef9dea0c0fa3e1c673 | <ide><path>activerecord/lib/active_record/relation/delegation.rb
<ide> def inherited(child_class)
<ide> # may vary depending on the klass of a relation, so we create a subclass of Relation
<ide> # for each different klass, and the delegations are compiled into that subclass only.
<ide>
<del> delegate :to_xml, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to_ary, :to => :to_a
<add> delegate :&, :+, :[], :all?, :collect, :detect, :each, :each_cons,
<add> :each_with_index, :flat_map, :group_by, :include?, :length,
<add> :map, :none?, :one?, :reverse, :sample, :second, :sort, :sort_by,
<add> :to_ary, :to_set, :to_xml, :to_yaml, :to => :to_a
<add>
<ide> delegate :table_name, :quoted_table_name, :primary_key, :quoted_primary_key,
<ide> :connection, :columns_hash, :to => :klass
<ide>
<ide> def method_missing(method, *args, &block)
<ide> if @klass.respond_to?(method)
<ide> self.class.delegate_to_scoped_klass(method)
<ide> scoping { @klass.send(method, *args, &block) }
<del> elsif array_delegable?(method)
<del> self.class.delegate method, :to => :to_a
<del> to_a.send(method, *args, &block)
<ide> elsif arel.respond_to?(method)
<ide> self.class.delegate method, :to => :arel
<ide> arel.send(method, *args, &block)
<ide> def relation_class_for(klass)
<ide> end
<ide>
<ide> def respond_to?(method, include_private = false)
<del> super || array_delegable?(method) ||
<del> @klass.respond_to?(method, include_private) ||
<add> super || @klass.respond_to?(method, include_private) ||
<ide> arel.respond_to?(method, include_private)
<ide> end
<ide>
<ide> protected
<ide>
<del> def array_delegable?(method)
<del> defined = Array.method_defined?(method)
<del> if defined && method.to_s.ends_with?('!')
<del> ActiveSupport::Deprecation.warn(
<del> "Association will no longer delegate #{method} to #to_a as of Rails 4.2. You instead must first call #to_a on the association to expose the array to be acted on."
<del> )
<del> end
<del> defined
<del> end
<del>
<ide> def method_missing(method, *args, &block)
<ide> if @klass.respond_to?(method)
<ide> scoping { @klass.send(method, *args, &block) }
<del> elsif array_delegable?(method)
<del> to_a.send(method, *args, &block)
<ide> elsif arel.respond_to?(method)
<ide> arel.send(method, *args, &block)
<ide> else
<ide><path>activerecord/test/cases/relation/delegation_test.rb
<ide> module ActiveRecord
<ide> class DelegationTest < ActiveRecord::TestCase
<ide> fixtures :posts
<ide>
<del> def assert_responds(target, method)
<del> assert target.respond_to?(method)
<del> assert_nothing_raised do
<del> method_arity = target.to_a.method(method).arity
<add> def call_method(target, method)
<add> method_arity = target.to_a.method(method).arity
<ide>
<del> if method_arity.zero?
<add> if method_arity.zero?
<add> target.send(method)
<add> elsif method_arity < 0
<add> if method == :shuffle!
<ide> target.send(method)
<del> elsif method_arity < 0
<del> if method == :shuffle!
<del> target.send(method)
<del> else
<del> target.send(method, 1)
<del> end
<ide> else
<del> raise NotImplementedError
<add> target.send(method, 1)
<ide> end
<add> elsif method_arity == 1
<add> target.send(method, 1)
<add> else
<add> raise NotImplementedError
<ide> end
<ide> end
<ide> end
<ide> def target
<ide> Post.first.comments
<ide> end
<ide>
<del> [:map, :collect].each do |method|
<del> test "##{method} is delegated" do
<del> assert_responds(target, method)
<del> assert_equal(target.pluck(:body), target.send(method) {|post| post.body })
<del> end
<del>
<del> test "##{method}! is not delegated" do
<del> assert_deprecated do
<del> assert_responds(target, "#{method}!")
<del> end
<add> [:&, :+, :[], :all?, :collect, :detect, :each, :each_cons,
<add> :each_with_index, :flat_map, :group_by, :include?, :length,
<add> :map, :none?, :one?, :reverse, :sample, :second, :sort, :sort_by,
<add> :to_ary, :to_set, :to_xml, :to_yaml].each do |method|
<add> test "association delegates #{method} to Array" do
<add> assert_respond_to target, method
<ide> end
<ide> end
<ide>
<ide> [:compact!, :flatten!, :reject!, :reverse!, :rotate!,
<del> :shuffle!, :slice!, :sort!, :sort_by!].each do |method|
<del> test "##{method} delegation is deprecated" do
<del> assert_deprecated do
<del> assert_responds(target, method)
<del> end
<del> end
<del> end
<del>
<del> [:select!, :uniq!].each do |method|
<del> test "##{method} is implemented" do
<del> assert_responds(target, method)
<add> :shuffle!, :slice!, :sort!, :sort_by!, :delete_if,
<add> :keep_if, :pop, :shift, :delete_at, :compact].each do |method|
<add> test "#{method} is not delegated to Array" do
<add> assert_raises(NoMethodError) { call_method(target, method) }
<ide> end
<ide> end
<ide> end
<ide> class DelegationRelationTest < DelegationTest
<ide> fixtures :comments
<ide>
<ide> def target
<del> Comment.where(body: 'Normal type')
<add> Comment.all
<ide> end
<ide>
<del> [:map, :collect].each do |method|
<del> test "##{method} is delegated" do
<del> assert_responds(target, method)
<del> assert_equal(target.pluck(:body), target.send(method) {|post| post.body })
<del> end
<del>
<del> test "##{method}! is not delegated" do
<del> assert_deprecated do
<del> assert_responds(target, "#{method}!")
<del> end
<add> [:&, :+, :[], :all?, :collect, :detect, :each, :each_cons,
<add> :each_with_index, :flat_map, :group_by, :include?, :length,
<add> :map, :none?, :one?, :reverse, :sample, :second, :sort, :sort_by,
<add> :to_ary, :to_set, :to_xml, :to_yaml].each do |method|
<add> test "relation delegates #{method} to Array" do
<add> assert_respond_to target, method
<ide> end
<ide> end
<ide>
<ide> [:compact!, :flatten!, :reject!, :reverse!, :rotate!,
<del> :shuffle!, :slice!, :sort!, :sort_by!].each do |method|
<del> test "##{method} delegation is deprecated" do
<del> assert_deprecated do
<del> assert_responds(target, method)
<del> end
<del> end
<del> end
<del>
<del> [:select!, :uniq!].each do |method|
<del> test "##{method} triggers an immutable error" do
<del> assert_raises ActiveRecord::ImmutableRelation do
<del> assert_responds(target, method)
<del> end
<add> :shuffle!, :slice!, :sort!, :sort_by!, :delete_if,
<add> :keep_if, :pop, :shift, :delete_at, :compact].each do |method|
<add> test "#{method} is not delegated to Array" do
<add> assert_raises(NoMethodError) { call_method(target, method) }
<ide> end
<ide> end
<ide> end | 2 |
Text | Text | add example usage | 5882c442e52921d6e8755efccd7e11a2ae405bbe | <ide><path>examples/README.md
<ide> similar API between the different models.
<ide> | [Language Model fine-tuning](#language-model-fine-tuning) | Fine-tuning the library models for language modeling on a text dataset. Causal language modeling for GPT/GPT-2, masked language modeling for BERT/RoBERTa. |
<ide> | [Language Generation](#language-generation) | Conditional text generation using the auto-regressive models of the library: GPT, GPT-2, Transformer-XL and XLNet. |
<ide> | [GLUE](#glue) | Examples running BERT/XLM/XLNet/RoBERTa on the 9 GLUE tasks. Examples feature distributed training as well as half-precision. |
<del>| [SQuAD](#squad) | Using BERT for question answering, examples with distributed training. |
<add>| [SQuAD](#squad) | Using BERT for question answering, examples with distributed training. |
<add>| [Multiple Choice](#multiple choice) | Examples running BERT/XLNet/RoBERTa on the SWAG/RACE/ARC tasks.
<ide>
<ide> ## Language model fine-tuning
<ide>
<ide> The results are the following:
<ide> loss = 0.04755385363816904
<ide> ```
<ide>
<add>##Multiple Choice
<add>
<add>Based on the script [`run_multiple_choice.py`]().
<add>
<add>#### Fine-tuning on SWAG
<add>Download [swag](https://github.com/rowanz/swagaf/tree/master/data) data
<add>
<add>```
<add>#training on 4 tesla V100(16GB) GPUS
<add>export SWAG_DIR=/path/to/swag_data_dir
<add>python ./examples/single_model_scripts/run_multiple_choice.py \
<add>--model_type roberta \
<add>--task_name swag \
<add>--model_name_or_path roberta-base \
<add>--do_train \
<add>--do_eval \
<add>--do_lower_case \
<add>--data_dir $SWAG_DIR \
<add>--learning_rate 5e-5 \
<add>--num_train_epochs 3 \
<add>--max_seq_length 80 \
<add>--output_dir models_bert/swag_base \
<add>--per_gpu_eval_batch_size=16 \
<add>--per_gpu_train_batch_size=16 \
<add>--gradient_accumulation_steps 2 \
<add>--overwrite_output
<add>```
<add>Training with the defined hyper-parameters yields the following results:
<add>```
<add>***** Eval results *****
<add>eval_acc = 0.8338998300509847
<add>eval_loss = 0.44457291918821606
<add>```
<add>
<ide> ## SQuAD
<ide>
<ide> Based on the script [`run_squad.py`](https://github.com/huggingface/pytorch-transformers/blob/master/examples/run_squad.py). | 1 |
Python | Python | do backward compatibility correctly | 0f7a8b3dfbd9c99162074aeebc80981cfd3decbb | <ide><path>numpy/conftest.py
<ide> import warnings
<ide> import pytest
<ide> import numpy
<add>import importlib
<ide>
<ide> from numpy.core.multiarray_tests import get_fpu_mode
<ide>
<ide> def pytest_collection_modifyitems(config, items):
<ide> @pytest.fixture(autouse=True)
<ide> def add_np(doctest_namespace):
<ide> doctest_namespace['np'] = numpy
<add>
<add>
<add>for module, replacement in {
<add> 'numpy.testing.decorators': 'numpy.testing.pytest_tools.decorators',
<add> 'numpy.testing.utils': 'numpy.testing.pytest_tools.utils',
<add>}.items():
<add> module = importlib.import_module(module)
<add> replacement = importlib.import_module(replacement)
<add> module.__dict__.clear()
<add> module.__dict__.update(replacement.__dict__)
<ide><path>numpy/testing/decorators.py
<ide> """
<ide> import os
<ide>
<del>if int(os.getenv('NPY_PYTEST', '0')):
<del> from .pytest_tools.decorators import *
<del>else:
<del> from .nose_tools.decorators import *
<add>from .nose_tools.decorators import *
<ide><path>numpy/testing/nosetester.py
<ide> """
<ide> import os
<ide>
<del>if int(os.getenv('NPY_PYTEST', '0')):
<del> from .pytest_tools.nosetester import *
<del>else:
<del> from .nose_tools.nosetester import *
<add>from .nose_tools.nosetester import *
<ide>
<ide>
<ide> __all__ = ['get_package_name', 'run_module_suite', 'NoseTester',
<ide><path>numpy/testing/utils.py
<ide> """
<ide> import os
<ide>
<del>if int(os.getenv('NPY_PYTEST', '0')):
<del> from .pytest_tools.utils import *
<del>else:
<del> from .nose_tools.utils import *
<add>from .nose_tools.utils import *
<ide>
<ide> __all__ = [
<ide> 'assert_equal', 'assert_almost_equal', 'assert_approx_equal', | 4 |
Ruby | Ruby | ensure environment variables are strings | 3ce5737425488d0199a0146af7d85ae448221a13 | <ide><path>Library/Homebrew/service.rb
<ide> def run_type(type = nil)
<ide> end
<ide> end
<ide>
<del> sig { params(variables: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) }
<add> sig { params(variables: T::Hash[String, String]).returns(T.nilable(T::Hash[String, String])) }
<ide> def environment_variables(variables = {})
<ide> case T.unsafe(variables)
<del> when nil
<del> @environment_variables
<ide> when Hash
<del> @environment_variables = variables
<add> @environment_variables = variables.transform_values(&:to_s)
<ide> else
<ide> raise TypeError, "Service#environment_variables expects a hash"
<ide> end
<ide><path>Library/Homebrew/test/service_spec.rb
<ide> f.class.service do
<ide> run [opt_bin/"beanstalkd", "test"]
<ide> run_type :immediate
<del> environment_variables PATH: std_service_path_env, FOO: "BAR"
<add> environment_variables PATH: std_service_path_env, FOO: "BAR", ETC_DIR: etc/"beanstalkd"
<ide> error_log_path var/"log/beanstalkd.error.log"
<ide> log_path var/"log/beanstalkd.log"
<ide> input_path var/"in/beanstalkd"
<ide> <dict>
<ide> \t<key>EnvironmentVariables</key>
<ide> \t<dict>
<add> \t\t<key>ETC_DIR</key>
<add> \t\t<string>#{HOMEBREW_PREFIX}/etc/beanstalkd</string>
<ide> \t\t<key>FOO</key>
<ide> \t\t<string>BAR</string>
<ide> \t\t<key>PATH</key> | 2 |
Javascript | Javascript | remove settimeout for body existance | 8000c6cf20f682ef11bc52656efdaeb965c0dffa | <ide><path>src/core.js
<ide> jQuery.extend({
<ide> return;
<ide> }
<ide>
<del> // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
<del> if ( !document.body ) {
<del> return setTimeout( jQuery.ready );
<del> }
<del>
<ide> // Remember that the DOM is ready
<ide> jQuery.isReady = true;
<ide> | 1 |
PHP | PHP | remove unused properties and methods | bbe801cfe43f8b2ad6f97342f14b1fe79c80ae17 | <ide><path>src/View/Helper/FormHelper.php
<ide> class FormHelper extends Helper {
<ide> */
<ide> public $requestType = null;
<ide>
<del>/**
<del> * The default model being used for the current form.
<del> *
<del> * @var string
<del> */
<del> public $defaultModel = null;
<del>
<ide> /**
<ide> * Persistent default options used by input(). Set by FormHelper::create().
<ide> *
<ide> class FormHelper extends Helper {
<ide> */
<ide> protected $_unlockedFields = array();
<ide>
<del>/**
<del> * Holds the model references already loaded by this helper
<del> * product of trying to inspect them out of field names
<del> *
<del> * @var array
<del> */
<del> protected $_models = array();
<del>
<del>/**
<del> * Holds all the validation errors for models loaded and inspected
<del> * it can also be set manually to be able to display custom error messages
<del> * in the any of the input fields generated by this helper
<del> *
<del> * @var array
<del> */
<del> public $validationErrors = array();
<del>
<del>/**
<del> * Holds already used DOM ID suffixes to avoid collisions with multiple form field elements.
<del> *
<del> * @var array
<del> */
<del> protected $_domIdSuffixes = array();
<del>
<ide> /**
<ide> * Registry for input widgets.
<ide> *
<ide> public function multiCheckbox($fieldName, $options, $attributes = []) {
<ide> return $hidden . $this->widget('multicheckbox', $attributes);
<ide> }
<ide>
<del>/**
<del> * Generates a valid DOM ID suffix from a string.
<del> * Also avoids collisions when multiple values are coverted to the same suffix by
<del> * appending a numeric value.
<del> *
<del> * For pre-HTML5 IDs only characters like a-z 0-9 - _ are valid. HTML5 doesn't have that
<del> * limitation, but to avoid layout issues it still filters out some sensitive chars.
<del> *
<del> * @param string $value The value that should be transferred into a DOM ID suffix.
<del> * @param string $type Doctype to use. Defaults to html4.
<del> * @return string DOM ID
<del> */
<del> public function domIdSuffix($value, $type = 'html4') {
<del> if ($type === 'html5') {
<del> $value = str_replace(array('@', '<', '>', ' ', '"', '\''), '_', $value);
<del> } else {
<del> $value = Inflector::camelize(Inflector::slug($value));
<del> }
<del> $value = Inflector::camelize($value);
<del> $count = 1;
<del> $suffix = $value;
<del> while (in_array($suffix, $this->_domIdSuffixes)) {
<del> $suffix = $value . $count++;
<del> }
<del> $this->_domIdSuffixes[] = $suffix;
<del> return $suffix;
<del> }
<del>
<ide> /**
<ide> * Returns a SELECT element for days.
<ide> *
<ide> protected function _name($options = array(), $field = null, $key = 'name') {
<ide> return parent::_name($options, $field, $key);
<ide> }
<ide>
<del>/**
<del> * Returns an array of formatted OPTION/OPTGROUP elements
<del> *
<del> * @param array $elements
<del> * @param array $parents
<del> * @param boolean $showParents
<del> * @param array $attributes
<del> * @return array
<del> */
<del> protected function _selectOptions($elements = array(), $parents = array(), $showParents = null, $attributes = array()) {
<del> $select = array();
<del> $attributes = array_merge(
<del> array('escape' => true, 'style' => null, 'value' => null, 'class' => null),
<del> $attributes
<del> );
<del> $selectedIsEmpty = ($attributes['value'] === '' || $attributes['value'] === null);
<del> $selectedIsArray = is_array($attributes['value']);
<del>
<del> $this->_domIdSuffixes = array();
<del> foreach ($elements as $name => $title) {
<del> $htmlOptions = array();
<del> if (is_array($title) && (!isset($title['name']) || !isset($title['value']))) {
<del> if (!empty($name)) {
<del> if ($attributes['style'] === 'checkbox') {
<del> $select[] = $this->Html->useTag('fieldsetend');
<del> } else {
<del> $select[] = $this->Html->useTag('optiongroupend');
<del> }
<del> $parents[] = $name;
<del> }
<del> $select = array_merge($select, $this->_selectOptions(
<del> $title, $parents, $showParents, $attributes
<del> ));
<del>
<del> if (!empty($name)) {
<del> $name = $attributes['escape'] ? h($name) : $name;
<del> if ($attributes['style'] === 'checkbox') {
<del> $select[] = $this->Html->useTag('fieldsetstart', $name);
<del> } else {
<del> $select[] = $this->Html->useTag('optiongroup', $name, '');
<del> }
<del> }
<del> $name = null;
<del> } elseif (is_array($title)) {
<del> $htmlOptions = $title;
<del> $name = $title['value'];
<del> $title = $title['name'];
<del> unset($htmlOptions['name'], $htmlOptions['value']);
<del> }
<del>
<del> if ($name !== null) {
<del> $isNumeric = is_numeric($name);
<del> if (
<del> (!$selectedIsArray && !$selectedIsEmpty && (string)$attributes['value'] == (string)$name) ||
<del> ($selectedIsArray && in_array((string)$name, $attributes['value'], !$isNumeric))
<del> ) {
<del> if ($attributes['style'] === 'checkbox') {
<del> $htmlOptions['checked'] = true;
<del> } else {
<del> $htmlOptions['selected'] = 'selected';
<del> }
<del> }
<del>
<del> if ($showParents || (!in_array($title, $parents))) {
<del> $title = ($attributes['escape']) ? h($title) : $title;
<del>
<del> $hasDisabled = !empty($attributes['disabled']);
<del> if ($hasDisabled) {
<del> $disabledIsArray = is_array($attributes['disabled']);
<del> if ($disabledIsArray) {
<del> $disabledIsNumeric = is_numeric($name);
<del> }
<del> }
<del> if (
<del> $hasDisabled &&
<del> $disabledIsArray &&
<del> in_array((string)$name, $attributes['disabled'], !$disabledIsNumeric)
<del> ) {
<del> $htmlOptions['disabled'] = 'disabled';
<del> }
<del> if ($hasDisabled && !$disabledIsArray && $attributes['style'] === 'checkbox') {
<del> $htmlOptions['disabled'] = $attributes['disabled'] === true ? 'disabled' : $attributes['disabled'];
<del> }
<del>
<del> if ($attributes['style'] === 'checkbox') {
<del> $htmlOptions['value'] = $name;
<del>
<del> $tagName = $attributes['id'] . $this->domIdSuffix($name);
<del> $htmlOptions['id'] = $tagName;
<del> $label = array('for' => $tagName);
<del>
<del> if (isset($htmlOptions['checked']) && $htmlOptions['checked'] === true) {
<del> $label['class'] = 'selected';
<del> }
<del>
<del> $name = $attributes['name'];
<del>
<del> if (empty($attributes['class'])) {
<del> $attributes['class'] = 'checkbox';
<del> } elseif ($attributes['class'] === 'form-error') {
<del> $attributes['class'] = 'checkbox ' . $attributes['class'];
<del> }
<del> $label = $this->label(null, $title, $label);
<del> $item = $this->Html->useTag('checkboxmultiple', $name, $htmlOptions);
<del> $select[] = $this->Html->div($attributes['class'], $item . $label);
<del> } else {
<del> if ($attributes['escape']) {
<del> $name = h($name);
<del> }
<del> $select[] = $this->Html->useTag('selectoption', $name, $htmlOptions, $title);
<del> }
<del> }
<del> }
<del> }
<del>
<del> return array_reverse($select, true);
<del> }
<del>
<ide> /**
<ide> * Generates option lists for common <select /> menus
<ide> * | 1 |
Ruby | Ruby | remove unnecessary mocha stub | 2af162c4626f39e4b337d5f6f606c56bee0e544e | <ide><path>activerecord/test/cases/tasks/database_tasks_test.rb
<ide> def test_ignores_configurations_without_databases
<ide>
<ide> def test_ignores_remote_databases
<ide> @configurations["development"].merge!("host" => "my.server.tld")
<del> $stderr.stubs(:puts)
<ide>
<ide> assert_not_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
<ide> ActiveRecord::Tasks::DatabaseTasks.create_all | 1 |
Ruby | Ruby | avoid double type cast when serializing attributes | 8e383fdad662339700c2715a9d144b4cdebe75ec | <ide><path>activemodel/lib/active_model/attribute.rb
<ide> def type_cast(value)
<ide> type.cast(value)
<ide> end
<ide>
<add> def value_for_database
<add> Type::SerializeCastValue.serialize(type, value)
<add> end
<add>
<ide> def came_from_user?
<ide> !type.value_constructed_by_mass_assignment?(value_before_type_cast)
<ide> end
<ide><path>activemodel/lib/active_model/type.rb
<ide> # frozen_string_literal: true
<ide>
<ide> require "active_model/type/helpers"
<add>require "active_model/type/serialize_cast_value"
<ide> require "active_model/type/value"
<ide>
<ide> require "active_model/type/big_integer"
<ide><path>activemodel/lib/active_model/type/big_integer.rb
<ide> module Type
<ide> # All casting and serialization are performed in the same way as the
<ide> # standard ActiveModel::Type::Integer type.
<ide> class BigInteger < Integer
<add> include SerializeCastValue
<add>
<add> def serialize_cast_value(value) # :nodoc:
<add> value
<add> end
<add>
<ide> private
<ide> def max_value
<ide> ::Float::INFINITY
<ide><path>activemodel/lib/active_model/type/boolean.rb
<ide> module Type
<ide> # - Empty strings are coerced to +nil+.
<ide> # - All other values will be coerced to +true+.
<ide> class Boolean < Value
<add> include SerializeCastValue
<add>
<ide> FALSE_VALUES = [
<ide> false, 0,
<ide> "0", :"0",
<ide><path>activemodel/lib/active_model/type/date.rb
<ide> module Type
<ide> # String values are parsed using the ISO 8601 date format. Any other values
<ide> # are cast using their +to_date+ method, if it exists.
<ide> class Date < Value
<add> include SerializeCastValue
<ide> include Helpers::Timezone
<ide> include Helpers::AcceptsMultiparameterTime.new
<ide>
<ide><path>activemodel/lib/active_model/type/date_time.rb
<ide> module Type
<ide> # attribute :start, :datetime, precision: 4
<ide> # end
<ide> class DateTime < Value
<add> include SerializeCastValue
<ide> include Helpers::Timezone
<ide> include Helpers::TimeValue
<ide> include Helpers::AcceptsMultiparameterTime.new(
<ide> def type
<ide> :datetime
<ide> end
<ide>
<add> alias :serialize_cast_value :serialize_time_value # :nodoc:
<add>
<ide> private
<ide> def cast_value(value)
<ide> return apply_seconds_precision(value) unless value.is_a?(::String)
<ide><path>activemodel/lib/active_model/type/decimal.rb
<ide> module Type
<ide> # attribute :weight, :decimal, precision: 24
<ide> # end
<ide> class Decimal < Value
<add> include SerializeCastValue
<ide> include Helpers::Numeric
<ide> BIGDECIMAL_PRECISION = 18
<ide>
<ide><path>activemodel/lib/active_model/type/float.rb
<ide> module Type
<ide> # - <tt>"-Infinity"</tt> is cast to <tt>-Float::INFINITY</tt>.
<ide> # - <tt>"NaN"</tt> is cast to <tt>Float::NAN</tt>.
<ide> class Float < Value
<add> include SerializeCastValue
<ide> include Helpers::Numeric
<ide>
<ide> def type
<ide><path>activemodel/lib/active_model/type/helpers/time_value.rb
<ide> def serialize(value)
<ide>
<ide> value
<ide> end
<add> alias :serialize_time_value :serialize
<ide>
<ide> def apply_seconds_precision(value)
<ide> return value unless precision && value.respond_to?(:nsec)
<ide><path>activemodel/lib/active_model/type/immutable_string.rb
<ide> module Type
<ide> #
<ide> # person.active # => "aye"
<ide> class ImmutableString < Value
<add> include SerializeCastValue
<add>
<ide> def initialize(**args)
<ide> @true = -(args.delete(:true)&.to_s || "t")
<ide> @false = -(args.delete(:false)&.to_s || "f")
<ide><path>activemodel/lib/active_model/type/integer.rb
<ide> module Type
<ide> # attribute :age, :integer, limit: 6
<ide> # end
<ide> class Integer < Value
<add> include SerializeCastValue
<ide> include Helpers::Numeric
<ide>
<ide> # Column storage size in bytes.
<ide> def serialize(value)
<ide> ensure_in_range(super)
<ide> end
<ide>
<add> def serialize_cast_value(value) # :nodoc:
<add> ensure_in_range(value)
<add> end
<add>
<ide> def serializable?(value)
<ide> cast_value = cast(value)
<ide> in_range?(cast_value) || begin
<ide><path>activemodel/lib/active_model/type/serialize_cast_value.rb
<add># frozen_string_literal: true
<add>
<add>module ActiveModel
<add> module Type
<add> module SerializeCastValue # :nodoc:
<add> def self.included(klass)
<add> unless klass.respond_to?(:included_serialize_cast_value)
<add> klass.singleton_class.attr_accessor :included_serialize_cast_value
<add> klass.attr_reader :itself_if_class_included_serialize_cast_value
<add> end
<add> klass.included_serialize_cast_value = true
<add> end
<add>
<add> def self.serialize(type, value)
<add> # Verify that `type.class` explicitly included SerializeCastValue.
<add> # Using `type.equal?(type.itself_if_...)` is a performant way to also
<add> # ensure that `type` is not just a DelegateClass instance (e.g.
<add> # ActiveRecord::Type::Serialized) unintentionally delegating
<add> # SerializeCastValue methods.
<add> if type.equal?((type.itself_if_class_included_serialize_cast_value rescue nil))
<add> type.serialize_cast_value(value)
<add> else
<add> type.serialize(value)
<add> end
<add> end
<add>
<add> def initialize(...)
<add> @itself_if_class_included_serialize_cast_value = self if self.class.included_serialize_cast_value
<add> super
<add> end
<add>
<add> def serialize_cast_value(value)
<add> value
<add> end
<add> end
<add> end
<add>end
<ide><path>activemodel/lib/active_model/type/string.rb
<ide> module Type
<ide> # However, it accounts for mutable strings, so dirty tracking can properly
<ide> # check if a string has changed.
<ide> class String < ImmutableString
<add> include SerializeCastValue
<add>
<ide> def changed_in_place?(raw_old_value, new_value)
<ide> if new_value.is_a?(::String)
<ide> raw_old_value != new_value
<ide><path>activemodel/lib/active_model/type/time.rb
<ide> module Type
<ide> # attribute :start, :time, precision: 4
<ide> # end
<ide> class Time < Value
<add> include SerializeCastValue
<ide> include Helpers::Timezone
<ide> include Helpers::TimeValue
<ide> include Helpers::AcceptsMultiparameterTime.new(
<ide> def user_input_in_time_zone(value)
<ide> super(value)
<ide> end
<ide>
<add> alias :serialize_cast_value :serialize_time_value # :nodoc:
<add>
<ide> private
<ide> def cast_value(value)
<ide> return apply_seconds_precision(value) unless value.is_a?(::String)
<ide><path>activemodel/lib/active_model/type/value.rb
<ide> module Type
<ide> # The base class for all attribute types. This class also serves as the
<ide> # default type for attributes that do not specify a type.
<ide> class Value
<add> include SerializeCastValue
<ide> attr_reader :precision, :scale, :limit
<ide>
<ide> # Initializes a type with three basic configuration settings: precision,
<ide> # limit, and scale. The Value base class does not define behavior for
<ide> # these settings. It uses them for equality comparison and hash key
<ide> # generation only.
<ide> def initialize(precision: nil, limit: nil, scale: nil)
<add> super()
<ide> @precision = precision
<ide> @scale = scale
<ide> @limit = limit
<ide><path>activemodel/test/cases/attribute_test.rb
<ide> def deserialize(value)
<ide> assert_equal "serialize(cast(whatever))", attribute.value_for_database
<ide> end
<ide>
<add> test "from_user + value_for_database uses serialize_cast_value when possible" do
<add> @type = Class.new(InscribingType) do
<add> include Type::SerializeCastValue
<add>
<add> def serialize_cast_value(value)
<add> "serialize_cast_value(#{value})"
<add> end
<add> end.new
<add>
<add> attribute = Attribute.from_user(nil, "whatever", @type)
<add>
<add> assert_equal "serialize_cast_value(cast(whatever))", attribute.value_for_database
<add> end
<add>
<ide> test "duping dups the value" do
<ide> attribute = Attribute.from_database(nil, "a value", @type)
<ide>
<ide><path>activemodel/test/cases/type/big_integer_test.rb
<ide> def test_large_values
<ide> type = Type::BigInteger.new
<ide> assert_equal 9999999999999999999999999999999, type.serialize(9999999999999999999999999999999)
<ide> end
<add>
<add> test "serialize_cast_value is equivalent to serialize after cast" do
<add> type = Type::BigInteger.new
<add> value = type.cast(9999999999999999999999999999999)
<add>
<add> assert_equal type.serialize(value), type.serialize_cast_value(value)
<add> assert_equal type.serialize(-value), type.serialize_cast_value(-value)
<add> end
<ide> end
<ide> end
<ide> end
<ide><path>activemodel/test/cases/type/date_time_test.rb
<ide> def test_hash_with_wrong_keys
<ide> assert_equal "Provided hash {:a=>1} doesn't contain necessary keys: [1, 2, 3]", error.message
<ide> end
<ide>
<add> test "serialize_cast_value is equivalent to serialize after cast" do
<add> type = Type::DateTime.new(precision: 1)
<add> value = type.cast("1999-12-31 12:34:56.789 -1000")
<add>
<add> assert_equal type.serialize(value), type.serialize_cast_value(value)
<add> end
<add>
<ide> private
<ide> def with_timezone_config(default:)
<ide> old_zone_default = ::Time.zone_default
<ide><path>activemodel/test/cases/type/integer_test.rb
<ide> class IntegerTest < ActiveModel::TestCase
<ide> type.serialize(9999999999999999999999999999999)
<ide> end
<ide> end
<add>
<add> test "serialize_cast_value enforces range" do
<add> type = Integer.new
<add>
<add> assert_raises(ActiveModel::RangeError) do
<add> type.serialize_cast_value(-2147483649)
<add> end
<add>
<add> assert_raises(ActiveModel::RangeError) do
<add> type.serialize_cast_value(2147483648)
<add> end
<add> end
<ide> end
<ide> end
<ide> end
<ide><path>activemodel/test/cases/type/serialize_cast_value_test.rb
<add># frozen_string_literal: true
<add>
<add>require "cases/helper"
<add>
<add>module ActiveModel
<add> module Type
<add> class SerializeCastValueTest < ActiveModel::TestCase
<add> class DoesNotIncludeModule
<add> def serialize(value)
<add> "serialize(#{value})"
<add> end
<add>
<add> def serialize_cast_value(value)
<add> raise "this should never be called"
<add> end
<add> end
<add>
<add> class IncludesModule < DoesNotIncludeModule
<add> include SerializeCastValue
<add>
<add> def serialize_cast_value(value)
<add> super("serialize_cast_value(#{value})")
<add> end
<add> end
<add>
<add> test "calls #serialize when a class does not include SerializeCastValue" do
<add> assert_equal "serialize(foo)", SerializeCastValue.serialize(DoesNotIncludeModule.new, "foo")
<add> end
<add>
<add> test "calls #serialize_cast_value when a class directly includes SerializeCastValue" do
<add> assert_equal "serialize_cast_value(foo)", SerializeCastValue.serialize(IncludesModule.new, "foo")
<add> end
<add>
<add> test "calls #serialize when a subclass does not directly include SerializeCastValue" do
<add> subclass = Class.new(IncludesModule)
<add> assert_equal "serialize(foo)", SerializeCastValue.serialize(subclass.new, "foo")
<add> end
<add>
<add> test "calls #serialize_cast_value when a subclass re-includes SerializeCastValue" do
<add> subclass = Class.new(IncludesModule)
<add> subclass.include SerializeCastValue
<add> assert_equal "serialize_cast_value(foo)", SerializeCastValue.serialize(subclass.new, "foo")
<add> end
<add>
<add> test "calls #serialize when a delegate class does not include SerializeCastValue" do
<add> delegate_class = DelegateClass(IncludesModule)
<add> assert_equal "serialize(foo)", SerializeCastValue.serialize(delegate_class.new(IncludesModule.new), "foo")
<add> end
<add>
<add> test "calls #serialize_cast_value when a delegate class includes SerializeCastValue" do
<add> delegate_class = DelegateClass(IncludesModule)
<add> delegate_class.include SerializeCastValue
<add> assert_equal "serialize_cast_value(foo)", SerializeCastValue.serialize(delegate_class.new(IncludesModule.new), "foo")
<add> end
<add> end
<add> end
<add>end
<ide><path>activemodel/test/cases/type/time_test.rb
<ide> def test_user_input_in_time_zone
<ide> assert_equal offset, type.user_input_in_time_zone(time_string).formatted_offset
<ide> end
<ide> end
<add>
<add> test "serialize_cast_value is equivalent to serialize after cast" do
<add> type = Type::Time.new(precision: 1)
<add> value = type.cast("1999-12-31T12:34:56.789-10:00")
<add>
<add> assert_equal type.serialize(value), type.serialize_cast_value(value)
<add> end
<ide> end
<ide> end
<ide> end
<ide><path>activerecord/lib/active_record/type/date.rb
<ide> module ActiveRecord
<ide> module Type
<ide> class Date < ActiveModel::Type::Date
<add> include ActiveModel::Type::SerializeCastValue
<ide> include Internal::Timezone
<ide> end
<ide> end
<ide><path>activerecord/lib/active_record/type/date_time.rb
<ide> module ActiveRecord
<ide> module Type
<ide> class DateTime < ActiveModel::Type::DateTime
<add> include ActiveModel::Type::SerializeCastValue
<ide> include Internal::Timezone
<ide> end
<ide> end
<ide><path>activerecord/lib/active_record/type/decimal_without_scale.rb
<ide> module ActiveRecord
<ide> module Type
<ide> class DecimalWithoutScale < ActiveModel::Type::BigInteger # :nodoc:
<add> include ActiveModel::Type::SerializeCastValue
<add>
<ide> def type
<ide> :decimal
<ide> end
<ide><path>activerecord/lib/active_record/type/text.rb
<ide> module ActiveRecord
<ide> module Type
<ide> class Text < ActiveModel::Type::String # :nodoc:
<add> include ActiveModel::Type::SerializeCastValue
<add>
<ide> def type
<ide> :text
<ide> end
<ide><path>activerecord/lib/active_record/type/time.rb
<ide> module ActiveRecord
<ide> module Type
<ide> class Time < ActiveModel::Type::Time
<add> include ActiveModel::Type::SerializeCastValue
<ide> include Internal::Timezone
<ide>
<ide> class Value < DelegateClass(::Time) # :nodoc:
<ide> def serialize(value)
<ide> end
<ide> end
<ide>
<add> def serialize_cast_value(value) # :nodoc:
<add> Value.new(super) if value
<add> end
<add>
<ide> private
<ide> def cast_value(value)
<ide> case value = super
<ide><path>activerecord/lib/active_record/type/unsigned_integer.rb
<ide> module ActiveRecord
<ide> module Type
<ide> class UnsignedInteger < ActiveModel::Type::Integer # :nodoc:
<add> include ActiveModel::Type::SerializeCastValue
<add>
<ide> private
<ide> def max_value
<ide> super * 2
<ide><path>activerecord/test/cases/type/date_time_test.rb
<ide> def test_datetime_seconds_precision_applied_to_timestamp
<ide> p = Task.create!(starting: ::Time.now)
<ide> assert_equal p.starting.usec, p.reload.starting.usec
<ide> end
<add>
<add> test "serialize_cast_value is equivalent to serialize after cast" do
<add> type = Type::DateTime.new(precision: 1)
<add> value = type.cast("1999-12-31 12:34:56.789 -1000")
<add>
<add> assert_equal type.serialize(value), type.serialize_cast_value(value)
<add> end
<ide> end
<ide> end
<ide> end
<ide><path>activerecord/test/cases/type/time_test.rb
<ide> def test_default_year_is_correct
<ide> assert_equal expected_time, topic.bonus_time
<ide> assert_instance_of ::Time, topic.bonus_time
<ide> end
<add>
<add> test "serialize_cast_value is equivalent to serialize after cast" do
<add> type = Type::Time.new(precision: 1)
<add> value = type.cast("1999-12-31T12:34:56.789-10:00")
<add>
<add> assert_equal type.serialize(value), type.serialize_cast_value(value)
<add> assert_instance_of type.serialize(value).class, type.serialize_cast_value(value)
<add> assert_instance_of type.serialize(nil).class, type.serialize_cast_value(nil)
<add> end
<ide> end
<ide> end
<ide> end
<ide><path>activerecord/test/cases/type/unsigned_integer_test.rb
<ide> class UnsignedIntegerTest < ActiveRecord::TestCase
<ide> UnsignedInteger.new.serialize(-1)
<ide> end
<ide> end
<add>
<add> test "serialize_cast_value enforces range" do
<add> type = UnsignedInteger.new
<add>
<add> assert_raises(ActiveModel::RangeError) do
<add> type.serialize_cast_value(-1)
<add> end
<add>
<add> assert_raises(ActiveModel::RangeError) do
<add> type.serialize_cast_value(4294967296)
<add> end
<add> end
<ide> end
<ide> end
<ide> end | 30 |
Javascript | Javascript | add hasfipscrypto to test/common.js | 8ac852fec0c6a946f02fd64d99689880e51d0bdb | <ide><path>test/common.js
<ide> Object.defineProperty(exports, 'opensslCli', {get: function() {
<ide> return opensslCli;
<ide> }, enumerable: true });
<ide>
<del>Object.defineProperty(exports, 'hasCrypto', {get: function() {
<del> return process.versions.openssl ? true : false;
<del>}});
<add>Object.defineProperty(exports, 'hasCrypto', {
<add> get: function() {
<add> return process.versions.openssl ? true : false;
<add> }
<add>});
<add>
<add>Object.defineProperty(exports, 'hasFipsCrypto', {
<add> get: function() {
<add> return process.config.variables.openssl_fips ? true : false;
<add> }
<add>});
<ide>
<ide> if (exports.isWindows) {
<ide> exports.PIPE = '\\\\.\\pipe\\libuv-test'; | 1 |
Javascript | Javascript | remove attribute match from quickis | 746074f0f74b0c0916fb2db2b6370c324822f31a | <ide><path>src/event.js
<ide> var rnamespaces = /\.(.*)$/,
<ide> rhoverHack = /\bhover(\.\S+)?/,
<ide> rkeyEvent = /^key/,
<ide> rmouseEvent = /^(?:mouse|contextmenu)|click/,
<del> rquickIs = /^([\w\-]+)?(?:#([\w\-]+))?(?:\.([\w\-]+))?(?:\[([\w+\-]+)=["']?([\w\-]*)["']?\])?$/,
<add> rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
<ide> quickParse = function( selector ) {
<ide> var quick = rquickIs.exec( selector );
<ide> if ( quick ) {
<del> // 0 1 2 3 4 5
<del> // [ _, tag, id, class, attrName, attrValue ]
<add> // 0 1 2 3
<add> // [ _, tag, id, class ]
<ide> quick[1] = ( quick[1] || "" ).toLowerCase();
<del> quick[3] = quick[3] && new RegExp( "(?:^|\\w)" + quick[3] + "(?:\\w|$)" );
<add> quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
<ide> }
<ide> return quick;
<ide> },
<ide> quickIs = function( elem, m ) {
<ide> return (
<ide> (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
<ide> (!m[2] || elem.id === m[2]) &&
<del> (!m[3] || m[3].test( elem.className )) &&
<del> (!m[4] || elem.getAttribute( m[4] ) == m[5])
<add> (!m[3] || m[3].test( elem.className ))
<ide> );
<ide> };
<ide>
<ide><path>test/unit/event.js
<ide> test(".on and .off", function() {
<ide> });
<ide>
<ide> test("delegated events quickIs", function() {
<del> expect(17);
<add> expect(14);
<ide> var markup = jQuery(
<ide> '<div>'+
<ide> '<p class="D">'+
<del> 'dead<b devo="cool">beat</b>club'+
<add> 'dead<b class="devo-like">beat</b>club'+
<ide> '</p>'+
<ide> '<q id="famous">'+
<ide> 'worked<em>or</em>borked?<em></em>'+
<ide> test("delegated events quickIs", function() {
<ide> .appendTo( "body" )
<ide> .on( "blink", "em", func )
<ide> .on( "blink", ".D", func )
<add> .on( "blink", ".devo-like", func )
<add> .on( "blink", ".devo", func )
<ide> .on( "blink", ".d", func )
<ide> .on( "blink", "p.d", func )
<del> .on( "blink", "[devo=cool]", func )
<del> .on( "blink", "[devo='NO']", func )
<ide> .on( "blink", "#famous", func );
<ide>
<del> check( "[devo=cool]", "b|[devo=cool] p|.D" );
<del> check( "[devo='']", "" );
<add> check( ".devo-like", "b|.devo-like p|.D" );
<add> check( ".devo", "" );
<ide> check( "p", "p|.D" );
<del> check( "b", "b|[devo=cool] p|.D" );
<add> check( "b", "b|.devo-like p|.D" );
<ide> check( "em", "em|em q|#famous em|em q|#famous" );
<ide>
<del> markup.find( "b" ).attr( "devo", "NO" );
<del> check( "b", "b|[devo='NO'] p|.D" );
<del>
<del> markup
<del> .on( "blink", ".tricky", function() {
<del> ok( false, "triggered on wrong class name match" );
<del> })
<del> .find( "p" )
<del> .attr( "class", "tricky-match" )
<del> .trigger( "blink" );
<del>
<ide> markup.remove();
<ide> });
<ide> | 2 |
Go | Go | fix offline image transfert | be282b57d561bdb7e686ed8d4f7b6327e7a65b70 | <ide><path>server.go
<ide> func (srv *Server) exportImage(image *Image, tempdir string) error {
<ide> // temporary directory
<ide> tmpImageDir := path.Join(tempdir, i.ID)
<ide> if err := os.Mkdir(tmpImageDir, os.ModeDir); err != nil {
<add> if os.IsExist(err) {
<add> return nil
<add> }
<ide> return err
<ide> }
<ide> | 1 |
Javascript | Javascript | support instanceof operator | 0d8e6452ecd4923220134ed8a3c78cafb6ed82c1 | <ide><path>src/moment.js
<ide> moment.defineLocale = defineLocale;
<ide> moment.weekdaysShort = weekdaysShort;
<ide> moment.normalizeUnits = normalizeUnits;
<ide> moment.relativeTimeThreshold = relativeTimeThreshold;
<add>moment.prototype = fn;
<ide>
<ide> export default moment;
<ide><path>src/test/moment/instanceof.js
<add>import { module, test } from '../qunit';
<add>import moment from '../../moment';
<add>
<add>module('instanceof');
<add>
<add>test('instanceof', function (assert) {
<add> var mm = moment([2010, 0, 1]);
<add>
<add> var extend = function (a, b) {
<add> var i;
<add> for (i in b) {
<add> a[i] = b[i];
<add> }
<add> return a;
<add> };
<add>
<add> assert.equal(moment() instanceof moment, true, 'simple moment object');
<add> assert.equal(extend({}, moment()) instanceof moment, false, 'extended moment object');
<add> assert.equal(moment(null) instanceof moment, true, 'invalid moment object');
<add>
<add> assert.equal(new Date() instanceof moment, false, 'date object is not moment object');
<add> assert.equal(Object instanceof moment, false, 'Object is not moment object');
<add> assert.equal('foo' instanceof moment, false, 'string is not moment object');
<add> assert.equal(1 instanceof moment, false, 'number is not moment object');
<add> assert.equal(NaN instanceof moment, false, 'NaN is not moment object');
<add> assert.equal(null instanceof moment, false, 'null is not moment object');
<add> assert.equal(undefined instanceof moment, false, 'undefined is not moment object');
<add>});
<ide>\ No newline at end of file | 2 |
PHP | PHP | add the find method to the eloquent query class | a68d2242d3a60e2d3fdd0a40aba0fbeaed2aa40b | <ide><path>laravel/database/eloquent/query.php
<ide> public function __construct($model)
<ide> $this->table = $this->table();
<ide> }
<ide>
<add> /**
<add> * Find a model by its primary key.
<add> *
<add> * @param mixed $id
<add> * @param array $columns
<add> * @return mixed
<add> */
<add> public function find($id, $columns = array('*'))
<add> {
<add> $model = $this->model;
<add>
<add> $this->table->where($model::$key, '=', $id);
<add>
<add> return $this->first($columns);
<add> }
<add>
<ide> /**
<ide> * Get the first model result for the query.
<ide> * | 1 |
Javascript | Javascript | upgrade compilation to es6 | 86169bd7ebcb39c9664e7d34123c243146cf206e | <ide><path>lib/Compilation.js
<ide> /*
<ide> MIT License http://www.opensource.org/licenses/mit-license.php
<ide> Author Tobias Koppers @sokra
<del>*/
<del>var async = require("async");
<del>
<del>var Tapable = require("tapable");
<del>var EntryModuleNotFoundError = require("./EntryModuleNotFoundError");
<del>var ModuleNotFoundError = require("./ModuleNotFoundError");
<del>var ModuleDependencyWarning = require("./ModuleDependencyWarning");
<del>var Module = require("./Module");
<del>var Chunk = require("./Chunk");
<del>var Entrypoint = require("./Entrypoint");
<del>var Stats = require("./Stats");
<del>var MainTemplate = require("./MainTemplate");
<del>var ChunkTemplate = require("./ChunkTemplate");
<del>var HotUpdateChunkTemplate = require("./HotUpdateChunkTemplate");
<del>var ModuleTemplate = require("./ModuleTemplate");
<del>var Dependency = require("./Dependency");
<del>var ChunkRenderError = require("./ChunkRenderError");
<del>var CachedSource = require("webpack-sources").CachedSource;
<del>
<del>function Compilation(compiler) {
<del> Tapable.call(this);
<del> this.compiler = compiler;
<del> this.resolvers = compiler.resolvers;
<del> this.inputFileSystem = compiler.inputFileSystem;
<del>
<del> var options = this.options = compiler.options;
<del> this.outputOptions = options && options.output;
<del> this.bail = options && options.bail;
<del> this.profile = options && options.profile;
<del> this.performance = options && options.performance;
<del>
<del> this.mainTemplate = new MainTemplate(this.outputOptions);
<del> this.chunkTemplate = new ChunkTemplate(this.outputOptions);
<del> this.hotUpdateChunkTemplate = new HotUpdateChunkTemplate(this.outputOptions);
<del> this.moduleTemplate = new ModuleTemplate(this.outputOptions);
<del>
<del> this.entries = [];
<del> this.preparedChunks = [];
<del> this.entrypoints = {};
<del> this.chunks = [];
<del> this.namedChunks = {};
<del> this.modules = [];
<del> this._modules = {};
<del> this.cache = null;
<del> this.records = null;
<del> this.nextFreeModuleIndex = undefined;
<del> this.nextFreeModuleIndex2 = undefined;
<del> this.additionalChunkAssets = [];
<del> this.assets = {};
<del> this.errors = [];
<del> this.warnings = [];
<del> this.children = [];
<del> this.dependencyFactories = new Map();
<del> this.dependencyTemplates = new Map();
<del>}
<del>module.exports = Compilation;
<add> */
<add>"use strict";
<add>
<add>const async = require("async");
<add>
<add>const Tapable = require("tapable");
<add>const EntryModuleNotFoundError = require("./EntryModuleNotFoundError");
<add>const ModuleNotFoundError = require("./ModuleNotFoundError");
<add>const ModuleDependencyWarning = require("./ModuleDependencyWarning");
<add>const Module = require("./Module");
<add>const Chunk = require("./Chunk");
<add>const Entrypoint = require("./Entrypoint");
<add>const Stats = require("./Stats");
<add>const MainTemplate = require("./MainTemplate");
<add>const ChunkTemplate = require("./ChunkTemplate");
<add>const HotUpdateChunkTemplate = require("./HotUpdateChunkTemplate");
<add>const ModuleTemplate = require("./ModuleTemplate");
<add>const Dependency = require("./Dependency");
<add>const ChunkRenderError = require("./ChunkRenderError");
<add>const CachedSource = require("webpack-sources").CachedSource;
<ide>
<del>Compilation.prototype = Object.create(Tapable.prototype);
<del>Compilation.prototype.constructor = Compilation;
<add>function byId(a, b) {
<add> if(a.id < b.id) return -1;
<add> if(a.id > b.id) return 1;
<add> return 0;
<add>}
<ide>
<del>Compilation.prototype.templatesPlugin = function(name, fn) {
<del> this.mainTemplate.plugin(name, fn);
<del> this.chunkTemplate.plugin(name, fn);
<del>};
<add>class Compilation extends Tapable {
<add> constructor(compiler) {
<add> super();
<add> this.compiler = compiler;
<add> this.resolvers = compiler.resolvers;
<add> this.inputFileSystem = compiler.inputFileSystem;
<add>
<add> const options = this.options = compiler.options;
<add> this.outputOptions = options && options.output;
<add> this.bail = options && options.bail;
<add> this.profile = options && options.profile;
<add> this.performance = options && options.performance;
<add>
<add> this.mainTemplate = new MainTemplate(this.outputOptions);
<add> this.chunkTemplate = new ChunkTemplate(this.outputOptions);
<add> this.hotUpdateChunkTemplate = new HotUpdateChunkTemplate(this.outputOptions);
<add> this.moduleTemplate = new ModuleTemplate(this.outputOptions);
<add>
<add> this.entries = [];
<add> this.preparedChunks = [];
<add> this.entrypoints = {};
<add> this.chunks = [];
<add> this.namedChunks = {};
<add> this.modules = [];
<add> this._modules = {};
<add> this.cache = null;
<add> this.records = null;
<add> this.nextFreeModuleIndex = undefined;
<add> this.nextFreeModuleIndex2 = undefined;
<add> this.additionalChunkAssets = [];
<add> this.assets = {};
<add> this.errors = [];
<add> this.warnings = [];
<add> this.children = [];
<add> this.dependencyFactories = new Map();
<add> this.dependencyTemplates = new Map();
<add> }
<ide>
<del>Compilation.prototype.addModule = function(module, cacheGroup) {
<del> cacheGroup = cacheGroup || "m";
<del> var identifier = module.identifier();
<del> if(this._modules[identifier]) {
<del> return false;
<add> templatesPlugin(name, fn) {
<add> this.mainTemplate.plugin(name, fn);
<add> this.chunkTemplate.plugin(name, fn);
<ide> }
<del> if(this.cache && this.cache[cacheGroup + identifier]) {
<del> var cacheModule = this.cache[cacheGroup + identifier];
<ide>
<del> var rebuild = true;
<del> if(!cacheModule.error && cacheModule.cacheable && this.fileTimestamps && this.contextTimestamps) {
<del> rebuild = cacheModule.needRebuild(this.fileTimestamps, this.contextTimestamps);
<add> addModule(module, cacheGroup) {
<add> cacheGroup = cacheGroup || "m";
<add> const identifier = module.identifier();
<add> if(this._modules[identifier]) {
<add> return false;
<ide> }
<add> if(this.cache && this.cache[cacheGroup + identifier]) {
<add> const cacheModule = this.cache[cacheGroup + identifier];
<ide>
<del> if(!rebuild) {
<del> cacheModule.disconnect();
<del> this._modules[identifier] = cacheModule;
<del> this.modules.push(cacheModule);
<del> cacheModule.errors.forEach(function(err) {
<del> this.errors.push(err);
<del> }, this);
<del> cacheModule.warnings.forEach(function(err) {
<del> this.warnings.push(err);
<del> }, this);
<del> return cacheModule;
<del> } else {
<del> module.lastId = cacheModule.id;
<del> }
<del> }
<del> module.unbuild();
<del> this._modules[identifier] = module;
<del> if(this.cache) {
<del> this.cache[cacheGroup + identifier] = module;
<del> }
<del> this.modules.push(module);
<del> return true;
<del>};
<del>
<del>Compilation.prototype.getModule = function(module) {
<del> var identifier = module.identifier();
<del> return this._modules[identifier];
<del>};
<del>
<del>Compilation.prototype.findModule = function(identifier) {
<del> return this._modules[identifier];
<del>};
<del>
<del>Compilation.prototype.buildModule = function(module, optional, origin, dependencies, thisCallback) {
<del> var _this = this;
<del> _this.applyPlugins1("build-module", module);
<del> if(module.building) return module.building.push(thisCallback);
<del> var building = module.building = [thisCallback];
<del>
<del> function callback(err) {
<del> module.building = undefined;
<del> building.forEach(function(cb) {
<del> cb(err);
<del> });
<del> }
<del> module.build(_this.options, this, _this.resolvers.normal, _this.inputFileSystem, function(err) {
<del> module.errors.forEach(function(err) {
<del> err.origin = origin;
<del> err.dependencies = dependencies;
<del> if(optional)
<del> _this.warnings.push(err);
<del> else
<del> _this.errors.push(err);
<del> }, this);
<del> module.warnings.forEach(function(err) {
<del> err.origin = origin;
<del> err.dependencies = dependencies;
<del> _this.warnings.push(err);
<del> }, this);
<del> module.dependencies.sort(Dependency.compare);
<del> if(err) {
<del> _this.applyPlugins2("failed-module", module, err);
<del> return callback(err);
<del> }
<del> _this.applyPlugins1("succeed-module", module);
<del> return callback();
<del> });
<del>};
<del>
<del>Compilation.prototype.processModuleDependencies = function(module, callback) {
<del> var dependencies = [];
<del>
<del> function addDependency(dep) {
<del> for(var i = 0; i < dependencies.length; i++) {
<del> if(dep.isEqualResource(dependencies[i][0])) {
<del> return dependencies[i].push(dep);
<add> let rebuild = true;
<add> if(!cacheModule.error && cacheModule.cacheable && this.fileTimestamps && this.contextTimestamps) {
<add> rebuild = cacheModule.needRebuild(this.fileTimestamps, this.contextTimestamps);
<ide> }
<del> }
<del> dependencies.push([dep]);
<del> }
<ide>
<del> function addDependenciesBlock(block) {
<del> if(block.dependencies) {
<del> block.dependencies.forEach(addDependency);
<del> }
<del> if(block.blocks) {
<del> block.blocks.forEach(addDependenciesBlock);
<add> if(!rebuild) {
<add> cacheModule.disconnect();
<add> this._modules[identifier] = cacheModule;
<add> this.modules.push(cacheModule);
<add> cacheModule.errors.forEach(err => this.errors.push(err), this);
<add> cacheModule.warnings.forEach(err => this.warnings.push(err), this);
<add> return cacheModule;
<add> } else {
<add> module.lastId = cacheModule.id;
<add> }
<ide> }
<del> if(block.variables) {
<del> block.variables.forEach(function(v) {
<del> v.dependencies.forEach(addDependency);
<del> });
<add> module.unbuild();
<add> this._modules[identifier] = module;
<add> if(this.cache) {
<add> this.cache[cacheGroup + identifier] = module;
<ide> }
<add> this.modules.push(module);
<add> return true;
<ide> }
<del> addDependenciesBlock(module);
<del> this.addModuleDependencies(module, dependencies, this.bail, null, true, callback);
<del>};
<del>
<del>Compilation.prototype.addModuleDependencies = function(module, dependencies, bail, cacheGroup, recursive, callback) {
<del> var _this = this;
<del> var start = _this.profile && +new Date();
<del>
<del> var factories = [];
<del> for(var i = 0; i < dependencies.length; i++) {
<del> var factory = _this.dependencyFactories.get(dependencies[i][0].constructor);
<del> if(!factory) {
<del> return callback(new Error("No module factory available for dependency type: " + dependencies[i][0].constructor.name));
<del> }
<del> factories[i] = [factory, dependencies[i]];
<add>
<add> getModule(module) {
<add> const identifier = module.identifier();
<add> return this._modules[identifier];
<ide> }
<del> async.forEach(factories, function iteratorFactory(item, callback) {
<del> var dependencies = item[1];
<del>
<del> var errorAndCallback = function errorAndCallback(err) {
<del> err.origin = module;
<del> _this.errors.push(err);
<del> if(bail) {
<del> callback(err);
<del> } else {
<del> callback();
<del> }
<del> };
<del> var warningAndCallback = function warningAndCallback(err) {
<del> err.origin = module;
<del> _this.warnings.push(err);
<del> callback();
<del> };
<ide>
<del> var factory = item[0];
<del> factory.create({
<del> contextInfo: {
<del> issuer: module.nameForCondition && module.nameForCondition()
<del> },
<del> context: module.context,
<del> dependencies: dependencies
<del> }, function factoryCallback(err, dependentModule) {
<del> function isOptional() {
<del> return dependencies.filter(function(d) {
<del> return !d.optional;
<del> }).length === 0;
<add> findModule(identifier) {
<add> return this._modules[identifier];
<add> }
<add>
<add> buildModule(module, optional, origin, dependencies, thisCallback) {
<add> this.applyPlugins1("build-module", module);
<add> if(module.building) return module.building.push(thisCallback);
<add> const building = module.building = [thisCallback];
<add>
<add> function callback(err) {
<add> module.building = undefined;
<add> building.forEach(cb => cb(err));
<add> }
<add> module.build(this.options, this, this.resolvers.normal, this.inputFileSystem, (err) => {
<add> module.errors.forEach(err => {
<add> err.origin = origin;
<add> err.dependencies = dependencies;
<add> if(optional)
<add> this.warnings.push(err);
<add> else
<add> this.errors.push(err);
<add> }, this);
<add> module.warnings.forEach(err => {
<add> err.origin = origin;
<add> err.dependencies = dependencies;
<add> this.warnings.push(err);
<add> }, this);
<add> module.dependencies.sort(Dependency.compare);
<add> if(err) {
<add> this.applyPlugins2("failed-module", module, err);
<add> return callback(err);
<ide> }
<add> this.applyPlugins1("succeed-module", module);
<add> return callback();
<add> });
<add> }
<ide>
<del> function errorOrWarningAndCallback(err) {
<del> if(isOptional()) {
<del> return warningAndCallback(err);
<del> } else {
<del> return errorAndCallback(err);
<add> processModuleDependencies(module, callback) {
<add> const dependencies = [];
<add>
<add> function addDependency(dep) {
<add> for(let i = 0; i < dependencies.length; i++) {
<add> if(dep.isEqualResource(dependencies[i][0])) {
<add> return dependencies[i].push(dep);
<ide> }
<ide> }
<del> if(err) {
<del> return errorOrWarningAndCallback(new ModuleNotFoundError(module, err, dependencies));
<add> dependencies.push([dep]);
<add> }
<add>
<add> function addDependenciesBlock(block) {
<add> if(block.dependencies) {
<add> block.dependencies.forEach(addDependency);
<ide> }
<del> if(!dependentModule) {
<del> return process.nextTick(callback);
<add> if(block.blocks) {
<add> block.blocks.forEach(addDependenciesBlock);
<ide> }
<del> if(_this.profile) {
<del> if(!dependentModule.profile) {
<del> dependentModule.profile = {};
<del> }
<del> var afterFactory = +new Date();
<del> dependentModule.profile.factory = afterFactory - start;
<add> if(block.variables) {
<add> block.variables.forEach(v => v.dependencies.forEach(addDependency));
<ide> }
<add> }
<add> addDependenciesBlock(module);
<add> this.addModuleDependencies(module, dependencies, this.bail, null, true, callback);
<add> }
<ide>
<del> dependentModule.issuer = module;
<del> var newModule = _this.addModule(dependentModule, cacheGroup);
<add> addModuleDependencies(module, dependencies, bail, cacheGroup, recursive, callback) {
<add> let _this = this;
<add> const start = _this.profile && +new Date();
<ide>
<del> if(!newModule) { // from cache
<del> dependentModule = _this.getModule(dependentModule);
<add> let factories = [];
<add> for(let i = 0; i < dependencies.length; i++) {
<add> const factory = _this.dependencyFactories.get(dependencies[i][0].constructor);
<add> if(!factory) {
<add> return callback(new Error(`No module factory available for dependency type: ${dependencies[i][0].constructor.name}`));
<add> }
<add> factories[i] = [factory, dependencies[i]];
<add> }
<add> async.forEach(factories, function iteratorFactory(item, callback) {
<add> const dependencies = item[1];
<ide>
<del> if(dependentModule.optional) {
<del> dependentModule.optional = isOptional();
<add> const errorAndCallback = function errorAndCallback(err) {
<add> err.origin = module;
<add> _this.errors.push(err);
<add> if(bail) {
<add> callback(err);
<add> } else {
<add> callback();
<add> }
<add> };
<add> const warningAndCallback = function warningAndCallback(err) {
<add> err.origin = module;
<add> _this.warnings.push(err);
<add> callback();
<add> };
<add>
<add> const factory = item[0];
<add> factory.create({
<add> contextInfo: {
<add> issuer: module.nameForCondition && module.nameForCondition()
<add> },
<add> context: module.context,
<add> dependencies: dependencies
<add> }, function factoryCallback(err, dependentModule) {
<add> let afterFactory;
<add>
<add> function isOptional() {
<add> return dependencies.filter(d => !d.optional).length === 0;
<ide> }
<ide>
<del> dependencies.forEach(function(dep) {
<del> dep.module = dependentModule;
<del> dependentModule.addReason(module, dep);
<del> });
<del>
<del> if(_this.profile) {
<del> if(!module.profile) {
<del> module.profile = {};
<add> function errorOrWarningAndCallback(err) {
<add> if(isOptional()) {
<add> return warningAndCallback(err);
<add> } else {
<add> return errorAndCallback(err);
<ide> }
<del> var time = +new Date() - start;
<del> if(!module.profile.dependencies || time > module.profile.dependencies) {
<del> module.profile.dependencies = time;
<add> }
<add> if(err) {
<add> return errorOrWarningAndCallback(new ModuleNotFoundError(module, err, dependencies));
<add> }
<add> if(!dependentModule) {
<add> return process.nextTick(callback);
<add> }
<add> if(_this.profile) {
<add> if(!dependentModule.profile) {
<add> dependentModule.profile = {};
<ide> }
<add> afterFactory = +new Date();
<add> dependentModule.profile.factory = afterFactory - start;
<ide> }
<ide>
<del> return process.nextTick(callback);
<del> }
<add> dependentModule.issuer = module;
<add> const newModule = _this.addModule(dependentModule, cacheGroup);
<ide>
<del> if(newModule instanceof Module) {
<del> if(_this.profile) {
<del> newModule.profile = dependentModule.profile;
<del> }
<add> if(!newModule) { // from cache
<add> dependentModule = _this.getModule(dependentModule);
<ide>
<del> newModule.optional = isOptional();
<del> newModule.issuer = dependentModule.issuer;
<del> dependentModule = newModule;
<add> if(dependentModule.optional) {
<add> dependentModule.optional = isOptional();
<add> }
<ide>
<del> dependencies.forEach(function(dep) {
<del> dep.module = dependentModule;
<del> dependentModule.addReason(module, dep);
<del> });
<add> dependencies.forEach(dep => {
<add> dep.module = dependentModule;
<add> dependentModule.addReason(module, dep);
<add> });
<ide>
<del> if(_this.profile) {
<del> var afterBuilding = +new Date();
<del> module.profile.building = afterBuilding - afterFactory;
<del> }
<add> if(_this.profile) {
<add> if(!module.profile) {
<add> module.profile = {};
<add> }
<add> const time = +new Date() - start;
<add> if(!module.profile.dependencies || time > module.profile.dependencies) {
<add> module.profile.dependencies = time;
<add> }
<add> }
<ide>
<del> if(recursive) {
<del> return process.nextTick(_this.processModuleDependencies.bind(_this, dependentModule, callback));
<del> } else {
<ide> return process.nextTick(callback);
<ide> }
<del> }
<ide>
<del> dependentModule.optional = isOptional();
<add> if(newModule instanceof Module) {
<add> if(_this.profile) {
<add> newModule.profile = dependentModule.profile;
<add> }
<ide>
<del> dependencies.forEach(function(dep) {
<del> dep.module = dependentModule;
<del> dependentModule.addReason(module, dep);
<del> });
<add> newModule.optional = isOptional();
<add> newModule.issuer = dependentModule.issuer;
<add> dependentModule = newModule;
<ide>
<del> _this.buildModule(dependentModule, isOptional(), module, dependencies, function(err) {
<del> if(err) {
<del> return errorOrWarningAndCallback(err);
<del> }
<add> dependencies.forEach(dep => {
<add> dep.module = dependentModule;
<add> dependentModule.addReason(module, dep);
<add> });
<ide>
<del> if(_this.profile) {
<del> var afterBuilding = +new Date();
<del> dependentModule.profile.building = afterBuilding - afterFactory;
<del> }
<add> if(_this.profile) {
<add> const afterBuilding = +new Date();
<add> module.profile.building = afterBuilding - afterFactory;
<add> }
<ide>
<del> if(recursive) {
<del> _this.processModuleDependencies(dependentModule, callback);
<del> } else {
<del> return callback();
<add> if(recursive) {
<add> return process.nextTick(_this.processModuleDependencies.bind(_this, dependentModule, callback));
<add> } else {
<add> return process.nextTick(callback);
<add> }
<ide> }
<del> });
<ide>
<del> });
<del> }, function finalCallbackAddModuleDependencies(err) {
<del> // In V8, the Error objects keep a reference to the functions on the stack. These warnings &
<del> // errors are created inside closures that keep a reference to the Compilation, so errors are
<del> // leaking the Compilation object. Setting _this to null workarounds the following issue in V8.
<del> // https://bugs.chromium.org/p/chromium/issues/detail?id=612191
<del> _this = null;
<del>
<del> if(err) {
<del> return callback(err);
<del> }
<add> dependentModule.optional = isOptional();
<ide>
<del> return process.nextTick(callback);
<del> });
<del>};
<add> dependencies.forEach(dep => {
<add> dep.module = dependentModule;
<add> dependentModule.addReason(module, dep);
<add> });
<ide>
<del>Compilation.prototype._addModuleChain = function process(context, dependency, onModule, callback) {
<del> var start = this.profile && +new Date();
<add> _this.buildModule(dependentModule, isOptional(), module, dependencies, err => {
<add> if(err) {
<add> return errorOrWarningAndCallback(err);
<add> }
<ide>
<del> var errorAndCallback = this.bail ? function errorAndCallback(err) {
<del> callback(err);
<del> } : function errorAndCallback(err) {
<del> err.dependencies = [dependency];
<del> this.errors.push(err);
<del> callback();
<del> }.bind(this);
<add> if(_this.profile) {
<add> const afterBuilding = +new Date();
<add> dependentModule.profile.building = afterBuilding - afterFactory;
<add> }
<ide>
<del> if(typeof dependency !== "object" || dependency === null || !dependency.constructor) {
<del> throw new Error("Parameter 'dependency' must be a Dependency");
<del> }
<add> if(recursive) {
<add> _this.processModuleDependencies(dependentModule, callback);
<add> } else {
<add> return callback();
<add> }
<add> });
<add>
<add> });
<add> }, function finalCallbackAddModuleDependencies(err) {
<add> // In V8, the Error objects keep a reference to the functions on the stack. These warnings &
<add> // errors are created inside closures that keep a reference to the Compilation, so errors are
<add> // leaking the Compilation object. Setting _this to null workarounds the following issue in V8.
<add> // https://bugs.chromium.org/p/chromium/issues/detail?id=612191
<add> _this = null;
<ide>
<del> var moduleFactory = this.dependencyFactories.get(dependency.constructor);
<del> if(!moduleFactory) {
<del> throw new Error("No dependency factory available for this dependency type: " + dependency.constructor.name);
<add> if(err) {
<add> return callback(err);
<add> }
<add>
<add> return process.nextTick(callback);
<add> });
<ide> }
<ide>
<del> moduleFactory.create({
<del> context: context,
<del> dependencies: [dependency]
<del> }, function(err, module) {
<del> if(err) {
<del> return errorAndCallback(new EntryModuleNotFoundError(err));
<add> _addModuleChain(context, dependency, onModule, callback) {
<add> const start = this.profile && +new Date();
<add>
<add> const errorAndCallback = this.bail ? function errorAndCallback(err) {
<add> callback(err);
<add> } : function errorAndCallback(err) {
<add> err.dependencies = [dependency];
<add> this.errors.push(err);
<add> callback();
<add> }.bind(this);
<add>
<add> if(typeof dependency !== "object" || dependency === null || !dependency.constructor) {
<add> throw new Error("Parameter 'dependency' must be a Dependency");
<ide> }
<ide>
<del> if(this.profile) {
<del> if(!module.profile) {
<del> module.profile = {};
<del> }
<del> var afterFactory = +new Date();
<del> module.profile.factory = afterFactory - start;
<add> const moduleFactory = this.dependencyFactories.get(dependency.constructor);
<add> if(!moduleFactory) {
<add> throw new Error(`No dependency factory available for this dependency type: ${dependency.constructor.name}`);
<ide> }
<ide>
<del> var result = this.addModule(module);
<del> if(!result) {
<del> module = this.getModule(module);
<add> moduleFactory.create({
<add> context: context,
<add> dependencies: [dependency]
<add> }, (err, module) => {
<add> if(err) {
<add> return errorAndCallback(new EntryModuleNotFoundError(err));
<add> }
<ide>
<del> onModule(module);
<add> let afterFactory;
<ide>
<ide> if(this.profile) {
<del> var afterBuilding = +new Date();
<del> module.profile.building = afterBuilding - afterFactory;
<add> if(!module.profile) {
<add> module.profile = {};
<add> }
<add> afterFactory = +new Date();
<add> module.profile.factory = afterFactory - start;
<ide> }
<ide>
<del> return callback(null, module);
<del> }
<add> const result = this.addModule(module);
<add> if(!result) {
<add> module = this.getModule(module);
<ide>
<del> if(result instanceof Module) {
<del> if(this.profile) {
<del> result.profile = module.profile;
<add> onModule(module);
<add>
<add> if(this.profile) {
<add> const afterBuilding = +new Date();
<add> module.profile.building = afterBuilding - afterFactory;
<add> }
<add>
<add> return callback(null, module);
<ide> }
<ide>
<del> module = result;
<add> if(result instanceof Module) {
<add> if(this.profile) {
<add> result.profile = module.profile;
<add> }
<add>
<add> module = result;
<add>
<add> onModule(module);
<add>
<add> moduleReady.call(this);
<add> return;
<add> }
<ide>
<ide> onModule(module);
<ide>
<del> moduleReady.call(this);
<del> return;
<del> }
<add> this.buildModule(module, false, null, null, (err) => {
<add> if(err) {
<add> return errorAndCallback(err);
<add> }
<add>
<add> if(this.profile) {
<add> const afterBuilding = +new Date();
<add> module.profile.building = afterBuilding - afterFactory;
<add> }
<ide>
<del> onModule(module);
<add> moduleReady.call(this);
<add> });
<add>
<add> function moduleReady() {
<add> this.processModuleDependencies(module, err => {
<add> if(err) {
<add> return callback(err);
<add> }
<ide>
<del> this.buildModule(module, false, null, null, function(err) {
<add> return callback(null, module);
<add> });
<add> }
<add> });
<add> }
<add>
<add> addEntry(context, entry, name, callback) {
<add> const slot = {
<add> name: name,
<add> module: null
<add> };
<add> this.preparedChunks.push(slot);
<add> this._addModuleChain(context, entry, (module) => {
<add>
<add> entry.module = module;
<add> this.entries.push(module);
<add> module.issuer = null;
<add>
<add> }, (err, module) => {
<ide> if(err) {
<del> return errorAndCallback(err);
<add> return callback(err);
<ide> }
<ide>
<del> if(this.profile) {
<del> var afterBuilding = +new Date();
<del> module.profile.building = afterBuilding - afterFactory;
<add> if(module) {
<add> slot.module = module;
<add> } else {
<add> const idx = this.preparedChunks.indexOf(slot);
<add> this.preparedChunks.splice(idx, 1);
<ide> }
<add> return callback();
<add> });
<add> }
<ide>
<del> moduleReady.call(this);
<del> }.bind(this));
<add> prefetch(context, dependency, callback) {
<add> this._addModuleChain(context, dependency, module => {
<ide>
<del> function moduleReady() {
<del> this.processModuleDependencies(module, function(err) {
<del> if(err) {
<del> return callback(err);
<del> }
<add> module.prefetched = true;
<add> module.issuer = null;
<ide>
<del> return callback(null, module);
<del> });
<del> }
<del> }.bind(this));
<del>};
<del>
<del>Compilation.prototype.addEntry = function process(context, entry, name, callback) {
<del> var slot = {
<del> name: name,
<del> module: null
<del> };
<del> this.preparedChunks.push(slot);
<del> this._addModuleChain(context, entry, function(module) {
<del>
<del> entry.module = module;
<del> this.entries.push(module);
<del> module.issuer = null;
<del>
<del> }.bind(this), function(err, module) {
<del> if(err) {
<del> return callback(err);
<add> }, callback);
<add> }
<add>
<add> rebuildModule(module, thisCallback) {
<add> if(module.variables.length || module.blocks.length)
<add> throw new Error("Cannot rebuild a complex module with variables or blocks");
<add> if(module.rebuilding) {
<add> return module.rebuilding.push(thisCallback);
<ide> }
<add> const rebuilding = module.rebuilding = [thisCallback];
<ide>
<del> if(module) {
<del> slot.module = module;
<del> } else {
<del> var idx = this.preparedChunks.indexOf(slot);
<del> this.preparedChunks.splice(idx, 1);
<add> function callback(err) {
<add> module.rebuilding = undefined;
<add> rebuilding.forEach(cb => cb(err));
<ide> }
<del> return callback();
<del> }.bind(this));
<del>};
<add> const deps = module.dependencies.slice();
<add> this.buildModule(module, false, module, null, (err) => {
<add> if(err) return callback(err);
<ide>
<del>Compilation.prototype.prefetch = function process(context, dependency, callback) {
<del> this._addModuleChain(context, dependency, function(module) {
<add> this.processModuleDependencies(module, (err) => {
<add> if(err) return callback(err);
<add> deps.forEach(d => {
<add> if(d.module && d.module.removeReason(module, d)) {
<add> module.chunks.forEach(chunk => {
<add> if(!d.module.hasReasonForChunk(chunk)) {
<add> if(d.module.removeChunk(chunk)) {
<add> this.removeChunkFromDependencies(d.module, chunk);
<add> }
<add> }
<add> });
<add> }
<add> });
<add> callback();
<add> });
<ide>
<del> module.prefetched = true;
<del> module.issuer = null;
<add> });
<add> }
<ide>
<del> }, callback);
<del>};
<add> finish() {
<add> this.applyPlugins1("finish-modules", this.modules);
<add> this.modules.forEach(m => this.reportDependencyWarnings(m, [m]));
<add> }
<ide>
<del>Compilation.prototype.rebuildModule = function(module, thisCallback) {
<del> if(module.variables.length || module.blocks.length)
<del> throw new Error("Cannot rebuild a complex module with variables or blocks");
<del> if(module.rebuilding) {
<del> return module.rebuilding.push(thisCallback);
<add> unseal() {
<add> this.applyPlugins0("unseal");
<add> this.chunks.length = 0;
<add> this.namedChunks = {};
<add> this.additionalChunkAssets.length = 0;
<add> this.assets = {};
<add> this.modules.forEach(module => module.unseal());
<ide> }
<del> var rebuilding = module.rebuilding = [thisCallback];
<ide>
<del> function callback(err) {
<del> module.rebuilding = undefined;
<del> rebuilding.forEach(function(cb) {
<del> cb(err);
<add> seal(callback) {
<add> const self = this;
<add> self.applyPlugins0("seal");
<add> self.nextFreeModuleIndex = 0;
<add> self.nextFreeModuleIndex2 = 0;
<add> self.preparedChunks.forEach(preparedChunk => {
<add> const module = preparedChunk.module;
<add> const chunk = self.addChunk(preparedChunk.name, module);
<add> const entrypoint = self.entrypoints[chunk.name] = new Entrypoint(chunk.name);
<add> entrypoint.unshiftChunk(chunk);
<add>
<add> chunk.addModule(module);
<add> module.addChunk(chunk);
<add> chunk.entryModule = module;
<add> self.assignIndex(module);
<add> self.assignDepth(module);
<add> self.processDependenciesBlockForChunk(module, chunk);
<ide> });
<del> }
<del> var deps = module.dependencies.slice();
<del> this.buildModule(module, false, module, null, function(err) {
<del> if(err) return callback(err);
<add> self.sortModules(self.modules);
<add> self.applyPlugins0("optimize");
<ide>
<del> this.processModuleDependencies(module, function(err) {
<del> if(err) return callback(err);
<del> deps.forEach(function(d) {
<del> if(d.module && d.module.removeReason(module, d)) {
<del> module.chunks.forEach(function(chunk) {
<del> if(!d.module.hasReasonForChunk(chunk)) {
<del> if(d.module.removeChunk(chunk)) {
<del> this.removeChunkFromDependencies(d.module, chunk);
<del> }
<del> }
<del> }, this);
<del> }
<del> }, this);
<del> callback();
<del> }.bind(this));
<del>
<del> }.bind(this));
<del>};
<del>
<del>Compilation.prototype.finish = function finish() {
<del> this.applyPlugins1("finish-modules", this.modules);
<del> this.modules.forEach(function(m) {
<del> this.reportDependencyWarnings(m, [m]);
<del> }, this);
<del>};
<del>
<del>Compilation.prototype.unseal = function unseal() {
<del> this.applyPlugins0("unseal");
<del> this.chunks.length = 0;
<del> this.namedChunks = {};
<del> this.additionalChunkAssets.length = 0;
<del> this.assets = {};
<del> this.modules.forEach(function(module) {
<del> module.unseal();
<del> });
<del>};
<del>
<del>Compilation.prototype.seal = function seal(callback) {
<del> var self = this;
<del> self.applyPlugins0("seal");
<del> self.nextFreeModuleIndex = 0;
<del> self.nextFreeModuleIndex2 = 0;
<del> self.preparedChunks.forEach(function(preparedChunk) {
<del> var module = preparedChunk.module;
<del> var chunk = self.addChunk(preparedChunk.name, module);
<del> var entrypoint = self.entrypoints[chunk.name] = new Entrypoint(chunk.name);
<del> entrypoint.unshiftChunk(chunk);
<del>
<del> chunk.addModule(module);
<del> module.addChunk(chunk);
<del> chunk.entryModule = module;
<del> self.assignIndex(module);
<del> self.assignDepth(module);
<del> self.processDependenciesBlockForChunk(module, chunk);
<del> }, self);
<del> self.sortModules(self.modules);
<del> self.applyPlugins0("optimize");
<del>
<del> while(self.applyPluginsBailResult1("optimize-modules-basic", self.modules) ||
<del> self.applyPluginsBailResult1("optimize-modules", self.modules) ||
<del> self.applyPluginsBailResult1("optimize-modules-advanced", self.modules)); // eslint-disable-line no-extra-semi
<del> self.applyPlugins1("after-optimize-modules", self.modules);
<del>
<del> while(self.applyPluginsBailResult1("optimize-chunks-basic", self.chunks) ||
<del> self.applyPluginsBailResult1("optimize-chunks", self.chunks) ||
<del> self.applyPluginsBailResult1("optimize-chunks-advanced", self.chunks)); // eslint-disable-line no-extra-semi
<del> self.applyPlugins1("after-optimize-chunks", self.chunks);
<del>
<del> self.applyPluginsAsyncSeries("optimize-tree", self.chunks, self.modules, function sealPart2(err) {
<del> if(err) {
<del> return callback(err);
<del> }
<add> while(self.applyPluginsBailResult1("optimize-modules-basic", self.modules) ||
<add> self.applyPluginsBailResult1("optimize-modules", self.modules) ||
<add> self.applyPluginsBailResult1("optimize-modules-advanced", self.modules)); // eslint-disable-line no-extra-semi
<add> self.applyPlugins1("after-optimize-modules", self.modules);
<ide>
<del> self.applyPlugins2("after-optimize-tree", self.chunks, self.modules);
<add> while(self.applyPluginsBailResult1("optimize-chunks-basic", self.chunks) ||
<add> self.applyPluginsBailResult1("optimize-chunks", self.chunks) ||
<add> self.applyPluginsBailResult1("optimize-chunks-advanced", self.chunks)); // eslint-disable-line no-extra-semi
<add> self.applyPlugins1("after-optimize-chunks", self.chunks);
<ide>
<del> var shouldRecord = self.applyPluginsBailResult("should-record") !== false;
<add> self.applyPluginsAsyncSeries("optimize-tree", self.chunks, self.modules, function sealPart2(err) {
<add> if(err) {
<add> return callback(err);
<add> }
<ide>
<del> self.sortItemsBeforeIds();
<add> self.applyPlugins2("after-optimize-tree", self.chunks, self.modules);
<ide>
<del> self.applyPlugins2("revive-modules", self.modules, self.records);
<del> self.applyPlugins1("optimize-module-order", self.modules);
<del> self.applyPlugins1("advanced-optimize-module-order", self.modules);
<del> self.applyPlugins1("before-module-ids", self.modules);
<del> self.applyPlugins1("module-ids", self.modules);
<del> self.applyModuleIds();
<del> self.applyPlugins1("optimize-module-ids", self.modules);
<del> self.applyPlugins1("after-optimize-module-ids", self.modules);
<add> const shouldRecord = self.applyPluginsBailResult("should-record") !== false;
<ide>
<del> self.sortItemsWithModuleIds();
<add> self.sortItemsBeforeIds();
<ide>
<del> self.applyPlugins2("revive-chunks", self.chunks, self.records);
<del> self.applyPlugins1("optimize-chunk-order", self.chunks);
<del> self.applyPlugins1("before-chunk-ids", self.chunks);
<del> self.applyChunkIds();
<del> self.applyPlugins1("optimize-chunk-ids", self.chunks);
<del> self.applyPlugins1("after-optimize-chunk-ids", self.chunks);
<add> self.applyPlugins2("revive-modules", self.modules, self.records);
<add> self.applyPlugins1("optimize-module-order", self.modules);
<add> self.applyPlugins1("advanced-optimize-module-order", self.modules);
<add> self.applyPlugins1("before-module-ids", self.modules);
<add> self.applyPlugins1("module-ids", self.modules);
<add> self.applyModuleIds();
<add> self.applyPlugins1("optimize-module-ids", self.modules);
<add> self.applyPlugins1("after-optimize-module-ids", self.modules);
<ide>
<del> self.sortItemsWithChunkIds();
<add> self.sortItemsWithModuleIds();
<ide>
<del> if(shouldRecord)
<del> self.applyPlugins2("record-modules", self.modules, self.records);
<del> if(shouldRecord)
<del> self.applyPlugins2("record-chunks", self.chunks, self.records);
<add> self.applyPlugins2("revive-chunks", self.chunks, self.records);
<add> self.applyPlugins1("optimize-chunk-order", self.chunks);
<add> self.applyPlugins1("before-chunk-ids", self.chunks);
<add> self.applyChunkIds();
<add> self.applyPlugins1("optimize-chunk-ids", self.chunks);
<add> self.applyPlugins1("after-optimize-chunk-ids", self.chunks);
<ide>
<del> self.applyPlugins0("before-hash");
<del> self.createHash();
<del> self.applyPlugins0("after-hash");
<add> self.sortItemsWithChunkIds();
<ide>
<del> if(shouldRecord)
<del> self.applyPlugins1("record-hash", self.records);
<add> if(shouldRecord)
<add> self.applyPlugins2("record-modules", self.modules, self.records);
<add> if(shouldRecord)
<add> self.applyPlugins2("record-chunks", self.chunks, self.records);
<ide>
<del> self.applyPlugins0("before-module-assets");
<del> self.createModuleAssets();
<del> if(self.applyPluginsBailResult("should-generate-chunk-assets") !== false) {
<del> self.applyPlugins0("before-chunk-assets");
<del> self.createChunkAssets();
<del> }
<del> self.applyPlugins1("additional-chunk-assets", self.chunks);
<del> self.summarizeDependencies();
<del> if(shouldRecord)
<del> self.applyPlugins2("record", self, self.records);
<add> self.applyPlugins0("before-hash");
<add> self.createHash();
<add> self.applyPlugins0("after-hash");
<ide>
<del> self.applyPluginsAsync("additional-assets", function(err) {
<del> if(err) {
<del> return callback(err);
<add> if(shouldRecord)
<add> self.applyPlugins1("record-hash", self.records);
<add>
<add> self.applyPlugins0("before-module-assets");
<add> self.createModuleAssets();
<add> if(self.applyPluginsBailResult("should-generate-chunk-assets") !== false) {
<add> self.applyPlugins0("before-chunk-assets");
<add> self.createChunkAssets();
<ide> }
<del> self.applyPluginsAsync("optimize-chunk-assets", self.chunks, function(err) {
<add> self.applyPlugins1("additional-chunk-assets", self.chunks);
<add> self.summarizeDependencies();
<add> if(shouldRecord)
<add> self.applyPlugins2("record", self, self.records);
<add>
<add> self.applyPluginsAsync("additional-assets", err => {
<ide> if(err) {
<ide> return callback(err);
<ide> }
<del> self.applyPlugins1("after-optimize-chunk-assets", self.chunks);
<del> self.applyPluginsAsync("optimize-assets", self.assets, function(err) {
<add> self.applyPluginsAsync("optimize-chunk-assets", self.chunks, err => {
<ide> if(err) {
<ide> return callback(err);
<ide> }
<del> self.applyPlugins1("after-optimize-assets", self.assets);
<del> if(self.applyPluginsBailResult("need-additional-seal")) {
<del> self.unseal();
<del> return self.seal(callback);
<del> }
<del> return self.applyPluginsAsync("after-seal", callback);
<add> self.applyPlugins1("after-optimize-chunk-assets", self.chunks);
<add> self.applyPluginsAsync("optimize-assets", self.assets, err => {
<add> if(err) {
<add> return callback(err);
<add> }
<add> self.applyPlugins1("after-optimize-assets", self.assets);
<add> if(self.applyPluginsBailResult("need-additional-seal")) {
<add> self.unseal();
<add> return self.seal(callback);
<add> }
<add> return self.applyPluginsAsync("after-seal", callback);
<add> });
<ide> });
<ide> });
<ide> });
<del> });
<del>};
<del>
<del>Compilation.prototype.sortModules = function sortModules(modules) {
<del> modules.sort(function(a, b) {
<del> if(a.index < b.index) return -1;
<del> if(a.index > b.index) return 1;
<del> return 0;
<del> });
<del>};
<del>
<del>Compilation.prototype.reportDependencyWarnings = function reportDependencyWarnings(module, blocks) {
<del> var _this = this;
<del> blocks.forEach(function(block) {
<del> block.dependencies.forEach(function(d) {
<del> var warnings = d.getWarnings();
<del> if(warnings) {
<del> warnings.forEach(function(w) {
<del> var warning = new ModuleDependencyWarning(module, w, d.loc);
<del> _this.warnings.push(warning);
<del> });
<del> }
<add> }
<add>
<add> sortModules(modules) {
<add> modules.sort((a, b) => {
<add> if(a.index < b.index) return -1;
<add> if(a.index > b.index) return 1;
<add> return 0;
<ide> });
<del> _this.reportDependencyWarnings(module, block.blocks);
<del> });
<del>};
<del>
<del>Compilation.prototype.addChunk = function addChunk(name, module, loc) {
<del> var chunk;
<del> if(name) {
<del> if(Object.prototype.hasOwnProperty.call(this.namedChunks, name)) {
<del> chunk = this.namedChunks[name];
<del> if(module) {
<del> chunk.addOrigin(module, loc);
<add> }
<add>
<add> reportDependencyWarnings(module, blocks) {
<add> blocks.forEach(block => {
<add> block.dependencies.forEach(d => {
<add> const warnings = d.getWarnings();
<add> if(warnings) {
<add> warnings.forEach(w => {
<add> const warning = new ModuleDependencyWarning(module, w, d.loc);
<add> this.warnings.push(warning);
<add> });
<add> }
<add> });
<add> this.reportDependencyWarnings(module, block.blocks);
<add> });
<add> }
<add>
<add> addChunk(name, module, loc) {
<add> let chunk;
<add> if(name) {
<add> if(Object.prototype.hasOwnProperty.call(this.namedChunks, name)) {
<add> chunk = this.namedChunks[name];
<add> if(module) {
<add> chunk.addOrigin(module, loc);
<add> }
<add> return chunk;
<ide> }
<del> return chunk;
<ide> }
<add> chunk = new Chunk(name, module, loc);
<add> this.chunks.push(chunk);
<add> if(name) {
<add> this.namedChunks[name] = chunk;
<add> }
<add> return chunk;
<ide> }
<del> chunk = new Chunk(name, module, loc);
<del> this.chunks.push(chunk);
<del> if(name) {
<del> this.namedChunks[name] = chunk;
<del> }
<del> return chunk;
<del>};
<ide>
<del>Compilation.prototype.assignIndex = function assignIndex(module) {
<del> var _this = this;
<add> assignIndex(module) {
<add> const _this = this;
<ide>
<del> function assignIndexToModule(module) {
<del> // enter module
<del> if(typeof module.index !== "number") {
<del> module.index = _this.nextFreeModuleIndex++;
<add> function assignIndexToModule(module) {
<add> // enter module
<add> if(typeof module.index !== "number") {
<add> module.index = _this.nextFreeModuleIndex++;
<ide>
<del> queue.push(function() {
<ide> // leave module
<del> module.index2 = _this.nextFreeModuleIndex2++;
<del> });
<add> queue.push(() => module.index2 = _this.nextFreeModuleIndex2++);
<ide>
<del> // enter it as block
<del> assignIndexToDependencyBlock(module);
<add> // enter it as block
<add> assignIndexToDependencyBlock(module);
<add> }
<ide> }
<del> }
<ide>
<del> function assignIndexToDependency(dependency) {
<del> if(dependency.module) {
<del> queue.push(function() {
<del> assignIndexToModule(dependency.module);
<del> });
<add> function assignIndexToDependency(dependency) {
<add> if(dependency.module) {
<add> queue.push(() => assignIndexToModule(dependency.module));
<add> }
<ide> }
<del> }
<ide>
<del> function assignIndexToDependencyBlock(block) {
<del> var allDependencies = [];
<add> function assignIndexToDependencyBlock(block) {
<add> const allDependencies = [];
<ide>
<del> function iteratorDependency(d) {
<del> allDependencies.push(d);
<del> }
<add> function iteratorDependency(d) {
<add> allDependencies.push(d);
<add> }
<ide>
<del> function iteratorBlock(b) {
<del> queue.push(function() {
<del> assignIndexToDependencyBlock(b);
<del> });
<del> }
<add> function iteratorBlock(b) {
<add> queue.push(() => assignIndexToDependencyBlock(b));
<add> }
<ide>
<del> if(block.variables) {
<del> block.variables.forEach(function(v) {
<del> v.dependencies.forEach(iteratorDependency);
<del> });
<add> if(block.variables) {
<add> block.variables.forEach(v => v.dependencies.forEach(iteratorDependency));
<add> }
<add> if(block.dependencies) {
<add> block.dependencies.forEach(iteratorDependency);
<add> }
<add> if(block.blocks) {
<add> block.blocks.slice().reverse().forEach(iteratorBlock, this);
<add> }
<add>
<add> allDependencies.reverse();
<add> allDependencies.forEach(d => queue.push(() => assignIndexToDependency(d)));
<ide> }
<del> if(block.dependencies) {
<del> block.dependencies.forEach(iteratorDependency);
<add>
<add> const queue = [() => {
<add> assignIndexToModule(module);
<add> }];
<add> while(queue.length) {
<add> queue.pop()();
<ide> }
<del> if(block.blocks) {
<del> block.blocks.slice().reverse().forEach(iteratorBlock, this);
<add> }
<add>
<add> assignDepth(module) {
<add> function assignDepthToModule(module, depth) {
<add> // enter module
<add> if(typeof module.depth === "number" && module.depth <= depth) return;
<add> module.depth = depth;
<add>
<add> // enter it as block
<add> assignDepthToDependencyBlock(module, depth + 1);
<ide> }
<ide>
<del> allDependencies.reverse();
<del> allDependencies.forEach(function(d) {
<del> queue.push(function() {
<del> assignIndexToDependency(d);
<del> });
<del> });
<del> }
<add> function assignDepthToDependency(dependency, depth) {
<add> if(dependency.module) {
<add> queue.push(() => assignDepthToModule(dependency.module, depth));
<add> }
<add> }
<ide>
<del> var queue = [function() {
<del> assignIndexToModule(module);
<del> }];
<del> while(queue.length) {
<del> queue.pop()();
<del> }
<del>};
<add> function assignDepthToDependencyBlock(block, depth) {
<add> function iteratorDependency(d) {
<add> assignDepthToDependency(d, depth);
<add> }
<ide>
<del>Compilation.prototype.assignDepth = function assignDepth(module) {
<del> function assignDepthToModule(module, depth) {
<del> // enter module
<del> if(typeof module.depth === "number" && module.depth <= depth) return;
<del> module.depth = depth;
<add> function iteratorBlock(b) {
<add> assignDepthToDependencyBlock(b, depth);
<add> }
<ide>
<del> // enter it as block
<del> assignDepthToDependencyBlock(module, depth + 1);
<del> }
<add> if(block.variables) {
<add> block.variables.forEach(v => v.dependencies.forEach(iteratorDependency, this));
<add> }
<add> if(block.dependencies) {
<add> block.dependencies.forEach(iteratorDependency);
<add> }
<add> if(block.blocks) {
<add> block.blocks.forEach(iteratorBlock, this);
<add> }
<add> }
<ide>
<del> function assignDepthToDependency(dependency, depth) {
<del> if(dependency.module) {
<del> queue.push(function() {
<del> assignDepthToModule(dependency.module, depth);
<del> });
<add> const queue = [() => {
<add> assignDepthToModule(module, 0);
<add> }];
<add> while(queue.length) {
<add> queue.pop()();
<ide> }
<ide> }
<ide>
<del> function assignDepthToDependencyBlock(block, depth) {
<del> function iteratorDependency(d) {
<del> assignDepthToDependency(d, depth);
<add> processDependenciesBlockForChunk(block, chunk) {
<add> const queue = [
<add> [block, chunk]
<add> ];
<add> while(queue.length) {
<add> const queueItem = queue.pop();
<add> block = queueItem[0];
<add> chunk = queueItem[1];
<add> if(block.variables) {
<add> block.variables.forEach(v => v.dependencies.forEach(iteratorDependency, this));
<add> }
<add> if(block.dependencies) {
<add> block.dependencies.forEach(iteratorDependency, this);
<add> }
<add> if(block.blocks) {
<add> block.blocks.forEach(iteratorBlock, this);
<add> }
<ide> }
<ide>
<ide> function iteratorBlock(b) {
<del> assignDepthToDependencyBlock(b, depth);
<add> let c;
<add> if(!b.chunks) {
<add> c = this.addChunk(b.chunkName, b.module, b.loc);
<add> b.chunks = [c];
<add> c.addBlock(b);
<add> } else {
<add> c = b.chunks[0];
<add> }
<add> chunk.addChunk(c);
<add> c.addParent(chunk);
<add> queue.push([b, c]);
<ide> }
<ide>
<del> if(block.variables) {
<del> block.variables.forEach(function(v) {
<del> v.dependencies.forEach(iteratorDependency);
<del> });
<del> }
<del> if(block.dependencies) {
<del> block.dependencies.forEach(iteratorDependency);
<del> }
<del> if(block.blocks) {
<del> block.blocks.forEach(iteratorBlock, this);
<add> function iteratorDependency(d) {
<add> if(!d.module) {
<add> return;
<add> }
<add> if(d.weak) {
<add> return;
<add> }
<add> if(chunk.addModule(d.module)) {
<add> d.module.addChunk(chunk);
<add> queue.push([d.module, chunk]);
<add> }
<ide> }
<ide> }
<ide>
<del> var queue = [function() {
<del> assignDepthToModule(module, 0);
<del> }];
<del> while(queue.length) {
<del> queue.pop()();
<del> }
<del>};
<del>
<del>Compilation.prototype.processDependenciesBlockForChunk = function processDependenciesBlockForChunk(block, chunk) {
<del> var queue = [
<del> [block, chunk]
<del> ];
<del> while(queue.length) {
<del> var queueItem = queue.pop();
<del> block = queueItem[0];
<del> chunk = queueItem[1];
<del> if(block.variables) {
<del> block.variables.forEach(function(v) {
<del> v.dependencies.forEach(iteratorDependency, this);
<del> }, this);
<del> }
<del> if(block.dependencies) {
<del> block.dependencies.forEach(iteratorDependency, this);
<del> }
<del> if(block.blocks) {
<del> block.blocks.forEach(iteratorBlock, this);
<del> }
<del> }
<add> removeChunkFromDependencies(block, chunk) {
<add> block.blocks.forEach(b => {
<add> b.chunks.forEach(c => {
<add> chunk.removeChunk(c);
<add> c.removeParent(chunk);
<add> this.removeChunkFromDependencies(b, c);
<add> });
<add> });
<ide>
<del> function iteratorBlock(b) {
<del> var c;
<del> if(!b.chunks) {
<del> c = this.addChunk(b.chunkName, b.module, b.loc);
<del> b.chunks = [c];
<del> c.addBlock(b);
<del> } else {
<del> c = b.chunks[0];
<add> function iteratorDependency(d) {
<add> if(!d.module) {
<add> return;
<add> }
<add> if(!d.module.hasReasonForChunk(chunk)) {
<add> if(d.module.removeChunk(chunk)) {
<add> this.removeChunkFromDependencies(d.module, chunk);
<add> }
<add> }
<ide> }
<del> chunk.addChunk(c);
<del> c.addParent(chunk);
<del> queue.push([b, c]);
<add> block.dependencies.forEach(iteratorDependency, this);
<add> block.variables.forEach(v => v.dependencies.forEach(iteratorDependency, this));
<ide> }
<ide>
<del> function iteratorDependency(d) {
<del> if(!d.module) {
<del> return;
<del> }
<del> if(d.weak) {
<del> return;
<del> }
<del> if(chunk.addModule(d.module)) {
<del> d.module.addChunk(chunk);
<del> queue.push([d.module, chunk]);
<del> }
<del> }
<del>};
<del>
<del>Compilation.prototype.removeChunkFromDependencies = function removeChunkFromDependencies(block, chunk) {
<del> block.blocks.forEach(function(b) {
<del> b.chunks.forEach(function(c) {
<del> chunk.removeChunk(c);
<del> c.removeParent(chunk);
<del> this.removeChunkFromDependencies(b, c);
<del> }, this);
<del> }, this);
<del>
<del> function iteratorDependency(d) {
<del> if(!d.module) {
<del> return;
<add> applyModuleIds() {
<add> const unusedIds = [];
<add> let nextFreeModuleId = 0;
<add> const usedIds = [];
<add> const usedIdMap = {};
<add> if(this.usedModuleIds) {
<add> Object.keys(this.usedModuleIds).forEach(key => {
<add> const id = this.usedModuleIds[key];
<add> if(typeof usedIdMap[id] === "undefined") {
<add> usedIds.push(id);
<add> usedIdMap[id] = id;
<add> }
<add> });
<ide> }
<del> if(!d.module.hasReasonForChunk(chunk)) {
<del> if(d.module.removeChunk(chunk)) {
<del> this.removeChunkFromDependencies(d.module, chunk);
<add> this.modules.forEach(module => {
<add> if(module.id !== null && typeof usedIdMap[module.id] === "undefined") {
<add> usedIds.push(module.id);
<add> usedIdMap[module.id] = module.id;
<ide> }
<del> }
<del> }
<del> block.dependencies.forEach(iteratorDependency, this);
<del> block.variables.forEach(function(v) {
<del> v.dependencies.forEach(iteratorDependency, this);
<del> }, this);
<del>
<del>};
<del>
<del>Compilation.prototype.applyModuleIds = function applyModuleIds() {
<del> var unusedIds = [];
<del> var nextFreeModuleId = 0;
<del> var usedIds = [];
<del> var usedIdMap = {};
<del> if(this.usedModuleIds) {
<del> Object.keys(this.usedModuleIds).forEach(function(key) {
<del> var id = this.usedModuleIds[key];
<del> if(typeof usedIdMap[id] === "undefined") {
<del> usedIds.push(id);
<del> usedIdMap[id] = id;
<add> });
<add> if(usedIds.length > 0) {
<add> const usedNumberIds = usedIds.filter(id => typeof id === "number");
<add> nextFreeModuleId = usedNumberIds.reduce((a, b) => Math.max(a, b), -1) + 1;
<add> for(let i = 0; i < nextFreeModuleId; i++) {
<add> if(usedIdMap[i] !== i)
<add> unusedIds.push(i);
<ide> }
<del> }, this);
<del> }
<del> this.modules.forEach(function(module) {
<del> if(module.id !== null && typeof usedIdMap[module.id] === "undefined") {
<del> usedIds.push(module.id);
<del> usedIdMap[module.id] = module.id;
<add> unusedIds.reverse();
<ide> }
<del> });
<del> if(usedIds.length > 0) {
<del> var usedNumberIds = usedIds.filter(function(id) {
<del> return typeof id === "number";
<add> this.modules.forEach(module => {
<add> if(module.id === null) {
<add> if(unusedIds.length > 0)
<add> module.id = unusedIds.pop();
<add> else
<add> module.id = nextFreeModuleId++;
<add> }
<ide> });
<del> nextFreeModuleId = usedNumberIds.reduce(function(a, b) {
<del> return Math.max(a, b);
<del> }, -1) + 1;
<del> for(var i = 0; i < nextFreeModuleId; i++) {
<del> if(usedIdMap[i] !== i)
<del> unusedIds.push(i);
<del> }
<del> unusedIds.reverse();
<ide> }
<del> this.modules.forEach(function(module) {
<del> if(module.id === null) {
<del> if(unusedIds.length > 0)
<del> module.id = unusedIds.pop();
<del> else
<del> module.id = nextFreeModuleId++;
<add>
<add> applyChunkIds() {
<add> const unusedIds = [];
<add> let nextFreeChunkId = 0;
<add> if(this.usedChunkIds) {
<add> const usedIds = Object.keys(this.usedChunkIds).map(key => this.usedChunkIds[key]).sort();
<add> const usedNumberIds = usedIds.filter(id => typeof id === "number");
<add> nextFreeChunkId = usedNumberIds.reduce((a, b) => Math.max(a, b), -1) + 1;
<add> for(let i = 0; i < nextFreeChunkId; i++) {
<add> if(this.usedChunkIds[i] !== i)
<add> unusedIds.push(i);
<add> }
<add> unusedIds.reverse();
<ide> }
<del> }, this);
<del>};
<del>
<del>Compilation.prototype.applyChunkIds = function applyChunkIds() {
<del> var unusedIds = [];
<del> var nextFreeChunkId = 0;
<del> if(this.usedChunkIds) {
<del> var usedIds = Object.keys(this.usedChunkIds).map(function(key) {
<del> return this.usedChunkIds[key];
<del> }, this).sort();
<del> var usedNumberIds = usedIds.filter(function(id) {
<del> return typeof id === "number";
<add> this.chunks.forEach(chunk => {
<add> if(chunk.id === null) {
<add> if(unusedIds.length > 0)
<add> chunk.id = unusedIds.pop();
<add> else
<add> chunk.id = nextFreeChunkId++;
<add> }
<add> if(!chunk.ids) {
<add> chunk.ids = [chunk.id];
<add> }
<ide> });
<del> nextFreeChunkId = usedNumberIds.reduce(function(a, b) {
<del> return Math.max(a, b);
<del> }, -1) + 1;
<del> for(var i = 0; i < nextFreeChunkId; i++) {
<del> if(this.usedChunkIds[i] !== i)
<del> unusedIds.push(i);
<del> }
<del> unusedIds.reverse();
<ide> }
<del> this.chunks.forEach(function(chunk) {
<del> if(chunk.id === null) {
<del> if(unusedIds.length > 0)
<del> chunk.id = unusedIds.pop();
<del> else
<del> chunk.id = nextFreeChunkId++;
<del> }
<del> if(!chunk.ids) {
<del> chunk.ids = [chunk.id];
<del> }
<del> }, this);
<del>};
<ide>
<del>function byId(a, b) {
<del> if(a.id < b.id) return -1;
<del> if(a.id > b.id) return 1;
<del> return 0;
<del>}
<add> sortItemsBeforeIds() {
<ide>
<del>Compilation.prototype.sortItemsBeforeIds = function sortItemsBeforeIds() {
<del>
<del>};
<del>
<del>Compilation.prototype.sortItemsWithModuleIds = function sortItemsWithModuleIds() {
<del> this.modules.sort(byId);
<del> this.modules.forEach(function(module) {
<del> module.sortItems();
<del> });
<del> this.chunks.forEach(function(chunk) {
<del> chunk.sortItems();
<del> });
<del>};
<del>
<del>Compilation.prototype.sortItemsWithChunkIds = function sortItemsWithChunkIds() {
<del> this.chunks.sort(byId);
<del> this.modules.forEach(function(module) {
<del> module.sortItems();
<del> });
<del> this.chunks.forEach(function(chunk) {
<del> chunk.sortItems();
<del> });
<del>};
<del>
<del>Compilation.prototype.summarizeDependencies = function summarizeDependencies() {
<del> function filterDups(array) {
<del> var newArray = [];
<del> for(var i = 0; i < array.length; i++) {
<del> if(i === 0 || array[i - 1] !== array[i])
<del> newArray.push(array[i]);
<del> }
<del> return newArray;
<ide> }
<del> this.fileDependencies = (this.compilationDependencies || []).slice();
<del> this.contextDependencies = [];
<del> this.missingDependencies = [];
<del> this.children.forEach(function(child) {
<del> this.fileDependencies = this.fileDependencies.concat(child.fileDependencies);
<del> this.contextDependencies = this.contextDependencies.concat(child.contextDependencies);
<del> this.missingDependencies = this.missingDependencies.concat(child.missingDependencies);
<del> }.bind(this));
<del> this.modules.forEach(function(module) {
<del> if(module.fileDependencies) {
<del> module.fileDependencies.forEach(function(item) {
<del> this.fileDependencies.push(item);
<del> }, this);
<del> }
<del> if(module.contextDependencies) {
<del> module.contextDependencies.forEach(function(item) {
<del> this.contextDependencies.push(item);
<del> }, this);
<del> }
<del> }, this);
<del> this.errors.forEach(function(error) {
<del> if(Array.isArray(error.missing)) {
<del> error.missing.forEach(function(item) {
<del> this.missingDependencies.push(item);
<del> }, this);
<add>
<add> sortItemsWithModuleIds() {
<add> this.modules.sort(byId);
<add> this.modules.forEach(module => module.sortItems());
<add> this.chunks.forEach(chunk => chunk.sortItems());
<add> }
<add>
<add> sortItemsWithChunkIds() {
<add> this.chunks.sort(byId);
<add> this.modules.forEach(module => module.sortItems());
<add> this.chunks.forEach(chunk => chunk.sortItems());
<add> }
<add>
<add> summarizeDependencies() {
<add> function filterDups(array) {
<add> const newArray = [];
<add> for(let i = 0; i < array.length; i++) {
<add> if(i === 0 || array[i - 1] !== array[i])
<add> newArray.push(array[i]);
<add> }
<add> return newArray;
<ide> }
<del> }, this);
<del> this.fileDependencies.sort();
<del> this.fileDependencies = filterDups(this.fileDependencies);
<del> this.contextDependencies.sort();
<del> this.contextDependencies = filterDups(this.contextDependencies);
<del> this.missingDependencies.sort();
<del> this.missingDependencies = filterDups(this.missingDependencies);
<del>};
<del>
<del>Compilation.prototype.createHash = function createHash() {
<del> var outputOptions = this.outputOptions;
<del> var hashFunction = outputOptions.hashFunction;
<del> var hashDigest = outputOptions.hashDigest;
<del> var hashDigestLength = outputOptions.hashDigestLength;
<del> var hash = require("crypto").createHash(hashFunction);
<del> if(outputOptions.hashSalt)
<del> hash.update(outputOptions.hashSalt);
<del> this.mainTemplate.updateHash(hash);
<del> this.chunkTemplate.updateHash(hash);
<del> this.moduleTemplate.updateHash(hash);
<del> var i, chunk;
<del> var chunks = this.chunks.slice();
<del> chunks.sort(function(a, b) {
<del> var aEntry = a.hasRuntime();
<del> var bEntry = b.hasRuntime();
<del> if(aEntry && !bEntry) return 1;
<del> if(!aEntry && bEntry) return -1;
<del> return 0;
<del> });
<del> for(i = 0; i < chunks.length; i++) {
<del> chunk = chunks[i];
<del> var chunkHash = require("crypto").createHash(hashFunction);
<add> this.fileDependencies = (this.compilationDependencies || []).slice();
<add> this.contextDependencies = [];
<add> this.missingDependencies = [];
<add> this.children.forEach(child => {
<add> this.fileDependencies = this.fileDependencies.concat(child.fileDependencies);
<add> this.contextDependencies = this.contextDependencies.concat(child.contextDependencies);
<add> this.missingDependencies = this.missingDependencies.concat(child.missingDependencies);
<add> });
<add> this.modules.forEach(module => {
<add> if(module.fileDependencies) {
<add> module.fileDependencies.forEach(item => this.fileDependencies.push(item));
<add> }
<add> if(module.contextDependencies) {
<add> module.contextDependencies.forEach(item => this.contextDependencies.push(item));
<add> }
<add> });
<add> this.errors.forEach(error => {
<add> if(Array.isArray(error.missing)) {
<add> error.missing.forEach(item => this.missingDependencies.push(item));
<add> }
<add> });
<add> this.fileDependencies.sort();
<add> this.fileDependencies = filterDups(this.fileDependencies);
<add> this.contextDependencies.sort();
<add> this.contextDependencies = filterDups(this.contextDependencies);
<add> this.missingDependencies.sort();
<add> this.missingDependencies = filterDups(this.missingDependencies);
<add> }
<add>
<add> createHash() {
<add> const outputOptions = this.outputOptions;
<add> const hashFunction = outputOptions.hashFunction;
<add> const hashDigest = outputOptions.hashDigest;
<add> const hashDigestLength = outputOptions.hashDigestLength;
<add> const hash = require("crypto").createHash(hashFunction);
<ide> if(outputOptions.hashSalt)
<ide> hash.update(outputOptions.hashSalt);
<del> chunk.updateHash(chunkHash);
<del> if(chunk.hasRuntime()) {
<del> this.mainTemplate.updateHashForChunk(chunkHash, chunk);
<del> } else {
<del> this.chunkTemplate.updateHashForChunk(chunkHash);
<add> this.mainTemplate.updateHash(hash);
<add> this.chunkTemplate.updateHash(hash);
<add> this.moduleTemplate.updateHash(hash);
<add> let chunk;
<add> const chunks = this.chunks.slice();
<add> chunks.sort((a, b) => {
<add> const aEntry = a.hasRuntime();
<add> const bEntry = b.hasRuntime();
<add> if(aEntry && !bEntry) return 1;
<add> if(!aEntry && bEntry) return -1;
<add> return 0;
<add> });
<add> for(let i = 0; i < chunks.length; i++) {
<add> chunk = chunks[i];
<add> const chunkHash = require("crypto").createHash(hashFunction);
<add> if(outputOptions.hashSalt)
<add> hash.update(outputOptions.hashSalt);
<add> chunk.updateHash(chunkHash);
<add> if(chunk.hasRuntime()) {
<add> this.mainTemplate.updateHashForChunk(chunkHash, chunk);
<add> } else {
<add> this.chunkTemplate.updateHashForChunk(chunkHash);
<add> }
<add> this.applyPlugins2("chunk-hash", chunk, chunkHash);
<add> chunk.hash = chunkHash.digest(hashDigest);
<add> hash.update(chunk.hash);
<add> chunk.renderedHash = chunk.hash.substr(0, hashDigestLength);
<ide> }
<del> this.applyPlugins2("chunk-hash", chunk, chunkHash);
<del> chunk.hash = chunkHash.digest(hashDigest);
<del> hash.update(chunk.hash);
<del> chunk.renderedHash = chunk.hash.substr(0, hashDigestLength);
<add> this.fullHash = hash.digest(hashDigest);
<add> this.hash = this.fullHash.substr(0, hashDigestLength);
<ide> }
<del> this.fullHash = hash.digest(hashDigest);
<del> this.hash = this.fullHash.substr(0, hashDigestLength);
<del>};
<del>
<del>Compilation.prototype.modifyHash = function modifyHash(update) {
<del> var outputOptions = this.outputOptions;
<del> var hashFunction = outputOptions.hashFunction;
<del> var hashDigest = outputOptions.hashDigest;
<del> var hashDigestLength = outputOptions.hashDigestLength;
<del> var hash = require("crypto").createHash(hashFunction);
<del> hash.update(this.fullHash);
<del> hash.update(update);
<del> this.fullHash = hash.digest(hashDigest);
<del> this.hash = this.fullHash.substr(0, hashDigestLength);
<del>};
<del>
<del>Compilation.prototype.createModuleAssets = function createModuleAssets() {
<del> var cacheAssetsAndApplyPlugins = function cacheAssetsAndApplyPlugins(name) {
<del> var file = this.getPath(name);
<del> this.assets[file] = module.assets[name];
<del> this.applyPlugins2("module-asset", module, file);
<add>
<add> modifyHash(update) {
<add> const outputOptions = this.outputOptions;
<add> const hashFunction = outputOptions.hashFunction;
<add> const hashDigest = outputOptions.hashDigest;
<add> const hashDigestLength = outputOptions.hashDigestLength;
<add> const hash = require("crypto").createHash(hashFunction);
<add> hash.update(this.fullHash);
<add> hash.update(update);
<add> this.fullHash = hash.digest(hashDigest);
<add> this.hash = this.fullHash.substr(0, hashDigestLength);
<ide> }
<ide>
<del> for(var i = 0; i < this.modules.length; i++) {
<del> var module = this.modules[i];
<del> if(module.assets) {
<del> Object.keys(module.assets).forEach(cacheAssetsAndApplyPlugins, this);
<add> createModuleAssets() {
<add> let module;
<add>
<add> function cacheAssetsAndApplyPlugins(name) {
<add> const file = this.getPath(name);
<add> this.assets[file] = module.assets[name];
<add> this.applyPlugins2("module-asset", module, file);
<add> }
<add>
<add> for(let i = 0; i < this.modules.length; i++) {
<add> module = this.modules[i];
<add> if(module.assets) {
<add> Object.keys(module.assets).forEach(cacheAssetsAndApplyPlugins, this);
<add> }
<ide> }
<ide> }
<del>};
<del>
<del>Compilation.prototype.createChunkAssets = function createChunkAssets() {
<del> var outputOptions = this.outputOptions;
<del> var filename = outputOptions.filename;
<del> var chunkFilename = outputOptions.chunkFilename;
<del> for(var i = 0; i < this.chunks.length; i++) {
<del> var chunk = this.chunks[i];
<del> chunk.files = [];
<del> var chunkHash = chunk.hash;
<del> var source;
<del> var file;
<del> var filenameTemplate = chunk.filenameTemplate ? chunk.filenameTemplate :
<del> chunk.isInitial() ? filename :
<del> chunkFilename;
<del> try {
<del> var useChunkHash = !chunk.hasRuntime() || (this.mainTemplate.useChunkHash && this.mainTemplate.useChunkHash(chunk));
<del> var usedHash = useChunkHash ? chunkHash : this.fullHash;
<del> if(this.cache && this.cache["c" + chunk.id] && this.cache["c" + chunk.id].hash === usedHash) {
<del> source = this.cache["c" + chunk.id].source;
<del> } else {
<del> if(chunk.hasRuntime()) {
<del> source = this.mainTemplate.render(this.hash, chunk, this.moduleTemplate, this.dependencyTemplates);
<add>
<add> createChunkAssets() {
<add> const outputOptions = this.outputOptions;
<add> const filename = outputOptions.filename;
<add> const chunkFilename = outputOptions.chunkFilename;
<add> for(let i = 0; i < this.chunks.length; i++) {
<add> const chunk = this.chunks[i];
<add> chunk.files = [];
<add> const chunkHash = chunk.hash;
<add> let source;
<add> let file;
<add> const filenameTemplate = chunk.filenameTemplate ? chunk.filenameTemplate :
<add> chunk.isInitial() ? filename :
<add> chunkFilename;
<add> try {
<add> const useChunkHash = !chunk.hasRuntime() || (this.mainTemplate.useChunkHash && this.mainTemplate.useChunkHash(chunk));
<add> const usedHash = useChunkHash ? chunkHash : this.fullHash;
<add> if(this.cache && this.cache[`c${chunk.id}`] && this.cache[`c${chunk.id}`].hash === usedHash) {
<add> source = this.cache[`c${chunk.id}`].source;
<ide> } else {
<del> source = this.chunkTemplate.render(chunk, this.moduleTemplate, this.dependencyTemplates);
<del> }
<del> if(this.cache) {
<del> this.cache["c" + chunk.id] = {
<del> hash: usedHash,
<del> source: source = (source instanceof CachedSource ? source : new CachedSource(source))
<del> };
<add> if(chunk.hasRuntime()) {
<add> source = this.mainTemplate.render(this.hash, chunk, this.moduleTemplate, this.dependencyTemplates);
<add> } else {
<add> source = this.chunkTemplate.render(chunk, this.moduleTemplate, this.dependencyTemplates);
<add> }
<add> if(this.cache) {
<add> this.cache[`c${chunk.id}`] = {
<add> hash: usedHash,
<add> source: source = (source instanceof CachedSource ? source : new CachedSource(source))
<add> };
<add> }
<ide> }
<add> file = this.getPath(filenameTemplate, {
<add> noChunkHash: !useChunkHash,
<add> chunk
<add> });
<add> if(this.assets[file])
<add> throw new Error(`Conflict: Multiple assets emit to the same filename ${file}`);
<add> this.assets[file] = source;
<add> chunk.files.push(file);
<add> this.applyPlugins2("chunk-asset", chunk, file);
<add> } catch(err) {
<add> this.errors.push(new ChunkRenderError(chunk, file || filenameTemplate, err));
<ide> }
<del> file = this.getPath(filenameTemplate, {
<del> noChunkHash: !useChunkHash,
<del> chunk: chunk
<del> });
<del> if(this.assets[file])
<del> throw new Error("Conflict: Multiple assets emit to the same filename '" + file + "'");
<del> this.assets[file] = source;
<del> chunk.files.push(file);
<del> this.applyPlugins2("chunk-asset", chunk, file);
<del> } catch(err) {
<del> this.errors.push(new ChunkRenderError(chunk, file || filenameTemplate, err));
<ide> }
<ide> }
<del>};
<del>
<del>Compilation.prototype.getPath = function(filename, data) {
<del> data = data || {};
<del> data.hash = data.hash || this.hash;
<del> return this.mainTemplate.applyPluginsWaterfall("asset-path", filename, data);
<del>};
<del>
<del>Compilation.prototype.getStats = function() {
<del> return new Stats(this);
<del>};
<del>
<del>Compilation.prototype.createChildCompiler = function(name, outputOptions) {
<del> return this.compiler.createChildCompiler(this, name, outputOptions);
<del>};
<del>
<del>Compilation.prototype.checkConstraints = function() {
<del> var usedIds = {};
<del> this.modules.forEach(function(module) {
<del> if(usedIds[module.id])
<del> throw new Error("checkConstraints: duplicate module id " + module.id);
<del> });
<del> this.chunks.forEach(function(chunk, idx) {
<del> if(this.chunks.indexOf(chunk) !== idx)
<del> throw new Error("checkConstraints: duplicate chunk in compilation " + chunk.debugId);
<del> chunk.checkConstraints();
<del> }.bind(this));
<del>};
<add>
<add> getPath(filename, data) {
<add> data = data || {};
<add> data.hash = data.hash || this.hash;
<add> return this.mainTemplate.applyPluginsWaterfall("asset-path", filename, data);
<add> }
<add>
<add> getStats() {
<add> return new Stats(this);
<add> }
<add>
<add> createChildCompiler(name, outputOptions) {
<add> return this.compiler.createChildCompiler(this, name, outputOptions);
<add> }
<add>
<add> checkConstraints() {
<add> const usedIds = {};
<add> this.modules.forEach(module => {
<add> if(usedIds[module.id])
<add> throw new Error(`checkConstraints: duplicate module id ${module.id}`);
<add> });
<add> this.chunks.forEach((chunk, idx) => {
<add> if(this.chunks.indexOf(chunk) !== idx)
<add> throw new Error(`checkConstraints: duplicate chunk in compilation ${chunk.debugId}`);
<add> chunk.checkConstraints();
<add> });
<add> }
<add>}
<add>
<add>module.exports = Compilation; | 1 |
Javascript | Javascript | prevent double attr interpolation w/ templateurl | fc115bfd0d18017f4bcef1e39fb22d97a98f8ab1 | <ide><path>src/ng/compile.js
<ide> function $CompileProvider($provide) {
<ide> origAsyncDirective = directives.shift(),
<ide> // The fact that we have to copy and patch the directive seems wrong!
<ide> derivedSyncDirective = extend({}, origAsyncDirective, {
<del> controller: null, templateUrl: null, transclude: null
<add> controller: null, templateUrl: null, transclude: null, scope: null
<ide> });
<ide>
<ide> $compileNode.html('');
<ide><path>test/ng/compileSpec.js
<ide> describe('$compile', function() {
<ide> expect($exceptionHandler.errors).toEqual([]);
<ide> });
<ide> });
<add>
<add>
<add> it('should resume delayed compilation without duplicates when in a repeater', function() {
<add> // this is a test for a regression
<add> // scope creation, isolate watcher setup, controller instantiation, etc should happen
<add> // only once even if we are dealing with delayed compilation of a node due to templateUrl
<add> // and the template node is in a repeater
<add>
<add> var controllerSpy = jasmine.createSpy('controller');
<add>
<add> module(function($compileProvider) {
<add> $compileProvider.directive('delayed', valueFn({
<add> controller: controllerSpy,
<add> templateUrl: 'delayed.html',
<add> scope: {
<add> title: '@'
<add> }
<add> }));
<add> });
<add>
<add> inject(function($templateCache, $compile, $rootScope) {
<add> $rootScope.coolTitle = 'boom!';
<add> $templateCache.put('delayed.html', '<div>{{title}}</div>');
<add> element = $compile(
<add> '<div><div ng-repeat="i in [1,2]"><div delayed title="{{coolTitle + i}}"></div>|</div></div>'
<add> )($rootScope);
<add>
<add> $rootScope.$apply();
<add>
<add> expect(controllerSpy.callCount).toBe(2);
<add> expect(element.text()).toBe('boom!1|boom!2|');
<add> });
<add> });
<ide> });
<ide>
<ide> | 2 |
PHP | PHP | remove type hint | 4d8f0a1a72fe9ea915570df2ef58cbafd43ec96a | <ide><path>src/Illuminate/Database/Eloquent/Model.php
<ide> public function is($model)
<ide> /**
<ide> * Determine if two models are not the same.
<ide> *
<del> * @param \Illuminate\Database\Eloquent\Model $model
<add> * @param \Illuminate\Database\Eloquent\Model|null $model
<ide> * @return bool
<ide> */
<del> public function isNot(Model $model)
<add> public function isNot($model)
<ide> {
<ide> return ! $this->is($model);
<ide> } | 1 |
Text | Text | remove uannecessary require | f054855bbf15201487f4a7fdac8812c958330af1 | <ide><path>doc/api/n-api.md
<ide> napi_status napi_create_async_work(napi_env env,
<ide> - `[in] env`: The environment that the API is invoked under.
<ide> - `[in] async_resource`: An optional object associated with the async work
<ide> that will be passed to possible async_hooks [`init` hooks][].
<del>- `[in] async_resource_name`: An identifier for the kind of resource that is
<add>- `[in] async_resource_name`: Identifier for the kind of resource that is
<ide> being provided for diagnostic information exposed by the `async_hooks` API.
<ide> - `[in] execute`: The native function which should be called to excute
<ide> the logic asynchronously.
<ide> napi_status napi_async_init(napi_env env,
<ide> - `[in] env`: The environment that the API is invoked under.
<ide> - `[in] async_resource`: An optional object associated with the async work
<ide> that will be passed to possible `async_hooks` [`init` hooks][].
<del>- `[in] async_resource_name`: Required identifier for the kind of resource
<add>- `[in] async_resource_name`: Identifier for the kind of resource
<ide> that is being provided for diagnostic information exposed by the
<ide> `async_hooks` API.
<ide> - `[out] result`: The initialized async context. | 1 |
PHP | PHP | add ascii() and utf8() validators | ca939252454f4af7d680c3186f3de0d1abbf0fce | <ide><path>src/Validation/Validation.php
<ide> public static function longitude($value, array $options = [])
<ide> return self::geoCoordinate($value, $options);
<ide> }
<ide>
<add> /**
<add> * Check that the input value is within the ascii byte range.
<add> *
<add> * This method will reject all non-string values.
<add> *
<add> * @param string $value The value to check
<add> * @return bool
<add> */
<add> public static function ascii($value)
<add> {
<add> if (!is_string($value)) {
<add> return false;
<add> }
<add> return strlen($value) <= mb_strlen($value, 'utf-8');
<add> }
<add>
<add> /**
<add> * Check that the input value is a utf8 string.
<add> *
<add> * This method will reject all non-string values.
<add> *
<add> * # Options
<add> *
<add> * - `extended` - Disallow bytes higher within the basic multilingual plane.
<add> * MySQL's older utf8 encoding type does not allow characters above
<add> * the basic multilingual plane. Defaults to false.
<add> *
<add> * @param string $value The value to check
<add> * @return bool
<add> */
<add> public static function utf8($value, array $options = [])
<add> {
<add> if (!is_string($value)) {
<add> return false;
<add> }
<add> $options += ['extended' => false];
<add> if ($options['extended']) {
<add> return true;
<add> }
<add> return preg_match('/[\x{10000}-\x{10FFFF}]/u', $value) === 0;
<add> }
<add>
<ide> /**
<ide> * Check that the input value is an integer
<ide> *
<ide><path>tests/TestCase/Validation/ValidationTest.php
<ide> public function testLongitude()
<ide> }
<ide>
<ide> /**
<del> * Test is_integer
<add> * Test isInteger
<ide> *
<ide> * @return void
<ide> */
<ide> public function testIsInteger()
<ide> $this->assertFalse(Validation::isInteger(new \StdClass));
<ide> $this->assertFalse(Validation::isInteger('2 bears'));
<ide> }
<add>
<add> /**
<add> * Test ascii
<add> *
<add> * @return void
<add> */
<add> public function testAscii()
<add> {
<add> $this->assertTrue(Validation::ascii('1 big blue bus.'));
<add> $this->assertTrue(Validation::ascii(',.<>[]{;/?\)()'));
<add>
<add> $this->assertFalse(Validation::ascii([]));
<add> $this->assertFalse(Validation::ascii(1001));
<add> $this->assertFalse(Validation::ascii(3.14));
<add> $this->assertFalse(Validation::ascii(new \StdClass));
<add>
<add> // Latin-1 supplement
<add> $this->assertFalse(Validation::ascii('some' . "\xc2\x82" . 'value'));
<add> $this->assertFalse(Validation::ascii('some' . "\xc3\xbf" . 'value'));
<add>
<add> // End of BMP
<add> $this->assertFalse(Validation::ascii('some' . "\xef\xbf\xbd" . 'value'));
<add>
<add> // Start of supplementary multilingual plane
<add> $this->assertFalse(Validation::ascii('some' . "\xf0\x90\x80\x80" . 'value'));
<add> }
<add>
<add> /**
<add> * Test utf8 basic
<add> *
<add> * @return void
<add> */
<add> public function testUtf8Basic()
<add> {
<add> $this->assertFalse(Validation::utf8([]));
<add> $this->assertFalse(Validation::utf8(1001));
<add> $this->assertFalse(Validation::utf8(3.14));
<add> $this->assertFalse(Validation::utf8(new \StdClass));
<add> $this->assertTrue(Validation::utf8('1 big blue bus.'));
<add> $this->assertTrue(Validation::utf8(',.<>[]{;/?\)()'));
<add>
<add> // Latin-1 supplement
<add> $this->assertTrue(Validation::utf8('some' . "\xc2\x82" . 'value'));
<add> $this->assertTrue(Validation::utf8('some' . "\xc3\xbf" . 'value'));
<add>
<add> // End of BMP
<add> $this->assertTrue(Validation::utf8('some' . "\xef\xbf\xbd" . 'value'));
<add>
<add> // Start of supplementary multilingual plane
<add> $this->assertFalse(Validation::utf8('some' . "\xf0\x90\x80\x80" . 'value'));
<add>
<add> // Grinning face
<add> $this->assertFalse(Validation::utf8('some' . "\xf0\x9f\x98\x80" . 'value'));
<add> }
<add>
<add> /**
<add> * Test utf8 extended
<add> *
<add> * @return void
<add> */
<add> public function testUtf8Extended()
<add> {
<add> $this->assertFalse(Validation::utf8([], ['extended' => true]));
<add> $this->assertFalse(Validation::utf8(1001, ['extended' => true]));
<add> $this->assertFalse(Validation::utf8(3.14, ['extended' => true]));
<add> $this->assertFalse(Validation::utf8(new \StdClass, ['extended' => true]));
<add> $this->assertTrue(Validation::utf8('1 big blue bus.', ['extended' => true]));
<add> $this->assertTrue(Validation::utf8(',.<>[]{;/?\)()', ['extended' => true]));
<add>
<add> // Latin-1 supplement
<add> $this->assertTrue(Validation::utf8('some' . "\xc2\x82" . 'value', ['extended' => true]));
<add> $this->assertTrue(Validation::utf8('some' . "\xc3\xbf" . 'value', ['extended' => true]));
<add>
<add> // End of BMP
<add> $this->assertTrue(Validation::utf8('some' . "\xef\xbf\xbd" . 'value', ['extended' => true]));
<add>
<add> // Start of supplementary multilingual plane
<add> $this->assertTrue(Validation::utf8('some' . "\xf0\x90\x80\x80" . 'value', ['extended' => true]));
<add>
<add> // Grinning face
<add> $this->assertTrue(Validation::utf8('some' . "\xf0\x9f\x98\x80" . 'value', ['extended' => true]));
<add> }
<ide> } | 2 |
Python | Python | fix head_mask for model templates | 897a24c869e2ac2ed44f17956f1009fd8f055f5e | <ide><path>templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/test_modeling_tf_{{cookiecutter.lowercase_modelname}}.py
<ide> class TF{{cookiecutter.camelcase_modelname}}ModelTest(TFModelTesterMixin, unitte
<ide> else ()
<ide> )
<ide>
<add> test_head_masking = False
<add>
<ide> def setUp(self):
<ide> self.model_tester = TF{{cookiecutter.camelcase_modelname}}ModelTester(self)
<ide> self.config_tester = ConfigTester(self, config_class={{cookiecutter.camelcase_modelname}}Config, hidden_size=37)
<ide> class TF{{cookiecutter.camelcase_modelname}}ModelTest(TFModelTesterMixin, unitte
<ide> all_generative_model_classes = (TF{{cookiecutter.camelcase_modelname}}ForConditionalGeneration,) if is_tf_available() else ()
<ide> is_encoder_decoder = True
<ide> test_pruning = False
<add> test_head_masking = False
<ide>
<ide> def setUp(self):
<ide> self.model_tester = TF{{cookiecutter.camelcase_modelname}}ModelTester(self) | 1 |
Text | Text | use rails secret in rails guides | c8ac079413acca3f62d4e15bb1b5a1c5bf7d2039 | <ide><path>guides/source/security.md
<ide> Thus the session becomes a more secure place to store data. The encryption is
<ide> done using a server-side secret key `secrets.secret_key_base` stored in
<ide> `config/secrets.yml`.
<ide>
<del>That means the security of this storage depends on this secret (and on the digest algorithm, which defaults to SHA1, for compatibility). So _don't use a trivial secret, i.e. a word from a dictionary, or one which is shorter than 30 characters, use `rake secret` instead_.
<add>That means the security of this storage depends on this secret (and on the digest algorithm, which defaults to SHA1, for compatibility). So _don't use a trivial secret, i.e. a word from a dictionary, or one which is shorter than 30 characters, use `rails secret` instead_.
<ide>
<ide> `secrets.secret_key_base` is used for specifying a key which allows sessions for the application to be verified against a known secure key to prevent tampering. Applications get `secrets.secret_key_base` initialized to a random key present in `config/secrets.yml`, e.g.:
<ide>
<ide><path>guides/source/upgrading_ruby_on_rails.md
<ide> secrets, you need to:
<ide>
<ide> 3. Remove the `secret_token.rb` initializer.
<ide>
<del>4. Use `rake secret` to generate new keys for the `development` and `test` sections.
<add>4. Use `rails secret` to generate new keys for the `development` and `test` sections.
<ide>
<ide> 5. Restart your server.
<ide> | 2 |
Python | Python | add a way to import airflow without side-effects | 5e5cf6316e7e33f639baa3ee65295159e930c791 | <ide><path>airflow/__init__.py
<ide>
<ide> # flake8: noqa: F401
<ide>
<add>import os
<ide> import sys
<ide> from typing import Callable, Optional
<ide>
<ide> # lib.)
<ide> __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
<ide>
<del>settings.initialize()
<add># Perform side-effects unless someone has explicitly opted out before import
<add># WARNING: DO NOT USE THIS UNLESS YOU REALLY KNOW WHAT YOU'RE DOING.
<add>if not os.environ.get("_AIRFLOW__AS_LIBRARY", None):
<add> settings.initialize()
<ide>
<ide> login: Optional[Callable] = None
<ide> | 1 |
Javascript | Javascript | extract logic to get the socket name to a function | a7d1e682e6d6a11c53733cd31ca3b24d5a86d1ba | <ide><path>src/main-process/atom-application.js
<ide> const getDefaultPath = () => {
<ide> }
<ide> }
<ide>
<add>// Returns a unique id for each Atom instance. This id allows many Atom windows
<add>// that share the same configuration to reuse the same main process.
<add>const getAtomInstanceId = (atomVersion) => {
<add> const {username} = os.userInfo()
<add>
<add> // Lowercasing the ATOM_HOME to make sure that we don't get multiple sockets
<add> // on case-insensitive filesystems due to arbitrary case differences in paths.
<add> const atomHomeUnique = path.resolve(process.env.ATOM_HOME).toLowerCase()
<add> const hash = crypto
<add> .createHash('sha1')
<add> .update(atomVersion)
<add> .update(process.arch)
<add> .update(username || '')
<add> .update(atomHomeUnique)
<add>
<add> return hash.digest('base64')
<add>}
<add>
<add>const getSocketName = (atomVersion) => {
<add> // We only keep the first 12 characters of the hash as not to have excessively long
<add> // socket file. Note that macOS/BSD limit the length of socket file paths (see #15081).
<add> // The replace calls convert the digest into "URL and Filename Safe" encoding (see RFC 4648).
<add> const atomInstanceId = getAtomInstanceId(atomVersion)
<add> .substring(0, 12)
<add> .replace(/\+/g, '-')
<add> .replace(/\//g, '_')
<add>
<add> if (process.platform === 'win32') {
<add> return `\\\\.\\pipe\\atom-${atomInstanceId}-sock`
<add> } else {
<add> return path.join(os.tmpdir(), `atom-${atomInstanceId}.sock`)
<add> }
<add>}
<add>
<ide> // The application's singleton class.
<ide> //
<ide> // It's the entry point into the Atom application and maintains the global state
<ide> class AtomApplication extends EventEmitter {
<ide> // Public: The entry point into the Atom application.
<ide> static open (options) {
<ide> if (!options.socketPath) {
<del> const {username} = os.userInfo()
<del>
<del> // Lowercasing the ATOM_HOME to make sure that we don't get multiple sockets
<del> // on case-insensitive filesystems due to arbitrary case differences in paths.
<del> const atomHomeUnique = path.resolve(process.env.ATOM_HOME).toLowerCase()
<del> const hash = crypto
<del> .createHash('sha1')
<del> .update(options.version)
<del> .update('|')
<del> .update(process.arch)
<del> .update('|')
<del> .update(username || '')
<del> .update('|')
<del> .update(atomHomeUnique)
<del>
<del> // We only keep the first 12 characters of the hash as not to have excessively long
<del> // socket file. Note that macOS/BSD limit the length of socket file paths (see #15081).
<del> // The replace calls convert the digest into "URL and Filename Safe" encoding (see RFC 4648).
<del> const atomInstanceDigest = hash
<del> .digest('base64')
<del> .substring(0, 12)
<del> .replace(/\+/g, '-')
<del> .replace(/\//g, '_')
<del>
<del> if (process.platform === 'win32') {
<del> options.socketPath = `\\\\.\\pipe\\atom-${atomInstanceDigest}-sock`
<del> } else {
<del> options.socketPath = path.join(os.tmpdir(), `atom-${atomInstanceDigest}.sock`)
<del> }
<add> options.socketPath = getSocketName(options.version)
<ide> }
<ide>
<ide> // FIXME: Sometimes when socketPath doesn't exist, net.connect would strangely | 1 |
Javascript | Javascript | remove useless default caught | 824fb49a706dc8e12911d5d142aa8fc779fe59d2 | <ide><path>lib/internal/bootstrap_node.js
<ide> var caught;
<ide>
<ide> if (process.domain && process.domain._errorHandler)
<del> caught = process.domain._errorHandler(er) || caught;
<add> caught = process.domain._errorHandler(er);
<ide>
<ide> if (!caught)
<ide> caught = process.emit('uncaughtException', er); | 1 |
Javascript | Javascript | fix sizebot - point correctly to circleci artifact | d84c539b31bc703fe6271965ce85344f50c8c207 | <ide><path>dangerfile.js
<ide> function git(args) {
<ide>
<ide> for (let i = 0; i < baseArtifactsInfo.length; i++) {
<ide> const info = baseArtifactsInfo[i];
<del> if (info.path === 'home/circleci/project/build/bundle-sizes.json') {
<add> if (info.path.endsWith('bundle-sizes.json')) {
<ide> const resultsResponse = await fetch(info.url);
<ide> previousBuildResults = await resultsResponse.json();
<ide> break; | 1 |
Text | Text | remove non-existent chart value from readme | 561060aaa82ddb63fe2a38473bfd920a5aeff786 | <ide><path>chart/README.md
<ide> The following tables lists the configurable parameters of the Airflow chart and
<ide> | `webserver.resources.limits.memory` | Memory Limit of webserver | `~` |
<ide> | `webserver.resources.requests.cpu` | CPU Request of webserver | `~` |
<ide> | `webserver.resources.requests.memory` | Memory Request of webserver | `~` |
<del>| `webserver.jwtSigningCertificateSecretName` | Name of secret to mount Airflow Webserver JWT singing certificate from | `~` |
<ide> | `webserver.defaultUser` | Optional default airflow user information | `{}` |
<ide>
<ide> | 1 |
Go | Go | take docker_test_host into account | e1ef33449f484678d236cb49e80daf5ba1e1899c | <ide><path>integration-cli/docker_utils.go
<ide> import (
<ide> "net/http"
<ide> "net/http/httptest"
<ide> "net/http/httputil"
<add> "net/url"
<ide> "os"
<ide> "os/exec"
<ide> "path"
<ide> func (d *Daemon) Cmd(name string, arg ...string) (string, error) {
<ide> return string(b), err
<ide> }
<ide>
<add>func daemonHost() string {
<add> daemonUrlStr := "unix:///var/run/docker.sock"
<add> if daemonHostVar := os.Getenv("DOCKER_TEST_HOST"); daemonHostVar != "" {
<add> daemonUrlStr = daemonHostVar
<add> }
<add> return daemonUrlStr
<add>}
<add>
<ide> func sockRequest(method, endpoint string, data interface{}) ([]byte, error) {
<del> // FIX: the path to sock should not be hardcoded
<del> sock := filepath.Join("/", "var", "run", "docker.sock")
<del> c, err := net.DialTimeout("unix", sock, time.Duration(10*time.Second))
<add> daemon := daemonHost()
<add> daemonUrl, err := url.Parse(daemon)
<add> if err != nil {
<add> return nil, fmt.Errorf("could not parse url %q: %v", daemon, err)
<add> }
<add>
<add> var c net.Conn
<add> switch daemonUrl.Scheme {
<add> case "unix":
<add> c, err = net.DialTimeout(daemonUrl.Scheme, daemonUrl.Path, time.Duration(10*time.Second))
<add> case "tcp":
<add> c, err = net.DialTimeout(daemonUrl.Scheme, daemonUrl.Host, time.Duration(10*time.Second))
<add> default:
<add> err = fmt.Errorf("unknown scheme %v", daemonUrl.Scheme)
<add> }
<ide> if err != nil {
<del> return nil, fmt.Errorf("could not dial docker sock at %s: %v", sock, err)
<add> return nil, fmt.Errorf("could not dial docker daemon at %s: %v", daemon, err)
<ide> }
<ide>
<ide> client := httputil.NewClientConn(c, nil) | 1 |
Go | Go | add integ-test for fixed--cidr == bridge network | 5b53839326621e8796fee88e376fc4ca42ed980f | <ide><path>integration-cli/docker_cli_daemon_test.go
<ide> func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr(c *check.C) {
<ide> }
<ide> }
<ide>
<add>func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidrFixedCIDREqualBridgeNetwork(c *check.C) {
<add> d := s.d
<add>
<add> bridgeName := "external-bridge"
<add> bridgeIP := "172.27.42.1/16"
<add>
<add> out, err := createInterface(c, "bridge", bridgeName, bridgeIP)
<add> c.Assert(err, check.IsNil, check.Commentf(out))
<add> defer deleteInterface(c, bridgeName)
<add>
<add> err = d.StartWithBusybox("--bridge", bridgeName, "--fixed-cidr", bridgeIP)
<add> c.Assert(err, check.IsNil)
<add> defer s.d.Restart()
<add>
<add> out, err = d.Cmd("run", "-d", "busybox", "top")
<add> c.Assert(err, check.IsNil, check.Commentf(out))
<add> cid1 := strings.TrimSpace(out)
<add> defer d.Cmd("stop", cid1)
<add>}
<add>
<ide> func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *check.C) {
<ide> defaultNetworkBridge := "docker0"
<ide> deleteInterface(c, defaultNetworkBridge) | 1 |
Ruby | Ruby | add initial tests for weakhash | 4da31d21bc0fe10fc329eb6d89ba52b27f8ed25e | <ide><path>activesupport/test/weak_hash_test.rb
<add>require 'abstract_unit'
<add>require 'active_support/weak_hash'
<add>
<add>class WeakHashTest < ActiveSupport::TestCase
<add>
<add> def setup
<add> @weak_hash = ActiveSupport::WeakHash.new
<add> @str = "A";
<add> @obj = Object.new
<add> end
<add>
<add> test "allows us to assign value, and return assigned value" do
<add> a = @str; b = @obj
<add> assert_equal @weak_hash[a] = b, b
<add> end
<add>
<add> test "should allow us to assign and read value" do
<add> a = @str; b = @obj
<add> assert_equal @weak_hash[a] = b, b
<add> assert_equal @weak_hash[a], b
<add> end
<add>
<add> test "should use object_id to identify objects" do
<add> a = Object.new
<add> @weak_hash[a] = "b"
<add> assert_nil @weak_hash[a.dup]
<add> end
<add>
<add> test "should find objects that have same hash" do
<add> @weak_hash["a"] = "b"
<add> assert_equal "b", @weak_hash["a"]
<add> end
<add>end | 1 |
Ruby | Ruby | add docs for the type registry | 82d12eb9045cba57172ec7cc0786d0f72a8b711f | <ide><path>activerecord/lib/active_record/attributes.rb
<ide> module ClassMethods
<ide> # end
<ide> # end
<ide> #
<add> # # config/initializers/types.rb
<add> # ActiveRecord::Type.register(:money, MoneyType)
<add> #
<add> # # /app/models/store_listing.rb
<ide> # class StoreListing < ActiveRecord::Base
<del> # attribute :price_in_cents, MoneyType.new
<add> # attribute :price_in_cents, :money
<ide> # end
<ide> #
<ide> # store_listing = StoreListing.new(price_in_cents: '$10.00')
<ide> # store_listing.price_in_cents # => 1000
<ide> #
<ide> # For more details on creating custom types, see the documentation for
<del> # ActiveRecord::Type::Value.
<add> # ActiveRecord::Type::Value. For more details on registering your types
<add> # to be referenced by a symbol, see ActiveRecord::Type.register. You can
<add> # also pass a type object directly, in place of a symbol.
<ide> #
<ide> # ==== Querying
<ide> #
<ide> module ClassMethods
<ide> # end
<ide> # end
<ide> #
<add> # ActiveRecord::Type.register(:money, MoneyType)
<add> #
<ide> # class Product < ActiveRecord::Base
<ide> # currency_converter = ConversionRatesFromTheInternet.new
<del> # attribute :price_in_bitcoins, MoneyType.new(currency_converter)
<add> # attribute :price_in_bitcoins, :money, currency_converter
<ide> # end
<ide> #
<ide> # Product.where(price_in_bitcoins: Money.new(5, "USD"))
<ide><path>activerecord/lib/active_record/type.rb
<ide> module Type
<ide>
<ide> class << self
<ide> attr_accessor :registry # :nodoc:
<add> delegate :add_modifier, to: :registry
<ide>
<del> delegate :register, :add_modifier, to: :registry
<add> # Add a new type to the registry, allowing it to be referenced as a
<add> # symbol by ActiveRecord::Attributes::ClassMethods#attribute. If your
<add> # type is only meant to be used with a specific database adapter, you can
<add> # do so by passing +adapter: :postgresql+. If your type has the same
<add> # name as a native type for the current adapter, an exception will be
<add> # raised unless you specify an +:override+ option. +override: true+ will
<add> # cause your type to be used instead of the native type. +override:
<add> # false+ will cause the native type to be used over yours if one exists.
<add> def register(type_name, klass = nil, **options, &block)
<add> registry.register(type_name, klass, **options, &block)
<add> end
<ide>
<del> def lookup(*args, adapter: current_adapter_name, **kwargs)
<add> def lookup(*args, adapter: current_adapter_name, **kwargs) # :nodoc:
<ide> registry.lookup(*args, adapter: adapter, **kwargs)
<ide> end
<ide> | 2 |
Javascript | Javascript | remove custom umd | 20141202c1f81dec33f498c97ef9664e4a7c1cd2 | <ide><path>src/js/video.js
<ide> * @file video.js
<ide> * @module videojs
<ide> */
<del>
<del>/* global define */
<del>
<ide> import window from 'global/window';
<ide> import document from 'global/document';
<ide> import * as setup from './setup';
<ide> videojs.insertContent = Dom.insertContent;
<ide> */
<ide> videojs.computedStyle = computedStyle;
<ide>
<del>/*
<del> * Custom Universal Module Definition (UMD)
<del> *
<del> * Video.js will never be a non-browser lib so we can simplify UMD a bunch and
<del> * still support requirejs and browserify. This also needs to be closure
<del> * compiler compatible, so string keys are used.
<del> */
<del>if (typeof define === 'function' && define.amd) {
<del> define('videojs', [], () => videojs);
<del>
<del>// checking that module is an object too because of umdjs/umd#35
<del>} else if (typeof exports === 'object' && typeof module === 'object') {
<del> module.exports = videojs;
<del>}
<del>
<del>export default videojs;
<add>// We use Node-style module.exports here instead of ES6 because it is more
<add>// compatible with different module systems.
<add>module.exports = videojs; | 1 |
Javascript | Javascript | set proper modulename values | 8b8ae79a1f78b3be1b39ae500cb9f85f65cfc3f7 | <ide><path>packages/ember-glimmer/tests/integration/application/rendering-test.js
<ide> moduleFor('Application test: rendering', class extends ApplicationTest {
<ide> template: 'Hi {{person.name}} from component'
<ide> });
<ide>
<del> let expectedBacktrackingMessage = /modified "model\.name" twice on \[object Object\] in a single render\. It was rendered in "template:routeWithError" and modified in "component:x-foo"/;
<add> let expectedBacktrackingMessage = /modified "model\.name" twice on \[object Object\] in a single render\. It was rendered in "template:my-app\/templates\/routeWithError.hbs" and modified in "component:x-foo"/;
<ide>
<ide> return this.visit('/').then(() => {
<ide> expectAssertion(() => {
<ide><path>packages/ember-glimmer/tests/integration/components/local-lookup-test.js
<ide> function buildResolver() {
<ide> let [sourceType, sourceName ] = sourceFullName.split(':');
<ide> let [type, name ] = fullName.split(':');
<ide>
<del> if (type !== 'template' && sourceType === 'template' && sourceName.slice(0, 11) === 'components/') {
<del> sourceName = sourceName.slice(11);
<add> sourceName = sourceName.replace('my-app/', '');
<add>
<add> if (sourceType === 'template' && sourceName.slice(0, 21) === 'templates/components/') {
<add> sourceName = sourceName.slice(21);
<ide> }
<ide>
<del> if (type === 'template' && sourceType === 'template' && name.slice(0, 11) === 'components/') {
<add> name = name.replace('my-app/', '');
<add>
<add> if (type === 'template' && name.slice(0, 11) === 'components/') {
<ide> name = name.slice(11);
<add> sourceName = `components/${sourceName}`;
<ide> }
<ide>
<add> sourceName = sourceName.replace('.hbs', '');
<ide>
<ide> let result = `${type}:${sourceName}/${name}`;
<ide>
<ide> moduleFor('Components test: local lookup with expandLocalLookup feature', class
<ide> if (EMBER_MODULE_UNIFICATION) {
<ide> class LocalLookupTestResolver extends ModuleBasedTestResolver {
<ide> resolve(specifier, referrer) {
<add> let [type, name ] = specifier.split(':');
<ide> let fullSpecifier = specifier;
<ide>
<ide> if (referrer) {
<del> let namespace = referrer.split('template:components/')[1];
<add> let namespace = referrer.split('components/')[1] || '';
<add> namespace = namespace.replace('.hbs', '');
<ide> if (specifier.indexOf('template:components/') !== -1) {
<del> let name = specifier.split('template:components/')[1];
<del> fullSpecifier = `template:components/${namespace}/${name}`;
<add> name = name.replace('components/', '');
<add> fullSpecifier = `${type}:components/${namespace}/${name}`;
<ide> } else if (specifier.indexOf(':') !== -1) {
<ide> let [type, name] = specifier.split(':');
<ide> fullSpecifier = `${type}:${namespace}/${name}`;
<ide> if (EMBER_MODULE_UNIFICATION) {
<ide>
<ide> if (typeof template === 'string') {
<ide> resolver.add(`template:components/${name}`, this.compile(template, {
<del> moduleName: `components/${name}`
<add> moduleName: `my-name/templates/components/${name}.hbs`
<ide> }));
<ide> }
<ide> }
<ide> if (EMBER_MODULE_UNIFICATION) {
<ide> let { resolver } = this;
<ide> if (typeof template === 'string') {
<ide> resolver.add(`template:${name}`, this.compile(template, {
<del> moduleName: name
<add> moduleName: `my-name/templates/${name}.hbs`
<ide> }));
<ide> } else {
<ide> throw new Error(`Registered template "${name}" must be a string`);
<ide><path>packages/ember-glimmer/tests/integration/mount-test.js
<ide> moduleFor('{{mount}} test', class extends ApplicationTest {
<ide> }
<ide>
<ide> ['@test it boots an engine, instantiates its application controller, and renders its application template'](assert) {
<del> this.engineRegistrations['template:application'] = compile('<h2>Chat here, {{username}}</h2>', { moduleName: 'application' });
<add> this.engineRegistrations['template:application'] = compile('<h2>Chat here, {{username}}</h2>', { moduleName: 'my-app/templates/application.hbs' });
<ide>
<ide> let controller;
<ide>
<ide> moduleFor('{{mount}} test', class extends ApplicationTest {
<ide> this.addTemplate('index', '');
<ide> this.addTemplate('route-with-mount', '{{mount "chat"}}');
<ide>
<del> this.engineRegistrations['template:application'] = compile('hi {{person.name}} [{{component-with-backtracking-set person=person}}]', { moduleName: 'application' });
<add> this.engineRegistrations['template:application'] = compile('hi {{person.name}} [{{component-with-backtracking-set person=person}}]', { moduleName: 'my-app/templates/application.hbs' });
<ide> this.engineRegistrations['controller:application'] = Controller.extend({
<ide> person: { name: 'Alex' }
<ide> });
<ide>
<del> this.engineRegistrations['template:components/component-with-backtracking-set'] = compile('[component {{person.name}}]', { moduleName: 'components/component-with-backtracking-set' });
<add> this.engineRegistrations['template:components/component-with-backtracking-set'] = compile('[component {{person.name}}]', { moduleName: 'my-app/templates/components/component-with-backtracking-set.hbs' });
<ide> this.engineRegistrations['component:component-with-backtracking-set'] = Component.extend({
<ide> init() {
<ide> this._super(...arguments);
<ide> this.set('person.name', 'Ben');
<ide> }
<ide> });
<ide>
<del> let expectedBacktrackingMessage = /modified "person\.name" twice on \[object Object\] in a single render\. It was rendered in "template:route-with-mount" \(in "engine:chat"\) and modified in "component:component-with-backtracking-set" \(in "engine:chat"\)/;
<add> let expectedBacktrackingMessage = /modified "person\.name" twice on \[object Object\] in a single render\. It was rendered in "template:my-app\/templates\/route-with-mount.hbs" \(in "engine:chat"\) and modified in "component:component-with-backtracking-set" \(in "engine:chat"\)/;
<ide>
<ide> return this.visit('/').then(() => {
<ide> expectAssertion(() => {
<ide> moduleFor('{{mount}} test', class extends ApplicationTest {
<ide> router: null,
<ide> init() {
<ide> this._super(...arguments);
<del> this.register('template:application', compile('<h2>Foo Engine</h2>', { moduleName: 'application' }));
<add> this.register('template:application', compile('<h2>Foo Engine</h2>', { moduleName: 'my-app/templates/application.hbs' }));
<ide> }
<ide> }));
<ide> this.add('engine:bar', Engine.extend({
<ide> router: null,
<ide> init() {
<ide> this._super(...arguments);
<del> this.register('template:application', compile('<h2>Bar Engine</h2>', { moduleName: 'application' }));
<add> this.register('template:application', compile('<h2>Bar Engine</h2>', { moduleName: 'my-app/templates/application.hbs' }));
<ide> }
<ide> }));
<ide>
<ide> moduleFor('{{mount}} test', class extends ApplicationTest {
<ide> router: null,
<ide> init() {
<ide> this._super(...arguments);
<del> this.register('template:application', compile('<h2>Foo Engine: {{tagless-component}}</h2>', { moduleName: 'application' }));
<add> this.register('template:application', compile('<h2>Foo Engine: {{tagless-component}}</h2>', { moduleName: 'my-app/templates/application.hbs' }));
<ide> this.register('component:tagless-component', Component.extend({
<ide> tagName: "",
<ide> init() {
<ide> this._super(...arguments);
<ide> component = this;
<ide> }
<ide> }));
<del> this.register('template:components/tagless-component', compile('Tagless Component', { moduleName: 'components/tagless-component' }));
<add> this.register('template:components/tagless-component', compile('Tagless Component', { moduleName: 'my-app/templates/components/tagless-component.hbs' }));
<ide> }
<ide> }));
<ide>
<ide> if (EMBER_ENGINES_MOUNT_PARAMS) {
<ide> router: null,
<ide> init() {
<ide> this._super(...arguments);
<del> this.register('template:application', compile('<h2>Param Engine: {{model.foo}}</h2>', { moduleName: 'application' }));
<add> this.register('template:application', compile('<h2>Param Engine: {{model.foo}}</h2>', { moduleName: 'my-app/templates/application.hbs' }));
<ide> }
<ide> }));
<ide> }
<ide> if (EMBER_ENGINES_MOUNT_PARAMS) {
<ide> router: null,
<ide> init() {
<ide> this._super(...arguments);
<del> this.register('template:application', compile('{{model.foo}}', { moduleName: 'application' }));
<add> this.register('template:application', compile('{{model.foo}}', { moduleName: 'my-app/templates/application.hbs' }));
<ide> }
<ide> }));
<ide> this.addTemplate('engine-params-contextual-component', '{{mount "componentParamEngine" model=(hash foo=(component "foo-component"))}}');
<ide><path>packages/ember-glimmer/tests/unit/template-factory-test.js
<ide> moduleFor('Template factory test', class extends RenderingTest {
<ide> let { runtimeResolver } = this;
<ide>
<ide> let templateStr = 'Hello {{name}}';
<del> let options = { moduleName: 'some-module' };
<add> let options = { moduleName: 'my-app/templates/some-module.hbs' };
<ide>
<ide> let spec = precompile(templateStr, options);
<ide> let body = `exports.default = template(${spec});`;
<ide><path>packages/ember/tests/integration/multiple-app-test.js
<ide> moduleFor('View Integration', class extends ApplicationTestCase {
<ide> this.compile(`
<ide> <h1>Node 1</h1>{{special-button}}
<ide> `, {
<del> moduleName: 'index'
<add> moduleName: 'my-app/templates/index.hbs'
<ide> })
<ide> );
<ide> resolver.add(
<ide> 'template:components/special-button',
<ide> this.compile(`
<ide> <button class='do-stuff' {{action 'doStuff'}}>Button</button>
<ide> `, {
<del> moduleName: 'components/special-button'
<add> moduleName: 'my-app/templates/components/special-button.hbs'
<ide> })
<ide> );
<ide> }
<ide><path>packages/internal-test-helpers/lib/test-cases/abstract-rendering.js
<ide> export default class AbstractRenderingTestCase extends AbstractTestCase {
<ide> registerPartial(name, template) {
<ide> let owner = this.env.owner || this.owner;
<ide> if (typeof template === 'string') {
<del> let moduleName = `template:${name}`;
<del> owner.register(moduleName, this.compile(template, { moduleName }));
<add> owner.register(`template:${name}`, this.compile(template, { moduleName: `my-app/templates/-${name}.hbs` }));
<ide> }
<ide> }
<ide>
<ide> export default class AbstractRenderingTestCase extends AbstractTestCase {
<ide>
<ide> if (typeof template === 'string') {
<ide> owner.register(`template:components/${name}`, this.compile(template, {
<del> moduleName: `components/${name}`
<add> moduleName: `my-app/templates/components/${name}.hbs`
<ide> }));
<ide> }
<ide> }
<ide> export default class AbstractRenderingTestCase extends AbstractTestCase {
<ide> let { owner } = this;
<ide> if (typeof template === 'string') {
<ide> owner.register(`template:${name}`, this.compile(template, {
<del> moduleName: name
<add> moduleName: `my-app/templates/${name}.hbs`
<ide> }));
<ide> } else {
<ide> throw new Error(`Registered template "${name}" must be a string`);
<ide><path>packages/internal-test-helpers/lib/test-cases/test-resolver-application.js
<ide> export default class TestResolverApplicationTestCase extends AbstractApplication
<ide>
<ide> addTemplate(templateName, templateString) {
<ide> this.resolver.add(`template:${templateName}`, this.compile(templateString, {
<del> moduleName: templateName
<add> moduleName: `my-app/templates/${templateName}.hbs`
<ide> }));
<ide> }
<ide>
<ide> export default class TestResolverApplicationTestCase extends AbstractApplication
<ide>
<ide> if (typeof template === 'string') {
<ide> this.resolver.add(`template:components/${name}`, this.compile(template, {
<del> moduleName: `components/${name}`
<add> moduleName: `my-app/templates/components/${name}.hbs`
<ide> }));
<ide> }
<ide> }
<ide><path>packages/internal-test-helpers/lib/test-resolver.js
<ide> class Resolver {
<ide> throw new Error(`You called addTemplate for "${templateName}" with a template argument of type of '${templateType}'. addTemplate expects an argument of an uncompiled template as a string.`);
<ide> }
<ide> return this._registered[serializeKey(`template:${templateName}`)] = compile(template, {
<del> moduleName: templateName
<add> moduleName: `my-app/templates/${templateName}.hbs`
<ide> });
<ide> }
<ide> static create() { | 8 |
Python | Python | fix bug which lowercases special tokens | 2670b0d682746e1fe94ab9c7b4d2fd7f4af03193 | <ide><path>transformers/tests/tokenization_tests_commons.py
<ide> def test_pickle_tokenizer(self):
<ide> def test_added_tokens_do_lower_case(self):
<ide> tokenizer = self.get_tokenizer(do_lower_case=True)
<ide>
<del> text = "aaaaa bbbbbb low cccccccccdddddddd l"
<del> text2 = "AAAAA BBBBBB low CCCCCCCCCDDDDDDDD l"
<add> special_token = tokenizer.all_special_tokens[0]
<add>
<add> text = special_token + " aaaaa bbbbbb low cccccccccdddddddd l " + special_token
<add> text2 = special_token + " AAAAA BBBBBB low CCCCCCCCCDDDDDDDD l " + special_token
<ide>
<ide> toks0 = tokenizer.tokenize(text) # toks before adding new_toks
<ide>
<ide> def test_added_tokens_do_lower_case(self):
<ide>
<ide> self.assertEqual(len(toks), len(toks2)) # Length should still be the same
<ide> self.assertNotEqual(len(toks), len(toks0))
<del> self.assertNotEqual(toks[0], toks2[0]) # But at least the first tokens should differ
<add> self.assertNotEqual(toks[1], toks2[1]) # But at least the first non-special tokens should differ
<ide>
<ide> def test_add_tokens_tokenizer(self):
<ide> tokenizer = self.get_tokenizer()
<ide><path>transformers/tokenization_utils.py
<ide> import six
<ide> import copy
<ide> import itertools
<add>import re
<ide> from io import open
<ide>
<ide> from .file_utils import cached_path, is_tf_available, is_torch_available
<ide> def add_tokens(self, new_tokens):
<ide> to_add_tokens = []
<ide> for token in new_tokens:
<ide> assert isinstance(token, str) or (six.PY2 and isinstance(token, unicode))
<del> if self.init_kwargs.get('do_lower_case', False):
<add> if self.init_kwargs.get('do_lower_case', False) and token not in self.all_special_tokens:
<ide> token = token.lower()
<ide> if token != self.unk_token and \
<ide> self.convert_tokens_to_ids(token) == self.convert_tokens_to_ids(self.unk_token) and \
<ide> def tokenize(self, text, **kwargs):
<ide>
<ide> Take care of added tokens.
<ide> """
<add> def lowercase_text(t):
<add> # convert non-special tokens to lowercase
<add> escaped_special_toks = [re.escape(s_tok) for s_tok in self.all_special_tokens]
<add> pattern = r'(^' + r'|'.join(escaped_special_toks) + r')|' + \
<add> r'(.+?)'
<add> return re.sub(
<add> pattern,
<add> lambda m: m.groups()[0] or m.groups()[1].lower(),
<add> t)
<add>
<ide> if self.init_kwargs.get('do_lower_case', False):
<del> text = text.lower()
<add> text = lowercase_text(text)
<ide>
<ide> def split_on_token(tok, text):
<ide> result = [] | 2 |
Text | Text | remove references to deprecated test tasks | 2478b5e619fb8714755480429eba85eef93cbed7 | <ide><path>guides/source/testing.md
<ide> You don't need to set up and run your tests by hand on a test-by-test basis. Rai
<ide> | `rake test:models` | Runs all the model tests from `test/models`|
<ide> | `rake test:units` | Runs all the unit tests from `test/models`, `test/helpers`, and `test/unit`|
<ide>
<del>There're also some test commands which you can initiate by running rake tasks:
<del>
<del>| Tasks | Description |
<del>| ------------------------ | ----------- |
<del>| `rake test` | Runs all unit, functional and integration tests. You can also simply run `rake` as the _test_ target is the default.|
<del>| `rake test:recent` | Tests recent changes|
<del>| `rake test:uncommitted` | Runs all the tests which are uncommitted. Supports Subversion and Git|
<ide>
<ide> Brief Note About `MiniTest`
<ide> ----------------------------- | 1 |
Ruby | Ruby | add documentation for url connection strings | 1f427b534199399545f90fd0895d62c005247501 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
<ide> def connection
<ide> # "database" => "path/to/dbfile"
<ide> # )
<ide> #
<add> # Or a URL:
<add> #
<add> # ActiverRecord::Base.establish_connection(
<add> # "postgres://myuser:mypass@localhost/somedatabase"
<add> # )
<add> #
<ide> # The exceptions AdapterNotSpecified, AdapterNotFound and ArgumentError
<ide> # may be returned on an error.
<ide> def self.establish_connection(spec = nil) | 1 |
Javascript | Javascript | emit close event if request aborted | 8fa5fcc0ba74c23490c34da1a6c6e9a454280740 | <ide><path>lib/internal/http2/compat.js
<ide> function onStreamClosedResponse() {
<ide> res.emit('finish');
<ide> }
<ide>
<del>function onAborted(hadError, code) {
<add>function onStreamAbortedRequest(hadError, code) {
<ide> if ((this.writable) ||
<ide> (this._readableState && !this._readableState.ended)) {
<ide> this.emit('aborted', hadError, code);
<add> this.emit('close');
<add> }
<add>}
<add>
<add>function onStreamAbortedResponse() {
<add> if (this.writable) {
<add> this.emit('close');
<ide> }
<ide> }
<ide>
<ide> class Http2ServerRequest extends Readable {
<ide> stream.on('end', onStreamEnd);
<ide> stream.on('error', onStreamError);
<ide> stream.on('close', onStreamClosedRequest);
<del> stream.on('aborted', onAborted.bind(this));
<add> stream.on('aborted', onStreamAbortedRequest.bind(this));
<ide> const onfinish = this[kFinish].bind(this);
<ide> stream.on('streamClosed', onfinish);
<ide> stream.on('finish', onfinish);
<ide> class Http2ServerResponse extends Stream {
<ide> this.writable = true;
<ide> stream.on('drain', onStreamResponseDrain);
<ide> stream.on('close', onStreamClosedResponse);
<add> stream.on('aborted', onStreamAbortedResponse.bind(this));
<ide> const onfinish = this[kFinish].bind(this);
<ide> stream.on('streamClosed', onfinish);
<ide> stream.on('finish', onfinish);
<ide><path>test/parallel/test-http2-compat-serverresponse-close.js
<add>// Flags: --expose-http2 --expose-internals
<add>'use strict';
<add>
<add>const common = require('../common');
<add>if (!common.hasCrypto)
<add> common.skip('missing crypto');
<add>const h2 = require('http2');
<add>
<add>// Server request and response should receive close event
<add>// if the connection was terminated before response.end
<add>// could be called or flushed
<add>
<add>const server = h2.createServer(common.mustCall((req, res) => {
<add> res.writeHead(200);
<add> res.write('a');
<add>
<add> req.on('close', common.mustCall());
<add> res.on('close', common.mustCall());
<add>}));
<add>server.listen(0);
<add>
<add>server.on('listening', function() {
<add> const port = server.address().port;
<add>
<add> const url = `http://localhost:${port}`;
<add> const client = h2.connect(url, common.mustCall(function() {
<add> const headers = {
<add> ':path': '/foobar',
<add> ':method': 'GET',
<add> ':scheme': 'http',
<add> ':authority': `localhost:${port}`,
<add> };
<add> const request = client.request(headers);
<add> request.on('data', common.mustCall(function(chunk) {
<add> // cause an error on the server side
<add> client.destroy();
<add> server.close();
<add> }));
<add> request.end();
<add> }));
<add>}); | 2 |
Javascript | Javascript | use flat array in `meta/_foreachin` | 271d8cd7b6987f177318081925a5e3c74abe9762 | <ide><path>packages/ember-metal/lib/meta.js
<ide> export class Meta {
<ide> if (seen[innerKey] === undefined) {
<ide> seen[innerKey] = true;
<ide> calls = calls || [];
<del> calls.push([innerKey, innerMap[innerKey]]);
<add> calls.push(innerKey, innerMap[innerKey]);
<ide> }
<ide> }
<ide> }
<ide> }
<ide> pointer = pointer.parent;
<ide> }
<add>
<ide> if (calls !== undefined) {
<del> for (let i = 0; i < calls.length; i++) {
<del> let [innerKey, value] = calls[i];
<del> fn(innerKey, value);
<add> for (let i = 0; i < calls.length; i+=2) {
<add> fn(calls[i], calls[i + 1]);
<ide> }
<ide> }
<ide> }
<ide> export class Meta {
<ide>
<ide> writeValue(obj, key, value) {
<ide> let descriptor = lookupDescriptor(obj, key);
<del> let isMandatorySetter = descriptor !== undefined&& descriptor.set && descriptor.set.isMandatorySetter;
<add> let isMandatorySetter = descriptor !== undefined && descriptor.set && descriptor.set.isMandatorySetter;
<ide>
<ide> if (isMandatorySetter) {
<ide> this.writeValues(key, value); | 1 |
Java | Java | add @since tags to firstelement methods | c2141e2e9323f09ef42f2af92458c2d7bb9b424b | <ide><path>spring-core/src/main/java/org/springframework/util/CollectionUtils.java
<ide> else if (candidate != val.getClass()) {
<ide> }
<ide>
<ide> /**
<del> * Retrieve the last element of the given Set, using {@link SortedSet#last()}
<del> * or otherwise iterating over all elements (assuming a linked set).
<add> * Retrieve the first element of the given Set, using {@link SortedSet#first()}
<add> * or otherwise using the iterator.
<ide> * @param set the Set to check (may be {@code null} or empty)
<del> * @return the last element, or {@code null} if none
<del> * @since 5.0.3
<add> * @return the first element, or {@code null} if none
<add> * @since 5.2.3
<ide> * @see SortedSet
<ide> * @see LinkedHashMap#keySet()
<ide> * @see java.util.LinkedHashSet
<ide> */
<ide> @Nullable
<del> public static <T> T lastElement(@Nullable Set<T> set) {
<add> public static <T> T firstElement(@Nullable Set<T> set) {
<ide> if (isEmpty(set)) {
<ide> return null;
<ide> }
<ide> if (set instanceof SortedSet) {
<del> return ((SortedSet<T>) set).last();
<add> return ((SortedSet<T>) set).first();
<ide> }
<ide>
<del> // Full iteration necessary...
<ide> Iterator<T> it = set.iterator();
<del> T last = null;
<del> while (it.hasNext()) {
<del> last = it.next();
<add> T first = null;
<add> if (it.hasNext()) {
<add> first = it.next();
<ide> }
<del> return last;
<add> return first;
<ide> }
<ide>
<ide> /**
<del> * Retrieve the last element of the given List, accessing the highest index.
<add> * Retrieve the first element of the given List, accessing the zero index.
<ide> * @param list the List to check (may be {@code null} or empty)
<del> * @return the last element, or {@code null} if none
<del> * @since 5.0.3
<add> * @return the first element, or {@code null} if none
<add> * @since 5.2.3
<ide> */
<ide> @Nullable
<del> public static <T> T lastElement(@Nullable List<T> list) {
<add> public static <T> T firstElement(@Nullable List<T> list) {
<ide> if (isEmpty(list)) {
<ide> return null;
<ide> }
<del> return list.get(list.size() - 1);
<add> return list.get(0);
<ide> }
<ide>
<ide> /**
<del> * Retrieve the first element of the given Set, using {@link SortedSet#first()}
<del> * or otherwise using the iterator.
<add> * Retrieve the last element of the given Set, using {@link SortedSet#last()}
<add> * or otherwise iterating over all elements (assuming a linked set).
<ide> * @param set the Set to check (may be {@code null} or empty)
<del> * @return the first element, or {@code null} if none
<add> * @return the last element, or {@code null} if none
<add> * @since 5.0.3
<ide> * @see SortedSet
<ide> * @see LinkedHashMap#keySet()
<ide> * @see java.util.LinkedHashSet
<ide> */
<ide> @Nullable
<del> public static <T> T firstElement(@Nullable Set<T> set) {
<add> public static <T> T lastElement(@Nullable Set<T> set) {
<ide> if (isEmpty(set)) {
<ide> return null;
<ide> }
<ide> if (set instanceof SortedSet) {
<del> return ((SortedSet<T>) set).first();
<add> return ((SortedSet<T>) set).last();
<ide> }
<ide>
<add> // Full iteration necessary...
<ide> Iterator<T> it = set.iterator();
<del> T first = null;
<del> if (it.hasNext()) {
<del> first = it.next();
<add> T last = null;
<add> while (it.hasNext()) {
<add> last = it.next();
<ide> }
<del> return first;
<add> return last;
<ide> }
<ide>
<ide> /**
<del> * Retrieve the first element of the given List, accessing the zero index.
<add> * Retrieve the last element of the given List, accessing the highest index.
<ide> * @param list the List to check (may be {@code null} or empty)
<del> * @return the first element, or {@code null} if none
<add> * @return the last element, or {@code null} if none
<add> * @since 5.0.3
<ide> */
<ide> @Nullable
<del> public static <T> T firstElement(@Nullable List<T> list) {
<add> public static <T> T lastElement(@Nullable List<T> list) {
<ide> if (isEmpty(list)) {
<ide> return null;
<ide> }
<del> return list.get(0);
<add> return list.get(list.size() - 1);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | decrease duration of test-cli-syntax | a74ddff1d9f6b99f8eb57ae77a7d64e433c60abb | <ide><path>test/parallel/test-cli-syntax.js
<ide>
<ide> const common = require('../common');
<ide> const assert = require('assert');
<del>const spawnSync = require('child_process').spawnSync;
<add>const {exec, spawnSync} = require('child_process');
<ide> const path = require('path');
<ide>
<ide> const node = process.execPath;
<ide> const notFoundRE = /^Error: Cannot find module/m;
<ide> // loop each possible option, `-c` or `--check`
<ide> syntaxArgs.forEach(function(args) {
<ide> const _args = args.concat(file);
<del> const c = spawnSync(node, _args, {encoding: 'utf8'});
<ide>
<del> // no output should be produced
<del> assert.strictEqual(c.stdout, '', 'stdout produced');
<del> assert.strictEqual(c.stderr, '', 'stderr produced');
<del> assert.strictEqual(c.status, 0, `code === ${c.status}`);
<add> const cmd = [node, ..._args].join(' ');
<add> exec(cmd, common.mustCall((err, stdout, stderr) => {
<add> assert.ifError(err);
<add> assert.strictEqual(stdout, '', 'stdout produced');
<add> assert.strictEqual(stderr, '', 'stderr produced');
<add> }));
<ide> });
<ide> });
<ide>
<ide> const notFoundRE = /^Error: Cannot find module/m;
<ide> // loop each possible option, `-c` or `--check`
<ide> syntaxArgs.forEach(function(args) {
<ide> const _args = args.concat(file);
<del> const c = spawnSync(node, _args, {encoding: 'utf8'});
<add> const cmd = [node, ..._args].join(' ');
<add> exec(cmd, common.mustCall((err, stdout, stderr) => {
<add> assert.strictEqual(err instanceof Error, true);
<add> assert.strictEqual(err.code, 1, `code === ${err.code}`);
<ide>
<del> // no stdout should be produced
<del> assert.strictEqual(c.stdout, '', 'stdout produced');
<add> // no stdout should be produced
<add> assert.strictEqual(stdout, '', 'stdout produced');
<ide>
<del> // stderr should include the filename
<del> assert(c.stderr.startsWith(file), "stderr doesn't start with the filename");
<add> // stderr should have a syntax error message
<add> assert(syntaxErrorRE.test(stderr), 'stderr incorrect');
<ide>
<del> // stderr should have a syntax error message
<del> assert(syntaxErrorRE.test(c.stderr), 'stderr incorrect');
<del>
<del> assert.strictEqual(c.status, 1, `code === ${c.status}`);
<add> // stderr should include the filename
<add> assert(stderr.startsWith(file), "stderr doesn't start with the filename");
<add> }));
<ide> });
<ide> });
<ide>
<ide> const notFoundRE = /^Error: Cannot find module/m;
<ide> // loop each possible option, `-c` or `--check`
<ide> syntaxArgs.forEach(function(args) {
<ide> const _args = args.concat(file);
<del> const c = spawnSync(node, _args, {encoding: 'utf8'});
<del>
<del> // no stdout should be produced
<del> assert.strictEqual(c.stdout, '', 'stdout produced');
<add> const cmd = [node, ..._args].join(' ');
<add> exec(cmd, common.mustCall((err, stdout, stderr) => {
<add> // no stdout should be produced
<add> assert.strictEqual(stdout, '', 'stdout produced');
<ide>
<del> // stderr should have a module not found error message
<del> assert(notFoundRE.test(c.stderr), 'stderr incorrect');
<add> // stderr should have a module not found error message
<add> assert(notFoundRE.test(stderr), 'stderr incorrect');
<ide>
<del> assert.strictEqual(c.status, 1, `code === ${c.status}`);
<add> assert.strictEqual(err.code, 1, `code === ${err.code}`);
<add> }));
<ide> });
<ide> });
<ide>
<ide> syntaxArgs.forEach(function(args) {
<ide> ['-c', '--check'].forEach(function(checkFlag) {
<ide> ['-e', '--eval'].forEach(function(evalFlag) {
<ide> const args = [checkFlag, evalFlag, 'foo'];
<del> const c = spawnSync(node, args, {encoding: 'utf8'});
<del>
<del> assert(
<del> c.stderr.startsWith(
<del> `${node}: either --check or --eval can be used, not both`
<del> )
<del> );
<del>
<del> assert.strictEqual(c.status, 9, `code === ${c.status}`);
<add> const cmd = [node, ...args].join(' ');
<add> exec(cmd, common.mustCall((err, stdout, stderr) => {
<add> assert.strictEqual(err instanceof Error, true);
<add> assert.strictEqual(err.code, 9, `code === ${err.code}`);
<add> assert(
<add> stderr.startsWith(
<add> `${node}: either --check or --eval can be used, not both`
<add> )
<add> );
<add> }));
<ide> });
<ide> }); | 1 |
Javascript | Javascript | remove unnecessary lookup in example with emotion | 029bac4fd9e23f60dedac59ed57c5a5cc5d5b299 | <ide><path>examples/with-emotion/pages/_document.js
<ide> export default class MyDocument extends Document {
<ide> super(props)
<ide> const { __NEXT_DATA__, ids } = props
<ide> if (ids) {
<del> __NEXT_DATA__.ids = this.props.ids
<add> __NEXT_DATA__.ids = ids
<ide> }
<ide> }
<ide> | 1 |
Java | Java | allow custom requestmappinghandlermapping | 500179e5c0c7892e21a6255314554f5919e8a4a5 | <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java
<ide> /*
<del> * Copyright 2002-2014 the original author or authors.
<add> * Copyright 2002-2015 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public void setServletContext(ServletContext servletContext) {
<ide> */
<ide> @Bean
<ide> public RequestMappingHandlerMapping requestMappingHandlerMapping() {
<del> RequestMappingHandlerMapping handlerMapping = new RequestMappingHandlerMapping();
<add> RequestMappingHandlerMapping handlerMapping = createRequestMappingHandlerMapping();
<ide> handlerMapping.setOrder(0);
<ide> handlerMapping.setInterceptors(getInterceptors());
<ide> handlerMapping.setContentNegotiationManager(mvcContentNegotiationManager());
<ide> public RequestMappingHandlerMapping requestMappingHandlerMapping() {
<ide> return handlerMapping;
<ide> }
<ide>
<add> /**
<add> * Protected method for plugging in a custom sub-class of
<add> * {@link RequestMappingHandlerMapping}.
<add> */
<add> protected RequestMappingHandlerMapping createRequestMappingHandlerMapping() {
<add> return new RequestMappingHandlerMapping();
<add> }
<add>
<ide> /**
<ide> * Provide access to the shared handler interceptors used to configure
<ide> * {@link HandlerMapping} instances with. This method cannot be overridden, | 1 |
Python | Python | fix usage of disable_pipes | f81cc0bd1c59776332254a8bb3e43f3b9d0781d7 | <ide><path>examples/training/train_ner.py
<ide> def main(model=None, output_dir=None, n_iter=100):
<ide>
<ide> # get names of other pipes to disable them during training
<ide> other_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'ner']
<del> with nlp.disable_pipes(*other_pipes) as disabled: # only train NER
<add> with nlp.disable_pipes(*other_pipes): # only train NER
<ide> optimizer = nlp.begin_training(get_data)
<ide> for itn in range(n_iter):
<ide> random.shuffle(TRAIN_DATA)
<ide><path>examples/training/train_new_entity_type.py
<ide> def main(model=None, new_model_name='animal', output_dir=None, n_iter=50):
<ide>
<ide> # get names of other pipes to disable them during training
<ide> other_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'ner']
<del> with nlp.disable_pipes(*other_pipes) as disabled: # only train NER
<add> with nlp.disable_pipes(*other_pipes): # only train NER
<ide> random.seed(0)
<ide> optimizer = nlp.begin_training(lambda: [])
<ide> for itn in range(n_iter):
<ide><path>examples/training/train_parser.py
<ide> def main(model=None, output_dir=None, n_iter=1000):
<ide>
<ide> # get names of other pipes to disable them during training
<ide> other_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'parser']
<del> with nlp.disable_pipes(*other_pipes) as disabled: # only train parser
<add> with nlp.disable_pipes(*other_pipes): # only train parser
<ide> optimizer = nlp.begin_training(lambda: [])
<ide> for itn in range(n_iter):
<ide> random.shuffle(TRAIN_DATA) | 3 |
Javascript | Javascript | assign correct cache to child compilation | 0975d13da711904429c6dd581422c755dd04869c | <ide><path>lib/CachePlugin.js
<ide> class CachePlugin {
<ide> }
<ide>
<ide> apply(compiler) {
<add> const cacheMap = new Map();
<add> cacheMap.set(compiler, this.cache);
<ide> if(Array.isArray(compiler.compilers)) {
<ide> compiler.compilers.forEach((c, idx) => {
<ide> c.apply(new CachePlugin(this.cache[idx] = this.cache[idx] || {}));
<ide> });
<ide> } else {
<del> compiler.plugin("compilation", compilation => {
<del> if(!compilation.notCacheable) {
<del> compilation.cache = this.cache;
<del> } else if(this.watching) {
<del> compilation.warnings.push(
<del> new Error(`CachePlugin - Cache cannot be used because of: ${compilation.notCacheable}`)
<del> );
<del> }
<del> });
<add> const registerCacheToCompiler = (compiler, cache) => {
<add> compiler.plugin("this-compilation", compilation => {
<add> if(!compilation.notCacheable) {
<add> compilation.cache = cache;
<add> compilation.plugin("child-compiler", (childCompiler, compilerName, compilerIndex) => {
<add> if(cache) {
<add> let childCache;
<add> if(!cache.children) cache.children = {};
<add> if(!cache.children[compilerName]) cache.children[compilerName] = [];
<add> if(cache.children[compilerName][compilerIndex])
<add> childCache = cache.children[compilerName][compilerIndex];
<add> else
<add> cache.children[compilerName].push(childCache = {});
<add> registerCacheToCompiler(childCompiler, childCache);
<add> }
<add> });
<add> } else if(this.watching) {
<add> compilation.warnings.push(
<add> new Error(`CachePlugin - Cache cannot be used because of: ${compilation.notCacheable}`)
<add> );
<add> }
<add> });
<add> };
<add> registerCacheToCompiler(compiler, this.cache);
<ide> compiler.plugin("watch-run", (compiler, callback) => {
<ide> this.watching = true;
<ide> callback();
<ide><path>lib/Compiler.js
<ide> class Compiler extends Tapable {
<ide> else
<ide> this.records[relativeCompilerName].push(childCompiler.records = {});
<ide>
<del> if(this.cache) {
<del> if(!this.cache.children) this.cache.children = {};
<del> if(!this.cache.children[compilerName]) this.cache.children[compilerName] = [];
<del> if(this.cache.children[compilerName][compilerIndex])
<del> childCompiler.cache = this.cache.children[compilerName][compilerIndex];
<del> else
<del> this.cache.children[compilerName].push(childCompiler.cache = {});
<del> }
<del>
<ide> childCompiler.options = Object.create(this.options);
<ide> childCompiler.options.output = Object.create(childCompiler.options.output);
<ide> for(const name in outputOptions) {
<ide> childCompiler.options.output[name] = outputOptions[name];
<ide> }
<ide> childCompiler.parentCompilation = compilation;
<add>
<add> compilation.applyPlugins("child-compiler", childCompiler, compilerName, compilerIndex);
<add>
<ide> return childCompiler;
<ide> }
<ide>
<ide><path>test/WatchTestCases.test.js
<ide> describe("WatchTestCases", () => {
<ide>
<ide> const state = {};
<ide> let runIdx = 0;
<add> let waitMode = false;
<ide> let run = runs[runIdx];
<add> let triggeringFilename;
<ide> let lastHash = "";
<add> const currentWatchStepModule = require("./helpers/currentWatchStep");
<add> currentWatchStepModule.step = run.name;
<ide> copyDiff(path.join(testDirectory, run.name), tempDirectory);
<ide>
<del> const compiler = webpack(options);
<del> const watching = compiler.watch({
<del> aggregateTimeout: 1000
<del> }, (err, stats) => {
<del> if(err)
<del> return done(err);
<del> if(!stats)
<del> return done(new Error("No stats reported from Compiler"));
<del> if(stats.hash === lastHash)
<del> return;
<del> lastHash = stats.hash;
<del> if(run.done)
<del> return done(new Error("Compilation changed but no change was issued " + lastHash + " != " + stats.hash + " (run " + runIdx + ")"));
<del> run.done = true;
<del> if(err) return done(err);
<del> const statOptions = Stats.presetToOptions("verbose");
<del> statOptions.colors = false;
<del> fs.writeFileSync(path.join(outputDirectory, "stats.txt"), stats.toString(statOptions), "utf-8");
<del> const jsonStats = stats.toJson({
<del> errorDetails: true
<add> setTimeout(() => {
<add> const compiler = webpack(options);
<add> compiler.plugin("invalid", (filename, mtime) => {
<add> triggeringFilename = filename;
<ide> });
<del> if(checkArrayExpectation(path.join(testDirectory, run.name), jsonStats, "error", "Error", done)) return;
<del> if(checkArrayExpectation(path.join(testDirectory, run.name), jsonStats, "warning", "Warning", done)) return;
<del> let exportedTests = 0;
<add> const watching = compiler.watch({
<add> aggregateTimeout: 1000
<add> }, (err, stats) => {
<add> if(err)
<add> return done(err);
<add> if(!stats)
<add> return done(new Error("No stats reported from Compiler"));
<add> if(stats.hash === lastHash)
<add> return;
<add> lastHash = stats.hash;
<add> if(run.done && lastHash !== stats.hash) {
<add> return done(new Error("Compilation changed but no change was issued " + lastHash + " != " + stats.hash + " (run " + runIdx + ")\n" +
<add> "Triggering change: " + triggeringFilename));
<add> }
<add> if(waitMode) return;
<add> run.done = true;
<add> if(err) return done(err);
<add> const statOptions = Stats.presetToOptions("verbose");
<add> statOptions.colors = false;
<add> fs.writeFileSync(path.join(outputDirectory, "stats.txt"), stats.toString(statOptions), "utf-8");
<add> const jsonStats = stats.toJson({
<add> errorDetails: true
<add> });
<add> if(checkArrayExpectation(path.join(testDirectory, run.name), jsonStats, "error", "Error", done)) return;
<add> if(checkArrayExpectation(path.join(testDirectory, run.name), jsonStats, "warning", "Warning", done)) return;
<add> let exportedTests = 0;
<ide>
<del> function _it(title, fn) {
<del> const test = new Test(title, fn);
<del> run.suite.addTest(test);
<del> exportedTests++;
<del> return test;
<del> }
<add> function _it(title, fn) {
<add> const test = new Test(title, fn);
<add> run.suite.addTest(test);
<add> exportedTests++;
<add> return test;
<add> }
<ide>
<del> function _require(currentDirectory, module) {
<del> if(Array.isArray(module) || /^\.\.?\//.test(module)) {
<del> let fn;
<del> let content;
<del> let p;
<del> if(Array.isArray(module)) {
<del> p = path.join(currentDirectory, module[0]);
<del> content = module.map((arg) => {
<del> p = path.join(currentDirectory, arg);
<del> return fs.readFileSync(p, "utf-8");
<del> }).join("\n");
<del> } else {
<del> p = path.join(currentDirectory, module);
<del> content = fs.readFileSync(p, "utf-8");
<del> }
<del> fn = vm.runInThisContext("(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE) {" + content + "\n})", p);
<del> const m = {
<del> exports: {}
<del> };
<del> fn.call(m.exports, _require.bind(null, path.dirname(p)), m, m.exports, path.dirname(p), p, _it, run.name, jsonStats, state);
<del> return module.exports;
<del> } else if(testConfig.modules && module in testConfig.modules) {
<del> return testConfig.modules[module];
<del> } else return require(module);
<del> }
<add> function _require(currentDirectory, module) {
<add> if(Array.isArray(module) || /^\.\.?\//.test(module)) {
<add> let fn;
<add> let content;
<add> let p;
<add> if(Array.isArray(module)) {
<add> p = path.join(currentDirectory, module[0]);
<add> content = module.map((arg) => {
<add> p = path.join(currentDirectory, arg);
<add> return fs.readFileSync(p, "utf-8");
<add> }).join("\n");
<add> } else {
<add> p = path.join(currentDirectory, module);
<add> content = fs.readFileSync(p, "utf-8");
<add> }
<add> fn = vm.runInThisContext("(function(require, module, exports, __dirname, __filename, it, WATCH_STEP, STATS_JSON, STATE) {" + content + "\n})", p);
<add> const m = {
<add> exports: {}
<add> };
<add> fn.call(m.exports, _require.bind(null, path.dirname(p)), m, m.exports, path.dirname(p), p, _it, run.name, jsonStats, state);
<add> return module.exports;
<add> } else if(testConfig.modules && module in testConfig.modules) {
<add> return testConfig.modules[module];
<add> } else return require(module);
<add> }
<ide>
<del> let testConfig = {};
<del> try {
<del> // try to load a test file
<del> testConfig = require(path.join(testDirectory, "test.config.js"));
<del> } catch(e) {}
<add> let testConfig = {};
<add> try {
<add> // try to load a test file
<add> testConfig = require(path.join(testDirectory, "test.config.js"));
<add> } catch(e) {}
<ide>
<del> if(testConfig.noTests) return process.nextTick(done);
<del> _require(outputDirectory, "./bundle.js");
<add> if(testConfig.noTests) return process.nextTick(done);
<add> _require(outputDirectory, "./bundle.js");
<ide>
<del> if(exportedTests < 1) return done(new Error("No tests exported by test case"));
<del> runIdx++;
<del> if(runIdx < runs.length) {
<del> run = runs[runIdx];
<del> setTimeout(() => {
<del> copyDiff(path.join(testDirectory, run.name), tempDirectory);
<del> }, 1500);
<del> } else {
<del> watching.close();
<del> process.nextTick(done);
<del> }
<del> });
<add> if(exportedTests < 1) return done(new Error("No tests exported by test case"));
<add> runIdx++;
<add> if(runIdx < runs.length) {
<add> run = runs[runIdx];
<add> waitMode = true;
<add> setTimeout(() => {
<add> waitMode = false;
<add> currentWatchStepModule.step = run.name;
<add> copyDiff(path.join(testDirectory, run.name), tempDirectory);
<add> }, 1500);
<add> } else {
<add> watching.close();
<add> process.nextTick(done);
<add> }
<add> });
<add> }, 300);
<ide> });
<ide> });
<ide> });
<ide><path>test/helpers/currentWatchStep.js
<add>exports.step = undefined;
<ide><path>test/watchCases/cache/child-compilation-cache/0/changing-file.js
<add>123
<ide><path>test/watchCases/cache/child-compilation-cache/0/index.js
<add>it("should use correct caches in compilation and child compilations", function() {
<add> var x = require("./report-cache-counters-loader!./changing-file");
<add> switch(WATCH_STEP) {
<add> case "0":
<add> x.should.be.eql([1, 1]);
<add> break;
<add> case "1":
<add> x.should.be.eql([2, 1]);
<add> break;
<add> case "2":
<add> x.should.be.eql([3, 2]);
<add> break;
<add> default:
<add> throw new Error("Not handled step");
<add> }
<add>});
<ide><path>test/watchCases/cache/child-compilation-cache/0/report-cache-counters-loader.js
<add>var map = new Map();
<add>var currentWatchStepModule = require("../../../../helpers/currentWatchStep");
<add>
<add>module.exports = function(source) {
<add> if(map.has(currentWatchStepModule.step)) return map.get(currentWatchStepModule.step);
<add> this._compilation.cache.counter = (this._compilation.cache.counter || 0) + 1;
<add>
<add> var childCompiler = this._compilation.createChildCompiler("my-compiler " + source.trim(), {
<add> filename: "test"
<add> });
<add> var callback = this.async();
<add> childCompiler.runAsChild((err, entries, compilation) => {
<add> if(err) return callback(err);
<add>
<add> var childCache = compilation.cache;
<add> childCache.counter = (childCache.counter || 0) + 1;
<add>
<add> var result = `module.exports = [${this._compilation.cache.counter}, ${childCache.counter}]; // ${source}`;
<add> map.set(currentWatchStepModule.step, result);
<add> callback(null, result);
<add> });
<add>};
<ide><path>test/watchCases/cache/child-compilation-cache/1/changing-file.js
<add>456
<ide><path>test/watchCases/cache/child-compilation-cache/2/changing-file.js
<add>123 | 9 |
Go | Go | remove job from load | 70bb0d8ed7847d7e7850a1a864ff258767f0ad7a | <ide><path>api/server/server.go
<ide> func (s *Server) getImagesGet(eng *engine.Engine, version version.Version, w htt
<ide> }
<ide>
<ide> func (s *Server) postImagesLoad(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<del> job := eng.Job("load")
<del> job.Stdin.Add(r.Body)
<del> job.Stdout.Add(w)
<del> return job.Run()
<add>
<add> imageLoadConfig := &graph.ImageLoadConfig{
<add> InTar: r.Body,
<add> OutStream: w,
<add> Engine: eng,
<add> }
<add>
<add> return s.daemon.Repositories().Load(imageLoadConfig)
<ide> }
<ide>
<ide> func (s *Server) postContainersCreate(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
<ide><path>graph/load.go
<ide> package graph
<ide>
<ide> import (
<ide> "encoding/json"
<add> "io"
<ide> "io/ioutil"
<ide> "os"
<ide> "path"
<ide> import (
<ide> "github.com/docker/docker/pkg/chrootarchive"
<ide> )
<ide>
<add>type ImageLoadConfig struct {
<add> InTar io.ReadCloser
<add> OutStream io.Writer
<add> Engine *engine.Engine
<add>}
<add>
<ide> // Loads a set of images into the repository. This is the complementary of ImageExport.
<ide> // The input stream is an uncompressed tar ball containing images and metadata.
<del>func (s *TagStore) CmdLoad(job *engine.Job) error {
<add>func (s *TagStore) Load(imageLoadConfig *ImageLoadConfig) error {
<ide> tmpImageDir, err := ioutil.TempDir("", "docker-import-")
<ide> if err != nil {
<ide> return err
<ide> func (s *TagStore) CmdLoad(job *engine.Job) error {
<ide> excludes[i] = k
<ide> i++
<ide> }
<del> if err := chrootarchive.Untar(job.Stdin, repoDir, &archive.TarOptions{ExcludePatterns: excludes}); err != nil {
<add> if err := chrootarchive.Untar(imageLoadConfig.InTar, repoDir, &archive.TarOptions{ExcludePatterns: excludes}); err != nil {
<ide> return err
<ide> }
<ide>
<ide> func (s *TagStore) CmdLoad(job *engine.Job) error {
<ide>
<ide> for _, d := range dirs {
<ide> if d.IsDir() {
<del> if err := s.recursiveLoad(job.Eng, d.Name(), tmpImageDir); err != nil {
<add> if err := s.recursiveLoad(imageLoadConfig.Engine, d.Name(), tmpImageDir); err != nil {
<ide> return err
<ide> }
<ide> }
<ide> func (s *TagStore) CmdLoad(job *engine.Job) error {
<ide>
<ide> for imageName, tagMap := range repositories {
<ide> for tag, address := range tagMap {
<del> if err := s.SetLoad(imageName, tag, address, true, job.Stdout); err != nil {
<add> if err := s.SetLoad(imageName, tag, address, true, imageLoadConfig.OutStream); err != nil {
<ide> return err
<ide> }
<ide> }
<ide><path>graph/service.go
<ide> func (s *TagStore) Install(eng *engine.Engine) error {
<ide> "image_inspect": s.CmdLookup,
<ide> "image_export": s.CmdImageExport,
<ide> "viz": s.CmdViz,
<del> "load": s.CmdLoad,
<ide> "push": s.CmdPush,
<ide> } {
<ide> if err := eng.Register(name, handler); err != nil { | 3 |
PHP | PHP | fix name reference for expected variable | 267a2287a9cebc71200d07e9c8d15a947ff35f94 | <ide><path>tests/TestCase/Database/Driver/SqliteTest.php
<ide> public function testConnectionConfigCustom() {
<ide> $connection->expects($this->exactly(2))->method('exec');
<ide>
<ide> $driver->expects($this->once())->method('_connect')
<del> ->with($dsn, expected);
<add> ->with($dsn, $expected);
<ide> $driver->expects($this->any())->method('connection')
<ide> ->will($this->returnValue($connection));
<ide> $driver->connect($config); | 1 |
Javascript | Javascript | use const as appropriate | 71c0d0370a98c50c4b49659bd6ece3359437902c | <ide><path>lib/timers.js
<ide> function TimersList(msecs, unrefed) {
<ide> // adds listOnTimeout to the C++ object prototype, as
<ide> // V8 would not inline it otherwise.
<ide> TimerWrap.prototype[kOnTimeout] = function listOnTimeout(now) {
<del> var list = this._list;
<del> var msecs = list.msecs;
<add> const list = this._list;
<add> const msecs = list.msecs;
<ide>
<ide> debug('timeout callback %d', msecs);
<ide> debug('now: %d', now);
<ide> function tryOnTimeout(timer, list) {
<ide> function reuse(item) {
<ide> L.remove(item);
<ide>
<del> var list = refedLists[item._idleTimeout];
<add> const list = refedLists[item._idleTimeout];
<ide> // if empty - reuse the watcher
<ide> if (list !== undefined && L.isEmpty(list)) {
<ide> debug('reuse hit');
<ide> function unenroll(item) {
<ide> item._destroyed = true;
<ide> }
<ide>
<del> var handle = reuse(item);
<add> const handle = reuse(item);
<ide> if (handle !== null) {
<ide> debug('unenroll: list empty');
<ide> handle.close();
<ide> exports.setTimeout = setTimeout;
<ide>
<ide>
<ide> function ontimeout(timer, start) {
<del> var args = timer._timerArgs;
<add> const args = timer._timerArgs;
<ide> if (typeof timer._onTimeout !== 'function')
<ide> return promiseResolve(timer._onTimeout, args[0]);
<ide> if (start === undefined && timer._repeat)
<ide> Timeout.prototype.unref = function() {
<ide> if (this._handle) {
<ide> this._handle.unref();
<ide> } else if (typeof this._onTimeout === 'function') {
<del> var now = TimerWrap.now();
<add> const now = TimerWrap.now();
<ide> if (!this._idleStart) this._idleStart = now;
<ide> var delay = this._idleStart + this._idleTimeout - now;
<ide> if (delay < 0) delay = 0;
<ide> Timeout.prototype.unref = function() {
<ide> return;
<ide> }
<ide>
<del> var handle = reuse(this);
<add> const handle = reuse(this);
<ide> if (handle !== null) {
<ide> handle._list = undefined;
<ide> } | 1 |
Text | Text | add changelog entry for [ci skip] | 989cccdc3e6f9c6dcb740b2792fcc74b19eed67e | <ide><path>activerecord/CHANGELOG.md
<add>* Make possible to have an association called `records`.
<add>
<add> Fixes #11645.
<add>
<add> *prathamesh-sonpatki*
<add>
<ide> * `to_sql` on an association now matches the query that is actually executed, where it
<ide> could previously have incorrectly accrued additional conditions (e.g. as a result of
<ide> a previous query). CollectionProxy now always defers to the association scope's | 1 |
Java | Java | support static fields in reflectiontestutils | 063ef240c185fe6ba2ed39ef2fc6767c7a8dd900 | <ide><path>spring-test/src/main/java/org/springframework/test/util/ReflectionTestUtils.java
<ide> /*
<del> * Copyright 2002-2012 the original author or authors.
<add> * Copyright 2002-2015 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> * methods.</li>
<ide> * </ul>
<ide> *
<add> * <p>In addition, several methods in this class provide support for {@code static}
<add> * fields — for example, {@link #setField(Class, String, Object)},
<add> * {@link #getField(Class, String)}, etc.
<add> *
<ide> * @author Sam Brannen
<ide> * @author Juergen Hoeller
<ide> * @since 2.5
<ide> public class ReflectionTestUtils {
<ide>
<ide>
<ide> /**
<del> * Set the {@link Field field} with the given {@code name} on the provided
<del> * {@link Object target object} to the supplied {@code value}.
<add> * Set the {@linkplain Field field} with the given {@code name} on the
<add> * provided {@code targetObject} to the supplied {@code value}.
<ide> *
<del> * <p>This method traverses the class hierarchy in search of the desired field.
<del> * In addition, an attempt will be made to make non-{@code public} fields
<del> * <em>accessible</em>, thus allowing one to set {@code protected},
<del> * {@code private}, and <em>package-private</em> fields.
<add> * <p>This method delegates to {@link #setField(Object, String, Object, Class)},
<add> * supplying {@code null} for the {@code type} argument.
<ide> *
<del> * @param target the target object on which to set the field
<del> * @param name the name of the field to set
<add> * @param targetObject the target object on which to set the field; never {@code null}
<add> * @param name the name of the field to set; never {@code null}
<ide> * @param value the value to set
<del> * @see ReflectionUtils#findField(Class, String, Class)
<del> * @see ReflectionUtils#makeAccessible(Field)
<del> * @see ReflectionUtils#setField(Field, Object, Object)
<ide> */
<del> public static void setField(Object target, String name, Object value) {
<del> setField(target, name, value, null);
<add> public static void setField(Object targetObject, String name, Object value) {
<add> setField(targetObject, name, value, null);
<add> }
<add>
<add> /**
<add> * Set the {@linkplain Field field} with the given {@code name}/{@code type}
<add> * on the provided {@code targetObject} to the supplied {@code value}.
<add> *
<add> * <p>This method delegates to {@link #setField(Object, Class, String, Object, Class)},
<add> * supplying {@code null} for the {@code targetClass} argument.
<add> *
<add> * @param targetObject the target object on which to set the field; never {@code null}
<add> * @param name the name of the field to set; may be {@code null} if
<add> * {@code type} is specified
<add> * @param value the value to set
<add> * @param type the type of the field to set; may be {@code null} if
<add> * {@code name} is specified
<add> */
<add> public static void setField(Object targetObject, String name, Object value, Class<?> type) {
<add> setField(targetObject, null, name, value, type);
<add> }
<add>
<add> /**
<add> * Set the static {@linkplain Field field} with the given {@code name} on
<add> * the provided {@code targetClass} to the supplied {@code value}.
<add> *
<add> * <p>This method delegates to {@link #setField(Object, Class, String, Object, Class)},
<add> * supplying {@code null} for the {@code targetObject} and {@code type} arguments.
<add> *
<add> * @param targetClass the target class on which to set the static field;
<add> * never {@code null}
<add> * @param name the name of the field to set; never {@code null}
<add> * @param value the value to set
<add> * @since 4.2
<add> */
<add> public static void setField(Class<?> targetClass, String name, Object value) {
<add> setField(null, targetClass, name, value, null);
<add> }
<add>
<add> /**
<add> * Set the static {@linkplain Field field} with the given
<add> * {@code name}/{@code type} on the provided {@code targetClass} to
<add> * the supplied {@code value}.
<add> *
<add> * <p>This method delegates to {@link #setField(Object, Class, String, Object, Class)},
<add> * supplying {@code null} for the {@code targetObject} argument.
<add> *
<add> * @param targetClass the target class on which to set the static field;
<add> * never {@code null}
<add> * @param name the name of the field to set; may be {@code null} if
<add> * {@code type} is specified
<add> * @param value the value to set
<add> * @param type the type of the field to set; may be {@code null} if
<add> * {@code name} is specified
<add> * @since 4.2
<add> */
<add> public static void setField(Class<?> targetClass, String name, Object value, Class<?> type) {
<add> setField(null, targetClass, name, value, type);
<ide> }
<ide>
<ide> /**
<del> * Set the {@link Field field} with the given {@code name} on the provided
<del> * {@link Object target object} to the supplied {@code value}.
<add> * Set the {@linkplain Field field} with the given {@code name}/{@code type}
<add> * on the provided {@code targetObject}/{@code targetClass} to the supplied
<add> * {@code value}.
<ide> *
<ide> * <p>This method traverses the class hierarchy in search of the desired
<ide> * field. In addition, an attempt will be made to make non-{@code public}
<ide> * fields <em>accessible</em>, thus allowing one to set {@code protected},
<ide> * {@code private}, and <em>package-private</em> fields.
<ide> *
<del> * @param target the target object on which to set the field
<del> * @param name the name of the field to set
<add> * @param targetObject the target object on which to set the field; may be
<add> * {@code null} if the field is static
<add> * @param targetClass the target class on which to set the field; may
<add> * be {@code null} if the field is an instance field
<add> * @param name the name of the field to set; may be {@code null} if
<add> * {@code type} is specified
<ide> * @param value the value to set
<del> * @param type the type of the field (may be {@code null})
<add> * @param type the type of the field to set; may be {@code null} if
<add> * {@code name} is specified
<ide> * @see ReflectionUtils#findField(Class, String, Class)
<ide> * @see ReflectionUtils#makeAccessible(Field)
<ide> * @see ReflectionUtils#setField(Field, Object, Object)
<add> * @since 4.2
<ide> */
<del> public static void setField(Object target, String name, Object value, Class<?> type) {
<del> Assert.notNull(target, "Target object must not be null");
<del> Field field = ReflectionUtils.findField(target.getClass(), name, type);
<add> public static void setField(Object targetObject, Class<?> targetClass, String name, Object value, Class<?> type) {
<add> Assert.isTrue(targetObject != null || targetClass != null,
<add> "Either targetObject or targetClass for the field must be specified");
<add>
<add> if (targetClass == null) {
<add> targetClass = targetObject.getClass();
<add> }
<add> Field field = ReflectionUtils.findField(targetClass, name, type);
<ide>
<del> // SPR-9571: inline Assert.notNull() in order to avoid accidentally invoking
<del> // toString() on a non-null target.
<add> // Inline Assert.notNull() to avoid invoking toString() on a non-null target.
<ide> if (field == null) {
<del> throw new IllegalArgumentException(String.format("Could not find field [%s] of type [%s] on target [%s]",
<del> name, type, target));
<add> throw new IllegalArgumentException(String.format(
<add> "Could not find field [%s] of type [%s] on target object [%s] or target class [%s]", name, type,
<add> targetObject, targetClass));
<ide> }
<ide>
<ide> if (logger.isDebugEnabled()) {
<del> logger.debug(String.format("Setting field [%s] of type [%s] on target [%s] to value [%s]", name, type,
<del> target,
<del> value));
<add> logger.debug(String.format(
<add> "Setting field [%s] of type [%s] on target object [%s] or target class [%s] to value [%s]", name, type,
<add> targetObject, targetClass, value));
<ide> }
<ide> ReflectionUtils.makeAccessible(field);
<del> ReflectionUtils.setField(field, target, value);
<add> ReflectionUtils.setField(field, targetObject, value);
<ide> }
<ide>
<ide> /**
<del> * Get the field with the given {@code name} from the provided target object.
<add> * Get the value of the {@linkplain Field field} with the given {@code name}
<add> * from the provided {@code targetObject}.
<add> *
<add> * <p>This method delegates to {@link #getField(Object, Class, String)},
<add> * supplying {@code null} for the {@code targetClass} argument.
<add> *
<add> * @param targetObject the target object from which to get the field;
<add> * never {@code null}
<add> * @param name the name of the field to get; never {@code null}
<add> * @return the field's current value
<add> * @see #getField(Class, String)
<add> */
<add> public static Object getField(Object targetObject, String name) {
<add> return getField(targetObject, null, name);
<add> }
<add>
<add> /**
<add> * Get the value of the static {@linkplain Field field} with the given
<add> * {@code name} from the provided {@code targetClass}.
<add> *
<add> * <p>This method delegates to {@link #getField(Object, Class, String)},
<add> * supplying {@code null} for the {@code targetObject} argument.
<add> *
<add> * @param targetClass the target class from which to get the static field;
<add> * never {@code null}
<add> * @param name the name of the field to get; never {@code null}
<add> * @return the field's current value
<add> * @see #getField(Object, String)
<add> * @since 4.2
<add> */
<add> public static Object getField(Class<?> targetClass, String name) {
<add> return getField(null, targetClass, name);
<add> }
<add>
<add> /**
<add> * Get the value of the {@linkplain Field field} with the given {@code name}
<add> * from the provided {@code targetObject}/{@code targetClass}.
<ide> *
<ide> * <p>This method traverses the class hierarchy in search of the desired
<ide> * field. In addition, an attempt will be made to make non-{@code public}
<ide> * fields <em>accessible</em>, thus allowing one to get {@code protected},
<ide> * {@code private}, and <em>package-private</em> fields.
<ide> *
<del> * @param target the target object on which to set the field
<del> * @param name the name of the field to get
<add> * @param targetObject the target object from which to get the field; may be
<add> * {@code null} if the field is static
<add> * @param targetClass the target class from which to get the field; may
<add> * be {@code null} if the field is an instance field
<add> * @param name the name of the field to get; never {@code null}
<ide> * @return the field's current value
<add> * @see #getField(Object, String)
<add> * @see #getField(Class, String)
<ide> * @see ReflectionUtils#findField(Class, String, Class)
<ide> * @see ReflectionUtils#makeAccessible(Field)
<del> * @see ReflectionUtils#setField(Field, Object, Object)
<add> * @see ReflectionUtils#getField(Field, Object, Object)
<add> * @since 4.2
<ide> */
<del> public static Object getField(Object target, String name) {
<del> Assert.notNull(target, "Target object must not be null");
<del> Field field = ReflectionUtils.findField(target.getClass(), name);
<del> Assert.notNull(field, "Could not find field [" + name + "] on target [" + target + "]");
<add> public static Object getField(Object targetObject, Class<?> targetClass, String name) {
<add> Assert.isTrue(targetObject != null || targetClass != null,
<add> "Either targetObject or targetClass for the field must be specified");
<add>
<add> if (targetClass == null) {
<add> targetClass = targetObject.getClass();
<add> }
<add> Field field = ReflectionUtils.findField(targetClass, name);
<add>
<add> // Inline Assert.notNull() to avoid invoking toString() on a non-null target.
<add> if (field == null) {
<add> throw new IllegalArgumentException(
<add> String.format("Could not find field [%s] on target object [%s] or target class [%s]", name,
<add> targetObject, targetClass));
<add> }
<ide>
<ide> if (logger.isDebugEnabled()) {
<del> logger.debug("Getting field [" + name + "] from target [" + target + "]");
<add> logger.debug(String.format("Getting field [%s] from target object [%s] or target class [%s]", name,
<add> targetObject, targetClass));
<ide> }
<ide> ReflectionUtils.makeAccessible(field);
<del> return ReflectionUtils.getField(field, target);
<add> return ReflectionUtils.getField(field, targetObject);
<ide> }
<ide>
<ide> /**
<ide><path>spring-test/src/test/java/org/springframework/test/util/ReflectionTestUtilsTests.java
<ide> /*
<del> * Copyright 2002-2014 the original author or authors.
<add> * Copyright 2002-2015 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide>
<ide> package org.springframework.test.util;
<ide>
<add>import org.junit.Before;
<ide> import org.junit.Ignore;
<add>import org.junit.Rule;
<ide> import org.junit.Test;
<add>import org.junit.rules.ExpectedException;
<ide>
<ide> import org.springframework.test.util.subpackage.Component;
<ide> import org.springframework.test.util.subpackage.LegacyEntity;
<ide> import org.springframework.test.util.subpackage.Person;
<add>import org.springframework.test.util.subpackage.StaticFields;
<ide>
<add>import static org.hamcrest.CoreMatchers.*;
<ide> import static org.junit.Assert.*;
<ide> import static org.springframework.test.util.ReflectionTestUtils.*;
<ide>
<ide> public class ReflectionTestUtilsTests {
<ide> private final Person person = new Person();
<ide> private final Component component = new Component();
<ide>
<add> @Rule
<add> public ExpectedException exception = ExpectedException.none();
<add>
<add>
<add> @Before
<add> public void resetStaticFields() {
<add> StaticFields.reset();
<add> }
<add>
<add> @Test
<add> public void setFieldWithNullTargetObject() throws Exception {
<add> exception.expect(IllegalArgumentException.class);
<add> exception.expectMessage(startsWith("Either targetObject or targetClass"));
<add> setField((Object) null, "id", new Long(99));
<add> }
<add>
<add> @Test
<add> public void getFieldWithNullTargetObject() throws Exception {
<add> exception.expect(IllegalArgumentException.class);
<add> exception.expectMessage(startsWith("Either targetObject or targetClass"));
<add> getField((Object) null, "id");
<add> }
<add>
<add> @Test
<add> public void setFieldWithNullTargetClass() throws Exception {
<add> exception.expect(IllegalArgumentException.class);
<add> exception.expectMessage(startsWith("Either targetObject or targetClass"));
<add> setField((Class<?>) null, "id", new Long(99));
<add> }
<add>
<add> @Test
<add> public void getFieldWithNullTargetClass() throws Exception {
<add> exception.expect(IllegalArgumentException.class);
<add> exception.expectMessage(startsWith("Either targetObject or targetClass"));
<add> getField((Class<?>) null, "id");
<add> }
<ide>
<ide> @Test
<del> public void setFieldForStandardUseCases() throws Exception {
<add> public void setFieldWithNullNameAndNullType() throws Exception {
<add> exception.expect(IllegalArgumentException.class);
<add> exception.expectMessage(startsWith("Either name or type"));
<add> setField(person, null, new Long(99), null);
<add> }
<add>
<add> @Test
<add> public void setFieldWithBogusName() throws Exception {
<add> exception.expect(IllegalArgumentException.class);
<add> exception.expectMessage(startsWith("Could not find field [bogus]"));
<add> setField(person, "bogus", new Long(99), long.class);
<add> }
<add>
<add> @Test
<add> public void setFieldWithWrongType() throws Exception {
<add> exception.expect(IllegalArgumentException.class);
<add> exception.expectMessage(startsWith("Could not find field"));
<add> setField(person, "id", new Long(99), String.class);
<add> }
<add>
<add> @Test
<add> public void setFieldAndGetFieldForStandardUseCases() throws Exception {
<ide> setField(person, "id", new Long(99), long.class);
<ide> setField(person, "name", "Tom");
<ide> setField(person, "age", new Integer(42));
<ide> public void setFieldForStandardUseCases() throws Exception {
<ide>
<ide> @Test
<ide> public void setFieldWithNullValuesForNonPrimitives() throws Exception {
<add> // Fields must be non-null to start with
<add> setField(person, "name", "Tom");
<add> setField(person, "eyeColor", "blue", String.class);
<add> setField(person, "favoriteNumber", PI, Number.class);
<add> assertNotNull(person.getName());
<add> assertNotNull(person.getEyeColor());
<add> assertNotNull(person.getFavoriteNumber());
<add>
<add> // Set to null
<ide> setField(person, "name", null, String.class);
<ide> setField(person, "eyeColor", null, String.class);
<ide> setField(person, "favoriteNumber", null, Number.class);
<ide> public void setFieldOnLegacyEntityWithSideEffectsInToString() {
<ide> }
<ide>
<ide> @Test
<del> public void invokeSetterMethodWithExplicitSetterMethodNames() throws Exception {
<add> public void setStaticFieldViaClass() throws Exception {
<add> setField(StaticFields.class, "publicField", "xxx");
<add> setField(StaticFields.class, "privateField", "yyy");
<add>
<add> assertEquals("public static field", "xxx", StaticFields.publicField);
<add> assertEquals("private static field", "yyy", StaticFields.getPrivateField());
<add> }
<add>
<add> @Test
<add> public void setStaticFieldViaClassWithExplicitType() throws Exception {
<add> setField(StaticFields.class, "publicField", "xxx", String.class);
<add> setField(StaticFields.class, "privateField", "yyy", String.class);
<add>
<add> assertEquals("public static field", "xxx", StaticFields.publicField);
<add> assertEquals("private static field", "yyy", StaticFields.getPrivateField());
<add> }
<add>
<add> @Test
<add> public void setStaticFieldViaInstance() throws Exception {
<add> StaticFields staticFields = new StaticFields();
<add> setField(staticFields, null, "publicField", "xxx", null);
<add> setField(staticFields, null, "privateField", "yyy", null);
<add>
<add> assertEquals("public static field", "xxx", StaticFields.publicField);
<add> assertEquals("private static field", "yyy", StaticFields.getPrivateField());
<add> }
<add>
<add> @Test
<add> public void getStaticFieldViaClass() throws Exception {
<add> assertEquals("public static field", "public", getField(StaticFields.class, "publicField"));
<add> assertEquals("private static field", "private", getField(StaticFields.class, "privateField"));
<add> }
<add>
<add> @Test
<add> public void getStaticFieldViaInstance() throws Exception {
<add> StaticFields staticFields = new StaticFields();
<add> assertEquals("public static field", "public", getField(staticFields, "publicField"));
<add> assertEquals("private static field", "private", getField(staticFields, "privateField"));
<add> }
<add>
<add> @Test
<add> public void invokeSetterMethodAndInvokeGetterMethodWithExplicitMethodNames() throws Exception {
<ide> invokeSetterMethod(person, "setId", new Long(1), long.class);
<ide> invokeSetterMethod(person, "setName", "Jerry", String.class);
<ide> invokeSetterMethod(person, "setAge", new Integer(33), int.class);
<ide> public void invokeSetterMethodWithExplicitSetterMethodNames() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> public void invokeSetterMethodWithJavaBeanPropertyNames() throws Exception {
<add> public void invokeSetterMethodAndInvokeGetterMethodWithJavaBeanPropertyNames() throws Exception {
<ide> invokeSetterMethod(person, "id", new Long(99), long.class);
<ide> invokeSetterMethod(person, "name", "Tom");
<ide> invokeSetterMethod(person, "age", new Integer(42));
<ide> public void invokeMethodSimulatingLifecycleEvents() {
<ide> assertNull("text", component.getText());
<ide> }
<ide>
<del> @Test(expected = IllegalStateException.class)
<del> public void invokeMethodWithIncompatibleArgumentTypes() {
<del> invokeMethod(component, "subtract", "foo", 2.0);
<del> }
<del>
<del> @Test(expected = IllegalStateException.class)
<add> @Test
<ide> public void invokeInitMethodBeforeAutowiring() {
<add> exception.expect(IllegalStateException.class);
<add> exception.expectMessage(equalTo("number must not be null"));
<ide> invokeMethod(component, "init");
<ide> }
<ide>
<del> @Test(expected = IllegalStateException.class)
<add> @Test
<add> public void invokeMethodWithIncompatibleArgumentTypes() {
<add> exception.expect(IllegalStateException.class);
<add> exception.expectMessage(startsWith("Method not found"));
<add> invokeMethod(component, "subtract", "foo", 2.0);
<add> }
<add>
<add> @Test
<ide> public void invokeMethodWithTooFewArguments() {
<add> exception.expect(IllegalStateException.class);
<add> exception.expectMessage(startsWith("Method not found"));
<ide> invokeMethod(component, "configure", new Integer(42));
<ide> }
<ide>
<del> @Test(expected = IllegalStateException.class)
<add> @Test
<ide> public void invokeMethodWithTooManyArguments() {
<add> exception.expect(IllegalStateException.class);
<add> exception.expectMessage(startsWith("Method not found"));
<ide> invokeMethod(component, "configure", new Integer(42), "enigma", "baz", "quux");
<ide> }
<ide>
<ide><path>spring-test/src/test/java/org/springframework/test/util/subpackage/StaticFields.java
<add>/*
<add> * Copyright 2002-2015 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * 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>
<add>package org.springframework.test.util.subpackage;
<add>
<add>/**
<add> * Simple class with static fields; intended for use in unit tests.
<add> *
<add> * @author Sam Brannen
<add> * @since 4.2
<add> */
<add>public class StaticFields {
<add>
<add> public static String publicField = "public";
<add>
<add> private static String privateField = "private";
<add>
<add>
<add> public static void reset() {
<add> publicField = "public";
<add> privateField = "private";
<add> }
<add>
<add> public static String getPrivateField() {
<add> return privateField;
<add> }
<add>
<add>}
<ide>\ No newline at end of file | 3 |
Go | Go | add retry logic during aufs unmount | 0e539fec331cb9dbc4ef784b55516570b11affe2 | <ide><path>daemon/graphdriver/aufs/aufs.go
<ide> import (
<ide> "strings"
<ide> "sync"
<ide> "syscall"
<add> "time"
<ide>
<ide> "github.com/Sirupsen/logrus"
<ide> "github.com/vbatts/tar-split/tar/storage"
<ide> func (a *Driver) createDirsFor(id string) error {
<ide> return nil
<ide> }
<ide>
<add>// Helper function to debug EBUSY errors on remove.
<add>func debugEBusy(mountPath string) (out []string, err error) {
<add> // lsof is not part of GNU coreutils. This is a best effort
<add> // attempt to detect offending processes.
<add> c := exec.Command("lsof")
<add>
<add> r, err := c.StdoutPipe()
<add> if err != nil {
<add> return nil, fmt.Errorf("Assigning pipes failed with %v", err)
<add> }
<add>
<add> if err := c.Start(); err != nil {
<add> return nil, fmt.Errorf("Starting %s failed with %v", c.Path, err)
<add> }
<add>
<add> defer func() {
<add> waiterr := c.Wait()
<add> if waiterr != nil && err == nil {
<add> err = fmt.Errorf("Waiting for %s failed with %v", c.Path, waiterr)
<add> }
<add> }()
<add>
<add> sc := bufio.NewScanner(r)
<add> for sc.Scan() {
<add> entry := sc.Text()
<add> if strings.Contains(entry, mountPath) {
<add> out = append(out, entry, "\n")
<add> }
<add> }
<add>
<add> return out, nil
<add>}
<add>
<ide> // Remove will unmount and remove the given id.
<ide> func (a *Driver) Remove(id string) error {
<ide> a.pathCacheLock.Lock()
<ide> func (a *Driver) Remove(id string) error {
<ide> if !exists {
<ide> mountpoint = a.getMountpoint(id)
<ide> }
<del> if err := a.unmount(mountpoint); err != nil {
<del> // no need to return here, we can still try to remove since the `Rename` will fail below if still mounted
<del> logrus.Debugf("aufs: error while unmounting %s: %v", mountpoint, err)
<add>
<add> var retries int
<add> for {
<add> mounted, err := a.mounted(mountpoint)
<add> if err != nil {
<add> return err
<add> }
<add> if !mounted {
<add> break
<add> }
<add>
<add> if err := a.unmount(mountpoint); err != nil {
<add> if err != syscall.EBUSY {
<add> return fmt.Errorf("aufs: unmount error: %s: %v", mountpoint, err)
<add> }
<add> if retries >= 5 {
<add> out, debugErr := debugEBusy(mountpoint)
<add> if debugErr == nil {
<add> logrus.Warnf("debugEBusy returned %v", out)
<add> }
<add> return fmt.Errorf("aufs: unmount error after retries: %s: %v", mountpoint, err)
<add> }
<add> // If unmount returns EBUSY, it could be a transient error. Sleep and retry.
<add> retries++
<add> logrus.Warnf("unmount failed due to EBUSY: retry count: %d", retries)
<add> time.Sleep(100 * time.Millisecond)
<add> continue
<add> }
<add> break
<ide> }
<ide>
<ide> // Atomically remove each directory in turn by first moving it out of the
<ide> // way (so that docker doesn't find it anymore) before doing removal of
<ide> // the whole tree.
<ide> tmpMntPath := path.Join(a.mntPath(), fmt.Sprintf("%s-removing", id))
<ide> if err := os.Rename(mountpoint, tmpMntPath); err != nil && !os.IsNotExist(err) {
<add> if err == syscall.EBUSY {
<add> logrus.Warnf("os.Rename err due to EBUSY")
<add> out, debugErr := debugEBusy(mountpoint)
<add> if debugErr == nil {
<add> logrus.Warnf("debugEBusy returned %v", out)
<add> }
<add> }
<ide> return err
<ide> }
<ide> defer os.RemoveAll(tmpMntPath) | 1 |
Text | Text | add solution using all code | 022a2fce8a7de0f830cb8d413c7b82577c5a97fb | <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.english.md
<ide> tests:
<ide> <section id='solution'>
<ide>
<ide> ```js
<del>// solution required
<add><style>
<add> .injected-text {
<add> margin-bottom: -25px;
<add> text-align: center;
<add> }
<add>
<add> .box {
<add> border-style: solid;
<add> border-color: black;
<add> border-width: 5px;
<add> text-align: center;
<add> }
<add>
<add> .yellow-box {
<add> background-color: yellow;
<add> padding: 10px;
<add> }
<add>
<add> .red-box {
<add> background-color: crimson;
<add> color: #fff;
<add> margin-top: 40px;
<add> margin-right: 20px;
<add> margin-bottom: 20px;
<add> margin-left: 40px;
<add> }
<add>
<add> .blue-box {
<add> background-color: blue;
<add> color: #fff;
<add> margin-top: 40px;
<add> margin-right: 20px;
<add> margin-bottom: 20px;
<add> margin-left: 40px;
<add> }
<add></style>
<add><h5 class="injected-text">margin</h5>
<add>
<add><div class="box yellow-box">
<add> <h5 class="box red-box">padding</h5>
<add> <h5 class="box blue-box">padding</h5>
<add></div>
<ide> ```
<ide> </section> | 1 |
Python | Python | fix local storage test failurs under python 3.2 | 028bd5279b89e0b4885ebe067b4a54210c77c8b3 | <ide><path>libcloud/storage/drivers/local.py
<ide>
<ide> from libcloud.utils.files import read_in_chunks
<ide> from libcloud.utils.py3 import relpath
<add>from libcloud.utils.py3 import u
<ide> from libcloud.common.base import Connection
<ide> from libcloud.storage.base import Object, Container, StorageDriver
<ide> from libcloud.common.types import LibcloudError
<ide> def _make_object(self, container, object_name):
<ide> # use only the mtime attribute here. If the file contents change,
<ide> # the underlying file-system will change mtime
<ide> data_hash = self._get_hash_function()
<del> data_hash.update(str(stat.st_mtime))
<add> data_hash.update(u(stat.st_mtime).encode('ascii'))
<ide> data_hash = data_hash.hexdigest()
<ide>
<ide> extra = {}
<ide><path>libcloud/test/storage/test_local.py
<ide> def test_download_object_as_stream_success(self):
<ide>
<ide> data = ''
<ide> for buff in stream:
<del> data += buff
<add> data += buff.decode('utf-8')
<ide>
<ide> self.assertTrue(len(data), 4096)
<ide> | 2 |
PHP | PHP | add validation for the http method | 83dbcd8b8d572237ddc93ff52628e0ee8c5d9c55 | <ide><path>src/Network/Request.php
<ide> public function getMethod()
<ide> public function withMethod($method)
<ide> {
<ide> $new = clone $this;
<add>
<add> if (!is_string($method) ||
<add> !preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)
<add> ) {
<add> throw new InvalidArgumentException(sprintf(
<add> 'Unsupported HTTP method "%s" provided',
<add> $method
<add> ));
<add> }
<ide> $new->_environment['REQUEST_METHOD'] = $method;
<ide> return $new;
<ide> }
<ide><path>tests/TestCase/Network/RequestTest.php
<ide> public function testWithMethod()
<ide> $this->assertEquals('put', $new->getMethod());
<ide> }
<ide>
<add> /**
<add> * Test withMethod() and invalid data
<add> *
<add> * @expectedException InvalidArgumentException
<add> * @expectedExceptionMessage Unsupported HTTP method "no good" provided
<add> * @return void
<add> */
<add> public function testWithMethodInvalid()
<add> {
<add> $request = new Request([
<add> 'environment' => ['REQUEST_METHOD' => 'delete']
<add> ]);
<add> $request->withMethod('no good');
<add> }
<add>
<ide> /**
<ide> * Test host retrieval.
<ide> * | 2 |
Text | Text | recommend opening issue on atom/atom | 9f1a3c6effcbfb07b05976e4fd6053a043d3c986 | <ide><path>CONTRIBUTING.md
<ide> The following is a set of guidelines for contributing to Atom and its packages,
<ide> which are hosted in the [Atom Organization](https://github.com/atom) on GitHub.
<ide> If you're unsure which package is causing your problem or if you're having an
<del>issue with Atom core, please use the feedback form in the application or email
<del>[atom@github.com](mailto:atom@github.com). These are just guidelines, not rules,
<del>use your best judgement and feel free to propose changes to this document in a
<del>pull request.
<add>issue with Atom core, please open an issue on the [main atom repository](https://github.com/atom/atom/issues).
<add>These are just guidelines, not rules, use your best judgement and feel free to
<add>propose changes to this document in a pull request.
<ide>
<ide> ## Submitting Issues
<ide> | 1 |
Ruby | Ruby | extract notes from files in binary | 2495a0ba33832d20e3eadc163999dd40123e10c1 | <ide><path>railties/lib/rails/source_annotation_extractor.rb
<ide> def find_in(dir)
<ide> # Otherwise it returns an empty hash.
<ide> def extract_annotations_from(file, pattern)
<ide> lineno = 0
<del> result = File.readlines(file).inject([]) do |list, line|
<add> result = File.readlines(file, encoding: Encoding::BINARY).inject([]) do |list, line|
<ide> lineno += 1
<ide> next list unless line =~ pattern
<ide> list << Annotation.new(lineno, $1, $2) | 1 |
PHP | PHP | prevent zero only lines from being emptied | bae556e73fc18fbf081eba7862fb3767be1a5e2a | <ide><path>lib/Cake/Network/Email/CakeEmail.php
<ide> protected function _wrap($message, $wrapLength = CakeEmail::LINE_LENGTH_MUST) {
<ide> $cut = ($wrapLength == CakeEmail::LINE_LENGTH_MUST);
<ide>
<ide> foreach ($lines as $line) {
<del> if (empty($line)) {
<add> if (empty($line) && $line !== '0') {
<ide> $formatted[] = '';
<ide> continue;
<ide> }
<ide><path>lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
<ide> public function testWrapForJapaneseEncoding() {
<ide> $this->assertEquals($expected, $result['message']);
<ide> }
<ide>
<add>/**
<add> * testZeroOnlyLinesNotBeingEmptied()
<add> *
<add> * @return void
<add> */
<add> public function testZeroOnlyLinesNotBeingEmptied() {
<add> $message = "Lorem\r\n0\r\n0\r\nipsum";
<add>
<add> $this->CakeEmail->reset();
<add> $this->CakeEmail->transport('Debug');
<add> $this->CakeEmail->from('cake@cakephp.org');
<add> $this->CakeEmail->to('cake@cakephp.org');
<add> $this->CakeEmail->subject('Wordwrap Test');
<add> $this->CakeEmail->config(array('empty'));
<add> $result = $this->CakeEmail->send($message);
<add> $expected = "{$message}\r\n\r\n";
<add> $this->assertEquals($expected, $result['message']);
<add> }
<add>
<ide> /**
<ide> * CakeEmailTest::assertLineLengths()
<ide> * | 2 |
Python | Python | fix setup.py to include api_generating files | 2da41b12e72450089c9873ce52428fc1e0eb360d | <ide><path>scipy/base/setup.py
<ide> def generate_umath_c(ext,build_dir):
<ide> join('src','arraymethods.c'),
<ide> join('src','scalartypes.inc.src'),
<ide> join('src','arraytypes.inc.src'),
<del> join('include','scipy','*object.h')
<add> join('include','scipy','*object.h'),
<add> join(codegen_dir,'genapi.py'),
<add> join(codegen_dir,'*.txt')
<ide> ]
<ide>
<ide> config.add_extension('multiarray',
<ide> def generate_umath_c(ext,build_dir):
<ide> ],
<ide> depends = [join('src','ufuncobject.c'),
<ide> generate_umath_py,
<del> join(codegen_dir,'generate_ufunc_api.py')
<add> join(codegen_dir,'generate_ufunc_api.py'),
<ide> ]+deps,
<ide> )
<ide> | 1 |
Text | Text | add css syntax | e637a3c703f4e7c7219fc5c2dec425e766e1e8ba | <ide><path>guide/english/css/text-align/index.md
<ide> title: Text Align
<ide>
<ide> This CSS property describes the horizontal alignment of inline content in its parent block element. `text-align` does not control the alignment of block elements, it affects only their inline content.
<ide>
<add>### CSS Syntax
<add>`text-align: value;`
<add>
<add>value : `left|right|center|justify|initial|inherit`
<add>
<ide> ### Values:
<ide> The `text-align` property is specified as a single keyword chosen from the list of values below:
<ide> | 1 |
Text | Text | add test to prevent hardcoded pass | 895e6b8daf6338920221fa33ff4be59eef815e89 | <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
<ide> tests:
<ide> testString: 'assert(checkObj({city: "Seattle"}, "city") === "Seattle");'
<ide> - text: '<code>checkObj({city: "Seattle"}, "district")</code> should return <code>"Not Found"</code>.'
<ide> testString: 'assert(checkObj({city: "Seattle"}, "district") === "Not Found");'
<add> - text: '<code>checkObj({pet: "kitten", bed: "sleigh"}, "gift")</code> should return <code>"Not Found"</code>.'
<add> testString: 'assert(checkObj({pet: "kitten", bed: "sleigh"}, "gift") === "Not Found");'
<ide> ```
<ide>
<ide> </section> | 1 |
Ruby | Ruby | restore flash sweep | 7ace23abacfecf6d34630bb5141faf80a8b88634 | <ide><path>actionpack/lib/action_dispatch/middleware/flash.rb
<ide> def initialize(app)
<ide> end
<ide>
<ide> def call(env)
<del> if (session = env['rack.session']) && session.key?('flash')
<add> if (session = env['rack.session']) && (flash = session['flash'])
<ide> flash.sweep
<ide> end
<ide> | 1 |
Javascript | Javascript | fix logbox.ignorealllogs used with no argument | f28c7505fa5b4a7ddf1e9311d38dfcd15e8953a2 | <ide><path>Libraries/LogBox/LogBox.js
<ide> if (__DEV__) {
<ide> },
<ide>
<ide> ignoreAllLogs: (value?: ?boolean): void => {
<del> LogBoxData.setDisabled(!!value);
<add> LogBoxData.setDisabled(value == null ? true : value);
<ide> },
<ide>
<ide> uninstall: (): void => {
<ide><path>Libraries/LogBox/__tests__/LogBox-test.js
<ide> describe('LogBox', () => {
<ide> expect(LogBoxData.isDisabled()).toBe(true);
<ide> });
<ide>
<add> it('will not ignore logs for `ignoreAllLogs(false)`', () => {
<add> expect(LogBoxData.isDisabled()).toBe(false);
<add>
<add> LogBox.install();
<add>
<add> expect(LogBoxData.isDisabled()).toBe(false);
<add>
<add> LogBox.ignoreAllLogs(false);
<add>
<add> expect(LogBoxData.isDisabled()).toBe(false);
<add> });
<add>
<add> it('will ignore logs for `ignoreAllLogs()`', () => {
<add> expect(LogBoxData.isDisabled()).toBe(false);
<add>
<add> LogBox.install();
<add>
<add> expect(LogBoxData.isDisabled()).toBe(false);
<add>
<add> LogBox.ignoreAllLogs();
<add>
<add> expect(LogBoxData.isDisabled()).toBe(true);
<add> });
<add>
<ide> it('registers warnings', () => {
<ide> jest.mock('../Data/LogBoxData');
<ide> | 2 |
Javascript | Javascript | add test case | 5853ec5caed54a496bdd030c127134f1a089ce69 | <ide><path>test/configCases/externals/global/index.js
<add>afterEach(() => {
<add> delete global.EXTERNAL_TEST_GLOBAL;
<add>});
<add>
<add>it("should move externals in chunks into entry chunk", function() {
<add> global.EXTERNAL_TEST_GLOBAL = 42;
<add> // eslint-disable-next-line node/no-missing-require
<add> const result = require("external");
<add> expect(result).toBe(42);
<add>});
<ide><path>test/configCases/externals/global/webpack.config.js
<add>module.exports = {
<add> externals: {
<add> external: "global EXTERNAL_TEST_GLOBAL"
<add> }
<add>}; | 2 |
Python | Python | fix use of randint in test_mem_overlap.py | 51726e59137aa0ea6cf216d95f23fe788a7164ea | <ide><path>numpy/core/tests/test_mem_overlap.py
<ide> def test_diophantine_fuzz():
<ide> numbers = []
<ide> while min(feasible_count, infeasible_count) < min_count:
<ide> # Ensure big and small integer problems
<del> A_max = 1 + rng.randint(0, 11)**6
<del> U_max = rng.randint(0, 11)**6
<add> A_max = 1 + rng.randint(0, 11, dtype=np.intp)**6
<add> U_max = rng.randint(0, 11, dtype=np.intp)**6
<ide>
<ide> A_max = min(max_int, A_max)
<ide> U_max = min(max_int-1, U_max)
<ide>
<del> A = tuple(rng.randint(1, A_max+1) for j in range(ndim))
<del> U = tuple(rng.randint(0, U_max+2) for j in range(ndim))
<add> A = tuple(rng.randint(1, A_max+1, dtype=np.intp)
<add> for j in range(ndim))
<add> U = tuple(rng.randint(0, U_max+2, dtype=np.intp)
<add> for j in range(ndim))
<ide>
<ide> b_ub = min(max_int-2, sum(a*ub for a, ub in zip(A, U)))
<del> b = rng.randint(-1, b_ub+2)
<add> b = rng.randint(-1, b_ub+2, dtype=np.intp)
<ide>
<ide> if ndim == 0 and feasible_count < min_count:
<ide> b = 0
<ide> def check_may_share_memory_easy_fuzz(get_max_work, same_steps, min_count):
<ide> rng = np.random.RandomState(1234)
<ide>
<ide> def random_slice(n, step):
<del> start = rng.randint(0, n+1)
<del> stop = rng.randint(start, n+1)
<del> if rng.randint(0, 2) == 0:
<add> start = rng.randint(0, n+1, dtype=np.intp)
<add> stop = rng.randint(start, n+1, dtype=np.intp)
<add> if rng.randint(0, 2, dtype=np.intp) == 0:
<ide> stop, start = start, stop
<ide> step *= -1
<ide> return slice(start, stop, step)
<ide> def random_slice(n, step):
<ide> infeasible = 0
<ide>
<ide> while min(feasible, infeasible) < min_count:
<del> steps = tuple(rng.randint(1, 11) if rng.randint(0, 5) == 0 else 1
<add> steps = tuple(rng.randint(1, 11, dtype=np.intp)
<add> if rng.randint(0, 5, dtype=np.intp) == 0 else 1
<ide> for j in range(x.ndim))
<ide> if same_steps:
<ide> steps2 = steps
<ide> else:
<del> steps2 = tuple(rng.randint(1, 11) if rng.randint(0, 5) == 0 else 1
<add> steps2 = tuple(rng.randint(1, 11, dtype=np.intp)
<add> if rng.randint(0, 5, dtype=np.intp) == 0 else 1
<ide> for j in range(x.ndim))
<ide>
<ide> t1 = np.arange(x.ndim)
<ide> def test_internal_overlap_slices():
<ide> rng = np.random.RandomState(1234)
<ide>
<ide> def random_slice(n, step):
<del> start = rng.randint(0, n+1)
<del> stop = rng.randint(start, n+1)
<del> if rng.randint(0, 2) == 0:
<add> start = rng.randint(0, n+1, dtype=np.intp)
<add> stop = rng.randint(start, n+1, dtype=np.intp)
<add> if rng.randint(0, 2, dtype=np.intp) == 0:
<ide> stop, start = start, stop
<ide> step *= -1
<ide> return slice(start, stop, step)
<ide> def random_slice(n, step):
<ide> min_count = 5000
<ide>
<ide> while cases < min_count:
<del> steps = tuple(rng.randint(1, 11) if rng.randint(0, 5) == 0 else 1
<add> steps = tuple(rng.randint(1, 11, dtype=np.intp)
<add> if rng.randint(0, 5, dtype=np.intp) == 0 else 1
<ide> for j in range(x.ndim))
<ide> t1 = np.arange(x.ndim)
<ide> rng.shuffle(t1)
<ide> def test_internal_overlap_fuzz():
<ide> rng = np.random.RandomState(1234)
<ide>
<ide> while min(overlap, no_overlap) < min_count:
<del> ndim = rng.randint(1, 4)
<add> ndim = rng.randint(1, 4, dtype=np.intp)
<ide>
<del> strides = tuple(rng.randint(-1000, 1000) for j in range(ndim))
<del> shape = tuple(rng.randint(1, 30) for j in range(ndim))
<add> strides = tuple(rng.randint(-1000, 1000, dtype=np.intp)
<add> for j in range(ndim))
<add> shape = tuple(rng.randint(1, 30, dtype=np.intp)
<add> for j in range(ndim))
<ide>
<ide> a = as_strided(x, strides=strides, shape=shape)
<ide> result = check_internal_overlap(a) | 1 |
Javascript | Javascript | simplify string concatenation | 32cb926420602cf4d94d8c9cc5f135d4436d019e | <ide><path>test/parallel/test-http-multi-line-headers.js
<ide> const server = net.createServer(function(conn) {
<ide> const response =
<ide> 'HTTP/1.1 200 OK\r\n' +
<ide> 'Connection: close\r\n' +
<del> 'Content-Length: ' + body.length + '\r\n' +
<add> `Content-Length: ${body.length}\r\n` +
<ide> 'Content-Type: text/plain;\r\n' +
<ide> ' x-unix-mode=0600;\r\n' +
<ide> ' name="hello.txt"\r\n' + | 1 |
Text | Text | update index.md git file | 7881a603ba502245377f11a5cbd9dc2dbdd21d44 | <ide><path>guide/english/git/git-branch/index.md
<ide> Git's branching functionality lets you create new branches of a project to test
<ide> - [Rename a Branch](#rename-a-branch)
<ide> - [Delete a Branch](#delete-a-branch)
<ide> - [Compare Branches](#compare-branches)
<add>- [Update a Branch from Remote](#update-branch-from-remote)
<add>- [Track a Remote Branch](#track-a-remote-branch)
<ide> - [Help with Git Branch](#help-with-git-branch)
<ide> - [More Information](#more-information)
<del>- [Track a Remote Branch](#track-a-remote-branch)
<ide>
<ide> ### View Branches <a name="view-branches"></a>
<ide> To view the branches in a Git repository, run the command:
<ide> You'll see colored output for the changes between branches. For all lines that h
<ide>
<ide> If you want to see a list of all the branches that are completely merged into your current branch (in other words, your current branch includes all the changes of the other branches that are listed), run the command `git branch --merged`.
<ide>
<add>### Update a Branch from Remote <a name="update-branch-from-remote"></a>
<add>
<add>#### To update a local branch from remote:
<add>```shell
<add>git stash (optional, to save local changes which differs from the remote repository if any)
<add>```
<add>
<add>#### If you weren't already on the branch you want to work on:
<add>```shell
<add>git checkout my_local_branch
<add>```
<add>
<add>#### Finally pull from the remote branch
<add>```shell
<add>git pull
<add>```
<add>
<ide> ### Track a Remote Branch <a name="track-a-remote-branch"></a>
<add>
<ide> If you already have a branch and you want to track a remote branch, then you use `set-upstream-to` command:
<ide> ```shell
<ide> git branch --set-upstream-to origin/BRANCH
<ide> ```
<add>
<ide> Or you can use the `-u` flag (upstream) when you make your first push:
<ide> ```shell
<ide> git push -u origin BRANCH
<add>
<ide> ```
<ide>
<ide> ### Help with Git Branch <a name="help-with-git-branch"></a> | 1 |
PHP | PHP | update bodyparsermiddleware to psr 15 standard | c2f919fc2359be2b0cb70dc7f2df6ba756a6fc97 | <ide><path>src/Http/Middleware/BodyParserMiddleware.php
<ide> namespace Cake\Http\Middleware;
<ide>
<ide> use Cake\Http\Exception\BadRequestException;
<del>use Cake\Http\Response;
<ide> use Cake\Utility\Exception\XmlException;
<ide> use Cake\Utility\Xml;
<ide> use Psr\Http\Message\ResponseInterface;
<ide> use Psr\Http\Message\ServerRequestInterface;
<add>use Psr\Http\Server\MiddlewareInterface;
<add>use Psr\Http\Server\RequestHandlerInterface;
<ide>
<ide> /**
<ide> * Parse encoded request body data.
<ide> *
<ide> * You can also add your own request body parsers using the `addParser()` method.
<ide> */
<del>class BodyParserMiddleware
<add>class BodyParserMiddleware implements MiddlewareInterface
<ide> {
<ide> /**
<ide> * Registered Parsers
<ide> public function addParser(array $types, callable $parser): self
<ide> * Will modify the request adding a parsed body if the content-type is known.
<ide> *
<ide> * @param \Psr\Http\Message\ServerRequestInterface $request The request.
<del> * @param \Psr\Http\Message\ResponseInterface $response The response.
<del> * @param callable $next Callback to invoke the next middleware.
<del> * @return \Cake\Http\Response A response
<add> * @param \Psr\Http\Server\RequestHandlerInterface $handler The request handler.
<add> * @return \Cake\Http\ResponseInterface A response.
<ide> */
<del> public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next): Response
<add> public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
<ide> {
<ide> if (!in_array($request->getMethod(), $this->methods)) {
<del> return $next($request, $response);
<add> return $handler->handle($request);
<ide> }
<ide> list($type) = explode(';', $request->getHeaderLine('Content-Type'));
<ide> $type = strtolower($type);
<ide> if (!isset($this->parsers[$type])) {
<del> return $next($request, $response);
<add> return $handler->handle($request);
<ide> }
<ide>
<ide> $parser = $this->parsers[$type];
<ide> public function __invoke(ServerRequestInterface $request, ResponseInterface $res
<ide> }
<ide> $request = $request->withParsedBody($result);
<ide>
<del> return $next($request, $response);
<add> return $handler->handle($request);
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/Http/Middleware/BodyParserMiddlewareTest.php
<ide> use Cake\Http\Response;
<ide> use Cake\Http\ServerRequest;
<ide> use Cake\TestSuite\TestCase;
<add>use TestApp\Http\TestRequestHandler;
<ide>
<ide> /**
<ide> * Test for BodyParser
<ide> public function testInvokeMismatchedType($method)
<ide> ],
<ide> 'input' => 'a,b,c',
<ide> ]);
<del> $response = new Response();
<del> $next = function ($req, $res) {
<add> $handler = new TestRequestHandler(function ($req) {
<ide> $this->assertEquals([], $req->getParsedBody());
<ide>
<del> return $res;
<del> };
<del> $parser($request, $response, $next);
<add> return new Response();
<add> });
<add> $parser->process($request, $handler);
<ide> }
<ide>
<ide> /**
<ide> public function testInvokeCaseInsensitiveContentType($method)
<ide> ],
<ide> 'input' => '{"title": "yay"}',
<ide> ]);
<del> $response = new Response();
<del> $next = function ($req, $res) {
<add> $handler = new TestRequestHandler(function ($req) {
<ide> $this->assertEquals(['title' => 'yay'], $req->getParsedBody());
<ide>
<del> return $res;
<del> };
<del> $parser($request, $response, $next);
<add> return new Response();
<add> });
<add> $parser->process($request, $handler);
<ide> }
<ide>
<ide> /**
<ide> public function testInvokeParse($method)
<ide> ],
<ide> 'input' => '{"title": "yay"}',
<ide> ]);
<del> $response = new Response();
<del> $next = function ($req, $res) {
<add> $handler = new TestRequestHandler(function ($req) {
<ide> $this->assertEquals(['title' => 'yay'], $req->getParsedBody());
<ide>
<del> return $res;
<del> };
<del> $parser($request, $response, $next);
<add> return new Response();
<add> });
<add> $parser->process($request, $handler);
<ide> }
<ide>
<ide> /**
<ide> public function testInvokeParseStripCharset()
<ide> ],
<ide> 'input' => '{"title": "yay"}',
<ide> ]);
<del> $response = new Response();
<del> $next = function ($req, $res) {
<add> $handler = new TestRequestHandler(function ($req) {
<ide> $this->assertEquals(['title' => 'yay'], $req->getParsedBody());
<ide>
<del> return $res;
<del> };
<del> $parser($request, $response, $next);
<add> return new Response();
<add> });
<add> $parser->process($request, $handler);
<ide> }
<ide>
<ide> /**
<ide> public function testInvokeNoParseOnSafe($method)
<ide> ],
<ide> 'input' => '{"title": "yay"}',
<ide> ]);
<del> $response = new Response();
<del> $next = function ($req, $res) {
<add> $handler = new TestRequestHandler(function ($req) {
<ide> $this->assertEquals([], $req->getParsedBody());
<ide>
<del> return $res;
<del> };
<del> $parser($request, $response, $next);
<add> return new Response();
<add> });
<add> $parser->process($request, $handler);
<ide> }
<ide>
<ide> /**
<ide> public function testInvokeXml()
<ide> ],
<ide> 'input' => $xml,
<ide> ]);
<del> $response = new Response();
<del> $next = function ($req, $res) {
<add> $handler = new TestRequestHandler(function ($req) {
<ide> $expected = [
<ide> 'article' => ['title' => 'yay'],
<ide> ];
<ide> $this->assertEquals($expected, $req->getParsedBody());
<ide>
<del> return $res;
<del> };
<del>
<add> return new Response();
<add> });
<ide> $parser = new BodyParserMiddleware(['xml' => true]);
<del> $parser($request, $response, $next);
<add> $parser->process($request, $handler);
<ide> }
<ide>
<ide> /**
<ide> public function testInvokeXmlCdata()
<ide> ],
<ide> 'input' => $xml,
<ide> ]);
<del> $response = new Response();
<del> $next = function ($req, $res) {
<add> $handler = new TestRequestHandler(function ($req) {
<ide> $expected = [
<ide> 'article' => [
<ide> 'id' => 1,
<ide> public function testInvokeXmlCdata()
<ide> ];
<ide> $this->assertEquals($expected, $req->getParsedBody());
<ide>
<del> return $res;
<del> };
<del>
<add> return new Response();
<add> });
<ide> $parser = new BodyParserMiddleware(['xml' => true]);
<del> $parser($request, $response, $next);
<add> $parser->process($request, $handler);
<ide> }
<ide>
<ide> /**
<ide> public function testInvokeXmlInternalEntities()
<ide> 'input' => $xml,
<ide> ]);
<ide> $response = new Response();
<del> $next = function ($req, $res) {
<add> $handler = new TestRequestHandler(function ($req) {
<ide> $this->assertEquals([], $req->getParsedBody());
<ide>
<del> return $res;
<del> };
<del>
<add> return new Response();
<add> });
<ide> $parser = new BodyParserMiddleware(['xml' => true]);
<del> $parser($request, $response, $next);
<add> $parser->process($request, $handler);
<ide> }
<ide>
<ide> /**
<ide> public function testInvokeParseNoArray()
<ide> ],
<ide> 'input' => 'lol',
<ide> ]);
<del> $response = new Response();
<del> $next = function ($req, $res) {
<del> return $res;
<del> };
<del>
<add> $handler = new TestRequestHandler(function ($req) {
<add> return new Response();
<add> });
<ide> $this->expectException(BadRequestException::class);
<ide> $parser = new BodyParserMiddleware();
<del> $parser($request, $response, $next);
<add> $parser->process($request, $handler);
<ide> }
<ide> }
<ide><path>tests/test_app/TestApp/Http/TestRequestHandler.php
<add><?php
<add>declare(strict_types=1);
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<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. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace TestApp\Http;
<add>
<add>use Psr\Http\Message\ResponseInterface;
<add>use Psr\Http\Message\ServerRequestInterface;
<add>use Psr\Http\Server\RequestHandlerInterface;
<add>
<add>class TestRequestHandler implements RequestHandlerInterface
<add>{
<add> public $callable;
<add>
<add> public function __construct(callable $callable)
<add> {
<add> $this->callable = $callable;
<add> }
<add>
<add> public function handle(ServerRequestInterface $request): ResponseInterface
<add> {
<add> return ($this->callable)($request);
<add> }
<add>} | 3 |
Ruby | Ruby | remove questionable test | 46a11a2b26b375ff1676b6e336cbd153c1041371 | <ide><path>Library/Homebrew/test/test_utils.rb
<ide> require 'testing_env'
<ide>
<ide> class UtilTests < Test::Unit::TestCase
<del>
<ide> def test_put_columns_empty
<ide> assert_nothing_raised do
<ide> # Issue #217 put columns with new results fails.
<ide> puts_columns []
<ide> end
<ide> end
<del>
<del> def test_arch_for_command
<del> # /usr/bin/svn only exists if the command-line tools are installed
<del> # Skip test on Xcode only systems
<del> return unless File.exist? '/usr/bin/svn'
<del>
<del> archs = archs_for_command '/usr/bin/svn'
<del> if `sw_vers -productVersion` =~ /10\.(\d+)/ and $1.to_i >= 9
<del> assert_equal 1, archs.length
<del> assert archs.include?(:x86_64)
<del> elsif `sw_vers -productVersion` =~ /10\.(\d+)/ and $1.to_i >= 7
<del> assert_equal 2, archs.length
<del> assert archs.include?(:x86_64)
<del> assert archs.include?(:i386)
<del> elsif `sw_vers -productVersion` =~ /10\.(\d+)/ and $1.to_i == 6
<del> assert_equal 3, archs.length
<del> assert archs.include?(:x86_64)
<del> assert archs.include?(:i386)
<del> assert archs.include?(:ppc7400)
<del> else
<del> assert_equal 2, archs.length
<del> assert archs.include?(:i386)
<del> assert archs.include?(:ppc7400)
<del> end
<del> end
<del>
<ide> end | 1 |
Java | Java | fix "coercion" spelling mistakes in javadoc | 8faf01f56db7697198842f9481e1f7d4814e365d | <ide><path>spring-context/src/main/java/org/springframework/format/AnnotationFormatterFactory.java
<ide> /*
<del> * Copyright 2002-2012 the original author or authors.
<add> * Copyright 2002-2014 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide>
<ide> /**
<ide> * Get the Printer to print the value of a field of {@code fieldType} annotated with {@code annotation}.
<del> * If the type <T> the printer accepts is not assignable to {@code fieldType}, a coersion from {@code fieldType} to <T> will be attempted before the Printer is invoked.
<add> * If the type <T> the printer accepts is not assignable to {@code fieldType}, a coercion from {@code fieldType} to <T> will be attempted before the Printer is invoked.
<ide> * @param annotation the annotation instance
<ide> * @param fieldType the type of field that was annotated
<ide> * @return the printer
<ide>
<ide> /**
<ide> * Get the Parser to parse a submitted value for a field of {@code fieldType} annotated with {@code annotation}.
<del> * If the object the parser returns is not assignable to {@code fieldType}, a coersion to {@code fieldType} will be attempted before the field is set.
<add> * If the object the parser returns is not assignable to {@code fieldType}, a coercion to {@code fieldType} will be attempted before the field is set.
<ide> * @param annotation the annotation instance
<ide> * @param fieldType the type of field that was annotated
<ide> * @return the parser
<ide><path>spring-context/src/main/java/org/springframework/format/FormatterRegistry.java
<ide> /*
<del> * Copyright 2002-2012 the original author or authors.
<add> * Copyright 2002-2014 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public interface FormatterRegistry extends ConverterRegistry {
<ide> /**
<ide> * Adds a Formatter to format fields of the given type.
<ide> * <p>On print, if the Formatter's type T is declared and {@code fieldType} is not assignable to T,
<del> * a coersion to T will be attempted before delegating to {@code formatter} to print a field value.
<add> * a coercion to T will be attempted before delegating to {@code formatter} to print a field value.
<ide> * On parse, if the parsed object returned by {@code formatter} is not assignable to the runtime field type,
<del> * a coersion to the field type will be attempted before returning the parsed field value.
<add> * a coercion to the field type will be attempted before returning the parsed field value.
<ide> * @param fieldType the field type to format
<ide> * @param formatter the formatter to add
<ide> */
<ide> public interface FormatterRegistry extends ConverterRegistry {
<ide> * The formatter will delegate to the specified {@code printer} for printing
<ide> * and the specified {@code parser} for parsing.
<ide> * <p>On print, if the Printer's type T is declared and {@code fieldType} is not assignable to T,
<del> * a coersion to T will be attempted before delegating to {@code printer} to print a field value.
<add> * a coercion to T will be attempted before delegating to {@code printer} to print a field value.
<ide> * On parse, if the object returned by the Parser is not assignable to the runtime field type,
<del> * a coersion to the field type will be attempted before returning the parsed field value.
<add> * a coercion to the field type will be attempted before returning the parsed field value.
<ide> * @param fieldType the field type to format
<ide> * @param printer the printing part of the formatter
<ide> * @param parser the parsing part of the formatter | 2 |
Javascript | Javascript | improve $rollbackviewvalue description & example | 25e8c5927ca94eb749f666f579a6f56de6fd8ca8 | <ide><path>src/ng/directive/ngModel.js
<ide> var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
<ide> * which may be caused by a pending debounced event or because the input is waiting for a some
<ide> * future event.
<ide> *
<del> * If you have an input that uses `ng-model-options` to set up debounced events or events such
<del> * as blur you can have a situation where there is a period when the `$viewValue`
<del> * is out of synch with the ngModel's `$modelValue`.
<add> * If you have an input that uses `ng-model-options` to set up debounced updates or updates that
<add> * depend on special events such as blur, you can have a situation where there is a period when
<add> * the `$viewValue` is out of sync with the ngModel's `$modelValue`.
<ide> *
<del> * In this case, you can run into difficulties if you try to update the ngModel's `$modelValue`
<add> * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update
<add> * and reset the input to the last committed view value.
<add> *
<add> * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue`
<ide> * programmatically before these debounced/future events have resolved/occurred, because Angular's
<ide> * dirty checking mechanism is not able to tell whether the model has actually changed or not.
<ide> *
<ide> var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
<ide> * angular.module('cancel-update-example', [])
<ide> *
<ide> * .controller('CancelUpdateController', ['$scope', function($scope) {
<del> * $scope.resetWithCancel = function(e) {
<del> * if (e.keyCode == 27) {
<del> * $scope.myForm.myInput1.$rollbackViewValue();
<del> * $scope.myValue = '';
<del> * }
<del> * };
<del> * $scope.resetWithoutCancel = function(e) {
<add> * $scope.model = {};
<add> *
<add> * $scope.setEmpty = function(e, value, rollback) {
<ide> * if (e.keyCode == 27) {
<del> * $scope.myValue = '';
<add> * e.preventDefault();
<add> * if (rollback) {
<add> * $scope.myForm[value].$rollbackViewValue();
<add> * }
<add> * $scope.model[value] = '';
<ide> * }
<ide> * };
<ide> * }]);
<ide> * </file>
<ide> * <file name="index.html">
<ide> * <div ng-controller="CancelUpdateController">
<del> * <p>Try typing something in each input. See that the model only updates when you
<del> * blur off the input.
<del> * </p>
<del> * <p>Now see what happens if you start typing then press the Escape key</p>
<add> * <p>Both of these inputs are only updated if they are blurred. Hitting escape should
<add> * empty them. Follow these steps and observe the difference:</p>
<add> * <ol>
<add> * <li>Type something in the input. You will see that the model is not yet updated</li>
<add> * <li>Press the Escape key.
<add> * <ol>
<add> * <li> In the first example, nothing happens, because the model is already '', and no
<add> * update is detected. If you blur the input, the model will be set to the current view.
<add> * </li>
<add> * <li> In the second example, the pending update is cancelled, and the input is set back
<add> * to the last committed view value (''). Blurring the input does nothing.
<add> * </li>
<add> * </ol>
<add> * </li>
<add> * </ol>
<ide> *
<ide> * <form name="myForm" ng-model-options="{ updateOn: 'blur' }">
<del> * <p id="inputDescription1">With $rollbackViewValue()</p>
<del> * <input name="myInput1" aria-describedby="inputDescription1" ng-model="myValue"
<del> * ng-keydown="resetWithCancel($event)"><br/>
<del> * myValue: "{{ myValue }}"
<add> * <div>
<add> * <p id="inputDescription1">Without $rollbackViewValue():</p>
<add> * <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
<add> * ng-keydown="setEmpty($event, 'value1')">
<add> * value1: "{{ model.value1 }}"
<add> * </div>
<ide> *
<del> * <p id="inputDescription2">Without $rollbackViewValue()</p>
<del> * <input name="myInput2" aria-describedby="inputDescription2" ng-model="myValue"
<del> * ng-keydown="resetWithoutCancel($event)"><br/>
<del> * myValue: "{{ myValue }}"
<add> * <div>
<add> * <p id="inputDescription2">With $rollbackViewValue():</p>
<add> * <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
<add> * ng-keydown="setEmpty($event, 'value2', true)">
<add> * value2: "{{ model.value2 }}"
<add> * </div>
<ide> * </form>
<ide> * </div>
<ide> * </file>
<add> <file name="style.css">
<add> div {
<add> display: table-cell;
<add> }
<add> div:nth-child(1) {
<add> padding-right: 30px;
<add> }
<add>
<add> </file>
<ide> * </example>
<ide> */
<ide> this.$rollbackViewValue = function() { | 1 |
Text | Text | add instructions for testing website locally | 60b2398cc51bf0e7647248fc87d54c93b32993ab | <ide><path>CONTRIBUTING.md
<ide> The core team will be monitoring for pull requests. When we get one, we'll run s
<ide> 1. Fork the repo and create your branch from `master`.
<ide> 2. **Describe your test plan in your commit.** If you've added code that should be tested, add tests!
<ide> 3. If you've changed APIs, update the documentation.
<del>4. Add the copyright notice to the top of any new files you've added.
<del>5. Ensure tests pass on Travis and Circle CI.
<del>6. Make sure your code lints (`node linter.js <files touched>`).
<del>7. Squash your commits (`git rebase -i`).
<del>8. If you haven't already, sign the [CLA](https://code.facebook.com/cla).
<add>4. If you've updated the docs, verify the website locally and submit screenshots if applicable
<add>```
<add>$ cd website
<add>$ npm install && npm start
<add>go to: http://localhost:8079/react-native/index.html
<add>```
<add>5. Add the copyright notice to the top of any new files you've added.
<add>6. Ensure tests pass on Travis and Circle CI.
<add>7. Make sure your code lints (`node linter.js <files touched>`).
<add>8. Squash your commits (`git rebase -i`).
<add>9. If you haven't already, sign the [CLA](https://code.facebook.com/cla).
<ide>
<ide> #### Copyright Notice for files
<ide> | 1 |
PHP | PHP | change doc block | 8934a9189f62907adc9e896c59262a51c06efe1d | <ide><path>src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
<ide> trait HasAttributes
<ide> protected $changes = [];
<ide>
<ide> /**
<del> * The attributes that should be cast to native types.
<add> * The attributes that should be cast.
<ide> *
<ide> * @var array
<ide> */ | 1 |
Javascript | Javascript | add displayname to component spec functions | 3bf12bba0d650383c5b9a9140f2aa2d034e7a017 | <ide><path>src/core/ReactCompositeComponent.js
<ide> function mixSpecIntoComponent(ConvenienceConstructor, spec) {
<ide> }
<ide> } else {
<ide> proto[name] = property;
<add> if (__DEV__) {
<add> // Add verbose displayName to the function, which helps when looking
<add> // at profiling tools.
<add> if (typeof property === 'function' && spec.displayName) {
<add> proto[name].displayName = spec.displayName + '_' + name;
<add> }
<add> }
<ide> }
<ide> }
<ide> } | 1 |
PHP | PHP | fix more doc blocks | b221b021bc270725f2e183293aed8d4c5a101964 | <ide><path>src/Collection/CollectionTrait.php
<ide> public function each(callable $c) {
<ide> *
<ide> * @param callable $c the method that will receive each of the elements and
<ide> * returns true whether or not they should be in the resulting collection.
<del> * @return \Cake\Collection\Iterator\FilterIterator;
<add> * @return \Cake\Collection\Iterator\FilterIterator
<ide> */
<ide> public function filter(callable $c) {
<ide> return new FilterIterator($this, $c);
<ide> public function filter(callable $c) {
<ide> *
<ide> * @param callable $c the method that will receive each of the elements and
<ide> * returns true whether or not they should be out of the resulting collection.
<del> * @return \Cake\Collection\Iterator\FilterIterator;
<add> * @return \Cake\Collection\Iterator\FilterIterator
<ide> */
<ide> public function reject(callable $c) {
<ide> return new FilterIterator($this, function ($key, $value, $items) use ($c) {
<ide><path>src/Database/Query.php
<ide> public function orHaving($conditions, $types = []) {
<ide> * Pages should start at 1.
<ide> *
<ide> * @param integer $num The page number you want.
<del> * @reutrn Query
<add> * @return Query
<ide> */
<ide> public function page($page) {
<ide> $limit = $this->clause('limit');
<ide> public function delete($table = null) {
<ide> * ->epilog('RETURNING id');
<ide> * }}}
<ide> *
<del> * @params string|QueryExpression the expression to be appended
<add> * @param string|QueryExpression the expression to be appended
<ide> * @return Query
<ide> */
<ide> public function epilog($expression = null) {
<ide><path>src/Database/Schema/Collection.php
<ide> class Collection {
<ide> /**
<ide> * Schema dialect instance.
<ide> *
<del> * @var
<add> * @var Cake\Database\Schema\BaseSchema
<ide> */
<ide> protected $_dialect;
<ide>
<ide><path>src/Database/StatementInterface.php
<ide> public function errorInfo();
<ide> * that binding parameters from this method will not perform any custom type conversion
<ide> * as it would normally happen when calling `bindValue`
<ide> *
<del> * $param array $params list of values to be bound to query
<add> * @param array $params list of values to be bound to query
<ide> * @return boolean true on success, false otherwise
<ide> */
<ide> public function execute($params = null);
<ide><path>src/Database/TypeConverterTrait.php
<ide> trait TypeConverterTrait {
<ide> * Converts a give value to a suitable database value based on type
<ide> * and return relevant internal statement type
<ide> *
<del> * @param mixed value
<add> * @param mixed $value
<ide> * @param string $type
<ide> * @return array list containing converted value and internal type
<ide> */
<ide><path>src/Log/Log.php
<ide> public static function config($key, $config = null) {
<ide> * Get a logging engine.
<ide> *
<ide> * @param string $name Key name of a configured adapter to get.
<del> * @return $mixed instance of BaseLog or false if not found
<add> * @return mixed Instance of BaseLog or false if not found
<ide> */
<ide> public static function engine($name) {
<ide> static::_init();
<ide><path>src/Network/Http/FormData/Part.php
<ide> public function disposition($disposition = null) {
<ide> * Get/set the contentId for a part.
<ide> *
<ide> * @param null|string $id The content id.
<del> * @return mixed.
<add> * @return mixed
<ide> */
<ide> public function contentId($id = null) {
<ide> if ($id === null) {
<ide><path>src/ORM/Association.php
<ide> public abstract function cascadeDelete(Entity $entity, $options = []);
<ide> * association. This means that rows in the 'target' table would miss important
<ide> * or required information if the row in 'source' did not exist.
<ide> *
<add> * @param \Cake\ORM\Table $side The potential Table with ownership
<ide> * @return boolean
<ide> */
<ide> public abstract function isOwningSide(Table $side);
<ide><path>src/ORM/Association/BelongsTo.php
<ide> public function property($name = null) {
<ide> * association. This means that rows in the 'target' table would miss important
<ide> * or required information if the row in 'source' did not exist.
<ide> *
<add> * @param \Cake\ORM\Table $side The potential Table with ownership
<ide> * @return boolean
<ide> */
<ide> public function isOwningSide(Table $side) {
<ide><path>src/ORM/Association/BelongsToMany.php
<ide> public function cascadeDelete(Entity $entity, $options = []) {
<ide> * Returns boolean true, as both of the tables 'own' rows in the other side
<ide> * of the association via the joint table.
<ide> *
<add> * @param \Cake\ORM\Table $side The potential Table with ownership
<ide> * @return boolean
<ide> */
<ide> public function isOwningSide(Table $side) {
<ide><path>src/ORM/Association/HasMany.php
<ide> public function eagerLoader(array $options) {
<ide> * association. This means that rows in the 'target' table would miss important
<ide> * or required information if the row in 'source' did not exist.
<ide> *
<add> * @param \Cake\ORM\Table $side The potential Table with ownership
<ide> * @return boolean
<ide> */
<ide> public function isOwningSide(Table $side) {
<ide><path>src/ORM/Association/HasOne.php
<ide> public function property($name = null) {
<ide> * association. This means that rows in the 'target' table would miss important
<ide> * or required information if the row in 'source' did not exist.
<ide> *
<add> * @param \Cake\ORM\Table $side The potential Table with ownership
<ide> * @return boolean
<ide> */
<ide> public function isOwningSide(Table $side) {
<ide><path>src/ORM/Query.php
<ide> public function hydrate($enable = null) {
<ide> /**
<ide> * Decorates the ResultSet iterator with MapReduce routines
<ide> *
<del> * @param $result Cake\ORM\ResultCollectionTrait original results
<add> * @param Cake\ORM\ResultCollectionTrait $result Original results
<ide> * @return Cake\ORM\ResultCollectionTrait
<ide> */
<ide> protected function _decorateResults($result) {
<ide><path>src/TestSuite/Fixture/TestFixture.php
<ide> class TestFixture {
<ide> /**
<ide> * The Cake\Database\Schema\Table for this fixture.
<ide> *
<del> * @var Cake\Database\Schema\Table;
<add> * @var Cake\Database\Schema\Table
<ide> */
<ide> protected $_schema;
<ide>
<ide><path>src/Validation/RulesProvider.php
<ide> */
<ide> class RulesProvider {
<ide>
<add>/**
<add> * The class to proxy, defaults to \Cake\Validation\Validation in construction
<add> *
<add> * @var object
<add> */
<ide> protected $_class;
<ide>
<ide> /**
<ide><path>src/View/Input/DateTime.php
<ide> class DateTime implements InputInterface {
<ide> /**
<ide> * Select box widget.
<ide> *
<del> * @var Cake\View\Input\Select;
<add> * @var Cake\View\Input\Select
<ide> */
<ide> protected $_select;
<ide> | 16 |
Text | Text | add v3.27.0-beta.2 to changelog.md | 3a6a3ab2fcf666af5c4d5acf89042331c3c27328 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<del>### v3.27.0 (March 22, 2021)
<add>### v3.27.0-beta.2 (March 25, 2021)
<add>
<add>- [#19473](https://github.com/emberjs/ember.js/pull/19473) Update GlimmerVM to latest (fix compatibility for template import proposals)
<add>- [#19474](https://github.com/emberjs/ember.js/pull/19474) [FEATURE] Enable `(helper` and `(modifier` helpers
<add>
<add>### v3.27.0-beta.1 (March 22, 2021)
<ide>
<ide> - [#19382](https://github.com/emberjs/ember.js/pull/19382) / [#19430](https://github.com/emberjs/ember.js/pull/19430) [FEATURE] Remaining implementation work per [RFC #671](https://github.com/emberjs/rfcs/blob/master/text/0671-modernize-built-in-components-1.md).
<ide> - [#19457](https://github.com/emberjs/ember.js/pull/19457) / [#19463](https://github.com/emberjs/ember.js/pull/19463) / [#19464](https://github.com/emberjs/ember.js/pull/19464) / [#19467](https://github.com/emberjs/ember.js/pull/19467) [DEPRECATION] Add deprecation for the Ember Global per [RFC #706](https://github.com/emberjs/rfcs/blob/master/text/0706-deprecate-ember-global.md). | 1 |
Text | Text | add one more method affected in changelog | 0c62e141a3fc9b2d00935bb99d2d5f465e1a4fb4 | <ide><path>actionview/CHANGELOG.md
<ide> * Stop exposing public methods in view's helpers.
<ide>
<del> For example, in methods like `options_from_collection_for_select`,
<del> it was possible to call private methods from the objects used.
<add> For example, in methods like `options_from_collection_for_select`
<add> and `collection_select` it was possible to call private methods from
<add> the objects used.
<ide>
<ide> See [#33546](https://github.com/rails/rails/issues/33546) for details.
<ide> | 1 |
Javascript | Javascript | support numeric input to limitto | 1c8a7459c90efc77b1a0987f976e3bddab4565fe | <ide><path>src/ng/filter/limitTo.js
<ide> *
<ide> * @description
<ide> * Creates a new array or string containing only a specified number of elements. The elements
<del> * are taken from either the beginning or the end of the source array or string, as specified by
<del> * the value and sign (positive or negative) of `limit`.
<add> * are taken from either the beginning or the end of the source array, string or number, as specified by
<add> * the value and sign (positive or negative) of `limit`. If a number is used as input, it is
<add> * converted to a string.
<ide> *
<del> * @param {Array|string} input Source array or string to be limited.
<add> * @param {Array|string|number} input Source array, string or number to be limited.
<ide> * @param {string|number} limit The length of the returned array or string. If the `limit` number
<ide> * is positive, `limit` number of items from the beginning of the source array/string are copied.
<ide> * If the number is negative, `limit` number of items from the end of the source array/string
<ide> .controller('ExampleController', ['$scope', function($scope) {
<ide> $scope.numbers = [1,2,3,4,5,6,7,8,9];
<ide> $scope.letters = "abcdefghi";
<add> $scope.longNumber = 2345432342;
<ide> $scope.numLimit = 3;
<ide> $scope.letterLimit = 3;
<add> $scope.longNumberLimit = 3;
<ide> }]);
<ide> </script>
<ide> <div ng-controller="ExampleController">
<ide> Limit {{numbers}} to: <input type="integer" ng-model="numLimit">
<ide> <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
<ide> Limit {{letters}} to: <input type="integer" ng-model="letterLimit">
<ide> <p>Output letters: {{ letters | limitTo:letterLimit }}</p>
<add> Limit {{longNumber}} to: <input type="integer" ng-model="longNumberLimit">
<add> <p>Output long number: {{ longNumber | limitTo:longNumberLimit }}</p>
<ide> </div>
<ide> </file>
<ide> <file name="protractor.js" type="protractor">
<ide> var numLimitInput = element(by.model('numLimit'));
<ide> var letterLimitInput = element(by.model('letterLimit'));
<add> var longNumberLimitInput = element(by.model('longNumberLimit'));
<ide> var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
<ide> var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
<add> var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit'));
<ide>
<ide> it('should limit the number array to first three items', function() {
<ide> expect(numLimitInput.getAttribute('value')).toBe('3');
<ide> expect(letterLimitInput.getAttribute('value')).toBe('3');
<add> expect(longNumberLimitInput.getAttribute('value')).toBe('3');
<ide> expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');
<ide> expect(limitedLetters.getText()).toEqual('Output letters: abc');
<add> expect(limitedLongNumber.getText()).toEqual('Output long number: 234');
<ide> });
<ide>
<ide> it('should update the output when -3 is entered', function() {
<ide> numLimitInput.clear();
<ide> numLimitInput.sendKeys('-3');
<ide> letterLimitInput.clear();
<ide> letterLimitInput.sendKeys('-3');
<add> longNumberLimitInput.clear();
<add> longNumberLimitInput.sendKeys('-3');
<ide> expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');
<ide> expect(limitedLetters.getText()).toEqual('Output letters: ghi');
<add> expect(limitedLongNumber.getText()).toEqual('Output long number: 342');
<ide> });
<ide>
<ide> it('should not exceed the maximum size of input array', function() {
<ide> numLimitInput.clear();
<ide> numLimitInput.sendKeys('100');
<ide> letterLimitInput.clear();
<ide> letterLimitInput.sendKeys('100');
<add> longNumberLimitInput.clear();
<add> longNumberLimitInput.sendKeys('100');
<ide> expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');
<ide> expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');
<add> expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342');
<ide> });
<ide> </file>
<ide> </example>
<ide> */
<ide> function limitToFilter(){
<ide> return function(input, limit) {
<add> if (isNumber(input)) input = input.toString();
<ide> if (!isArray(input) && !isString(input)) return input;
<ide>
<ide> if (Math.abs(Number(limit)) === Infinity) {
<ide><path>test/ng/filter/limitToSpec.js
<ide> describe('Filter: limitTo', function() {
<ide> var items;
<ide> var str;
<add> var number;
<ide> var limitTo;
<ide>
<ide> beforeEach(inject(function($filter) {
<ide> items = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
<ide> str = "tuvwxyz";
<add> number = 100.045;
<ide> limitTo = $filter('limitTo');
<ide> }));
<ide>
<ide> describe('Filter: limitTo', function() {
<ide> expect(limitTo(items, '3')).toEqual(['a', 'b', 'c']);
<ide> expect(limitTo(str, 3)).toEqual("tuv");
<ide> expect(limitTo(str, '3')).toEqual("tuv");
<add> expect(limitTo(number, 3)).toEqual("100");
<add> expect(limitTo(number, '3')).toEqual("100");
<ide> });
<ide>
<ide>
<ide> describe('Filter: limitTo', function() {
<ide> expect(limitTo(items, '-3')).toEqual(['f', 'g', 'h']);
<ide> expect(limitTo(str, -3)).toEqual("xyz");
<ide> expect(limitTo(str, '-3')).toEqual("xyz");
<add> expect(limitTo(number, -3)).toEqual("045");
<add> expect(limitTo(number, '-3')).toEqual("045");
<ide> });
<ide>
<ide>
<ide> describe('Filter: limitTo', function() {
<ide> });
<ide>
<ide>
<del> it('should return input if not String or Array', function() {
<del> expect(limitTo(1,1)).toEqual(1);
<add> it('should return input if not String or Array or Number', function() {
<ide> expect(limitTo(null, 1)).toEqual(null);
<ide> expect(limitTo(undefined, 1)).toEqual(undefined);
<ide> expect(limitTo({}, 1)).toEqual({});
<ide> describe('Filter: limitTo', function() {
<ide> expect(limitTo(str, '9')).toEqual(str);
<ide> expect(limitTo(str, -9)).toEqual(str);
<ide> expect(limitTo(str, '-9')).toEqual(str);
<add> expect(limitTo(number, 9)).toEqual(number.toString());
<add> expect(limitTo(number, '-9')).toEqual(number.toString());
<ide> });
<ide>
<ide> it('should return entire input array when limited by Infinity', function() { | 2 |
PHP | PHP | implement jsonserializable in paginators | 9bc717d955da4943c43cbb042a707e75ebb9265f | <ide><path>src/Illuminate/Pagination/LengthAwarePaginator.php
<ide>
<ide> use Countable;
<ide> use ArrayAccess;
<add>use JsonSerializable;
<ide> use IteratorAggregate;
<ide> use Illuminate\Support\Collection;
<ide> use Illuminate\Contracts\Support\Jsonable;
<ide> use Illuminate\Contracts\Support\Arrayable;
<ide> use Illuminate\Contracts\Pagination\Presenter;
<ide> use Illuminate\Contracts\Pagination\LengthAwarePaginator as LengthAwarePaginatorContract;
<ide>
<del>class LengthAwarePaginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, LengthAwarePaginatorContract
<add>class LengthAwarePaginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, JsonSerializable, Jsonable, LengthAwarePaginatorContract
<ide> {
<ide> /**
<ide> * The total number of items before slicing.
<ide> public function toArray()
<ide> ];
<ide> }
<ide>
<add> /**
<add> * Convert the object into something JSON serializable.
<add> *
<add> * @return array
<add> */
<add> public function jsonSerialize()
<add> {
<add> return $this->toArray();
<add> }
<add>
<ide> /**
<ide> * Convert the object to its JSON representation.
<ide> *
<ide> public function toArray()
<ide> */
<ide> public function toJson($options = 0)
<ide> {
<del> return json_encode($this->toArray(), $options);
<add> return json_encode($this->jsonSerialize(), $options);
<ide> }
<ide> }
<ide><path>src/Illuminate/Pagination/Paginator.php
<ide>
<ide> use Countable;
<ide> use ArrayAccess;
<add>use JsonSerializable;
<ide> use IteratorAggregate;
<ide> use Illuminate\Support\Collection;
<ide> use Illuminate\Contracts\Support\Jsonable;
<ide> use Illuminate\Contracts\Support\Arrayable;
<ide> use Illuminate\Contracts\Pagination\Presenter;
<ide> use Illuminate\Contracts\Pagination\Paginator as PaginatorContract;
<ide>
<del>class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, PaginatorContract
<add>class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, JsonSerializable, Jsonable, PaginatorContract
<ide> {
<ide> /**
<ide> * Determine if there are more items in the data source.
<ide> public function toArray()
<ide> ];
<ide> }
<ide>
<add> /**
<add> * Convert the object into something JSON serializable.
<add> *
<add> * @return array
<add> */
<add> public function jsonSerialize()
<add> {
<add> return $this->toArray();
<add> }
<add>
<ide> /**
<ide> * Convert the object to its JSON representation.
<ide> *
<ide> public function toArray()
<ide> */
<ide> public function toJson($options = 0)
<ide> {
<del> return json_encode($this->toArray(), $options);
<add> return json_encode($this->jsonSerialize(), $options);
<ide> }
<ide> } | 2 |
Javascript | Javascript | fix races in test-performance-eventlooputil | 135dd8876ee8a80c17d171cb2b13868359572eaf | <ide><path>test/parallel/test-performance-eventlooputil.js
<ide> if (nodeTiming.loopStart === -1) {
<ide> }
<ide>
<ide> setTimeout(mustCall(function r() {
<del> const t = Date.now();
<ide> const elu1 = eventLoopUtilization();
<ide>
<ide> // Force idle time to accumulate before allowing test to continue.
<ide> if (elu1.idle <= 0)
<ide> return setTimeout(mustCall(r), 5);
<ide>
<add> const t = Date.now();
<ide> while (Date.now() - t < SPIN_DUR) { }
<ide>
<del> const elu2 = eventLoopUtilization();
<del> const elu3 = eventLoopUtilization(elu1);
<del> const elu4 = eventLoopUtilization(elu2, elu1);
<add> const elu2 = eventLoopUtilization(elu1);
<add> const elu3 = eventLoopUtilization();
<add> const elu4 = eventLoopUtilization(elu3, elu1);
<ide>
<del> assert.strictEqual(elu3.idle, 0);
<add> assert.strictEqual(elu2.idle, 0);
<ide> assert.strictEqual(elu4.idle, 0);
<del> assert.strictEqual(elu3.utilization, 1);
<add> assert.strictEqual(elu2.utilization, 1);
<ide> assert.strictEqual(elu4.utilization, 1);
<del> assert.strictEqual(elu2.active - elu1.active, elu4.active);
<del> assert.ok(elu3.active > SPIN_DUR - 10, `${elu3.active} <= ${SPIN_DUR - 10}`);
<add> assert.strictEqual(elu3.active - elu1.active, elu4.active);
<add> assert.ok(elu2.active > SPIN_DUR - 10, `${elu2.active} <= ${SPIN_DUR - 10}`);
<add> assert.ok(elu2.active < elu4.active, `${elu2.active} >= ${elu4.active}`);
<add> assert.ok(elu3.active > elu2.active, `${elu3.active} <= ${elu2.active}`);
<ide> assert.ok(elu3.active > elu4.active, `${elu3.active} <= ${elu4.active}`);
<del> assert.ok(elu2.active > elu3.active, `${elu2.active} <= ${elu3.active}`);
<del> assert.ok(elu2.active > elu4.active, `${elu2.active} <= ${elu4.active}`);
<ide>
<ide> setTimeout(mustCall(runIdleTimeTest), TIMEOUT);
<ide> }), 5); | 1 |
Javascript | Javascript | consolidate svg config to avoid some duplication | 79a62b09eac4de5b19aa9e9858a23be7aecec310 | <ide><path>src/renderers/dom/shared/SVGDOMPropertyConfig.js
<ide> var NS = {
<ide> xml: 'http://www.w3.org/XML/1998/namespace',
<ide> };
<ide>
<add>// We use attributes for everything SVG so let's avoid some duplication and run
<add>// code instead.
<add>
<add>var ATTRS = {
<add> accentHeight: 'accent-height',
<add> accumulate: null,
<add> additive: null,
<add> alignmentBaseline: 'alignment-baseline',
<add> allowReorder: 'allowReorder',
<add> alphabetic: null,
<add> amplitude: null,
<add> arabicForm: 'arabic-form',
<add> ascent: null,
<add> attributeName: 'attributeName',
<add> attributeType: 'attributeType',
<add> autoReverse: 'autoReverse',
<add> azimuth: null,
<add> baseFrequency: 'baseFrequency',
<add> baseProfile: 'baseProfile',
<add> baselineShift: 'baseline-shift',
<add> bbox: null,
<add> begin: null,
<add> bias: null,
<add> by: null,
<add> calcMode: 'calcMode',
<add> capHeight: 'cap-height',
<add> class: null,
<add> clip: null,
<add> clipPath: 'clip-path',
<add> clipRule: 'clip-rule',
<add> clipPathUnits: 'clipPathUnits',
<add> color: null,
<add> colorInterpolation: 'color-interpolation',
<add> colorInterpolationFilters: 'color-interpolation-filters',
<add> colorProfile: 'color-profile',
<add> colorRendering: 'color-rendering',
<add> contentScriptType: 'contentScriptType',
<add> contentStyleType: 'contentStyleType',
<add> cursor: null,
<add> cx: null,
<add> cy: null,
<add> d: null,
<add> decelerate: null,
<add> descent: null,
<add> diffuseConstant: 'diffuseConstant',
<add> direction: null,
<add> display: null,
<add> divisor: null,
<add> dominantBaseline: 'dominant-baseline',
<add> dur: null,
<add> dx: null,
<add> dy: null,
<add> edgeMode: 'edgeMode',
<add> elevation: null,
<add> enableBackground: 'enable-background',
<add> end: null,
<add> exponent: null,
<add> externalResourcesRequired: 'externalResourcesRequired',
<add> fill: null,
<add> fillOpacity: 'fill-opacity',
<add> fillRule: 'fill-rule',
<add> filter: null,
<add> filterRes: 'filterRes',
<add> filterUnits: 'filterUnits',
<add> floodColor: 'flood-color',
<add> floodOpacity: 'flood-opacity',
<add> fontFamily: 'font-family',
<add> fontSize: 'font-size',
<add> fontSizeAdjust: 'font-size-adjust',
<add> fontStretch: 'font-stretch',
<add> fontStyle: 'font-style',
<add> fontVariant: 'font-variant',
<add> fontWeight: 'font-weight',
<add> format: null,
<add> from: null,
<add> fx: null,
<add> fy: null,
<add> g1: null,
<add> g2: null,
<add> glyphName: 'glyph-name',
<add> glyphOrientationHorizontal: 'glyph-orientation-horizontal',
<add> glyphOrientationVertical: 'glyph-orientation-vertical',
<add> glyphRef: 'glyphRef',
<add> gradientTransform: 'gradientTransform',
<add> gradientUnits: 'gradientUnits',
<add> hanging: null,
<add> height: null,
<add> horizAdvX: 'horiz-adv-x',
<add> horizOriginX: 'horiz-origin-x',
<add> id: null,
<add> ideographic: null,
<add> imageRendering: 'image-rendering',
<add> in: null,
<add> in2: null,
<add> intercept: null,
<add> k: null,
<add> k1: null,
<add> k2: null,
<add> k3: null,
<add> k4: null,
<add> kernelMatrix: 'kernelMatrix',
<add> kernelUnitLength: 'kernelUnitLength',
<add> kerning: null,
<add> keyPoints: 'keyPoints',
<add> keySplines: 'keySplines',
<add> keyTimes: 'keyTimes',
<add> lang: null,
<add> lengthAdjust: 'lengthAdjust',
<add> letterSpacing: 'letter-spacing',
<add> lightingColor: 'lighting-color',
<add> limitingConeAngle: 'limitingConeAngle',
<add> local: null,
<add> markerEnd: 'marker-end',
<add> markerMid: 'marker-mid',
<add> markerStart: 'marker-start',
<add> markerHeight: 'markerHeight',
<add> markerUnits: 'markerUnits',
<add> markerWidth: 'markerWidth',
<add> mask: null,
<add> maskContentUnits: 'maskContentUnits',
<add> maskUnits: 'maskUnits',
<add> mathematical: null,
<add> max: null,
<add> media: null,
<add> method: null,
<add> min: null,
<add> mode: null,
<add> name: null,
<add> numOctaves: 'numOctaves',
<add> offset: null,
<add> opacity: null,
<add> operator: null,
<add> order: null,
<add> orient: null,
<add> orientation: null,
<add> origin: null,
<add> overflow: null,
<add> overlinePosition: 'overline-position',
<add> overlineThickness: 'overline-thickness',
<add> paintOrder: 'paint-order',
<add> panose1: 'panose-1',
<add> pathLength: 'pathLength',
<add> patternContentUnits: 'patternContentUnits',
<add> patternTransform: 'patternTransform',
<add> patternUnits: 'patternUnits',
<add> pointerEvents: 'pointer-events',
<add> points: null,
<add> pointsAtX: 'pointsAtX',
<add> pointsAtY: 'pointsAtY',
<add> pointsAtZ: 'pointsAtZ',
<add> preserveAlpha: 'preserveAlpha',
<add> preserveAspectRatio: 'preserveAspectRatio',
<add> primitiveUnits: 'primitiveUnits',
<add> r: null,
<add> radius: null,
<add> refX: 'refX',
<add> refY: 'refY',
<add> renderingIntent: 'rendering-intent',
<add> repeatCount: 'repeatCount',
<add> repeatDur: 'repeatDur',
<add> requiredExtensions: 'requiredExtensions',
<add> requiredFeatures: 'requiredFeatures',
<add> restart: null,
<add> result: null,
<add> rotate: null,
<add> rx: null,
<add> ry: null,
<add> scale: null,
<add> seed: null,
<add> shapeRendering: 'shape-rendering',
<add> slope: null,
<add> spacing: null,
<add> specularConstant: 'specularConstant',
<add> specularExponent: 'specularExponent',
<add> speed: null,
<add> spreadMethod: 'spreadMethod',
<add> startOffset: 'startOffset',
<add> stdDeviation: 'stdDeviation',
<add> stemh: null,
<add> stemv: null,
<add> stitchTiles: 'stitchTiles',
<add> stopColor: 'stop-color',
<add> stopOpacity: 'stop-opacity',
<add> strikethroughPosition: 'strikethrough-position',
<add> strikethroughThickness: 'strikethrough-thickness',
<add> string: null,
<add> stroke: null,
<add> strokeDasharray: 'stroke-dasharray',
<add> strokeDashoffset: 'stroke-dashoffset',
<add> strokeLinecap: 'stroke-linecap',
<add> strokeLinejoin: 'stroke-linejoin',
<add> strokeMiterlimit: 'stroke-miterlimit',
<add> strokeOpacity: 'stroke-opacity',
<add> strokeWidth: 'stroke-width',
<add> style: null,
<add> surfaceScale: 'surfaceScale',
<add> systemLanguage: 'systemLanguage',
<add> tableValues: 'tableValues',
<add> target: null,
<add> targetX: 'targetX',
<add> targetY: 'targetY',
<add> textAnchor: 'text-anchor',
<add> textDecoration: 'text-decoration',
<add> textRendering: 'text-rendering',
<add> textLength: 'textLength',
<add> to: null,
<add> transform: null,
<add> type: null,
<add> u1: null,
<add> u2: null,
<add> underlinePosition: 'underline-position',
<add> underlineThickness: 'underline-thickness',
<add> unicode: null,
<add> unicodeBidi: 'unicode-bidi',
<add> unicodeRange: 'unicode-range',
<add> unitsPerEm: 'units-per-em',
<add> vAlphabetic: 'v-alphabetic',
<add> vHanging: 'v-hanging',
<add> vIdeographic: 'v-ideographic',
<add> vMathematical: 'v-mathematical',
<add> values: null,
<add> version: null,
<add> vertAdvY: 'vert-adv-y',
<add> vertOriginX: 'vert-origin-x',
<add> vertOriginY: 'vert-origin-y',
<add> viewBox: 'viewBox',
<add> viewTarget: 'viewTarget',
<add> visibility: null,
<add> width: null,
<add> widths: null,
<add> wordSpacing: 'word-spacing',
<add> writingMode: 'writing-mode',
<add> x: null,
<add> xHeight: 'x-height',
<add> x1: null,
<add> x2: null,
<add> xChannelSelector: 'xChannelSelector',
<add> xlinkActuate: 'xlink:actuate',
<add> xlinkArcrole: 'xlink:arcrole',
<add> xlinkHref: 'xlink:href',
<add> xlinkRole: 'xlink:role',
<add> xlinkShow: 'xlink:show',
<add> xlinkTitle: 'xlink:title',
<add> xlinkType: 'xlink:type',
<add> xmlBase: 'xml:base',
<add> xmlLang: 'xml:lang',
<add> xmlSpace: 'xml:space',
<add> y: null,
<add> y1: null,
<add> y2: null,
<add> yChannelSelector: 'yChannelSelector',
<add> z: null,
<add> zoomAndPan: 'zoomAndPan',
<add>};
<add>
<ide> var SVGDOMPropertyConfig = {
<del> Properties: {
<del> accentHeight: null,
<del> accumulate: null,
<del> additive: null,
<del> alignmentBaseline: null,
<del> allowReorder: null,
<del> alphabetic: null,
<del> amplitude: null,
<del> arabicForm: null,
<del> ascent: null,
<del> attributeName: null,
<del> attributeType: null,
<del> autoReverse: null,
<del> azimuth: null,
<del> baseFrequency: null,
<del> baselineShift: null,
<del> baseProfile: null,
<del> bbox: null,
<del> begin: null,
<del> bias: null,
<del> by: null,
<del> calcMode: null,
<del> capHeight: null,
<del> class: null,
<del> clip: null,
<del> clipPath: null,
<del> clipPathUnits: null,
<del> clipRule: null,
<del> color: null,
<del> colorInterpolation: null,
<del> colorInterpolationFilters: null,
<del> colorProfile: null,
<del> colorRendering: null,
<del> contentScriptType: null,
<del> contentStyleType: null,
<del> cursor: null,
<del> cx: null,
<del> cy: null,
<del> d: null,
<del> decelerate: null,
<del> descent: null,
<del> diffuseConstant: null,
<del> direction: null,
<del> display: null,
<del> divisor: null,
<del> dominantBaseline: null,
<del> dur: null,
<del> dx: null,
<del> dy: null,
<del> edgeMode: null,
<del> elevation: null,
<del> enableBackground: null,
<del> end: null,
<del> exponent: null,
<del> externalResourcesRequired: null,
<del> fill: null,
<del> fillOpacity: null,
<del> fillRule: null,
<del> filter: null,
<del> filterRes: null,
<del> filterUnits: null,
<del> floodColor: null,
<del> floodOpacity: null,
<del> fontFamily: null,
<del> fontSize: null,
<del> fontSizeAdjust: null,
<del> fontStretch: null,
<del> fontStyle: null,
<del> fontVariant: null,
<del> fontWeight: null,
<del> format: null,
<del> from: null,
<del> fx: null,
<del> fy: null,
<del> g1: null,
<del> g2: null,
<del> glyphName: null,
<del> glyphOrientationHorizontal: null,
<del> glyphOrientationVertical: null,
<del> glyphRef: null,
<del> gradientTransform: null,
<del> gradientUnits: null,
<del> hanging: null,
<del> height: null,
<del> horizAdvX: null,
<del> horizOriginX: null,
<del> id: null,
<del> ideographic: null,
<del> imageRendering: null,
<del> in: null,
<del> in2: null,
<del> intercept: null,
<del> k: null,
<del> k1: null,
<del> k2: null,
<del> k3: null,
<del> k4: null,
<del> kernelMatrix: null,
<del> kernelUnitLength: null,
<del> kerning: null,
<del> keyPoints: null,
<del> keySplines: null,
<del> keyTimes: null,
<del> lang: null,
<del> lengthAdjust: null,
<del> letterSpacing: null,
<del> lightingColor: null,
<del> limitingConeAngle: null,
<del> local: null,
<del> markerEnd: null,
<del> markerHeight: null,
<del> markerMid: null,
<del> markerStart: null,
<del> markerUnits: null,
<del> markerWidth: null,
<del> mask: null,
<del> maskContentUnits: null,
<del> maskUnits: null,
<del> mathematical: null,
<del> max: null,
<del> media: null,
<del> method: null,
<del> min: null,
<del> mode: null,
<del> name: null,
<del> numOctaves: null,
<del> offset: null,
<del> opacity: null,
<del> operator: null,
<del> order: null,
<del> orient: null,
<del> orientation: null,
<del> origin: null,
<del> overflow: null,
<del> overlinePosition: null,
<del> overlineThickness: null,
<del> paintOrder: null,
<del> panose1: null,
<del> pathLength: null,
<del> patternContentUnits: null,
<del> patternTransform: null,
<del> patternUnits: null,
<del> pointerEvents: null,
<del> points: null,
<del> pointsAtX: null,
<del> pointsAtY: null,
<del> pointsAtZ: null,
<del> preserveAlpha: null,
<del> preserveAspectRatio: null,
<del> primitiveUnits: null,
<del> r: null,
<del> radius: null,
<del> refX: null,
<del> refY: null,
<del> renderingIntent: null,
<del> repeatCount: null,
<del> repeatDur: null,
<del> requiredExtensions: null,
<del> requiredFeatures: null,
<del> restart: null,
<del> result: null,
<del> rotate: null,
<del> rx: null,
<del> ry: null,
<del> scale: null,
<del> seed: null,
<del> shapeRendering: null,
<del> slope: null,
<del> spacing: null,
<del> specularConstant: null,
<del> specularExponent: null,
<del> speed: null,
<del> spreadMethod: null,
<del> startOffset: null,
<del> stdDeviation: null,
<del> stemh: null,
<del> stemv: null,
<del> stitchTiles: null,
<del> stopColor: null,
<del> stopOpacity: null,
<del> strikethroughPosition: null,
<del> strikethroughThickness: null,
<del> string: null,
<del> stroke: null,
<del> strokeDasharray: null,
<del> strokeDashoffset: null,
<del> strokeLinecap: null,
<del> strokeLinejoin: null,
<del> strokeMiterlimit: null,
<del> strokeOpacity: null,
<del> strokeWidth: null,
<del> style: null,
<del> surfaceScale: null,
<del> systemLanguage: null,
<del> tableValues: null,
<del> target: null,
<del> targetX: null,
<del> targetY: null,
<del> textAnchor: null,
<del> textDecoration: null,
<del> textLength: null,
<del> textRendering: null,
<del> to: null,
<del> transform: null,
<del> type: null,
<del> u1: null,
<del> u2: null,
<del> underlinePosition: null,
<del> underlineThickness: null,
<del> unicode: null,
<del> unicodeBidi: null,
<del> unicodeRange: null,
<del> unitsPerEm: null,
<del> vAlphabetic: null,
<del> values: null,
<del> version: null,
<del> vertAdvY: null,
<del> vertOriginX: null,
<del> vertOriginY: null,
<del> vHanging: null,
<del> vIdeographic: null,
<del> viewBox: null,
<del> viewTarget: null,
<del> visibility: null,
<del> vMathematical: null,
<del> width: null,
<del> widths: null,
<del> wordSpacing: null,
<del> writingMode: null,
<del> x: null,
<del> x1: null,
<del> x2: null,
<del> xChannelSelector: null,
<del> xHeight: null,
<del> xlinkActuate: null,
<del> xlinkArcrole: null,
<del> xlinkHref: null,
<del> xlinkRole: null,
<del> xlinkShow: null,
<del> xlinkTitle: null,
<del> xlinkType: null,
<del> xmlBase: null,
<del> xmlLang: null,
<del> xmlSpace: null,
<del> y: null,
<del> y1: null,
<del> y2: null,
<del> yChannelSelector: null,
<del> z: null,
<del> zoomAndPan: null,
<del> },
<add> Properties: {},
<ide> DOMAttributeNamespaces: {
<ide> xlinkActuate: NS.xlink,
<ide> xlinkArcrole: NS.xlink,
<ide> var SVGDOMPropertyConfig = {
<ide> xmlLang: NS.xml,
<ide> xmlSpace: NS.xml,
<ide> },
<del> DOMAttributeNames: {
<del> accentHeight: 'accent-height',
<del> alignmentBaseline: 'alignment-baseline',
<del> allowReorder: 'allowReorder',
<del> arabicForm: 'arabic-form',
<del> attributeName: 'attributeName',
<del> attributeType: 'attributeType',
<del> autoReverse: 'autoReverse',
<del> baseFrequency: 'baseFrequency',
<del> baselineShift: 'baseline-shift',
<del> baseProfile: 'baseProfile',
<del> calcMode: 'calcMode',
<del> capHeight: 'cap-height',
<del> clipPath: 'clip-path',
<del> clipPathUnits: 'clipPathUnits',
<del> clipRule: 'clip-rule',
<del> colorInterpolation: 'color-interpolation',
<del> colorInterpolationFilters: 'color-interpolation-filters',
<del> colorProfile: 'color-profile',
<del> colorRendering: 'color-rendering',
<del> contentScriptType: 'contentScriptType',
<del> contentStyleType: 'contentStyleType',
<del> diffuseConstant: 'diffuseConstant',
<del> dominantBaseline: 'dominant-baseline',
<del> edgeMode: 'edgeMode',
<del> enableBackground: 'enable-background',
<del> externalResourcesRequired: 'externalResourcesRequired',
<del> fillOpacity: 'fill-opacity',
<del> fillRule: 'fill-rule',
<del> filterRes: 'filterRes',
<del> filterUnits: 'filterUnits',
<del> floodColor: 'flood-color',
<del> floodOpacity: 'flood-opacity',
<del> fontFamily: 'font-family',
<del> fontSize: 'font-size',
<del> fontSizeAdjust: 'font-size-adjust',
<del> fontStretch: 'font-stretch',
<del> fontStyle: 'font-style',
<del> fontVariant: 'font-variant',
<del> fontWeight: 'font-weight',
<del> glyphName: 'glyph-name',
<del> glyphOrientationHorizontal: 'glyph-orientation-horizontal',
<del> glyphOrientationVertical: 'glyph-orientation-vertical',
<del> glyphRef: 'glyphRef',
<del> gradientTransform: 'gradientTransform',
<del> gradientUnits: 'gradientUnits',
<del> horizAdvX: 'horiz-adv-x',
<del> horizOriginX: 'horiz-origin-x',
<del> imageRendering: 'image-rendering',
<del> kernelMatrix: 'kernelMatrix',
<del> kernelUnitLength: 'kernelUnitLength',
<del> keyPoints: 'keyPoints',
<del> keySplines: 'keySplines',
<del> keyTimes: 'keyTimes',
<del> lengthAdjust: 'lengthAdjust',
<del> letterSpacing: 'letter-spacing',
<del> lightingColor: 'lighting-color',
<del> limitingConeAngle: 'limitingConeAngle',
<del> markerEnd: 'marker-end',
<del> markerHeight: 'markerHeight',
<del> markerMid: 'marker-mid',
<del> markerStart: 'marker-start',
<del> markerUnits: 'markerUnits',
<del> markerWidth: 'markerWidth',
<del> maskContentUnits: 'maskContentUnits',
<del> maskUnits: 'maskUnits',
<del> numOctaves: 'numOctaves',
<del> overlinePosition: 'overline-position',
<del> overlineThickness: 'overline-thickness',
<del> paintOrder: 'paint-order',
<del> panose1: 'panose-1',
<del> pathLength: 'pathLength',
<del> patternContentUnits: 'patternContentUnits',
<del> patternTransform: 'patternTransform',
<del> patternUnits: 'patternUnits',
<del> pointerEvents: 'pointer-events',
<del> pointsAtX: 'pointsAtX',
<del> pointsAtY: 'pointsAtY',
<del> pointsAtZ: 'pointsAtZ',
<del> preserveAlpha: 'preserveAlpha',
<del> preserveAspectRatio: 'preserveAspectRatio',
<del> primitiveUnits: 'primitiveUnits',
<del> refX: 'refX',
<del> refY: 'refY',
<del> renderingIntent: 'rendering-intent',
<del> repeatCount: 'repeatCount',
<del> repeatDur: 'repeatDur',
<del> requiredExtensions: 'requiredExtensions',
<del> requiredFeatures: 'requiredFeatures',
<del> shapeRendering: 'shape-rendering',
<del> specularConstant: 'specularConstant',
<del> specularExponent: 'specularExponent',
<del> spreadMethod: 'spreadMethod',
<del> startOffset: 'startOffset',
<del> stdDeviation: 'stdDeviation',
<del> stitchTiles: 'stitchTiles',
<del> stopColor: 'stop-color',
<del> stopOpacity: 'stop-opacity',
<del> strikethroughPosition: 'strikethrough-position',
<del> strikethroughThickness: 'strikethrough-thickness',
<del> strokeDasharray: 'stroke-dasharray',
<del> strokeDashoffset: 'stroke-dashoffset',
<del> strokeLinecap: 'stroke-linecap',
<del> strokeLinejoin: 'stroke-linejoin',
<del> strokeMiterlimit: 'stroke-miterlimit',
<del> strokeOpacity: 'stroke-opacity',
<del> strokeWidth: 'stroke-width',
<del> surfaceScale: 'surfaceScale',
<del> systemLanguage: 'systemLanguage',
<del> tableValues: 'tableValues',
<del> targetX: 'targetX',
<del> targetY: 'targetY',
<del> textAnchor: 'text-anchor',
<del> textDecoration: 'text-decoration',
<del> textLength: 'textLength',
<del> textRendering: 'text-rendering',
<del> underlinePosition: 'underline-position',
<del> underlineThickness: 'underline-thickness',
<del> unicodeBidi: 'unicode-bidi',
<del> unicodeRange: 'unicode-range',
<del> unitsPerEm: 'units-per-em',
<del> vAlphabetic: 'v-alphabetic',
<del> vertAdvY: 'vert-adv-y',
<del> vertOriginX: 'vert-origin-x',
<del> vertOriginY: 'vert-origin-y',
<del> vHanging: 'v-hanging',
<del> vIdeographic: 'v-ideographic',
<del> viewBox: 'viewBox',
<del> viewTarget: 'viewTarget',
<del> vMathematical: 'v-mathematical',
<del> wordSpacing: 'word-spacing',
<del> writingMode: 'writing-mode',
<del> xChannelSelector: 'xChannelSelector',
<del> xHeight: 'x-height',
<del> xlinkActuate: 'xlink:actuate',
<del> xlinkArcrole: 'xlink:arcrole',
<del> xlinkHref: 'xlink:href',
<del> xlinkRole: 'xlink:role',
<del> xlinkShow: 'xlink:show',
<del> xlinkTitle: 'xlink:title',
<del> xlinkType: 'xlink:type',
<del> xmlBase: 'xml:base',
<del> xmlLang: 'xml:lang',
<del> xmlSpace: 'xml:space',
<del> yChannelSelector: 'yChannelSelector',
<del> zoomAndPan: 'zoomAndPan',
<del> },
<add> DOMAttributeNames: {},
<ide> };
<ide>
<add>Object.keys(ATTRS).map((key) => {
<add> SVGDOMPropertyConfig.Properties[key] = null;
<add> if (ATTRS[key]) {
<add> SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
<add> }
<add>});
<add>
<ide> module.exports = SVGDOMPropertyConfig; | 1 |
PHP | PHP | remove unused code | 58a6dec9120994d2dd8e5e4c6a7709763ffe60f6 | <ide><path>src/Cache/Engine/MemcachedEngine.php
<ide> public function init(array $config = [])
<ide> }
<ide>
<ide> if ($this->_config['username'] !== null && $this->_config['password'] !== null) {
<del> $sasl = method_exists($this->_Memcached, 'setSaslAuthData');
<ide> if (!method_exists($this->_Memcached, 'setSaslAuthData')) {
<ide> throw new InvalidArgumentException(
<ide> 'Memcached extension is not built with SASL support' | 1 |
Javascript | Javascript | add test for child_process.execfile() | 1d82adc8c7ff4a04a9b8ef3fdbbf28515967cdcb | <ide><path>test/parallel/test-child-process-execfile.js
<add>'use strict';
<add>
<add>const common = require('../common');
<add>const assert = require('assert');
<add>const execFile = require('child_process').execFile;
<add>const path = require('path');
<add>
<add>const fixture = path.join(common.fixturesDir, 'exit.js');
<add>
<add>{
<add> execFile(
<add> process.execPath,
<add> [fixture, 42],
<add> common.mustCall((e) => {
<add> // Check that arguments are included in message
<add> assert.strictEqual(e.message.trim(),
<add> `Command failed: ${process.execPath} ${fixture} 42`);
<add> assert.strictEqual(e.code, 42);
<add> })
<add> );
<add>} | 1 |
Javascript | Javascript | remove obsolete uniform type properties | f1db204e2d7ebdec7db6cc4b4e8ae7d9d6562c75 | <ide><path>examples/js/renderers/WebGLDeferredRenderer.js
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> map: { type: "t", value: null },
<del> offsetRepeat: { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) },
<add> map: { value: null },
<add> offsetRepeat: { value: new THREE.Vector4( 0, 0, 1, 1 ) },
<ide>
<del> diffuse: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> emissive: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> specular: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> shininess: { type: "f", value: 30.0 }
<add> diffuse: { value: new THREE.Color( 0x000000 ) },
<add> emissive: { value: new THREE.Color( 0x000000 ) },
<add> specular: { value: new THREE.Color( 0x000000 ) },
<add> shininess: { value: 30.0 }
<ide>
<ide> },
<ide>
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> samplerColor: { type: "t", value: null },
<del> viewWidth: { type: "f", value: 800 },
<del> viewHeight: { type: "f", value: 600 }
<add> samplerColor: { value: null },
<add> viewWidth: { value: 800 },
<add> viewHeight: { value: 600 }
<ide>
<ide> },
<ide>
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> samplerNormalDepth: { type: "t", value: null },
<del> samplerColor: { type: "t", value: null },
<add> samplerNormalDepth: { value: null },
<add> samplerColor: { value: null },
<ide>
<del> matProjInverse: { type: "m4", value: new THREE.Matrix4() },
<add> matProjInverse: { value: new THREE.Matrix4() },
<ide>
<del> viewWidth: { type: "f", value: 800 },
<del> viewHeight: { type: "f", value: 600 },
<add> viewWidth: { value: 800 },
<add> viewHeight: { value: 600 },
<ide>
<del> lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> lightPositionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
<del> lightIntensity: { type: "f", value: 1.0 },
<del> lightRadius: { type: "f", value: 1.0 }
<add> lightColor: { value: new THREE.Color( 0x000000 ) },
<add> lightPositionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
<add> lightIntensity: { value: 1.0 },
<add> lightRadius: { value: 1.0 }
<ide>
<ide> },
<ide>
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> samplerNormalDepth: { type: "t", value: null },
<del> samplerColor: { type: "t", value: null },
<add> samplerNormalDepth: { value: null },
<add> samplerColor: { value: null },
<ide>
<del> matProjInverse: { type: "m4", value: new THREE.Matrix4() },
<add> matProjInverse: { value: new THREE.Matrix4() },
<ide>
<del> viewWidth: { type: "f", value: 800 },
<del> viewHeight: { type: "f", value: 600 },
<add> viewWidth: { value: 800 },
<add> viewHeight: { value: 600 },
<ide>
<del> lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> lightDirectionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
<del> lightPositionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
<del> lightAngle: { type: "f", value: 1.0 },
<del> lightIntensity: { type: "f", value: 1.0 }
<add> lightColor: { value: new THREE.Color( 0x000000 ) },
<add> lightDirectionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
<add> lightPositionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
<add> lightAngle: { value: 1.0 },
<add> lightIntensity: { value: 1.0 }
<ide>
<ide> },
<ide>
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> samplerNormalDepth: { type: "t", value: null },
<del> samplerColor: { type: "t", value: null },
<add> samplerNormalDepth: { value: null },
<add> samplerColor: { value: null },
<ide>
<del> matProjInverse: { type: "m4", value: new THREE.Matrix4() },
<add> matProjInverse: { value: new THREE.Matrix4() },
<ide>
<del> viewWidth: { type: "f", value: 800 },
<del> viewHeight: { type: "f", value: 600 },
<add> viewWidth: { value: 800 },
<add> viewHeight: { value: 600 },
<ide>
<del> lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> lightDirectionVS : { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
<del> lightIntensity: { type: "f", value: 1.0 }
<add> lightColor: { value: new THREE.Color( 0x000000 ) },
<add> lightDirectionVS : { value: new THREE.Vector3( 0, 1, 0 ) },
<add> lightIntensity: { value: 1.0 }
<ide>
<ide> },
<ide>
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> shininess: { type: "f", value: 30.0 }
<add> shininess: { value: 30.0 }
<ide>
<ide> },
<ide>
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> samplerNormalDepthShininess: { type: "t", value: null },
<add> samplerNormalDepthShininess: { value: null },
<ide>
<del> matProjInverse: { type: "m4", value: new THREE.Matrix4() },
<add> matProjInverse: { value: new THREE.Matrix4() },
<ide>
<del> viewWidth: { type: "f", value: 800 },
<del> viewHeight: { type: "f", value: 600 },
<add> viewWidth: { value: 800 },
<add> viewHeight: { value: 600 },
<ide>
<del> lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> lightPositionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
<del> lightIntensity: { type: "f", value: 1.0 },
<del> lightRadius: { type: "f", value: 1.0 }
<add> lightColor: { value: new THREE.Color( 0x000000 ) },
<add> lightPositionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
<add> lightIntensity: { value: 1.0 },
<add> lightRadius: { value: 1.0 }
<ide>
<ide> },
<ide>
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> samplerNormalDepthShininess: { type: "t", value: null },
<add> samplerNormalDepthShininess: { value: null },
<ide>
<del> matProjInverse: { type: "m4", value: new THREE.Matrix4() },
<add> matProjInverse: { value: new THREE.Matrix4() },
<ide>
<del> viewWidth: { type: "f", value: 800 },
<del> viewHeight: { type: "f", value: 600 },
<add> viewWidth: { value: 800 },
<add> viewHeight: { value: 600 },
<ide>
<del> lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> lightDirectionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
<del> lightPositionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
<del> lightAngle: { type: "f", value: 1.0 },
<del> lightIntensity: { type: "f", value: 1.0 }
<add> lightColor: { value: new THREE.Color( 0x000000 ) },
<add> lightDirectionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
<add> lightPositionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
<add> lightAngle: { value: 1.0 },
<add> lightIntensity: { value: 1.0 }
<ide>
<ide> },
<ide>
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> samplerNormalDepthShininess: { type: "t", value: null },
<add> samplerNormalDepthShininess: { value: null },
<ide>
<del> matProjInverse: { type: "m4", value: new THREE.Matrix4() },
<add> matProjInverse: { value: new THREE.Matrix4() },
<ide>
<del> viewWidth: { type: "f", value: 800 },
<del> viewHeight: { type: "f", value: 600 },
<add> viewWidth: { value: 800 },
<add> viewHeight: { value: 600 },
<ide>
<del> lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> lightDirectionVS : { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
<del> lightIntensity: { type: "f", value: 1.0 }
<add> lightColor: { value: new THREE.Color( 0x000000 ) },
<add> lightDirectionVS : { value: new THREE.Vector3( 0, 1, 0 ) },
<add> lightIntensity: { value: 1.0 }
<ide>
<ide> },
<ide>
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> samplerLight: { type: "t", value: null },
<add> samplerLight: { value: null },
<ide>
<del> map: { type: "t", value: null },
<del> offsetRepeat: { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) },
<add> map: { value: null },
<add> offsetRepeat: { value: new THREE.Vector4( 0, 0, 1, 1 ) },
<ide>
<del> viewWidth: { type: "f", value: 800 },
<del> viewHeight: { type: "f", value: 600 },
<add> viewWidth: { value: 800 },
<add> viewHeight: { value: 600 },
<ide>
<del> diffuse: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> emissive: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> specular: { type: "c", value: new THREE.Color( 0x000000 ) },
<del> shininess: { type: "f", value: 30.0 }
<add> diffuse: { value: new THREE.Color( 0x000000 ) },
<add> emissive: { value: new THREE.Color( 0x000000 ) },
<add> specular: { value: new THREE.Color( 0x000000 ) },
<add> shininess: { value: 30.0 }
<ide>
<ide> },
<ide>
<ide> THREE.ShaderDeferred = {
<ide>
<ide> uniforms: {
<ide>
<del> samplerResult: { type: "t", value: null }
<add> samplerResult: { value: null }
<ide>
<ide> },
<ide> | 1 |
Ruby | Ruby | restore the frozen state on rollback. fixes | cb847b9f2e56eeff737323d9a42a2a0a6c23804d | <ide><path>activerecord/lib/active_record/transactions.rb
<ide> def restore_transaction_record_state(force = false) #:nodoc:
<ide> @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1
<ide> if @_start_transaction_state[:level] < 1
<ide> restore_state = remove_instance_variable(:@_start_transaction_state)
<del> @attributes = @attributes.dup if @attributes.frozen?
<add> was_frozen = @attributes.frozen?
<add> @attributes = @attributes.dup if was_frozen
<ide> @new_record = restore_state[:new_record]
<ide> @destroyed = restore_state[:destroyed]
<ide> if restore_state.has_key?(:id)
<ide> def restore_transaction_record_state(force = false) #:nodoc:
<ide> @attributes.delete(self.class.primary_key)
<ide> @attributes_cache.delete(self.class.primary_key)
<ide> end
<add> @attributes.freeze if was_frozen
<ide> end
<ide> end
<ide> end
<ide><path>activerecord/test/cases/transactions_test.rb
<ide> def test_rollback_when_commit_raises
<ide> end
<ide> end
<ide>
<add> def test_rollback_when_saving_a_frozen_record
<add> topic = Topic.new(:title => 'test')
<add> topic.freeze
<add> e = assert_raise(RuntimeError) { topic.save }
<add> assert_equal "can't modify frozen Hash", e.message
<add> assert !topic.persisted?, 'not persisted'
<add> assert_nil topic.id
<add> assert topic.frozen?, 'not frozen'
<add> end
<add>
<ide> def test_restore_active_record_state_for_all_records_in_a_transaction
<ide> topic_1 = Topic.new(:title => 'test_1')
<ide> topic_2 = Topic.new(:title => 'test_2') | 2 |
Javascript | Javascript | add childprocess.prototype.killed test case | c8646e0c4159aa53b2ae94d1b69850ce5fa62ca2 | <ide><path>test/simple/test-child-process-kill.js
<ide> cat.on('exit', function(code, signal) {
<ide> termSignal = signal;
<ide> });
<ide>
<add>assert.equal(cat.killed, false);
<ide> cat.kill();
<add>assert.equal(cat.killed, true);
<ide>
<ide> process.on('exit', function() {
<ide> assert.strictEqual(exitCode, null); | 1 |
Ruby | Ruby | improve check for 'install_name_tool' | 9f79c05656a44f926898774c6029025002bcd621 | <ide><path>Library/Homebrew/diagnostic.rb
<ide> def check_for_stray_developer_directory
<ide> def check_for_bad_install_name_tool
<ide> return if MacOS.version < "10.9"
<ide>
<del> libs = Pathname.new("/usr/bin/install_name_tool").dynamically_linked_libraries
<add> install_name_tool = OS::Mac.install_name_tool
<add> libs = Pathname.new(install_name_tool).dynamically_linked_libraries
<ide>
<ide> # otool may not work, for example if the Xcode license hasn't been accepted yet
<ide> return if libs.empty?
<ide>
<del> unless libs.include? "/usr/lib/libxcselect.dylib" then <<-EOS.undent
<del> You have an outdated version of /usr/bin/install_name_tool installed.
<add> expectedLibs = ["/usr/lib/libSystem.B.dylib", "/usr/lib/libxcselect.dylib"]
<add> if (libs & expectedLibs).empty? then <<-EOS.undent
<add> You have an outdated version of #{install_name_tool} installed.
<ide> This will cause binary package installations to fail.
<ide> This can happen if you install osx-gcc-installer or RailsInstaller.
<ide> To restore it, you must reinstall OS X or restore the binary from | 1 |
Python | Python | change tests to support older response format | 294961e6fce2c34784f304ca587850d62569b64e | <ide><path>tests/test_helpers.py
<ide> def post_json():
<ide> c = app.test_client()
<ide> rv = c.post('/json', data=None, content_type='application/json')
<ide> assert rv.status_code == 400
<del> assert '<p>No JSON object could be decoded</p>' in rv.data
<add> assert 'No JSON object could be decoded' in rv.data
<ide>
<ide> def test_post_empty_json_doesnt_add_exception_to_reponse_if_no_debug(self):
<ide> app = flask.Flask(__name__)
<ide> def post_json():
<ide> c = app.test_client()
<ide> rv = c.post('/json', data=None, content_type='application/json')
<ide> assert rv.status_code == 400
<del> assert '<p>No JSON object could be decoded</p>' not in rv.data
<add> assert 'No JSON object could be decoded' not in rv.data
<ide>
<ide> def test_json_bad_requests(self):
<ide> app = flask.Flask(__name__) | 1 |
Text | Text | add myles borins to the ctc | 2367e6c901af244b8b75589a69d269772d19db3c | <ide><path>README.md
<ide> more information about the governance of the Node.js project, see
<ide> **Rod Vagg** <rod@vagg.org>
<ide> * [shigeki](https://github.com/shigeki) -
<ide> **Shigeki Ohtsu** <ohtsu@iij.ad.jp>
<add>* [TheAlphaNerd](https://github.com/TheAlphaNerd) -
<add>**Myles Borins** <myles.borins@gmail.com>
<ide> * [trevnorris](https://github.com/trevnorris) -
<ide> **Trevor Norris** <trev.norris@gmail.com>
<ide> * [Trott](https://github.com/Trott) -
<ide> more information about the governance of the Node.js project, see
<ide> **Michaël Zasso** <mic.besace@gmail.com>
<ide> * [tellnes](https://github.com/tellnes) -
<ide> **Christian Tellnes** <christian@tellnes.no>
<del>* [thealphanerd](https://github.com/thealphanerd) -
<del>**Myles Borins** <myles.borins@gmail.com>
<ide> * [thefourtheye](https://github.com/thefourtheye) -
<ide> **Sakthipriyan Vairamani** <thechargingvolcano@gmail.com>
<ide> * [thekemkid](https://github.com/thekemkid) - | 1 |
Ruby | Ruby | improve url audits | 5f6515baad38896668ce9750f4026e2d39e898fb | <ide><path>Library/Homebrew/cmd/audit.rb
<ide> def audit_conflicts
<ide>
<ide> def audit_urls
<ide> unless f.homepage =~ %r[^https?://]
<del> problem "The homepage should start with http or https."
<add> problem "The homepage should start with http or https (url is #{f.homepage})."
<add> end
<add>
<add> # Check for http:// GitHub homepage urls, https:// is preferred.
<add> # Note: only check homepages that are repo pages, not *.github.com hosts
<add> if f.homepage =~ %r[^http://github\.com/]
<add> problem "Use https:// URLs for homepages on GitHub (url is #{f.homepage})."
<ide> end
<ide>
<ide> # Google Code homepages should end in a slash
<ide> if f.homepage =~ %r[^https?://code\.google\.com/p/[^/]+[^/]$]
<del> problem "Google Code homepage should end with a slash."
<add> problem "Google Code homepage should end with a slash (url is #{f.homepage})."
<ide> end
<ide>
<ide> urls = [(f.stable.url rescue nil), (f.devel.url rescue nil), (f.head.url rescue nil)].compact
<ide>
<ide> # Check GNU urls; doesn't apply to mirrors
<del> if urls.any? { |p| p =~ %r[^(https?|ftp)://(?!alpha).+/gnu/] }
<del> problem "\"ftpmirror.gnu.org\" is preferred for GNU software."
<add> urls.select { |u| u =~ %r[^(https?|ftp)://(?!alpha).+/gnu/] }.each do |u|
<add> problem "\"ftpmirror.gnu.org\" is preferred for GNU software (url is #{u})."
<ide> end
<ide>
<ide> # the rest of the checks apply to mirrors as well
<ide> def audit_urls
<ide> next unless p =~ %r[^https?://.*\bsourceforge\.]
<ide>
<ide> if p =~ /(\?|&)use_mirror=/
<del> problem "Update this url (don't use #{$1}use_mirror)."
<add> problem "Don't use #{$1}use_mirror in SourceForge urls (url is #{p})."
<ide> end
<ide>
<ide> if p =~ /\/download$/
<del> problem "Update this url (don't use /download)."
<add> problem "Don't use /download in SourceForge urls (url is #{p})."
<ide> end
<ide>
<ide> if p =~ %r[^http://prdownloads\.]
<del> problem "Update this url (don't use prdownloads). See:\nhttp://librelist.com/browser/homebrew/2011/1/12/prdownloads-is-bad/"
<add> problem "Don't use prdownloads in SourceForge urls (url is #{p}).\n" +
<add> "\tSee: http://librelist.com/browser/homebrew/2011/1/12/prdownloads-is-bad/"
<ide> end
<ide>
<ide> if p =~ %r[^http://\w+\.dl\.]
<del> problem "Update this url (don't use specific dl mirrors)."
<add> problem "Don't use specific dl mirrors in SourceForge urls (url is #{p})."
<ide> end
<ide> end
<ide>
<del> # Check for git:// urls; https:// is preferred.
<del> if urls.any? { |p| p =~ %r[^git://github\.com/] }
<del> problem "Use https:// URLs for accessing GitHub repositories."
<add> # Check for git:// GitHub repo urls, https:// is preferred.
<add> urls.select { |u| u =~ %r[^git://([^/])*github\.com/] }.each do |u|
<add> problem "Use https:// URLs for accessing GitHub repositories (url is #{u})."
<ide> end
<ide>
<add> # Check for http:// GitHub repo urls, https:// is preferred.
<add> urls.select { |u| u =~ %r[^http://github\.com/.*\.git$] }.each do |u|
<add> problem "Use https:// URLs for accessing GitHub repositories (url is #{u})."
<add> end
<add>
<ide> if urls.any? { |u| u =~ /\.xz/ } && !f.deps.any? { |d| d.name == "xz" }
<ide> problem "Missing a build-time dependency on 'xz'"
<ide> end | 1 |
Go | Go | fix error on docker wait | 82531f71681c9b5bc5a6c871f81ef67f9e92d708 | <ide><path>commands.go
<ide> func (cli *DockerCli) LoadConfigFile() (err error) {
<ide> func waitForExit(cli *DockerCli, containerId string) (int, error) {
<ide> body, _, err := cli.call("POST", "/containers/"+containerId+"/wait", nil)
<ide> if err != nil {
<del> // If we can't connect, then the daemon probably died.
<del> if err != ErrConnectionRefused {
<del> return -1, err
<del> }
<del> return -1, nil
<add> return -1, err
<ide> }
<ide>
<ide> var out APIWait | 1 |
PHP | PHP | move some code into refreshapplication | e3be0deb504cf219544e99f881d2b39a0664e9e1 | <ide><path>src/Illuminate/Foundation/Testing/TestCase.php
<ide> public function setUp()
<ide> if ( ! $this->app)
<ide> {
<ide> $this->refreshApplication();
<del>
<del> $this->app->setRequestForConsoleEnvironment();
<del>
<del> $this->app->boot();
<ide> }
<ide> }
<ide>
<ide> protected function refreshApplication()
<ide> $this->app = $this->createApplication();
<ide>
<ide> $this->client = $this->createClient();
<add>
<add> $this->app->setRequestForConsoleEnvironment();
<add>
<add> $this->app->boot();
<ide> }
<ide>
<ide> /** | 1 |
Python | Python | add chroot detection | b53c63b85a9af057b681c45dc359758df1cccd6f | <ide><path>setup.py
<ide>
<ide> from setuptools import setup
<ide>
<add>is_chroot = os.stat('/').st_ino != 2
<add>
<ide>
<ide> def get_data_files():
<ide> data_files = [
<ide> def get_data_files():
<ide> ('share/man/man1', ['man/glances.1'])
<ide> ]
<ide>
<del> if os.name == 'posix' and os.getuid() == 0: # Unix-like + root privileges
<add> if hasattr(sys, 'real_prefix'): # virtualenv
<add> conf_path = os.path.join(sys.prefix, 'etc', 'glances')
<add> elif os.name == 'posix' and (os.getuid() == 0 or is_chroot):
<add> # Unix-like + root privileges/chroot environment
<ide> if 'bsd' in sys.platform:
<ide> conf_path = os.path.join(sys.prefix, 'etc', 'glances')
<ide> elif 'linux' in sys.platform:
<ide> conf_path = os.path.join('/etc', 'glances')
<ide> elif 'darwin' in sys.platform:
<ide> conf_path = os.path.join('/usr/local', 'etc', 'glances')
<del> elif hasattr(sys, 'real_prefix'): # virtualenv
<del> conf_path = os.path.join(sys.prefix, 'etc', 'glances')
<ide> elif 'win32' in sys.platform: # windows
<ide> conf_path = os.path.join(os.environ.get('APPDATA'), 'glances')
<ide> else: # Unix-like + per-user install | 1 |
Python | Python | add preliminary support for finnish | 73f66ec5706108f193b8dcabaf79473a87925d26 | <ide><path>setup.py
<ide> 'spacy.pt',
<ide> 'spacy.nl',
<ide> 'spacy.sv',
<add> 'spacy.fi',
<ide> 'spacy.language_data',
<ide> 'spacy.serialize',
<ide> 'spacy.syntax',
<ide><path>spacy/__init__.py
<ide> from . import pt
<ide> from . import nl
<ide> from . import sv
<del>
<add>from . import fi
<ide>
<ide> try:
<ide> basestring
<ide> set_lang_class(zh.Chinese.lang, zh.Chinese)
<ide> set_lang_class(nl.Dutch.lang, nl.Dutch)
<ide> set_lang_class(sv.Swedish.lang, sv.Swedish)
<add>set_lang_class(fi.Finnish.lang, fi.Finnish)
<add>
<ide>
<ide>
<ide> def load(name, **overrides):
<ide><path>spacy/fi/__init__.py
<add># encoding: utf8
<add>from __future__ import unicode_literals, print_function
<add>
<add>from ..language import Language
<add>from ..attrs import LANG
<add>from .language_data import *
<add>
<add>
<add>class Finnish(Language):
<add> lang = 'fi'
<add>
<add> class Defaults(Language.Defaults):
<add> lex_attr_getters = dict(Language.Defaults.lex_attr_getters)
<add> lex_attr_getters[LANG] = lambda text: 'fi'
<add>
<add> tokenizer_exceptions = TOKENIZER_EXCEPTIONS
<add> stop_words = STOP_WORDS
<ide><path>spacy/fi/language_data.py
<add># encoding: utf8
<add>from __future__ import unicode_literals
<add>
<add>from .. import language_data as base
<add>from ..language_data import update_exc, strings_to_exc
<add>
<add>from .stop_words import STOP_WORDS
<add>from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
<add>
<add>
<add>STOP_WORDS = set(STOP_WORDS)
<add>
<add>TOKENIZER_EXCEPTIONS = dict(TOKENIZER_EXCEPTIONS)
<add>update_exc(TOKENIZER_EXCEPTIONS, strings_to_exc(base.EMOTICONS))
<add>
<add>
<add>__all__ = ["TOKENIZER_EXCEPTIONS", "STOP_WORDS"]
<ide><path>spacy/fi/stop_words.py
<add># encoding: utf8
<add>from __future__ import unicode_literals
<add>
<add># Source https://github.com/stopwords-iso/stopwords-fi/blob/master/stopwords-fi.txt
<add>
<add>STOP_WORDS = set("""
<add>aiemmin
<add>aika
<add>aikaa
<add>aikaan
<add>aikaisemmin
<add>aikaisin
<add>aikajen
<add>aikana
<add>aikoina
<add>aikoo
<add>aikovat
<add>aina
<add>ainakaan
<add>ainakin
<add>ainoa
<add>ainoat
<add>aiomme
<add>aion
<add>aiotte
<add>aist
<add>aivan
<add>ajan
<add>alas
<add>alemmas
<add>alkuisin
<add>alkuun
<add>alla
<add>alle
<add>aloitamme
<add>aloitan
<add>aloitat
<add>aloitatte
<add>aloitattivat
<add>aloitettava
<add>aloitettevaksi
<add>aloitettu
<add>aloitimme
<add>aloitin
<add>aloitit
<add>aloititte
<add>aloittaa
<add>aloittamatta
<add>aloitti
<add>aloittivat
<add>alta
<add>aluksi
<add>alussa
<add>alusta
<add>annettavaksi
<add>annetteva
<add>annettu
<add>ansiosta
<add>antaa
<add>antamatta
<add>antoi
<add>aoua
<add>apu
<add>asia
<add>asiaa
<add>asian
<add>asiasta
<add>asiat
<add>asioiden
<add>asioihin
<add>asioita
<add>asti
<add>avuksi
<add>avulla
<add>avun
<add>avutta
<add>edelle
<add>edelleen
<add>edellä
<add>edeltä
<add>edemmäs
<add>edes
<add>edessä
<add>edestä
<add>ehkä
<add>ei
<add>eikä
<add>eilen
<add>eivät
<add>eli
<add>ellei
<add>elleivät
<add>ellemme
<add>ellen
<add>ellet
<add>ellette
<add>emme
<add>en
<add>enemmän
<add>eniten
<add>ennen
<add>ensi
<add>ensimmäinen
<add>ensimmäiseksi
<add>ensimmäisen
<add>ensimmäisenä
<add>ensimmäiset
<add>ensimmäisiksi
<add>ensimmäisinä
<add>ensimmäisiä
<add>ensimmäistä
<add>ensin
<add>entinen
<add>entisen
<add>entisiä
<add>entisten
<add>entistä
<add>enää
<add>eri
<add>erittäin
<add>erityisesti
<add>eräiden
<add>eräs
<add>eräät
<add>esi
<add>esiin
<add>esillä
<add>esimerkiksi
<add>et
<add>eteen
<add>etenkin
<add>etessa
<add>ette
<add>ettei
<add>että
<add>haikki
<add>halua
<add>haluaa
<add>haluamatta
<add>haluamme
<add>haluan
<add>haluat
<add>haluatte
<add>haluavat
<add>halunnut
<add>halusi
<add>halusimme
<add>halusin
<add>halusit
<add>halusitte
<add>halusivat
<add>halutessa
<add>haluton
<add>he
<add>hei
<add>heidän
<add>heidät
<add>heihin
<add>heille
<add>heillä
<add>heiltä
<add>heissä
<add>heistä
<add>heitä
<add>helposti
<add>heti
<add>hetkellä
<add>hieman
<add>hitaasti
<add>hoikein
<add>huolimatta
<add>huomenna
<add>hyvien
<add>hyviin
<add>hyviksi
<add>hyville
<add>hyviltä
<add>hyvin
<add>hyvinä
<add>hyvissä
<add>hyvistä
<add>hyviä
<add>hyvä
<add>hyvät
<add>hyvää
<add>hän
<add>häneen
<add>hänelle
<add>hänellä
<add>häneltä
<add>hänen
<add>hänessä
<add>hänestä
<add>hänet
<add>häntä
<add>ihan
<add>ilman
<add>ilmeisesti
<add>itse
<add>itsensä
<add>itseään
<add>ja
<add>jo
<add>johon
<add>joiden
<add>joihin
<add>joiksi
<add>joilla
<add>joille
<add>joilta
<add>joina
<add>joissa
<add>joista
<add>joita
<add>joka
<add>jokainen
<add>jokin
<add>joko
<add>joksi
<add>joku
<add>jolla
<add>jolle
<add>jolloin
<add>jolta
<add>jompikumpi
<add>jona
<add>jonka
<add>jonkin
<add>jonne
<add>joo
<add>jopa
<add>jos
<add>joskus
<add>jossa
<add>josta
<add>jota
<add>jotain
<add>joten
<add>jotenkin
<add>jotenkuten
<add>jotka
<add>jotta
<add>jouduimme
<add>jouduin
<add>jouduit
<add>jouduitte
<add>joudumme
<add>joudun
<add>joudutte
<add>joukkoon
<add>joukossa
<add>joukosta
<add>joutua
<add>joutui
<add>joutuivat
<add>joutumaan
<add>joutuu
<add>joutuvat
<add>juuri
<add>jälkeen
<add>jälleen
<add>jää
<add>kahdeksan
<add>kahdeksannen
<add>kahdella
<add>kahdelle
<add>kahdelta
<add>kahden
<add>kahdessa
<add>kahdesta
<add>kahta
<add>kahteen
<add>kai
<add>kaiken
<add>kaikille
<add>kaikilta
<add>kaikkea
<add>kaikki
<add>kaikkia
<add>kaikkiaan
<add>kaikkialla
<add>kaikkialle
<add>kaikkialta
<add>kaikkien
<add>kaikkin
<add>kaksi
<add>kannalta
<add>kannattaa
<add>kanssa
<add>kanssaan
<add>kanssamme
<add>kanssani
<add>kanssanne
<add>kanssasi
<add>kauan
<add>kauemmas
<add>kaukana
<add>kautta
<add>kehen
<add>keiden
<add>keihin
<add>keiksi
<add>keille
<add>keillä
<add>keiltä
<add>keinä
<add>keissä
<add>keistä
<add>keitten
<add>keittä
<add>keitä
<add>keneen
<add>keneksi
<add>kenelle
<add>kenellä
<add>keneltä
<add>kenen
<add>kenenä
<add>kenessä
<add>kenestä
<add>kenet
<add>kenettä
<add>kennessästä
<add>kenties
<add>kerran
<add>kerta
<add>kertaa
<add>keskellä
<add>kesken
<add>keskimäärin
<add>ketkä
<add>ketä
<add>kiitos
<add>kohti
<add>koko
<add>kokonaan
<add>kolmas
<add>kolme
<add>kolmen
<add>kolmesti
<add>koska
<add>koskaan
<add>kovin
<add>kuin
<add>kuinka
<add>kuinkan
<add>kuitenkaan
<add>kuitenkin
<add>kuka
<add>kukaan
<add>kukin
<add>kukka
<add>kumpainen
<add>kumpainenkaan
<add>kumpi
<add>kumpikaan
<add>kumpikin
<add>kun
<add>kuten
<add>kuuden
<add>kuusi
<add>kuutta
<add>kylliksi
<add>kyllä
<add>kymmenen
<add>kyse
<add>liian
<add>liki
<add>lisäksi
<add>lisää
<add>lla
<add>luo
<add>luona
<add>lähekkäin
<add>lähelle
<add>lähellä
<add>läheltä
<add>lähemmäs
<add>lähes
<add>lähinnä
<add>lähtien
<add>läpi
<add>mahdollisimman
<add>mahdollista
<add>me
<add>meidän
<add>meidät
<add>meihin
<add>meille
<add>meillä
<add>meiltä
<add>meissä
<add>meistä
<add>meitä
<add>melkein
<add>melko
<add>menee
<add>meneet
<add>menemme
<add>menen
<add>menet
<add>menette
<add>menevät
<add>meni
<add>menimme
<add>menin
<add>menit
<add>menivät
<add>mennessä
<add>mennyt
<add>menossa
<add>mihin
<add>mikin
<add>miksi
<add>mikä
<add>mikäli
<add>mikään
<add>mille
<add>milloin
<add>milloinkan
<add>millä
<add>miltä
<add>minkä
<add>minne
<add>minua
<add>minulla
<add>minulle
<add>minulta
<add>minun
<add>minussa
<add>minusta
<add>minut
<add>minuun
<add>minä
<add>missä
<add>mistä
<add>miten
<add>mitkä
<add>mitä
<add>mitään
<add>moi
<add>molemmat
<add>mones
<add>monesti
<add>monet
<add>moni
<add>moniaalla
<add>moniaalle
<add>moniaalta
<add>monta
<add>muassa
<add>muiden
<add>muita
<add>muka
<add>mukaan
<add>mukaansa
<add>mukana
<add>mutta
<add>muu
<add>muualla
<add>muualle
<add>muualta
<add>muuanne
<add>muulloin
<add>muun
<add>muut
<add>muuta
<add>muutama
<add>muutaman
<add>muuten
<add>myöhemmin
<add>myös
<add>myöskin
<add>myöskään
<add>myötä
<add>ne
<add>neljä
<add>neljän
<add>neljää
<add>niiden
<add>niihin
<add>niiksi
<add>niille
<add>niillä
<add>niiltä
<add>niin
<add>niinä
<add>niissä
<add>niistä
<add>niitä
<add>noiden
<add>noihin
<add>noiksi
<add>noilla
<add>noille
<add>noilta
<add>noin
<add>noina
<add>noissa
<add>noista
<add>noita
<add>nopeammin
<add>nopeasti
<add>nopeiten
<add>nro
<add>nuo
<add>nyt
<add>näiden
<add>näihin
<add>näiksi
<add>näille
<add>näillä
<add>näiltä
<add>näin
<add>näinä
<add>näissä
<add>näissähin
<add>näissälle
<add>näissältä
<add>näissästä
<add>näistä
<add>näitä
<add>nämä
<add>ohi
<add>oikea
<add>oikealla
<add>oikein
<add>ole
<add>olemme
<add>olen
<add>olet
<add>olette
<add>oleva
<add>olevan
<add>olevat
<add>oli
<add>olimme
<add>olin
<add>olisi
<add>olisimme
<add>olisin
<add>olisit
<add>olisitte
<add>olisivat
<add>olit
<add>olitte
<add>olivat
<add>olla
<add>olleet
<add>olli
<add>ollut
<add>oma
<add>omaa
<add>omaan
<add>omaksi
<add>omalle
<add>omalta
<add>oman
<add>omassa
<add>omat
<add>omia
<add>omien
<add>omiin
<add>omiksi
<add>omille
<add>omilta
<add>omissa
<add>omista
<add>on
<add>onkin
<add>onko
<add>ovat
<add>paikoittain
<add>paitsi
<add>pakosti
<add>paljon
<add>paremmin
<add>parempi
<add>parhaillaan
<add>parhaiten
<add>perusteella
<add>peräti
<add>pian
<add>pieneen
<add>pieneksi
<add>pienelle
<add>pienellä
<add>pieneltä
<add>pienempi
<add>pienestä
<add>pieni
<add>pienin
<add>poikki
<add>puolesta
<add>puolestaan
<add>päälle
<add>runsaasti
<add>saakka
<add>sadam
<add>sama
<add>samaa
<add>samaan
<add>samalla
<add>samallalta
<add>samallassa
<add>samallasta
<add>saman
<add>samat
<add>samoin
<add>sata
<add>sataa
<add>satojen
<add>se
<add>seitsemän
<add>sekä
<add>sen
<add>seuraavat
<add>siellä
<add>sieltä
<add>siihen
<add>siinä
<add>siis
<add>siitä
<add>sijaan
<add>siksi
<add>sille
<add>silloin
<add>sillä
<add>silti
<add>siltä
<add>sinne
<add>sinua
<add>sinulla
<add>sinulle
<add>sinulta
<add>sinun
<add>sinussa
<add>sinusta
<add>sinut
<add>sinuun
<add>sinä
<add>sisäkkäin
<add>sisällä
<add>siten
<add>sitten
<add>sitä
<add>ssa
<add>sta
<add>suoraan
<add>suuntaan
<add>suuren
<add>suuret
<add>suuri
<add>suuria
<add>suurin
<add>suurten
<add>taa
<add>taas
<add>taemmas
<add>tahansa
<add>tai
<add>takaa
<add>takaisin
<add>takana
<add>takia
<add>tallä
<add>tapauksessa
<add>tarpeeksi
<add>tavalla
<add>tavoitteena
<add>te
<add>teidän
<add>teidät
<add>teihin
<add>teille
<add>teillä
<add>teiltä
<add>teissä
<add>teistä
<add>teitä
<add>tietysti
<add>todella
<add>toinen
<add>toisaalla
<add>toisaalle
<add>toisaalta
<add>toiseen
<add>toiseksi
<add>toisella
<add>toiselle
<add>toiselta
<add>toisemme
<add>toisen
<add>toisensa
<add>toisessa
<add>toisesta
<add>toista
<add>toistaiseksi
<add>toki
<add>tosin
<add>tuhannen
<add>tuhat
<add>tule
<add>tulee
<add>tulemme
<add>tulen
<add>tulet
<add>tulette
<add>tulevat
<add>tulimme
<add>tulin
<add>tulisi
<add>tulisimme
<add>tulisin
<add>tulisit
<add>tulisitte
<add>tulisivat
<add>tulit
<add>tulitte
<add>tulivat
<add>tulla
<add>tulleet
<add>tullut
<add>tuntuu
<add>tuo
<add>tuohon
<add>tuoksi
<add>tuolla
<add>tuolle
<add>tuolloin
<add>tuolta
<add>tuon
<add>tuona
<add>tuonne
<add>tuossa
<add>tuosta
<add>tuota
<add>tuotä
<add>tuskin
<add>tykö
<add>tähän
<add>täksi
<add>tälle
<add>tällä
<add>tällöin
<add>tältä
<add>tämä
<add>tämän
<add>tänne
<add>tänä
<add>tänään
<add>tässä
<add>tästä
<add>täten
<add>tätä
<add>täysin
<add>täytyvät
<add>täytyy
<add>täällä
<add>täältä
<add>ulkopuolella
<add>usea
<add>useasti
<add>useimmiten
<add>usein
<add>useita
<add>uudeksi
<add>uudelleen
<add>uuden
<add>uudet
<add>uusi
<add>uusia
<add>uusien
<add>uusinta
<add>uuteen
<add>uutta
<add>vaan
<add>vahemmän
<add>vai
<add>vaiheessa
<add>vaikea
<add>vaikean
<add>vaikeat
<add>vaikeilla
<add>vaikeille
<add>vaikeilta
<add>vaikeissa
<add>vaikeista
<add>vaikka
<add>vain
<add>varmasti
<add>varsin
<add>varsinkin
<add>varten
<add>vasen
<add>vasenmalla
<add>vasta
<add>vastaan
<add>vastakkain
<add>vastan
<add>verran
<add>vielä
<add>vierekkäin
<add>vieressä
<add>vieri
<add>viiden
<add>viime
<add>viimeinen
<add>viimeisen
<add>viimeksi
<add>viisi
<add>voi
<add>voidaan
<add>voimme
<add>voin
<add>voisi
<add>voit
<add>voitte
<add>voivat
<add>vuoden
<add>vuoksi
<add>vuosi
<add>vuosien
<add>vuosina
<add>vuotta
<add>vähemmän
<add>vähintään
<add>vähiten
<add>vähän
<add>välillä
<add>yhdeksän
<add>yhden
<add>yhdessä
<add>yhteen
<add>yhteensä
<add>yhteydessä
<add>yhteyteen
<add>yhtä
<add>yhtäälle
<add>yhtäällä
<add>yhtäältä
<add>yhtään
<add>yhä
<add>yksi
<add>yksin
<add>yksittäin
<add>yleensä
<add>ylemmäs
<add>yli
<add>ylös
<add>ympäri
<add>älköön
<add>älä
<add>""".split())
<ide><path>spacy/fi/tokenizer_exceptions.py
<add># encoding: utf8
<add>from __future__ import unicode_literals
<add>
<add>from ..symbols import *
<add>from ..language_data import PRON_LEMMA
<add>
<add># Source https://www.cs.tut.fi/~jkorpela/kielenopas/5.5.html
<add>
<add>TOKENIZER_EXCEPTIONS = {
<add> "aik.": [
<add> {ORTH: "aik.", LEMMA: "aikaisempi"}
<add> ],
<add> "alk.": [
<add> {ORTH: "alk.", LEMMA: "alkaen"}
<add> ],
<add> "alv.": [
<add> {ORTH: "alv.", LEMMA: "arvonlisävero"}
<add> ],
<add> "ark.": [
<add> {ORTH: "ark.", LEMMA: "arkisin"}
<add> ],
<add> "as.": [
<add> {ORTH: "as.", LEMMA: "asunto"}
<add> ],
<add> "ed.": [
<add> {ORTH: "ed.", LEMMA: "edellinen"}
<add> ],
<add> "esim.": [
<add> {ORTH: "esim.", LEMMA: "esimerkki"}
<add> ],
<add> "huom.": [
<add> {ORTH: "huom.", LEMMA: "huomautus"}
<add> ],
<add> "jne.": [
<add> {ORTH: "jne.", LEMMA: "ja niin edelleen"}
<add> ],
<add> "joht.": [
<add> {ORTH: "joht.", LEMMA: "johtaja"}
<add> ],
<add> "k.": [
<add> {ORTH: "k.", LEMMA: "kuollut"}
<add> ],
<add> "ks.": [
<add> {ORTH: "ks.", LEMMA: "katso"}
<add> ],
<add> "lk.": [
<add> {ORTH: "lk.", LEMMA: "luokka"}
<add> ],
<add> "lkm.": [
<add> {ORTH: "lkm.", LEMMA: "lukumäärä"}
<add> ],
<add> "lyh.": [
<add> {ORTH: "lyh.", LEMMA: "lyhenne"}
<add> ],
<add> "läh.": [
<add> {ORTH: "läh.", LEMMA: "lähettäjä"}
<add> ],
<add> "miel.": [
<add> {ORTH: "miel.", LEMMA: "mieluummin"}
<add> ],
<add> "milj.": [
<add> {ORTH: "milj.", LEMMA: "miljoona"}
<add> ],
<add> "mm.": [
<add> {ORTH: "mm.", LEMMA: "muun muassa"}
<add> ],
<add> "myöh.": [
<add> {ORTH: "myöh.", LEMMA: "myöhempi"}
<add> ],
<add> "n.": [
<add> {ORTH: "n.", LEMMA: "noin"}
<add> ],
<add> "nimim.": [
<add> {ORTH: "nimim.", LEMMA: "nimimerkki"}
<add> ],
<add> "ns.": [
<add> {ORTH: "ns.", LEMMA: "niin sanottu"}
<add> ],
<add> "nyk.": [
<add> {ORTH: "nyk.", LEMMA: "nykyinen"}
<add> ],
<add> "oik.": [
<add> {ORTH: "oik.", LEMMA: "oikealla"}
<add> ],
<add> "os.": [
<add> {ORTH: "os.", LEMMA: "osoite"}
<add> ],
<add> "p.": [
<add> {ORTH: "p.", LEMMA: "päivä"}
<add> ],
<add> "par.": [
<add> {ORTH: "par.", LEMMA: "paremmin"}
<add> ],
<add> "per.": [
<add> {ORTH: "per.", LEMMA: "perustettu"}
<add> ],
<add> "pj.": [
<add> {ORTH: "pj.", LEMMA: "puheenjohtaja"}
<add> ],
<add> "puh.joht.": [
<add> {ORTH: "puh.joht.", LEMMA: "puheenjohtaja"}
<add> ],
<add> "prof.": [
<add> {ORTH: "prof.", LEMMA: "professori"}
<add> ],
<add> "puh.": [
<add> {ORTH: "puh.", LEMMA: "puhelin"}
<add> ],
<add> "pvm.": [
<add> {ORTH: "pvm.", LEMMA: "päivämäärä"}
<add> ],
<add> "rak.": [
<add> {ORTH: "rak.", LEMMA: "rakennettu"}
<add> ],
<add> "ry.": [
<add> {ORTH: "ry.", LEMMA: "rekisteröity yhdistys"}
<add> ],
<add> "s.": [
<add> {ORTH: "s.", LEMMA: "sivu"}
<add> ],
<add> "siht.": [
<add> {ORTH: "siht.", LEMMA: "sihteeri"}
<add> ],
<add> "synt.": [
<add> {ORTH: "synt.", LEMMA: "syntynyt"}
<add> ],
<add> "t.": [
<add> {ORTH: "t.", LEMMA: "toivoo"}
<add> ],
<add> "tark.": [
<add> {ORTH: "tark.", LEMMA: "tarkastanut"}
<add> ],
<add> "til.": [
<add> {ORTH: "til.", LEMMA: "tilattu"}
<add> ],
<add> "tms.": [
<add> {ORTH: "tms.", LEMMA: "tai muuta sellaista"}
<add> ],
<add> "toim.": [
<add> {ORTH: "toim.", LEMMA: "toimittanut"}
<add> ],
<add> "v.": [
<add> {ORTH: "v.", LEMMA: "vuosi"}
<add> ],
<add> "vas.": [
<add> {ORTH: "vas.", LEMMA: "vasen"}
<add> ],
<add> "vast.": [
<add> {ORTH: "vast.", LEMMA: "vastaus"}
<add> ],
<add> "vrt.": [
<add> {ORTH: "vrt.", LEMMA: "vertaa"}
<add> ],
<add> "yht.": [
<add> {ORTH: "yht.", LEMMA: "yhteensä"}
<add> ],
<add> "yl.": [
<add> {ORTH: "yl.", LEMMA: "yleinen"}
<add> ],
<add> "ym.": [
<add> {ORTH: "ym.", LEMMA: "ynnä muuta"}
<add> ],
<add> "yms.": [
<add> {ORTH: "yms.", LEMMA: "ynnä muuta sellaista"}
<add> ],
<add> "yo.": [
<add> {ORTH: "yo.", LEMMA: "ylioppilas"}
<add> ],
<add> "yliopp.": [
<add> {ORTH: "yliopp.", LEMMA: "ylioppilas"}
<add> ],
<add> "ao.": [
<add> {ORTH: "ao.", LEMMA: "asianomainen"}
<add> ],
<add> "em.": [
<add> {ORTH: "em.", LEMMA: "edellä mainittu"}
<add> ],
<add> "ko.": [
<add> {ORTH: "ko.", LEMMA: "kyseessä oleva"}
<add> ],
<add> "ml.": [
<add> {ORTH: "ml.", LEMMA: "mukaan luettuna"}
<add> ],
<add> "po.": [
<add> {ORTH: "po.", LEMMA: "puheena oleva"}
<add> ],
<add> "so.": [
<add> {ORTH: "so.", LEMMA: "se on"}
<add> ],
<add> "ts.": [
<add> {ORTH: "ts.", LEMMA: "toisin sanoen"}
<add> ],
<add> "vm.": [
<add> {ORTH: "vm.", LEMMA: "viimeksi mainittu"}
<add> ],
<add> "siht.": [
<add> {ORTH: "siht.", LEMMA: "sihteeri"}
<add> ],
<add> "srk.": [
<add> {ORTH: "srk.", LEMMA: "seurakunta"}
<add> ]
<add>} | 6 |
Text | Text | use serial comma in process docs | 40fa2e9c110c616b1301c20c2a3cdb2cf6cc165e | <ide><path>doc/api/process.md
<ide> process.on('SIGTERM', handle);
<ide> * `'SIGKILL'` cannot have a listener installed, it will unconditionally
<ide> terminate Node.js on all platforms.
<ide> * `'SIGSTOP'` cannot have a listener installed.
<del>* `'SIGBUS'`, `'SIGFPE'`, `'SIGSEGV'` and `'SIGILL'`, when not raised
<add>* `'SIGBUS'`, `'SIGFPE'`, `'SIGSEGV'`, and `'SIGILL'`, when not raised
<ide> artificially using kill(2), inherently leave the process in a state from
<ide> which it is not safe to call JS listeners. Doing so might cause the process
<ide> to stop responding. | 1 |
Javascript | Javascript | move createsafefragment to the top to satisfy lint | a74cbb2b911b3afad96599728208d95a60d24cbf | <ide><path>src/manipulation.js
<ide> (function( jQuery ) {
<ide>
<add>function createSafeFragment( document ) {
<add> var nodeNames = (
<add> "abbr article aside audio canvas datalist details figcaption figure footer " +
<add> "header hgroup mark meter nav output progress section summary time video"
<add> ).split( " " ),
<add> safeFrag = document.createDocumentFragment();
<add>
<add> if ( safeFrag.createElement ) {
<add> while ( nodeNames.length ) {
<add> safeFrag.createElement(
<add> nodeNames.pop()
<add> );
<add> }
<add> }
<add> return safeFrag;
<add>}
<add>
<ide> var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
<ide> rleadingWhitespace = /^\s+/,
<ide> rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
<ide> function evalScript( i, elem ) {
<ide> }
<ide> }
<ide>
<del>function createSafeFragment( document ) {
<del> var nodeNames = (
<del> "abbr article aside audio canvas datalist details figcaption figure footer " +
<del> "header hgroup mark meter nav output progress section summary time video"
<del> ).split( " " ),
<del> safeFrag = document.createDocumentFragment();
<del>
<del> if ( safeFrag.createElement ) {
<del> while ( nodeNames.length ) {
<del> safeFrag.createElement(
<del> nodeNames.pop()
<del> );
<del> }
<del> }
<del> return safeFrag;
<del>}
<del>
<ide> })( jQuery ); | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.