content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Java
Java
update copyright headers in idgenerators
e97712b95b8878fec0f40f9141ad29de42f18610
<ide><path>spring-core/src/main/java/org/springframework/util/AlternativeJdkIdGenerator.java <ide> /* <del> * Copyright 2002-2013 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><path>spring-core/src/main/java/org/springframework/util/IdGenerator.java <ide> /* <del> * Copyright 2002-2013 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> import java.util.UUID; <ide> <ide> /** <del> * Contract for generating {@link UUID} identifiers. <add> * Contract for generating universally unique identifiers {@link UUID (UUIDs)}. <ide> * <ide> * @author Rossen Stoyanchev <ide> * @since 4.0 <ide><path>spring-core/src/main/java/org/springframework/util/JdkIdGenerator.java <ide> /* <del> * Copyright 2002-2013 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> import java.util.UUID; <ide> <ide> /** <del> * An IdGenerator that calls {@link java.util.UUID#randomUUID()}. <add> * An {@link org.springframework.util.IdGenerator IdGenerator} that calls <add> * {@link java.util.UUID#randomUUID()}. <ide> * <ide> * @author Rossen Stoyanchev <ide> * @since 4.2 <ide><path>spring-core/src/main/java/org/springframework/util/SimpleIdGenerator.java <ide> /* <del> * Copyright 2002-2013 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> import java.util.concurrent.atomic.AtomicLong; <ide> <ide> /** <del> * An simple IdGenerator that starts at 1 and increments by 1 with each call. <add> * A simple {@link org.springframework.util.IdGenerator IdGenerator} that <add> * starts at 1 and increments by 1 with each call. <ide> * <ide> * @author Rossen Stoyanchev <ide> * @since 4.2
4
Javascript
Javascript
remove extra pages
9546f9c3ace8727e69d7348c77ce324d1638db42
<ide><path>test/integration/handles-export-errors/pages/index copy 10.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 11.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 12.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 13.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 2.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 3.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 4.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 5.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 6.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 7.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 8.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy 9.js <del>// eslint-disable-next-line <del>export default () => hello.world <ide><path>test/integration/handles-export-errors/pages/index copy.js <del>// eslint-disable-next-line <del>export default () => hello.world
13
Python
Python
include keras tensor in the allowed types
919a964b8ffd2f53b60504072a4127632ba79d60
<ide><path>src/transformers/modeling_tf_utils.py <ide> import tensorflow as tf <ide> from tensorflow.python.keras import backend as K <ide> from tensorflow.python.keras.engine import data_adapter <add>from tensorflow.python.keras.engine.keras_tensor import KerasTensor <ide> from tensorflow.python.keras.saving import hdf5_format <ide> <ide> from .configuration_utils import PretrainedConfig <ide> tf_logger = tf.get_logger() <ide> <ide> TFModelInputType = Union[ <del> List[tf.Tensor], List[np.ndarray], Dict[str, tf.Tensor], Dict[str, np.ndarray], np.ndarray, tf.Tensor <add> List[tf.Tensor], <add> List[np.ndarray], <add> List[KerasTensor], <add> Dict[str, tf.Tensor], <add> Dict[str, np.ndarray], <add> Dict[str, KerasTensor], <add> tf.Tensor, <add> np.ndarray, <add> KerasTensor, <ide> ] <ide> <ide> <ide> def input_processing(func, config, input_ids, **kwargs): <ide> signature.pop("self", None) <ide> parameter_names = list(signature.keys()) <ide> output = {} <del> allowed_types = (tf.Tensor, bool, int, ModelOutput, tuple, list, dict, np.ndarray) <add> allowed_types = (tf.Tensor, bool, int, ModelOutput, tuple, list, dict, np.ndarray, KerasTensor) <ide> <ide> if "inputs" in kwargs["kwargs_call"]: <ide> warnings.warn( <ide> def input_processing(func, config, input_ids, **kwargs): <ide> else: <ide> raise ValueError(f"Data of type {type(v)} is not allowed only {allowed_types} is accepted for {k}.") <ide> else: <del> if isinstance(input_ids, tf.Tensor) or input_ids is None: <add> if isinstance(input_ids, (tf.Tensor, KerasTensor)) or input_ids is None: <ide> output[parameter_names[0]] = input_ids <ide> else: <ide> raise ValueError(
1
Text
Text
fix indents in pe
49b10b0e32473441d84810fff236dbb0a5d11768
<ide><path>.github/PULL_REQUEST_TEMPLATE.md <ide> <ide> <ide> * IF IT'S A NEW FEATURE OR API CHANGE, TEST THE WATERS: <del> http://www.numpy.org/devdocs/dev/development_workflow.html#get-the-mailing-list-s-opinion <add> http://www.numpy.org/devdocs/dev/development_workflow.html#get-the-mailing-list-s-opinion <ide> <ide> <ide> * HIT ALL THE GUIDELINES: <del> https://numpy.org/devdocs/dev/index.html#guidelines <add> https://numpy.org/devdocs/dev/index.html#guidelines <ide> <ide> <ide> * WHAT TO DO IF WE HAVEN'T GOTTEN BACK TO YOU: <del> http://www.numpy.org/devdocs/dev/development_workflow.html#getting-your-pr-reviewed <add> http://www.numpy.org/devdocs/dev/development_workflow.html#getting-your-pr-reviewed <ide> -->
1
Python
Python
use check_output to capture in celery task
439f7dc1d1d531405ecd6e3772bd69a6fcb9f508
<ide><path>airflow/executors/celery_executor.py <ide> def execute_command(command_to_exec: CommandType) -> None: <ide> log.info("Executing command in Celery: %s", command_to_exec) <ide> env = os.environ.copy() <ide> try: <del> subprocess.check_call(command_to_exec, stderr=subprocess.STDOUT, <del> close_fds=True, env=env) <add> # pylint: disable=unexpected-keyword-arg <add> subprocess.check_output(command_to_exec, stderr=subprocess.STDOUT, <add> close_fds=True, env=env) <add> # pylint: disable=unexpected-keyword-arg <ide> except subprocess.CalledProcessError as e: <ide> log.exception('execute_command encountered a CalledProcessError') <ide> log.error(e.output) <ide><path>tests/executors/test_celery_executor.py <ide> def test_gauge_executor_metrics(self, mock_stats_gauge, mock_trigger_tasks, mock <ide> [['airflow', 'version'], ValueError], <ide> [['airflow', 'tasks', 'run'], None] <ide> )) <del> @mock.patch('subprocess.check_call') <del> def test_command_validation(self, command, expected_exception, mock_check_call): <add> @mock.patch('subprocess.check_output') <add> def test_command_validation(self, command, expected_exception, mock_check_output): <ide> # Check that we validate _on the receiving_ side, not just sending side <ide> if expected_exception: <ide> with pytest.raises(expected_exception): <ide> celery_executor.execute_command(command) <del> mock_check_call.assert_not_called() <add> mock_check_output.assert_not_called() <ide> else: <ide> celery_executor.execute_command(command) <del> mock_check_call.assert_called_once_with( <add> mock_check_output.assert_called_once_with( <ide> command, stderr=mock.ANY, close_fds=mock.ANY, env=mock.ANY, <ide> ) <ide>
2
Python
Python
fix the taskset set
0f33f97deeafadeed4690ef669e8f937afda763d
<ide><path>celery/tests/test_task.py <ide> def test_counter_taskset(self): <ide> self.assertEquals(ts.task_name, IncrementCounterTask.name) <ide> self.assertEquals(ts.total, 9) <ide> <del> taskset_id, subtask_ids = ts.run() <add> taskset_res = ts.run() <add> subtask_ids = taskset_res.subtask_ids <add> taskset_id = taskset_res.taskset_id <ide> <ide> consumer = IncrementCounterTask().get_consumer() <ide> for subtask_id in subtask_ids:
1
PHP
PHP
adjust comments in crypt class
5664c9dc92d47a1d7ffb6e703dac56507849c487
<ide><path>system/crypt.php <ide> class Crypt { <ide> */ <ide> public static function encrypt($value) <ide> { <del> // Seed the system random number generator if it is being used. <del> if (($random = static::randomizer()) === MCRYPT_RAND) <del> { <del> mt_srand(); <del> } <add> // If the system random number generator is being used, we need to seed <add> // it to get adequately random results. <add> if (($random = static::randomizer()) === MCRYPT_RAND) mt_srand(); <ide> <ide> $iv = mcrypt_create_iv(static::iv_size(), $random); <ide>
1
PHP
PHP
fix some docblocks
5e905c728e4e486c8d4090d51b5037ec97a5253b
<ide><path>src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php <ide> public function find($id, $columns = ['*']) <ide> /** <ide> * Find multiple related models by their primary keys. <ide> * <del> * @param mixed $id <add> * @param mixed $ids <ide> * @param array $columns <ide> * @return \Illuminate\Database\Eloquent\Collection <ide> */ <ide> protected function getSelectColumns(array $columns = ['*']) <ide> return array_merge($columns, [$this->parent->getTable().'.'.$this->firstKey]); <ide> } <ide> <del> /* <add> /** <ide> * Get a paginator for the "select" statement. <ide> * <ide> * @param int $perPage <ide><path>src/Illuminate/Queue/Worker.php <ide> class Worker { <ide> /** <ide> * The exception handler instance. <ide> * <del> * @var \Illuminate\Exception\Handler <add> * @var \Illuminate\Foundation\Exceptions\Handler <ide> */ <ide> protected $exceptions; <ide>
2
Python
Python
check matching inputs/outputs in umath generation
948b9d19d4fbfa485031b622b42d2c5df2e8020d
<ide><path>numpy/core/code_generators/generate_umath.py <ide> def TD(types, f=None, astype=None, in_=None, out=None, simd=None): <ide> if f is not None: <ide> if isinstance(f, str): <ide> func_data = build_func_data(types, f) <add> elif len(f) != len(types): <add> raise ValueError("Number of types and f do not match") <ide> else: <del> assert len(f) == len(types) <ide> func_data = f <ide> else: <ide> func_data = (None,) * len(types) <ide> if isinstance(in_, str): <ide> in_ = (in_,) * len(types) <ide> elif in_ is None: <ide> in_ = (None,) * len(types) <add> elif len(in_) != len(types): <add> raise ValueError("Number of types and inputs do not match") <ide> if isinstance(out, str): <ide> out = (out,) * len(types) <ide> elif out is None: <ide> out = (None,) * len(types) <add> elif len(out) != len(types): <add> raise ValueError("Number of types and outputs do not match") <ide> tds = [] <ide> for t, fd, i, o in zip(types, func_data, in_, out): <ide> # [(simd-name, list of types)]
1
Ruby
Ruby
add odeprecated comments
f5cd15fa1893d58676a005c54dcaded3cdf61729
<ide><path>Library/Homebrew/formula.rb <ide> def pour_bottle?(&block) <ide> # will not be deprecated. <ide> # <pre>deprecate! date: "2020-08-27", because: "it is no longer maintained"</pre> <ide> def deprecate!(date: nil, because: nil) <add> # TODO: enable for next major/minor release <add> # odeprecated "`deprecate!` without a reason", "`deprecate! because: \"reason\"`" if because.blank? <add> <ide> return if date.present? && Date.parse(date) > Date.today <ide> <ide> @deprecation_reason = because if because.present? <ide> def deprecated? <ide> # will be deprecated instead of disabled. <ide> # <pre>disable! date: "2020-08-27", because: "it no longer builds"</pre> <ide> def disable!(date: nil, because: nil) <add> # TODO: enable for next major/minor release <add> # odeprecated "`disable!` without a reason", "`disable! because: \"reason\"`" if because.blank? <add> <ide> if date.present? && Date.parse(date) > Date.today <ide> @deprecation_reason = because if because.present? <ide> @deprecated = true
1
Text
Text
reuse link indexes for n-api.md
d742535184655a04aafbf266522231aa1b7430c2
<ide><path>doc/api/n-api.md <ide> properties: <ide> The N-API is a C API that ensures ABI stability across Node.js versions <ide> and different compiler levels. A C++ API can be easier to use. <ide> To support using C++, the project maintains a <del>C++ wrapper module called <del>[node-addon-api](https://github.com/nodejs/node-addon-api). <add>C++ wrapper module called [node-addon-api][]. <ide> This wrapper provides an inlineable C++ API. Binaries built <ide> with `node-addon-api` will depend on the symbols for the N-API C-based <ide> functions exported by Node.js. `node-addon-api` is a more <ide> API. <ide> <ide> ## Working with JavaScript Values <ide> N-API exposes a set of APIs to create all types of JavaScript values. <del>Some of these types are documented under <del>[Section 6](https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values) <add>Some of these types are documented under [Section 6][] <ide> of the [ECMAScript Language Specification][]. <ide> <ide> Fundamentally, these APIs are used to do one of the following: <ide> typedef enum { <ide> ``` <ide> <ide> Describes the type of a `napi_value`. This generally corresponds to the types <del>described in <del>[Section 6.1](https://tc39.github.io/ecma262/#sec-ecmascript-language-types) of <del>the ECMAScript Language Specification. <add>described in [Section 6.1][] of the ECMAScript Language Specification. <ide> In addition to types in that section, `napi_valuetype` can also represent <ide> `Function`s and `Object`s with external data. <ide> <ide> Returns `napi_ok` if the API succeeded. <ide> This API allocates a default JavaScript `Object`. <ide> It is the equivalent of doing `new Object()` in JavaScript. <ide> <del>The JavaScript `Object` type is described in <del>[Section 6.1.7](https://tc39.github.io/ecma262/#sec-object-type) of the <add>The JavaScript `Object` type is described in [Section 6.1.7][] of the <ide> ECMAScript Language Specification. <ide> <ide> #### napi_create_symbol <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API creates a JavaScript `Symbol` object from a UTF8-encoded C string. <ide> <del>The JavaScript `Symbol` type is described in <del>[Section 19.4](https://tc39.github.io/ecma262/#sec-symbol-objects) <add>The JavaScript `Symbol` type is described in [Section 19.4][] <ide> of the ECMAScript Language Specification. <ide> <ide> #### napi_create_typedarray <ide> This API is used to convert from the C `int64_t` type to the JavaScript <ide> The JavaScript `Number` type is described in [Section 6.1.6][] <ide> of the ECMAScript Language Specification. Note the complete range of `int64_t` <ide> cannot be represented with full precision in JavaScript. Integer values <del>outside the range of <del>[`Number.MIN_SAFE_INTEGER`](https://tc39.github.io/ecma262/#sec-number.min_safe_integer) <del>-(2^53 - 1) - <del>[`Number.MAX_SAFE_INTEGER`](https://tc39.github.io/ecma262/#sec-number.max_safe_integer) <del>(2^53 - 1) will lose precision. <add>outside the range of [`Number.MIN_SAFE_INTEGER`][] `-(2^53 - 1)` - <add>[`Number.MAX_SAFE_INTEGER`][] `(2^53 - 1)` will lose precision. <ide> <ide> #### napi_create_double <ide> <!-- YAML <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API returns the length of an array. <ide> <del>`Array` length is described in <del>[Section 22.1.4.1](https://tc39.github.io/ecma262/#sec-properties-of-array-instances-length) <del>of the ECMAScript Language Specification. <add>`Array` length is described in [Section 22.1.4.1][] of the ECMAScript Language <add>Specification. <ide> <ide> #### napi_get_arraybuffer_info <ide> <!-- YAML <ide> is passed in it returns `napi_number_expected`. <ide> This API returns the C `int64` primitive equivalent of the given JavaScript <ide> `Number`. <ide> <del>`Number` values outside the range of <del>[`Number.MIN_SAFE_INTEGER`](https://tc39.github.io/ecma262/#sec-number.min_safe_integer) <del>-(2^53 - 1) - <del>[`Number.MAX_SAFE_INTEGER`](https://tc39.github.io/ecma262/#sec-number.max_safe_integer) <del>(2^53 - 1) will lose precision. <add>`Number` values outside the range of [`Number.MIN_SAFE_INTEGER`][] <add>`-(2^53 - 1)` - [`Number.MAX_SAFE_INTEGER`][] `(2^53 - 1)` will lose precision. <ide> <ide> Non-finite number values (`NaN`, `+Infinity`, or `-Infinity`) set the <ide> result to zero. <ide> This API returns the Undefined object. <ide> ## Working with JavaScript Values - Abstract Operations <ide> <ide> N-API exposes a set of APIs to perform some abstract operations on JavaScript <del>values. Some of these operations are documented under <del>[Section 7](https://tc39.github.io/ecma262/#sec-abstract-operations) <add>values. Some of these operations are documented under [Section 7][] <ide> of the [ECMAScript Language Specification][]. <ide> <ide> These APIs support doing one of the following: <ide> napi_status napi_coerce_to_bool(napi_env env, <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API implements the abstract operation `ToBoolean()` as defined in <del>[Section 7.1.2](https://tc39.github.io/ecma262/#sec-toboolean) <del>of the ECMAScript Language Specification. <add>[Section 7.1.2][] of the ECMAScript Language Specification. <ide> This API can be re-entrant if getters are defined on the passed-in `Object`. <ide> <ide> ### napi_coerce_to_number <ide> napi_status napi_coerce_to_number(napi_env env, <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API implements the abstract operation `ToNumber()` as defined in <del>[Section 7.1.3](https://tc39.github.io/ecma262/#sec-tonumber) <del>of the ECMAScript Language Specification. <add>[Section 7.1.3][] of the ECMAScript Language Specification. <ide> This API can be re-entrant if getters are defined on the passed-in `Object`. <ide> <ide> ### napi_coerce_to_object <ide> napi_status napi_coerce_to_object(napi_env env, <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API implements the abstract operation `ToObject()` as defined in <del>[Section 7.1.13](https://tc39.github.io/ecma262/#sec-toobject) <del>of the ECMAScript Language Specification. <add>[Section 7.1.13][] of the ECMAScript Language Specification. <ide> This API can be re-entrant if getters are defined on the passed-in `Object`. <ide> <ide> ### napi_coerce_to_string <ide> napi_status napi_coerce_to_string(napi_env env, <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API implements the abstract operation `ToString()` as defined in <del>[Section 7.1.13](https://tc39.github.io/ecma262/#sec-tostring) <del>of the ECMAScript Language Specification. <add>[Section 7.1.13][] of the ECMAScript Language Specification. <ide> This API can be re-entrant if getters are defined on the passed-in `Object`. <ide> <ide> ### napi_typeof <ide> is true. <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API represents invoking the `instanceof` Operator on the object as <del>defined in <del>[Section 12.10.4](https://tc39.github.io/ecma262/#sec-instanceofoperator) <del>of the ECMAScript Language Specification. <add>defined in [Section 12.10.4][] of the ECMAScript Language Specification. <ide> <ide> ### napi_is_array <ide> <!-- YAML <ide> napi_status napi_is_array(napi_env env, napi_value value, bool* result) <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API represents invoking the `IsArray` operation on the object <del>as defined in [Section 7.2.2](https://tc39.github.io/ecma262/#sec-isarray) <del>of the ECMAScript Language Specification. <add>as defined in [Section 7.2.2][] of the ECMAScript Language Specification. <ide> <ide> ### napi_is_arraybuffer <ide> <!-- YAML <ide> napi_status napi_strict_equals(napi_env env, <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> This API represents the invocation of the Strict Equality algorithm as <del>defined in <del>[Section 7.2.14](https://tc39.github.io/ecma262/#sec-strict-equality-comparison) <del>of the ECMAScript Language Specification. <add>defined in [Section 7.2.14][] of the ECMAScript Language Specification. <ide> <ide> ## Working with JavaScript Properties <ide> <ide> N-API exposes a set of APIs to get and set properties on JavaScript <del>objects. Some of these types are documented under <del>[Section 7](https://tc39.github.io/ecma262/#sec-operations-on-objects) of the <add>objects. Some of these types are documented under [Section 7][] of the <ide> [ECMAScript Language Specification][]. <ide> <ide> Properties in JavaScript are represented as a tuple of a key and a value. <ide> property to be a JavaScript function represented by `method`. If this is <ide> passed in, set `value`, `getter` and `setter` to `NULL` (since these members <ide> won't be used). <ide> * `attributes`: The attributes associated with the particular property. <del>See [`napi_property_attributes`](#n_api_napi_property_attributes). <add>See [`napi_property_attributes`][]. <ide> * `data`: The callback data passed into `method`, `getter` and `setter` if <ide> this function is invoked. <ide> <ide> be associated with the resulting JavaScript function (which is returned in the <ide> `result` parameter) and freed whenever the function is garbage-collected by <ide> passing both the JavaScript function and the data to [`napi_add_finalizer`][]. <ide> <del>JavaScript `Function`s are described in <del>[Section 19.2](https://tc39.github.io/ecma262/#sec-function-objects) <del>of the ECMAScript Language Specification. <add>JavaScript `Function`s are described in [Section 19.2][] of the ECMAScript <add>Language Specification. <ide> <ide> ### napi_get_cb_info <ide> <!-- YAML <ide> This API may only be called from the main thread. <ide> [Native Abstractions for Node.js]: https://github.com/nodejs/nan <ide> [Object Lifetime Management]: #n_api_object_lifetime_management <ide> [Object Wrap]: #n_api_object_wrap <add>[Section 6]: https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values <add>[Section 6.1]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types <add>[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type <add>[Section 6.1.6]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type <add>[Section 6.1.7]: https://tc39.github.io/ecma262/#sec-object-type <add>[Section 6.1.7.1]: https://tc39.github.io/ecma262/#table-2 <add>[Section 7]: https://tc39.github.io/ecma262/#sec-abstract-operations <add>[Section 7.1.2]: https://tc39.github.io/ecma262/#sec-toboolean <add>[Section 7.1.3]: https://tc39.github.io/ecma262/#sec-tonumber <add>[Section 7.1.13]: https://tc39.github.io/ecma262/#sec-toobject <add>[Section 7.2.2]: https://tc39.github.io/ecma262/#sec-isarray <add>[Section 7.2.14]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison <add>[Section 8.7]: https://tc39.es/ecma262/#sec-agents <add>[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc <ide> [Section 12.5.5]: https://tc39.github.io/ecma262/#sec-typeof-operator <add>[Section 12.10.4]: https://tc39.github.io/ecma262/#sec-instanceofoperator <add>[Section 19.2]: https://tc39.github.io/ecma262/#sec-function-objects <add>[Section 19.4]: https://tc39.github.io/ecma262/#sec-symbol-objects <ide> [Section 20.3]: https://tc39.github.io/ecma262/#sec-date-objects <ide> [Section 22.1]: https://tc39.github.io/ecma262/#sec-array-objects <add>[Section 22.1.4.1]: https://tc39.github.io/ecma262/#sec-properties-of-array-instances-length <ide> [Section 22.2]: https://tc39.github.io/ecma262/#sec-typedarray-objects <ide> [Section 24.1]: https://tc39.github.io/ecma262/#sec-arraybuffer-objects <ide> [Section 24.3]: https://tc39.github.io/ecma262/#sec-dataview-objects <ide> [Section 25.4]: https://tc39.github.io/ecma262/#sec-promise-objects <del>[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type <del>[Section 6.1.6]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type <del>[Section 6.1.7.1]: https://tc39.github.io/ecma262/#table-2 <del>[Section 8.7]: https://tc39.es/ecma262/#sec-agents <del>[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc <add>[`Number.MIN_SAFE_INTEGER`]: https://tc39.github.io/ecma262/#sec-number.min_safe_integer <add>[`Number.MAX_SAFE_INTEGER`]: https://tc39.github.io/ecma262/#sec-number.max_safe_integer <ide> [Working with JavaScript Functions]: #n_api_working_with_javascript_functions <ide> [Working with JavaScript Properties]: #n_api_working_with_javascript_properties <ide> [Working with JavaScript Values - Abstract Operations]: #n_api_working_with_javascript_values_abstract_operations <ide> This API may only be called from the main thread. <ide> [`napi_open_callback_scope`]: #n_api_napi_open_callback_scope <ide> [`napi_open_escapable_handle_scope`]: #n_api_napi_open_escapable_handle_scope <ide> [`napi_open_handle_scope`]: #n_api_napi_open_handle_scope <add>[`napi_property_attributes`]: #n_api_napi_property_attributes <ide> [`napi_property_descriptor`]: #n_api_napi_property_descriptor <ide> [`napi_queue_async_work`]: #n_api_napi_queue_async_work <ide> [`napi_reference_ref`]: #n_api_napi_reference_ref <ide> This API may only be called from the main thread. <ide> [`uv_unref`]: http://docs.libuv.org/en/v1.x/handle.html#c.uv_unref <ide> [async_hooks `type`]: async_hooks.html#async_hooks_type <ide> [context-aware addons]: addons.html#addons_context_aware_addons <add>[node-addon-api]: https://github.com/nodejs/node-addon-api <ide> [worker threads]: https://nodejs.org/api/worker_threads.html
1
Text
Text
add verification step to image release process
5d5598eca6ae4513e2decd851d32db992b6a02ec
<ide><path>dev/README_RELEASE_AIRFLOW.md <ide> - [Publish release to SVN](#publish-release-to-svn) <ide> - [Prepare PyPI "release" packages](#prepare-pypi-release-packages) <ide> - [Manually prepare production Docker Image](#manually-prepare-production-docker-image) <add> - [Verify production images](#verify-production-images) <ide> - [Publish documentation](#publish-documentation) <ide> - [Notify developers of release](#notify-developers-of-release) <ide> - [Add release data to Apache Committee Report Helper](#add-release-data-to-apache-committee-report-helper) <ide> Preparing a release that is not in the latest branch: <ide> breeze release-prod-images --airflow-version "${VERSION}" --slim-images --skip-latest <ide> ``` <ide> <add>## Verify production images <add> <add>```shell script <add>for PYTHON in 3.7 3.8 3.9 3.10 <add>do <add> docker pull apache/airflow:${VERSION}-python${PYTHON} <add> breeze verify-prod-image --image-name apache/airflow:${VERSION}-python${PYTHON} <add>done <add>docker pull apache/airflow:${VERSION} <add>breeze verify-prod-image --image-name apache/airflow:${VERSION} <add>``` <add> <ide> <ide> ## Publish documentation <ide>
1
Text
Text
update coreapi version in docs
5dd3d1b5d9dcbecf960e484eba9945964418a647
<ide><path>docs/index.md <ide> REST framework requires the following: <ide> <ide> The following packages are optional: <ide> <del>* [coreapi][coreapi] (1.31.0+) - Schema generation support. <add>* [coreapi][coreapi] (1.32.0+) - Schema generation support. <ide> * [Markdown][markdown] (2.1.0+) - Markdown support for the browsable API. <ide> * [django-filter][django-filter] (0.9.2+) - Filtering support. <ide> * [django-crispy-forms][django-crispy-forms] - Improved HTML display for filtering.
1
Java
Java
fix instacrash on login in rnfeed
5534f8b7c7ab9e5458735346444283e775eb3e1d
<ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThread.java <ide> public interface MessageQueueThread { <ide> /** <ide> * @return whether the current Thread is also the Thread associated with this MessageQueueThread. <ide> */ <add> @DoNotStrip <ide> boolean isOnThread(); <ide> <ide> /** <ide> * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an <ide> * {@link AssertionError}) if the assertion fails. <ide> */ <add> @DoNotStrip <ide> void assertIsOnThread(); <ide> <ide> /** <ide> * Quits this MessageQueueThread. If called from this MessageQueueThread, this will be the last <ide> * thing the thread runs. If called from a separate thread, this will block until the thread can <ide> * be quit and joined. <ide> */ <add> @DoNotStrip <ide> void quitSynchronous(); <ide> } <ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java <ide> public void run() { <ide> /** <ide> * @return whether the current Thread is also the Thread associated with this MessageQueueThread. <ide> */ <add> @DoNotStrip <ide> @Override <ide> public boolean isOnThread() { <ide> return mLooper.getThread() == Thread.currentThread(); <ide> public boolean isOnThread() { <ide> * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an <ide> * {@link AssertionError}) if the assertion fails. <ide> */ <add> @DoNotStrip <ide> @Override <ide> public void assertIsOnThread() { <ide> SoftAssertions.assertCondition(isOnThread(), mAssertionErrorMessage); <ide> public void assertIsOnThread() { <ide> * Quits this queue's Looper. If that Looper was running on a different Thread than the current <ide> * Thread, also waits for the last message being processed to finish and the Thread to die. <ide> */ <add> @DoNotStrip <ide> @Override <ide> public void quitSynchronous() { <ide> mIsFinished = true;
2
Javascript
Javascript
fix use of 'window' in compositioneventplugin
458836abd3e74fce7addfef3749391176cc72085
<ide><path>src/eventPlugins/CompositionEventPlugin.js <ide> <ide> var EventConstants = require('EventConstants'); <ide> var EventPropagators = require('EventPropagators'); <add>var ExecutionEnvironment = require('ExecutionEnvironment'); <ide> var ReactInputSelection = require('ReactInputSelection'); <ide> var SyntheticCompositionEvent = require('SyntheticCompositionEvent'); <ide> <ide> var keyOf = require('keyOf'); <ide> var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space <ide> var START_KEYCODE = 229; <ide> <del>var useCompositionEvent = 'CompositionEvent' in window; <add>var useCompositionEvent = ExecutionEnvironment.canUseDOM && <add> 'CompositionEvent' in window; <ide> var topLevelTypes = EventConstants.topLevelTypes; <ide> var currentComposition = null; <ide>
1
Text
Text
add a few middlewares
b024e3f66cfb8e0e582240e4e50a47c2fca5d154
<ide><path>docs/introduction/Ecosystem.md <ide> On this page we will only feature a few of them that the Redux maintainers have <ide> <ide> * [redux-thunk](http://github.com/gaearon/redux-thunk) — The easiest way to write async action creators <ide> * [redux-promise](https://github.com/acdlite/redux-promise) — [FSA](https://github.com/acdlite/flux-standard-action)-compliant promise middleware <add>* [redux-axios-middleware](https://github.com/svrcekmichal/redux-axios-middleware) — Redux middleware for fetching data with axios HTTP client <add>* [redux-observable](https://github.com/blesh/redux-observable/) — RxJS middleware for Redux <ide> * [redux-rx](https://github.com/acdlite/redux-rx) — RxJS utilities for Redux, including a middleware for Observable <ide> * [redux-logger](https://github.com/fcomb/redux-logger) — Log every Redux action and the next state <ide> * [redux-immutable-state-invariant](https://github.com/leoasis/redux-immutable-state-invariant) — Warns about state mutations in development <add>* [redux-unhandled-action](https://github.com/socialtables/redux-unhandled-action) — Warns about actions that produced no state changes in development <ide> * [redux-analytics](https://github.com/markdalgleish/redux-analytics) — Analytics middleware for Redux <ide> * [redux-gen](https://github.com/weo-edu/redux-gen) — Generator middleware for Redux <ide> * [redux-saga](https://github.com/yelouafi/redux-saga) — An alternative side effect model for Redux apps
1
Ruby
Ruby
add an asset_host accessor for consistency
ee58876fcc99cfca420033a9c30c68c326f4d1e6
<ide><path>actionpack/lib/action_controller/base.rb <ide> def self.subclasses <ide> @subclasses ||= [] <ide> end <ide> <del> # TODO Move this to the appropriate module <del> config_accessor :asset_path <add> config_accessor :asset_host, :asset_path <ide> <ide> ActiveSupport.run_load_hooks(:action_controller, self) <ide> end
1
Javascript
Javascript
use generated view config for slider
e52bc2aa73f8139ce4e7e197716aaeb110180df0
<ide><path>Libraries/Components/Slider/Slider.js <ide> 'use strict'; <ide> <ide> const Platform = require('../../Utilities/Platform'); <del>const RCTSliderNativeComponent = require('./RCTSliderNativeComponent'); <add>const SliderNativeComponent = require('./SliderNativeComponent'); <ide> const React = require('react'); <ide> const ReactNative = require('../../Renderer/shims/ReactNative'); <ide> const StyleSheet = require('../../StyleSheet/StyleSheet'); <ide> type Props = $ReadOnly<{| <ide> */ <ide> const Slider = ( <ide> props: Props, <del> forwardedRef?: ?React.Ref<typeof RCTSliderNativeComponent>, <add> forwardedRef?: ?React.Ref<typeof SliderNativeComponent>, <ide> ) => { <ide> const style = StyleSheet.compose( <ide> styles.slider, <ide> const Slider = ( <ide> : null; <ide> <ide> return ( <del> <RCTSliderNativeComponent <add> <SliderNativeComponent <ide> {...localProps} <ide> ref={forwardedRef} <ide> style={style} <add><path>Libraries/Components/Slider/SliderNativeComponent.js <del><path>Libraries/Components/Slider/RCTSliderNativeComponent.js <ide> <ide> 'use strict'; <ide> <del>const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); <del> <ide> import type { <ide> Float, <ide> BubblingEvent, <ide> type Options = { <ide> <ide> type SliderType = CodegenNativeComponent<'Slider', NativeProps, Options>; <ide> <del>module.exports = ((requireNativeComponent('RCTSlider'): any): SliderType); <add>module.exports = ((require('SliderNativeViewConfig'): any): SliderType); <ide><path>Libraries/Components/Slider/SliderNativeViewConfig.js <add> <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow <add> */ <add> <add>'use strict'; <add> <add>const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); <add>const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); <add>const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); <add> <add>const SliderViewConfig = { <add> uiViewClassName: 'RCTSlider', <add> Commands: {}, <add> <add> bubblingEventTypes: { <add> ...ReactNativeViewViewConfig.bubblingEventTypes, <add> <add> topChange: { <add> phasedRegistrationNames: { <add> captured: 'onChangeCapture', <add> bubbled: 'onChange', <add> }, <add> }, <add> <add> topValueChange: { <add> phasedRegistrationNames: { <add> captured: 'onValueChangeCapture', <add> bubbled: 'onValueChange', <add> }, <add> }, <add> }, <add> <add> directEventTypes: { <add> ...ReactNativeViewViewConfig.directEventTypes, <add> <add> topSlidingComplete: { <add> registrationName: 'onSlidingComplete', <add> }, <add> }, <add> <add> validAttributes: { <add> ...ReactNativeViewViewConfig.validAttributes, <add> disabled: true, <add> enabled: true, <add> maximumTrackImage: { process: require('resolveAssetSource') }, <add> maximumTrackTintColor: { process: require('processColor') }, <add> maximumValue: true, <add> minimumTrackImage: { process: require('resolveAssetSource') }, <add> minimumTrackTintColor: { process: require('processColor') }, <add> minimumValue: true, <add> step: true, <add> testID: true, <add> thumbImage: { process: require('resolveAssetSource') }, <add> thumbTintColor: { process: require('processColor') }, <add> trackImage: { process: require('resolveAssetSource') }, <add> value: true, <add> onChange: true, <add> onValueChange: true, <add> onSlidingComplete: true, <add> }, <add>}; <add> <add>verifyComponentAttributeEquivalence('RCTSlider', SliderViewConfig); <add> <add>ReactNativeViewConfigRegistry.register( <add> 'RCTSlider', <add> () => SliderViewConfig, <add>); <add> <add>module.exports = 'RCTSlider'; // RCT prefix present for paper support <ide><path>Libraries/Components/Slider/SliderSchema.js <ide> const SliderSchema: SchemaType = { <ide> components: { <ide> Slider: { <ide> interfaceOnly: true, <add> isDeprecatedPaperComponentNameRCT: true, <ide> extendsProps: [ <ide> { <ide> type: 'ReactNativeBuiltInType', <ide><path>packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs-cli.js <ide> const yargv = yargs.strict().option('t', { <ide> const argv = yargv.argv; <ide> const fileList = argv._[0].split('\n'); <ide> <del>const CURRENT_VIEW_CONFIG_FILES = []; <add>const CURRENT_VIEW_CONFIG_FILES = ['SliderNativeComponent.js']; <ide> <ide> generate( <ide> fileList.filter(fileName =>
5
Text
Text
add example of event to data values
41eb16a6506ce1caa699ee5ca6e1d85f01c27b63
<ide><path>docs/docs/general/interactions/events.md <ide> var chart = new Chart(ctx, { <ide> } <ide> }); <ide> ``` <add> <add>## Converting Events to Data Values <add> <add>A common occurrence is taking an event, such as a click, and finding the data coordinates on the chart where the event occurred. Chart.js provides helpers that make this a straightforward process. <add> <add>```javascript <add>const chart = new Chart(ctx, { <add> type: 'line', <add> data: data, <add> options: { <add> onClick: (e) => { <add> const canvasPosition = Chart.helpers.getRelativePosition(e); <add> <add> // Substitute the appropriate scale IDs <add> const dataX = chart.scales.x.getValueForPixel(canvasPosition.x); <add> const dataY = chart.scales.y.getValueForPixel(canvasPosition.y); <add> } <add> } <add>}); <add>``` <ide>\ No newline at end of file
1
Javascript
Javascript
remove tostring call
e5c0dd1695062f463b86313cb35d051a0af1a168
<ide><path>src/dom-element-pool.js <ide> class DOMElementPool { <ide> if (!this.managedElements.has(element)) return <ide> if (this.freedElements.has(element)) { <ide> atom.assert(false, 'The element has already been freed!', { <del> content: element instanceof window.Text ? element.textContent : element.outerHTML.toString() <add> content: element instanceof window.Text ? element.textContent : element.outerHTML <ide> }) <ide> return <ide> }
1
Text
Text
fix remaining inaccuracies in api docs (closes )
d0b3af9222809b858ca0fa4e23a85c8f3d357eae
<ide><path>website/docs/api/dependencyparser.md <ide> shortcut for this and instantiate the component using its string name and <ide> ## DependencyParser.\_\_call\_\_ {#call tag="method"} <ide> <ide> Apply the pipe to one document. The document is modified in place, and returned. <del>This usually happens under the hood when you call the `nlp` object on a text and <del>all pipeline components are applied to the `Doc` in order. Both <add>This usually happens under the hood when the `nlp` object is called on a text <add>and all pipeline components are applied to the `Doc` in order. Both <ide> [`__call__`](/api/dependencyparser#call) and <ide> [`pipe`](/api/dependencyparser#pipe) delegate to the <ide> [`predict`](/api/dependencyparser#predict) and <ide> all pipeline components are applied to the `Doc` in order. Both <ide> <ide> ## DependencyParser.pipe {#pipe tag="method"} <ide> <del>Apply the pipe to a stream of documents. Both <del>[`__call__`](/api/dependencyparser#call) and <add>Apply the pipe to a stream of documents. This usually happens under the hood <add>when the `nlp` object is called on a text and all pipeline components are <add>applied to the `Doc` in order. Both [`__call__`](/api/dependencyparser#call) and <ide> [`pipe`](/api/dependencyparser#pipe) delegate to the <ide> [`predict`](/api/dependencyparser#predict) and <ide> [`set_annotations`](/api/dependencyparser#set_annotations) methods. <ide> <ide> > #### Example <ide> > <ide> > ```python <del>> texts = [u"One doc", u"...", u"Lots of docs"] <ide> > parser = DependencyParser(nlp.vocab) <del>> for doc in parser.pipe(texts, batch_size=50): <add>> for doc in parser.pipe(docs, batch_size=50): <ide> > pass <ide> > ``` <ide> <ide> Apply the pipeline's model to a batch of docs, without modifying them. <ide> > scores = parser.predict([doc1, doc2]) <ide> > ``` <ide> <del>| Name | Type | Description | <del>| ----------- | -------- | ------------------------- | <del>| `docs` | iterable | The documents to predict. | <del>| **RETURNS** | - | Scores from the model. | <add>| Name | Type | Description | <add>| ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `docs` | iterable | The documents to predict. | <add>| **RETURNS** | tuple | A `(scores, tensors)` tuple where `scores` is the model's prediction for each document and `tensors` is the token representations used to predict the scores. Each tensor is an array with one row for each token in the document. | <ide> <ide> ## DependencyParser.set_annotations {#set_annotations tag="method"} <ide> <ide><path>website/docs/api/entityrecognizer.md <ide> shortcut for this and instantiate the component using its string name and <ide> ## EntityRecognizer.\_\_call\_\_ {#call tag="method"} <ide> <ide> Apply the pipe to one document. The document is modified in place, and returned. <del>This usually happens under the hood when you call the `nlp` object on a text and <del>all pipeline components are applied to the `Doc` in order. Both <add>This usually happens under the hood when the `nlp` object is called on a text <add>and all pipeline components are applied to the `Doc` in order. Both <ide> [`__call__`](/api/entityrecognizer#call) and <ide> [`pipe`](/api/entityrecognizer#pipe) delegate to the <ide> [`predict`](/api/entityrecognizer#predict) and <ide> all pipeline components are applied to the `Doc` in order. Both <ide> <ide> ## EntityRecognizer.pipe {#pipe tag="method"} <ide> <del>Apply the pipe to a stream of documents. Both <del>[`__call__`](/api/entityrecognizer#call) and <add>Apply the pipe to a stream of documents. This usually happens under the hood <add>when the `nlp` object is called on a text and all pipeline components are <add>applied to the `Doc` in order. Both [`__call__`](/api/entityrecognizer#call) and <ide> [`pipe`](/api/entityrecognizer#pipe) delegate to the <ide> [`predict`](/api/entityrecognizer#predict) and <ide> [`set_annotations`](/api/entityrecognizer#set_annotations) methods. <ide> <ide> > #### Example <ide> > <ide> > ```python <del>> texts = [u"One doc", u"...", u"Lots of docs"] <ide> > ner = EntityRecognizer(nlp.vocab) <del>> for doc in ner.pipe(texts, batch_size=50): <add>> for doc in ner.pipe(docs, batch_size=50): <ide> > pass <ide> > ``` <ide> <ide> Apply the pipeline's model to a batch of docs, without modifying them. <ide> > scores = ner.predict([doc1, doc2]) <ide> > ``` <ide> <del>| Name | Type | Description | <del>| ----------- | -------- | ------------------------- | <del>| `docs` | iterable | The documents to predict. | <del>| **RETURNS** | - | Scores from the model. | <add>| Name | Type | Description | <add>| ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `docs` | iterable | The documents to predict. | <add>| **RETURNS** | tuple | A `(scores, tensors)` tuple where `scores` is the model's prediction for each document and `tensors` is the token representations used to predict the scores. Each tensor is an array with one row for each token in the document. | <ide> <ide> ## EntityRecognizer.set_annotations {#set_annotations tag="method"} <ide> <ide><path>website/docs/api/goldparse.md <ide> source: spacy/gold.pyx <ide> <ide> ## GoldParse.\_\_init\_\_ {#init tag="method"} <ide> <del>Create a `GoldParse`. <del> <del>| Name | Type | Description | <del>| ----------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | <del>| `doc` | `Doc` | The document the annotations refer to. | <del>| `words` | iterable | A sequence of unicode word strings. | <del>| `tags` | iterable | A sequence of strings, representing tag annotations. | <del>| `heads` | iterable | A sequence of integers, representing syntactic head offsets. | <del>| `deps` | iterable | A sequence of strings, representing the syntactic relation types. | <del>| `entities` | iterable | A sequence of named entity annotations, either as BILUO tag strings, or as `(start_char, end_char, label)` tuples, representing the entity positions. | <del>| **RETURNS** | `GoldParse` | The newly constructed object. | <add>Create a `GoldParse`. Unlike annotations in `entities`, label annotations in <add>`cats` can overlap, i.e. a single word can be covered by multiple labelled <add>spans. The [`TextCategorizer`](/api/textcategorizer) component expects true <add>examples of a label to have the value `1.0`, and negative examples of a label to <add>have the value `0.0`. Labels not in the dictionary are treated as missing – the <add>gradient for those labels will be zero. <add> <add>| Name | Type | Description | <add>| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `doc` | `Doc` | The document the annotations refer to. | <add>| `words` | iterable | A sequence of unicode word strings. | <add>| `tags` | iterable | A sequence of strings, representing tag annotations. | <add>| `heads` | iterable | A sequence of integers, representing syntactic head offsets. | <add>| `deps` | iterable | A sequence of strings, representing the syntactic relation types. | <add>| `entities` | iterable | A sequence of named entity annotations, either as BILUO tag strings, or as `(start_char, end_char, label)` tuples, representing the entity positions. | <add>| `cats` | dict | Labels for text classification. Each key in the dictionary may be a string or an int, or a `(start_char, end_char, label)` tuple, indicating that the label is applied to only part of the document (usually a sentence). | <add>| **RETURNS** | `GoldParse` | The newly constructed object. | <ide> <ide> ## GoldParse.\_\_len\_\_ {#len tag="method"} <ide> <ide> Whether the provided syntactic annotations form a projective dependency tree. <ide> ### gold.biluo_tags_from_offsets {#biluo_tags_from_offsets tag="function"} <ide> <ide> Encode labelled spans into per-token tags, using the <del>[BILUO scheme](/api/annotation#biluo) (Begin/In/Last/Unit/Out). <del> <del>Returns a list of unicode strings, describing the tags. Each tag string will be <del>of the form of either `""`, `"O"` or `"{action}-{label}"`, where action is one <del>of `"B"`, `"I"`, `"L"`, `"U"`. The string `"-"` is used where the entity offsets <add>[BILUO scheme](/api/annotation#biluo) (Begin, In, Last, Unit, Out). Returns a <add>list of unicode strings, describing the tags. Each tag string will be of the <add>form of either `""`, `"O"` or `"{action}-{label}"`, where action is one of <add>`"B"`, `"I"`, `"L"`, `"U"`. The string `"-"` is used where the entity offsets <ide> don't align with the tokenization in the `Doc` object. The training algorithm <ide> will view these as missing values. `O` denotes a non-entity token. `B` denotes <ide> the beginning of a multi-token entity, `I` the inside of an entity of three or <ide><path>website/docs/api/tagger.md <ide> shortcut for this and instantiate the component using its string name and <ide> ## Tagger.\_\_call\_\_ {#call tag="method"} <ide> <ide> Apply the pipe to one document. The document is modified in place, and returned. <del>This usually happens under the hood when you call the `nlp` object on a text and <del>all pipeline components are applied to the `Doc` in order. Both <add>This usually happens under the hood when the `nlp` object is called on a text <add>and all pipeline components are applied to the `Doc` in order. Both <ide> [`__call__`](/api/tagger#call) and [`pipe`](/api/tagger#pipe) delegate to the <ide> [`predict`](/api/tagger#predict) and <ide> [`set_annotations`](/api/tagger#set_annotations) methods. <ide> all pipeline components are applied to the `Doc` in order. Both <ide> <ide> ## Tagger.pipe {#pipe tag="method"} <ide> <del>Apply the pipe to a stream of documents. Both [`__call__`](/api/tagger#call) and <add>Apply the pipe to a stream of documents. This usually happens under the hood <add>when the `nlp` object is called on a text and all pipeline components are <add>applied to the `Doc` in order. Both [`__call__`](/api/tagger#call) and <ide> [`pipe`](/api/tagger#pipe) delegate to the [`predict`](/api/tagger#predict) and <ide> [`set_annotations`](/api/tagger#set_annotations) methods. <ide> <ide> > #### Example <ide> > <ide> > ```python <del>> texts = [u"One doc", u"...", u"Lots of docs"] <ide> > tagger = Tagger(nlp.vocab) <del>> for doc in tagger.pipe(texts, batch_size=50): <add>> for doc in tagger.pipe(docs, batch_size=50): <ide> > pass <ide> > ``` <ide> <ide> Apply the pipeline's model to a batch of docs, without modifying them. <ide> > scores = tagger.predict([doc1, doc2]) <ide> > ``` <ide> <del>| Name | Type | Description | <del>| ----------- | -------- | ------------------------- | <del>| `docs` | iterable | The documents to predict. | <del>| **RETURNS** | - | Scores from the model. | <add>| Name | Type | Description | <add>| ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `docs` | iterable | The documents to predict. | <add>| **RETURNS** | tuple | A `(scores, tensors)` tuple where `scores` is the model's prediction for each document and `tensors` is the token representations used to predict the scores. Each tensor is an array with one row for each token in the document. | <ide> <ide> ## Tagger.set_annotations {#set_annotations tag="method"} <ide> <ide><path>website/docs/api/textcategorizer.md <ide> argument. <ide> ## TextCategorizer.\_\_call\_\_ {#call tag="method"} <ide> <ide> Apply the pipe to one document. The document is modified in place, and returned. <del>This usually happens under the hood when you call the `nlp` object on a text and <del>all pipeline components are applied to the `Doc` in order. Both <add>This usually happens under the hood when the `nlp` object is called on a text <add>and all pipeline components are applied to the `Doc` in order. Both <ide> [`__call__`](/api/textcategorizer#call) and [`pipe`](/api/textcategorizer#pipe) <ide> delegate to the [`predict`](/api/textcategorizer#predict) and <ide> [`set_annotations`](/api/textcategorizer#set_annotations) methods. <ide> delegate to the [`predict`](/api/textcategorizer#predict) and <ide> <ide> ## TextCategorizer.pipe {#pipe tag="method"} <ide> <del>Apply the pipe to a stream of documents. Both <del>[`__call__`](/api/textcategorizer#call) and [`pipe`](/api/textcategorizer#pipe) <del>delegate to the [`predict`](/api/textcategorizer#predict) and <add>Apply the pipe to a stream of documents. This usually happens under the hood <add>when the `nlp` object is called on a text and all pipeline components are <add>applied to the `Doc` in order. Both [`__call__`](/api/textcategorizer#call) and <add>[`pipe`](/api/textcategorizer#pipe) delegate to the <add>[`predict`](/api/textcategorizer#predict) and <ide> [`set_annotations`](/api/textcategorizer#set_annotations) methods. <ide> <ide> > #### Example <ide> > <ide> > ```python <del>> texts = [u"One doc", u"...", u"Lots of docs"] <ide> > textcat = TextCategorizer(nlp.vocab) <del>> for doc in textcat.pipe(texts, batch_size=50): <add>> for doc in textcat.pipe(docs, batch_size=50): <ide> > pass <ide> > ``` <ide> <ide> Apply the pipeline's model to a batch of docs, without modifying them. <ide> > scores = textcat.predict([doc1, doc2]) <ide> > ``` <ide> <del>| Name | Type | Description | <del>| ----------- | -------- | ------------------------- | <del>| `docs` | iterable | The documents to predict. | <del>| **RETURNS** | - | Scores from the model. | <add>| Name | Type | Description | <add>| ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | <add>| `docs` | iterable | The documents to predict. | <add>| **RETURNS** | tuple | A `(scores, tensors)` tuple where `scores` is the model's prediction for each document and `tensors` is the token representations used to predict the scores. Each tensor is an array with one row for each token in the document. | <ide> <ide> ## TextCategorizer.set_annotations {#set_annotations tag="method"} <ide>
5
Ruby
Ruby
remove extra colon
60b70c993127c79f0cc7532ce159902d39f1aa5d
<ide><path>Library/Homebrew/download_strategy.rb <ide> def fetch <ide> unless cached_location.exist? <ide> urls = actual_urls <ide> unless urls.empty? <del> ohai "Downloading from: #{urls.last}" <add> ohai "Downloading from #{urls.last}" <ide> if !ENV["HOMEBREW_NO_INSECURE_REDIRECT"].nil? && @url.start_with?("https://") && <ide> urls.any? { |u| !u.start_with? "https://" } <ide> raise "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set."
1
Java
Java
refine blockhound support
2f12351292564fb2090707ee117620e2a51be640
<ide><path>spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java <ide> <ide> import org.junit.jupiter.api.BeforeAll; <ide> import org.junit.jupiter.api.Test; <add>import org.junit.jupiter.api.condition.DisabledForJreRange; <ide> import reactor.blockhound.BlockHound; <add>import reactor.core.scheduler.ReactorBlockHoundIntegration; <ide> import reactor.core.scheduler.Schedulers; <ide> <ide> import org.springframework.tests.sample.objects.TestObject; <ide> import org.springframework.util.ConcurrentReferenceHashMap; <ide> <ide> import static org.assertj.core.api.Assertions.assertThat; <ide> import static org.assertj.core.api.Assertions.assertThatThrownBy; <add>import static org.junit.jupiter.api.condition.JRE.JAVA_14; <ide> <ide> /** <ide> * Tests to verify the spring-core BlockHound integration rules. <ide> * <ide> * @author Rossen Stoyanchev <ide> * @since 5.2.4 <ide> */ <add>@DisabledForJreRange(min = JAVA_14) <ide> public class SpringCoreBlockHoundIntegrationTests { <ide> <ide> <ide> @BeforeAll <ide> static void setUp() { <del> BlockHound.install(); <add> BlockHound.builder() <add> .with(new ReactorBlockHoundIntegration()) // Reactor non-blocking thread predicate <add> .with(new ReactiveAdapterRegistry.SpringCoreBlockHoundIntegration()) <add> .install(); <ide> } <ide> <ide>
1
Ruby
Ruby
improve standardization of strategy tests
7e07010f06a594f72cbf12a5cae889eaa15c4373
<ide><path>Library/Homebrew/test/livecheck/strategy/apache_spec.rb <ide> let(:non_apache_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is an Apache URL" do <add> it "returns true for an Apache URL" do <ide> expect(apache.match?(apache_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not an Apache URL" do <add> it "returns false for a non-Apache URL" do <ide> expect(apache.match?(non_apache_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/bitbucket_spec.rb <ide> let(:non_bitbucket_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is a Bitbucket URL" do <add> it "returns true for a Bitbucket URL" do <ide> expect(bitbucket.match?(bitbucket_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not a Bitbucket URL" do <add> it "returns false for a non-Bitbucket URL" do <ide> expect(bitbucket.match?(non_bitbucket_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/cpan_spec.rb <ide> let(:non_cpan_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is a CPAN URL" do <add> it "returns true for a CPAN URL" do <ide> expect(cpan.match?(cpan_url_no_subdirectory)).to be true <ide> expect(cpan.match?(cpan_url_with_subdirectory)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not a CPAN URL" do <add> it "returns false for a non-CPAN URL" do <ide> expect(cpan.match?(non_cpan_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/electron_builder_spec.rb <ide> describe Homebrew::Livecheck::Strategy::ElectronBuilder do <ide> subject(:electron_builder) { described_class } <ide> <del> let(:valid_url) { "https://www.example.com/example/latest-mac.yml" } <del> let(:invalid_url) { "https://brew.sh/test" } <add> let(:yaml_url) { "https://www.example.com/example/latest-mac.yml" } <add> let(:non_yaml_url) { "https://brew.sh/test" } <ide> <ide> let(:electron_builder_yaml) { <ide> <<~EOS <ide> let(:versions) { ["1.2.3"] } <ide> <ide> describe "::match?" do <del> it "returns true for any URL pointing to a YAML file" do <del> expect(electron_builder.match?(valid_url)).to be true <add> it "returns true for a YAML file URL" do <add> expect(electron_builder.match?(yaml_url)).to be true <ide> end <ide> <del> it "returns false for a URL not pointing to a YAML file" do <del> expect(electron_builder.match?(invalid_url)).to be false <add> it "returns false for non-YAML URL" do <add> expect(electron_builder.match?(non_yaml_url)).to be false <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/livecheck/strategy/git_spec.rb <ide> end <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is a Git repository" do <add> it "returns true for a Git repository URL" do <ide> expect(git.match?(git_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not a Git repository" do <add> it "returns false for a non-Git URL" do <ide> expect(git.match?(non_git_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/github_latest_spec.rb <ide> let(:non_github_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is a GitHub release artifact URL" do <add> it "returns true for a GitHub release artifact URL" do <ide> expect(github_latest.match?(github_release_artifact_url)).to be true <ide> end <ide> <del> it "returns true if the argument provided is a GitHub tag archive URL" do <add> it "returns true for a GitHub tag archive URL" do <ide> expect(github_latest.match?(github_tag_archive_url)).to be true <ide> end <ide> <del> it "returns true if the argument provided is a GitHub repository upload URL" do <add> it "returns true for a GitHub repository upload URL" do <ide> expect(github_latest.match?(github_repository_upload_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not a GitHub URL" do <add> it "returns false for a non-GitHub URL" do <ide> expect(github_latest.match?(non_github_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/gnome_spec.rb <ide> let(:non_gnome_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is a GNOME URL" do <add> it "returns true for a GNOME URL" do <ide> expect(gnome.match?(gnome_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not a GNOME URL" do <add> it "returns false for a non-GNOME URL" do <ide> expect(gnome.match?(non_gnome_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/gnu_spec.rb <ide> let(:non_gnu_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is a non-Savannah GNU URL" do <add> it "returns true for a [non-Savannah] GNU URL" do <ide> expect(gnu.match?(gnu_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is a Savannah GNU URL" do <add> it "returns false for a Savannah GNU URL" do <ide> expect(gnu.match?(savannah_gnu_url)).to be false <ide> end <ide> <del> it "returns false if the argument provided is not a GNU URL" do <add> it "returns false for a non-GNU URL (not nongnu.org)" do <ide> expect(gnu.match?(non_gnu_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/hackage_spec.rb <ide> let(:non_hackage_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is a Hackage URL" do <add> it "returns true for a Hackage URL" do <ide> expect(hackage.match?(hackage_url)).to be true <ide> expect(hackage.match?(hackage_downloads_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not a Hackage URL" do <add> it "returns false for a non-Hackage URL" do <ide> expect(hackage.match?(non_hackage_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/header_match_spec.rb <ide> describe Homebrew::Livecheck::Strategy::HeaderMatch do <ide> subject(:header_match) { described_class } <ide> <del> let(:url) { "https://www.example.com/" } <add> let(:http_url) { "https://brew.sh/blog/" } <add> let(:non_http_url) { "ftp://brew.sh/" } <ide> <ide> let(:versions) { <ide> versions = { <ide> } <ide> <ide> describe "::match?" do <del> it "returns true for any URL" do <del> expect(header_match.match?(url)).to be true <add> it "returns true for an HTTP URL" do <add> expect(header_match.match?(http_url)).to be true <add> end <add> <add> it "returns false for a non-HTTP URL" do <add> expect(header_match.match?(non_http_url)).to be false <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/livecheck/strategy/launchpad_spec.rb <ide> let(:non_launchpad_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is a Launchpad URL" do <add> it "returns true for a Launchpad URL" do <ide> expect(launchpad.match?(launchpad_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not a Launchpad URL" do <add> it "returns false for a non-Launchpad URL" do <ide> expect(launchpad.match?(non_launchpad_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/npm_spec.rb <ide> let(:non_npm_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is an npm URL" do <add> it "returns true for an npm URL" do <ide> expect(npm.match?(npm_url)).to be true <ide> expect(npm.match?(npm_scoped_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not an npm URL" do <add> it "returns false for a non-npm URL" do <ide> expect(npm.match?(non_npm_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/page_match_spec.rb <ide> describe Homebrew::Livecheck::Strategy::PageMatch do <ide> subject(:page_match) { described_class } <ide> <del> let(:url) { "https://brew.sh/blog/" } <add> let(:http_url) { "https://brew.sh/blog/" } <add> let(:non_http_url) { "ftp://brew.sh/" } <add> <ide> let(:regex) { %r{href=.*?/homebrew[._-]v?(\d+(?:\.\d+)+)/?["' >]}i } <ide> <ide> let(:content) { <ide> "1.9.0" => Version.new("1.9.0"), <ide> }, <ide> regex: regex, <del> url: url, <add> url: http_url, <ide> } <ide> } <ide> <ide> } <ide> <ide> describe "::match?" do <del> it "returns true for any URL" do <del> expect(page_match.match?(url)).to be true <add> it "returns true for an HTTP URL" do <add> expect(page_match.match?(http_url)).to be true <add> end <add> <add> it "returns false for a non-HTTP URL" do <add> expect(page_match.match?(non_http_url)).to be false <ide> end <ide> end <ide> <ide> <ide> describe "::find_versions?" do <ide> it "finds versions in provided_content" do <del> expect(page_match.find_versions(url, regex, provided_content: content)) <add> expect(page_match.find_versions(http_url, regex, provided_content: content)) <ide> .to eq(find_versions_cached_return_hash) <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/pypi_spec.rb <ide> let(:non_pypi_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is a PyPI URL" do <add> it "returns true for a PyPI URL" do <ide> expect(pypi.match?(pypi_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not a PyPI URL" do <add> it "returns false for a non-PyPI URL" do <ide> expect(pypi.match?(non_pypi_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/sourceforge_spec.rb <ide> let(:non_sourceforge_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is a SourceForge URL" do <add> it "returns true for a SourceForge URL" do <ide> expect(sourceforge.match?(sourceforge_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not a SourceForge URL" do <add> it "returns false for a non-SourceForge URL" do <ide> expect(sourceforge.match?(non_sourceforge_url)).to be false <ide> end <ide> end <ide><path>Library/Homebrew/test/livecheck/strategy/sparkle_spec.rb <ide> describe Homebrew::Livecheck::Strategy::Sparkle do <ide> subject(:sparkle) { described_class } <ide> <del> let(:url) { "https://www.example.com/example/appcast.xml" } <add> let(:appcast_url) { "https://www.example.com/example/appcast.xml" } <add> let(:non_http_url) { "ftp://brew.sh/" } <ide> <ide> let(:appcast_data) { <ide> { <ide> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"> <ide> <channel> <ide> <title>Example Changelog</title> <del> <link>#{url}</link> <add> <link>#{appcast_url}</link> <ide> <description>Most recent changes with links to updates.</description> <ide> <language>en</language> <ide> <item> <ide> let(:versions) { [item.bundle_version.nice_version] } <ide> <ide> describe "::match?" do <del> it "returns true for any URL" do <del> expect(sparkle.match?(url)).to be true <add> it "returns true for an HTTP URL" do <add> expect(sparkle.match?(appcast_url)).to be true <add> end <add> <add> it "returns false for a non-HTTP URL" do <add> expect(sparkle.match?(non_http_url)).to be false <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/livecheck/strategy/xorg_spec.rb <ide> let(:non_xorg_url) { "https://brew.sh/test" } <ide> <ide> describe "::match?" do <del> it "returns true if the argument provided is an X.Org URL" do <add> it "returns true for an X.Org URL" do <ide> expect(xorg.match?(xorg_url)).to be true <ide> end <ide> <del> it "returns false if the argument provided is not an X.Org URL" do <add> it "returns false for a non-X.Org URL" do <ide> expect(xorg.match?(non_xorg_url)).to be false <ide> end <ide> end
17
Python
Python
update bucket_sort.py (#821)
f5abc04176b9635da963ca701f643acde5da24dc
<ide><path>sorts/bucket_sort.py <ide> # Time Complexity of Solution: <ide> # Best Case O(n); Average Case O(n); Worst Case O(n) <ide> <del>from __future__ import print_function <del>from insertion_sort import insertion_sort <del>import math <del> <del>DEFAULT_BUCKET_SIZE = 5 <del> <del>def bucketSort(myList, bucketSize=DEFAULT_BUCKET_SIZE): <del> if(len(myList) == 0): <del> print('You don\'t have any elements in array!') <del> <del> minValue = myList[0] <del> maxValue = myList[0] <del> <del> # For finding minimum and maximum values <del> for i in range(0, len(myList)): <del> if myList[i] < minValue: <del> minValue = myList[i] <del> elif myList[i] > maxValue: <del> maxValue = myList[i] <del> <del> # Initialize buckets <del> bucketCount = math.floor((maxValue - minValue) / bucketSize) + 1 <del> buckets = [] <del> for i in range(0, bucketCount): <add>DEFAULT_BUCKET_SIZE=5 <add>def bucket_sort(my_list,bucket_size=DEFAULT_BUCKET_SIZE): <add> if(my_list==0): <add> print("you don't have any elements in array!") <add> <add> <add> min_value=min(my_list) <add> max_value=max(my_list) <add> <add> bucket_count=(max_value-min_value)//bucket_size+1 <add> buckets=[] <add> for i in range(bucket_count): <ide> buckets.append([]) <add> for i in range(len(my_list)): <add> buckets[(my_list[i]-min_value)//bucket_size].append(my_list[i]) <add> <add> <add> sorted_array=[] <add> for i in range(len(buckets)): <add> buckets[i].sort() <add> for j in range(len(buckets[i])): <add> sorted_array.append(buckets[i][j]) <add> return sorted_array <ide> <del> # For putting values in buckets <del> for i in range(0, len(myList)): <del> buckets[math.floor((myList[i] - minValue) / bucketSize)].append(myList[i]) <ide> <del> # Sort buckets and place back into input array <del> sortedArray = [] <del> for i in range(0, len(buckets)): <del> insertion_sort(buckets[i]) <del> for j in range(0, len(buckets[i])): <del> sortedArray.append(buckets[i][j]) <ide> <del> return sortedArray <ide> <del>if __name__ == '__main__': <del> sortedArray = bucketSort([12, 23, 4, 5, 3, 2, 12, 81, 56, 95]) <del> print(sortedArray) <add>#test <add>#besd on python 3.7.3 <add>user_input =input('Enter numbers separated by a comma:').strip() <add>unsorted =[int(item) for item in user_input.split(',')] <add>print(bucket_sort(unsorted))
1
PHP
PHP
add missing annotation
bf89a65c8de9cd928e32b41785cdcb182579ac82
<ide><path>src/Database/SqlDialectTrait.php <ide> public function queryTranslator($type) <ide> $query = (new IdentifierQuoter($this))->quote($query); <ide> } <ide> <add> /** @var \Cake\ORM\Query $query */ <ide> $query = $this->{'_' . $type . 'QueryTranslator'}($query); <ide> $translators = $this->_expressionTranslators(); <ide> if (!$translators) {
1
Javascript
Javascript
update the map reference in each minified file
df372ad6e7f44d879a9d3e8b9e0a27f6d8c176b5
<ide><path>build/release.js <ide> function makeReleaseCopies( next ) { <ide> Object.keys( releaseFiles ).forEach(function( key ) { <ide> var text, <ide> builtFile = releaseFiles[ key ], <del> releaseFile = key.replace( /VER/g, releaseVersion ); <add> releaseFile = "dist/" + key.replace( /VER/g, releaseVersion ); <ide> <ide> // Beta releases don't update the jquery-latest etc. copies <del> if ( !isBeta || key !== releaseFile ) { <add> if ( !isBeta || key.indexOf( "VER" ) >= 0 ) { <ide> <ide> if ( /\.map$/.test( releaseFile ) ) { <ide> // Map files need to reference the new uncompressed name; <ide> function makeReleaseCopies( next ) { <ide> .replace( /"file":"([^"]+)","sources":\["([^"]+)"\]/, <ide> "\"file\":\"" + releaseFile.replace( /\.min\.map/, ".min.js" ) + <ide> "\",\"sources\":[\"" + releaseFile.replace( /\.min\.map/, ".js" ) + "\"]" ); <del> console.log( "Modifying map " + builtFile + " to " + releaseFile ); <del> fs.writeFileSync( "dist/" + releaseFile, text ); <del> } else { <del> copy( builtFile, "dist/" + releaseFile ); <add> fs.writeFileSync( releaseFile, text ); <add> } else if ( /\.min\.js$/.test( releaseFile ) ) { <add> // Minified files point back to the corresponding map; <add> // again assume one big happy directory. <add> // "//@ sourceMappingURL=jquery.min.map" <add> text = fs.readFileSync( builtFile, "utf8" ) <add> .replace( /\/\/@ sourceMappingURL=\S+/, <add> "//@ sourceMappingURL=" + releaseFile.replace( /\.js$/, ".map" ) ); <add> fs.writeFileSync( releaseFile, text ); <add> } else if ( builtFile !== releaseFile ) { <add> copy( builtFile, releaseFile ); <ide> } <ide> <ide> jQueryFilesCDN.push( releaseFile );
1
Python
Python
remove commented lines
d1dba51326abc2b1cf8d621b0fd85c84611f4d28
<ide><path>data_structures/binary tree/AVLtree.py <ide> def test(self): <ide> print("****") <ide> self.getheight() <ide> if __name__ == "__main__": <del># t = AVLtree() <del># t.test() <del># q = my_queue() <del>## q.push(1) <del>## q.push(2) <del># for i in range(10): <del># q.push(i) <del># q.print() <del># q.push(90) <del># q.print() <del># <del># q.pop() <del># q.print() <ide> t = AVLtree() <ide> t.traversale() <del># t.insert(7) <del>## t.traversale() <del># <del># t.insert(8) <del># t.traversale() <del># t.insert(3) <del># t.traversale() <del># t.insert(6) <del># t.traversale() <del># t.insert(1) <del># t.traversale() <del># t.insert(10) <del># t.traversale() <del># t.insert(14) <del># t.traversale() <del># t.insert(13) <del># t.traversale() <del>## t.traversale() <del># t.insert(4) <del># t.traversale() <del># t.insert(7) <del># t.traversale() <del># <del># <del># t.del_node(8) <del># t.traversale() <del># t.del_node(3) <del># t.traversale() <del># t.del_node(6) <del># t.traversale() <del># t.del_node(1) <del># t.traversale() <del># t.del_node(10) <del># t.traversale() <del># t.del_node(14) <del># t.traversale() <del># t.del_node(13) <del># t.traversale() <del>## t.traversale() <del># t.del_node(4) <del># t.traversale() <del># t.del_node(7) <del># t.traversale() <ide> l = list(range(10)) <ide> random.shuffle(l) <ide> for i in l:
1
Text
Text
add docs for `--memory-swap`
7bb4b56cf98662ef5f1deb64bdf8a120490bc258
<ide><path>docs/man/docker-run.1.md <ide> docker-run - Run a command in a new container <ide> [**--link**[=*[]*]] <ide> [**--lxc-conf**[=*[]*]] <ide> [**-m**|**--memory**[=*MEMORY*]] <add>[**--memory-swap**[=*MEMORY-SWAP]] <ide> [**--mac-address**[=*MAC-ADDRESS*]] <ide> [**--name**[=*NAME*]] <ide> [**--net**[=*"bridge"*]] <ide> actual limit may be rounded up to a multiple of the operating system's page <ide> size, if it is not already. The memory limit should be formatted as follows: <ide> `<number><optional unit>`, where unit = b, k, m or g. <ide> <add>**--memory-swap**="" <add> Total memory usage (memory + swap) <add> <add> Set '-1' to disable swap (format: <number><optional unit>, where unit = b, k, m or g) <add> <ide> **--mac-address**="" <ide> Container MAC address (e.g. 92:d0:c6:0a:29:33) <ide> <ide><path>docs/sources/reference/commandline/cli.md <ide> removed before the image is removed. <ide> --link=[] Add link to another container in the form of name:alias <ide> --lxc-conf=[] (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1" <ide> -m, --memory="" Memory limit (format: <number><optional unit>, where unit = b, k, m or g) <add> -memory-swap="" Total memory usage (memory + swap), set '-1' to disable swap (format: <number><optional unit>, where unit = b, k, m or g) <ide> --mac-address="" Container MAC address (e.g. 92:d0:c6:0a:29:33) <ide> --name="" Assign a name to the container <ide> --net="bridge" Set the Network mode for the container
2
Java
Java
suspend the channel when there is no demand
d8099adc9a94e13eb7b6e261e6300e33beaa8c95
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractListenerWebSocketSession.java <ide> package org.springframework.web.reactive.socket.adapter; <ide> <ide> import java.io.IOException; <add>import java.util.Queue; <ide> import java.util.concurrent.atomic.AtomicBoolean; <ide> <ide> import org.reactivestreams.Publisher; <ide> import reactor.core.publisher.Flux; <ide> import reactor.core.publisher.Mono; <ide> import reactor.core.publisher.MonoProcessor; <add>import reactor.util.concurrent.Queues; <ide> <ide> import org.springframework.core.io.buffer.DataBufferFactory; <ide> import org.springframework.http.server.reactive.AbstractListenerReadPublisher; <ide> public Mono<Void> send(Publisher<WebSocketMessage> messages) { <ide> */ <ide> protected abstract void resumeReceiving(); <ide> <add> /** <add> * Returns {@code true} if receiving new message(s) is suspended otherwise <add> * {@code false}. <add> * <p><strong>Note:</strong> if the underlying WebSocket API does not provide <add> * flow control for receiving messages, and this method should return <add> * {@code false} and {@link #canSuspendReceiving()} should return {@code false}. <add> * @return returns {@code true} if receiving new message(s) is suspended <add> * otherwise {@code false}. <add> */ <add> protected abstract boolean isSuspended(); <add> <ide> /** <ide> * Send the given WebSocket message. <ide> */ <ide> public void onComplete() { <ide> <ide> private final class WebSocketReceivePublisher extends AbstractListenerReadPublisher<WebSocketMessage> { <ide> <del> @Nullable <del> private volatile WebSocketMessage webSocketMessage; <add> private volatile Queue<Object> pendingWebSocketMessages = Queues.unbounded().get(); <ide> <ide> @Override <ide> protected void checkOnDataAvailable() { <del> if (this.webSocketMessage != null) { <add> if (isSuspended()) { <add> resumeReceiving(); <add> } <add> if (!pendingWebSocketMessages.isEmpty()) { <ide> onDataAvailable(); <ide> } <ide> } <ide> <add> @Override <add> protected void suspendReading() { <add> suspendReceiving(); <add> } <add> <ide> @Override <ide> @Nullable <ide> protected WebSocketMessage read() throws IOException { <del> if (this.webSocketMessage != null) { <del> WebSocketMessage result = this.webSocketMessage; <del> this.webSocketMessage = null; <add> return (WebSocketMessage) pendingWebSocketMessages.poll(); <add> } <add> <add> @Override <add> public void onAllDataRead() { <add> if (isSuspended()) { <ide> resumeReceiving(); <del> return result; <ide> } <del> <del> return null; <add> super.onAllDataRead(); <ide> } <ide> <ide> void handleMessage(WebSocketMessage webSocketMessage) { <del> this.webSocketMessage = webSocketMessage; <del> suspendReceiving(); <add> this.pendingWebSocketMessages.offer(webSocketMessage); <ide> onDataAvailable(); <ide> } <ide> } <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/JettyWebSocketSession.java <ide> protected void resumeReceiving() { <ide> this.suspendToken = null; <ide> } <ide> <add> @Override <add> protected boolean isSuspended() { <add> return this.suspendToken != null; <add> } <add> <ide> @Override <ide> protected boolean sendMessage(WebSocketMessage message) throws IOException { <ide> ByteBuffer buffer = message.getPayload().asByteBuffer(); <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/StandardWebSocketSession.java <ide> protected void resumeReceiving() { <ide> // no-op <ide> } <ide> <add> @Override <add> protected boolean isSuspended() { <add> return false; <add> } <add> <ide> @Override <ide> protected boolean sendMessage(WebSocketMessage message) throws IOException { <ide> ByteBuffer buffer = message.getPayload().asByteBuffer(); <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/TomcatWebSocketSession.java <ide> <ide> package org.springframework.web.reactive.socket.adapter; <ide> <add>import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; <add> <ide> import javax.websocket.Session; <ide> <ide> import org.apache.tomcat.websocket.WsSession; <ide> * @since 5.0 <ide> */ <ide> public class TomcatWebSocketSession extends StandardWebSocketSession { <add> private static final AtomicIntegerFieldUpdater<TomcatWebSocketSession> SUSPENDED = <add> AtomicIntegerFieldUpdater.newUpdater(TomcatWebSocketSession.class, "suspended"); <add> private volatile int suspended; <ide> <ide> <ide> public TomcatWebSocketSession(Session session, HandshakeInfo info, DataBufferFactory factory) { <ide> protected boolean canSuspendReceiving() { <ide> <ide> @Override <ide> protected void suspendReceiving() { <del> ((WsSession) getDelegate()).suspend(); <add> if (SUSPENDED.compareAndSet(this, 0, 1)) { <add> ((WsSession) getDelegate()).suspend(); <add> } <ide> } <ide> <ide> @Override <ide> protected void resumeReceiving() { <del> ((WsSession) getDelegate()).resume(); <add> if (SUSPENDED.compareAndSet(this, 1, 0)) { <add> ((WsSession) getDelegate()).resume(); <add> } <add> } <add> <add> @Override <add> protected boolean isSuspended() { <add> return this.suspended == 1; <ide> } <ide> <ide> } <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/UndertowWebSocketSession.java <ide> protected boolean canSuspendReceiving() { <ide> return true; <ide> } <ide> <add> @Override <ide> protected void suspendReceiving() { <ide> getDelegate().suspendReceives(); <ide> } <ide> <add> @Override <ide> protected void resumeReceiving() { <ide> getDelegate().resumeReceives(); <ide> } <ide> <add> @Override <add> protected boolean isSuspended() { <add> return !getDelegate().isReceivesResumed(); <add> } <add> <ide> @Override <ide> protected boolean sendMessage(WebSocketMessage message) throws IOException { <ide> ByteBuffer buffer = message.getPayload().asByteBuffer();
5
Javascript
Javascript
handle edge case for boolean matcher
03c795fcd8e7f51796a32e6190d1c471ca189658
<ide><path>lib/util/compileBooleanMatcher.js <ide> const compileBooleanMatcher = map => { <ide> * @returns {function(string): string} a template function to determine the value at runtime <ide> */ <ide> const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => { <add> if (positiveItems.length === 0) return () => "false"; <add> if (negativeItems.length === 0) return () => "true"; <ide> if (positiveItems.length === 1) <ide> return value => `${toSimpleString(positiveItems[0])} == ${value}`; <ide> if (negativeItems.length === 1)
1
Ruby
Ruby
allow extracting url in sparkle strategy
b3c46ba2b931aa8d6e99eaf1733f0349f2c09a19
<ide><path>Library/Homebrew/livecheck.rb <ide> def skip? <ide> # <ide> # @param symbol [Symbol] symbol for the desired strategy <ide> # @return [Symbol, nil] <del> def strategy(symbol = nil) <add> def strategy(symbol = nil, &block) <add> @strategy_block = block if block <add> <ide> case symbol <ide> when nil <ide> @strategy <ide> def strategy(symbol = nil) <ide> end <ide> end <ide> <add> attr_reader :strategy_block <add> <ide> # Sets the `@url` instance variable to the provided argument or returns the <ide> # `@url` instance variable when no argument is provided. The argument can be <ide> # a `String` (a URL) or a supported `Symbol` corresponding to a URL in the <ide><path>Library/Homebrew/livecheck/livecheck.rb <ide> def latest_version(formula_or_cask, json: false, full_name: false, verbose: fals <ide> <ide> next if strategy.blank? <ide> <del> strategy_data = strategy.find_versions(url, livecheck_regex) <add> strategy_data = strategy.find_versions(url, livecheck_regex, &livecheck.strategy_block) <ide> match_version_map = strategy_data[:matches] <ide> regex = strategy_data[:regex] <ide> <ide><path>Library/Homebrew/livecheck/strategy/sparkle.rb <ide> # typed: false <ide> # frozen_string_literal: true <ide> <add>require "bundle_version" <ide> require_relative "page_match" <ide> <ide> module Homebrew <ide> def self.match?(url) <ide> <ide> # Checks the content at the URL for new versions. <ide> sig { params(url: String, regex: T.nilable(Regexp)).returns(T::Hash[Symbol, T.untyped]) } <del> def self.find_versions(url, regex) <add> def self.find_versions(url, regex, &block) <ide> raise ArgumentError, "The #{NICE_NAME} strategy does not support regular expressions." if regex <ide> <ide> require "nokogiri" <ide> def self.find_versions(url, regex) <ide> xml = Nokogiri.parse(contents) <ide> xml.remove_namespaces! <ide> <del> match = xml.xpath("//rss//channel//item//enclosure") <del> .map { |enclosure| [*enclosure["shortVersionString"], *enclosure["version"]].uniq } <del> .reject(&:empty?) <del> .uniq <del> .max_by { |versions| versions.map { |v| Version.new(v) } } <del> &.join(",") <add> enclosure = <add> xml.xpath("//rss//channel//item//enclosure") <add> .map { |e| { url: e["url"], version: BundleVersion.new(e["shortVersionString"], e["version"]) } } <add> .max_by { |e| e[:version] } <ide> <del> match_data[:matches][match] = Version.new(match) if match <add> if enclosure <add> match = if block <add> enclosure[:version] = Cask::DSL::Version.new(enclosure[:version].nice_version) <add> block.call(enclosure).to_s <add> else <add> enclosure[:version].nice_version <add> end <add> <add> match_data[:matches][match] = Version.new(match) <add> end <ide> <ide> match_data <ide> end
3
Javascript
Javascript
remove undefined variable
449f73e05fdb17b76a11f6e122cadf80fdbdf9ba
<ide><path>lib/internal/quic/core.js <ide> class QuicClientSession extends QuicSession { <ide> <ide> // If handle is a number, creating the session failed. <ide> if (typeof handle === 'number') { <del> let reason; <ide> switch (handle) { <ide> case ERR_FAILED_TO_CREATE_SESSION: <ide> throw new ERR_QUIC_FAILED_TO_CREATE_SESSION(); <ide> class QuicClientSession extends QuicSession { <ide> case ERR_INVALID_TLS_SESSION_TICKET: <ide> throw new ERR_QUIC_INVALID_TLS_SESSION_TICKET(); <ide> default: <del> throw new ERR_OPERATION_FAILED(`Unspecified reason [${reason}]`); <add> throw new ERR_OPERATION_FAILED(`Unspecified reason [${handle}]`); <ide> } <ide> } <ide>
1
Python
Python
improve exceptions for 'd (would/had) in english
440b81bddc24669ffe89ef7501fb8c75f98b60d2
<ide><path>spacy/lang/en/tokenizer_exceptions.py <ide> <ide> _exc[orth + "'d"] = [ <ide> {ORTH: orth, LEMMA: PRON_LEMMA, NORM: pron, TAG: "PRP"}, <del> {ORTH: "'d", LEMMA: "would", NORM: "would", TAG: "MD"}, <add> {ORTH: "'d", NORM: "'d"}, <ide> ] <ide> <ide> _exc[orth + "d"] = [ <ide> {ORTH: orth, LEMMA: PRON_LEMMA, NORM: pron, TAG: "PRP"}, <del> {ORTH: "d", LEMMA: "would", NORM: "would", TAG: "MD"}, <add> {ORTH: "d", NORM: "'d"}, <ide> ] <ide> <ide> _exc[orth + "'d've"] = [ <ide> {ORTH: "'d", NORM: "'d"}, <ide> ] <ide> <del> _exc[orth + "d"] = [{ORTH: orth, LEMMA: word, NORM: word}, {ORTH: "d"}] <add> _exc[orth + "d"] = [ <add> {ORTH: orth, LEMMA: word, NORM: word}, <add> {ORTH: "d", NORM: "'d"} <add> ] <ide> <ide> _exc[orth + "'d've"] = [ <ide> {ORTH: orth, LEMMA: word, NORM: word},
1
Java
Java
use resolvabletype in generictyperesolver
595efe9aab884bab233c61278f00ef325446d268
<ide><path>spring-core/src/main/java/org/springframework/core/GenericTypeResolver.java <ide> <ide> package org.springframework.core; <ide> <del>import java.lang.reflect.Array; <del>import java.lang.reflect.GenericArrayType; <del>import java.lang.reflect.MalformedParameterizedTypeException; <ide> import java.lang.reflect.Method; <ide> import java.lang.reflect.ParameterizedType; <ide> import java.lang.reflect.Type; <ide> import java.lang.reflect.TypeVariable; <ide> import java.lang.reflect.WildcardType; <add>import java.util.Collections; <ide> import java.util.HashMap; <ide> import java.util.Map; <ide> <ide> * @author Juergen Hoeller <ide> * @author Rob Harrop <ide> * @author Sam Brannen <add> * @author Phillip Webb <ide> * @since 2.5.2 <ide> * @see GenericCollectionTypeResolver <ide> */ <ide> public abstract class GenericTypeResolver { <ide> * Determine the target type for the given parameter specification. <ide> * @param methodParam the method parameter specification <ide> * @return the corresponding generic parameter type <add> * @deprecated as of Spring 4.0 use {@link MethodParameter#getGenericParameterType()} <ide> */ <add> @Deprecated <ide> public static Type getTargetType(MethodParameter methodParam) { <ide> Assert.notNull(methodParam, "MethodParameter must not be null"); <del> if (methodParam.getConstructor() != null) { <del> return methodParam.getConstructor().getGenericParameterTypes()[methodParam.getParameterIndex()]; <del> } <del> else { <del> if (methodParam.getParameterIndex() >= 0) { <del> return methodParam.getMethod().getGenericParameterTypes()[methodParam.getParameterIndex()]; <del> } <del> else { <del> return methodParam.getMethod().getGenericReturnType(); <del> } <del> } <add> return methodParam.getGenericParameterType(); <ide> } <ide> <ide> /** <ide> public static Type getTargetType(MethodParameter methodParam) { <ide> * @return the corresponding generic parameter or return type <ide> */ <ide> public static Class<?> resolveParameterType(MethodParameter methodParam, Class<?> clazz) { <del> Type genericType = getTargetType(methodParam); <add> Assert.notNull(methodParam, "MethodParameter must not be null"); <ide> Assert.notNull(clazz, "Class must not be null"); <del> Map<TypeVariable, Type> typeVariableMap = getTypeVariableMap(clazz); <del> Type rawType = getRawType(genericType, typeVariableMap); <del> Class<?> result = (rawType instanceof Class ? (Class) rawType : methodParam.getParameterType()); <del> methodParam.setParameterType(result); <del> methodParam.typeVariableMap = typeVariableMap; <del> return result; <add> methodParam.resolveClass = clazz; <add> methodParam.setParameterType(ResolvableType.forMethodParameter(methodParam, clazz).resolve()); <add> return methodParam.getParameterType(); <ide> } <ide> <ide> /** <ide> public static Class<?> resolveParameterType(MethodParameter methodParam, Class<? <ide> */ <ide> public static Class<?> resolveReturnType(Method method, Class<?> clazz) { <ide> Assert.notNull(method, "Method must not be null"); <del> Type genericType = method.getGenericReturnType(); <ide> Assert.notNull(clazz, "Class must not be null"); <del> Map<TypeVariable, Type> typeVariableMap = getTypeVariableMap(clazz); <del> Type rawType = getRawType(genericType, typeVariableMap); <del> return (rawType instanceof Class ? (Class<?>) rawType : method.getReturnType()); <add> return ResolvableType.forMethodReturn(method, clazz).resolve(method.getReturnType()); <ide> } <ide> <ide> /** <ide> public static Class<?> resolveReturnTypeForGenericMethod(Method method, Object[] <ide> */ <ide> public static Class<?> resolveReturnTypeArgument(Method method, Class<?> genericIfc) { <ide> Assert.notNull(method, "method must not be null"); <del> Type returnType = method.getReturnType(); <del> Type genericReturnType = method.getGenericReturnType(); <del> if (returnType.equals(genericIfc)) { <del> if (genericReturnType instanceof ParameterizedType) { <del> ParameterizedType targetType = (ParameterizedType) genericReturnType; <del> Type[] actualTypeArguments = targetType.getActualTypeArguments(); <del> Type typeArg = actualTypeArguments[0]; <del> if (!(typeArg instanceof WildcardType)) { <del> return (Class<?>) typeArg; <del> } <del> } <del> else { <del> return null; <del> } <add> ResolvableType resolvableType = ResolvableType.forMethodReturn(method).as(genericIfc); <add> if (!resolvableType.hasGenerics() || resolvableType.getType() instanceof WildcardType) { <add> return null; <ide> } <del> return resolveTypeArgument((Class<?>) returnType, genericIfc); <add> return getSingleGeneric(resolvableType); <ide> } <ide> <ide> /** <ide> public static Class<?> resolveReturnTypeArgument(Method method, Class<?> generic <ide> * @return the resolved type of the argument, or {@code null} if not resolvable <ide> */ <ide> public static Class<?> resolveTypeArgument(Class<?> clazz, Class<?> genericIfc) { <del> Class[] typeArgs = resolveTypeArguments(clazz, genericIfc); <del> if (typeArgs == null) { <add> ResolvableType resolvableType = ResolvableType.forClass(clazz).as(genericIfc); <add> if (!resolvableType.hasGenerics()) { <ide> return null; <ide> } <del> if (typeArgs.length != 1) { <add> return getSingleGeneric(resolvableType); <add> } <add> <add> private static Class<?> getSingleGeneric(ResolvableType resolvableType) { <add> if (resolvableType.getGenerics().length > 1) { <ide> throw new IllegalArgumentException("Expected 1 type argument on generic interface [" + <del> genericIfc.getName() + "] but found " + typeArgs.length); <add> resolvableType + "] but found " + resolvableType.getGenerics().length); <ide> } <del> return typeArgs[0]; <add> return resolvableType.getGeneric().resolve(); <ide> } <ide> <add> <ide> /** <ide> * Resolve the type arguments of the given generic interface against the given <ide> * target class which is assumed to implement the generic interface and possibly <ide> public static Class<?> resolveTypeArgument(Class<?> clazz, Class<?> genericIfc) <ide> * number of actual type arguments, or {@code null} if not resolvable <ide> */ <ide> public static Class[] resolveTypeArguments(Class<?> clazz, Class<?> genericIfc) { <del> return doResolveTypeArguments(clazz, clazz, genericIfc); <del> } <del> <del> private static Class[] doResolveTypeArguments(Class<?> ownerClass, Class<?> classToIntrospect, Class<?> genericIfc) { <del> while (classToIntrospect != null) { <del> if (genericIfc.isInterface()) { <del> Type[] ifcs = classToIntrospect.getGenericInterfaces(); <del> for (Type ifc : ifcs) { <del> Class[] result = doResolveTypeArguments(ownerClass, ifc, genericIfc); <del> if (result != null) { <del> return result; <del> } <del> } <del> } <del> else { <del> try { <del> Class[] result = doResolveTypeArguments(ownerClass, classToIntrospect.getGenericSuperclass(), genericIfc); <del> if (result != null) { <del> return result; <del> } <del> } <del> catch (MalformedParameterizedTypeException ex) { <del> // from getGenericSuperclass() - return null to skip further superclass traversal <del> return null; <del> } <del> } <del> classToIntrospect = classToIntrospect.getSuperclass(); <add> ResolvableType type = ResolvableType.forClass(clazz).as(genericIfc); <add> if(!type.hasGenerics()) { <add> return null; <ide> } <del> return null; <add> return type.resolveGenerics(); <ide> } <ide> <del> private static Class[] doResolveTypeArguments(Class<?> ownerClass, Type ifc, Class<?> genericIfc) { <del> if (ifc instanceof ParameterizedType) { <del> ParameterizedType paramIfc = (ParameterizedType) ifc; <del> Type rawType = paramIfc.getRawType(); <del> if (genericIfc.equals(rawType)) { <del> Type[] typeArgs = paramIfc.getActualTypeArguments(); <del> Class[] result = new Class[typeArgs.length]; <del> for (int i = 0; i < typeArgs.length; i++) { <del> Type arg = typeArgs[i]; <del> result[i] = extractClass(ownerClass, arg); <del> } <del> return result; <del> } <del> else if (genericIfc.isAssignableFrom((Class) rawType)) { <del> return doResolveTypeArguments(ownerClass, (Class) rawType, genericIfc); <del> } <del> } <del> else if (ifc != null && genericIfc.isAssignableFrom((Class) ifc)) { <del> return doResolveTypeArguments(ownerClass, (Class) ifc, genericIfc); <del> } <del> return null; <add> /** <add> * Resolve the specified generic type against the given TypeVariable map. <add> * @param genericType the generic type to resolve <add> * @param typeVariableMap the TypeVariable Map to resolved against <add> * @return the type if it resolves to a Class, or {@code Object.class} otherwise <add> * @deprecated as of Spring 4.0 in favor of {@link ResolvableType} <add> */ <add> @Deprecated <add> public static Class<?> resolveType(Type genericType, Map<TypeVariable, Type> typeVariableMap) { <add> TypeVariableResolver variableResolver = new TypeVariableMapResolver(typeVariableMap); <add> Class<?> resolved = ResolvableType.forType(genericType, variableResolver).resolve(); <add> return (resolved == null ? Object.class : resolved); <ide> } <ide> <ide> /** <del> * Extract a Class from the given Type. <add> * Build a mapping of {@link TypeVariable#getName TypeVariable names} to <add> * {@link Class concrete classes} for the specified {@link Class}. Searches <add> * all super types, enclosing types and interfaces. <add> * @deprecated as of Spring 4.0 in favor of {@link ResolvableType} <ide> */ <del> private static Class<?> extractClass(Class<?> ownerClass, Type arg) { <del> if (arg instanceof ParameterizedType) { <del> return extractClass(ownerClass, ((ParameterizedType) arg).getRawType()); <del> } <del> else if (arg instanceof GenericArrayType) { <del> GenericArrayType gat = (GenericArrayType) arg; <del> Type gt = gat.getGenericComponentType(); <del> Class<?> componentClass = extractClass(ownerClass, gt); <del> return Array.newInstance(componentClass, 0).getClass(); <add> @Deprecated <add> public static Map<TypeVariable, Type> getTypeVariableMap(Class<?> clazz) { <add> Map<TypeVariable, Type> typeVariableMap = typeVariableCache.get(clazz); <add> if (typeVariableMap == null) { <add> typeVariableMap = new HashMap<TypeVariable, Type>(); <add> buildTypeVaraibleMap(ResolvableType.forClass(clazz), typeVariableMap); <add> typeVariableCache.put(clazz, Collections.unmodifiableMap(typeVariableMap)); <ide> } <del> else if (arg instanceof TypeVariable) { <del> TypeVariable tv = (TypeVariable) arg; <del> arg = getTypeVariableMap(ownerClass).get(tv); <del> if (arg == null) { <del> arg = extractBoundForTypeVariable(tv); <del> if (arg instanceof ParameterizedType) { <del> return extractClass(ownerClass, ((ParameterizedType) arg).getRawType()); <add> return typeVariableMap; <add> } <add> <add> private static void buildTypeVaraibleMap(ResolvableType type, <add> Map<TypeVariable, Type> typeVariableMap) { <add> if(type != ResolvableType.NONE) { <add> if(type.getType() instanceof ParameterizedType) { <add> TypeVariable<?>[] variables = type.resolve().getTypeParameters(); <add> for (int i = 0; i < variables.length; i++) { <add> ResolvableType generic = type.getGeneric(i); <add> while (generic.getType() instanceof TypeVariable<?>) { <add> generic = generic.resolveType(); <add> } <add> if (generic != ResolvableType.NONE) { <add> typeVariableMap.put(variables[i], generic.getType()); <add> } <ide> } <ide> } <del> else { <del> return extractClass(ownerClass, arg); <add> buildTypeVaraibleMap(type.getSuperType(), typeVariableMap); <add> for (ResolvableType interfaceType : type.getInterfaces()) { <add> buildTypeVaraibleMap(interfaceType, typeVariableMap); <add> } <add> if (type.resolve().isMemberClass()) { <add> buildTypeVaraibleMap(ResolvableType.forClass(type.resolve().getEnclosingClass()), <add> typeVariableMap); <ide> } <ide> } <del> return (arg instanceof Class ? (Class) arg : Object.class); <del> } <del> <del> /** <del> * Resolve the specified generic type against the given TypeVariable map. <del> * @param genericType the generic type to resolve <del> * @param typeVariableMap the TypeVariable Map to resolved against <del> * @return the type if it resolves to a Class, or {@code Object.class} otherwise <del> */ <del> public static Class<?> resolveType(Type genericType, Map<TypeVariable, Type> typeVariableMap) { <del> Type resolvedType = getRawType(genericType, typeVariableMap); <del> if (resolvedType instanceof GenericArrayType) { <del> Type componentType = ((GenericArrayType) resolvedType).getGenericComponentType(); <del> Class<?> componentClass = resolveType(componentType, typeVariableMap); <del> resolvedType = Array.newInstance(componentClass, 0).getClass(); <del> } <del> return (resolvedType instanceof Class ? (Class) resolvedType : Object.class); <ide> } <ide> <ide> /** <ide> public static Class<?> resolveType(Type genericType, Map<TypeVariable, Type> typ <ide> * @param typeVariableMap the TypeVariable Map to resolved against <ide> * @return the resolved raw type <ide> */ <add> @Deprecated <ide> static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap) { <ide> Type resolvedType = genericType; <ide> if (genericType instanceof TypeVariable) { <ide> static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap <ide> } <ide> } <ide> <del> /** <del> * Build a mapping of {@link TypeVariable#getName TypeVariable names} to <del> * {@link Class concrete classes} for the specified {@link Class}. Searches <del> * all super types, enclosing types and interfaces. <del> */ <del> public static Map<TypeVariable, Type> getTypeVariableMap(Class<?> clazz) { <del> Map<TypeVariable, Type> typeVariableMap = typeVariableCache.get(clazz); <del> <del> if (typeVariableMap == null) { <del> typeVariableMap = new HashMap<TypeVariable, Type>(); <del> <del> // interfaces <del> extractTypeVariablesFromGenericInterfaces(clazz.getGenericInterfaces(), typeVariableMap); <del> <del> try { <del> // super class <del> Class<?> type = clazz; <del> while (type.getSuperclass() != null && !Object.class.equals(type.getSuperclass())) { <del> Type genericType = type.getGenericSuperclass(); <del> if (genericType instanceof ParameterizedType) { <del> ParameterizedType pt = (ParameterizedType) genericType; <del> populateTypeMapFromParameterizedType(pt, typeVariableMap); <del> } <del> extractTypeVariablesFromGenericInterfaces(type.getSuperclass().getGenericInterfaces(), typeVariableMap); <del> type = type.getSuperclass(); <del> } <del> } <del> catch (MalformedParameterizedTypeException ex) { <del> // from getGenericSuperclass() - ignore and continue with member class check <del> } <del> <del> try { <del> // enclosing class <del> Class<?> type = clazz; <del> while (type.isMemberClass()) { <del> Type genericType = type.getGenericSuperclass(); <del> if (genericType instanceof ParameterizedType) { <del> ParameterizedType pt = (ParameterizedType) genericType; <del> populateTypeMapFromParameterizedType(pt, typeVariableMap); <del> } <del> type = type.getEnclosingClass(); <del> } <del> } <del> catch (MalformedParameterizedTypeException ex) { <del> // from getGenericSuperclass() - ignore and preserve previously accumulated type variables <del> } <del> <del> typeVariableCache.put(clazz, typeVariableMap); <del> } <del> <del> return typeVariableMap; <del> } <del> <ide> /** <ide> * Extracts the bound {@code Type} for a given {@link TypeVariable}. <ide> */ <add> @Deprecated <ide> static Type extractBoundForTypeVariable(TypeVariable typeVariable) { <ide> Type[] bounds = typeVariable.getBounds(); <ide> if (bounds.length == 0) { <ide> static Type extractBoundForTypeVariable(TypeVariable typeVariable) { <ide> return bound; <ide> } <ide> <del> private static void extractTypeVariablesFromGenericInterfaces(Type[] genericInterfaces, Map<TypeVariable, Type> typeVariableMap) { <del> for (Type genericInterface : genericInterfaces) { <del> if (genericInterface instanceof ParameterizedType) { <del> ParameterizedType pt = (ParameterizedType) genericInterface; <del> populateTypeMapFromParameterizedType(pt, typeVariableMap); <del> if (pt.getRawType() instanceof Class) { <del> extractTypeVariablesFromGenericInterfaces( <del> ((Class) pt.getRawType()).getGenericInterfaces(), typeVariableMap); <del> } <del> } <del> else if (genericInterface instanceof Class) { <del> extractTypeVariablesFromGenericInterfaces( <del> ((Class) genericInterface).getGenericInterfaces(), typeVariableMap); <del> } <del> } <del> } <ide> <ide> /** <del> * Read the {@link TypeVariable TypeVariables} from the supplied {@link ParameterizedType} <del> * and add mappings corresponding to the {@link TypeVariable#getName TypeVariable name} -> <del> * concrete type to the supplied {@link Map}. <del> * <p>Consider this case: <del> * <pre class="code> <del> * public interface Foo<S, T> { <del> * .. <del> * } <del> * <del> * public class FooImpl implements Foo<String, Integer> { <del> * .. <del> * }</pre> <del> * For '{@code FooImpl}' the following mappings would be added to the {@link Map}: <del> * {S=java.lang.String, T=java.lang.Integer}. <add> * Adapts a {@code typeVariableMap} to a {@link TypeVariableResolver}. <ide> */ <del> private static void populateTypeMapFromParameterizedType(ParameterizedType type, Map<TypeVariable, Type> typeVariableMap) { <del> if (type.getRawType() instanceof Class) { <del> Type[] actualTypeArguments = type.getActualTypeArguments(); <del> TypeVariable[] typeVariables = ((Class) type.getRawType()).getTypeParameters(); <del> for (int i = 0; i < actualTypeArguments.length; i++) { <del> Type actualTypeArgument = actualTypeArguments[i]; <del> TypeVariable variable = typeVariables[i]; <del> if (actualTypeArgument instanceof Class) { <del> typeVariableMap.put(variable, actualTypeArgument); <del> } <del> else if (actualTypeArgument instanceof GenericArrayType) { <del> typeVariableMap.put(variable, actualTypeArgument); <del> } <del> else if (actualTypeArgument instanceof ParameterizedType) { <del> typeVariableMap.put(variable, actualTypeArgument); <del> } <del> else if (actualTypeArgument instanceof TypeVariable) { <del> // We have a type that is parameterized at instantiation time <del> // the nearest match on the bridge method will be the bounded type. <del> TypeVariable typeVariableArgument = (TypeVariable) actualTypeArgument; <del> Type resolvedType = typeVariableMap.get(typeVariableArgument); <del> if (resolvedType == null) { <del> resolvedType = extractBoundForTypeVariable(typeVariableArgument); <del> } <del> typeVariableMap.put(variable, resolvedType); <del> } <add> private static class TypeVariableMapResolver implements TypeVariableResolver { <add> <add> private Map<TypeVariable, Type> typeVariableMap; <add> <add> <add> public TypeVariableMapResolver(Map<TypeVariable, Type> typeVariableMap) { <add> Assert.notNull("TypeVariableMap must not be null"); <add> this.typeVariableMap = typeVariableMap; <add> } <add> <add> <add> @Override <add> public Type resolveVariable(TypeVariable typeVariable) { <add> return typeVariableMap.get(typeVariable); <add> } <add> <add> @Override <add> public int hashCode() { <add> return typeVariableMap.hashCode(); <add> } <add> <add> @Override <add> public boolean equals(Object obj) { <add> if(obj == this) { <add> return true; <add> } <add> if(obj instanceof TypeVariableMapResolver) { <add> TypeVariableMapResolver other = (TypeVariableMapResolver) obj; <add> return this.typeVariableMap.equals(other.typeVariableMap); <ide> } <add> return false; <ide> } <add> <ide> } <ide> <ide> } <ide><path>spring-core/src/main/java/org/springframework/core/MethodParameter.java <ide> public class MethodParameter { <ide> /** Map from Integer level to Integer type index */ <ide> Map<Integer, Integer> typeIndexesPerLevel; <ide> <del> Map<TypeVariable, Type> typeVariableMap; <add> Class<?> resolveClass; <ide> <ide> private int hash = 0; <ide> <ide> public MethodParameter(MethodParameter original) { <ide> this.parameterName = original.parameterName; <ide> this.nestingLevel = original.nestingLevel; <ide> this.typeIndexesPerLevel = original.typeIndexesPerLevel; <del> this.typeVariableMap = original.typeVariableMap; <add> this.resolveClass = original.resolveClass; <ide> this.hash = original.hash; <ide> } <ide> <ide><path>spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java <ide> <ide> import org.junit.Test; <ide> <add>import static org.hamcrest.Matchers.*; <ide> import static org.junit.Assert.*; <ide> import static org.springframework.core.GenericTypeResolver.*; <ide> import static org.springframework.util.ReflectionUtils.*; <ide> public void testBoundParameterizedType() { <ide> assertEquals(B.class, resolveTypeArgument(TestImpl.class, ITest.class)); <ide> } <ide> <add> @Test <add> public void testGetTypeVariableMap() throws Exception { <add> Map<TypeVariable, Type> map; <add> <add> map = GenericTypeResolver.getTypeVariableMap(MySimpleInterfaceType.class); <add> assertThat(map.toString(), equalTo("{T=class java.lang.String}")); <add> <add> map = GenericTypeResolver.getTypeVariableMap(MyCollectionInterfaceType.class); <add> assertThat(map.toString(), equalTo("{T=java.util.Collection<java.lang.String>}")); <add> <add> map = GenericTypeResolver.getTypeVariableMap(MyCollectionSuperclassType.class); <add> assertThat(map.toString(), equalTo("{T=java.util.Collection<java.lang.String>}")); <add> <add> map = GenericTypeResolver.getTypeVariableMap(MySimpleTypeWithMethods.class); <add> assertThat(map.toString(), equalTo("{T=class java.lang.Integer}")); <add> <add> map = GenericTypeResolver.getTypeVariableMap(TopLevelClass.class); <add> assertThat(map.toString(), equalTo("{}")); <add> <add> map = GenericTypeResolver.getTypeVariableMap(TypedTopLevelClass.class); <add> assertThat(map.toString(), equalTo("{T=class java.lang.Integer}")); <add> <add> map = GenericTypeResolver.getTypeVariableMap(TypedTopLevelClass.TypedNested.class); <add> assertThat(map.size(), equalTo(2)); <add> Type t = null; <add> Type x = null; <add> for (Map.Entry<TypeVariable, Type> entry : map.entrySet()) { <add> if(entry.getKey().toString().equals("T")) { <add> t = entry.getValue(); <add> } <add> else { <add> x = entry.getValue(); <add> } <add> } <add> assertThat(t, equalTo((Type) Integer.class)); <add> assertThat(x, equalTo((Type) Long.class)); <add> } <ide> <ide> public interface MyInterfaceType<T> { <ide> } <ide> public static class MySimpleTypeWithMethods extends MyTypeWithMethods<Integer> { <ide> class TestImpl<I extends A, T extends B<I>> extends ITest<T>{ <ide> } <ide> <add> static class TopLevelClass<T> { <add> class Nested<X> { <add> } <add> } <add> <add> static class TypedTopLevelClass extends TopLevelClass<Integer> { <add> class TypedNested extends Nested<Long> { <add> } <add> } <add> <ide> }
3
PHP
PHP
integrate new plugin hooks into the console runner
bf8e83cab56cbcc0db8666c567f3e68dda7a48d3
<ide><path>src/Console/CommandRunner.php <ide> use Cake\Console\Exception\StopException; <ide> use Cake\Console\Shell; <ide> use Cake\Core\ConsoleApplicationInterface; <add>use Cake\Core\PluginApplicationInterface; <ide> use Cake\Event\EventDispatcherInterface; <ide> use Cake\Event\EventDispatcherTrait; <add>use Cake\Event\EventManagerTrait; <ide> use Cake\Utility\Inflector; <ide> use RuntimeException; <ide> <ide> public function setAliases(array $aliases) <ide> */ <ide> public function run(array $argv, ConsoleIo $io = null) <ide> { <add> $hasPlugins = $this->app instanceof PluginApplicationInterface; <ide> $this->app->bootstrap(); <add> if ($hasPlugins) { <add> $this->app->pluginBootstrap(); <add> } <ide> <ide> $commands = new CommandCollection([ <ide> 'version' => VersionCommand::class, <ide> 'help' => HelpCommand::class, <ide> ]); <ide> $commands = $this->app->console($commands); <add> if ($hasPlugins) { <add> $commands = $this->app->pluginConsole($commands); <add> } <ide> <ide> if (!($commands instanceof CommandCollection)) { <ide> $type = getTypeName($commands); <ide><path>src/Http/BaseApplication.php <ide> <ide> use Cake\Core\ConsoleApplicationInterface; <ide> use Cake\Core\HttpApplicationInterface; <del>use Cake\Core\PluginRegistry; <del>use Cake\Core\PluginRegistryInterface; <add>use Cake\Core\PluginApplicationInterface; <add>use Cake\Core\PluginCollection; <ide> use Cake\Routing\DispatcherFactory; <ide> use Cake\Routing\Router; <ide> use InvalidArgumentException; <ide> * and ensuring that middleware is attached. It is also invoked as the last piece <ide> * of middleware, and delegates request/response handling to the correct controller. <ide> */ <del>abstract class BaseApplication implements ConsoleApplicationInterface, HttpApplicationInterface <add>abstract class BaseApplication implements <add> ConsoleApplicationInterface, <add> HttpApplicationInterface, <add> PluginApplicationInterface <ide> { <ide> <ide> /** <ide> abstract class BaseApplication implements ConsoleApplicationInterface, HttpAppli <ide> protected $configDir; <ide> <ide> /** <del> * Plugin Registry <add> * Plugin Collection <ide> * <del> * @param \Cake\Core\PluginRegistry <add> * @param \Cake\Core\PluginCollection <ide> */ <del> protected $pluginRegistry; <del> <del> /** <del> * Default Plugin Registry Class <del> * <del> * @var string <del> */ <del> protected $defaultPluginRegistry = PluginRegistry::class; <add> protected $plugins; <ide> <ide> /** <ide> * Constructor <ide> abstract class BaseApplication implements ConsoleApplicationInterface, HttpAppli <ide> public function __construct($configDir, $pluginRegistry = null) <ide> { <ide> $this->configDir = $configDir; <del> <del> $this->setPluginRegistry($pluginRegistry); <add> $this->plugins = new PluginCollection(); <ide> } <ide> <ide> /** <del> * Sets the plugin registry <del> * <del> * @param string|null $pluginRegistry Plugin Registry Object <del> * @return void <add> * @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to set in your App Class <add> * @return \Cake\Http\MiddlewareQueue <ide> */ <del> public function setPluginRegistry($pluginRegistry = null) <del> { <del> if (empty($pluginRegistry)) { <del> $this->pluginRegistry = new $this->defaultPluginRegistry(); <del> <del> return; <del> } <add> abstract public function middleware($middleware); <ide> <del> if (!$pluginRegistry instanceof PluginRegistryInterface) { <del> throw new InvalidArgumentException(sprintf( <del> '`%s` is not an instance of `%s`', <del> get_class($pluginRegistry), <del> PluginRegistryInterface::class <del> )); <add> /** <add> * {@inheritDoc} <add> */ <add> public function pluginMiddleware($middleware) <add> { <add> foreach ($this->plugins->with('middleware') as $plugin) { <add> $middleware = $plugin->middleware($middleware); <ide> } <ide> <del> $this->pluginRegistry = $pluginRegistry; <add> return $middleware; <ide> } <ide> <ide> /** <del> * @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to set in your App Class <del> * @return \Cake\Http\MiddlewareQueue <add> * {@inheritDoc} <ide> */ <del> abstract public function middleware($middleware); <add> public function addPlugin($name, array $config = []) <add> { <add> } <ide> <ide> /** <ide> * {@inheritDoc} <ide> public function bootstrap() <ide> $this->pluginRegistry()->bootstrap(); <ide> } <ide> <add> /** <add> * {@inheritDoc} <add> */ <add> public function pluginBootstrap() <add> { <add> foreach ($this->plugins->with('bootstrap') as $plugin) { <add> $plugin->bootstrap(); <add> } <add> } <add> <ide> /** <ide> * {@inheritDoc} <ide> * <ide> public function routes($routes) <ide> } <ide> } <ide> <add> /** <add> * {@inheritDoc} <add> */ <add> public function pluginRoutes($routes) <add> { <add> foreach ($this->plugins->with('routes') as $plugin) { <add> $routes = $plugin->routes($routes); <add> } <add> <add> return $routes; <add> } <add> <ide> /** <ide> * Define the console commands for an application. <ide> * <ide> public function console($commands) <ide> return $this->pluginRegistry()->console($commands); <ide> } <ide> <add> /** <add> * {@inheritDoc} <add> */ <add> public function pluginConsole($commands) <add> { <add> foreach ($this->plugins->with('console') as $plugin) { <add> $commands = $plugin->console($commands); <add> } <add> <add> return $commands; <add> } <add> <ide> /** <ide> * Invoke the application. <ide> * <ide> protected function getDispatcher() <ide> { <ide> return new ActionDispatcher(null, null, DispatcherFactory::filters()); <ide> } <del> <del> /** <del> * Plugins <del> * <del> * @return \Cake\Core\PluginRegistry <del> */ <del> public function getPluginRegistry() <del> { <del> return $this->pluginRegistry; <del> } <ide> } <ide><path>tests/TestCase/Console/CommandRunnerTest.php <ide> public function testRunTriggersBuildCommandsEvent() <ide> $this->assertTrue($this->eventTriggered, 'Should have triggered event.'); <ide> } <ide> <add> /** <add> * Test that run calls plugin hook methods <add> * <add> * @return void <add> */ <add> public function testRunCallsPluginHookMethods() <add> { <add> $app = $this->getMockBuilder(BaseApplication::class) <add> ->setMethods(['middleware', 'bootstrap', 'pluginBootstrap', 'pluginConsole']) <add> ->setConstructorArgs([$this->config]) <add> ->getMock(); <add> $app->expects($this->once()) <add> ->method('pluginBootstrap'); <add> <add> $commands = new CommandCollection(); <add> $app->expects($this->once()) <add> ->method('pluginConsole') <add> ->with($this->isinstanceOf(CommandCollection::class)) <add> ->will($this->returnCallback(function ($commands) { <add> return $commands; <add> })); <add> <add> $output = new ConsoleOutput(); <add> $runner = new CommandRunner($app, 'cake'); <add> $result = $runner->run(['cake', '--version'], $this->getMockIo($output)); <add> $this->assertContains(Configure::version(), $output->messages()[0]); <add> } <add> <ide> protected function makeAppWithCommands($commands) <ide> { <ide> $app = $this->getMockBuilder(BaseApplication::class)
3
Python
Python
add example of how to do sparse-checkout
e08257d4012b6df624c88b45ba28e8f9829ce2ad
<ide><path>spacy/cli/_git_sparse_checkout_example.py <add>import tempfile <add>import typer <add>from pathlib import Path <add>import subprocess <add>import shlex <add>import shutil <add>from contextlib import contextmanager <add> <add> <add>@contextmanager <add>def make_tempdir(): <add> d = Path(tempfile.mkdtemp()) <add> yield d <add> shutil.rmtree(str(d)) <add> <add> <add> <add>def clone_repo(repo, temp_dir): <add> subprocess.check_call([ <add> "git", <add> "clone", <add> repo, <add> temp_dir, <add> "--no-checkout", <add> "--depth", "1", <add> "--config", "core.sparseCheckout=true" <add> ]) <add> <add> <add>def checkout_and_fetch(temp_dir): <add> subprocess.check_call([ <add> "git", <add> "-C", temp_dir, <add> "fetch" <add> ]) <add> subprocess.check_call([ <add> "git", <add> "-C", temp_dir, <add> "checkout" <add> ]) <add> <add> <add>def set_sparse_checkout_dir(temp_dir, subpath): <add> with (temp_dir / ".git" / "info" / "sparse-checkout").open("w") as file_: <add> file_.write(subpath) <add> <add> <add>def main(repo: str, subpath: str, dest: Path): <add> with make_tempdir() as temp_dir: <add> clone_repo(repo, temp_dir) <add> print("After clone", list(temp_dir.iterdir())) <add> set_sparse_checkout_dir(temp_dir, subpath) <add> checkout_and_fetch(temp_dir) <add> print("After checkout", list(temp_dir.iterdir())) <add> assert (temp_dir / subpath) in list(temp_dir.iterdir()) <add> shutil.copytree(temp_dir / subpath, dest / subpath, dirs_exist_ok=True) <add> print("Exists after cleanup?", temp_dir.exists()) <add> print("Destination", list(dest.iterdir())) <add> <add> <add>if __name__ == "__main__": <add> typer.run(main)
1
PHP
PHP
fix deprecationwarning message
5db1ae9ce3347476018f76d24013ec0ea8250195
<ide><path>src/ORM/Table.php <ide> public function hasBehavior($name) <ide> /** <ide> * Returns an association object configured for the specified alias if any. <ide> * <del> * @deprecated 3.6.0 Use getAssociation() and Table::hasAssocation() instead. <add> * @deprecated 3.6.0 Use getAssociation() and Table::hasAssociation() instead. <ide> * @param string $name the alias used for the association. <ide> * @return \Cake\ORM\Association|null Either the association or null. <ide> */ <ide> public function association($name) <ide> { <del> deprecationWarning('Use Table::getAssociation() and Table::hasAssocation() instead.'); <add> deprecationWarning('Use Table::getAssociation() and Table::hasAssociation() instead.'); <ide> <ide> return $this->findAssociation($name); <ide> }
1
PHP
PHP
use array_values on relationship matches
9cee86ffb9576b457a614540deba6dd524357eac
<ide><path>laravel/database/eloquent/relationships/has_many.php <ide> public function match($relationship, &$parents, $children) <ide> return $v->$foreign == $parent->get_key(); <ide> }); <ide> <del> $parent->relationships[$relationship] = $matching; <add> $parent->relationships[$relationship] = array_values($matching); <ide> } <ide> } <ide> <ide><path>laravel/database/eloquent/relationships/has_many_and_belongs_to.php <ide> public function match($relationship, &$parents, $children) <ide> return $v->pivot->$foreign == $parent->get_key(); <ide> }); <ide> <del> $parent->relationships[$relationship] = $matching; <add> $parent->relationships[$relationship] = array_values($matching); <ide> } <ide> } <ide>
2
Python
Python
call numpyops instead of get_current_ops()
0796401c1955fc3508b2d1f50b402b492fa690b2
<ide><path>spacy/tests/pipeline/test_models.py <ide> import pytest <ide> from numpy.testing import assert_almost_equal <ide> from spacy.vocab import Vocab <del>from thinc.api import get_current_ops, Model, data_validation <add>from thinc.api import NumpyOps, Model, data_validation <ide> from thinc.types import Array2d, Ragged <ide> <ide> from spacy.lang.en import English <ide> from spacy.ml import FeatureExtractor, StaticVectors <ide> from spacy.ml._character_embed import CharacterEmbed <ide> from spacy.tokens import Doc <ide> <del>OPS = get_current_ops() <add> <add>OPS = NumpyOps() <ide> <ide> texts = ["These are 4 words", "Here just three"] <ide> l0 = [[1, 2], [3, 4], [5, 6], [7, 8]]
1
Python
Python
add morph rules in language
b382dc902c54b0e2369c0af8eacfd514064dcc8d
<ide><path>spacy/language.py <ide> def create_vocab(cls, nlp=None): <ide> # This is very messy, but it's the minimal working fix to Issue #639. <ide> # This defaults stuff needs to be refactored (again) <ide> lex_attr_getters[IS_STOP] = lambda string: string.lower() in cls.stop_words <del> return Vocab(lex_attr_getters=lex_attr_getters, tag_map=cls.tag_map, <add> vocab = Vocab(lex_attr_getters=lex_attr_getters, tag_map=cls.tag_map, <ide> lemmatizer=lemmatizer) <ide> else: <del> return Vocab.load(nlp.path, lex_attr_getters=cls.lex_attr_getters, <add> vocab = Vocab.load(nlp.path, lex_attr_getters=cls.lex_attr_getters, <ide> tag_map=cls.tag_map, lemmatizer=lemmatizer) <add> for tag_str, exc in cls.morph_rules.items(): <add> for orth_str, attrs in exc.items(): <add> vocab.morphology.add_special_case(tag_str, orth_str, attrs) <add> return vocab <ide> <ide> @classmethod <ide> def add_vectors(cls, nlp=None): <ide> def create_pipeline(self, nlp=None): <ide> lemma_rules = {} <ide> lemma_exc = {} <ide> lemma_index = {} <add> morph_rules = {} <ide> <ide> lex_attr_getters = { <ide> attrs.LOWER: lambda string: string.lower(),
1
Ruby
Ruby
fix broken test
1f7415ab3a5b433ecfb0c10d66343a894d73914a
<ide><path>activerecord/test/cases/json_serialization_test.rb <ide> def test_should_allow_only_option_for_list_of_authors <ide> def test_should_allow_except_option_for_list_of_authors <ide> ActiveRecord::Base.include_root_in_json = false <ide> authors = [@david, @mary] <del> assert_equal %([{"id":1},{"id":2}]), ActiveSupport::JSON.encode(authors, :except => [:name, :author_address_id, :author_address_extra_id]) <add> encoded = ActiveSupport::JSON.encode(authors, :except => [ <add> :name, :author_address_id, :author_address_extra_id, <add> :organization_id, :owned_essay_id <add> ]) <add> assert_equal %([{"id":1},{"id":2}]), encoded <ide> ensure <ide> ActiveRecord::Base.include_root_in_json = true <ide> end
1
Javascript
Javascript
preserve contents for cloned scripts
dec2804c783003c13d356ed3fec664c3ac4b05ee
<ide><path>src/manipulation.js <ide> function cloneFixAttributes( src, dest ) { <ide> // cloning other types of input fields <ide> } else if ( nodeName === "input" || nodeName === "textarea" ) { <ide> dest.defaultValue = src.defaultValue; <add> <add> // IE blanks contents when cloning scripts <add> } else if ( nodeName === "script" && dest.text !== src.text ) { <add> dest.text = src.text; <ide> } <ide> <ide> // Event data gets referenced instead of copied if the expando <ide><path>test/unit/manipulation.js <ide> test("clone()", function() { <ide> equal( jQuery("body").clone().children()[0].id, "qunit-header", "Make sure cloning body works" ); <ide> }); <ide> <add>test("clone(script type=non-javascript) (#11359)", function() { <add> expect(3); <add> var src = jQuery("<script type='text/filler'>Lorem ipsum dolor sit amet</script><q><script type='text/filler'>consectetur adipiscing elit</script></q>"); <add> var dest = src.clone(); <add> equal( dest[0].text, "Lorem ipsum dolor sit amet", "Cloning preserves script text" ); <add> equal( dest.last().html(), src.last().html(), "Cloning preserves nested script text" ); <add> ok( /^\s*<scr.pt\s+type=['"]?text\/filler['"]?\s*>consectetur adipiscing elit<\/scr.pt>\s*$/i.test( dest.last().html() ), "Cloning preserves nested script text" ); <add>}); <add> <ide> test("clone(form element) (Bug #3879, #6655)", function() { <ide> expect(5); <ide> var element = jQuery("<select><option>Foo</option><option selected>Bar</option></select>");
2
Python
Python
preserve matrices. fix #142
7a957813bc80e45b1707535c5ae6cad65c8d84b2
<ide><path>numpy/lib/function_base.py <ide> import types <ide> import numpy.core.numeric as _nx <ide> from numpy.core.numeric import ones, zeros, arange, concatenate, array, \ <del> asarray, empty, empty_like, asanyarray, ndarray <add> asarray, asanyarray, empty, empty_like, asanyarray, ndarray <ide> from numpy.core.numeric import ScalarType, dot, where, newaxis <ide> from numpy.core.umath import pi, multiply, add, arctan2, \ <ide> frompyfunc, isnan, cos, less_equal, sqrt, sin, mod, exp <ide> def diff(a, n=1, axis=-1): <ide> if n == 0: <ide> return a <ide> if n < 0: <del> raise ValueError, 'order must be non-negative but got ' + `n` <del> a = asarray(a) <add> raise ValueError, 'order must be non-negative but got ' + repr(n) <add> a = asanyarray(a) <ide> nd = len(a.shape) <ide> slice1 = [slice(None)]*nd <ide> slice2 = [slice(None)]*nd <ide> def sinc(x): <ide> return sin(y)/y <ide> <ide> def msort(a): <del> b = array(a,copy=True) <add> b = array(a,subok=True,copy=True) <ide> b.sort(0) <ide> return b <ide> <ide><path>numpy/lib/shape_base.py <ide> def atleast_1d(*arys): <ide> """ <ide> res = [] <ide> for ary in arys: <del> res.append(array(ary,copy=False,ndmin=1)) <add> res.append(array(ary,copy=False,subok=True,ndmin=1)) <ide> if len(res) == 1: <ide> return res[0] <ide> else: <ide> def atleast_2d(*arys): <ide> """ <ide> res = [] <ide> for ary in arys: <del> res.append(array(ary,copy=False,ndmin=2)) <add> res.append(array(ary,copy=False,subok=2,ndmin=2)) <ide> if len(res) == 1: <ide> return res[0] <ide> else:
2
PHP
PHP
fix incorrect padding with multi-byte strings
76db206551622be1560fb68349da819807350a1b
<ide><path>laravel/crypter.php <ide> protected static function iv_size() <ide> */ <ide> protected static function pad($value) <ide> { <del> $pad = static::$block - (Str::length($value) % static::$block); <add> $pad = static::$block - (strlen($value) % static::$block); <ide> <ide> return $value .= str_repeat(chr($pad), $pad); <ide> } <ide> protected static function pad($value) <ide> */ <ide> protected static function unpad($value) <ide> { <del> if (MB_STRING) <del> { <del> $pad = ord(mb_substr($value, -1, 1, Config::get('application.encoding'))); <del> } <del> else <del> { <del> $pad = ord(substr($value, -1)); <del> } <add> $pad = ord(substr($value, -1)); <ide> <ide> if ($pad and $pad <= static::$block) <ide> { <ide> protected static function unpad($value) <ide> // as the padding appears to have been changed. <ide> if (preg_match('/'.chr($pad).'{'.$pad.'}$/', $value)) <ide> { <del> if (MB_STRING) <del> { <del> return mb_substr($value, 0, Str::length($value) - $pad, Config::get('application.encoding')); <del> } <del> <del> return substr($value, 0, Str::length($value) - $pad); <add> return substr($value, 0, strlen($value) - $pad); <ide> } <ide> <ide> // If the padding characters do not match the expected padding
1
Javascript
Javascript
remove unnecessary bind
2e738fb6b53903d11d2557acfe4b17c7c60c3a6b
<ide><path>lib/internal/cluster/child.js <ide> function shared(message, handle, indexesKey, cb) { <ide> send({ act: 'close', key }); <ide> handles.delete(key); <ide> indexes.delete(indexesKey); <del> return close.apply(this, arguments); <del> }.bind(handle); <add> return close.apply(handle, arguments); <add> }; <ide> assert(handles.has(key) === false); <ide> handles.set(key, handle); <ide> cb(message.errno, handle);
1
Python
Python
add style improvements to project euler problem 8
f3fe29cea1b97db60ee29a78a8f89d1d84ac8c2a
<ide><path>project_euler/problem_08/sol1.py <ide> """ <add>Problem 8: https://projecteuler.net/problem=8 <add> <ide> The four adjacent digits in the 1000-digit number that have the greatest <ide> product are 9 × 9 × 8 × 9 = 5832. <ide> <ide> 71636269561882670428252483600823257530420752963450""" <ide> <ide> <del>def solution(n): <add>def solution(n: str = N) -> int: <ide> """Find the thirteen adjacent digits in the 1000-digit number n that have <ide> the greatest product and returns it. <ide> <ide> >>> solution(N) <ide> 23514624000 <ide> """ <del> LargestProduct = -sys.maxsize - 1 <add> largest_product = -sys.maxsize - 1 <ide> for i in range(len(n) - 12): <ide> product = 1 <ide> for j in range(13): <ide> product *= int(n[i + j]) <del> if product > LargestProduct: <del> LargestProduct = product <del> return LargestProduct <add> if product > largest_product: <add> largest_product = product <add> return largest_product <ide> <ide> <ide> if __name__ == "__main__": <ide><path>project_euler/problem_08/sol2.py <ide> """ <add>Problem 8: https://projecteuler.net/problem=8 <add> <ide> The four adjacent digits in the 1000-digit number that have the greatest <ide> product are 9 × 9 × 8 × 9 = 5832. <ide> <ide> ) <ide> <ide> <del>def solution(n): <add>def solution(n: str = N) -> int: <ide> """Find the thirteen adjacent digits in the 1000-digit number n that have <ide> the greatest product and returns it. <ide> <ide><path>project_euler/problem_08/sol3.py <ide> """ <add>Problem 8: https://projecteuler.net/problem=8 <add> <ide> The four adjacent digits in the 1000-digit number that have the greatest <ide> product are 9 × 9 × 8 × 9 = 5832. <ide> <ide> 71636269561882670428252483600823257530420752963450""" <ide> <ide> <del>def streval(s: str) -> int: <del> ret = 1 <del> for it in s: <del> ret *= int(it) <del> return ret <add>def str_eval(s: str) -> int: <add> """Returns product of digits in given string n <add> <add> >>> str_eval("987654321") <add> 362880 <add> >>> str_eval("22222222") <add> 256 <add> """ <add> product = 1 <add> for digit in s: <add> product *= int(digit) <add> return product <ide> <ide> <del>def solution(n: str) -> int: <add>def solution(n: str = N) -> int: <ide> """Find the thirteen adjacent digits in the 1000-digit number n that have <ide> the greatest product and returns it. <ide> <ide> >>> solution(N) <ide> 23514624000 <ide> """ <del> LargestProduct = -sys.maxsize - 1 <add> largest_product = -sys.maxsize - 1 <ide> substr = n[:13] <ide> cur_index = 13 <ide> while cur_index < len(n) - 13: <ide> if int(n[cur_index]) >= int(substr[0]): <ide> substr = substr[1:] + n[cur_index] <ide> cur_index += 1 <ide> else: <del> LargestProduct = max(LargestProduct, streval(substr)) <add> largest_product = max(largest_product, str_eval(substr)) <ide> substr = n[cur_index : cur_index + 13] <ide> cur_index += 13 <del> return LargestProduct <add> return largest_product <ide> <ide> <ide> if __name__ == "__main__":
3
PHP
PHP
flatten
ca66631b916063c1be8a594c58035e8e432c0277
<ide><path>src/Illuminate/Support/Arr.php <ide> public static function last($array, callable $callback, $default = null) <ide> * Flatten a multi-dimensional array into a single level. <ide> * <ide> * @param array $array <add> * @param int $depth <ide> * @return array <ide> */ <del> public static function flatten($array) <add> public static function flatten($array, $depth = INF) <ide> { <del> $return = []; <add> return array_reduce($array, function ($result, $item) use ($depth) { <add> $item = $item instanceof Collection ? $item->all() : $item; <ide> <del> array_walk_recursive($array, function ($x) use (&$return) { $return[] = $x; }); <add> if (is_array($item)) { <add> if ($depth === 1) { <add> return array_merge($result, $item); <add> } <add> <add> return array_merge($result, static::flatten($item, $depth - 1)); <add> } <add> <add> $result[] = $item; <ide> <del> return $return; <add> return $result; <add> }, []); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Support/Collection.php <ide> public function first(callable $callback = null, $default = null) <ide> */ <ide> public function flatten($depth = INF) <ide> { <del> return $this->reduce(function ($return, $item) use ($depth) { <del> if ($item instanceof self || is_array($item)) { <del> if ($depth === 1) { <del> return $return->merge($item); <del> } <del> <del> return $return->merge((new static($item))->flatten($depth - 1)); <del> } <del> <del> return $return->push($item); <del> }, new static); <add> return new static(Arr::flatten($this->items, $depth)); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Support/helpers.php <ide> function array_last($array, $callback, $default = null) <ide> * Flatten a multi-dimensional array into a single level. <ide> * <ide> * @param array $array <add> * @param int $depth <ide> * @return array <ide> */ <del> function array_flatten($array) <add> function array_flatten($array, $depth = INF) <ide> { <del> return Arr::flatten($array); <add> return Arr::flatten($array, $depth); <ide> } <ide> } <ide> <ide><path>tests/Support/SupportArrTest.php <ide> <?php <ide> <ide> use Illuminate\Support\Arr; <add>use Illuminate\Support\Collection; <ide> <ide> class SupportArrTest extends PHPUnit_Framework_TestCase <ide> { <ide> public function testLast() <ide> <ide> public function testFlatten() <ide> { <del> $array = ['name' => 'Joe', 'languages' => ['PHP', 'Ruby']]; <del> $array = Arr::flatten($array); <del> $this->assertEquals(['Joe', 'PHP', 'Ruby'], $array); <add> // Flat arrays are unaffected <add> $array = ['#foo', '#bar', '#baz']; <add> $this->assertEquals(['#foo', '#bar', '#baz'], Arr::flatten(['#foo', '#bar', '#baz'])); <add> <add> // Nested arrays are flattened with existing flat items <add> $array = [['#foo', '#bar'], '#baz']; <add> $this->assertEquals(['#foo', '#bar', '#baz'], Arr::flatten($array)); <add> <add> // Sets of nested arrays are flattened <add> $array = [['#foo', '#bar'], ['#baz']]; <add> $this->assertEquals(['#foo', '#bar', '#baz'], Arr::flatten($array)); <add> <add> // Deeply nested arrays are flattened <add> $array = [['#foo', ['#bar']], ['#baz']]; <add> $this->assertEquals(['#foo', '#bar', '#baz'], Arr::flatten($array)); <add> <add> // Nested collections are flattened alongside arrays <add> $array = [new Collection(['#foo', '#bar']), ['#baz']]; <add> $this->assertEquals(['#foo', '#bar', '#baz'], Arr::flatten($array)); <add> <add> // Nested collections containing plain arrays are flattened <add> $array = [new Collection(['#foo', ['#bar']]), ['#baz']]; <add> $this->assertEquals(['#foo', '#bar', '#baz'], Arr::flatten($array)); <add> <add> // Nested arrays containing collections are flattened <add> $array = [['#foo', new Collection(['#bar'])], ['#baz']]; <add> $this->assertEquals(['#foo', '#bar', '#baz'], Arr::flatten($array)); <add> <add> // Nested arrays containing collections containing arrays are flattened <add> $array = [['#foo', new Collection(['#bar', ['#zap']])], ['#baz']]; <add> $this->assertEquals(['#foo', '#bar', '#zap', '#baz'], Arr::flatten($array)); <add> } <add> <add> public function testFlattenWithDepth() <add> { <add> // No depth flattens recursively <add> $array = [['#foo', ['#bar', ['#baz']]], '#zap']; <add> $this->assertEquals(['#foo', '#bar', '#baz', '#zap'], Arr::flatten($array)); <add> <add> // Specifying a depth only flattens to that depth <add> $array = [['#foo', ['#bar', ['#baz']]], '#zap']; <add> $this->assertEquals(['#foo', ['#bar', ['#baz']], '#zap'], Arr::flatten($array, 1)); <add> <add> $array = [['#foo', ['#bar', ['#baz']]], '#zap']; <add> $this->assertEquals(['#foo', '#bar', ['#baz'], '#zap'], Arr::flatten($array, 2)); <ide> } <ide> <ide> public function testGet()
4
PHP
PHP
improve error message
63b392a26b2b4fc8d0936ad432491a273fc79dd7
<ide><path>lib/Cake/Routing/Router.php <ide> protected static function _validateRouteClass($routeClass) { <ide> $routeClass !== 'CakeRoute' && <ide> (!class_exists($routeClass) || !is_subclass_of($routeClass, 'CakeRoute')) <ide> ) { <del> throw new RouterException(__d('cake_dev', 'Route classes must extend CakeRoute')); <add> throw new RouterException(__d('cake_dev', 'Route class not found, or route class is not a subclass of CakeRoute')); <ide> } <ide> return $routeClass; <ide> }
1
PHP
PHP
add collection to $casts
e22171a44126d458d6e7f89a5ae38fbf15ae321c
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> protected function castAttribute($key, $value) <ide> case 'array': <ide> case 'json': <ide> return json_decode($value, true); <add> case 'collection': <add> return new Collection(json_decode($value, true)); <ide> default: <ide> return $value; <ide> }
1
Ruby
Ruby
use sandbox.formula? method
6375adc0ff00073740b49973aacfe81d4cd1099e
<ide><path>Library/Homebrew/formula_installer.rb <ide> def build <ide> #{formula.path} <ide> ].concat(build_argv) <ide> <del> if Sandbox.available? && ARGV.sandbox? <del> Sandbox.print_sandbox_message <del> end <add> Sandbox.print_sandbox_message if Sandbox.formula?(formula) <ide> <ide> Utils.safe_fork do <ide> # Invalidate the current sudo timestamp in case a build script calls sudo <ide> system "/usr/bin/sudo", "-k" <ide> <del> if Sandbox.available? && ARGV.sandbox? <add> if Sandbox.formula?(formula) <ide> sandbox = Sandbox.new <ide> formula.logs.mkpath <ide> sandbox.record_log(formula.logs/"sandbox.build.log")
1
Python
Python
add more tests for `np.kaiser`
e214496119f6b35819cebaa1562818d27b6c34fb
<ide><path>numpy/lib/tests/test_function_base.py <ide> def test_blackman(self, dtype: str, M: int) -> None: <ide> else: <ide> assert_almost_equal(np.sum(w, axis=0), 3.7800, 4) <ide> <add> def test_kaiser(self, dtype: str, M: int) -> None: <add> scalar = np.array(M, dtype=dtype)[()] <add> <add> w = kaiser(scalar, 0) <add> if dtype == "O": <add> ref_dtype = np.float64 <add> else: <add> ref_dtype = np.result_type(scalar.dtype, np.float64) <add> assert w.dtype == ref_dtype <add> <add> # check symmetry <add> assert_equal(w, flipud(w)) <add> <add> # check known value <add> if scalar < 1: <add> assert_array_equal(w, np.array([])) <add> elif scalar == 1: <add> assert_array_equal(w, np.ones(1)) <add> else: <add> assert_almost_equal(np.sum(w, axis=0), 10, 15) <add> <ide> <ide> class TestTrapz: <ide>
1
Python
Python
fix typo in glossary (resolves )
c63e99da8a15d8540bae20cabfecec9f3d8c30ae
<ide><path>spacy/glossary.py <ide> def explain(term): <ide> 'ADJA': 'adjective, attributive', <ide> 'ADJD': 'adjective, adverbial or predicative', <ide> 'APPO': 'postposition', <del> 'APRP': 'preposition; circumposition left', <add> 'APPR': 'preposition; circumposition left', <ide> 'APPRART': 'preposition with article', <ide> 'APZR': 'circumposition right', <ide> 'ART': 'definite or indefinite article',
1
Ruby
Ruby
use mocha for rescue tests
ba814a903386ce12ea5370f5c7df8ef9fb693612
<ide><path>actionpack/test/controller/rescue_test.rb <ide> require File.dirname(__FILE__) + '/../abstract_unit' <del>require 'flexmock' <add> <add># gem install mocha <add>require 'mocha' <ide> <ide> class RescueController < ActionController::Base <ide> def raises <ide> def raises <ide> <ide> <ide> class RescueTest < Test::Unit::TestCase <del> include FlexMock::TestCase <ide> FIXTURE_PUBLIC = "#{File.dirname(__FILE__)}/../fixtures".freeze <ide> <ide> def setup <ide> def setup <ide> <ide> <ide> def test_rescue_action_locally_if_all_requests_local <del> stub = flexstub(@controller) <del> stub.should_receive(:local_request?).and_return(true) <del> stub.should_receive(:rescue_action_locally).with(@exception).once <del> stub.should_receive(:rescue_action_in_public).never <add> @controller.expects(:local_request?).never <add> @controller.expects(:rescue_action_locally).with(@exception) <add> @controller.expects(:rescue_action_in_public).never <ide> <ide> with_all_requests_local do <ide> @controller.send :rescue_action, @exception <ide> end <ide> end <ide> <ide> def test_rescue_action_locally_if_remote_addr_is_localhost <del> stub = flexstub(@controller) <del> stub.should_receive(:local_request?).and_return(true) <del> stub.should_receive(:rescue_action_locally).with(@exception).once <del> stub.should_receive(:rescue_action_in_public).never <add> @controller.expects(:local_request?).returns(true) <add> @controller.expects(:rescue_action_locally).with(@exception) <add> @controller.expects(:rescue_action_in_public).never <ide> <ide> with_all_requests_local false do <ide> @controller.send :rescue_action, @exception <ide> end <ide> end <ide> <ide> def test_rescue_action_in_public_otherwise <del> stub = flexstub(@controller) <del> stub.should_receive(:local_request?).and_return(false) <del> stub.should_receive(:rescue_action_in_public).with(@exception).once <del> stub.should_receive(:rescue_action_locally).never <add> @controller.expects(:local_request?).returns(false) <add> @controller.expects(:rescue_action_locally).never <add> @controller.expects(:rescue_action_in_public).with(@exception) <ide> <ide> with_all_requests_local false do <ide> @controller.send :rescue_action, @exception <ide> def test_rescue_action_locally <ide> <ide> <ide> def test_local_request_when_remote_addr_is_localhost <del> flexstub(@controller).should_receive(:request).and_return(@request) <add> @controller.expects(:request).returns(@request).at_least_once <ide> with_remote_addr '127.0.0.1' do <ide> assert @controller.send(:local_request?) <ide> end <ide> end <ide> <ide> def test_local_request_when_remote_addr_isnt_locahost <del> flexstub(@controller).should_receive(:request).and_return(@request) <add> @controller.expects(:request).returns(@request) <ide> with_remote_addr '1.2.3.4' do <ide> assert !@controller.send(:local_request?) <ide> end
1
Javascript
Javascript
adjust tests after api changes
e460e6ae90e02b1d79a3f55404c788855b04e886
<ide><path>src/Redux.js <ide> export default class Redux { <ide> } <ide> <ide> subscribe(listener) { <del> this.listeners.push(listener); <add> const { listeners } = this; <add> listeners.push(listener); <ide> <ide> return function unsubscribe () { <del> const index = this.listeners.indexOf(listener); <del> this.listeners.splice(index, 1); <add> const index = listeners.indexOf(listener); <add> listeners.splice(index, 1); <ide> }; <ide> } <ide> } <ide><path>test/createDispatcher.spec.js <ide> import expect from 'expect'; <ide> import { createDispatcher, composeStores } from '../src'; <add>import thunkMiddleware from '../src/middleware/thunk'; <ide> <ide> const fakeState = { foo: 'bar' }; <ide> const fakeAction = { type: 'FOO', foo: 'bar' }; <ide> describe('createDispatcher', () => { <ide> <ide> it('should handle sync and async dispatches', done => { <ide> const spy = expect.createSpy(() => {}); <del> const dispatcher = createDispatcher(composeStores({ fakeStore })); <add> const dispatcher = createDispatcher( <add> composeStores({ fakeStore }), <add> getState => [thunkMiddleware(getState)]); <ide> expect(dispatcher).toBeA('function'); <ide> <ide> const dispatchFn = dispatcher(fakeState, spy); <ide><path>test/exports.spec.js <ide> describe('Redux', () => { <ide> <ide> it('should export necessary components', () => { <ide> const imports = Object.keys(redux); <del> expect(imports.length).toBe(8); <add> expect(imports.length).toBe(9); <ide> <ide> expect(imports).toContain('createRedux'); <ide> expect(imports).toContain('createDispatcher'); <ide> describe('Redux', () => { <ide> expect(imports).toContain('provide'); <ide> expect(imports).toContain('connect'); <ide> <add> expect(imports).toContain('compose'); <ide> expect(imports).toContain('composeStores'); <ide> expect(imports).toContain('bindActionCreators'); <ide> });
3
Ruby
Ruby
make internal class as nodoc
a558e5d8ba19a465f1606c82f36cab7680bc2b5d
<ide><path>activesupport/lib/active_support/logger_thread_safe_level.rb <ide> require 'active_support/concern' <ide> <ide> module ActiveSupport <del> module LoggerThreadSafeLevel <add> module LoggerThreadSafeLevel # :nodoc: <ide> extend ActiveSupport::Concern <ide> <ide> def after_initialize <del> @local_levels = Concurrent::Map.new(:initial_capacity => 2) <add> @local_levels = Concurrent::Map.new(initial_capacity: 2) <ide> end <ide> <ide> def local_log_id
1
Text
Text
add v4.9.0-beta.2 to changelog
d61d713c055be1cc2c9c916c46d83af75f9af1ab
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v4.9.0-beta.2 (October 25, 2022) <add>- [#20227](https://github.com/emberjs/ember.js/pull/20227) [BUGFIX] Fix unsafe internal cast for NativeArray <add>- [#20228](https://github.com/emberjs/ember.js/pull/20228) [BUGFIX] Remove type export for ControllerMixin <add> <ide> ### v4.9.0-beta.1 (October 17, 2022) <ide> <ide> - [#20203](https://github.com/emberjs/ember.js/pull/20203) / [#20204](https://github.com/emberjs/ember.js/pull/20204) [FEATURE] Preview types: Update to Typescript 4.8
1
Ruby
Ruby
remove usless comments
526299913fe757af28de9bad868635124b26e071
<ide><path>Library/Homebrew/diagnostic.rb <ide> def check_for_tap_ruby_files_locations <ide> def all <ide> methods.map(&:to_s).grep(/^check_/) <ide> end <del> end # end class Checks <add> end <ide> end <ide> end <ide> <ide><path>Library/Homebrew/language/python.rb <ide> def do_install(targets) <ide> "-v", "--no-deps", "--no-binary", ":all:", <ide> "--ignore-installed", *targets <ide> end <del> end # class Virtualenv <del> end # module Virtualenv <del> end # module Python <del>end # module Language <add> end <add> end <add> end <add>end
2
Python
Python
fix str representation for rank-0 arrays
f3a4e8ff8d76dbadd59d4d4e2efc359d3b2db091
<ide><path>numpy/core/numeric.py <ide> def array_repr(arr, max_line_width=None, precision=None, suppress_small=None): <ide> return cName + "(%s, dtype=%s)" % (lst, typename) <ide> <ide> def array_str(a, max_line_width=None, precision=None, suppress_small=None): <del> return array2string(a, max_line_width, precision, suppress_small, ' ', "") <add> return array2string(a, max_line_width, precision, suppress_small, ' ', "", str) <ide> <ide> set_string_function = multiarray.set_string_function <ide> set_string_function(array_str, 0)
1
Ruby
Ruby
update code comments
c75a8221a5115dc45634ece380266a8a63c0458d
<ide><path>Library/Homebrew/requirements/gpg2_requirement.rb <ide> class GPG2Requirement < Requirement <ide> fatal true <ide> default_formula "gnupg" <ide> <del> # GPGTools installs GnuPG 2.0.x as a vanilla `gpg` symlink <del> # pointing to `gpg2`. Homebrew install 2.1.x as a non-symlink `gpg`. <del> # We support both the 2.0.x "stable" and 2.1.x "modern" series here. <add> # GPGTools installs GnuPG 2.0.x as a `gpg` symlink pointing <add> # to `gpg2`. Our `gnupg` installs only a non-symlink `gpg`. <add> # The aim is to retain support for any version above 2.0. <ide> satisfy(build_env: false) { Gpg.gpg || Gpg.gpg2 } <ide> end
1
Javascript
Javascript
fix singlefile build target
04e2235ce7f9439b32b811329763f9aa60ee89a4
<ide><path>make.js <ide> target.bundle = function(args) { <ide> // We want shared_src_files in both pdf.js and pdf.worker.js <ide> // unless it's being built in singlefile mode. <ide> WORKER_SRC_FILES = SHARED_SRC_FILES.concat(WORKER_SRC_FILES); <add> } else { <add> // In singlefile mode, all of the src files will be bundled into <add> // the main pdf.js outuput. <add> MAIN_SRC_FILES = MAIN_SRC_FILES.concat(WORKER_SRC_FILES); <ide> } <ide> <ide> var EXT_SRC_FILES = [ <ide> target.singlefile = function() { <ide> cd(SINGLE_FILE_DIR); <ide> <ide> echo(); <del> echo('### Concatenating pdf.js and pdf.worker.js into pdf.combined.js'); <add> echo('### Moving pdf.js to pdf.combined.js'); <ide> var pdfJs = cat(BUILD_TARGET); <del> pdfJs += cat(BUILD_WORKER_TARGET); <ide> pdfJs.to(SINGLE_FILE_TARGET); <ide> <ide> rm(BUILD_TARGET);
1
Javascript
Javascript
expose enablebabelruntime config param externally
89a358f34786198c8a9a2d379588efd57b6a0eec
<ide><path>jest/preprocessor.js <ide> module.exports = { <ide> options: { <ide> ast: true, // needed for open source (?) https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c#r28647044 <ide> dev: true, <del> disableBabelRuntime: true, <add> enableBabelRuntime: false, <ide> experimentalImportSupport: false, <ide> hot: false, <ide> inlineRequires: true,
1
Python
Python
fix urlpatterns in test
6fa534f21475f4c9527b1181f8a427978ce1c085
<ide><path>tests/test_atomic_requests.py <ide> def get(self, request, *args, **kwargs): <ide> BasicModel.objects.all() <ide> raise Http404 <ide> <del> return patterns( <del> '', <del> url(r'^$', NonAtomicAPIExceptionView.as_view()) <add> return ( <add> url(r'^$', NonAtomicAPIExceptionView.as_view()), <ide> ) <ide> <ide> def setUp(self):
1
Ruby
Ruby
swallow bundler exceptions when running tests
48b3257582830206b93817e4f519e0b2fe4f9dee
<ide><path>railties/test/generators/shared_generator_tests.rb <ide> def test_shebang_when_is_the_same_as_default_use_env <ide> end <ide> <ide> def test_template_raises_an_error_with_invalid_path <del> content = capture(:stderr){ run_generator([destination_root, "-m", "non/existent/path"]) } <del> assert_match(/The template \[.*\] could not be loaded/, content) <del> assert_match(/non\/existent\/path/, content) <add> quietly do <add> content = capture(:stderr){ run_generator([destination_root, "-m", "non/existent/path"]) } <add> <add> assert_match(/The template \[.*\] could not be loaded/, content) <add> assert_match(/non\/existent\/path/, content) <add> end <ide> end <ide> <ide> def test_template_is_executed_when_supplied <ide> def test_template_is_executed_when_supplied <ide> template.instance_eval "def read; self; end" # Make the string respond to read <ide> <ide> generator([destination_root], template: path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) <del> assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) <add> quietly { assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) } <ide> end <ide> <ide> def test_template_is_executed_when_supplied_an_https_path <ide> def test_template_is_executed_when_supplied_an_https_path <ide> template.instance_eval "def read; self; end" # Make the string respond to read <ide> <ide> generator([destination_root], template: path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) <del> assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) <add> quietly { assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) } <ide> end <ide> <ide> def test_dev_option
1
Python
Python
avoid dnn import when not running on gpu
f3eeb982d0e4858a333246430833b1087d446f5a
<ide><path>keras/layers/convolutional.py <ide> <ide> import theano <ide> import theano.tensor as T <del>from theano.sandbox.cuda import dnn <add>if theano.config.device[:3] == 'gpu': <add> from theano.sandbox.cuda import dnn <ide> <ide> from .. import activations, initializations, regularizers, constraints <ide> from ..utils.theano_utils import shared_zeros
1
Go
Go
reject scope settings in config-only network
bf98dc6a401ed78fb6a24ade8e95a8a5f06d54d7
<ide><path>libnetwork/network.go <ide> func (n *network) validateConfiguration() error { <ide> if n.configOnly { <ide> // Only supports network specific configurations. <ide> // Network operator configurations are not supported. <del> if n.ingress || n.internal || n.attachable { <add> if n.ingress || n.internal || n.attachable || n.scope != "" { <ide> return types.ForbiddenErrorf("configuration network can only contain network " + <ide> "specific fields. Network operator fields like " + <del> "[ ingress | internal | attachable ] are not supported.") <add> "[ ingress | internal | attachable | scope ] are not supported.") <ide> } <ide> } <ide> if n.configFrom != "" {
1
Javascript
Javascript
improve performance of limitchunkcountplugin a lot
6f1c6850714e11240effa4f870aa31d60389eb6d
<ide><path>lib/Chunk.js <ide> class Chunk { <ide> /** <ide> * <ide> * @param {Chunk} otherChunk the chunk to integrate with <del> * @param {ModuleReason} reason reason why the module is being integrated <add> * @param {string} reason reason why the module is being integrated <ide> * @returns {boolean} returns true or false if integration succeeds or fails <ide> */ <ide> integrate(otherChunk, reason) { <ide> class Chunk { <ide> return false; <ide> } <ide> <add> /** <add> * @param {Chunk} a chunk <add> * @param {Chunk} b chunk <add> * @returns {boolean} true, if a is always available when b is reached <add> */ <ide> const isAvailable = (a, b) => { <ide> const queue = new Set(b.groupsIterable); <ide> for (const chunkGroup of queue) { <ide><path>lib/optimize/LimitChunkCountPlugin.js <ide> <ide> const validateOptions = require("schema-utils"); <ide> const schema = require("../../schemas/plugins/optimize/LimitChunkCountPlugin.json"); <add>const LazyBucketSortedSet = require("../util/LazyBucketSortedSet"); <ide> <ide> /** @typedef {import("../../declarations/plugins/optimize/LimitChunkCountPlugin").LimitChunkCountPluginOptions} LimitChunkCountPluginOptions */ <add>/** @typedef {import("../Chunk")} Chunk */ <add>/** @typedef {import("../Compiler")} Compiler */ <add> <add>/** <add> * @typedef {Object} ChunkCombination <add> * @property {boolean} deleted this is set to true when combination was removed <add> * @property {number} sizeDiff <add> * @property {number} integratedSize <add> * @property {Chunk} a <add> * @property {Chunk} b <add> * @property {number} aIdx <add> * @property {number} bIdx <add> * @property {number} aSize <add> * @property {number} bSize <add> */ <add> <add>const addToSetMap = (map, key, value) => { <add> const set = map.get(key); <add> if (set === undefined) { <add> map.set(key, new Set([value])); <add> } else { <add> set.add(value); <add> } <add>}; <ide> <ide> class LimitChunkCountPlugin { <ide> /** <ide> class LimitChunkCountPlugin { <ide> validateOptions(schema, options, "Limit Chunk Count Plugin"); <ide> this.options = options; <ide> } <add> <add> /** <add> * @param {Compiler} compiler the webpack compiler <add> * @returns {void} <add> */ <ide> apply(compiler) { <ide> const options = this.options; <ide> compiler.hooks.compilation.tap("LimitChunkCountPlugin", compilation => { <ide> class LimitChunkCountPlugin { <ide> if (maxChunks < 1) return; <ide> if (chunks.length <= maxChunks) return; <ide> <add> let remainingChunksToMerge = chunks.length - maxChunks; <add> <add> // order chunks in a deterministic way <ide> const orderedChunks = chunks.slice().sort((a, b) => a.compareTo(b)); <ide> <del> const sortedExtendedPairCombinations = orderedChunks <del> .reduce((combinations, a, idx) => { <del> // create combination pairs <del> for (let i = 0; i < idx; i++) { <del> const b = orderedChunks[i]; <del> combinations.push([b, a]); <del> } <del> return combinations; <del> }, []) <del> .map(pair => { <del> // extend combination pairs with size and integrated size <del> const a = pair[0].size(options); <del> const b = pair[1].size(options); <del> const ab = pair[0].integratedSize(pair[1], options); <del> return [a + b - ab, ab, pair[0], pair[1], a, b]; <del> }) <del> .filter(extendedPair => { <add> // create a lazy sorted data structure to keep all combinations <add> // this is large. Size = chunks * (chunks - 1) / 2 <add> // It uses a multi layer bucket sort plus normal sort in the last layer <add> // It's also lazy so only accessed buckets are sorted <add> const combinations = new LazyBucketSortedSet( <add> // Layer 1: ordered by largest size benefit <add> c => c.sizeDiff, <add> (a, b) => b - a, <add> // Layer 2: ordered by smallest combined size <add> c => c.integratedSize, <add> (a, b) => a - b, <add> // Layer 3: ordered by position difference in orderedChunk (-> to be deterministic) <add> c => c.bIdx - c.aIdx, <add> (a, b) => a - b, <add> // Layer 4: ordered by position in orderedChunk (-> to be deterministic) <add> (a, b) => a.bIdx - b.bIdx <add> ); <add> <add> // we keep a mappng from chunk to all combinations <add> // but this mapping is not kept up-to-date with deletions <add> // so `deleted` flag need to be considered when iterating this <add> /** @type {Map<Chunk, Set<ChunkCombination>>} */ <add> const combinationsByChunk = new Map(); <add> <add> orderedChunks.forEach((b, bIdx) => { <add> // create combination pairs with size and integrated size <add> for (let aIdx = 0; aIdx < bIdx; aIdx++) { <add> const a = orderedChunks[aIdx]; <add> const integratedSize = a.integratedSize(b, options); <add> <ide> // filter pairs that do not have an integratedSize <ide> // meaning they can NOT be integrated! <del> return extendedPair[1] !== false; <del> }) <del> .sort((a, b) => { <del> // sadly javascript does an inplace sort here <del> // sort them by size <del> const diff1 = b[0] - a[0]; <del> if (diff1 !== 0) return diff1; <del> const diff2 = a[1] - b[1]; <del> if (diff2 !== 0) return diff2; <del> const diff3 = a[2].compareTo(b[2]); <del> if (diff3 !== 0) return diff3; <del> return a[3].compareTo(b[3]); <del> }); <del> <del> const pair = sortedExtendedPairCombinations[0]; <del> <del> if (pair && pair[2].integrate(pair[3], "limit")) { <del> chunks.splice(chunks.indexOf(pair[3]), 1); <del> return true; <add> if (integratedSize === false) continue; <add> <add> const aSize = a.size(options); <add> const bSize = b.size(options); <add> const c = { <add> deleted: false, <add> sizeDiff: aSize + bSize - integratedSize, <add> integratedSize, <add> a, <add> b, <add> aIdx, <add> bIdx, <add> aSize, <add> bSize <add> }; <add> combinations.add(c); <add> addToSetMap(combinationsByChunk, a, c); <add> addToSetMap(combinationsByChunk, b, c); <add> } <add> return combinations; <add> }); <add> <add> // list of modified chunks during this run <add> // combinations affected by this change are skipped to allow <add> // futher optimizations <add> /** @type {Set<Chunk>} */ <add> const modifiedChunks = new Set(); <add> <add> let changed = false; <add> // eslint-disable-next-line no-constant-condition <add> loop: while (true) { <add> const combination = combinations.popFirst(); <add> if (combination === undefined) break; <add> <add> combination.deleted = true; <add> const { a, b, integratedSize } = combination; <add> <add> // skip over pair when <add> // one of the already merged chunks is a parent of one of the chunks <add> if (modifiedChunks.size > 0) { <add> const queue = new Set(a.groupsIterable); <add> for (const group of b.groupsIterable) { <add> queue.add(group); <add> } <add> for (const group of queue) { <add> for (const mChunk of modifiedChunks) { <add> if (mChunk !== a && mChunk !== b && mChunk.isInGroup(group)) { <add> // This is a potential pair which needs recalculation <add> // We can't do that now, but it merge before following pairs <add> // so we leave space for it, and consider chunks as modified <add> // just for the worse case <add> remainingChunksToMerge--; <add> if (remainingChunksToMerge <= 0) break loop; <add> modifiedChunks.add(a); <add> modifiedChunks.add(b); <add> continue loop; <add> } <add> } <add> for (const parent of group.parentsIterable) { <add> queue.add(parent); <add> } <add> } <add> } <add> <add> // merge the chunks <add> if (a.integrate(b, "limit")) { <add> chunks.splice(chunks.indexOf(b), 1); <add> <add> // flag chunk a as modified as further optimization are possible for all children here <add> modifiedChunks.add(a); <add> <add> changed = true; <add> remainingChunksToMerge--; <add> if (remainingChunksToMerge <= 0) break; <add> <add> // Update all affected combinations <add> // delete all combination with the removed chunk <add> // we will use combinations with the kept chunk instead <add> for (const combination of combinationsByChunk.get(b)) { <add> if (combination.deleted) continue; <add> combination.deleted = true; <add> combinations.delete(combination); <add> } <add> <add> // Update combinations with the kept chunk with new sizes <add> for (const combination of combinationsByChunk.get(a)) { <add> if (combination.deleted) continue; <add> if (combination.a === a) { <add> // Update size <add> const newIntegratedSize = a.integratedSize( <add> combination.b, <add> options <add> ); <add> if (newIntegratedSize === false) { <add> combination.deleted = true; <add> combinations.delete(combination); <add> continue; <add> } <add> const finishUpdate = combinations.startUpdate(combination); <add> combination.integratedSize = newIntegratedSize; <add> combination.aSize = integratedSize; <add> combination.sizeDiff = <add> combination.bSize + integratedSize - newIntegratedSize; <add> finishUpdate(); <add> } else if (combination.b === a) { <add> // Update size <add> const newIntegratedSize = combination.a.integratedSize( <add> a, <add> options <add> ); <add> if (newIntegratedSize === false) { <add> combination.deleted = true; <add> combinations.delete(combination); <add> continue; <add> } <add> const finishUpdate = combinations.startUpdate(combination); <add> combination.integratedSize = newIntegratedSize; <add> combination.bSize = integratedSize; <add> combination.sizeDiff = <add> integratedSize + combination.aSize - newIntegratedSize; <add> finishUpdate(); <add> } <add> } <add> } <ide> } <add> if (changed) return true; <ide> } <ide> ); <ide> }); <ide><path>lib/util/LazyBucketSortedSet.js <add>/* <add> MIT License http://www.opensource.org/licenses/mit-license.php <add> Author Tobias Koppers @sokra <add>*/ <add> <add>"use strict"; <add> <add>const SortableSet = require("./SortableSet"); <add> <add>/** <add> * @template T <add> * @template K <add> * Multi layer bucket sorted set <add> * Supports adding non-existing items (DO NOT ADD ITEM TWICE) <add> * Supports removing exiting items (DO NOT REMOVE ITEM NOT IN SET) <add> * Supports popping the first items according to defined order <add> * Supports iterating all items without order <add> * Supports updating an item in an efficient way <add> * Supports size property, which is the number of items <add> * Items are lazy partially sorted when needed <add> */ <add>class LazyBucketSortedSet { <add> /** <add> * @param {function(T): K} getKey function to get key from item <add> * @param {function(K, K): number} comparator comparator to sort keys <add> * @param {...((function(T): any) | (function(any, any): number))} args more pairs of getKey and comparator plus optional final comparator for the last layer <add> */ <add> constructor(getKey, comparator, ...args) { <add> this._getKey = getKey; <add> this._innerArgs = args; <add> this._leaf = args.length <= 1; <add> this._keys = new SortableSet(undefined, comparator); <add> /** @type {Map<K, LazyBucketSortedSet<T, any> | SortableSet<T>>} */ <add> this._map = new Map(); <add> this._unsortedItems = new Set(); <add> this.size = 0; <add> } <add> <add> /** <add> * @param {T} item an item <add> * @returns {void} <add> */ <add> add(item) { <add> this.size++; <add> this._unsortedItems.add(item); <add> } <add> <add> /** <add> * @param {K} key key of item <add> * @param {T} item the item <add> * @returns {void} <add> */ <add> _addInternal(key, item) { <add> let entry = this._map.get(key); <add> if (entry === undefined) { <add> entry = this._leaf <add> ? new SortableSet(undefined, this._innerArgs[0]) <add> : new /** @type {any} */ (LazyBucketSortedSet)(...this._innerArgs); <add> this._keys.add(key); <add> this._map.set(key, entry); <add> } <add> entry.add(item); <add> } <add> <add> /** <add> * @param {T} item an item <add> * @returns {void} <add> */ <add> delete(item) { <add> this.size--; <add> if (this._unsortedItems.has(item)) { <add> this._unsortedItems.delete(item); <add> return; <add> } <add> const key = this._getKey(item); <add> const entry = this._map.get(key); <add> entry.delete(item); <add> if (entry.size === 0) { <add> this._deleteKey(key); <add> } <add> } <add> <add> /** <add> * @param {K} key key to be removed <add> * @returns {void} <add> */ <add> _deleteKey(key) { <add> this._keys.delete(key); <add> this._map.delete(key); <add> } <add> <add> /** <add> * @returns {T | undefined} an item <add> */ <add> popFirst() { <add> if (this.size === 0) return undefined; <add> this.size--; <add> if (this._unsortedItems.size > 0) { <add> for (const item of this._unsortedItems) { <add> const key = this._getKey(item); <add> this._addInternal(key, item); <add> } <add> this._unsortedItems.clear(); <add> } <add> this._keys.sort(); <add> const key = this._keys.values().next().value; <add> const entry = this._map.get(key); <add> if (this._leaf) { <add> const leafEntry = /** @type {SortableSet<T>} */ (entry); <add> leafEntry.sort(); <add> const item = leafEntry.values().next().value; <add> leafEntry.delete(item); <add> if (leafEntry.size === 0) { <add> this._deleteKey(key); <add> } <add> return item; <add> } else { <add> const nodeEntry = /** @type {LazyBucketSortedSet<T, any>} */ (entry); <add> const item = nodeEntry.popFirst(); <add> if (nodeEntry.size === 0) { <add> this._deleteKey(key); <add> } <add> return item; <add> } <add> } <add> <add> /** <add> * @param {T} item to be updated item <add> * @returns {function(true=): void} finish update <add> */ <add> startUpdate(item) { <add> if (this._unsortedItems.has(item)) { <add> return remove => { <add> if (remove) { <add> this._unsortedItems.delete(item); <add> this.size--; <add> return; <add> } <add> }; <add> } <add> const key = this._getKey(item); <add> if (this._leaf) { <add> const oldEntry = /** @type {SortableSet<T>} */ (this._map.get(key)); <add> return remove => { <add> if (remove) { <add> this.size--; <add> oldEntry.delete(item); <add> if (oldEntry.size === 0) { <add> this._deleteKey(key); <add> } <add> return; <add> } <add> const newKey = this._getKey(item); <add> if (key === newKey) { <add> // This flags the sortable set as unordered <add> oldEntry.add(item); <add> } else { <add> oldEntry.delete(item); <add> if (oldEntry.size === 0) { <add> this._deleteKey(key); <add> } <add> this._addInternal(newKey, item); <add> } <add> }; <add> } else { <add> const oldEntry = /** @type {LazyBucketSortedSet<T, any>} */ (this._map.get( <add> key <add> )); <add> const finishUpdate = oldEntry.startUpdate(item); <add> return remove => { <add> if (remove) { <add> this.size--; <add> finishUpdate(true); <add> if (oldEntry.size === 0) { <add> this._deleteKey(key); <add> } <add> return; <add> } <add> const newKey = this._getKey(item); <add> if (key === newKey) { <add> finishUpdate(); <add> } else { <add> finishUpdate(true); <add> if (oldEntry.size === 0) { <add> this._deleteKey(key); <add> } <add> this._addInternal(newKey, item); <add> } <add> }; <add> } <add> } <add> <add> /** <add> * @param {Iterator<T>[]} iterators list of iterators to append to <add> * @returns {void} <add> */ <add> _appendIterators(iterators) { <add> if (this._unsortedItems.size > 0) <add> iterators.push(this._unsortedItems[Symbol.iterator]()); <add> for (const key of this._keys) { <add> const entry = this._map.get(key); <add> if (this._leaf) { <add> const leafEntry = /** @type {SortableSet<T>} */ (entry); <add> const iterator = leafEntry[Symbol.iterator](); <add> iterators.push(iterator); <add> } else { <add> const nodeEntry = /** @type {LazyBucketSortedSet<T, any>} */ (entry); <add> nodeEntry._appendIterators(iterators); <add> } <add> } <add> } <add> <add> /** <add> * @returns {Iterator<T>} the iterator <add> */ <add> [Symbol.iterator]() { <add> const iterators = []; <add> this._appendIterators(iterators); <add> iterators.reverse(); <add> let currentIterator = iterators.pop(); <add> return { <add> next: () => { <add> const res = currentIterator.next(); <add> if (res.done) { <add> if (iterators.length === 0) return res; <add> currentIterator = iterators.pop(); <add> return currentIterator.next(); <add> } <add> return res; <add> } <add> }; <add> } <add>} <add> <add>module.exports = LazyBucketSortedSet;
3
Text
Text
add communications links
4a41496163eb852abebb81b3cafa1ef818dfd803
<ide><path>README.md <ide> Learn more about Rx on the <a href="https://github.com/Netflix/RxJava/wiki">Wiki <ide> <ide> <a href='https://netflixoss.ci.cloudbees.com/job/RxJava-pull-requests/'><img src='https://netflixoss.ci.cloudbees.com/job/RxJava-pull-requests/badge/icon'></a> <ide> <add>## Communication <add> <add>- Google Group: [RxJava](http://groups.google.com/d/forum/rxjava) <add>- Twitter: [@RxJava](http://twitter.com/RxJava) <add>- [GitHub Issues](https://github.com/Netflix/RxJava/issues) <add> <ide> ## Versioning <ide> <ide> RxJava is working towards a 1.0 release which will be reached once it "more or less" becomes feature complete with the [Rx.Net version](https://rx.codeplex.com). The backlog of features needed to accomplish this are documented in the [project issues](https://github.com/Netflix/RxJava/issues).
1
Ruby
Ruby
use utils.git_available? instead of git?
c8efb058267b3500ee5c40ebf58de3feea8841a5
<ide><path>Library/Homebrew/cmd/doctor.rb <ide> def find_relative_paths(*relative_paths) <ide> def inject_file_list(list, str) <ide> list.inject(str) { |s, f| s << " #{f}\n" } <ide> end <del> <del> # Git will always be on PATH because of the wrapper script in <del> # Library/ENV/scm, so we check if there is a *real* <del> # git here to avoid multiple warnings. <del> def git? <del> return @git if instance_variable_defined?(:@git) <del> @git = system "git --version >/dev/null 2>&1" <del> end <ide> ############# END HELPERS <ide> <ide> # Sorry for the lack of an indent here, the diff would have been unreadable. <ide> def __check_git_version <ide> end <ide> <ide> def check_for_git <del> if git? <add> if Utils.git_available? <ide> __check_git_version <ide> else <<-EOS.undent <ide> Git could not be found in your PATH. <ide> def check_for_git <ide> end <ide> <ide> def check_git_newline_settings <del> return unless git? <add> return unless Utils.git_available? <ide> <ide> autocrlf = `git config --get core.autocrlf`.chomp <ide> <ide> def check_git_newline_settings <ide> end <ide> <ide> def check_git_origin <del> return unless git? && (HOMEBREW_REPOSITORY/".git").exist? <add> return if !Utils.git_available? || !(HOMEBREW_REPOSITORY/".git").exist? <ide> <ide> origin = Homebrew.git_origin <ide> <ide> def check_missing_deps <ide> end <ide> <ide> def check_git_status <del> return unless git? <add> return unless Utils.git_available? <ide> HOMEBREW_REPOSITORY.cd do <ide> unless `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.chomp.empty? <ide> <<-EOS.undent_________________________________________________________72 <ide> def check_for_pydistutils_cfg_in_home <ide> end <ide> <ide> def check_for_outdated_homebrew <del> return unless git? <add> return unless Utils.git_available? <ide> HOMEBREW_REPOSITORY.cd do <ide> if File.directory? ".git" <ide> local = `git rev-parse -q --verify refs/remotes/origin/master`.chomp <ide><path>Library/Homebrew/utils/git.rb <ide> module Utils <ide> def self.git_available? <ide> return @git if instance_variable_defined?(:@git) <del> git = which("git") <add> # check git in original path in case it's the wrapper script of Library/ENV/scm <add> git = which("git", ORIGINAL_PATHS.join(File::PATH_SEPARATOR)) <ide> # git isn't installed by older Xcodes <ide> return @git = false if git.nil? <ide> # /usr/bin/git is a popup stub when Xcode/CLT aren't installed, so bail out
2
Python
Python
fix broken format string in debug messages
65fc555f76bbc17be3291ba6b8bb41adb7f48810
<ide><path>glances/plugins/glances_ip.py <ide> def update(self): <ide> self.stats['mask_cidr'] = self.ip_to_cidr(self.stats['mask']) <ide> self.stats['gateway'] = netifaces.gateways()['default'][netifaces.AF_INET][0] <ide> except (KeyError, AttributeError) as e: <del> logger.debug("Can not grab IP information (%s)".format(e)) <del> <add> logger.debug("Cannot grab IP information: {0}".format(e)) <ide> elif self.input_method == 'snmp': <ide> # Not implemented yet <ide> pass <ide><path>glances/plugins/glances_plugin.py <ide> def init_stats_history(self): <ide> ret = None <ide> if self.args is not None and self.args.enable_history and self.get_items_history_list() is not None: <ide> init_list = [i['name'] for i in self.get_items_history_list()] <del> logger.debug("Stats history activated for plugin {0} (items: {0})".format( <del> self.plugin_name, init_list)) <add> logger.debug("Stats history activated for plugin {0} (items: {1})".format(self.plugin_name, init_list)) <ide> ret = {} <ide> return ret <ide> <ide> def reset_stats_history(self): <ide> """Reset the stats history (dict of list).""" <ide> if self.args is not None and self.args.enable_history and self.get_items_history_list() is not None: <ide> reset_list = [i['name'] for i in self.get_items_history_list()] <del> logger.debug("Reset history for plugin {0} (items: {0})".format( <del> self.plugin_name, reset_list)) <add> logger.debug("Reset history for plugin {0} (items: {1})".format(self.plugin_name, reset_list)) <ide> self.stats_history = {} <ide> <ide> def update_stats_history(self, item_name=''):
2
Javascript
Javascript
correct variable declaration
028f0e672a611339357484e1c9be1e7d51097004
<ide><path>packages/ember-runtime/lib/computed/reduce_computed_macros.js <ide> function propertySort(itemsKey, sortPropertiesKey) { <ide> this.notifyPropertyChange(key); <ide> } <ide> <add> let itemsKeyIsAtThis = (itemsKey === '@this'); <ide> let normalizedSortProperties = normalizeSortProperties(sortProperties); <ide> activeObservers = normalizedSortProperties.map(([prop]) => { <ide> let path = itemsKeyIsAtThis ? `@each.${prop}` : `${itemsKey}.@each.${prop}`; <ide> function propertySort(itemsKey, sortPropertiesKey) { <ide> <ide> activeObserversMap.set(this, activeObservers); <ide> <del> let itemsKeyIsAtThis = (itemsKey === '@this'); <ide> let items = itemsKeyIsAtThis ? this : get(this, itemsKey); <ide> if (!isArray(items)) { return emberA(); } <ide>
1
Go
Go
use containerd api to get version
fec2b144feaaa18998ec2ed34c9bc843c4c29abd
<ide><path>daemon/info_unix.go <ide> package daemon <ide> <ide> import ( <add> "context" <ide> "os/exec" <ide> "strings" <ide> <ide> func (daemon *Daemon) FillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo) <ide> } <ide> <ide> v.ContainerdCommit.Expected = dockerversion.ContainerdCommitID <del> if rv, err := exec.Command("docker-containerd", "--version").Output(); err == nil { <del> parts := strings.Split(strings.TrimSpace(string(rv)), " ") <del> if len(parts) == 3 { <del> v.ContainerdCommit.ID = parts[2] <del> } <del> switch { <del> case v.ContainerdCommit.ID == "": <del> logrus.Warnf("failed to retrieve docker-containerd version: unknown format", string(rv)) <del> v.ContainerdCommit.ID = "N/A" <del> case strings.HasSuffix(v.ContainerdCommit.ID, "-g"+v.ContainerdCommit.ID[len(v.ContainerdCommit.ID)-7:]): <del> v.ContainerdCommit.ID = v.ContainerdCommit.Expected <del> } <add> if rv, err := daemon.containerd.Version(context.Background()); err == nil { <add> v.ContainerdCommit.ID = rv.Revision <ide> } else { <del> logrus.Warnf("failed to retrieve docker-containerd version: %v", err) <add> logrus.Warnf("failed to retrieve containerd version: %v", err) <ide> v.ContainerdCommit.ID = "N/A" <ide> } <ide> <ide><path>libcontainerd/client_daemon.go <ide> type client struct { <ide> containers map[string]*container <ide> } <ide> <add>func (c *client) Version(ctx context.Context) (containerd.Version, error) { <add> return c.remote.Version(ctx) <add>} <add> <ide> func (c *client) Restore(ctx context.Context, id string, attachStdio StdioCallback) (alive bool, pid int, err error) { <ide> c.Lock() <ide> defer c.Unlock() <ide><path>libcontainerd/client_local_windows.go <ide> import ( <ide> <ide> "github.com/Microsoft/hcsshim" <ide> opengcs "github.com/Microsoft/opengcs/client" <add> "github.com/containerd/containerd" <ide> "github.com/docker/docker/pkg/sysinfo" <ide> "github.com/docker/docker/pkg/system" <ide> specs "github.com/opencontainers/runtime-spec/specs-go" <ide> const ( <ide> // of docker. <ide> const defaultOwner = "docker" <ide> <add>func (c *client) Version(ctx context.Context) (containerd.Version, error) { <add> return containerd.Version{}, errors.New("not implemented on Windows") <add>} <add> <ide> // Create is the entrypoint to create a container from a spec. <ide> // Table below shows the fields required for HCS JSON calling parameters, <ide> // where if not populated, is omitted. <ide><path>libcontainerd/types.go <ide> type Backend interface { <ide> <ide> // Client provides access to containerd features. <ide> type Client interface { <add> Version(ctx context.Context) (containerd.Version, error) <add> <ide> Restore(ctx context.Context, containerID string, attachStdio StdioCallback) (alive bool, pid int, err error) <ide> <ide> Create(ctx context.Context, containerID string, spec *specs.Spec, runtimeOptions interface{}) error
4
Ruby
Ruby
fix links [ci skip]
398e4fecde6f8b3263cc7c04face664c248d3966
<ide><path>activestorage/lib/active_storage/analyzer/image_analyzer.rb <ide> module ActiveStorage <ide> # ActiveStorage::Analyzer::ImageAnalyzer.new(blob).metadata <ide> # # => { width: 4104, height: 2736 } <ide> # <del> # This analyzer relies on the third-party [MiniMagick]{https://github.com/minimagick/minimagick} gem. MiniMagick requires <del> # the [ImageMagick]{http://www.imagemagick.org} system library. These libraries are not provided by Rails; you must <add> # This analyzer relies on the third-party {MiniMagick}[https://github.com/minimagick/minimagick] gem. MiniMagick requires <add> # the {ImageMagick}[http://www.imagemagick.org] system library. These libraries are not provided by Rails; you must <ide> # install them yourself to use this analyzer. <ide> class Analyzer::ImageAnalyzer < Analyzer <ide> def self.accept?(blob)
1
Javascript
Javascript
fix bypassnode without .value
836e363c07cf59b759b907d4fbf4b4529bc2dcaf
<ide><path>examples/js/nodes/core/BypassNode.js <ide> THREE.BypassNode.prototype.nodeType = "Bypass"; <ide> <ide> THREE.BypassNode.prototype.getType = function ( builder ) { <ide> <del> return this.value ? this.value.getType( builder ) : 'void'; <add> if ( this.value ) { <add> <add> return this.value.getType( builder ); <add> <add> } else if (builder.isShader( 'fragment' )) { <add> <add> return 'fv1'; <add> <add> } <add> <add> return 'void'; <ide> <ide> }; <ide> <ide> THREE.BypassNode.prototype.generate = function ( builder, output ) { <ide> <ide> var code = this.code.build( builder, output ) + ';'; <ide> <del> if ( builder.isShader( 'fragment' ) ) { <add> if ( builder.isShader( 'vertex' ) ) { <ide> <del> builder.material.addFragmentNode( code ); <add> builder.material.addVertexNode( code ); <add> <add> if (this.value) { <add> <add> return this.value.build( builder, output ); <add> <add> } <ide> <ide> } else { <ide> <del> builder.material.addVertexNode( code ); <del> <del> } <del> <del> if (this.value) { <add> builder.material.addFragmentNode( code ); <ide> <del> return this.value.build( builder, output ); <add> return this.value ? this.value.build( builder, output ) : builder.format( '0.0', 'fv1', output ); <ide> <ide> } <ide>
1
Javascript
Javascript
remove reference to `_rendernode`
6d4302f12c0b7aae7913089ea5a9668fa30cf2e9
<ide><path>packages/ember-views/lib/views/core_view.js <ide> const CoreView = EmberObject.extend(Evented, ActionHandler, { <ide> this._state = 'preRender'; <ide> this._currentState = this._states.preRender; <ide> this._willInsert = false; <del> this._renderNode = null; <ide> this.lastResult = null; <ide> this._destroyingSubtreeForView = null; <ide> this._isDispatchingAttrs = false;
1
PHP
PHP
fix mysql multiple-table delete error
d54500eb013d23ada07b563420e55e3712ef88ae
<ide><path>src/Illuminate/Database/Query/Grammars/MySqlGrammar.php <ide> public function compileDelete(Builder $query) <ide> $sql = trim("delete $table from {$table}{$joins} $where"); <ide> } else { <ide> $sql = trim("delete from $table $where"); <del> } <ide> <del> if (isset($query->orders)) { <del> $sql .= ' '.$this->compileOrders($query, $query->orders); <del> } <add> if (isset($query->orders)) { <add> $sql .= ' '.$this->compileOrders($query, $query->orders); <add> } <ide> <del> if (isset($query->limit)) { <del> $sql .= ' '.$this->compileLimit($query, $query->limit); <add> if (isset($query->limit)) { <add> $sql .= ' '.$this->compileLimit($query, $query->limit); <add> } <ide> } <ide> <ide> return $sql; <ide><path>tests/Database/DatabaseQueryBuilderTest.php <ide> public function testDeleteMethod() <ide> $builder->getConnection()->shouldReceive('delete')->once()->with('delete from "users" where "id" = ?', [1])->andReturn(1); <ide> $result = $builder->from('users')->delete(1); <ide> $this->assertEquals(1, $result); <add> <add> $builder = $this->getMySqlBuilder(); <add> $builder->getConnection()->shouldReceive('delete')->once()->with('delete from `users` where `email` = ? order by `id` asc limit 1', ['foo'])->andReturn(1); <add> $result = $builder->from('users')->where('email', '=', 'foo')->orderBy('id')->take(1)->delete(); <add> $this->assertEquals(1, $result); <ide> } <ide> <ide> public function testDeleteWithJoinMethod() <ide> { <ide> $builder = $this->getMySqlBuilder(); <ide> $builder->getConnection()->shouldReceive('delete')->once()->with('delete `users` from `users` inner join `contacts` on `users`.`id` = `contacts`.`id` where `email` = ?', ['foo'])->andReturn(1); <del> $result = $builder->from('users')->join('contacts', 'users.id', '=', 'contacts.id')->where('email', '=', 'foo')->delete(); <add> $result = $builder->from('users')->join('contacts', 'users.id', '=', 'contacts.id')->where('email', '=', 'foo')->orderBy('id')->limit(1)->delete(); <ide> $this->assertEquals(1, $result); <ide> <ide> $builder = $this->getMySqlBuilder(); <ide> $builder->getConnection()->shouldReceive('delete')->once()->with('delete `users` from `users` inner join `contacts` on `users`.`id` = `contacts`.`id` where `id` = ?', [1])->andReturn(1); <del> $result = $builder->from('users')->join('contacts', 'users.id', '=', 'contacts.id')->delete(1); <add> $result = $builder->from('users')->join('contacts', 'users.id', '=', 'contacts.id')->orderBy('id')->take(1)->delete(1); <ide> $this->assertEquals(1, $result); <ide> } <ide>
2
Text
Text
fix anchors and subtitle in building.md
359f590b8da55e54b78f65857df6bb1bcef2d352
<ide><path>BUILDING.md <ide> file a new issue. <ide> * [Unix and macOS](#unix-and-macos) <ide> * [Unix prerequisites](#unix-prerequisites) <ide> * [macOS prerequisites](#macos-prerequisites) <del> * [Building Node.js](#building-nodejs) <add> * [Building Node.js](#building-nodejs-1) <ide> * [Running Tests](#running-tests) <ide> * [Running Coverage](#running-coverage) <ide> * [Building the documentation](#building-the-documentation) <ide> * [Building a debug build](#building-a-debug-build) <ide> * [Windows](#windows) <ide> * [Prerequisites](#prerequisites) <ide> * [Option 1: Manual install](#option-1-manual-install) <del> * [Option 1: Automated install with Boxstarter](#option-1-automated-install-with-boxstarter) <add> * [Option 2: Automated install with Boxstarter](#option-2-automated-install-with-boxstarter) <ide> * [Building Node.js](#building-nodejs-1) <ide> * [Android/Android-based devices (e.g. Firefox OS)](#androidandroid-based-devices-eg-firefox-os) <ide> * [`Intl` (ECMA-402) support](#intl-ecma-402-support)
1
Ruby
Ruby
help command for visible commands should be hidden
1cd88288d54dfd4254a9566023d5cb2e11a34db2
<ide><path>railties/lib/rails/commands/dev/dev_command.rb <ide> module Rails <ide> module Command <ide> class DevCommand < Base # :nodoc: <del> def help <del> say "rails dev:cache # Toggle development mode caching on/off." <add> no_commands do <add> def help <add> say "rails dev:cache # Toggle development mode caching on/off." <add> end <ide> end <ide> <ide> def cache
1
Text
Text
add a link to the great full-stack tutorial
02adad6db49931cf1a77d272f0085455b73d2eeb
<ide><path>docs/introduction/Ecosystem.md <ide> On this page we will only feature a few of them that the Redux maintainers have <ide> * [redux-tutorial](https://github.com/happypoulp/redux-tutorial) — Learn how to use redux step by step <ide> * [What the Flux?! Let’s Redux.](https://blog.andyet.com/2015/08/06/what-the-flux-lets-redux) <ide> * [Handcrafting an Isomorphic Redux Application (With Love)](https://medium.com/@bananaoomarang/handcrafting-an-isomorphic-redux-application-with-love-40ada4468af4) <add>* [Full-Stack Redux Tutorial](http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html) — A Comprehensive Guide to Test-First Development with Redux, React, and Immutable <ide> <ide> ## More <ide>
1
Javascript
Javascript
remove all the duplicate module warnings
76846f7e339d20d3efafadbb808f87012ed4b92c
<ide><path>packager/blacklist.js <ide> var sharedBlacklist = [ <ide> 'node_modules/react-tools/src/renderers/shared/event/EventPropagators.js', <ide> 'node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js', <ide> 'node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js', <add> <add> // Those conflicts with the ones in react-tools/. We need to blacklist the <add> // internal version otherwise they won't work in open source. <add> 'downstream/core/invariant.js', <add> 'downstream/key-mirror/keyMirror.js', <add> 'downstream/core/emptyFunction.js', <add> 'downstream/core/emptyObject.js', <add> 'downstream/key-mirror/keyOf.js', <add> 'downstream/core/dom/isNode.js', <add> 'downstream/core/TouchEventUtils.js', <add> 'downstream/core/nativeRequestAnimationFrame.js', <add> 'downstream/core/dom/containsNode.js', <add> 'downstream/core/dom/isTextNode.js', <add> 'downstream/functional/mapObject.js', <add> 'downstream/core/camelize.js', <add> 'downstream/core/hyphenate.js', <add> 'downstream/core/createArrayFromMixed.js', <add> 'downstream/core/toArray.js', <add> 'downstream/core/dom/getActiveElement.js', <ide> ]; <ide> <ide> // Raw unescaped patterns in case you need to use wildcards
1
Ruby
Ruby
add tests for fixtureresolver
a3044967ed48e27104e8c97719c798ee2f416846
<ide><path>actionpack/test/template/testing/fixture_resolver_test.rb <add>require 'abstract_unit' <add> <add>class FixtureResolverTest < ActiveSupport::TestCase <add> def test_should_return_empty_list_for_unknown_path <add> resolver = ActionView::FixtureResolver.new() <add> templates = resolver.find_all("path", "arbitrary", false, {:locale => [], :formats => [:html], :handlers => []}) <add> assert_equal [], templates, "expected an empty list of templates" <add> end <add> <add> def test_should_return_template_for_declared_path <add> resolver = ActionView::FixtureResolver.new("arbitrary/path" => "this text") <add> templates = resolver.find_all("path", "arbitrary", false, {:locale => [], :formats => [:html], :handlers => []}) <add> assert_equal 1, templates.size, "expected one template" <add> assert_equal "this text", templates.first.source <add> assert_equal "arbitrary/path", templates.first.virtual_path <add> assert_equal [:html], templates.first.formats <add> end <add>end
1
PHP
PHP
remove duplicate unset()
ed4068a725b8f05dc5bfad09afd6aac1b06861c7
<ide><path>src/Illuminate/Container/Container.php <ide> public function getBindings() <ide> */ <ide> protected function dropStaleInstances($abstract) <ide> { <del> unset($this->instances[$abstract]); <del> <del> unset($this->aliases[$abstract]); <add> unset($this->instances[$abstract], $this->aliases[$abstract]); <ide> } <ide> <ide> /** <ide> public function offsetSet($key, $value) <ide> */ <ide> public function offsetUnset($key) <ide> { <del> unset($this->bindings[$key]); <del> <del> unset($this->instances[$key]); <add> unset($this->bindings[$key], $this->instances[$key]); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Events/Dispatcher.php <ide> public function createClassListener($listener) <ide> */ <ide> public function forget($event) <ide> { <del> unset($this->listeners[$event]); <del> <del> unset($this->sorted[$event]); <add> unset($this->listeners[$event], $this->sorted[$event]); <ide> } <ide> <ide> }
2
Javascript
Javascript
fix style violations in the input.js file
3217a249e18c12fb1ade59073773e2ab67a67792
<ide><path>src/widget/input.js <ide> var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/; <ide> var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/; <ide> var INTEGER_REGEXP = /^\s*(\-|\+)?\d+\s*$/; <ide> <add> <ide> /** <ide> * @ngdoc inputType <ide> * @name angular.inputType.text <ide> angularInputType('email', function() { <ide> }); <ide> }); <ide> <add> <ide> /** <ide> * @ngdoc inputType <ide> * @name angular.inputType.url <ide> angularInputType('url', function() { <ide> }); <ide> }); <ide> <add> <ide> /** <ide> * @ngdoc inputType <ide> * @name angular.inputType.list <ide> angularInputType('list', function() { <ide> }; <ide> }); <ide> <add> <ide> /** <ide> * @ngdoc inputType <ide> * @name angular.inputType.number <ide> angularInputType('list', function() { <ide> */ <ide> angularInputType('number', numericRegexpInputType(NUMBER_REGEXP, 'NUMBER')); <ide> <add> <ide> /** <ide> * @ngdoc inputType <ide> * @name angular.inputType.integer <ide> angularInputType('number', numericRegexpInputType(NUMBER_REGEXP, 'NUMBER')); <ide> */ <ide> angularInputType('integer', numericRegexpInputType(INTEGER_REGEXP, 'INTEGER')); <ide> <add> <ide> /** <ide> * @ngdoc inputType <ide> * @name angular.inputType.checkbox <ide> angularInputType('checkbox', function(inputElement) { <ide> widget.$parseView = function() { <ide> widget.$modelValue = widget.$viewValue ? trueValue : falseValue; <ide> }; <del> <ide> }); <ide> <add> <ide> /** <ide> * @ngdoc inputType <ide> * @name angular.inputType.radio <ide> angularWidget('input', function(inputElement){ <ide> controller: TypeController, <ide> controllerArgs: [inputElement]}); <ide> <del> widget.$pattern = <ide> watchElementProperty(this, widget, 'required', inputElement); <ide> watchElementProperty(this, widget, 'readonly', inputElement); <ide> watchElementProperty(this, widget, 'disabled', inputElement); <ide> <del> <ide> widget.$pristine = !(widget.$dirty = false); <ide> <del> widget.$on('$validate', function(event) { <add> widget.$on('$validate', function() { <ide> var $viewValue = trim(widget.$viewValue), <ide> inValid = widget.$required && !$viewValue, <ide> tooLong = maxlength && $viewValue && $viewValue.length > maxlength, <ide> angularWidget('input', function(inputElement){ <ide> <ide> forEach(['valid', 'invalid', 'pristine', 'dirty'], function(name) { <ide> widget.$watch('$' + name, function(scope, value) { <del> inputElement[value ? 'addClass' : 'removeClass']('ng-' + name); <del> } <del> ); <add> inputElement[value ? 'addClass' : 'removeClass']('ng-' + name); <add> }); <ide> }); <ide> <ide> inputElement.bind('$destroy', function() { <ide> function watchElementProperty(modelScope, widget, name, element) { <ide> }); <ide> } <ide> } <del>
1
Python
Python
use pathlib instead
a037206f0a5453050f19fc4801d2efa445cbe4d7
<ide><path>bin/wiki_entity_linking/kb_creator.py <ide> DESC_WIDTH = 64 # dimension of output entity vectors <ide> <ide> <del>def create_kb(nlp, max_entities_per_alias, min_entity_freq, min_occ, <del> entity_def_output, entity_descr_output, <del> count_input, prior_prob_input, wikidata_input): <add>def create_kb( <add> nlp, <add> max_entities_per_alias, <add> min_entity_freq, <add> min_occ, <add> entity_def_output, <add> entity_descr_output, <add> count_input, <add> prior_prob_input, <add> wikidata_input, <add>): <ide> # Create the knowledge base from Wikidata entries <ide> kb = KnowledgeBase(vocab=nlp.vocab, entity_vector_length=DESC_WIDTH) <ide> <ide> def create_kb(nlp, max_entities_per_alias, min_entity_freq, min_occ, <ide> title_to_id, id_to_descr = wd.read_wikidata_entities_json(wikidata_input) <ide> <ide> # write the title-ID and ID-description mappings to file <del> _write_entity_files(entity_def_output, entity_descr_output, title_to_id, id_to_descr) <add> _write_entity_files( <add> entity_def_output, entity_descr_output, title_to_id, id_to_descr <add> ) <ide> <ide> else: <ide> # read the mappings from file <ide> def create_kb(nlp, max_entities_per_alias, min_entity_freq, min_occ, <ide> frequency_list.append(freq) <ide> filtered_title_to_id[title] = entity <ide> <del> print("Kept", len(filtered_title_to_id.keys()), "out of", len(title_to_id.keys()), <del> "titles with filter frequency", min_entity_freq) <add> print(len(title_to_id.keys()), "original titles") <add> print("kept", len(filtered_title_to_id.keys()), " with frequency", min_entity_freq) <ide> <ide> print() <ide> print(" * train entity encoder", datetime.datetime.now()) <ide> def create_kb(nlp, max_entities_per_alias, min_entity_freq, min_occ, <ide> <ide> print() <ide> print(" * adding", len(entity_list), "entities", datetime.datetime.now()) <del> kb.set_entities(entity_list=entity_list, freq_list=frequency_list, vector_list=embeddings) <add> kb.set_entities( <add> entity_list=entity_list, freq_list=frequency_list, vector_list=embeddings <add> ) <ide> <ide> print() <ide> print(" * adding aliases", datetime.datetime.now()) <ide> print() <del> _add_aliases(kb, title_to_id=filtered_title_to_id, <del> max_entities_per_alias=max_entities_per_alias, min_occ=min_occ, <del> prior_prob_input=prior_prob_input) <add> _add_aliases( <add> kb, <add> title_to_id=filtered_title_to_id, <add> max_entities_per_alias=max_entities_per_alias, <add> min_occ=min_occ, <add> prior_prob_input=prior_prob_input, <add> ) <ide> <ide> print() <ide> print("kb size:", len(kb), kb.get_size_entities(), kb.get_size_aliases()) <ide> def create_kb(nlp, max_entities_per_alias, min_entity_freq, min_occ, <ide> return kb <ide> <ide> <del>def _write_entity_files(entity_def_output, entity_descr_output, title_to_id, id_to_descr): <del> with open(entity_def_output, mode='w', encoding='utf8') as id_file: <add>def _write_entity_files( <add> entity_def_output, entity_descr_output, title_to_id, id_to_descr <add>): <add> with entity_def_output.open("w", encoding="utf8") as id_file: <ide> id_file.write("WP_title" + "|" + "WD_id" + "\n") <ide> for title, qid in title_to_id.items(): <ide> id_file.write(title + "|" + str(qid) + "\n") <ide> <del> with open(entity_descr_output, mode='w', encoding='utf8') as descr_file: <add> with entity_descr_output.open("w", encoding="utf8") as descr_file: <ide> descr_file.write("WD_id" + "|" + "description" + "\n") <ide> for qid, descr in id_to_descr.items(): <ide> descr_file.write(str(qid) + "|" + descr + "\n") <ide> <ide> <ide> def get_entity_to_id(entity_def_output): <ide> entity_to_id = dict() <del> with open(entity_def_output, 'r', encoding='utf8') as csvfile: <del> csvreader = csv.reader(csvfile, delimiter='|') <add> with entity_def_output.open("r", encoding="utf8") as csvfile: <add> csvreader = csv.reader(csvfile, delimiter="|") <ide> # skip header <ide> next(csvreader) <ide> for row in csvreader: <ide> def get_entity_to_id(entity_def_output): <ide> <ide> def get_id_to_description(entity_descr_output): <ide> id_to_desc = dict() <del> with open(entity_descr_output, 'r', encoding='utf8') as csvfile: <del> csvreader = csv.reader(csvfile, delimiter='|') <add> with entity_descr_output.open("r", encoding="utf8") as csvfile: <add> csvreader = csv.reader(csvfile, delimiter="|") <ide> # skip header <ide> next(csvreader) <ide> for row in csvreader: <ide> def _add_aliases(kb, title_to_id, max_entities_per_alias, min_occ, prior_prob_in <ide> <ide> # adding aliases with prior probabilities <ide> # we can read this file sequentially, it's sorted by alias, and then by count <del> with open(prior_prob_input, mode='r', encoding='utf8') as prior_file: <add> with prior_prob_input.open("r", encoding="utf8") as prior_file: <ide> # skip header <ide> prior_file.readline() <ide> line = prior_file.readline() <ide> def _add_aliases(kb, title_to_id, max_entities_per_alias, min_occ, prior_prob_in <ide> counts = [] <ide> entities = [] <ide> while line: <del> splits = line.replace('\n', "").split(sep='|') <add> splits = line.replace("\n", "").split(sep="|") <ide> new_alias = splits[0] <ide> count = int(splits[1]) <ide> entity = splits[2] <ide> def _add_aliases(kb, title_to_id, max_entities_per_alias, min_occ, prior_prob_in <ide> <ide> if selected_entities: <ide> try: <del> kb.add_alias(alias=previous_alias, entities=selected_entities, probabilities=prior_probs) <add> kb.add_alias( <add> alias=previous_alias, <add> entities=selected_entities, <add> probabilities=prior_probs, <add> ) <ide> except ValueError as e: <ide> print(e) <ide> total_count = 0 <ide> def _add_aliases(kb, title_to_id, max_entities_per_alias, min_occ, prior_prob_in <ide> previous_alias = new_alias <ide> <ide> line = prior_file.readline() <del> <ide><path>bin/wiki_entity_linking/training_set_creator.py <ide> # coding: utf-8 <ide> from __future__ import unicode_literals <ide> <del>import os <ide> import random <ide> import re <ide> import bz2 <ide> def _process_wikipedia_texts(wikipedia_input, wp_to_id, training_output, limit=N <ide> <ide> read_ids = set() <ide> entityfile_loc = training_output / ENTITY_FILE <del> with open(entityfile_loc, mode="w", encoding="utf8") as entityfile: <add> with entityfile_loc.open("w", encoding="utf8") as entityfile: <ide> # write entity training header file <ide> _write_training_entity( <ide> outputfile=entityfile, <ide> def _get_clean_wp_text(article_text): <ide> <ide> <ide> def _write_training_article(article_id, clean_text, training_output): <del> file_loc = training_output / str(article_id) + ".txt" <del> with open(file_loc, mode="w", encoding="utf8") as outputfile: <add> file_loc = training_output / "{}.txt".format(article_id) <add> with file_loc.open("w", encoding="utf8") as outputfile: <ide> outputfile.write(clean_text) <ide> <ide> <ide> def read_training(nlp, training_dir, dev, limit, kb=None): <ide> skip_articles = set() <ide> total_entities = 0 <ide> <del> with open(entityfile_loc, mode="r", encoding="utf8") as file: <add> with entityfile_loc.open("r", encoding="utf8") as file: <ide> for line in file: <ide> if not limit or len(data) < limit: <ide> fields = line.replace("\n", "").split(sep="|") <ide> def read_training(nlp, training_dir, dev, limit, kb=None): <ide> # parse the new article text <ide> file_name = article_id + ".txt" <ide> try: <del> with open( <del> os.path.join(training_dir, file_name), <del> mode="r", <del> encoding="utf8", <del> ) as f: <add> training_file = training_dir / file_name <add> with training_file.open("r", encoding="utf8") as f: <ide> text = f.read() <ide> # threshold for convenience / speed of processing <ide> if len(text) < 30000: <ide> def read_training(nlp, training_dir, dev, limit, kb=None): <ide> sent_length = len(ent.sent) <ide> # custom filtering to avoid too long or too short sentences <ide> if 5 < sent_length < 100: <del> offset = "{}_{}".format(ent.start_char, ent.end_char) <add> offset = "{}_{}".format( <add> ent.start_char, ent.end_char <add> ) <ide> ents_by_offset[offset] = ent <ide> else: <ide> skip_articles.add(article_id) <ide><path>bin/wiki_entity_linking/wikipedia_processor.py <ide> def read_prior_probs(wikipedia_input, prior_prob_output): <ide> cnt += 1 <ide> <ide> # write all aliases and their entities and count occurrences to file <del> with open(prior_prob_output, mode="w", encoding="utf8") as outputfile: <add> with prior_prob_output.open("w", encoding="utf8") as outputfile: <ide> outputfile.write("alias" + "|" + "count" + "|" + "entity" + "\n") <ide> for alias, alias_dict in sorted(map_alias_to_link.items(), key=lambda x: x[0]): <ide> s_dict = sorted(alias_dict.items(), key=lambda x: x[1], reverse=True) <ide> def write_entity_counts(prior_prob_input, count_output, to_print=False): <ide> entity_to_count = dict() <ide> total_count = 0 <ide> <del> with open(prior_prob_input, mode="r", encoding="utf8") as prior_file: <add> with prior_prob_input.open("r", encoding="utf8") as prior_file: <ide> # skip header <ide> prior_file.readline() <ide> line = prior_file.readline() <ide> def write_entity_counts(prior_prob_input, count_output, to_print=False): <ide> <ide> line = prior_file.readline() <ide> <del> with open(count_output, mode="w", encoding="utf8") as entity_file: <add> with count_output.open("w", encoding="utf8") as entity_file: <ide> entity_file.write("entity" + "|" + "count" + "\n") <ide> for entity, count in entity_to_count.items(): <ide> entity_file.write(entity + "|" + str(count) + "\n") <ide> def write_entity_counts(prior_prob_input, count_output, to_print=False): <ide> <ide> def get_all_frequencies(count_input): <ide> entity_to_count = dict() <del> with open(count_input, "r", encoding="utf8") as csvfile: <add> with count_input.open("r", encoding="utf8") as csvfile: <ide> csvreader = csv.reader(csvfile, delimiter="|") <ide> # skip header <ide> next(csvreader)
3
PHP
PHP
remove bc mapping of "ext" to "_ext"
1ea269a1e2d0a8b38fd3b3e55d27792254e27e8c
<ide><path>src/Routing/Router.php <ide> public static function url($url = null, $options = []) { <ide> $frag = '#' . $url['#']; <ide> unset($url['#']); <ide> } <del> if (isset($url['ext'])) { <del> $url['_ext'] = $url['ext']; <del> unset($url['ext']); <del> } <ide> if (isset($url['ssl'])) { <ide> $url['_scheme'] = ($url['ssl'] == true) ? 'https' : 'http'; <ide> unset($url['ssl']); <ide> public static function parseNamedParams(Request $request, $options = []) { <ide> * specific kinds of scopes. <ide> * <ide> * Routing scopes will inherit the globally set extensions configured with <del> * Router::parseExtensions(). You can also set valid extensions using <add> * Router::parseExtensions(). You can also set valid extensions using <ide> * `$routes->extensions()` in your closure. <ide> * <ide> * @param string $path The path prefix for the scope. This path will be prepended <ide><path>tests/TestCase/View/Helper/HtmlHelperTest.php <ide> public function testImageTag() { <ide> $result = $this->Html->image('//google.com/logo.gif'); <ide> $this->assertTags($result, array('img' => array('src' => '//google.com/logo.gif', 'alt' => ''))); <ide> <del> $result = $this->Html->image(array('controller' => 'test', 'action' => 'view', 1, 'ext' => 'gif')); <add> $result = $this->Html->image(array('controller' => 'test', 'action' => 'view', 1, '_ext' => 'gif')); <ide> $this->assertTags($result, array('img' => array('src' => '/test/view/1.gif', 'alt' => ''))); <ide> <ide> $result = $this->Html->image('/test/view/1.gif'); <ide> public function testNestedList() { <ide> public function testMeta() { <ide> Router::connect('/:controller', array('action' => 'index')); <ide> <del> $result = $this->Html->meta('this is an rss feed', array('controller' => 'posts', 'ext' => 'rss')); <add> $result = $this->Html->meta('this is an rss feed', array('controller' => 'posts', '_ext' => 'rss')); <ide> $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/posts\.rss/', 'type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => 'this is an rss feed'))); <ide> <del> $result = $this->Html->meta('rss', array('controller' => 'posts', 'ext' => 'rss'), array('title' => 'this is an rss feed')); <add> $result = $this->Html->meta('rss', array('controller' => 'posts', '_ext' => 'rss'), array('title' => 'this is an rss feed')); <ide> $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/posts\.rss/', 'type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => 'this is an rss feed'))); <ide> <del> $result = $this->Html->meta('atom', array('controller' => 'posts', 'ext' => 'xml')); <add> $result = $this->Html->meta('atom', array('controller' => 'posts', '_ext' => 'xml')); <ide> $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/posts\.xml/', 'type' => 'application/atom+xml', 'title' => 'atom'))); <ide> <ide> $result = $this->Html->meta('non-existing'); <ide> public function testMeta() { <ide> $result = $this->Html->meta('non-existing', '/posts.xpp', array('type' => 'atom')); <ide> $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/posts\.xpp/', 'type' => 'application/atom+xml', 'title' => 'non-existing'))); <ide> <del> $result = $this->Html->meta('atom', array('controller' => 'posts', 'ext' => 'xml'), array('link' => '/articles.rss')); <add> $result = $this->Html->meta('atom', array('controller' => 'posts', '_ext' => 'xml'), array('link' => '/articles.rss')); <ide> $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/articles\.rss/', 'type' => 'application/atom+xml', 'title' => 'atom'))); <ide> <ide> $result = $this->Html->meta('keywords', 'these, are, some, meta, keywords'); <ide><path>tests/TestCase/View/HelperTest.php <ide> public function testAssetUrl() { <ide> $result = $this->Helper->assetUrl(array( <ide> 'controller' => 'js', <ide> 'action' => 'post', <del> 'ext' => 'js' <add> '_ext' => 'js' <ide> ), <ide> array('fullBase' => true) <ide> );
3
Go
Go
skip testuuidgeneration on api < v1.40
05bd9958f26269d5f2996d3dd89bb1ab296c14ee
<ide><path>integration/system/uuid_test.go <ide> import ( <ide> "context" <ide> "testing" <ide> <add> "github.com/docker/docker/api/types/versions" <ide> "github.com/google/uuid" <ide> "gotest.tools/assert" <add> "gotest.tools/skip" <ide> ) <ide> <ide> func TestUUIDGeneration(t *testing.T) { <add> skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "ID format changed") <ide> defer setupTest(t)() <ide> <ide> c := testEnv.APIClient() <ide> info, err := c.Info(context.Background()) <ide> assert.NilError(t, err) <ide> <ide> _, err = uuid.Parse(info.ID) <del> assert.NilError(t, err) <add> assert.NilError(t, err, info.ID) <ide> }
1
PHP
PHP
add a test for using sqlite with an absolute path
7c6cb2494e0b1657657344eb42156476ad28f5f6
<ide><path>tests/TestCase/Core/StaticConfigTraitTest.php <ide> public function testCustomParseDsn() { <ide> ]; <ide> $this->assertEquals($expected, TestConnectionManagerStaticConfig::parseDsn($dsn)); <ide> <add> $dsn = 'sqlite:////absolute/path'; <add> $expected = [ <add> 'className' => 'Cake\Database\Connection', <add> 'driver' => 'Cake\Database\Driver\Sqlite', <add> 'database' => '/absolute/path', <add> 'scheme' => 'sqlite', <add> ]; <add> $this->assertEquals($expected, TestConnectionManagerStaticConfig::parseDsn($dsn)); <add> <ide> $dsn = 'sqlite:///?database=:memory:'; <ide> $expected = [ <ide> 'className' => 'Cake\Database\Connection',
1
Ruby
Ruby
fix doc in postgres database creation
2dc86ead1de8fd523ec40db79e92318062616967
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb <ide> def recreate_database(name, options = {}) #:nodoc: <ide> end <ide> <ide> # Create a new PostgreSQL database. Options include <tt>:owner</tt>, <tt>:template</tt>, <del> # <tt>:encoding</tt>, <tt>:collation</tt>, <tt>:ctype</tt>, <add> # <tt>:encoding</tt> (defaults to utf8), <tt>:collation</tt>, <tt>:ctype</tt>, <ide> # <tt>:tablespace</tt>, and <tt>:connection_limit</tt> (note that MySQL uses <ide> # <tt>:charset</tt> while PostgreSQL uses <tt>:encoding</tt>). <ide> #
1
Ruby
Ruby
use odie when commands encounter errors
2e982cd2a28ffbbde40305e98e8d142c2874c8cf
<ide><path>Library/Homebrew/cmd/gist-logs.rb <ide> def load_logs(dir) <ide> logs[file.basename.to_s] = { content: contents } <ide> end <ide> end <del> raise "No logs." if logs.empty? <add> odie "No logs." if logs.empty? <ide> <ide> logs <ide> end <ide><path>Library/Homebrew/cmd/install.rb <ide> def install <ide> formulae.each do |f| <ide> # head-only without --HEAD is an error <ide> if !args.HEAD? && f.stable.nil? <del> raise <<~EOS <add> odie <<~EOS <ide> #{f.full_name} is a head-only formula <ide> Install with `brew install --HEAD #{f.full_name}` <ide> EOS <ide> end <ide> <ide> # --HEAD, fail with no head defined <del> raise "No head is defined for #{f.full_name}" if args.HEAD? && f.head.nil? <add> odie "No head is defined for #{f.full_name}" if args.HEAD? && f.head.nil? <ide> <ide> installed_head_version = f.latest_head_version <ide> if installed_head_version && <ide><path>Library/Homebrew/cmd/migrate.rb <ide> def migrate <ide> if f.oldname <ide> rack = HOMEBREW_CELLAR/f.oldname <ide> raise NoSuchKegError, f.oldname if !rack.exist? || rack.subdirs.empty? <del> raise "#{rack} is a symlink" if rack.symlink? <add> <add> odie "#{rack} is a symlink" if rack.symlink? <ide> end <ide> <ide> migrator = Migrator.new(f, force: args.force?) <ide><path>Library/Homebrew/cmd/search.rb <ide> def search <ide> puts reason <ide> end <ide> <del> raise "No formulae or casks found for #{query.inspect}." if count.zero? <add> odie "No formulae or casks found for #{query.inspect}." if count.zero? <ide> end <ide> <ide> return unless $stdout.tty? <ide><path>Library/Homebrew/dev-cmd/create.rb <ide> def create_formula(args:) <ide> # unless --force is specified. <ide> unless args.force? <ide> if reason = MissingFormula.disallowed_reason(fc.name) <del> raise <<~EOS <add> odie <<~EOS <ide> The formula '#{fc.name}' is not allowed to be created. <ide> #{reason} <ide> If you really want to create this formula use `--force`. <ide> def create_formula(args:) <ide> <ide> if Formula.aliases.include? fc.name <ide> realname = Formulary.canonical_name(fc.name) <del> raise <<~EOS <add> odie <<~EOS <ide> The formula '#{realname}' is already aliased to '#{fc.name}'. <ide> Please check that you are not creating a duplicate. <ide> To force creation use `--force`. <ide><path>Library/Homebrew/dev-cmd/edit.rb <ide> def edit <ide> args = edit_args.parse <ide> <ide> unless (HOMEBREW_REPOSITORY/".git").directory? <del> raise <<~EOS <add> odie <<~EOS <ide> Changes will be lost! <ide> The first time you `brew update`, all local changes will be lost; you should <ide> thus `brew update` before you `brew edit`! <ide><path>Library/Homebrew/dev-cmd/pr-pull.rb <ide> def changed_formulae(tap, original_commit) <ide> end <ide> <ide> def download_artifact(url, dir, pr) <del> raise "Credentials must be set to access the Artifacts API" if GitHub.api_credentials_type == :none <add> odie "Credentials must be set to access the Artifacts API" if GitHub.api_credentials_type == :none <ide> <ide> token = GitHub.api_credentials <ide> curl_args = ["--header", "Authorization: token #{token}"] <ide><path>Library/Homebrew/dev-cmd/tap-new.rb <ide> def tap_new <ide> branch = args.branch || "main" <ide> <ide> tap = args.named.to_taps.first <del> raise "Invalid tap name '#{tap_name}'" unless tap.path.to_s.match?(HOMEBREW_TAP_PATH_REGEX) <add> odie "Invalid tap name '#{tap_name}'" unless tap.path.to_s.match?(HOMEBREW_TAP_PATH_REGEX) <ide> <ide> titleized_user = tap.user.dup <ide> titleized_repo = tap.repo.dup <ide> def tap_new <ide> def write_path(tap, filename, content) <ide> path = tap.path/filename <ide> tap.path.mkpath <del> raise "#{path} already exists" if path.exist? <add> odie "#{path} already exists" if path.exist? <ide> <ide> path.write content <ide> end <ide><path>Library/Homebrew/dev-cmd/unpack.rb <ide> def unpack <ide> unpack_dir = Pathname.pwd <ide> end <ide> <del> raise "Cannot write to #{unpack_dir}" unless unpack_dir.writable_real? <add> odie "Cannot write to #{unpack_dir}" unless unpack_dir.writable_real? <ide> <ide> formulae.each do |f| <ide> stage_dir = unpack_dir/"#{f.name}-#{f.version}" <ide> <ide> if stage_dir.exist? <del> raise "Destination #{stage_dir} already exists!" unless args.force? <add> odie "Destination #{stage_dir} already exists!" unless args.force? <ide> <ide> rm_rf stage_dir <ide> end <ide><path>Library/Homebrew/dev-cmd/update-test.rb <ide> def update_test <ide> start_log = Utils.popen_read("git", "log", "-1", "--decorate", "--oneline", start_commit).chomp <ide> end_log = Utils.popen_read("git", "log", "-1", "--decorate", "--oneline", end_commit).chomp <ide> actual_log = Utils.popen_read("git", "log", "-1", "--decorate", "--oneline", actual_end_commit).chomp <del> raise <<~EOS <add> odie <<~EOS <ide> brew update didn't update #{branch}! <ide> Start commit: #{start_log} <ide> Expected end commit: #{end_log}
10
Text
Text
add missing commas
99a3adbdaa0b1d6ebdc31c04cf71472a79c4147c
<ide><path>CHANGELOG.md <ide> <ide> ## Bug Fixes <ide> - **$q:** Add traceback to unhandled promise rejections <del> ([174cb4](https://github.com/angular/angular.js/commit/174cb4a8c81e25581da5b452c2bb43b0fa377a9b) <add> ([174cb4](https://github.com/angular/angular.js/commit/174cb4a8c81e25581da5b452c2bb43b0fa377a9b), <ide> [#14631](https://github.com/angular/angular.js/issues/14631)) <ide> - **$$cookieReader:** correctly handle forbidden access to `document.cookie` <del> ([33f769](https://github.com/angular/angular.js/commit/33f769b0a1214055c16fb59adad4897bf53d62bf) <add> ([33f769](https://github.com/angular/angular.js/commit/33f769b0a1214055c16fb59adad4897bf53d62bf), <ide> [#15523](https://github.com/angular/angular.js/issues/15523)) <ide> - **ngOptions:** do not unset the `selected` property unless necessary <del> ([bc4844](https://github.com/angular/angular.js/commit/bc4844d3b297d80aecef89aa1b32615024decedc) <add> ([bc4844](https://github.com/angular/angular.js/commit/bc4844d3b297d80aecef89aa1b32615024decedc), <ide> [#15477](https://github.com/angular/angular.js/issues/15477)) <ide> - **ngModelOptions:** work correctly when on the template of `replace` directives <del> ([5f8ed6](https://github.com/angular/angular.js/commit/5f8ed63f2ab02ffb9c21bf9c29d27c851d162e26) <add> ([5f8ed6](https://github.com/angular/angular.js/commit/5f8ed63f2ab02ffb9c21bf9c29d27c851d162e26), <ide> [#15492](https://github.com/angular/angular.js/issues/15492)) <ide> - **ngClassOdd/Even:** add/remove the correct classes when expression/`$index` change simultaneously <ide> ([d52864](https://github.com/angular/angular.js/commit/d528644fe3e9ffd43999e7fc67806059f9e1083e)) <ide> - **jqLite:** silently ignore `after()` if element has no parent <del> ([3d68b9](https://github.com/angular/angular.js/commit/3d68b9502848ff6714ef89bfb95b8e70ae34eff6) <add> ([3d68b9](https://github.com/angular/angular.js/commit/3d68b9502848ff6714ef89bfb95b8e70ae34eff6), <ide> [#15331](https://github.com/angular/angular.js/issues/15331), <ide> [#15475](https://github.com/angular/angular.js/issues/15475)) <ide> - **$rootScope:** when adding/removing watchers during $digest <del> ([163aca](https://github.com/angular/angular.js/commit/163aca336d7586a45255787af41b14b2a12361dd) <add> ([163aca](https://github.com/angular/angular.js/commit/163aca336d7586a45255787af41b14b2a12361dd), <ide> [#15422](https://github.com/angular/angular.js/issues/15422)) <ide> <ide> <ide> ## Performance Improvements <ide> - **ngClass:** avoid unnecessary `.data()` accesses, deep-watching and copies <del> ([1d3b65](https://github.com/angular/angular.js/commit/1d3b65adc2c22ff662159ef910089cf10d1edb7b) <add> ([1d3b65](https://github.com/angular/angular.js/commit/1d3b65adc2c22ff662159ef910089cf10d1edb7b), <ide> [#14404](https://github.com/angular/angular.js/issues/14404)) <ide> <ide> <ide> ## Bug Fixes <ide> - **$compile:** <ide> - don't throw tplrt error when there is whitespace around a top-level comment <del> ([12752f](https://github.com/angular/angular.js/commit/12752f66ac425ab38a5ee574a4bfbf3516adc42c) <add> ([12752f](https://github.com/angular/angular.js/commit/12752f66ac425ab38a5ee574a4bfbf3516adc42c), <ide> [#15108](https://github.com/angular/angular.js/issues/15108)) <ide> - clean up `@`-binding observers when re-assigning bindings <del> ([f3cb6e](https://github.com/angular/angular.js/commit/f3cb6e309aa1f676e5951ac745fa886d3581c2f4) <add> ([f3cb6e](https://github.com/angular/angular.js/commit/f3cb6e309aa1f676e5951ac745fa886d3581c2f4), <ide> [#15268](https://github.com/angular/angular.js/issues/15268)) <ide> - set attribute value even if `ngAttr*` contains no interpolation <del> ([229799](https://github.com/angular/angular.js/commit/22979904fb754c59e9f6ee5d8763e3b8de0e18c2) <add> ([229799](https://github.com/angular/angular.js/commit/22979904fb754c59e9f6ee5d8763e3b8de0e18c2), <ide> [#15133](https://github.com/angular/angular.js/issues/15133)) <ide> - `bindToController` should work without `controllerAs` <del> ([944989](https://github.com/angular/angular.js/commit/9449893763a4fd95ee8ff78b53c6966a874ec9ae) <add> ([944989](https://github.com/angular/angular.js/commit/9449893763a4fd95ee8ff78b53c6966a874ec9ae), <ide> [#15088](https://github.com/angular/angular.js/issues/15088)) <ide> - do not overwrite values set in `$onInit()` for `<`-bound literals <del> ([07e1ba](https://github.com/angular/angular.js/commit/07e1ba365fb5e8a049be732bd7b62f71e0aa1672) <add> ([07e1ba](https://github.com/angular/angular.js/commit/07e1ba365fb5e8a049be732bd7b62f71e0aa1672), <ide> [#15118](https://github.com/angular/angular.js/issues/15118)) <ide> - avoid calling `$onChanges()` twice for `NaN` initial values <ide> ([0cf5be](https://github.com/angular/angular.js/commit/0cf5be52642f7e9d81a708b3005042eac6492572)) <ide> - **$location:** prevent infinite digest with IDN urls in Edge <del> ([4bf892](https://github.com/angular/angular.js/commit/4bf89218130d434771089fdfe643490b8d2ee259) <add> ([4bf892](https://github.com/angular/angular.js/commit/4bf89218130d434771089fdfe643490b8d2ee259), <ide> [#15217](https://github.com/angular/angular.js/issues/15217)) <ide> - **$rootScope:** correctly handle adding/removing watchers during `$digest` <del> ([a9708d](https://github.com/angular/angular.js/commit/a9708de84b50f06eacda33834d5bbdfc97c97f37) <add> ([a9708d](https://github.com/angular/angular.js/commit/a9708de84b50f06eacda33834d5bbdfc97c97f37), <ide> [#15422](https://github.com/angular/angular.js/issues/15422)) <ide> - **$sce:** fix `adjustMatcher` to replace multiple `*` and `**` <ide> ([78eecb](https://github.com/angular/angular.js/commit/78eecb43dbb0500358d333aea8955bd0646a7790)) <ide> - **jqLite:** silently ignore `after()` if element has no parent <del> ([77ed85](https://github.com/angular/angular.js/commit/77ed85bcd3be057a5a79231565ac7accc6d644c6) <add> ([77ed85](https://github.com/angular/angular.js/commit/77ed85bcd3be057a5a79231565ac7accc6d644c6), <ide> [#15331](https://github.com/angular/angular.js/issues/15331)) <ide> - **input[radio]:** use non-strict comparison for checkedness <ide> ([593a50](https://github.com/angular/angular.js/commit/593a5034841b3b7661d3bcbdd06b7a9d0876fd34)) <ide> - **select, ngOptions:** <ide> - let `ngValue` take precedence over option text with multiple interpolations <del> ([5b7ec8](https://github.com/angular/angular.js/commit/5b7ec8c84e88ee08aacaf9404853eda0016093f5) <add> ([5b7ec8](https://github.com/angular/angular.js/commit/5b7ec8c84e88ee08aacaf9404853eda0016093f5), <ide> [#15413](https://github.com/angular/angular.js/issues/15413)) <ide> - don't add comment nodes as empty options <del> ([1d29c9](https://github.com/angular/angular.js/commit/1d29c91c3429de96e4103533752700d1266741be) <add> ([1d29c9](https://github.com/angular/angular.js/commit/1d29c91c3429de96e4103533752700d1266741be), <ide> [#15454](https://github.com/angular/angular.js/issues/15454)) <ide> - **ngClassOdd/Even:** add/remove the correct classes when expression/`$index` change simultaneously <ide> ([e3d020](https://github.com/angular/angular.js/commit/e3d02070ab8a02c818dcc5114db6fba9d3f385d6)) <ide> - **$sanitize:** reduce stack height in IE <= 11 <del> ([862dc2](https://github.com/angular/angular.js/commit/862dc2532f8126a4a71fd3d957884ba6f11f591c) <add> ([862dc2](https://github.com/angular/angular.js/commit/862dc2532f8126a4a71fd3d957884ba6f11f591c), <ide> [#14928](https://github.com/angular/angular.js/issues/14928)) <ide> - **ngMock/$controller:** respect `$compileProvider.preAssignBindingsEnabled()` <ide> ([75c83f](https://github.com/angular/angular.js/commit/75c83ff3195931859a099f7a95bf81d32abf2eb3)) <ide> <ide> <ide> ## New Features <ide> - **bootstrap:** do not bootstrap from unknown schemes with a different origin <del> ([bdeb33](https://github.com/angular/angular.js/commit/bdeb3392a8719131ab2b993f2a881c43a2860f92) <add> ([bdeb33](https://github.com/angular/angular.js/commit/bdeb3392a8719131ab2b993f2a881c43a2860f92), <ide> [#15428](https://github.com/angular/angular.js/issues/15428)) <ide> - **$anchorScroll:** convert numeric hash targets to string <del> ([a52640](https://github.com/angular/angular.js/commit/a5264090b66ad0cf9a93de84bb7b307868c0edef) <add> ([a52640](https://github.com/angular/angular.js/commit/a5264090b66ad0cf9a93de84bb7b307868c0edef), <ide> [#14680](https://github.com/angular/angular.js/issues/14680)) <ide> - **$compile:** <ide> - add `preAssignBindingsEnabled` option <ide> ([f86576](https://github.com/angular/angular.js/commit/f86576def44005f180a66e3aa12d6cc73c1ac72c)) <ide> - throw error when directive name or factory function is invalid <del> ([5c9399](https://github.com/angular/angular.js/commit/5c9399d18ae5cd79e6cf6fc4377d66df00f6fcc7) <add> ([5c9399](https://github.com/angular/angular.js/commit/5c9399d18ae5cd79e6cf6fc4377d66df00f6fcc7), <ide> [#15056](https://github.com/angular/angular.js/issues/15056)) <ide> - **$controller:** throw when requested controller is not registered <del> ([9ae793](https://github.com/angular/angular.js/commit/9ae793d8a69afe84370b601e07fc375fc18a576a) <add> ([9ae793](https://github.com/angular/angular.js/commit/9ae793d8a69afe84370b601e07fc375fc18a576a), <ide> [#14980](https://github.com/angular/angular.js/issues/14980)) <ide> - **$location:** add support for selectively rewriting links based on attribute <ide> ([a4a222](https://github.com/angular/angular.js/commit/a4a22266f127d3b9a6818e6f4754f048e253f693)) <ide> - **$resource:** pass `status`/`statusText` to success callbacks <del> ([a8da25](https://github.com/angular/angular.js/commit/a8da25c74d2c1f6265f0fafd95bf72c981d9d678) <del> [#8341](https://github.com/angular/angular.js/issues/8841) <add> ([a8da25](https://github.com/angular/angular.js/commit/a8da25c74d2c1f6265f0fafd95bf72c981d9d678), <add> [#8341](https://github.com/angular/angular.js/issues/8841), <ide> [#8841](https://github.com/angular/angular.js/issues/8841)) <ide> - **ngSwitch:** allow multiple case matches via optional attribute `ngSwitchWhenSeparator` <del> ([0e1651](https://github.com/angular/angular.js/commit/0e1651bfd28ba73ebd0e4943d85af48c4506e02c) <del> [#3410](https://github.com/angular/angular.js/issues/3410) <add> ([0e1651](https://github.com/angular/angular.js/commit/0e1651bfd28ba73ebd0e4943d85af48c4506e02c), <add> [#3410](https://github.com/angular/angular.js/issues/3410), <ide> [#3516](https://github.com/angular/angular.js/issues/3516)) <ide> <ide> <ide> ## Performance Improvements <ide> - **all:** don't trigger digests after enter/leave of structural directives <del> ([c57779](https://github.com/angular/angular.js/commit/c57779d8725493c5853dceda0105dafd5c0e3a7c) <add> ([c57779](https://github.com/angular/angular.js/commit/c57779d8725493c5853dceda0105dafd5c0e3a7c), <ide> [#15322](https://github.com/angular/angular.js/issues/15322)) <ide> - **$compile:** validate `directive.restrict` property on directive init <ide> ([31d464](https://github.com/angular/angular.js/commit/31d464feef38b1cc950da6c8dccd0f194ebfc68b))
1
Ruby
Ruby
add missing documentation bits
a3924483fb05181b4f0ac1ea1f13f92a2ab6c4e6
<ide><path>activerecord/lib/active_record/encryption/encryptable_record.rb <ide> module EncryptableRecord <ide> # designated column +original_<name>+. When reading the encrypted content, the version with the original case is <ide> # server. But you can still execute queries that will ignore the case. This option can only be used when +:deterministic+ <ide> # is true. <del> # * <tt>:previous</tt> - <add> # * <tt>:context</tt> - Hash of properties that will override +Context+ properties when this attribute is <add> # encrypted and decrypted. E.g: +encryptor:+, +cipher:+, +message_serializer:+, etc. <add> # * <tt>:previous</tt> - List of previous encryption schemes. When provided, they will be used in order when trying to read <add> # the attribute. Each entry of the list can contain the properties supported by #encrypts. Also, when deterministic <add> # encryption is used, they will be used to generate additional ciphertexts to check in the queries. <ide> def encrypts(*names, key_provider: nil, key: nil, deterministic: false, downcase: false, ignore_case: false, context: nil, previous: []) <ide> self.encrypted_attributes ||= Set.new # not using :default because the instance would be shared across classes <ide> <ide> def decrypt_rich_texts <ide> <ide> def encryptable_rich_texts <ide> @encryptable_rich_texts ||= self.class <del> .reflect_on_all_associations(:has_one) <del> .collect(&:name) <del> .grep(/rich_text/) <del> .collect { |attribute_name| send(attribute_name) }.compact <del> .find_all { |record| record.class.name == "ActionText::EncryptedRichText" } # not using class check to avoid adding dependency <add> .reflect_on_all_associations(:has_one) <add> .collect(&:name) <add> .grep(/rich_text/) <add> .collect { |attribute_name| send(attribute_name) }.compact <add> .find_all { |record| record.class.name == "ActionText::EncryptedRichText" } # not using class check to avoid adding dependency <ide> end <ide> <ide> def cant_modify_encrypted_attributes_when_frozen
1
Javascript
Javascript
use explicit .valueof() calls instead of coercion
b576d2ffc2ee8e690c487598623d19ea95bd879b
<ide><path>src/lib/create/from-anything.js <ide> function configFromInput(config) { <ide> if (input === undefined) { <ide> config._d = new Date(hooks.now()); <ide> } else if (isDate(input)) { <del> config._d = new Date(+input); <add> config._d = new Date(input.valueOf()); <ide> } else if (typeof input === 'string') { <ide> configFromString(config); <ide> } else if (isArray(input)) { <ide><path>src/lib/moment/add-subtract.js <ide> export function addSubtract (mom, duration, isAdding, updateOffset) { <ide> updateOffset = updateOffset == null ? true : updateOffset; <ide> <ide> if (milliseconds) { <del> mom._d.setTime(+mom._d + milliseconds * isAdding); <add> mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); <ide> } <ide> if (days) { <ide> set(mom, 'Date', get(mom, 'Date') + days * isAdding); <ide><path>src/lib/moment/compare.js <ide> export function isAfter (input, units) { <ide> } <ide> units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); <ide> if (units === 'millisecond') { <del> return +this > +localInput; <add> return this.valueOf() > localInput.valueOf(); <ide> } else { <del> return +localInput < +this.clone().startOf(units); <add> return localInput.valueOf() < this.clone().startOf(units).valueOf(); <ide> } <ide> } <ide> <ide> export function isBefore (input, units) { <ide> } <ide> units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); <ide> if (units === 'millisecond') { <del> return +this < +localInput; <add> return this.valueOf() < localInput.valueOf(); <ide> } else { <del> return +this.clone().endOf(units) < +localInput; <add> return this.clone().endOf(units).valueOf() < localInput.valueOf(); <ide> } <ide> } <ide> <ide> export function isSame (input, units) { <ide> } <ide> units = normalizeUnits(units || 'millisecond'); <ide> if (units === 'millisecond') { <del> return +this === +localInput; <add> return this.valueOf() === localInput.valueOf(); <ide> } else { <del> inputMs = +localInput; <del> return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units)); <add> inputMs = localInput.valueOf(); <add> return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); <ide> } <ide> } <ide> <ide><path>src/lib/moment/to-type.js <ide> export function valueOf () { <del> return +this._d - ((this._offset || 0) * 60000); <add> return this._d.valueOf() - ((this._offset || 0) * 60000); <ide> } <ide> <ide> export function unix () { <del> return Math.floor(+this / 1000); <add> return Math.floor(this.valueOf() / 1000); <ide> } <ide> <ide> export function toDate () { <del> return this._offset ? new Date(+this) : this._d; <add> return this._offset ? new Date(this.valueOf()) : this._d; <ide> } <ide> <ide> export function toArray () { <ide><path>src/lib/units/offset.js <ide> export function cloneWithOffset(input, model) { <ide> var res, diff; <ide> if (model._isUTC) { <ide> res = model.clone(); <del> diff = (isMoment(input) || isDate(input) ? +input : +createLocal(input)) - (+res); <add> diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); <ide> // Use low-level api, because this fn is low-level api. <del> res._d.setTime(+res._d + diff); <add> res._d.setTime(res._d.valueOf() + diff); <ide> hooks.updateOffset(res, false); <ide> return res; <ide> } else {
5
Python
Python
avoid extra copy if otype is object on output
440a5f9ad84f91460d6ee18aa7fdccac03c72625
<ide><path>numpy/lib/function_base.py <ide> def __call__(self, *args): <ide> self.ufunc = frompyfunc(self.thefunc, nargs, self.nout) <ide> <ide> # Convert to object arrays first <del> newargs = [asanyarray(arg,dtype=object) for arg in args] <add> newargs = [array(arg,copy=False,subok=True,dtype=object) for arg in args] <ide> if self.nout == 1: <ide> _res = array(self.ufunc(*newargs),copy=False, <del> subok=True).astype(self.otypes[0]) <add> subok=True,dtype=self.otypes[0]) <ide> else: <del> _res = tuple([array(x,copy=False,subok=True).astype(c) \ <add> _res = tuple([array(x,copy=False,subok=True,dtype=c) \ <ide> for x, c in zip(self.ufunc(*newargs), self.otypes)]) <ide> return _res <ide>
1
Text
Text
add missing date
c87e95c23942d2b9c38784a4ad3e9a6d043a4977
<ide><path>docs/topics/release-notes.md <ide> You can determine your currently installed version using `pip freeze`: <ide> <ide> ### 3.0.2 <ide> <del>**Date**: [December 2014][3.0.2-milestone]. <add>**Date**: [17th December 2014][3.0.2-milestone]. <ide> <ide> * Ensure `request.user` is made available to response middleware. ([#2155][gh2155]) <ide> * `Client.logout()` also cancels any existing `force_authenticate`. ([#2218][gh2218], [#2259][gh2259])
1
Javascript
Javascript
remove dead code from pdfthumbnailview
777d69b52ed2196cb69c851c07ae39421498ab65
<ide><path>web/pdf_thumbnail_view.js <ide> var PDFThumbnailView = (function PDFThumbnailViewClosure() { <ide> return canvas.getContext('2d'); <ide> }, <ide> <del> drawingRequired: function PDFThumbnailView_drawingRequired() { <del> return !this.hasImage; <del> }, <del> <ide> draw: function PDFThumbnailView_draw() { <ide> if (this.renderingState !== RenderingStates.INITIAL) { <ide> console.error('Must be in new state before drawing');
1
Python
Python
remove rogue print
afe9b37f600ba7dad9de249f56ea1e7c539939f7
<ide><path>rest_framework/pagination.py <ide> def __init__(self, *args, **kwargs): <ide> else: <ide> context_kwarg = {} <ide> <del> print object_serializer <ide> self.fields[results_field] = object_serializer(source='object_list', <ide> many=True, <ide> **context_kwarg)
1
Ruby
Ruby
use recursive flatten
6ebb061b18cd5af087453879b3eac0f719ea4ec4
<ide><path>activerecord/lib/active_record/associations/association_proxy.rb <ide> def flatten_deeper(array) <ide> end <ide> else <ide> def flatten_deeper(array) <del> array.sum [] do |elem| <del> if elem.respond_to?(:each) <del> flatten_deeper(elem) <del> else <del> [elem] <del> end <del> end <add> array.flatten <ide> end <ide> end <ide>
1
Text
Text
change step tests to use expected/found values
26fad221aae0e15ef21920db3c0ace34c9179671
<ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efc4f528d6a74d05e68af74.md <ide> You should make sure the checkbox is still present. <ide> assert($('input[type="checkbox"]')[0]); <ide> ``` <ide> <del>Your checkbox should still have an `id` attribute with the value `loving`. You may have removed the attribute or changed its value. <add>Your checkbox should still have an `id` attribute with the value `loving`. Expected `--fcc-expected--`, but found `--fcc-actual--`. <ide> <ide> ```js <del>assert($('input[type="checkbox"]')[0].id === 'loving'); <add>assert.equal($('input[type="checkbox"]')[0].id, 'loving'); <ide> ``` <ide> <ide> The text ` Loving` should no longer be located directly to the right of your checkbox. It should be wrapped in a `label` element. Make sure there is a space between the two elements. <ide> const labelElem = $('input[type="checkbox"]')[0].nextElementSibling; <ide> assert(labelElem.hasAttribute('for')); <ide> ``` <ide> <del>The new `label` element should have a `for` attribute with the value `loving`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks. <add>The new `label` element should have a `for` attribute with the value `loving`. Expected `--fcc-expected--`, but found `--fcc-actual--`. <ide> <ide> ```js <ide> const labelElem = $('input[type="checkbox"]')[0].nextElementSibling; <del>assert(labelElem.getAttribute('for').match(/^loving$/)); <add>assert.equal(labelElem.getAttribute('for'), 'loving'); <ide> ``` <ide> <ide> The text `Loving` should be nested within the new `label` element. You have either omitted the text or have a typo.
1
Javascript
Javascript
replace fixturedir with fixtures.path
733d528ac42f07f37391775811d307e3227da7e4
<ide><path>test/parallel/test-common.js <ide> <ide> 'use strict'; <ide> const common = require('../common'); <add>const fixtures = require('../common/fixtures'); <ide> const assert = require('assert'); <del>const { join } = require('path'); <ide> const { execFile } = require('child_process'); <ide> <ide> // test for leaked global detection <ide> fnAtLeast2Called3(); <ide> <ide> const failFixtures = [ <ide> [ <del> join(common.fixturesDir, 'failmustcall1.js'), <add> fixtures.path('failmustcall1.js'), <ide> 'Mismatched <anonymous> function calls. Expected exactly 2, actual 1.' <ide> ], [ <del> join(common.fixturesDir, 'failmustcall2.js'), <add> fixtures.path('failmustcall2.js'), <ide> 'Mismatched <anonymous> function calls. Expected at least 2, actual 1.' <ide> ] <ide> ];
1
Text
Text
remove broken links in model zoo
3ea7d47e00783030da3cd4fa580cb3f7e60d2185
<ide><path>research/object_detection/g3doc/detection_model_zoo.md <ide> Model name <ide> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------: | :---------------------: | :-----: <ide> [faster_rcnn_inception_resnet_v2_atrous_oidv2](http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_oid_2018_01_28.tar.gz) | 727 | 37 | Boxes <ide> [faster_rcnn_inception_resnet_v2_atrous_lowproposals_oidv2](http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_lowproposals_oid_2018_01_28.tar.gz) | 347 | | Boxes <del>[faster_rcnn_inception_resnet_v2_atrous_oidv4](http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_oidv4_2018_10_30.tar.gz) | 455 | | Boxes <del>[ssd_mobilenetv2_oidv4](http://download.tensorflow.org/models/object_detection/ssd_mobilenetv2_oidv4_2018_10_30.tar.gz) | 24 | | Boxes <ide> [facessd_mobilenet_v2_quantized_open_image_v4](http://download.tensorflow.org/models/object_detection/facessd_mobilenet_v2_quantized_320x320_open_image_v4.tar.gz) [^3] | 20 | 73 (faces) | Boxes <ide> <ide> ## iNaturalist Species-trained models
1