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 |
|---|---|---|---|---|---|
PHP | PHP | resolve validation factory contract in formrequest | ab902adb2e9b28012f9c4f1a95005891f8bc040b | <ide><path>src/Illuminate/Foundation/Http/FormRequest.php
<ide> use Illuminate\Http\Exception\HttpResponseException;
<ide> use Illuminate\Validation\ValidatesWhenResolvedTrait;
<ide> use Illuminate\Contracts\Validation\ValidatesWhenResolved;
<add>use Illuminate\Contracts\Validation\Factory as ValidationFactory;
<ide>
<ide> class FormRequest extends Request implements ValidatesWhenResolved
<ide> {
<ide> class FormRequest extends Request implements ValidatesWhenResolved
<ide> */
<ide> protected function getValidatorInstance()
<ide> {
<del> $factory = $this->container->make('Illuminate\Validation\Factory');
<add> $factory = $this->container->make(ValidationFactory::class);
<ide>
<ide> if (method_exists($this, 'validator')) {
<ide> return $this->container->call([$this, 'validator'], compact('factory')); | 1 |
Python | Python | drop unused import | 79b825ef320b9abe3b6d582442a2cb555db7e9b4 | <ide><path>rest_framework/templatetags/rest_framework.py
<ide> from __future__ import absolute_import, unicode_literals
<ide>
<del>import decimal
<ide> import re
<ide>
<ide> from django import template
<ide> def format_value(value):
<ide> return mark_safe('<a href="{value}">{value}</a>'.format(value=escape(value)))
<ide> elif '@' in value and not re.search(r'\s', value):
<ide> return mark_safe('<a href="mailto:{value}">{value}</a>'.format(value=escape(value)))
<add> elif '\n' in value:
<add> return mark_safe('<pre>%s</pre>' % escape(value))
<ide> return six.text_type(value)
<ide>
<ide> | 1 |
Text | Text | add changelog entry for [ci skip] | 555ec36522011862c03b483c53be32410594a51e | <ide><path>railties/CHANGELOG.md
<add>* Do not set the Rails environment to test by default when using test_unit Railtie.
<add>
<add> *Konstantin Shabanov*
<add>
<ide> * Remove sqlite3 lines from `.gitignore` if the application is not using sqlite3.
<ide>
<ide> *Dmitrii Golub* | 1 |
Javascript | Javascript | improve error message for invalid flag | 8bb60e3c8dde6f0c0295309291b4022937072c04 | <ide><path>lib/fs.js
<ide> fs.readFileSync = function(path, options) {
<ide>
<ide> // Used by binding.open and friends
<ide> function stringToFlags(flag) {
<del> // Only mess with strings
<del> if (typeof flag !== 'string') {
<add> // Return early if it's a number
<add> if (typeof flag === 'number') {
<ide> return flag;
<ide> }
<ide> | 1 |
Ruby | Ruby | fix documentation to the custom deprecator | 3f04785f77899b286d02a0a95dd7fbfc341dc999 | <ide><path>activesupport/lib/active_support/core_ext/module/deprecation.rb
<ide> class Module
<ide> #
<ide> # class MyLib::Deprecator
<ide> # def deprecation_warning(deprecated_method_name, message, caller_backtrace)
<del> # message = "#{method_name} is deprecated and will be removed from MyLibrary | #{message}"
<add> # message = "#{deprecated_method_name} is deprecated and will be removed from MyLibrary | #{message}"
<ide> # Kernel.warn message
<ide> # end
<ide> # end | 1 |
Javascript | Javascript | replace concatenation with literals | f05a2d88d64ca4ed2ebf5482d16d7fdd69cfa23e | <ide><path>test/parallel/test-whatwg-url-searchparams-sort.js
<ide> const { test, assert_equals, assert_array_equals } = require('../common/wpt');
<ide> assert_array_equals(param, val.output[i])
<ide> i++
<ide> }
<del> }, "Parse and sort: " + val.input)
<add> }, `Parse and sort: ${val.input}`)
<ide>
<ide> test(() => {
<del> let url = new URL("?" + val.input, "https://example/")
<add> let url = new URL(`?${val.input}`, "https://example/")
<ide> url.searchParams.sort()
<ide> let params = new URLSearchParams(url.search),
<ide> i = 0
<ide> for(let param of params) {
<ide> assert_array_equals(param, val.output[i])
<ide> i++
<ide> }
<del> }, "URL parse and sort: " + val.input)
<add> }, `URL parse and sort: ${val.input}`)
<ide> })
<ide>
<ide> test(function() {
<ide> tests.forEach((val) => {
<ide> assert_array_equals(param, val.output[i]);
<ide> i++;
<ide> }
<del> }, 'Parse and sort: ' + val.input);
<add> }, `Parse and sort: ${val.input}`);
<ide>
<ide> test(() => {
<ide> const url = new URL(`?${val.input}`, 'https://example/');
<ide> tests.forEach((val) => {
<ide> assert_array_equals(param, val.output[i]);
<ide> i++;
<ide> }
<del> }, 'URL parse and sort: ' + val.input);
<add> }, `URL parse and sort: ${val.input}`);
<ide> }); | 1 |
PHP | PHP | use self instead of $this for ide compatibility | 2f0133bbbe87929aa021830baf9ea2d8d9e29d46 | <ide><path>src/Console/ConsoleOptionParser.php
<ide> public function __construct($command = null, $defaultOptions = true)
<ide> *
<ide> * @param string|null $command The command name this parser is for. The command name is used for generating help.
<ide> * @param bool $defaultOptions Whether you want the verbose and quiet options set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public static function create($command, $defaultOptions = true)
<ide> {
<ide> public static function create($command, $defaultOptions = true)
<ide> *
<ide> * @param array $spec The spec to build the OptionParser with.
<ide> * @param bool $defaultOptions Whether you want the verbose and quiet options set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public static function buildFromArray($spec, $defaultOptions = true)
<ide> {
<ide> public function toArray()
<ide> * Get or set the command name for shell/task.
<ide> *
<ide> * @param array|\Cake\Console\ConsoleOptionParser $spec ConsoleOptionParser or spec to merge with.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function merge($spec)
<ide> {
<ide> public function merge($spec)
<ide> * Sets the command name for shell/task.
<ide> *
<ide> * @param string $text The text to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setCommand($text)
<ide> {
<ide> public function getCommand()
<ide> *
<ide> * @deprecated 3.4.0 Use setCommand()/getCommand() instead.
<ide> * @param string|null $text The text to set, or null if you want to read
<del> * @return string|$this If reading, the value of the command. If setting $this will be returned.
<add> * @return string|self If reading, the value of the command. If setting $this will be returned.
<ide> */
<ide> public function command($text = null)
<ide> {
<ide> public function command($text = null)
<ide> *
<ide> * @param string|array $text The text to set. If an array the
<ide> * text will be imploded with "\n".
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setDescription($text)
<ide> {
<ide> public function getDescription()
<ide> * @deprecated 3.4.0 Use setDescription()/getDescription() instead.
<ide> * @param string|array|null $text The text to set, or null if you want to read. If an array the
<ide> * text will be imploded with "\n".
<del> * @return string|$this If reading, the value of the description. If setting $this will be returned.
<add> * @return string|self If reading, the value of the description. If setting $this will be returned.
<ide> */
<ide> public function description($text = null)
<ide> {
<ide> public function description($text = null)
<ide> *
<ide> * @param string|array $text The text to set. If an array the text will
<ide> * be imploded with "\n".
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setEpilog($text)
<ide> {
<ide> public function getEpilog()
<ide> * @deprecated 3.4.0 Use setEpilog()/getEpilog() instead.
<ide> * @param string|array|null $text Text when setting or null when reading. If an array the text will
<ide> * be imploded with "\n".
<del> * @return string|$this If reading, the value of the epilog. If setting $this will be returned.
<add> * @return string|self If reading, the value of the epilog. If setting $this will be returned.
<ide> */
<ide> public function epilog($text = null)
<ide> {
<ide> public function epilog($text = null)
<ide> * @param \Cake\Console\ConsoleInputOption|string $name The long name you want to the value to be parsed out as when options are parsed.
<ide> * Will also accept an instance of ConsoleInputOption
<ide> * @param array $options An array of parameters that define the behavior of the option
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addOption($name, array $options = [])
<ide> {
<ide> public function addOption($name, array $options = [])
<ide> * Remove an option from the option parser.
<ide> *
<ide> * @param string $name The option name to remove.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function removeOption($name)
<ide> {
<ide> public function removeOption($name)
<ide> * @param \Cake\Console\ConsoleInputArgument|string $name The name of the argument.
<ide> * Will also accept an instance of ConsoleInputArgument.
<ide> * @param array $params Parameters for the argument, see above.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addArgument($name, array $params = [])
<ide> {
<ide> public function addArgument($name, array $params = [])
<ide> *
<ide> * @param array $args Array of arguments to add.
<ide> * @see \Cake\Console\ConsoleOptionParser::addArgument()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addArguments(array $args)
<ide> {
<ide> public function addArguments(array $args)
<ide> *
<ide> * @param array $options Array of options to add.
<ide> * @see \Cake\Console\ConsoleOptionParser::addOption()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addOptions(array $options)
<ide> {
<ide> public function addOptions(array $options)
<ide> *
<ide> * @param \Cake\Console\ConsoleInputSubcommand|string $name Name of the subcommand. Will also accept an instance of ConsoleInputSubcommand
<ide> * @param array $options Array of params, see above.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addSubcommand($name, array $options = [])
<ide> {
<ide> public function addSubcommand($name, array $options = [])
<ide> * Remove a subcommand from the option parser.
<ide> *
<ide> * @param string $name The subcommand name to remove.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function removeSubcommand($name)
<ide> {
<ide> public function removeSubcommand($name)
<ide> * Add multiple subcommands at once.
<ide> *
<ide> * @param array $commands Array of subcommands.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addSubcommands(array $commands)
<ide> {
<ide><path>src/Core/InstanceConfigTrait.php
<ide> public function config($key = null, $value = null, $merge = true)
<ide> *
<ide> * @param string|array $key The key to set, or a complete array of configs.
<ide> * @param mixed|null $value The value to set.
<del> * @return $this The object itself.
<add> * @return self The object itself.
<ide> */
<ide> public function configShallow($key, $value = null)
<ide> {
<ide><path>src/Database/Connection.php
<ide> public function configName()
<ide> * @param array $config Config for a new driver.
<ide> * @throws \Cake\Database\Exception\MissingDriverException When a driver class is missing.
<ide> * @throws \Cake\Database\Exception\MissingExtensionException When a driver's PHP extension is missing.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setDriver($driver, $config = [])
<ide> {
<ide> public function newQuery()
<ide> * Sets a Schema\Collection object for this connection.
<ide> *
<ide> * @param \Cake\Database\Schema\Collection $collection The schema collection object
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setSchemaCollection(SchemaCollection $collection)
<ide> {
<ide> public function rollback()
<ide> * `$connection->enableSavePoints(false)` Disables usage of savepoints and returns false
<ide> *
<ide> * @param bool $enable Whether or not save points should be used.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function enableSavePoints($enable)
<ide> {
<ide><path>src/Database/Driver.php
<ide> public function isConnected()
<ide> * in queries.
<ide> *
<ide> * @param bool $enable Whether to enable auto quoting
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function enableAutoQuoting($enable)
<ide> {
<ide><path>src/Database/Expression/CaseExpression.php
<ide> public function __construct($conditions = [], $values = [], $types = [])
<ide> * @param array|\Cake\Database\ExpressionInterface $values associative array of values of each condition
<ide> * @param array $types associative array of types to be associated with the values
<ide> *
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function add($conditions = [], $values = [], $types = [])
<ide> {
<ide><path>src/Database/Expression/FunctionExpression.php
<ide> public function __construct($name, $params = [], $types = [], $returnType = 'str
<ide> * Sets the name of the SQL function to be invoke in this expression.
<ide> *
<ide> * @param string $name The name of the function
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setName($name)
<ide> {
<ide> public function getName()
<ide> *
<ide> * @deprecated 3.4.0 Use setName()/getName() instead.
<ide> * @param string|null $name The name of the function
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function name($name = null)
<ide> {
<ide> public function name($name = null)
<ide> * passed arguments
<ide> * @param bool $prepend Whether to prepend or append to the list of arguments
<ide> * @see \Cake\Database\Expression\FunctionExpression::__construct() for more details.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function add($params, $types = [], $prepend = false)
<ide> {
<ide><path>src/Database/Expression/QueryExpression.php
<ide> public function __construct($conditions = [], $types = [], $conjunction = 'AND')
<ide> *
<ide> * @param string $conjunction Value to be used for joining conditions. If null it
<ide> * will not set any value, but return the currently stored one
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setConjunction($conjunction)
<ide> {
<ide> public function getConjunction()
<ide> * @deprecated 3.4.0 Use setConjunction()/getConjunction() instead.
<ide> * @param string|null $conjunction value to be used for joining conditions. If null it
<ide> * will not set any value, but return the currently stored one
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function tieWith($conjunction = null)
<ide> {
<ide> public function tieWith($conjunction = null)
<ide> *
<ide> * @param string|null $conjunction value to be used for joining conditions. If null it
<ide> * will not set any value, but return the currently stored one
<del> * @return string|$this
<add> * @return string|self
<ide> * @deprecated 3.2.0 Use tieWith() instead
<ide> */
<ide> public function type($conjunction = null)
<ide> public function type($conjunction = null)
<ide> * @param array $types associative array of fields pointing to the type of the
<ide> * values that are being passed. Used for correctly binding values to statements.
<ide> * @see \Cake\Database\Query::where() for examples on conditions
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function add($conditions, $types = [])
<ide> {
<ide> public function add($conditions, $types = [])
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<ide> * If it is suffixed with "[]" and the value is an array then multiple placeholders
<ide> * will be created, one per each value in the array.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function eq($field, $value, $type = null)
<ide> {
<ide> public function eq($field, $value, $type = null)
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<ide> * If it is suffixed with "[]" and the value is an array then multiple placeholders
<ide> * will be created, one per each value in the array.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function notEq($field, $value, $type = null)
<ide> {
<ide> public function notEq($field, $value, $type = null)
<ide> * @param string $field Database field to be compared against value
<ide> * @param mixed $value The value to be bound to $field for comparison
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function gt($field, $value, $type = null)
<ide> {
<ide> public function gt($field, $value, $type = null)
<ide> * @param string $field Database field to be compared against value
<ide> * @param mixed $value The value to be bound to $field for comparison
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function lt($field, $value, $type = null)
<ide> {
<ide> public function lt($field, $value, $type = null)
<ide> * @param string $field Database field to be compared against value
<ide> * @param mixed $value The value to be bound to $field for comparison
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function gte($field, $value, $type = null)
<ide> {
<ide> public function gte($field, $value, $type = null)
<ide> * @param string $field Database field to be compared against value
<ide> * @param mixed $value The value to be bound to $field for comparison
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function lte($field, $value, $type = null)
<ide> {
<ide> public function lte($field, $value, $type = null)
<ide> *
<ide> * @param string|\Cake\Database\ExpressionInterface $field database field to be
<ide> * tested for null
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function isNull($field)
<ide> {
<ide> public function isNull($field)
<ide> *
<ide> * @param string|\Cake\Database\ExpressionInterface $field database field to be
<ide> * tested for not null
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function isNotNull($field)
<ide> {
<ide> public function isNotNull($field)
<ide> * @param string $field Database field to be compared against value
<ide> * @param mixed $value The value to be bound to $field for comparison
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function like($field, $value, $type = null)
<ide> {
<ide> public function like($field, $value, $type = null)
<ide> * @param string $field Database field to be compared against value
<ide> * @param mixed $value The value to be bound to $field for comparison
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function notLike($field, $value, $type = null)
<ide> {
<ide> public function notLike($field, $value, $type = null)
<ide> * @param string $field Database field to be compared against value
<ide> * @param string|array $values the value to be bound to $field for comparison
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function in($field, $values, $type = null)
<ide> {
<ide> public function in($field, $values, $type = null)
<ide> * passed in $conditions. If there are more $values than $conditions, the last $value is used as the `ELSE` value
<ide> * @param array $types associative array of types to be associated with the values
<ide> * passed in $values
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addCase($conditions, $values = [], $types = [])
<ide> {
<ide> public function addCase($conditions, $values = [], $types = [])
<ide> * @param string $field Database field to be compared against value
<ide> * @param array $values the value to be bound to $field for comparison
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function notIn($field, $values, $type = null)
<ide> {
<ide> public function notIn($field, $values, $type = null)
<ide> * Adds a new condition to the expression object in the form "EXISTS (...)".
<ide> *
<ide> * @param \Cake\Database\ExpressionInterface $query the inner query
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function exists(ExpressionInterface $query)
<ide> {
<ide> public function exists(ExpressionInterface $query)
<ide> * Adds a new condition to the expression object in the form "NOT EXISTS (...)".
<ide> *
<ide> * @param \Cake\Database\ExpressionInterface $query the inner query
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function notExists(ExpressionInterface $query)
<ide> {
<ide> public function notExists(ExpressionInterface $query)
<ide> * @param mixed $from The initial value of the range.
<ide> * @param mixed $to The ending value in the comparison range.
<ide> * @param string|null $type the type name for $value as configured using the Type map.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function between($field, $from, $to, $type = null)
<ide> {
<ide> public function or_($conditions, $types = [])
<ide> * @param string|array|\Cake\Database\Expression\QueryExpression $conditions to be added and negated
<ide> * @param array $types associative array of fields pointing to the type of the
<ide> * values that are being passed. Used for correctly binding values to statements.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function not($conditions, $types = [])
<ide> {
<ide> public function count()
<ide> *
<ide> * @param string $left Left join condition field name.
<ide> * @param string $right Right join condition field name.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function equalFields($left, $right)
<ide> {
<ide> public function traverse(callable $callable)
<ide> * modified part is stored.
<ide> *
<ide> * @param callable $callable The callable to apply to each part.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function iterateParts(callable $callable)
<ide> {
<ide><path>src/Database/Expression/ValuesExpression.php
<ide> public function add($data)
<ide> * Sets the columns to be inserted.
<ide> *
<ide> * @param array $cols Array with columns to be inserted.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setColumns($cols)
<ide> {
<ide> public function getColumns()
<ide> *
<ide> * @deprecated 3.4.0 Use setColumns()/getColumns() instead.
<ide> * @param array|null $cols Array with columns to be inserted.
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function columns($cols = null)
<ide> {
<ide> protected function _columnNames()
<ide> * Sets the values to be inserted.
<ide> *
<ide> * @param array $values Array with values to be inserted.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setValues($values)
<ide> {
<ide> public function getValues()
<ide> * the currently stored values
<ide> *
<ide> * @param array|null $values Array with values to be inserted.
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function values($values = null)
<ide> {
<ide> public function values($values = null)
<ide> * to insert records in the table.
<ide> *
<ide> * @param \Cake\Database\Query $query The query to set
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setQuery(Query $query)
<ide> {
<ide> public function getQuery()
<ide> *
<ide> * @deprecated 3.4.0 Use setQuery()/getQuery() instead.
<ide> * @param \Cake\Database\Query|null $query The query to set
<del> * @return \Cake\Database\Query|null|$this
<add> * @return \Cake\Database\Query|null|self
<ide> */
<ide> public function query(Query $query = null)
<ide> {
<ide><path>src/Database/Query.php
<ide> public function __construct($connection)
<ide> * Sets the connection instance to be used for executing and transforming this query.
<ide> *
<ide> * @param \Cake\Datasource\ConnectionInterface $connection Connection instance
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setConnection($connection)
<ide> {
<ide> public function getConnection()
<ide> *
<ide> * @deprecated 3.4.0 Use setConnection()/getConnection() instead.
<ide> * @param \Cake\Datasource\ConnectionInterface|null $connection Connection instance
<del> * @return $this|\Cake\Datasource\ConnectionInterface
<add> * @return self|\Cake\Datasource\ConnectionInterface
<ide> */
<ide> public function connection($connection = null)
<ide> {
<ide> public function sql(ValueBinder $generator = null)
<ide> *
<ide> * @param callable $visitor A function or callable to be executed for each part
<ide> * @param array $parts The query clauses to traverse
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function traverse(callable $visitor, array $parts = [])
<ide> {
<ide> public function traverse(callable $visitor, array $parts = [])
<ide> *
<ide> * @param array|\Cake\Database\ExpressionInterface|string|callable $fields fields to be added to the list.
<ide> * @param bool $overwrite whether to reset fields with passed list or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function select($fields = [], $overwrite = false)
<ide> {
<ide> public function select($fields = [], $overwrite = false)
<ide> * @param array|\Cake\Database\ExpressionInterface|string|bool $on Enable/disable distinct class
<ide> * or list of fields to be filtered on
<ide> * @param bool $overwrite whether to reset fields with passed list or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function distinct($on = [], $overwrite = false)
<ide> {
<ide> public function distinct($on = [], $overwrite = false)
<ide> *
<ide> * @param array|\Cake\Database\ExpressionInterface|string $modifiers modifiers to be applied to the query
<ide> * @param bool $overwrite whether to reset order with field list or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function modifier($modifiers, $overwrite = false)
<ide> {
<ide> public function modifier($modifiers, $overwrite = false)
<ide> * passed as an array of strings, array of expression objects, or a single string. See
<ide> * the examples above for the valid call types.
<ide> * @param bool $overwrite whether to reset tables with passed list or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function from($tables = [], $overwrite = false)
<ide> {
<ide> public function from($tables = [], $overwrite = false)
<ide> * @param array $types associative array of type names used to bind values to query
<ide> * @param bool $overwrite whether to reset joins with passed list or not
<ide> * @see \Cake\Database\Type
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function join($tables = null, $types = [], $overwrite = false)
<ide> {
<ide> public function join($tables = null, $types = [], $overwrite = false)
<ide> * the join clauses.
<ide> *
<ide> * @param string $name The alias/name of the join to remove.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function removeJoin($name)
<ide> {
<ide> public function removeJoin($name)
<ide> * to use for joining.
<ide> * @param array $types a list of types associated to the conditions used for converting
<ide> * values to the corresponding database representation.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function leftJoin($table, $conditions = [], $types = [])
<ide> {
<ide> public function leftJoin($table, $conditions = [], $types = [])
<ide> * to use for joining.
<ide> * @param array $types a list of types associated to the conditions used for converting
<ide> * values to the corresponding database representation.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function rightJoin($table, $conditions = [], $types = [])
<ide> {
<ide> public function rightJoin($table, $conditions = [], $types = [])
<ide> * to use for joining.
<ide> * @param array $types a list of types associated to the conditions used for converting
<ide> * values to the corresponding database representation.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function innerJoin($table, $conditions = [], $types = [])
<ide> {
<ide> protected function _makeJoin($table, $conditions, $type)
<ide> * @param bool $overwrite whether to reset conditions with passed list or not
<ide> * @see \Cake\Database\Type
<ide> * @see \Cake\Database\Expression\QueryExpression
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function where($conditions = null, $types = [], $overwrite = false)
<ide> {
<ide> public function where($conditions = null, $types = [], $overwrite = false)
<ide> * @param array $types associative array of type names used to bind values to query
<ide> * @see \Cake\Database\Query::where()
<ide> * @see \Cake\Database\Type
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function andWhere($conditions, $types = [])
<ide> {
<ide> public function andWhere($conditions, $types = [])
<ide> * @param array $types associative array of type names used to bind values to query
<ide> * @see \Cake\Database\Query::where()
<ide> * @see \Cake\Database\Type
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function orWhere($conditions, $types = [])
<ide> {
<ide> public function orWhere($conditions, $types = [])
<ide> *
<ide> * @param array|\Cake\Database\ExpressionInterface|string $fields fields to be added to the list
<ide> * @param bool $overwrite whether to reset order with field list or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function order($fields, $overwrite = false)
<ide> {
<ide> public function order($fields, $overwrite = false)
<ide> *
<ide> * @param string|\Cake\Database\Expression\QueryExpression $field The field to order on.
<ide> * @param bool $overwrite Whether or not to reset the order clauses.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function orderAsc($field, $overwrite = false)
<ide> {
<ide> public function orderAsc($field, $overwrite = false)
<ide> *
<ide> * @param string|\Cake\Database\Expression\QueryExpression $field The field to order on.
<ide> * @param bool $overwrite Whether or not to reset the order clauses.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function orderDesc($field, $overwrite = false)
<ide> {
<ide> public function orderDesc($field, $overwrite = false)
<ide> *
<ide> * @param array|\Cake\Database\ExpressionInterface|string $fields fields to be added to the list
<ide> * @param bool $overwrite whether to reset fields with passed list or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function group($fields, $overwrite = false)
<ide> {
<ide> public function group($fields, $overwrite = false)
<ide> * @param array $types associative array of type names used to bind values to query
<ide> * @param bool $overwrite whether to reset conditions with passed list or not
<ide> * @see \Cake\Database\Query::where()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function having($conditions = null, $types = [], $overwrite = false)
<ide> {
<ide> public function having($conditions = null, $types = [], $overwrite = false)
<ide> * @param string|array|\Cake\Database\ExpressionInterface|callable $conditions The AND conditions for HAVING.
<ide> * @param array $types associative array of type names used to bind values to query
<ide> * @see \Cake\Database\Query::andWhere()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function andHaving($conditions, $types = [])
<ide> {
<ide> public function andHaving($conditions, $types = [])
<ide> * @param string|array|\Cake\Database\ExpressionInterface|callable $conditions The OR conditions for HAVING.
<ide> * @param array $types associative array of type names used to bind values to query.
<ide> * @see \Cake\Database\Query::orWhere()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function orHaving($conditions, $types = [])
<ide> {
<ide> public function orHaving($conditions, $types = [])
<ide> * @param int $num The page number you want.
<ide> * @param int|null $limit The number of rows you want in the page. If null
<ide> * the current limit clause will be used.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function page($num, $limit = null)
<ide> {
<ide> public function page($num, $limit = null)
<ide> * ```
<ide> *
<ide> * @param int|\Cake\Database\ExpressionInterface $num number of records to be returned
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function limit($num)
<ide> {
<ide> public function limit($num)
<ide> * ```
<ide> *
<ide> * @param int|\Cake\Database\ExpressionInterface $num number of records to be skipped
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function offset($num)
<ide> {
<ide> public function offset($num)
<ide> *
<ide> * @param string|\Cake\Database\Query $query full SQL query to be used in UNION operator
<ide> * @param bool $overwrite whether to reset the list of queries to be operated or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function union($query, $overwrite = false)
<ide> {
<ide> public function union($query, $overwrite = false)
<ide> *
<ide> * @param string|\Cake\Database\Query $query full SQL query to be used in UNION operator
<ide> * @param bool $overwrite whether to reset the list of queries to be operated or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function unionAll($query, $overwrite = false)
<ide> {
<ide> public function unionAll($query, $overwrite = false)
<ide> *
<ide> * @param array $columns The columns to insert into.
<ide> * @param array $types A map between columns & their datatypes.
<del> * @return $this
<add> * @return self
<ide> * @throws \RuntimeException When there are 0 columns.
<ide> */
<ide> public function insert(array $columns, array $types = [])
<ide> public function insert(array $columns, array $types = [])
<ide> * Set the table name for insert queries.
<ide> *
<ide> * @param string $table The table name to insert into.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function into($table)
<ide> {
<ide> public function into($table)
<ide> * instance to insert data from another SELECT statement.
<ide> *
<ide> * @param array|\Cake\Database\Query $data The data to insert.
<del> * @return $this
<add> * @return self
<ide> * @throws \Cake\Database\Exception if you try to set values before declaring columns.
<ide> * Or if you try to set values on non-insert queries.
<ide> */
<ide> public function values($data)
<ide> * Can be combined with set() and where() methods to create update queries.
<ide> *
<ide> * @param string $table The table you want to update.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function update($table)
<ide> {
<ide> public function update($table)
<ide> * array or QueryExpression. When $key is an array, this parameter will be
<ide> * used as $types instead.
<ide> * @param array $types The column types to treat data as.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function set($key, $value = null, $types = [])
<ide> {
<ide> public function set($key, $value = null, $types = [])
<ide> * create delete queries with specific conditions.
<ide> *
<ide> * @param string|null $table The table to use when deleting.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function delete($table = null)
<ide> {
<ide> public function delete($table = null)
<ide> * ```
<ide> *
<ide> * @param string|\Cake\Database\Expression\QueryExpression|null $expression The expression to be appended
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function epilog($expression = null)
<ide> {
<ide> public function clause($name)
<ide> *
<ide> * @param callable|null $callback The callback to invoke when results are fetched.
<ide> * @param bool $overwrite Whether or not this should append or replace all existing decorators.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function decorateResults($callback, $overwrite = false)
<ide> {
<ide> public function decorateResults($callback, $overwrite = false)
<ide> *
<ide> * @param callable $callback the function to be executed for each ExpressionInterface
<ide> * found inside this query.
<del> * @return $this|null
<add> * @return self|null
<ide> */
<ide> public function traverseExpressions(callable $callback)
<ide> {
<ide> public function traverseExpressions(callable $callback)
<ide> * @param mixed $value The value to be bound
<ide> * @param string|int $type the mapped type name, used for casting when sending
<ide> * to database
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function bind($param, $value, $type = 'string')
<ide> {
<ide> public function bind($param, $value, $type = 'string')
<ide> *
<ide> * @param \Cake\Database\ValueBinder|null $binder new instance to be set. If no value is passed the
<ide> * default one will be returned
<del> * @return $this|\Cake\Database\ValueBinder
<add> * @return self|\Cake\Database\ValueBinder
<ide> */
<ide> public function valueBinder($binder = null)
<ide> {
<ide> public function valueBinder($binder = null)
<ide> * remembered for future iterations.
<ide> *
<ide> * @param bool $enable Whether or not to enable buffering
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function enableBufferedResults($enable)
<ide> {
<ide> public function isBufferedResultsEnabled()
<ide> *
<ide> * @deprecated 3.4.0 Use enableBufferedResults()/isBufferedResultsEnabled() instead.
<ide> * @param bool|null $enable Whether or not to enable buffering
<del> * @return bool|$this
<add> * @return bool|self
<ide> */
<ide> public function bufferResults($enable = null)
<ide> {
<ide> public function bufferResults($enable = null)
<ide> * select clause are stored.
<ide> *
<ide> * @param \Cake\Database\TypeMap $typeMap The map object to use
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setSelectTypeMap(TypeMap $typeMap)
<ide> {
<ide> public function getSelectTypeMap()
<ide> *
<ide> * @deprecated 3.4.0 Use setSelectTypeMap()/getSelectTypeMap() instead.
<ide> * @param \Cake\Database\TypeMap|null $typeMap The map object to use
<del> * @return $this|\Cake\Database\TypeMap
<add> * @return self|\Cake\Database\TypeMap
<ide> */
<ide> public function selectTypeMap(TypeMap $typeMap = null)
<ide> {
<ide><path>src/Database/Schema/CachedCollection.php
<ide> public function cacheKey($name)
<ide> * disables it if false is passed.
<ide> *
<ide> * @param bool $enable Whether or not to enable caching
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setCacheMetadata($enable)
<ide> {
<ide><path>src/Database/Schema/TableSchema.php
<ide> public function name()
<ide> *
<ide> * @param string $name The name of the column
<ide> * @param array $attrs The attributes for the column.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addColumn($name, $attrs)
<ide> {
<ide> public function defaultValues()
<ide> *
<ide> * @param string $name The name of the index.
<ide> * @param array $attrs The attributes for the index.
<del> * @return $this
<add> * @return self
<ide> * @throws \Cake\Database\Exception
<ide> */
<ide> public function addIndex($name, $attrs)
<ide> public function primaryKey()
<ide> *
<ide> * @param string $name The name of the constraint.
<ide> * @param array $attrs The attributes for the constraint.
<del> * @return $this
<add> * @return self
<ide> * @throws \Cake\Database\Exception
<ide> */
<ide> public function addConstraint($name, $attrs)
<ide> public function constraint($name)
<ide> * For example the engine type in MySQL.
<ide> *
<ide> * @param array $options The options to set, or null to read options.
<del> * @return $this TableSchema instance
<add> * @return self TableSchema instance
<ide> */
<ide> public function setOptions($options)
<ide> {
<ide> public function getOptions()
<ide> *
<ide> * @deprecated 3.4.0 Use setOptions()/getOptions() instead.
<ide> * @param array|null $options The options to set, or null to read options.
<del> * @return $this|array Either the TableSchema instance, or an array of options when reading.
<add> * @return self|array Either the TableSchema instance, or an array of options when reading.
<ide> */
<ide> public function options($options = null)
<ide> {
<ide> public function options($options = null)
<ide> * Sets whether the table is temporary in the database.
<ide> *
<ide> * @param bool $temporary Whether or not the table is to be temporary.
<del> * @return $this Instance.
<add> * @return self Instance.
<ide> */
<ide> public function setTemporary($temporary)
<ide> {
<ide> public function isTemporary()
<ide> *
<ide> * @deprecated 3.4.0 Use setTemporary()/isTemporary() instead.
<ide> * @param bool|null $temporary whether or not the table is to be temporary
<del> * @return $this|bool Either the TableSchema instance, the current temporary setting
<add> * @return self|bool Either the TableSchema instance, the current temporary setting
<ide> */
<ide> public function temporary($temporary = null)
<ide> {
<ide><path>src/Database/Statement/BufferResultsTrait.php
<ide> trait BufferResultsTrait
<ide> * Whether or not to buffer results in php
<ide> *
<ide> * @param bool $buffer Toggle buffering
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function bufferResults($buffer)
<ide> {
<ide><path>src/Database/Type/DateTimeType.php
<ide> public function marshal($value)
<ide> * by using a locale aware parser.
<ide> *
<ide> * @param bool $enable Whether or not to enable
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function useLocaleParser($enable = true)
<ide> {
<ide> public function useLocaleParser($enable = true)
<ide> *
<ide> * @param string|array $format The format in which the string are passed.
<ide> * @see \Cake\I18n\Time::parseDateTime()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setLocaleFormat($format)
<ide> {
<ide> public function setLocaleFormat($format)
<ide> /**
<ide> * Change the preferred class name to the FrozenTime implementation.
<ide> *
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function useImmutable()
<ide> {
<ide> protected function _setClassName($class, $fallback)
<ide> /**
<ide> * Change the preferred class name to the mutable Time implementation.
<ide> *
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function useMutable()
<ide> {
<ide><path>src/Database/Type/DateType.php
<ide> class DateType extends DateTimeType
<ide> /**
<ide> * Change the preferred class name to the FrozenDate implementation.
<ide> *
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function useImmutable()
<ide> {
<ide> public function useImmutable()
<ide> /**
<ide> * Change the preferred class name to the mutable Date implementation.
<ide> *
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function useMutable()
<ide> {
<ide><path>src/Database/Type/DecimalType.php
<ide> public function marshal($value)
<ide> * by using a locale aware parser.
<ide> *
<ide> * @param bool $enable Whether or not to enable
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function useLocaleParser($enable = true)
<ide> {
<ide><path>src/Database/Type/FloatType.php
<ide> public function marshal($value)
<ide> * by using a locale aware parser.
<ide> *
<ide> * @param bool $enable Whether or not to enable
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function useLocaleParser($enable = true)
<ide> {
<ide><path>src/Database/TypeMap.php
<ide> public function __construct(array $defaults = [])
<ide> *
<ide> * @param array $defaults Associative array where keys are field names and values
<ide> * are the correspondent type.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setDefaults(array $defaults)
<ide> {
<ide> public function setDefaults(array $defaults)
<ide> /**
<ide> * Returns the currently configured types.
<ide> *
<del> * @return $this|array
<add> * @return self|array
<ide> */
<ide> public function getDefaults()
<ide> {
<ide> public function getDefaults()
<ide> * @deprecated 3.4.0 Use setDefaults()/getDefaults() instead.
<ide> * @param array|null $defaults associative array where keys are field names and values
<ide> * are the correspondent type.
<del> * @return $this|array
<add> * @return self|array
<ide> */
<ide> public function defaults(array $defaults = null)
<ide> {
<ide> public function addDefaults(array $types)
<ide> *
<ide> * @param array $types Associative array where keys are field names and values
<ide> * are the correspondent type.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setTypes(array $types)
<ide> {
<ide> public function getTypes()
<ide> * @deprecated 3.4.0 Use setTypes()/getTypes() instead.
<ide> * @param array|null $types associative array where keys are field names and values
<ide> * are the correspondent type.
<del> * @return $this|array
<add> * @return self|array
<ide> */
<ide> public function types(array $types = null)
<ide> {
<ide><path>src/Database/TypeMapTrait.php
<ide> trait TypeMapTrait
<ide> * Creates a new TypeMap if $typeMap is an array, otherwise exchanges it for the given one.
<ide> *
<ide> * @param array|\Cake\Database\TypeMap $typeMap Creates a TypeMap if array, otherwise sets the given TypeMap
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setTypeMap($typeMap)
<ide> {
<ide> public function getTypeMap()
<ide> *
<ide> * @deprecated 3.4.0 Use setTypeMap()/getTypeMap() instead.
<ide> * @param array|\Cake\Database\TypeMap|null $typeMap Creates a TypeMap if array, otherwise sets the given TypeMap
<del> * @return $this|\Cake\Database\TypeMap
<add> * @return self|\Cake\Database\TypeMap
<ide> */
<ide> public function typeMap($typeMap = null)
<ide> {
<ide> public function typeMap($typeMap = null)
<ide> * Allows setting default types when chaining query.
<ide> *
<ide> * @param array $types The array of types to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setDefaultTypes(array $types)
<ide> {
<ide> public function getDefaultTypes()
<ide> *
<ide> * @deprecated 3.4.0 Use setDefaultTypes()/getDefaultTypes() instead.
<ide> * @param array|null $types The array of types to set.
<del> * @return $this|array
<add> * @return self|array
<ide> */
<ide> public function defaultTypes(array $types = null)
<ide> {
<ide><path>src/Database/TypedResultInterface.php
<ide> interface TypedResultInterface
<ide> * If called without arguments, returns the current known type
<ide> *
<ide> * @param string|null $type The name of the type that is to be returned
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function returnType($type = null);
<ide> }
<ide><path>src/Database/TypedResultTrait.php
<ide> trait TypedResultTrait
<ide> * If called without arguments, returns the current known type
<ide> *
<ide> * @param string|null $type The name of the type that is to be returned
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function returnType($type = null)
<ide> {
<ide><path>src/Datasource/EntityTrait.php
<ide> public function __unset($property)
<ide> * first argument is also an array, in which case will be treated as $options
<ide> * @param array $options options to be used for setting the property. Allowed option
<ide> * keys are `setter` and `guard`
<del> * @return $this
<add> * @return self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> public function set($property, $value = null, array $options = [])
<ide> public function has($property)
<ide> * ```
<ide> *
<ide> * @param string|array $property The property to unset.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function unsetProperty($property)
<ide> {
<ide> public function unsetProperty($property)
<ide> * will be returned. Otherwise the hidden properties will be set.
<ide> *
<ide> * @param null|array $properties Either an array of properties to hide or null to get properties
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function hiddenProperties($properties = null)
<ide> {
<ide> public function hiddenProperties($properties = null)
<ide> * will be returned. Otherwise the virtual properties will be set.
<ide> *
<ide> * @param null|array $properties Either an array of properties to treat as virtual or null to get properties
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function virtualProperties($properties = null)
<ide> {
<ide> public function isNew($new = null)
<ide> * @param string|array|null $field The field to get errors for, or the array of errors to set.
<ide> * @param string|array|null $errors The errors to be set for $field
<ide> * @param bool $overwrite Whether or not to overwrite pre-existing errors for $field
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function errors($field = null, $errors = null, $overwrite = false)
<ide> {
<ide> protected function _readError($object, $path = null)
<ide> * @param string|array|null $field The field to get invalid value for, or the value to set.
<ide> * @param mixed|null $value The invalid value to be set for $field.
<ide> * @param bool $overwrite Whether or not to overwrite pre-existing values for $field.
<del> * @return $this|mixed
<add> * @return self|mixed
<ide> */
<ide> public function invalid($field = null, $value = null, $overwrite = false)
<ide> {
<ide> public function invalid($field = null, $value = null, $overwrite = false)
<ide> * @param string|array $property single or list of properties to change its accessibility
<ide> * @param bool|null $set true marks the property as accessible, false will
<ide> * mark it as protected.
<del> * @return $this|bool
<add> * @return self|bool
<ide> */
<ide> public function accessible($property, $set = null)
<ide> {
<ide> public function accessible($property, $set = null)
<ide> * this entity came from if it is known.
<ide> *
<ide> * @param string|null $alias the alias of the repository
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function source($alias = null)
<ide> {
<ide><path>src/Datasource/InvalidPropertyInterface.php
<ide> interface InvalidPropertyInterface
<ide> * @param string|array|null $field The field to get invalid value for, or the value to set.
<ide> * @param mixed|null $value The invalid value to be set for $field.
<ide> * @param bool $overwrite Whether or not to overwrite pre-existing values for $field.
<del> * @return $this|mixed
<add> * @return self|mixed
<ide> */
<ide> public function invalid($field = null, $value = null, $overwrite = false);
<ide> }
<ide><path>src/Datasource/ModelAwareTrait.php
<ide> public function modelFactory($type, callable $factory)
<ide> *
<ide> * @param string|null $modelType The model type or null to retrieve the current
<ide> *
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function modelType($modelType = null)
<ide> {
<ide><path>src/Datasource/QueryInterface.php
<ide> public function all();
<ide> * ```
<ide> *
<ide> * @param array $options list of query clauses to apply new parts to.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function applyOptions(array $options);
<ide>
<ide> public function applyOptions(array $options);
<ide> *
<ide> * @param string $finder The finder method to use.
<ide> * @param array $options The options for the finder.
<del> * @return $this Returns a modified query.
<add> * @return self Returns a modified query.
<ide> */
<ide> public function find($finder, array $options = []);
<ide>
<ide> public function count();
<ide> * ```
<ide> *
<ide> * @param int $num number of records to be returned
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function limit($num);
<ide>
<ide> public function limit($num);
<ide> * ```
<ide> *
<ide> * @param int $num number of records to be skipped
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function offset($num);
<ide>
<ide> public function offset($num);
<ide> *
<ide> * @param array|string $fields fields to be added to the list
<ide> * @param bool $overwrite whether to reset order with field list or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function order($fields, $overwrite = false);
<ide>
<ide> public function order($fields, $overwrite = false);
<ide> * @param int $num The page number you want.
<ide> * @param int|null $limit The number of rows you want in the page. If null
<ide> * the current limit clause will be used.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function page($num, $limit = null);
<ide>
<ide> public function toArray();
<ide> * that is, the repository that will appear in the from clause.
<ide> *
<ide> * @param \Cake\Datasource\RepositoryInterface|null $repository The default repository object to use
<del> * @return \Cake\Datasource\RepositoryInterface|$this
<add> * @return \Cake\Datasource\RepositoryInterface|self
<ide> */
<ide> public function repository(RepositoryInterface $repository = null);
<ide>
<ide> public function repository(RepositoryInterface $repository = null);
<ide> * @param string|array|callable|null $conditions The conditions to filter on.
<ide> * @param array $types associative array of type names used to bind values to query
<ide> * @param bool $overwrite whether to reset conditions with passed list or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function where($conditions = null, $types = [], $overwrite = false);
<ide> }
<ide><path>src/Datasource/QueryTrait.php
<ide> trait QueryTrait
<ide> * and this query object will be returned for chaining.
<ide> *
<ide> * @param \Cake\Datasource\RepositoryInterface|null $table The default table object to use
<del> * @return \Cake\Datasource\RepositoryInterface|$this
<add> * @return \Cake\Datasource\RepositoryInterface|self
<ide> */
<ide> public function repository(RepositoryInterface $table = null)
<ide> {
<ide> public function repository(RepositoryInterface $table = null)
<ide> * This method is most useful when combined with results stored in a persistent cache.
<ide> *
<ide> * @param \Cake\Datasource\ResultSetInterface $results The results this query should return.
<del> * @return $this The query instance.
<add> * @return self The query instance.
<ide> */
<ide> public function setResult($results)
<ide> {
<ide> public function getIterator()
<ide> * When using a function, this query instance will be supplied as an argument.
<ide> * @param string|\Cake\Cache\CacheEngine $config Either the name of the cache config to use, or
<ide> * a cache config instance.
<del> * @return $this This instance
<add> * @return self This instance
<ide> */
<ide> public function cache($key, $config = 'default')
<ide> {
<ide> public function cache($key, $config = 'default')
<ide> * passed, the current configured query `_eagerLoaded` value is returned.
<ide> *
<ide> * @param bool|null $value Whether or not to eager load.
<del> * @return $this|\Cake\ORM\Query
<add> * @return self|\Cake\ORM\Query
<ide> */
<ide> public function eagerLoaded($value = null)
<ide> {
<ide> public function toArray()
<ide> * @param callable|null $mapper The mapper callable.
<ide> * @param callable|null $reducer The reducing function.
<ide> * @param bool $overwrite Set to true to overwrite existing map + reduce functions.
<del> * @return $this|array
<add> * @return self|array
<ide> * @see \Cake\Collection\Iterator\MapReduce for details on how to use emit data to the map reducer.
<ide> */
<ide> public function mapReduce(callable $mapper = null, callable $reducer = null, $overwrite = false)
<ide> public function mapReduce(callable $mapper = null, callable $reducer = null, $ov
<ide> *
<ide> * @param callable|null $formatter The formatting callable.
<ide> * @param bool|int $mode Whether or not to overwrite, append or prepend the formatter.
<del> * @return $this|array
<add> * @return self|array
<ide> */
<ide> public function formatResults(callable $formatter = null, $mode = 0)
<ide> {
<ide> public function __call($method, $arguments)
<ide> * This is handy for passing all query clauses at once.
<ide> *
<ide> * @param array $options the options to be applied
<del> * @return $this This object
<add> * @return self This object
<ide> */
<ide> abstract public function applyOptions(array $options);
<ide>
<ide><path>src/Datasource/RuleInvoker.php
<ide> public function __construct(callable $rule, $name, array $options = [])
<ide> * Old options will be merged with the new ones.
<ide> *
<ide> * @param array $options The options to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setOptions(array $options)
<ide> {
<ide> public function setOptions(array $options)
<ide> * Only truthy names will be set.
<ide> *
<ide> * @param string $name The name to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setName($name)
<ide> {
<ide><path>src/Datasource/RulesChecker.php
<ide> public function __construct(array $options = [])
<ide> * @param string|null $name The alias for a rule.
<ide> * @param array $options List of extra options to pass to the rule callable as
<ide> * second argument.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function add(callable $rule, $name = null, array $options = [])
<ide> {
<ide> public function add(callable $rule, $name = null, array $options = [])
<ide> * @param string|null $name The alias for a rule.
<ide> * @param array $options List of extra options to pass to the rule callable as
<ide> * second argument.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addCreate(callable $rule, $name = null, array $options = [])
<ide> {
<ide> public function addCreate(callable $rule, $name = null, array $options = [])
<ide> * @param string|null $name The alias for a rule.
<ide> * @param array $options List of extra options to pass to the rule callable as
<ide> * second argument.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addUpdate(callable $rule, $name = null, array $options = [])
<ide> {
<ide> public function addUpdate(callable $rule, $name = null, array $options = [])
<ide> * @param string|null $name The alias for a rule.
<ide> * @param array $options List of extra options to pass to the rule callable as
<ide> * second argument.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addDelete(callable $rule, $name = null, array $options = [])
<ide> {
<ide><path>src/Event/Event.php
<ide> public function result()
<ide> * Listeners can attach a result value to the event.
<ide> *
<ide> * @param mixed $value The value to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setResult($value = null)
<ide> {
<ide> public function data($key = null)
<ide> *
<ide> * @param array|string $key An array will replace all payload data, and a key will set just that array item.
<ide> * @param mixed $value The value to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setData($key, $value = null)
<ide> {
<ide><path>src/Form/Schema.php
<ide> class Schema
<ide> * Add multiple fields to the schema.
<ide> *
<ide> * @param array $fields The fields to add.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addFields(array $fields)
<ide> {
<ide> public function addFields(array $fields)
<ide> * @param string $name The field name.
<ide> * @param string|array $attrs The attributes for the field, or the type
<ide> * as a string.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addField($name, $attrs)
<ide> {
<ide> public function addField($name, $attrs)
<ide> * Removes a field to the schema.
<ide> *
<ide> * @param string $name The field to remove.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function removeField($name)
<ide> {
<ide><path>src/Http/Client/FormData.php
<ide> public function newPart($name, $value)
<ide> * @param string|\Cake\Http\Client\FormData $name The name of the part to add,
<ide> * or the part data object.
<ide> * @param mixed $value The value for the part.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function add($name, $value = null)
<ide> {
<ide> public function add($name, $value = null)
<ide> * Iterates the parameter and adds all the key/values.
<ide> *
<ide> * @param array $data Array of data to add.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addMany(array $data)
<ide> {
<ide><path>src/Http/Client/Request.php
<ide> public function __construct($url = '', $method = self::METHOD_GET, array $header
<ide> * compatibility reasons, and is not part of the PSR7 interface.
<ide> *
<ide> * @param string|null $method The method for the request.
<del> * @return $this|string Either this or the current method.
<add> * @return self|string Either this or the current method.
<ide> * @throws \Cake\Core\Exception\Exception On invalid methods.
<ide> * @deprecated 3.3.0 Use getMethod() and withMethod() instead.
<ide> */
<ide> public function method($method = null)
<ide> * compatibility reasons, and is not part of the PSR7 interface.
<ide> *
<ide> * @param string|null $url The url for the request. Leave null for get
<del> * @return $this|string Either $this or the url value.
<add> * @return self|string Either $this or the url value.
<ide> * @deprecated 3.3.0 Use getUri() and withUri() instead.
<ide> */
<ide> public function url($url = null)
<ide> public function cookie($name, $value = null)
<ide> * compatibility reasons, and is not part of the PSR7 interface.
<ide> *
<ide> * @param string|null $version The HTTP version.
<del> * @return $this|string Either $this or the HTTP version.
<add> * @return self|string Either $this or the HTTP version.
<ide> * @deprecated 3.3.0 Use getProtocolVersion() and withProtocolVersion() instead.
<ide> */
<ide> public function version($version = null)
<ide><path>src/Http/MiddlewareQueue.php
<ide> protected function resolve($index)
<ide> * Append a middleware callable to the end of the queue.
<ide> *
<ide> * @param callable|string|array $middleware The middleware(s) to append.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function add($middleware)
<ide> {
<ide> public function add($middleware)
<ide> * Alias for MiddlewareQueue::add().
<ide> *
<ide> * @param callable|string|array $middleware The middleware(s) to append.
<del> * @return $this
<add> * @return self
<ide> * @see MiddlewareQueue::add()
<ide> */
<ide> public function push($middleware)
<ide> public function push($middleware)
<ide> * Prepend a middleware to the start of the queue.
<ide> *
<ide> * @param callable|string|array $middleware The middleware(s) to prepend.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function prepend($middleware)
<ide> {
<ide> public function prepend($middleware)
<ide> *
<ide> * @param int $index The index to insert at.
<ide> * @param callable|string $middleware The middleware to insert.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function insertAt($index, $middleware)
<ide> {
<ide> public function insertAt($index, $middleware)
<ide> *
<ide> * @param string $class The classname to insert the middleware before.
<ide> * @param callable|string $middleware The middleware to insert.
<del> * @return $this
<add> * @return self
<ide> * @throws \LogicException If middleware to insert before is not found.
<ide> */
<ide> public function insertBefore($class, $middleware)
<ide> public function insertBefore($class, $middleware)
<ide> *
<ide> * @param string $class The classname to insert the middleware before.
<ide> * @param callable|string $middleware The middleware to insert.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function insertAfter($class, $middleware)
<ide> {
<ide><path>src/Http/Server.php
<ide> public function emit(ResponseInterface $response, EmitterInterface $emitter = nu
<ide> * Set the application.
<ide> *
<ide> * @param BaseApplication $app The application to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setApp(BaseApplication $app)
<ide> {
<ide> public function getApp()
<ide> * Set the runner
<ide> *
<ide> * @param \Cake\Http\Runner $runner The runner to use.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setRunner(Runner $runner)
<ide> {
<ide><path>src/Http/ServerRequest.php
<ide> public static function addDetector($name, $callable)
<ide> * This modifies the parameters available through `$request->params`.
<ide> *
<ide> * @param array $params Array of parameters to merge in
<del> * @return $this The current object, you can chain this method.
<add> * @return self The current object, you can chain this method.
<ide> */
<ide> public function addParams(array $params)
<ide> {
<ide> public function addParams(array $params)
<ide> * Provides an easy way to modify, here, webroot and base.
<ide> *
<ide> * @param array $paths Array of paths to merge in
<del> * @return $this The current object, you can chain this method.
<add> * @return self The current object, you can chain this method.
<ide> */
<ide> public function addPaths(array $paths)
<ide> {
<ide> public function getQuery($name, $default = null)
<ide> *
<ide> * @param string|null $name Dot separated name of the value to read/write
<ide> * @param mixed ...$args The data to set (deprecated)
<del> * @return mixed|$this Either the value being read, or this so you can chain consecutive writes.
<add> * @return mixed|self Either the value being read, or this so you can chain consecutive writes.
<ide> * @deprecated 3.4.0 Use withData() and getData() or getParsedBody() instead.
<ide> */
<ide> public function data($name = null, ...$args)
<ide> public function getData($name = null, $default = null)
<ide> *
<ide> * @param string $name The name of the parameter to get.
<ide> * @param mixed ...$args Value to set (deprecated).
<del> * @return mixed|$this The value of the provided parameter. Will
<add> * @return mixed|self The value of the provided parameter. Will
<ide> * return false if the parameter doesn't exist or is falsey.
<ide> * @deprecated 3.4.0 Use getParam() and withParam() instead.
<ide> */
<ide> public function withProtocolVersion($version)
<ide> * @param string|null $value Value to set. Default null.
<ide> * @param string|null $default Default value when trying to retrieve an environment
<ide> * variable's value that does not exist. The value parameter must be null.
<del> * @return $this|string|null This instance if used as setter,
<add> * @return self|string|null This instance if used as setter,
<ide> * if used as getter either the environment value, or null if the value doesn't exist.
<ide> */
<ide> public function env($key, $value = null, $default = null)
<ide><path>src/Mailer/Email.php
<ide> public function __clone()
<ide> * @param string|array|null $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return array|$this
<add> * @return array|self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> public function from($email = null, $name = null)
<ide> public function from($email = null, $name = null)
<ide> * @param string|array|null $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return array|$this
<add> * @return array|self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> public function sender($email = null, $name = null)
<ide> public function sender($email = null, $name = null)
<ide> * @param string|array|null $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return array|$this
<add> * @return array|self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> public function replyTo($email = null, $name = null)
<ide> public function replyTo($email = null, $name = null)
<ide> * @param string|array|null $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return array|$this
<add> * @return array|self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> public function readReceipt($email = null, $name = null)
<ide> public function readReceipt($email = null, $name = null)
<ide> * @param string|array|null $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return array|$this
<add> * @return array|self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> public function returnPath($email = null, $name = null)
<ide> public function returnPath($email = null, $name = null)
<ide> * @param string|array|null $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function to($email = null, $name = null)
<ide> {
<ide> public function to($email = null, $name = null)
<ide> * @param string|array $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addTo($email, $name = null)
<ide> {
<ide> public function addTo($email, $name = null)
<ide> * @param string|array|null $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function cc($email = null, $name = null)
<ide> {
<ide> public function cc($email = null, $name = null)
<ide> * @param string|array $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addCc($email, $name = null)
<ide> {
<ide> public function addCc($email, $name = null)
<ide> * @param string|array|null $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function bcc($email = null, $name = null)
<ide> {
<ide> public function bcc($email = null, $name = null)
<ide> * @param string|array $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string|null $name Name
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addBcc($email, $name = null)
<ide> {
<ide> public function headerCharset($charset = null)
<ide> * @param string|bool|null $regex The pattern to use for email address validation,
<ide> * null to unset the pattern and make use of filter_var() instead, false or
<ide> * nothing to return the current value
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function emailPattern($regex = false)
<ide> {
<ide> public function emailPattern($regex = false)
<ide> * @param string|array $email String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string $name Name
<del> * @return $this
<add> * @return self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> protected function _setEmail($varName, $email, $name)
<ide> protected function _validateEmail($email)
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string $name Name
<ide> * @param string $throwMessage Exception message
<del> * @return $this
<add> * @return self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> protected function _setEmailSingle($varName, $email, $name, $throwMessage)
<ide> protected function _setEmailSingle($varName, $email, $name, $throwMessage)
<ide> * @param string|array $email String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> * @param string $name Name
<del> * @return $this
<add> * @return self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> protected function _addEmail($varName, $email, $name)
<ide> protected function _addEmail($varName, $email, $name)
<ide> * Get/Set Subject.
<ide> *
<ide> * @param string|null $subject Subject string.
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function subject($subject = null)
<ide> {
<ide> public function getOriginalSubject()
<ide> * Sets headers for the message
<ide> *
<ide> * @param array $headers Associative array containing headers to be set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setHeaders(array $headers)
<ide> {
<ide> public function setHeaders(array $headers)
<ide> * Add header for the message
<ide> *
<ide> * @param array $headers Headers to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addHeaders(array $headers)
<ide> {
<ide> protected function _formatAddress($address)
<ide> *
<ide> * @param bool|string $template Template name or null to not use
<ide> * @param bool|string $layout Layout name or null to not use
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function template($template = false, $layout = false)
<ide> {
<ide> public function template($template = false, $layout = false)
<ide> * View class for render
<ide> *
<ide> * @param string|null $viewClass View class name.
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function viewRender($viewClass = null)
<ide> {
<ide> public function viewRender($viewClass = null)
<ide> * Variables to be set on render
<ide> *
<ide> * @param array|null $viewVars Variables to set for view.
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function viewVars($viewVars = null)
<ide> {
<ide> public function viewVars($viewVars = null)
<ide> * Theme to use when rendering
<ide> *
<ide> * @param string|null $theme Theme name.
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function theme($theme = null)
<ide> {
<ide> public function theme($theme = null)
<ide> * Helpers to be used in render
<ide> *
<ide> * @param array|null $helpers Helpers list.
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function helpers($helpers = null)
<ide> {
<ide> public function helpers($helpers = null)
<ide> * Email format
<ide> *
<ide> * @param string|null $format Formatting string.
<del> * @return string|$this
<add> * @return string|self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> public function emailFormat($format = null)
<ide> public function emailFormat($format = null)
<ide> *
<ide> * @param string|\Cake\Mailer\AbstractTransport|null $name Either the name of a configured
<ide> * transport, or a transport instance.
<del> * @return \Cake\Mailer\AbstractTransport|$this
<add> * @return \Cake\Mailer\AbstractTransport|self
<ide> * @throws \LogicException When the chosen transport lacks a send method.
<ide> * @throws \InvalidArgumentException When $name is neither a string nor an object.
<ide> */
<ide> protected function _constructTransport($name)
<ide> * Message-ID
<ide> *
<ide> * @param bool|string|null $message True to generate a new Message-ID, False to ignore (not send in email), String to set as Message-ID
<del> * @return bool|string|$this
<add> * @return bool|string|self
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> public function messageId($message = null)
<ide> public function messageId($message = null)
<ide> * Domain as top level (the part after @)
<ide> *
<ide> * @param string|null $domain Manually set the domain for CLI mailing
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function domain($domain = null)
<ide> {
<ide> public function domain($domain = null)
<ide> * attachment compatibility with outlook email clients.
<ide> *
<ide> * @param string|array|null $attachments String with the filename or array with filenames
<del> * @return array|$this Either the array of attachments when getting or $this when setting.
<add> * @return array|self Either the array of attachments when getting or $this when setting.
<ide> * @throws \InvalidArgumentException
<ide> */
<ide> public function attachments($attachments = null)
<ide> public function attachments($attachments = null)
<ide> * Add attachments
<ide> *
<ide> * @param string|array $attachments String with the filename or array with filenames
<del> * @return $this
<add> * @return self
<ide> * @throws \InvalidArgumentException
<ide> * @see \Cake\Mailer\Email::attachments()
<ide> */
<ide> public static function dropTransport($key)
<ide> *
<ide> * @param null|string|array $config String with configuration name, or
<ide> * an array with config or null to return current config.
<del> * @return string|array|$this
<add> * @return string|array|self
<ide> */
<ide> public function profile($config = null)
<ide> {
<ide> protected function _applyConfig($config)
<ide> /**
<ide> * Reset all the internal variables to be able to send out a new email.
<ide> *
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function reset()
<ide> {
<ide> protected function _checkViewVars(&$item, $key)
<ide> * Configures an email instance object from serialized config.
<ide> *
<ide> * @param array $config Email configuration array.
<del> * @return $this Configured email instance.
<add> * @return self Configured email instance.
<ide> */
<ide> public function createFromArray($config)
<ide> {
<ide><path>src/Mailer/Mailer.php
<ide> public function getName()
<ide> * Sets layout to use.
<ide> *
<ide> * @param string $layout Name of the layout to use.
<del> * @return $this object.
<add> * @return self object.
<ide> */
<ide> public function layout($layout)
<ide> {
<ide> public function viewBuilder()
<ide> *
<ide> * @param string $method Method name.
<ide> * @param array $args Method arguments
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function __call($method, $args)
<ide> {
<ide> public function __call($method, $args)
<ide> *
<ide> * @param string|array $key Variable name or hash of view variables.
<ide> * @param mixed $value View variable value.
<del> * @return $this object.
<add> * @return self object.
<ide> */
<ide> public function set($key, $value = null)
<ide> {
<ide> public function send($action, $args = [], $headers = [])
<ide> /**
<ide> * Reset email instance.
<ide> *
<del> * @return $this
<add> * @return self
<ide> */
<ide> protected function reset()
<ide> {
<ide><path>src/Network/CorsBuilder.php
<ide> public function build()
<ide> * You can use `*.example.com` wildcards to accept subdomains, or `*` to allow all domains
<ide> *
<ide> * @param string|array $domain The allowed domains
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function allowOrigin($domain)
<ide> {
<ide> protected function _normalizeDomains($domains)
<ide> * Set the list of allowed HTTP Methods.
<ide> *
<ide> * @param array $methods The allowed HTTP methods
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function allowMethods(array $methods)
<ide> {
<ide> public function allowMethods(array $methods)
<ide> /**
<ide> * Enable cookies to be sent in CORS requests.
<ide> *
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function allowCredentials()
<ide> {
<ide> public function allowCredentials()
<ide> * Whitelist headers that can be sent in CORS requests.
<ide> *
<ide> * @param array $headers The list of headers to accept in CORS requests.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function allowHeaders(array $headers)
<ide> {
<ide> public function allowHeaders(array $headers)
<ide> * Define the headers a client library/browser can expose to scripting
<ide> *
<ide> * @param array $headers The list of headers to expose CORS responses
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function exposeHeaders(array $headers)
<ide> {
<ide> public function exposeHeaders(array $headers)
<ide> * Define the max-age preflight OPTIONS requests are valid for.
<ide> *
<ide> * @param int $age The max-age for OPTIONS requests in seconds
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function maxAge($age)
<ide> {
<ide><path>src/ORM/Association.php
<ide> public function __construct($alias, array $options = [])
<ide> * Sets the name for this association.
<ide> *
<ide> * @param string $name Name to be assigned
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setName($name)
<ide> {
<ide> public function name($name = null)
<ide> * Sets whether or not cascaded deletes should also fire callbacks.
<ide> *
<ide> * @param bool $cascadeCallbacks cascade callbacks switch value
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setCascadeCallbacks($cascadeCallbacks)
<ide> {
<ide> public function className()
<ide> * Sets the table instance for the source side of the association.
<ide> *
<ide> * @param \Cake\ORM\Table $table the instance to be assigned as source side
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setSource(Table $table)
<ide> {
<ide> public function source(Table $table = null)
<ide> * Sets the table instance for the target side of the association.
<ide> *
<ide> * @param \Cake\ORM\Table $table the instance to be assigned as target side
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setTarget(Table $table)
<ide> {
<ide> public function target(Table $table = null)
<ide> *
<ide> * @param array $conditions list of conditions to be used
<ide> * @see \Cake\Database\Query::where() for examples on the format of the array
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setConditions($conditions)
<ide> {
<ide> public function conditions($conditions = null)
<ide> * When not manually specified the primary key of the owning side table is used.
<ide> *
<ide> * @param string $key the table field to be used to link both tables together
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setBindingKey($key)
<ide> {
<ide> public function getForeignKey()
<ide> * Sets the name of the field representing the foreign key to the target table.
<ide> *
<ide> * @param string $key the key to be used to link both tables together
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setForeignKey($key)
<ide> {
<ide> public function foreignKey($key = null)
<ide> * If no parameters are passed the current setting is returned.
<ide> *
<ide> * @param bool $dependent Set the dependent mode. Use null to read the current state.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setDependent($dependent)
<ide> {
<ide> public function canBeJoined(array $options = [])
<ide> * Sets the type of join to be used when adding the association to a query.
<ide> *
<ide> * @param string $type the join type to be used (e.g. INNER)
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setJoinType($type)
<ide> {
<ide> public function joinType($type = null)
<ide> * in the source table record.
<ide> *
<ide> * @param string $name The name of the association property. Use null to read the current value.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setProperty($name)
<ide> {
<ide> protected function _propertyName()
<ide> * rendering any changes to this setting void.
<ide> *
<ide> * @param string $name The strategy type. Use null to read the current value.
<del> * @return $this
<add> * @return self
<ide> * @throws \InvalidArgumentException When an invalid strategy is provided.
<ide> */
<ide> public function setStrategy($name)
<ide> public function getFinder()
<ide> * Sets the default finder to use for fetching rows from the target table.
<ide> *
<ide> * @param string $finder the finder name to use
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setFinder($finder)
<ide> {
<ide><path>src/ORM/Association/BelongsToMany.php
<ide> class BelongsToMany extends Association
<ide> * Sets the name of the field representing the foreign key to the target table.
<ide> *
<ide> * @param string $key the key to be used to link both tables together
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setTargetForeignKey($key)
<ide> {
<ide> public function isOwningSide(Table $side)
<ide> *
<ide> * @param string $strategy the strategy name to be used
<ide> * @throws \InvalidArgumentException if an invalid strategy name is passed
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setSaveStrategy($strategy)
<ide> {
<ide> public function conditions($conditions = null)
<ide> * Sets the current join table, either the name of the Table instance or the instance itself.
<ide> *
<ide> * @param string|\Cake\ORM\Table $through Name of the Table instance or the instance itself
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setThrough($through)
<ide> {
<ide><path>src/ORM/Association/HasMany.php
<ide> public function isOwningSide(Table $side)
<ide> *
<ide> * @param string $strategy the strategy name to be used
<ide> * @throws \InvalidArgumentException if an invalid strategy name is passed
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setSaveStrategy($strategy)
<ide> {
<ide> public function foreignKey($key = null)
<ide> * Sets the sort order in which target records should be returned.
<ide> *
<ide> * @param mixed $sort A find() compatible order clause
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setSort($sort)
<ide> {
<ide><path>src/ORM/Behavior/Translate/TranslateTrait.php
<ide> trait TranslateTrait
<ide> * it.
<ide> *
<ide> * @param string $language Language to return entity for.
<del> * @return $this|\Cake\ORM\Entity
<add> * @return self|\Cake\ORM\Entity
<ide> */
<ide> public function translation($language)
<ide> {
<ide><path>src/ORM/EagerLoadable.php
<ide> public function propertyPath()
<ide> * Sets whether or not this level can be fetched using a join.
<ide> *
<ide> * @param bool $possible The value to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setCanBeJoined($possible)
<ide> {
<ide> public function canBeJoined($possible = null)
<ide> * the records.
<ide> *
<ide> * @param array $config The value to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setConfig(array $config)
<ide> {
<ide><path>src/ORM/EagerLoader.php
<ide> public function clearContain()
<ide> * Sets whether or not contained associations will load fields automatically.
<ide> *
<ide> * @param bool $enable The value to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function enableAutoFields($enable)
<ide> {
<ide> public function autoFields($enable = null)
<ide> * @param callable|null $builder the callback function to be used for setting extra
<ide> * options to the filtering query
<ide> * @param array $options Extra options for the association matching.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setMatching($assoc, callable $builder = null, $options = [])
<ide> {
<ide><path>src/ORM/Locator/TableLocator.php
<ide> class TableLocator implements LocatorInterface
<ide> *
<ide> * @param string|array $alias Name of the alias or array to completely overwrite current config.
<ide> * @param array|null $options list of options for the alias
<del> * @return $this
<add> * @return self
<ide> * @throws \RuntimeException When you attempt to configure an existing table instance.
<ide> */
<ide> public function setConfig($alias, $options = null)
<ide><path>src/ORM/Query.php
<ide> public function __construct($connection, $table)
<ide> * @param array|\Cake\Database\ExpressionInterface|string|\Cake\ORM\Table|\Cake\ORM\Association $fields fields
<ide> * to be added to the list.
<ide> * @param bool $overwrite whether to reset fields with passed list or not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function select($fields = [], $overwrite = false)
<ide> {
<ide> public function select($fields = [], $overwrite = false)
<ide> * This method returns the same query object for chaining.
<ide> *
<ide> * @param \Cake\ORM\Table $table The table to pull types from
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addDefaultTypes(Table $table)
<ide> {
<ide> public function addDefaultTypes(Table $table)
<ide> * and storing containments.
<ide> *
<ide> * @param \Cake\ORM\EagerLoader $instance The eager loader to use.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setEagerLoader(EagerLoader $instance)
<ide> {
<ide> public function getEagerLoader()
<ide> * @deprecated 3.4.0 Use setEagerLoader()/getEagerLoader() instead.
<ide> * @param \Cake\ORM\EagerLoader|null $instance The eager loader to use. Pass null
<ide> * to get the current eagerloader.
<del> * @return \Cake\ORM\EagerLoader|$this
<add> * @return \Cake\ORM\EagerLoader|self
<ide> */
<ide> public function eagerLoader(EagerLoader $instance = null)
<ide> {
<ide> public function eagerLoader(EagerLoader $instance = null)
<ide> * @param array|string|null $associations List of table aliases to be queried.
<ide> * @param bool $override Whether override previous list with the one passed
<ide> * defaults to merging previous list with the new one.
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function contain($associations = null, $override = false)
<ide> {
<ide> protected function _addAssociationsToTypeMap($table, $typeMap, $associations)
<ide> * @param string $assoc The association to filter by
<ide> * @param callable|null $builder a function that will receive a pre-made query object
<ide> * that can be used to add custom conditions or selecting some fields
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function matching($assoc, callable $builder = null)
<ide> {
<ide> public function matching($assoc, callable $builder = null)
<ide> * @param string $assoc The association to join with
<ide> * @param callable|null $builder a function that will receive a pre-made query object
<ide> * that can be used to add custom conditions or selecting some fields
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function leftJoinWith($assoc, callable $builder = null)
<ide> {
<ide> public function leftJoinWith($assoc, callable $builder = null)
<ide> * @param string $assoc The association to join with
<ide> * @param callable|null $builder a function that will receive a pre-made query object
<ide> * that can be used to add custom conditions or selecting some fields
<del> * @return $this
<add> * @return self
<ide> * @see \Cake\ORM\Query::matching()
<ide> */
<ide> public function innerJoinWith($assoc, callable $builder = null)
<ide> public function innerJoinWith($assoc, callable $builder = null)
<ide> * @param string $assoc The association to filter by
<ide> * @param callable|null $builder a function that will receive a pre-made query object
<ide> * that can be used to add custom conditions or selecting some fields
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function notMatching($assoc, callable $builder = null)
<ide> {
<ide> protected function _performCount()
<ide> * instead
<ide> *
<ide> * @param callable|null $counter The counter value
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function counter($counter)
<ide> {
<ide> public function counter($counter)
<ide> *
<ide> * @param bool|null $enable Use a boolean to set the hydration mode.
<ide> * Null will fetch the current hydration mode.
<del> * @return bool|$this A boolean when reading, and $this when setting the mode.
<add> * @return bool|self A boolean when reading, and $this when setting the mode.
<ide> */
<ide> public function hydrate($enable = null)
<ide> {
<ide> public function hydrate($enable = null)
<ide> /**
<ide> * {@inheritDoc}
<ide> *
<del> * @return $this
<add> * @return self
<ide> * @throws \RuntimeException When you attempt to cache a non-select query.
<ide> */
<ide> public function cache($key, $config = 'default')
<ide> protected function _dirty()
<ide> * Can be combined with set() and where() methods to create update queries.
<ide> *
<ide> * @param string|null $table Unused parameter.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function update($table = null)
<ide> {
<ide> public function update($table = null)
<ide> * Can be combined with the where() method to create delete queries.
<ide> *
<ide> * @param string|null $table Unused parameter.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function delete($table = null)
<ide> {
<ide> public function delete($table = null)
<ide> *
<ide> * @param array $columns The columns to insert into.
<ide> * @param array $types A map between columns & their datatypes.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function insert(array $columns, array $types = [])
<ide> {
<ide> public function jsonSerialize()
<ide> * auto-fields with this method.
<ide> *
<ide> * @param bool|null $value The value to set or null to read the current value.
<del> * @return bool|$this Either the current value or the query object.
<add> * @return bool|self Either the current value or the query object.
<ide> */
<ide> public function autoFields($value = null)
<ide> {
<ide><path>src/ORM/Table.php
<ide> public function initialize(array $config)
<ide> * Sets the database table name.
<ide> *
<ide> * @param string $table Table name.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setTable($table)
<ide> {
<ide> public function table($table = null)
<ide> * Sets the table alias.
<ide> *
<ide> * @param string $alias Table alias
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setAlias($alias)
<ide> {
<ide> public function aliasField($field)
<ide> * Sets the table registry key used to create this table instance.
<ide> *
<ide> * @param string $registryAlias The key used to access this object.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setRegistryAlias($registryAlias)
<ide> {
<ide> public function registryAlias($registryAlias = null)
<ide> * Sets the connection instance.
<ide> *
<ide> * @param \Cake\Datasource\ConnectionInterface $connection The connection instance
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setConnection(ConnectionInterface $connection)
<ide> {
<ide> public function getSchema()
<ide> * out of it and used as the schema for this table.
<ide> *
<ide> * @param array|\Cake\Database\Schema\TableSchema $schema Schema to be used for this table
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setSchema($schema)
<ide> {
<ide> public function hasField($field)
<ide> * Sets the primary key field name.
<ide> *
<ide> * @param string|array $key Sets a new name to be used as primary key
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setPrimaryKey($key)
<ide> {
<ide> public function primaryKey($key = null)
<ide> * Sets the display field.
<ide> *
<ide> * @param string $key Name to be used as display field.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setDisplayField($key)
<ide> {
<ide> public function getEntityClass()
<ide> *
<ide> * @param string $name The name of the class to use
<ide> * @throws \Cake\ORM\Exception\MissingEntityException when the entity class cannot be found
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setEntityClass($name)
<ide> {
<ide><path>src/Routing/Route/Route.php
<ide> public function extensions($extensions = null)
<ide> * Set the supported extensions for this route.
<ide> *
<ide> * @param array $extensions The extensions to set.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setExtensions(array $extensions)
<ide> {
<ide><path>src/TestSuite/Stub/Response.php
<ide> class Response extends Base
<ide> /**
<ide> * Stub the send() method so headers and output are not sent.
<ide> *
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function send()
<ide> {
<ide><path>src/Validation/ValidationSet.php
<ide> public function rules()
<ide> *
<ide> * @param string $name The name under which the rule should be set
<ide> * @param \Cake\Validation\ValidationRule|array $rule The validation rule to be set
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function add($name, $rule)
<ide> {
<ide> public function add($name, $rule)
<ide> * ```
<ide> *
<ide> * @param string $name The name under which the rule should be unset
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function remove($name)
<ide> {
<ide><path>src/Validation/Validator.php
<ide> public function hasField($name)
<ide> *
<ide> * @param string $name The name under which the provider should be set.
<ide> * @param object|string $object Provider object or class name.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setProvider($name, $object)
<ide> {
<ide> public function getProvider($name)
<ide> * @deprecated 3.4.0 Use setProvider()/getProvider() instead.
<ide> * @param string $name The name under which the provider should be set.
<ide> * @param null|object|string $object Provider object or class name.
<del> * @return $this|object|string|null
<add> * @return self|object|string|null
<ide> */
<ide> public function provider($name, $object = null)
<ide> {
<ide> public function count()
<ide> * @param string $field The name of the field from which the rule will be added
<ide> * @param array|string $name The alias for a single rule or multiple rules array
<ide> * @param array|\Cake\Validation\ValidationRule $rule the rule to add
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function add($field, $name, $rule = [])
<ide> {
<ide> public function add($field, $name, $rule = [])
<ide> *
<ide> * @param string $field The root field for the nested validator.
<ide> * @param \Cake\Validation\Validator $validator The nested validator.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addNested($field, Validator $validator)
<ide> {
<ide> public function addNested($field, Validator $validator)
<ide> *
<ide> * @param string $field The root field for the nested validator.
<ide> * @param \Cake\Validation\Validator $validator The nested validator.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function addNestedMany($field, Validator $validator)
<ide> {
<ide> public function addNestedMany($field, Validator $validator)
<ide> *
<ide> * @param string $field The name of the field from which the rule will be removed
<ide> * @param string|null $rule the name of the rule to be removed
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function remove($field, $rule = null)
<ide> {
<ide> public function remove($field, $rule = null)
<ide> * If a callable is passed then the field will be required only when the callback
<ide> * returns true.
<ide> * @param string|null $message The message to show if the field presence validation fails.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function requirePresence($field, $mode = true, $message = null)
<ide> {
<ide> public function requirePresence($field, $mode = true, $message = null)
<ide> * Valid values are true (always), 'create', 'update'. If a callable is passed then
<ide> * the field will allowed to be empty only when the callback returns true.
<ide> * @param string|null $message The message to show if the field is not
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function allowEmpty($field, $when = true, $message = null)
<ide> {
<ide> protected function _convertValidatorToArray($fieldName, $defaults = [], $setting
<ide> * to be empty. Valid values are true (always), 'create', 'update'. If a
<ide> * callable is passed then the field will allowed to be empty only when
<ide> * the callback returns false.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function notEmpty($field, $message = null, $when = false)
<ide> {
<ide> public function notEmpty($field, $message = null, $when = false)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::notBlank()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function notBlank($field, $message = null, $when = null)
<ide> {
<ide> public function notBlank($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::alphaNumeric()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function alphaNumeric($field, $message = null, $when = null)
<ide> {
<ide> public function alphaNumeric($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::alphaNumeric()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function lengthBetween($field, array $range, $message = null, $when = null)
<ide> {
<ide> public function lengthBetween($field, array $range, $message = null, $when = nul
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::cc()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function creditCard($field, $type = 'all', $message = null, $when = null)
<ide> {
<ide> public function creditCard($field, $type = 'all', $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::comparison()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function greaterThan($field, $value, $message = null, $when = null)
<ide> {
<ide> public function greaterThan($field, $value, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::comparison()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function greaterThanOrEqual($field, $value, $message = null, $when = null)
<ide> {
<ide> public function greaterThanOrEqual($field, $value, $message = null, $when = null
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::comparison()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function lessThan($field, $value, $message = null, $when = null)
<ide> {
<ide> public function lessThan($field, $value, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::comparison()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function lessThanOrEqual($field, $value, $message = null, $when = null)
<ide> {
<ide> public function lessThanOrEqual($field, $value, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::comparison()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function equals($field, $value, $message = null, $when = null)
<ide> {
<ide> public function equals($field, $value, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::comparison()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function notEquals($field, $value, $message = null, $when = null)
<ide> {
<ide> public function notEquals($field, $value, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::compareWith()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function sameAs($field, $secondField, $message = null, $when = null)
<ide> {
<ide> public function sameAs($field, $secondField, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::containsNonAlphaNumeric()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function containsNonAlphaNumeric($field, $limit = 1, $message = null, $when = null)
<ide> {
<ide> public function containsNonAlphaNumeric($field, $limit = 1, $message = null, $wh
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::date()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function date($field, $formats = ['ymd'], $message = null, $when = null)
<ide> {
<ide> public function date($field, $formats = ['ymd'], $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::datetime()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function dateTime($field, $formats = ['ymd'], $message = null, $when = null)
<ide> {
<ide> public function dateTime($field, $formats = ['ymd'], $message = null, $when = nu
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::time()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function time($field, $message = null, $when = null)
<ide> {
<ide> public function time($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::localizedTime()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function localizedTime($field, $type = 'datetime', $message = null, $when = null)
<ide> {
<ide> public function localizedTime($field, $type = 'datetime', $message = null, $when
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::boolean()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function boolean($field, $message = null, $when = null)
<ide> {
<ide> public function boolean($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::decimal()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function decimal($field, $places = null, $message = null, $when = null)
<ide> {
<ide> public function decimal($field, $places = null, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::email()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function email($field, $checkMX = false, $message = null, $when = null)
<ide> {
<ide> public function email($field, $checkMX = false, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::ip()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function ip($field, $message = null, $when = null)
<ide> {
<ide> public function ip($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::ip()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function ipv4($field, $message = null, $when = null)
<ide> {
<ide> public function ipv4($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::ip()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function ipv6($field, $message = null, $when = null)
<ide> {
<ide> public function ipv6($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::minLength()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function minLength($field, $min, $message = null, $when = null)
<ide> {
<ide> public function minLength($field, $min, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::maxLength()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function maxLength($field, $max, $message = null, $when = null)
<ide> {
<ide> public function maxLength($field, $max, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::numeric()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function numeric($field, $message = null, $when = null)
<ide> {
<ide> public function numeric($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::naturalNumber()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function naturalNumber($field, $message = null, $when = null)
<ide> {
<ide> public function naturalNumber($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::naturalNumber()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function nonNegativeInteger($field, $message = null, $when = null)
<ide> {
<ide> public function nonNegativeInteger($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::range()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function range($field, array $range, $message = null, $when = null)
<ide> {
<ide> public function range($field, array $range, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::url()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function url($field, $message = null, $when = null)
<ide> {
<ide> public function url($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::url()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function urlWithProtocol($field, $message = null, $when = null)
<ide> {
<ide> public function urlWithProtocol($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::inList()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function inList($field, array $list, $message = null, $when = null)
<ide> {
<ide> public function inList($field, array $list, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::uuid()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function uuid($field, $message = null, $when = null)
<ide> {
<ide> public function uuid($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::uploadedFile()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function uploadedFile($field, array $options, $message = null, $when = null)
<ide> {
<ide> public function uploadedFile($field, array $options, $message = null, $when = nu
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::uuid()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function latLong($field, $message = null, $when = null)
<ide> {
<ide> public function latLong($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::latitude()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function latitude($field, $message = null, $when = null)
<ide> {
<ide> public function latitude($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::longitude()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function longitude($field, $message = null, $when = null)
<ide> {
<ide> public function longitude($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::ascii()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function ascii($field, $message = null, $when = null)
<ide> {
<ide> public function ascii($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::utf8()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function utf8($field, $message = null, $when = null)
<ide> {
<ide> public function utf8($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::utf8()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function utf8Extended($field, $message = null, $when = null)
<ide> {
<ide> public function utf8Extended($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::isInteger()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function integer($field, $message = null, $when = null)
<ide> {
<ide> public function integer($field, $message = null, $when = null)
<ide> * @param string|null $message The error message when the rule fails.
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function isArray($field, $message = null, $when = null)
<ide> {
<ide> public function isArray($field, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::multiple()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function multipleOptions($field, array $options = [], $message = null, $when = null)
<ide> {
<ide> public function multipleOptions($field, array $options = [], $message = null, $w
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::numElements()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function hasAtLeast($field, $count, $message = null, $when = null)
<ide> {
<ide> public function hasAtLeast($field, $count, $message = null, $when = null)
<ide> * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
<ide> * true when the validation rule should be applied.
<ide> * @see \Cake\Validation\Validation::numElements()
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function hasAtMost($field, $count, $message = null, $when = null)
<ide> {
<ide><path>src/View/Helper/BreadcrumbsHelper.php
<ide> class BreadcrumbsHelper extends Helper
<ide> * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to
<ide> * the link)
<ide> * - *templateVars*: Specific template vars in case you override the templates provided.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function add($title, $url = null, array $options = [])
<ide> {
<ide> public function add($title, $url = null, array $options = [])
<ide> * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to
<ide> * the link)
<ide> * - *templateVars*: Specific template vars in case you override the templates provided.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function prepend($title, $url = null, array $options = [])
<ide> {
<ide> public function prepend($title, $url = null, array $options = [])
<ide> * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to
<ide> * the link)
<ide> * - *templateVars*: Specific template vars in case you override the templates provided.
<del> * @return $this
<add> * @return self
<ide> * @throws LogicException In case the index is out of bound
<ide> */
<ide> public function insertAt($index, $title, $url = null, array $options = [])
<ide> public function insertAt($index, $title, $url = null, array $options = [])
<ide> * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to
<ide> * the link)
<ide> * - *templateVars*: Specific template vars in case you override the templates provided.
<del> * @return $this
<add> * @return self
<ide> * @throws LogicException In case the matching crumb can not be found
<ide> */
<ide> public function insertBefore($matchingTitle, $title, $url = null, array $options = [])
<ide> public function insertBefore($matchingTitle, $title, $url = null, array $options
<ide> * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to
<ide> * the link)
<ide> * - *templateVars*: Specific template vars in case you override the templates provided.
<del> * @return $this
<add> * @return self
<ide> * @throws LogicException In case the matching crumb can not be found.
<ide> */
<ide> public function insertAfter($matchingTitle, $title, $url = null, array $options = [])
<ide><path>src/View/Helper/FormHelper.php
<ide> public function getValueSources()
<ide> * You need to supply one valid context or multiple, as a list of strings. Order sets priority.
<ide> *
<ide> * @param string|array $sources A string or a list of strings identifying a source.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setValueSources($sources)
<ide> {
<ide><path>src/View/Helper/HtmlHelper.php
<ide> public function __construct(View $View, array $config = [])
<ide> * @param string $name Text for link
<ide> * @param string|array|null $link URL for link (if empty it won't be a link)
<ide> * @param string|array $options Link attributes e.g. ['id' => 'selected']
<del> * @return $this
<add> * @return self
<ide> * @see \Cake\View\Helper\HtmlHelper::link() for details on $options that can be used.
<ide> * @link http://book.cakephp.org/3.0/en/views/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper
<ide> * @deprecated 3.3.6 Use the BreadcrumbsHelper instead
<ide><path>src/View/StringTemplate.php
<ide> public function pop()
<ide> * ```
<ide> *
<ide> * @param array $templates An associative list of named templates.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function add(array $templates)
<ide> {
<ide><path>src/View/StringTemplateTrait.php
<ide> trait StringTemplateTrait
<ide> * Sets templates to use.
<ide> *
<ide> * @param array $templates Templates to be added.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function setTemplates(array $templates)
<ide> {
<ide> public function getTemplates($template = null)
<ide> * @deprecated 3.4.0 Use setTemplates()/getTemplates() instead.
<ide> * @param string|null|array $templates null or string allow reading templates. An array
<ide> * allows templates to be added.
<del> * @return $this|string|array
<add> * @return self|string|array
<ide> */
<ide> public function templates($templates = null)
<ide> {
<ide><path>src/View/ViewBuilder.php
<ide> class ViewBuilder implements JsonSerializable, Serializable
<ide> * Get/set path for template files.
<ide> *
<ide> * @param string|null $path Path for view files. If null returns current path.
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function templatePath($path = null)
<ide> {
<ide> public function templatePath($path = null)
<ide> * Get/set path for layout files.
<ide> *
<ide> * @param string|null $path Path for layout files. If null returns current path.
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function layoutPath($path = null)
<ide> {
<ide> public function layoutPath($path = null)
<ide> * automatically applied to rendered views.
<ide> *
<ide> * @param bool|null $autoLayout Boolean to turn on/off. If null returns current value.
<del> * @return bool|$this
<add> * @return bool|self
<ide> */
<ide> public function autoLayout($autoLayout = null)
<ide> {
<ide> public function autoLayout($autoLayout = null)
<ide> *
<ide> * @param string|null|false $name Plugin name. If null returns current plugin.
<ide> * Use false to remove the current plugin name.
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function plugin($name = null)
<ide> {
<ide> public function plugin($name = null)
<ide> *
<ide> * @param array|null $helpers Helpers to use.
<ide> * @param bool $merge Whether or not to merge existing data with the new data.
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function helpers(array $helpers = null, $merge = true)
<ide> {
<ide> public function helpers(array $helpers = null, $merge = true)
<ide> *
<ide> * @param string|null|false $theme Theme name. If null returns current theme.
<ide> * Use false to remove the current theme.
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function theme($theme = null)
<ide> {
<ide> public function theme($theme = null)
<ide> * filename in /src/Template/<SubFolder> without the .ctp extension.
<ide> *
<ide> * @param string|null $name View file name to set. If null returns current name.
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function template($name = null)
<ide> {
<ide> public function template($name = null)
<ide> * without the .ctp extension.
<ide> *
<ide> * @param string|null $name Layout file name to set. If null returns current name.
<del> * @return string|$this
<add> * @return string|self
<ide> */
<ide> public function layout($name = null)
<ide> {
<ide> public function layout($name = null)
<ide> *
<ide> * @param array|null $options Either an array of options or null to get current options.
<ide> * @param bool $merge Whether or not to merge existing data with the new data.
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function options(array $options = null, $merge = true)
<ide> {
<ide> public function options(array $options = null, $merge = true)
<ide> * Get/set the view name
<ide> *
<ide> * @param string|null $name The name of the view
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function name($name = null)
<ide> {
<ide> public function name($name = null)
<ide> * @param string|null $name The class name for the view. Can
<ide> * be a plugin.class name reference, a short alias, or a fully
<ide> * namespaced name.
<del> * @return array|$this
<add> * @return array|self
<ide> */
<ide> public function className($name = null)
<ide> {
<ide> public function jsonSerialize()
<ide> * Configures a view builder instance from serialized config.
<ide> *
<ide> * @param array $config View builder configuration array.
<del> * @return $this Configured view builder instance.
<add> * @return self Configured view builder instance.
<ide> */
<ide> public function createFromArray($config)
<ide> {
<ide> public function serialize()
<ide> * Unserializes the view builder object.
<ide> *
<ide> * @param string $data Serialized string.
<del> * @return $this Configured view builder instance.
<add> * @return self Configured view builder instance.
<ide> */
<ide> public function unserialize($data)
<ide> {
<ide><path>src/View/ViewVarsTrait.php
<ide> public function createView($viewClass = null)
<ide> * @param string|array $name A string or an array of data.
<ide> * @param mixed $value Value in case $name is a string (which then works as the key).
<ide> * Unused if $name is an associative array, otherwise serves as the values to $name's keys.
<del> * @return $this
<add> * @return self
<ide> */
<ide> public function set($name, $value = null)
<ide> { | 57 |
PHP | PHP | add type hint | e47356e11df19f07902b634bc081186ac9bd6f60 | <ide><path>src/I18n/FrozenTime.php
<ide> public function timeAgoInWords(array $options = []): string
<ide> * @return array List of timezone identifiers
<ide> * @since 2.2
<ide> */
<del> public static function listTimezones($filter = null, $country = null, $options = []): array
<add> public static function listTimezones($filter = null, ?string $country = null, $options = []): array
<ide> {
<ide> if (is_bool($options)) {
<ide> $options = [
<ide> public static function listTimezones($filter = null, $country = null, $options =
<ide> if ($filter === null) {
<ide> $filter = DateTimeZone::ALL;
<ide> }
<del> $identifiers = DateTimeZone::listIdentifiers($filter, $country);
<add> $identifiers = DateTimeZone::listIdentifiers($filter, (string)$country);
<ide>
<ide> if ($regex) {
<ide> foreach ($identifiers as $key => $tz) {
<ide><path>src/I18n/Time.php
<ide> public function timeAgoInWords(array $options = []): string
<ide> * @return array List of timezone identifiers
<ide> * @since 2.2
<ide> */
<del> public static function listTimezones($filter = null, $country = null, $options = []): array
<add> public static function listTimezones($filter = null, ?string $country = null, $options = []): array
<ide> {
<ide> if (is_bool($options)) {
<ide> $options = [
<ide> public static function listTimezones($filter = null, $country = null, $options =
<ide> if ($filter === null) {
<ide> $filter = DateTimeZone::ALL;
<ide> }
<del> $identifiers = DateTimeZone::listIdentifiers($filter, $country);
<add> $identifiers = DateTimeZone::listIdentifiers($filter, (string)$country);
<ide>
<ide> if ($regex) {
<ide> foreach ($identifiers as $key => $tz) { | 2 |
PHP | PHP | fix double return | ed2df89c3ed865654ed248f3c837e43427bbb3c2 | <ide><path>laravel/error.php
<ide> public static function native($code, $error, $file, $line)
<ide> if (in_array($code, Config::get('error.ignore')))
<ide> {
<ide> return static::log($exception);
<del>
<del> return true;
<ide> }
<ide>
<ide> static::exception($exception); | 1 |
PHP | PHP | remove unused rule | 5f9769bc17d7d6ade1583ad7f348b1c4ebe3eb8b | <ide><path>tests/Validation/ValidationRequiredIfTest.php
<ide>
<ide> namespace Illuminate\Tests\Validation;
<ide>
<del>use Illuminate\Validation\Rule;
<ide> use PHPUnit\Framework\TestCase;
<ide> use Illuminate\Validation\Rules\RequiredIf;
<ide> | 1 |
PHP | PHP | fix cs, remove extra space | e3e54d40faf4273c1063a93ee509daa09d5fb426 | <ide><path>lib/Cake/Model/Datasource/Database/Sqlite.php
<ide> public function resultSet($results) {
<ide> foreach (String::tokenize($selectpart, ',', '(', ')') as $part) {
<ide> $fromPos = stripos($part, ' FROM ');
<ide> if ($fromPos !== false) {
<del> $selects[] = trim(substr($part, 0, $fromPos));
<add> $selects[] = trim(substr($part, 0, $fromPos));
<ide> break;
<ide> }
<ide> $selects[] = $part; | 1 |
Python | Python | add wheel to setup_requires | 9ebe607f82d198e1548a68ac633607b845f438c4 | <ide><path>setup.py
<ide> def setup_package():
<ide> license=about['__license__'],
<ide> ext_modules=ext_modules,
<ide> scripts=['bin/spacy'],
<add> setup_requires=['wheel>=0.32.0,<0.33.0'],
<ide> install_requires=[
<ide> 'numpy>=1.15.0',
<ide> 'msgpack-numpy<0.4.4.0' | 1 |
Python | Python | fix complex reference | a41f1aefef662be0645c61da5bf7849d0c68194c | <ide><path>numpy/core/tests/test_print.py
<ide> def check_complex_type(tp):
<ide> else:
<ide> if sys.platform == 'win32' and sys.version_info[0] <= 2 and \
<ide> sys.version_info[1] <= 5:
<del> ref = '1e+010'
<add> ref = '(1e+010+0j)'
<ide> else:
<del> ref = '1e+10'
<add> ref = '(1e+10+0j)'
<ide> assert_equal(str(tp(1e10)), ref,
<ide> err_msg='Failed str formatting for type %s' % tp)
<ide> | 1 |
Python | Python | add similarity_search.py in machine_learning | ae4d7d4d0433b865c1a3e35dbbb7d43f2dc8ab2c | <ide><path>machine_learning/similarity_search.py
<add>"""
<add>Similarity Search : https://en.wikipedia.org/wiki/Similarity_search
<add>Similarity search is a search algorithm for finding the nearest vector from
<add>vectors, used in natural language processing.
<add>In this algorithm, it calculates distance with euclidean distance and
<add>returns a list containing two data for each vector:
<add> 1. the nearest vector
<add> 2. distance between the vector and the nearest vector (float)
<add>"""
<add>import math
<add>
<add>import numpy as np
<add>
<add>
<add>def euclidean(input_a: np.ndarray, input_b: np.ndarray) -> float:
<add> """
<add> Calculates euclidean distance between two data.
<add> :param input_a: ndarray of first vector.
<add> :param input_b: ndarray of second vector.
<add> :return: Euclidean distance of input_a and input_b. By using math.sqrt(),
<add> result will be float.
<add>
<add> >>> euclidean(np.array([0]), np.array([1]))
<add> 1.0
<add> >>> euclidean(np.array([0, 1]), np.array([1, 1]))
<add> 1.0
<add> >>> euclidean(np.array([0, 0, 0]), np.array([0, 0, 1]))
<add> 1.0
<add> """
<add> return math.sqrt(sum(pow(a - b, 2) for a, b in zip(input_a, input_b)))
<add>
<add>
<add>def similarity_search(dataset: np.ndarray, value_array: np.ndarray) -> list:
<add> """
<add> :param dataset: Set containing the vectors. Should be ndarray.
<add> :param value_array: vector/vectors we want to know the nearest vector from dataset.
<add> :return: Result will be a list containing
<add> 1. the nearest vector
<add> 2. distance from the vector
<add>
<add> >>> dataset = np.array([[0], [1], [2]])
<add> >>> value_array = np.array([[0]])
<add> >>> similarity_search(dataset, value_array)
<add> [[[0], 0.0]]
<add>
<add> >>> dataset = np.array([[0, 0], [1, 1], [2, 2]])
<add> >>> value_array = np.array([[0, 1]])
<add> >>> similarity_search(dataset, value_array)
<add> [[[0, 0], 1.0]]
<add>
<add> >>> dataset = np.array([[0, 0, 0], [1, 1, 1], [2, 2, 2]])
<add> >>> value_array = np.array([[0, 0, 1]])
<add> >>> similarity_search(dataset, value_array)
<add> [[[0, 0, 0], 1.0]]
<add>
<add> >>> dataset = np.array([[0, 0, 0], [1, 1, 1], [2, 2, 2]])
<add> >>> value_array = np.array([[0, 0, 0], [0, 0, 1]])
<add> >>> similarity_search(dataset, value_array)
<add> [[[0, 0, 0], 0.0], [[0, 0, 0], 1.0]]
<add>
<add> These are the errors that might occur:
<add>
<add> 1. If dimensions are different.
<add> For example, dataset has 2d array and value_array has 1d array:
<add> >>> dataset = np.array([[1]])
<add> >>> value_array = np.array([1])
<add> >>> similarity_search(dataset, value_array)
<add> Traceback (most recent call last):
<add> ...
<add> ValueError: Wrong input data's dimensions... dataset : 2, value_array : 1
<add>
<add> 2. If data's shapes are different.
<add> For example, dataset has shape of (3, 2) and value_array has (2, 3).
<add> We are expecting same shapes of two arrays, so it is wrong.
<add> >>> dataset = np.array([[0, 0], [1, 1], [2, 2]])
<add> >>> value_array = np.array([[0, 0, 0], [0, 0, 1]])
<add> >>> similarity_search(dataset, value_array)
<add> Traceback (most recent call last):
<add> ...
<add> ValueError: Wrong input data's shape... dataset : 2, value_array : 3
<add>
<add> 3. If data types are different.
<add> When trying to compare, we are expecting same types so they should be same.
<add> If not, it'll come up with errors.
<add> >>> dataset = np.array([[0, 0], [1, 1], [2, 2]], dtype=np.float32)
<add> >>> value_array = np.array([[0, 0], [0, 1]], dtype=np.int32)
<add> >>> similarity_search(dataset, value_array) # doctest: +NORMALIZE_WHITESPACE
<add> Traceback (most recent call last):
<add> ...
<add> TypeError: Input data have different datatype...
<add> dataset : float32, value_array : int32
<add> """
<add>
<add> if dataset.ndim != value_array.ndim:
<add> raise ValueError(
<add> f"Wrong input data's dimensions... dataset : {dataset.ndim}, "
<add> f"value_array : {value_array.ndim}"
<add> )
<add>
<add> try:
<add> if dataset.shape[1] != value_array.shape[1]:
<add> raise ValueError(
<add> f"Wrong input data's shape... dataset : {dataset.shape[1]}, "
<add> f"value_array : {value_array.shape[1]}"
<add> )
<add> except IndexError:
<add> if dataset.ndim != value_array.ndim:
<add> raise TypeError("Wrong shape")
<add>
<add> if dataset.dtype != value_array.dtype:
<add> raise TypeError(
<add> f"Input data have different datatype... dataset : {dataset.dtype}, "
<add> f"value_array : {value_array.dtype}"
<add> )
<add>
<add> answer = []
<add>
<add> for value in value_array:
<add> dist = euclidean(value, dataset[0])
<add> vector = dataset[0].tolist()
<add>
<add> for dataset_value in dataset[1:]:
<add> temp_dist = euclidean(value, dataset_value)
<add>
<add> if dist > temp_dist:
<add> dist = temp_dist
<add> vector = dataset_value.tolist()
<add>
<add> answer.append([vector, dist])
<add>
<add> return answer
<add>
<add>
<add>if __name__ == "__main__":
<add> import doctest
<add>
<add> doctest.testmod() | 1 |
Go | Go | use nsinit for setting up namespace | 11429457691be3b009c6d9f4cc9fce9150d4e810 | <ide><path>pkg/libcontainer/cli/main.go
<ide> func init() {
<ide> func nsinitFunc(container *libcontainer.Container) error {
<ide> container.Master = uintptr(masterFd)
<ide> container.Console = console
<add> container.LogFile = "/root/logs"
<ide>
<ide> return nsinit.InitNamespace(container)
<ide> }
<ide><path>pkg/libcontainer/container.go
<ide> type Container struct {
<ide> Capabilities Capabilities `json:"capabilities,omitempty"`
<ide> Master uintptr `json:"master"`
<ide> Console string `json:"console"`
<add> LogFile string `json:"log_file"`
<ide> }
<ide>
<ide> type Command struct {
<ide><path>pkg/libcontainer/namespaces/exec.go
<ide> func ExecContainer(container *libcontainer.Container) (pid int, err error) {
<ide> // we need CLONE_VFORK so we can wait on the child
<ide> flag := uintptr(getNamespaceFlags(container.Namespaces) | CLONE_VFORK)
<ide>
<del> command := exec.Command(nsinit, "init", "-master", strconv.Itoa(int(master.Fd())), "-console", console)
<add> command := exec.Command(nsinit, "-master", strconv.Itoa(int(master.Fd())), "-console", console, "init")
<ide> command.SysProcAttr = &syscall.SysProcAttr{}
<ide> command.SysProcAttr.Cloneflags = flag
<add> command.ExtraFiles = []*os.File{master}
<ide> // command.SysProcAttr.Setctty = true
<ide>
<ide> if err := command.Start(); err != nil {
<ide> func ExecContainer(container *libcontainer.Container) (pid int, err error) {
<ide> log.Println(err)
<ide> }
<ide> }()
<del> command.Wait()
<ide> return pid, nil
<ide> }
<ide>
<ide><path>pkg/libcontainer/namespaces/nsinit/init.go
<ide> import (
<ide> // InitNamespace should be run inside an existing namespace to setup
<ide> // common mounts, drop capabilities, and setup network interfaces
<ide> func InitNamespace(container *libcontainer.Container) error {
<add> if err := setLogFile(container); err != nil {
<add> return err
<add> }
<add>
<ide> rootfs, err := resolveRootfs(container)
<ide> if err != nil {
<ide> return err
<ide> func openTerminal(name string, flag int) (*os.File, error) {
<ide> }
<ide> return os.NewFile(uintptr(r), name), nil
<ide> }
<add>
<add>func setLogFile(container *libcontainer.Container) error {
<add> f, err := os.OpenFile(container.LogFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0655)
<add> if err != nil {
<add> return err
<add> }
<add> log.SetOutput(f)
<add> return nil
<add>} | 4 |
Javascript | Javascript | fix spelling error | c5aa7611fa025bbf7cf6c579198faabc24df831f | <ide><path>packages/ember-runtime/tests/computed/reduce_computed_test.js
<ide> QUnit.module('arrayComputed', {
<ide> otherNumbers: Ember.A([ 7, 8, 9 ]),
<ide>
<ide> // Users would obviously just use `Ember.computed.map`
<del> // This implemantion is fine for these tests, but doesn't properly work as
<add> // This implementation is fine for these tests, but doesn't properly work as
<ide> // it's not index based.
<ide> evenNumbers: arrayComputed('numbers', {
<ide> addedItem: function (array, item) { | 1 |
Python | Python | fix ma.minimum.reduce with axis keyword | b8c6d09208ecb7f0d83a8b06ab9e15e720f03730 | <ide><path>numpy/ma/core.py
<ide> def reduce(self, target, axis=np._NoValue, **kwargs):
<ide>
<ide> if m is nomask:
<ide> t = self.f.reduce(target.view(np.ndarray), **kwargs)
<add> if isinstance(t, ndarray):
<add> t = MaskedArray(t, mask=nomask)
<ide> else:
<ide> target = target.filled(
<ide> self.fill_value_func(target)).view(type(target)) | 1 |
Javascript | Javascript | fix wrong mapping for issue #434 | 5970020f3b2ab989ef245a616bf7f9b4142ae9af | <ide><path>fonts.js
<ide> var Type2CFF = (function() {
<ide> for (var i = 1; i < charsets.length; i++) {
<ide> var code = -1;
<ide> var glyph = charsets[i];
<del> for (var j = index; j < differences.length; j++) {
<del> if (differences[j]) {
<add> for (var j = 0; j < differences.length; j++) {
<add> if (differences[j] == glyph) {
<ide> index = j;
<ide> code = differences.indexOf(glyph);
<ide> break; | 1 |
Text | Text | add v1.2.6 changes | fe7decd1b0339c35360cdd8c21a58278c8df2508 | <ide><path>CHANGELOG.md
<add><a name="1.2.6"></a>
<add># 1.2.6 taco-salsafication (2013-12-19)
<add>
<add>
<add>## Bug Fixes
<add>
<add>- **$animate:** use a scheduled timeout in favor of a fallback property to close transitions
<add> ([54637a33](https://github.com/angular/angular.js/commit/54637a335f885110efaa702a3bab29c77644b36c),
<add> [#5255](https://github.com/angular/angular.js/issues/5255), [#5241](https://github.com/angular/angular.js/issues/5241), [#5405](https://github.com/angular/angular.js/issues/5405))
<add>- **$compile:** remove invalid IE exceptional case for `href`
<add> ([c7a1d1ab](https://github.com/angular/angular.js/commit/c7a1d1ab0b663edffc1ac7b54deea847e372468d),
<add> [#5479](https://github.com/angular/angular.js/issues/5479))
<add>- **$location:** parse xlink:href for SVGAElements
<add> ([bc3ff2ce](https://github.com/angular/angular.js/commit/bc3ff2cecd0861766a9e8606f3cc2c582d9875df),
<add> [#5472](https://github.com/angular/angular.js/issues/5472), [#5198](https://github.com/angular/angular.js/issues/5198), [#5199](https://github.com/angular/angular.js/issues/5199), [#4098](https://github.com/angular/angular.js/issues/4098), [#1420](https://github.com/angular/angular.js/issues/1420))
<add>- **$log:** should work in IE8
<add> ([4f5758e6](https://github.com/angular/angular.js/commit/4f5758e6669222369889c9e789601d25ff885530),
<add> [#5400](https://github.com/angular/angular.js/issues/5400))
<add>- **$parse:** return `undefined` if an intermetiate property's value is `null`
<add> ([26d43cac](https://github.com/angular/angular.js/commit/26d43cacdc106765bd928d41600352198f887aef),
<add> [#5480](https://github.com/angular/angular.js/issues/5480))
<add>- **closure:** add type definition for `Scope#$watchCollection`
<add> ([8f329ffb](https://github.com/angular/angular.js/commit/8f329ffb829410e1fd8f86a766929134e736e3e5),
<add> [#5475](https://github.com/angular/angular.js/issues/5475))
<add>- **forEach:** allow looping over result of `querySelectorAll` in IE8
<add> ([274a6734](https://github.com/angular/angular.js/commit/274a6734ef1fff543cc50388a0958d1988baeb57))
<add>- **input:** do not hold input for composition on Android
<add> ([3dc18037](https://github.com/angular/angular.js/commit/3dc18037e8db8766641a4d39f0fee96077db1fcb),
<add> [#5308](https://github.com/angular/angular.js/issues/5308))
<add>- **jqLite:** support unbind self within handler
<add> ([2f91cfd0](https://github.com/angular/angular.js/commit/2f91cfd0d2986899c38641100c1851b2f9d3888a))
<add>- **ngRepeat:** allow multiline expressions
<add> ([cbb3ce2c](https://github.com/angular/angular.js/commit/cbb3ce2c309052b951d0cc87e4c6daa9c48a3dd8),
<add> [#5000](https://github.com/angular/angular.js/issues/5000))
<add>- **select:** invalidate when `multiple`, `required`, and model is `[]`
<add> ([5c97731a](https://github.com/angular/angular.js/commit/5c97731a22ed87d64712e673efea0e8a05eae65f),
<add> [#5337](https://github.com/angular/angular.js/issues/5337))
<add>
<add>
<add>## Features
<add>
<add>- **jqLite:** provide support for `element.one()`
<add> ([937caab6](https://github.com/angular/angular.js/commit/937caab6475e53a7ea0206e992f8a52449232e78))
<add>- **ngAnimate:** provide configuration support to match specific className values to trigger animations
<add> ([cef084ad](https://github.com/angular/angular.js/commit/cef084ade9072090259d8c679751cac3ffeaed51),
<add> [#5357](https://github.com/angular/angular.js/issues/5357), [#5283](https://github.com/angular/angular.js/issues/5283))
<add>
<add>
<add>## Performance Improvements
<add>
<add>- **compile:** add class 'ng-scope' before cloning and other micro-optimizations
<add> ([f3a796e5](https://github.com/angular/angular.js/commit/f3a796e522afdbd3b640d14426edb2fbfab463c5),
<add> [#5471](https://github.com/angular/angular.js/issues/5471))
<add>- **$parse:** use a faster path when the number of path parts is low
<add> ([f4462319](https://github.com/angular/angular.js/commit/864b2596b246470cca9d4e223eaed720f4462319))
<add>- use faster check for `$$` prefix
<add> ([06c5cfc7](https://github.com/angular/angular.js/commit/cb29632a5802e930262919b3db64ca4806c5cfc7))
<add>
<ide> <a name="1.2.5"></a>
<ide> # 1.2.5 singularity-expansion (2013-12-13)
<ide> | 1 |
Python | Python | fix ner pipeline | f79a7dc661b9d7caee867af18a2be009478ab739 | <ide><path>transformers/pipelines.py
<ide> def __call__(self, *texts, **kwargs):
<ide> # Forward
<ide> if self.framework == 'tf':
<ide> entities = self.model(tokens)[0][0].numpy()
<add> input_ids = tokens['input_ids'].numpy()[0]
<ide> else:
<ide> with torch.no_grad():
<ide> entities = self.model(**tokens)[0][0].cpu().numpy()
<add> input_ids = tokens['input_ids'].cpu().numpy()[0]
<ide>
<ide> score = np.exp(entities) / np.exp(entities).sum(-1, keepdims=True)
<ide> labels_idx = score.argmax(axis=-1)
<ide> def __call__(self, *texts, **kwargs):
<ide> for idx, label_idx in enumerate(labels_idx):
<ide> if self.model.config.id2label[label_idx] not in self.ignore_labels:
<ide> answer += [{
<del> 'word': self.tokenizer.decode(tokens['input_ids'][0][idx].cpu().tolist()),
<add> 'word': self.tokenizer.decode(int(input_ids[idx])),
<ide> 'score': score[idx][label_idx].item(),
<ide> 'entity': self.model.config.id2label[label_idx]
<ide> }] | 1 |
Javascript | Javascript | make the arraystream in repl tests write a '\n' | 8652c11031cf89d042aa9f0b9c0f33e60ab18c97 | <ide><path>test/simple/test-repl-.save.load.js
<ide> function ArrayStream() {
<ide> this.run = function(data) {
<ide> var self = this;
<ide> data.forEach(function(line) {
<del> self.emit('data', line);
<add> self.emit('data', line + '\n');
<ide> });
<ide> }
<ide> }
<ide><path>test/simple/test-repl-autolibs.js
<ide> function ArrayStream() {
<ide> this.run = function (data) {
<ide> var self = this;
<ide> data.forEach(function (line) {
<del> self.emit('data', line);
<add> self.emit('data', line + '\n');
<ide> });
<ide> }
<ide> }
<ide><path>test/simple/test-repl-tab-complete.js
<ide> function ArrayStream() {
<ide> this.run = function(data) {
<ide> var self = this;
<ide> data.forEach(function(line) {
<del> self.emit('data', line);
<add> self.emit('data', line + '\n');
<ide> });
<ide> }
<ide> } | 3 |
Java | Java | add support for custom expression parsing | 40d84c297bd88a2c4b7979b14eb7925e5fce0170 | <ide><path>spring-context/src/main/java/org/springframework/context/expression/CachedExpressionEvaluator.java
<ide> protected Expression getExpression(Map<ExpressionKey, Expression> cache,
<ide> ExpressionKey expressionKey = createKey(elementKey, expression);
<ide> Expression expr = cache.get(expressionKey);
<ide> if (expr == null) {
<del> expr = getParser().parseExpression(expression);
<add> expr = parseExpression(expression);
<ide> cache.put(expressionKey, expr);
<ide> }
<ide> return expr;
<ide> private ExpressionKey createKey(AnnotatedElementKey elementKey, String expressio
<ide> return new ExpressionKey(elementKey, expression);
<ide> }
<ide>
<add> /**
<add> * Parse the expression
<add> * @param expression the expression to parse
<add> */
<add> protected Expression parseExpression(String expression) {
<add> return getParser().parseExpression(expression);
<add> }
<ide>
<ide> /**
<ide> * An expression key. | 1 |
Python | Python | remove unnecessary func | 22a669d6c8ebe29114c72e4cebe900d599a15201 | <ide><path>research/a3c_blogpost/a3c_cartpole.py
<ide>
<ide> tf.enable_eager_execution()
<ide>
<del>def str2bool(v):
<del> if v.lower() in ('yes', 'true', 't', 'y', '1'):
<del> return True
<del> elif v.lower() in ('no', 'false', 'f', 'n', '0'):
<del> return False
<del> else:
<del> raise argparse.ArgumentTypeError('Boolean value expected.')
<del>
<del>
<ide> parser = argparse.ArgumentParser(description='Run A3C algorithm on the game '
<ide> 'Cartpole.')
<ide> parser.add_argument('--algorithm', default='a3c', type=str, | 1 |
Python | Python | replace list creation with list literal | ca5f59d03aeac2cf78adf9a6fde0f8e425033133 | <ide><path>glances/plugins/glances_help.py
<ide> def get_view_data(self, args=None):
<ide>
<ide> def msg_curse(self, args=None):
<ide> """Return the list to display in the curse interface."""
<del> # Init the return message
<del> ret = []
<del>
<del> # Build the string message
<del> # Header
<del> ret.append(self.curse_add_line(self.view_data['version'], 'TITLE'))
<del> ret.append(self.curse_add_line(self.view_data['psutil_version']))
<del> ret.append(self.curse_new_line())
<del>
<del> # Configuration file path
<del> if 'configuration_file' in self.view_data:
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['configuration_file']))
<del> ret.append(self.curse_new_line())
<del>
<del> # Keys
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['sort_auto']))
<del> ret.append(self.curse_add_line(self.view_data['sort_network']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['sort_cpu']))
<del> ret.append(self.curse_add_line(self.view_data['show_hide_alert']))
<del> ret.append(self.curse_new_line())
<del>
<del> ret.append(self.curse_add_line(self.view_data['sort_mem']))
<del> ret.append(self.curse_add_line(self.view_data['delete_warning_alerts']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['sort_user']))
<del> ret.append(self.curse_add_line(self.view_data['delete_warning_critical_alerts']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['sort_proc']))
<del> ret.append(self.curse_add_line(self.view_data['percpu']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['sort_io']))
<del> ret.append(self.curse_add_line(self.view_data['show_hide_ip']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['sort_cpu_times']))
<del> ret.append(self.curse_add_line(self.view_data['enable_disable_docker']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['show_hide_diskio']))
<del> ret.append(self.curse_add_line(self.view_data['view_network_io_combination']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['show_hide_filesystem']))
<del> ret.append(self.curse_add_line(self.view_data['view_cumulative_network']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['show_hide_network']))
<del> ret.append(self.curse_add_line(self.view_data['show_hide_filesytem_freespace']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['show_hide_sensors']))
<del> ret.append(self.curse_add_line(self.view_data['generate_graphs']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['show_hide_left_sidebar']))
<del> ret.append(self.curse_add_line(self.view_data['reset_history']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['enable_disable_process_stats']))
<del> ret.append(self.curse_add_line(self.view_data['show_hide_help']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['enable_disable_quick_look']))
<del> ret.append(self.curse_add_line(self.view_data['quit']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['enable_disable_top_extends_stats']))
<del> ret.append(self.curse_new_line())
<del> ret.append(self.curse_add_line(self.view_data['enable_disable_short_processname']))
<del> ret.append(self.curse_new_line())
<del>
<del> ret.append(self.curse_new_line())
<del>
<del> ret.append(self.curse_add_line(self.view_data['edit_pattern_filter']))
<add> ret = [
<add> # Header
<add> self.curse_add_line(self.view_data['version'], 'TITLE'),
<add> self.curse_add_line(self.view_data['psutil_version']),
<add> self.curse_new_line(),
<add> # Configuration file
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['configuration_file']),
<add> self.curse_new_line(),
<add> # Keys
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['sort_auto']),
<add> self.curse_add_line(self.view_data['sort_network']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['sort_cpu']),
<add> self.curse_add_line(self.view_data['show_hide_alert']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['sort_mem']),
<add> self.curse_add_line(self.view_data['delete_warning_alerts']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['sort_user']),
<add> self.curse_add_line(self.view_data['delete_warning_critical_alerts']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['sort_proc']),
<add> self.curse_add_line(self.view_data['percpu']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['sort_io']),
<add> self.curse_add_line(self.view_data['show_hide_ip']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['sort_cpu_times']),
<add> self.curse_add_line(self.view_data['enable_disable_docker']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['show_hide_diskio']),
<add> self.curse_add_line(self.view_data['view_network_io_combination']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['show_hide_filesystem']),
<add> self.curse_add_line(self.view_data['view_cumulative_network']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['show_hide_network']),
<add> self.curse_add_line(self.view_data['show_hide_filesytem_freespace']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['show_hide_sensors']),
<add> self.curse_add_line(self.view_data['generate_graphs']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['show_hide_left_sidebar']),
<add> self.curse_add_line(self.view_data['reset_history']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['enable_disable_process_stats']),
<add> self.curse_add_line(self.view_data['show_hide_help']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['enable_disable_quick_look']),
<add> self.curse_add_line(self.view_data['quit']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['enable_disable_top_extends_stats']),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['enable_disable_short_processname']),
<add> self.curse_new_line(),
<add> self.curse_new_line(),
<add> self.curse_add_line(self.view_data['edit_pattern_filter'])]
<ide>
<ide> # Return the message with decoration
<ide> return ret | 1 |
Javascript | Javascript | add mustcall to test-dgram-implicit-bind.js | c3d49332101abc68e64f13c96f4c165d4716d416 | <ide><path>test/parallel/test-dgram-implicit-bind.js
<ide> target.on('message', common.mustCall(function(buf) {
<ide> }
<ide> }, 2));
<ide>
<del>target.on('listening', function() {
<add>target.on('listening', common.mustCall(function() {
<ide> // Second .send() call should not throw a bind error.
<ide> const port = this.address().port;
<ide> source.send(Buffer.from('abc'), 0, 3, port, '127.0.0.1');
<ide> source.send(Buffer.from('def'), 0, 3, port, '127.0.0.1');
<del>});
<add>}));
<ide>
<ide> target.bind(0); | 1 |
Javascript | Javascript | add common.mustcall() to napi exception test | 9516aa19c16cbfda6917c4fb8d6aecf2da8a16aa | <ide><path>test/addons-napi/test_exception/test.js
<ide> function throwTheError() {
<ide> }
<ide> let caughtError;
<ide>
<del>const throwNoError = common.noop;
<del>
<ide> // Test that the native side successfully captures the exception
<ide> let returnedError = test_exception.returnException(throwTheError);
<ide> assert.strictEqual(theError, returnedError,
<ide> assert.strictEqual(test_exception.wasPending(), true,
<ide> ' when it was allowed through');
<ide>
<ide> // Test that the native side does not capture a non-existing exception
<del>returnedError = test_exception.returnException(throwNoError);
<add>returnedError = test_exception.returnException(common.mustCall());
<ide> assert.strictEqual(undefined, returnedError,
<ide> 'Returned error is undefined when no exception is thrown');
<ide>
<ide> // Test that no exception appears that was not thrown by us
<ide> try {
<del> test_exception.allowException(throwNoError);
<add> test_exception.allowException(common.mustCall());
<ide> } catch (anError) {
<ide> caughtError = anError;
<ide> } | 1 |
Text | Text | add option for developer tools inside browsers | ec6359408c52602846f38d21e8aa7985be10573e | <ide><path>guide/chinese/developer-tools/index.md
<ide> localeTitle: 开发者工具
<ide> * 版本控制系统
<ide> * DevOps工具
<ide> * 构建工具
<del>* 包管理员
<ide>\ No newline at end of file
<add>* 包管理员
<add>* 浏览器中的开发人员工具 | 1 |
Python | Python | add entity rules | bc40dad7d9fcf4feeca9af6187788f20303c1e74 | <ide><path>spacy/language_data/__init__.py
<ide> from .emoticons import *
<ide> from .punctuation import *
<add>from .entity_rules import *
<ide> from .util import *
<ide><path>spacy/language_data/entity_rules.py
<add># encoding: utf8
<add>from __future__ import unicode_literals
<add>
<add>from ..symbols import *
<add>from .util import ENT_ID
<add>
<add>
<add>ENTITY_RULES = [
<add> {
<add> ENT_ID: "Reddit",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "reddit"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Linux",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "linux"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Haskell",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "haskell"}],
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "HaskellCurry",
<add> "attrs": {ENT_TYPE: "PERSON"},
<add> "patterns": [
<add> [{LOWER: "haskell"}, {LOWER: "curry"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Javascript",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "javascript"}],
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "CSS",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "css"}],
<add> [{LOWER: "css3"}],
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "HTML",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "html"}],
<add> [{LOWER: "html5"}],
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Python",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{ORTH: "Python"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Ruby",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{ORTH: "Ruby"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "spaCy",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "spacy"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "displaCy",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "displacy"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Digg",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "digg"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "FoxNews",
<add> "attrs": {ENT_TYPE: "ORG"},
<add> "patterns": [
<add> [{LOWER: "foxnews"}],
<add> [{LOWER: "fox"}, {LOWER: "news"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Google",
<add> "attrs": {ENT_TYPE: "ORG"},
<add> "patterns": [
<add> [{LOWER: "google"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Mac",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "mac"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Wikipedia",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "wikipedia"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Windows",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{ORTH: "Windows"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Dell",
<add> "attrs": {ENT_TYPE: "ORG"},
<add> "patterns": [
<add> [{LOWER: "dell"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Facebook",
<add> "attrs": {ENT_TYPE: "ORG"},
<add> "patterns": [
<add> [{LOWER: "facebook"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Blizzard",
<add> "attrs": {ENT_TYPE: "ORG"},
<add> "patterns": [
<add> [{ORTH: "Blizzard"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "Ubuntu",
<add> "attrs": {ENT_TYPE: "ORG"},
<add> "patterns": [
<add> [{ORTH: "Ubuntu"}]
<add> ]
<add> },
<add>
<add> {
<add> ENT_ID: "YouTube",
<add> "attrs": {ENT_TYPE: "PRODUCT"},
<add> "patterns": [
<add> [{LOWER: "youtube"}]
<add> ]
<add> }
<add>]
<add>
<add>
<add>FALSE_POSITIVES = [
<add> [{ORTH: "Shit"}],
<add> [{ORTH: "Weed"}],
<add> [{ORTH: "Cool"}],
<add> [{ORTH: "Btw"}],
<add> [{ORTH: "Bah"}],
<add> [{ORTH: "Bullshit"}],
<add> [{ORTH: "Lol"}],
<add> [{ORTH: "Yo"}, {LOWER: "dawg"}],
<add> [{ORTH: "Yay"}],
<add> [{ORTH: "Ahh"}],
<add> [{ORTH: "Yea"}],
<add> [{ORTH: "Bah"}]
<add>]
<add>
<add>
<add>__all__ = ["ENTITY_RULES", "FALSE_POSITIVES"] | 2 |
Ruby | Ruby | remove formulapin dependency on fileutils | 4e817eaa6c46694ba4868a559f92aa064ef177af | <ide><path>Library/Homebrew/formula_pin.rb
<del>require 'fileutils'
<del>
<ide> class FormulaPin
<ide> PINDIR = Pathname.new("#{HOMEBREW_LIBRARY}/PinnedKegs")
<ide>
<ide> def path
<ide> end
<ide>
<ide> def pin_at(version)
<del> PINDIR.mkpath unless PINDIR.exist?
<add> PINDIR.mkpath
<ide> version_path = @f.rack.join(version)
<del> FileUtils.ln_s(version_path, path) unless pinned? or not version_path.exist?
<add> path.make_relative_symlink(version_path) unless pinned? || !version_path.exist?
<ide> end
<ide>
<ide> def pin
<ide> def pin
<ide> end
<ide>
<ide> def unpin
<del> FileUtils.rm(path) if pinned?
<add> path.unlink if pinned?
<ide> end
<ide>
<ide> def pinned? | 1 |
Java | Java | fix grammatical errors in javadoc | caf6760ddd5f616a8d71cd7445d5709f61296690 | <ide><path>spring-aop/src/main/java/org/aopalliance/intercept/Joinpoint.java
<ide> * terminology).
<ide> *
<ide> * <p>A runtime joinpoint is an <i>event</i> that occurs on a static
<del> * joinpoint (i.e. a location in a the program). For instance, an
<add> * joinpoint (i.e. a location in a program). For instance, an
<ide> * invocation is the runtime joinpoint on a method (static joinpoint).
<ide> * The static part of a given joinpoint can be generically retrieved
<ide> * using the {@link #getStaticPart()} method.
<ide><path>spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java
<ide> private void checkReadOnly() {
<ide>
<ide> /**
<ide> * {@link #getLookupPathForRequest Resolve} the lookupPath and cache it in a
<del> * a request attribute with the key {@link #PATH_ATTRIBUTE} for subsequent
<add> * request attribute with the key {@link #PATH_ATTRIBUTE} for subsequent
<ide> * access via {@link #getResolvedLookupPath(ServletRequest)}.
<ide> * @param request the current request
<ide> * @return the resolved path
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicate.java
<ide> default RequestPredicate or(RequestPredicate other) {
<ide>
<ide> /**
<ide> * Transform the given request into a request used for a nested route. For instance,
<del> * a path-based predicate can return a {@code ServerRequest} with a the path remaining
<add> * a path-based predicate can return a {@code ServerRequest} with a path remaining
<ide> * after a match.
<ide> * <p>The default implementation returns an {@code Optional} wrapping the given request if
<ide> * {@link #test(ServerRequest)} evaluates to {@code true}; or {@link Optional#empty()}
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/RequestPredicate.java
<ide> default RequestPredicate or(RequestPredicate other) {
<ide>
<ide> /**
<ide> * Transform the given request into a request used for a nested route. For instance,
<del> * a path-based predicate can return a {@code ServerRequest} with a the path remaining
<add> * a path-based predicate can return a {@code ServerRequest} with a path remaining
<ide> * after a match.
<ide> * <p>The default implementation returns an {@code Optional} wrapping the given request if
<ide> * {@link #test(ServerRequest)} evaluates to {@code true}; or {@link Optional#empty()}
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/ConvertingEncoderDecoderSupport.java
<ide> public boolean willDecode(M bytes) {
<ide> }
<ide>
<ide> /**
<del> * Decode the a message into an object.
<add> * Decode the message into an object.
<ide> * @see javax.websocket.Decoder.Text#decode(String)
<ide> * @see javax.websocket.Decoder.Binary#decode(ByteBuffer)
<ide> */ | 5 |
Ruby | Ruby | require plist_options when using plist | a9c0361a1d83374059fca73485643e89c2772331 | <ide><path>Library/Homebrew/cmd/audit.rb
<ide> def audit_text
<ide> problem "\"Formula.factory(name)\" is deprecated in favor of \"Formula[name]\""
<ide> end
<ide>
<add> if text =~ /def plist/ && text !~ /plist_options/
<add> problem "Please set plist_options when using a formula-defined plist."
<add> end
<add>
<ide> if text =~ /system "npm", "install"/ && text !~ %r[opt_libexec\}/npm/bin] && formula.name !~ /^kibana(\d{2})?$/
<ide> need_npm = "\#{Formula[\"node\"].opt_libexec\}/npm/bin"
<ide> problem <<-EOS.undent | 1 |
Javascript | Javascript | remove util.inherits usage | 55e6c68170880c8bd49272819c2497539cdf5de5 | <ide><path>lib/tty.js
<ide>
<ide> 'use strict';
<ide>
<del>const { inherits } = require('util');
<ide> const net = require('net');
<ide> const { TTY, isTTY } = internalBinding('tty_wrap');
<ide> const errors = require('internal/errors');
<ide> function ReadStream(fd, options) {
<ide> this.isRaw = false;
<ide> this.isTTY = true;
<ide> }
<del>inherits(ReadStream, net.Socket);
<add>
<add>Object.setPrototypeOf(ReadStream.prototype, net.Socket.prototype);
<add>Object.setPrototypeOf(ReadStream, net.Socket);
<ide>
<ide> ReadStream.prototype.setRawMode = function(flag) {
<ide> flag = !!flag;
<ide> function WriteStream(fd) {
<ide> this.rows = winSize[1];
<ide> }
<ide> }
<del>inherits(WriteStream, net.Socket);
<add>
<add>Object.setPrototypeOf(WriteStream.prototype, net.Socket.prototype);
<add>Object.setPrototypeOf(WriteStream, net.Socket);
<ide>
<ide> WriteStream.prototype.isTTY = true;
<ide> | 1 |
Javascript | Javascript | change the wrapping strategy | 58c2d138d0896ec39e4dcdfef90d00230c150409 | <ide><path>examples/with-material-ui-next/components/App.js
<del>import React, { Component } from 'react'
<del>import PropTypes from 'prop-types'
<del>import { JssProvider } from 'react-jss'
<del>import { withStyles, createStyleSheet, MuiThemeProvider } from 'material-ui/styles'
<del>import { getContext } from '../styles/context'
<del>
<del>// Apply some reset
<del>const styleSheet = createStyleSheet('App', theme => ({
<del> '@global': {
<del> html: {
<del> background: theme.palette.background.default,
<del> WebkitFontSmoothing: 'antialiased', // Antialiasing.
<del> MozOsxFontSmoothing: 'grayscale' // Antialiasing.
<del> },
<del> body: {
<del> margin: 0
<del> }
<del> }
<del>}))
<del>
<del>let AppWrapper = props => props.children
<del>
<del>AppWrapper = withStyles(styleSheet)(AppWrapper)
<del>
<del>class App extends Component {
<del> componentDidMount () {
<del> // Remove the server-side injected CSS.
<del> const jssStyles = document.querySelector('#jss-server-side')
<del> if (jssStyles && jssStyles.parentNode) {
<del> jssStyles.parentNode.removeChild(jssStyles)
<del> }
<del> }
<del>
<del> render () {
<del> const context = getContext()
<del>
<del> return (
<del> <JssProvider registry={context.sheetsRegistry} jss={context.jss}>
<del> <MuiThemeProvider theme={context.theme} sheetsManager={context.sheetsManager}>
<del> <AppWrapper>
<del> {this.props.children}
<del> </AppWrapper>
<del> </MuiThemeProvider>
<del> </JssProvider>
<del> )
<del> }
<del>}
<del>
<del>App.propTypes = {
<del> children: PropTypes.node.isRequired
<del>}
<del>
<del>export default App
<ide><path>examples/with-material-ui-next/components/withRoot.js
<add>import React, { Component } from 'react'
<add>import { JssProvider } from 'react-jss'
<add>import { withStyles, createStyleSheet, MuiThemeProvider } from 'material-ui/styles'
<add>import { getContext } from '../styles/context'
<add>
<add>// Apply some reset
<add>const styleSheet = createStyleSheet(theme => ({
<add> '@global': {
<add> html: {
<add> background: theme.palette.background.default,
<add> WebkitFontSmoothing: 'antialiased', // Antialiasing.
<add> MozOsxFontSmoothing: 'grayscale' // Antialiasing.
<add> },
<add> body: {
<add> margin: 0
<add> }
<add> }
<add>}))
<add>
<add>let AppWrapper = props => props.children
<add>
<add>AppWrapper = withStyles(styleSheet)(AppWrapper)
<add>
<add>function withRoot (BaseComponent) {
<add> class WithRoot extends Component {
<add> static getInitialProps (ctx) {
<add> if (BaseComponent.getInitialProps) {
<add> return BaseComponent.getInitialProps(ctx)
<add> }
<add>
<add> return {}
<add> }
<add>
<add> componentDidMount () {
<add> // Remove the server-side injected CSS.
<add> const jssStyles = document.querySelector('#jss-server-side')
<add> if (jssStyles && jssStyles.parentNode) {
<add> jssStyles.parentNode.removeChild(jssStyles)
<add> }
<add> }
<add>
<add> render () {
<add> const context = getContext()
<add>
<add> return (
<add> <JssProvider registry={context.sheetsRegistry} jss={context.jss}>
<add> <MuiThemeProvider theme={context.theme} sheetsManager={context.sheetsManager}>
<add> <AppWrapper>
<add> <BaseComponent />
<add> </AppWrapper>
<add> </MuiThemeProvider>
<add> </JssProvider>
<add> )
<add> }
<add> }
<add>
<add> WithRoot.displayName = `withRoot(${BaseComponent.displayName})`
<add>
<add> return WithRoot
<add>}
<add>
<add>export default withRoot
<ide><path>examples/with-material-ui-next/pages/index.js
<ide> import Dialog, {
<ide> DialogActions
<ide> } from 'material-ui/Dialog'
<ide> import Typography from 'material-ui/Typography'
<del>import App from '../components/App'
<add>import withRoot from '../components/withRoot'
<ide>
<ide> const styles = {
<ide> container: {
<ide> class Index extends Component {
<ide>
<ide> render () {
<ide> return (
<del> <App>
<del> <div style={styles.container}>
<del> <Dialog open={this.state.open} onRequestClose={this.handleRequestClose}>
<del> <DialogTitle>Super Secret Password</DialogTitle>
<del> <DialogContent>
<del> <DialogContentText>1-2-3-4-5</DialogContentText>
<del> </DialogContent>
<del> <DialogActions>
<del> <Button color='primary' onClick={this.handleRequestClose}>OK</Button>
<del> </DialogActions>
<del> </Dialog>
<del> <Typography type='display1' gutterBottom>Material-UI</Typography>
<del> <Typography type='subheading' gutterBottom>example project</Typography>
<del> <Button raised color='accent' onClick={this.handleClick}>
<del> Super Secret Password
<del> </Button>
<del> </div>
<del> </App>
<add> <div style={styles.container}>
<add> <Dialog open={this.state.open} onRequestClose={this.handleRequestClose}>
<add> <DialogTitle>Super Secret Password</DialogTitle>
<add> <DialogContent>
<add> <DialogContentText>1-2-3-4-5</DialogContentText>
<add> </DialogContent>
<add> <DialogActions>
<add> <Button color='primary' onClick={this.handleRequestClose}>OK</Button>
<add> </DialogActions>
<add> </Dialog>
<add> <Typography type='display1' gutterBottom>Material-UI</Typography>
<add> <Typography type='subheading' gutterBottom>example project</Typography>
<add> <Button raised color='accent' onClick={this.handleClick}>
<add> Super Secret Password
<add> </Button>
<add> </div>
<ide> )
<ide> }
<ide> }
<ide>
<del>export default Index
<add>export default withRoot(Index) | 3 |
Java | Java | remove jaf references | 0aaa6528dcb07ef76049cf74a4d6aecb4ee6c610 | <ide><path>spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java
<ide> import org.springframework.http.HttpOutputMessage;
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.MediaTypeFactory;
<del>import org.springframework.util.ClassUtils;
<ide> import org.springframework.util.StreamUtils;
<ide>
<ide> /**
<ide> * Implementation of {@link HttpMessageConverter} that can read/write {@link Resource Resources}
<ide> * and supports byte range requests.
<ide> *
<del> * <p>By default, this converter can read all media types. The Java Activation Framework (JAF) -
<del> * if available - is used to determine the {@code Content-Type} of written resources.
<del> * If JAF is not available, {@code application/octet-stream} is used.
<add> * <p>By default, this converter can read all media types. The {@link MediaTypeFactory} is used
<add> * to determine the {@code Content-Type} of written resources.
<ide> *
<ide> * @author Arjen Poutsma
<ide> * @author Juergen Hoeller
<ide> */
<ide> public class ResourceHttpMessageConverter extends AbstractHttpMessageConverter<Resource> {
<ide>
<del> private static final boolean jafPresent = ClassUtils.isPresent(
<del> "javax.activation.FileTypeMap", ResourceHttpMessageConverter.class.getClassLoader());
<del>
<ide> private final boolean supportsReadStreaming;
<ide>
<ide>
<ide> public String getFilename() {
<ide>
<ide> @Override
<ide> protected MediaType getDefaultContentType(Resource resource) {
<del> if (jafPresent) {
<del> return MediaTypeFactory.getMediaType(resource);
<del> }
<del> else {
<del> return MediaType.APPLICATION_OCTET_STREAM;
<del> }
<add> MediaType mediaType = MediaTypeFactory.getMediaType(resource);
<add> return mediaType != null ? mediaType : MediaType.APPLICATION_OCTET_STREAM;
<ide> }
<ide>
<ide> @Override
<ide><path>spring-web/src/main/java/org/springframework/http/converter/ResourceRegionHttpMessageConverter.java
<ide> import java.nio.charset.StandardCharsets;
<ide> import java.util.Collection;
<ide>
<add>import org.springframework.core.io.Resource;
<ide> import org.springframework.core.io.support.ResourceRegion;
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.HttpInputMessage;
<ide> import org.springframework.http.HttpOutputMessage;
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.MediaTypeFactory;
<ide> import org.springframework.util.Assert;
<del>import org.springframework.util.ClassUtils;
<ide> import org.springframework.util.MimeTypeUtils;
<ide> import org.springframework.util.StreamUtils;
<ide>
<ide> */
<ide> public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessageConverter<Object> {
<ide>
<del> private static final boolean jafPresent = ClassUtils.isPresent(
<del> "javax.activation.FileTypeMap", ResourceHttpMessageConverter.class.getClassLoader());
<del>
<ide> public ResourceRegionHttpMessageConverter() {
<ide> super(MediaType.ALL);
<ide> }
<ide> protected ResourceRegion readInternal(Class<?> clazz, HttpInputMessage inputMess
<ide> @Override
<ide> @SuppressWarnings("unchecked")
<ide> protected MediaType getDefaultContentType(Object object) {
<del> if (jafPresent) {
<del> if(object instanceof ResourceRegion) {
<del> return MediaTypeFactory.getMediaType(((ResourceRegion) object).getResource());
<del> }
<del> else {
<del> Collection<ResourceRegion> regions = (Collection<ResourceRegion>) object;
<del> if(regions.size() > 0) {
<del> return MediaTypeFactory.getMediaType(regions.iterator().next().getResource());
<del> }
<add> Resource resource = null;
<add> if (object instanceof ResourceRegion) {
<add> resource = ((ResourceRegion) object).getResource();
<add> }
<add> else {
<add> Collection<ResourceRegion> regions = (Collection<ResourceRegion>) object;
<add> if (regions.size() > 0) {
<add> resource = regions.iterator().next().getResource();
<ide> }
<ide> }
<del> return MediaType.APPLICATION_OCTET_STREAM;
<add> MediaType result = null;
<add> if (resource != null) {
<add> result = MediaTypeFactory.getMediaType(resource);
<add> }
<add> if (result == null) {
<add> return MediaType.APPLICATION_OCTET_STREAM;
<add> }
<add> return result;
<ide> }
<ide>
<ide> @Override
<ide><path>spring-web/src/main/java/org/springframework/web/accept/ContentNegotiationManager.java
<ide> public List<String> resolveFileExtensions(MediaType mediaType) {
<ide> * <p>At startup this method returns extensions explicitly registered with
<ide> * either {@link PathExtensionContentNegotiationStrategy} or
<ide> * {@link ParameterContentNegotiationStrategy}. At runtime if there is a
<del> * "path extension" strategy and its
<del> * {@link PathExtensionContentNegotiationStrategy#setUseJaf(boolean)
<del> * useJaf} property is set to "true", the list of extensions may
<del> * increase as file extensions are resolved via JAF and cached.
<add> * "path extension" strategy, the list of extensions may
<add> * increase as file extensions are resolved via
<add> * {@link org.springframework.http.MediaTypeFactory} and cached.
<ide> */
<ide> @Override
<ide> public List<String> getAllFileExtensions() {
<ide><path>spring-web/src/main/java/org/springframework/web/accept/ContentNegotiationManagerFactoryBean.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> import org.springframework.beans.factory.FactoryBean;
<ide> import org.springframework.beans.factory.InitializingBean;
<ide> import org.springframework.http.MediaType;
<add>import org.springframework.http.MediaTypeFactory;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.util.CollectionUtils;
<ide> import org.springframework.web.context.ServletContextAware;
<ide> * "application/json".
<ide> *
<ide> * <p>The path extension strategy will also use {@link ServletContext#getMimeType}
<del> * and the Java Activation framework (JAF), if available, to resolve a path
<del> * extension to a MediaType. You may {@link #setUseJaf suppress} the use of JAF.
<add> * and {@link MediaTypeFactory} to resolve a path extension to a MediaType.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @since 3.2
<ide>
<ide> private boolean ignoreUnknownPathExtensions = true;
<ide>
<del> private Boolean useJaf;
<del>
<ide> private String parameterName = "format";
<ide>
<ide> private ContentNegotiationStrategy defaultNegotiationStrategy;
<ide> public void setFavorPathExtension(boolean favorPathExtension) {
<ide> * (see Spring Framework reference documentation for more details on RFD
<ide> * attack protection).
<ide> * <p>The path extension strategy will also try to use
<del> * {@link ServletContext#getMimeType} and JAF (if present) to resolve path
<del> * extensions. To change this behavior see the {@link #useJaf} property.
<add> * {@link ServletContext#getMimeType} and
<add> * {@link org.springframework.http.MediaTypeFactory} to resolve path extensions.
<ide> * @param mediaTypes media type mappings
<ide> * @see #addMediaType(String, MediaType)
<ide> * @see #addMediaTypes(Map)
<ide> public void setIgnoreUnknownPathExtensions(boolean ignore) {
<ide> }
<ide>
<ide> /**
<del> * When {@link #setFavorPathExtension favorPathExtension} is set, this
<del> * property determines whether to allow use of JAF (Java Activation Framework)
<del> * to resolve a path extension to a specific MediaType.
<del> * <p>By default this is not set in which case
<del> * {@code PathExtensionContentNegotiationStrategy} will use JAF if available.
<add> * @deprecated as 5.0, in favor of {@link MediaTypeFactory}, which has no JAF dependency.
<ide> */
<add> @Deprecated
<ide> public void setUseJaf(boolean useJaf) {
<del> this.useJaf = useJaf;
<del> }
<del>
<del> private boolean isUseJafTurnedOff() {
<del> return (this.useJaf != null && !this.useJaf);
<ide> }
<ide>
<ide> /**
<ide> public void afterPropertiesSet() {
<ide>
<ide> if (this.favorPathExtension) {
<ide> PathExtensionContentNegotiationStrategy strategy;
<del> if (this.servletContext != null && !isUseJafTurnedOff()) {
<add> if (this.servletContext != null) {
<ide> strategy = new ServletPathExtensionContentNegotiationStrategy(
<ide> this.servletContext, this.mediaTypes);
<ide> }
<ide> else {
<ide> strategy = new PathExtensionContentNegotiationStrategy(this.mediaTypes);
<ide> }
<ide> strategy.setIgnoreUnknownExtensions(this.ignoreUnknownPathExtensions);
<del> if (this.useJaf != null) {
<del> strategy.setUseJaf(this.useJaf);
<del> }
<ide> strategies.add(strategy);
<ide> }
<ide>
<ide><path>spring-web/src/main/java/org/springframework/web/accept/PathExtensionContentNegotiationStrategy.java
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.MediaTypeFactory;
<ide> import org.springframework.util.Assert;
<del>import org.springframework.util.ClassUtils;
<ide> import org.springframework.util.StringUtils;
<ide> import org.springframework.web.HttpMediaTypeNotAcceptableException;
<ide> import org.springframework.web.context.request.NativeWebRequest;
<ide> * request path to a key to be used to look up a media type.
<ide> *
<ide> * <p>If the file extension is not found in the explicit registrations provided
<del> * to the constructor, the Java Activation Framework (JAF) is used as a fallback
<add> * to the constructor, the {@link MediaTypeFactory} is used as a fallback
<ide> * mechanism.
<ide> *
<del> * <p>The presence of the JAF is detected and enabled automatically but the
<del> * {@link #setUseJaf(boolean)} property may be set to false.
<del> *
<ide> * @author Rossen Stoyanchev
<ide> * @since 3.2
<ide> */
<ide> public class PathExtensionContentNegotiationStrategy extends AbstractMappingContentNegotiationStrategy {
<ide>
<del> private static final boolean JAF_PRESENT = ClassUtils.isPresent("javax.activation.FileTypeMap",
<del> PathExtensionContentNegotiationStrategy.class.getClassLoader());
<del>
<ide> private static final Log logger = LogFactory.getLog(PathExtensionContentNegotiationStrategy.class);
<ide>
<ide> private UrlPathHelper urlPathHelper = new UrlPathHelper();
<ide>
<del> private boolean useJaf = true;
<del>
<ide> private boolean ignoreUnknownExtensions = true;
<ide>
<ide>
<ide> public void setUrlPathHelper(UrlPathHelper urlPathHelper) {
<ide> }
<ide>
<ide> /**
<del> * Whether to use the Java Activation Framework to look up file extensions.
<del> * <p>By default this is set to "true" but depends on JAF being present.
<add> * @deprecated as 5.0, in favor of {@link MediaTypeFactory}, which has no JAF dependency.
<ide> */
<add> @Deprecated
<ide> public void setUseJaf(boolean useJaf) {
<del> this.useJaf = useJaf;
<ide> }
<ide>
<ide> /**
<ide> protected String getMediaTypeKey(NativeWebRequest webRequest) {
<ide> protected MediaType handleNoMatch(NativeWebRequest webRequest, String extension)
<ide> throws HttpMediaTypeNotAcceptableException {
<ide>
<del> if (this.useJaf && JAF_PRESENT) {
<del> MediaType mediaType = MediaTypeFactory.getMediaType("file." + extension);
<del> if (mediaType != null && !MediaType.APPLICATION_OCTET_STREAM.equals(mediaType)) {
<del> return mediaType;
<del> }
<add> MediaType mediaType = MediaTypeFactory.getMediaType("file." + extension);
<add> if (mediaType != null) {
<add> return mediaType;
<ide> }
<ide> if (this.ignoreUnknownExtensions) {
<ide> return null;
<ide> protected MediaType handleNoMatch(NativeWebRequest webRequest, String extension)
<ide> * A public method exposing the knowledge of the path extension strategy to
<ide> * resolve file extensions to a {@link MediaType} in this case for a given
<ide> * {@link Resource}. The method first looks up any explicitly registered
<del> * file extensions first and then falls back on JAF if available.
<add> * file extensions first and then falls back on {@link MediaTypeFactory} if available.
<ide> * @param resource the resource to look up
<ide> * @return the MediaType for the extension, or {@code null} if none found
<ide> * @since 4.3
<ide> public MediaType getMediaTypeForResource(Resource resource) {
<ide> if (extension != null) {
<ide> mediaType = lookupMediaType(extension);
<ide> }
<del> if (mediaType == null && JAF_PRESENT) {
<add> if (mediaType == null) {
<ide> mediaType = MediaTypeFactory.getMediaType(filename);
<ide> }
<del> if (MediaType.APPLICATION_OCTET_STREAM.equals(mediaType)) {
<del> mediaType = null;
<del> }
<ide> return mediaType;
<ide> }
<ide>
<ide><path>spring-web/src/main/java/org/springframework/web/accept/ServletPathExtensionContentNegotiationStrategy.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public ServletPathExtensionContentNegotiationStrategy(
<ide> /**
<ide> * Create an instance without any mappings to start with. Mappings may be
<ide> * added later when extensions are resolved through
<del> * {@link ServletContext#getMimeType(String)} or via JAF.
<add> * {@link ServletContext#getMimeType(String)} or via
<add> * {@link org.springframework.http.MediaTypeFactory}.
<ide> */
<ide> public ServletPathExtensionContentNegotiationStrategy(ServletContext context) {
<ide> this(context, null);
<ide> public ServletPathExtensionContentNegotiationStrategy(ServletContext context) {
<ide>
<ide> /**
<ide> * Resolve file extension via {@link ServletContext#getMimeType(String)}
<del> * and also delegate to base class for a potential JAF lookup.
<add> * and also delegate to base class for a potential
<add> * {@link org.springframework.http.MediaTypeFactory} lookup.
<ide> */
<ide> @Override
<ide> protected MediaType handleNoMatch(NativeWebRequest webRequest, String extension)
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/accept/PathExtensionContentTypeResolver.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 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> * the request path and uses that as the media type lookup key.
<ide> *
<ide> * <p>If the file extension is not found in the explicit registrations provided
<del> * to the constructor, the Java Activation Framework (JAF) is used as a fallback
<del> * mechanism. The presence of the JAF is detected and enabled automatically but
<del> * the {@link #setUseJaf(boolean)} property may be set to false.
<add> * to the constructor, the {@link MediaTypeFactory} is used as a fallback
<add> * mechanism.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @since 5.0
<ide> */
<ide> public class PathExtensionContentTypeResolver extends AbstractMappingContentTypeResolver {
<ide>
<del> private boolean useJaf = true;
<del>
<ide> private boolean ignoreUnknownExtensions = true;
<ide>
<ide>
<ide> public PathExtensionContentTypeResolver() {
<ide> }
<ide>
<ide>
<del> /**
<del> * Whether to use the Java Activation Framework to look up file extensions.
<del> * <p>By default this is set to "true" but depends on JAF being present.
<del> */
<del> public void setUseJaf(boolean useJaf) {
<del> this.useJaf = useJaf;
<del> }
<del>
<ide> /**
<ide> * Whether to ignore requests with unknown file extension. Setting this to
<ide> * {@code false} results in {@code HttpMediaTypeNotAcceptableException}.
<ide> protected String extractKey(ServerWebExchange exchange) {
<ide>
<ide> @Override
<ide> protected MediaType handleNoMatch(String key) throws NotAcceptableStatusException {
<del> if (this.useJaf) {
<del> MediaType mediaType = MediaTypeFactory.getMediaType("file." + key);
<del> if (mediaType != null && !MediaType.APPLICATION_OCTET_STREAM.equals(mediaType)) {
<del> return mediaType;
<del> }
<add> MediaType mediaType = MediaTypeFactory.getMediaType("file." + key);
<add> if (mediaType != null) {
<add> return mediaType;
<ide> }
<ide> if (!this.ignoreUnknownExtensions) {
<ide> throw new NotAcceptableStatusException(getAllMediaTypes());
<ide> protected MediaType handleNoMatch(String key) throws NotAcceptableStatusExceptio
<ide> /**
<ide> * A public method exposing the knowledge of the path extension resolver to
<ide> * determine the media type for a given {@link Resource}. First it checks
<del> * the explicitly registered mappings and then falls back on JAF.
<add> * the explicitly registered mappings and then falls back on {@link MediaTypeFactory}.
<ide> * @param resource the resource
<ide> * @return the MediaType for the extension, or {@code null} if none determined
<ide> */
<ide> public MediaType resolveMediaTypeForResource(Resource resource) {
<ide> if (mediaType == null) {
<ide> mediaType = MediaTypeFactory.getMediaType(filename);
<ide> }
<del> if (MediaType.APPLICATION_OCTET_STREAM.equals(mediaType)) {
<del> mediaType = null;
<del> }
<ide> return mediaType;
<ide> }
<ide>
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/accept/RequestedContentTypeResolverBuilder.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 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> * {@link #mediaTypes(Map)}. This will be used to resolve path extensions or a
<ide> * parameter value such as "json" to a media type such as "application/json".
<ide> *
<del> * <p>The path extension strategy will also use the Java Activation framework
<del> * (JAF), if available, to resolve a path extension to a MediaType. You may
<del> * {@link #useJaf suppress} the use of JAF.
<add> * <p>The path extension strategy will also use
<add> * {@link org.springframework.http.MediaTypeFactory} to resolve a path extension
<add> * to a MediaType.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @since 5.0
<ide> public class RequestedContentTypeResolverBuilder {
<ide>
<ide> private boolean ignoreUnknownPathExtensions = true;
<ide>
<del> private Boolean useJaf;
<del>
<ide> private String parameterName = "format";
<ide>
<ide> private RequestedContentTypeResolver contentTypeResolver;
<ide> public RequestedContentTypeResolverBuilder favorPathExtension(boolean favorPathE
<ide> * whitelisted for the purpose of Reflected File Download attack detection
<ide> * (see Spring Framework reference documentation for more details on RFD
<ide> * attack protection).
<del> * <p>The path extension strategy will also try to use JAF (if present) to
<del> * resolve path extensions. To change this behavior see {@link #useJaf}.
<add> * <p>The path extension strategy will also use the
<add> * {@link org.springframework.http.MediaTypeFactory} to resolve path
<add> * extensions.
<ide> * @param mediaTypes media type mappings
<ide> */
<ide> public RequestedContentTypeResolverBuilder mediaTypes(Map<String, MediaType> mediaTypes) {
<ide> public RequestedContentTypeResolverBuilder ignoreUnknownPathExtensions(boolean i
<ide> return this;
<ide> }
<ide>
<del> /**
<del> * When {@link #favorPathExtension favorPathExtension} is set, this
<del> * property determines whether to allow use of JAF (Java Activation Framework)
<del> * to resolve a path extension to a specific MediaType.
<del> * <p>By default this is not set in which case
<del> * {@code PathExtensionContentNegotiationStrategy} will use JAF if available.
<del> */
<del> public RequestedContentTypeResolverBuilder useJaf(boolean useJaf) {
<del> this.useJaf = useJaf;
<del> return this;
<del> }
<del>
<ide> /**
<ide> * Whether a request parameter ("format" by default) should be used to
<ide> * determine the requested media type. For this option to work you must
<ide> public CompositeContentTypeResolver build() {
<ide> if (this.favorPathExtension) {
<ide> PathExtensionContentTypeResolver resolver = new PathExtensionContentTypeResolver(this.mediaTypes);
<ide> resolver.setIgnoreUnknownExtensions(this.ignoreUnknownPathExtensions);
<del> if (this.useJaf != null) {
<del> resolver.setUseJaf(this.useJaf);
<del> }
<ide> resolvers.add(resolver);
<ide> }
<ide>
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ContentNegotiationConfigurer.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2017 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 javax.servlet.ServletContext;
<ide>
<ide> import org.springframework.http.MediaType;
<add>import org.springframework.http.MediaTypeFactory;
<ide> import org.springframework.web.accept.ContentNegotiationManager;
<ide> import org.springframework.web.accept.ContentNegotiationManagerFactoryBean;
<ide> import org.springframework.web.accept.ContentNegotiationStrategy;
<ide> * type such as "application/json".
<ide> *
<ide> * <p>The path extension strategy will also use {@link ServletContext#getMimeType}
<del> * and the Java Activation framework (JAF), if available, to resolve a path
<del> * extension to a MediaType. You may however {@link #useJaf suppress} the use
<del> * of JAF.
<add> * and the {@link MediaTypeFactory} to resolve a path
<add> * extension to a MediaType.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @since 3.2
<ide> public ContentNegotiationConfigurer favorPathExtension(boolean favorPathExtensio
<ide> * (see Spring Framework reference documentation for more details on RFD
<ide> * attack protection).
<ide> * <p>The path extension strategy will also try to use
<del> * {@link ServletContext#getMimeType} and JAF (if present) to resolve path
<del> * extensions. To change this behavior see the {@link #useJaf} property.
<add> * {@link ServletContext#getMimeType} and {@link MediaTypeFactory} to resolve path
<add> * extensions.
<ide> * @param extension the key to look up
<ide> * @param mediaType the media type
<ide> * @see #mediaTypes(Map)
<ide> public ContentNegotiationConfigurer ignoreUnknownPathExtensions(boolean ignore)
<ide> }
<ide>
<ide> /**
<del> * When {@link #favorPathExtension} is set, this property determines whether
<del> * to allow use of JAF (Java Activation Framework) to resolve a path
<del> * extension to a specific MediaType.
<del> * <p>By default this is not set in which case
<del> * {@code PathExtensionContentNegotiationStrategy} will use JAF if available.
<add> * @deprecated as 5.0, in favor of {@link MediaTypeFactory}, which has no JAF dependency.
<ide> */
<add> @Deprecated
<ide> public ContentNegotiationConfigurer useJaf(boolean useJaf) {
<del> this.factory.setUseJaf(useJaf);
<ide> return this;
<ide> }
<ide> | 9 |
Javascript | Javascript | assure settimeout callback only runs once | caf0b36de33ad4991e3f21ed088a84c68cb0662d | <ide><path>lib/timers.js
<ide> function listOnTimeout() {
<ide> if (domain)
<ide> domain.enter();
<ide> threw = true;
<add> first._called = true;
<ide> first._onTimeout();
<ide> if (domain)
<ide> domain.exit();
<ide> exports.clearInterval = function(timer) {
<ide>
<ide>
<ide> const Timeout = function(after) {
<add> this._called = false;
<ide> this._idleTimeout = after;
<ide> this._idlePrev = this;
<ide> this._idleNext = this;
<ide> Timeout.prototype.unref = function() {
<ide> var delay = this._idleStart + this._idleTimeout - now;
<ide> if (delay < 0) delay = 0;
<ide> exports.unenroll(this);
<add>
<add> // Prevent running cb again when unref() is called during the same cb
<add> if (this._called && !this._repeat) return;
<add>
<ide> this._handle = new Timer();
<ide> this._handle[kOnTimeout] = this._onTimeout;
<ide> this._handle.start(delay, 0);
<ide> function unrefTimeout() {
<ide> if (domain) domain.enter();
<ide> threw = true;
<ide> debug('unreftimer firing timeout');
<add> first._called = true;
<ide> first._onTimeout();
<ide> threw = false;
<ide> if (domain)
<ide><path>test/parallel/test-timers-unref.js
<ide> var interval_fired = false,
<ide> timeout_fired = false,
<ide> unref_interval = false,
<ide> unref_timer = false,
<add> unref_callbacks = 0,
<ide> interval, check_unref, checks = 0;
<ide>
<ide> var LONG_TIME = 10 * 1000;
<ide> check_unref = setInterval(function() {
<ide> checks += 1;
<ide> }, 100);
<ide>
<add>setTimeout(function() {
<add> unref_callbacks++;
<add> this.unref();
<add>}, SHORT_TIME);
<add>
<add>// Should not timeout the test
<add>setInterval(function() {
<add> this.unref();
<add>}, SHORT_TIME);
<add>
<ide> // Should not assert on args.Holder()->InternalFieldCount() > 0. See #4261.
<ide> (function() {
<ide> var t = setInterval(function() {}, 1);
<ide> process.on('exit', function() {
<ide> assert.strictEqual(timeout_fired, false, 'Timeout should not fire');
<ide> assert.strictEqual(unref_timer, true, 'An unrefd timeout should still fire');
<ide> assert.strictEqual(unref_interval, true, 'An unrefd interval should still fire');
<add> assert.strictEqual(unref_callbacks, 1, 'Callback should only run once');
<ide> }); | 2 |
Javascript | Javascript | add msaa to example files.js | 134f99d3cafec9d8798070339ab9e63d1c6307d0 | <ide><path>examples/files.js
<ide> var files = {
<ide> "webgl_postprocessing_glitch",
<ide> "webgl_postprocessing_godrays",
<ide> "webgl_postprocessing_masking",
<add> "webgl_postprocessing_msaa",
<ide> "webgl_postprocessing_nodes",
<ide> "webgl_postprocessing_smaa",
<ide> "webgl_postprocessing_ssao", | 1 |
Python | Python | make minor changes | fb41b0489b966dc10ed3116c74b5f543492cc6fa | <ide><path>research/object_detection/meta_architectures/context_rcnn_lib_tf2.py
<ide> def set_output_dimension(self, output_dim):
<ide> def build(self, input_shapes):
<ide> pass
<ide>
<del> def call(self, input_features, context_features, valid_context_size):
<add> def call(self, box_features, context_features, valid_context_size):
<ide> """Handles a call by performing attention."""
<ide> _, context_size, _ = context_features.shape
<ide> valid_mask = compute_valid_mask(valid_context_size, context_size)
<del> channels = input_features.shape[-1]
<add> channels = box_features.shape[-1]
<ide>
<ide> #Build the feature projection layer
<ide> if not self._output_dimension:
<ide> def call(self, input_features, context_features, valid_context_size):
<ide>
<ide> # Average pools over height and width dimension so that the shape of
<ide> # box_features becomes [batch_size, max_num_proposals, channels].
<del> input_features = tf.reduce_mean(input_features, [2, 3])
<add> box_features = tf.reduce_mean(box_features, [2, 3])
<ide>
<ide> with tf.name_scope("AttentionBlock"):
<ide> queries = project_features(
<del> input_features, self._bottleneck_dimension, self._is_training,
<add> box_features, self._bottleneck_dimension, self._is_training,
<ide> self._query_proj, normalize=True)
<ide> keys = project_features(
<ide> context_features, self._bottleneck_dimension, self._is_training, | 1 |
Javascript | Javascript | introduce internal `server` command | 9a22b1e78b4c9d8041d15c71c9a2297cada1cfdd | <ide><path>packager/webSocketProxy.js
<ide> function attachToServer(server, path) {
<ide> });
<ide> });
<ide> });
<add>
<add> return wss;
<ide> }
<ide>
<ide> module.exports = { | 1 |
PHP | PHP | reword exception explanation | cd98e3c9745999506c2d88ff4b77805632aeb4bc | <ide><path>src/Cache/SimpleCacheEngine.php
<ide> protected function ensureValidKey($key)
<ide> * @param string $key The unique key of this item in the cache.
<ide> * @param mixed $default Default value to return if the key does not exist.
<ide> * @return mixed The value of the item from the cache, or $default in case of cache miss.
<del> * @throws \Psr\SimpleCache\InvalidArgumentException
<del> * MUST be thrown if the $key string is not a legal value.
<add> * @throws \Psr\SimpleCache\InvalidArgumentException If the $key string is not a legal value.
<ide> */
<ide> public function get($key, $default = null)
<ide> { | 1 |
PHP | PHP | replace spaces with tabs | b08866c08e69e0812cb4d863f08e6b17a1fa5edf | <ide><path>src/Illuminate/Console/Command.php
<ide> public function option($key = null)
<ide> */
<ide> public function confirm($question, $default = true)
<ide> {
<del> $helper = $this->getHelperSet()->get('question');
<del> $question = new ConfirmationQuestion($question, $default);
<add> $helper = $this->getHelperSet()->get('question');
<add> $question = new ConfirmationQuestion("<question>{$question}</question>", $default);
<ide>
<ide> return $helper->ask($this->input, $this->output, $question);
<ide> }
<ide> public function confirm($question, $default = true)
<ide> */
<ide> public function ask($question, $default = null)
<ide> {
<del> $helper = $this->getHelperSet()->get('question');
<del> $question = new Question($question, $default);
<add> $helper = $this->getHelperSet()->get('question');
<add> $question = new Question("<question>$question</question>", $default);
<ide>
<ide> return $helper->ask($this->input, $this->output, $question);
<ide> }
<ide>
<del> /**
<del> * Prompt the user for input with autocomplete
<del> *
<del> * @param string $question
<del> * @param array $list
<del> * @param string $default
<del> * @return string
<del> */
<del> public function autocomplete($question, array $list, $default = null)
<del> {
<del> $helper = $this->getHelperSet()->get('question');
<del> $question = new Question("<question>$question</question>", $default);
<del> $question->setAutocompleterValues($list);
<add> /**
<add> * Prompt the user for input with autocomplete
<add> *
<add> * @param string $question
<add> * @param array $list
<add> * @param string $default
<add> * @return string
<add> */
<add> public function autocomplete($question, array $list, $default = null)
<add> {
<add> $helper = $this->getHelperSet()->get('question');
<add> $question = new Question("<question>$question</question>", $default);
<add> $question->setAutocompleterValues($list);
<ide>
<del> return $helper->ask($this->input, $this->output, $question);
<del> }
<add> return $helper->ask($this->input, $this->output, $question);
<add> }
<ide>
<ide>
<ide> /**
<ide> public function autocomplete($question, array $list, $default = null)
<ide> */
<ide> public function secret($question, $fallback = true)
<ide> {
<del> $helper = $this->getHelperSet()->get('question');
<del> $question = new Question($question);
<del> $question->setHidden(true);
<del> $question->setHiddenFallback($fallback);
<add> $helper = $this->getHelperSet()->get('question');
<add> $question = new Question("<question>$question</question>");
<add> $question->setHidden(true);
<add> $question->setHiddenFallback($fallback);
<ide>
<ide> return $helper->ask($this->input, $this->output, $question);
<ide> }
<ide>
<del> /**
<del> * Give the user a single choice from an array of answers.
<del> *
<del> * @param string $question
<del> * @param array $choices
<del> * @param string $default
<del> * @param bool $multiple
<del> * @param mixed $attempts
<del> * @return bool
<del> */
<del> public function choice($question, array $choices, $default = null, $multiple = false, $attempts = null)
<add> /**
<add> * Give the user a single choice from an array of answers.
<add> *
<add> * @param string $question
<add> * @param array $choices
<add> * @param string $default
<add> * @param bool $multiple
<add> * @param mixed $attempts
<add> * @return bool
<add> */
<add> public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null)
<ide> {
<del> $helper = $this->getHelperSet()->get('question');
<del> $question = new ChoiceQuestion($question, $choices, $default);
<del> $question->setMaxAttempts($attempts);
<del> $question->setMultiselect($multiple);
<add> $helper = $this->getHelperSet()->get('question');
<add> $question = new ChoiceQuestion("<question>$question</question>", $choices, $default);
<add> $question->setMaxAttempts($attempts);
<add> $question->setMultiselect($multiple);
<ide>
<ide> return $helper->ask($this->input, $this->output, $question);
<ide> }
<ide>
<del> /**
<del> * Format input to textual table
<del> *
<del> * @param array $headers
<del> * @param array $rows
<del> * @return void
<del> */
<del> public function table(array $headers, array $rows)
<del> {
<del> $table = $this->getHelperSet()->get('table');
<del> $table->setHeaders($headers);
<del> $table->setRows($rows);
<del> $table->render($this->output);
<del> }
<del>
<ide> /**
<del> * Write a string as standard output.
<add> * Format input to textual table
<ide> *
<del> * @param string $string
<add> * @param array $headers
<add> * @param array $rows
<ide> * @return void
<ide> */
<del> public function line($string)
<add> public function table(array $headers, array $rows)
<ide> {
<del> $this->output->writeln($string);
<add> $table = $this->getHelperSet()->get('table');
<add> $table->setHeaders($headers);
<add> $table->setRows($rows);
<add> $table->render($this->output);
<ide> }
<ide>
<ide> /**
<ide> public function info($string)
<ide> $this->output->writeln("<info>$string</info>");
<ide> }
<ide>
<add> /**
<add> * Write a string as standard output.
<add> *
<add> * @param string $string
<add> * @return void
<add> */
<add> public function line($string)
<add> {
<add> $this->output->writeln($string);
<add> }
<add>
<ide> /**
<ide> * Write a string as comment output.
<ide> * | 1 |
PHP | PHP | remove deprecate and unused methods | 466422a192fbffff9a9127df3f610d397d0a3777 | <ide><path>src/ORM/ResultSet.php
<ide> protected function _calculateColumnMap($query)
<ide> $this->_map = $map;
<ide> }
<ide>
<del> /**
<del> * Creates a map of Type converter classes for each of the columns that should
<del> * be fetched by this object.
<del> *
<del> * @deprecated 3.2.0 Not used anymore. Type casting is done at the statement level
<del> * @return void
<del> */
<del> protected function _calculateTypeMap()
<del> {
<del> deprecationWarning('ResultSet::_calculateTypeMap() is deprecated, and will be removed in 4.0.0.');
<del> }
<del>
<del> /**
<del> * Returns the Type classes for each of the passed fields belonging to the
<del> * table.
<del> *
<del> * @param \Cake\ORM\Table $table The table from which to get the schema
<del> * @param array $fields The fields whitelist to use for fields in the schema.
<del> * @return array
<del> */
<del> protected function _getTypes($table, $fields)
<del> {
<del> $types = [];
<del> $schema = $table->getSchema();
<del> $map = array_keys(Type::getMap() + ['string' => 1, 'text' => 1, 'boolean' => 1]);
<del> $typeMap = array_combine(
<del> $map,
<del> array_map(['Cake\Database\Type', 'build'], $map)
<del> );
<del>
<del> foreach (['string', 'text'] as $t) {
<del> if (get_class($typeMap[$t]) === 'Cake\Database\Type') {
<del> unset($typeMap[$t]);
<del> }
<del> }
<del>
<del> foreach (array_intersect($fields, $schema->columns()) as $col) {
<del> $typeName = $schema->getColumnType($col);
<del> if (isset($typeMap[$typeName])) {
<del> $types[$col] = $typeMap[$typeName];
<del> }
<del> }
<del>
<del> return $types;
<del> }
<del>
<ide> /**
<ide> * Helper function to fetch the next result from the statement or
<ide> * seeded results. | 1 |
PHP | PHP | add urlparser to support | 39c115ddca97217da748b90a1146d484d3c91f61 | <ide><path>src/Illuminate/Database/DatabaseManager.php
<ide>
<ide> use PDO;
<ide> use Illuminate\Support\Arr;
<add>use Illuminate\Support\ConfigurationUrlParser;
<ide> use Illuminate\Support\Str;
<ide> use InvalidArgumentException;
<ide> use Illuminate\Database\Connectors\ConnectionFactory;
<ide><path>src/Illuminate/Support/ConfigurationUrlParser.php
<add><?php
<add>
<add>namespace Illuminate\Support;
<add>
<add>use InvalidArgumentException;
<add>
<add>class ConfigurationUrlParser
<add>{
<add> /**
<add> * The drivers aliases map.
<add> *
<add> * @var array
<add> */
<add> protected static $driverAliases = [
<add> 'mssql' => 'sqlsrv',
<add> 'mysql2' => 'mysql', // RDS
<add> 'postgres' => 'pgsql',
<add> 'postgresql' => 'pgsql',
<add> 'sqlite3' => 'sqlite',
<add> ];
<add>
<add> /**
<add> * Parse the database configuration, hydrating options using a database configuration URL if possible.
<add> *
<add> * @param array|string $config
<add> * @return array
<add> */
<add> public function parseConfiguration($config)
<add> {
<add> if (is_string($config)) {
<add> $config = ['url' => $config];
<add> }
<add>
<add> $url = $config['url'] ?? null;
<add>
<add> $config = Arr::except($config, 'url');
<add>
<add> if (! $url) {
<add> return $config;
<add> }
<add>
<add> $parsedUrl = $this->parseUrl($url);
<add>
<add> return array_merge(
<add> $config,
<add> $this->getPrimaryOptions($parsedUrl),
<add> $this->getQueryOptions($parsedUrl)
<add> );
<add> }
<add>
<add> /**
<add> * Get the primary database connection options.
<add> *
<add> * @param array $url
<add> * @return array
<add> */
<add> protected function getPrimaryOptions($url)
<add> {
<add> return array_filter([
<add> 'driver' => $this->getDriver($url),
<add> 'database' => $this->getDatabase($url),
<add> 'host' => $url['host'] ?? null,
<add> 'port' => $url['port'] ?? null,
<add> 'username' => $url['user'] ?? null,
<add> 'password' => $url['pass'] ?? null,
<add> ], function ($value) {
<add> return ! is_null($value);
<add> });
<add> }
<add>
<add> /**
<add> * Get the database driver from the URL.
<add> *
<add> * @param array $url
<add> * @return string|null
<add> */
<add> protected function getDriver($url)
<add> {
<add> $alias = $url['scheme'] ?? null;
<add>
<add> if (! $alias) {
<add> return;
<add> }
<add>
<add> return static::$driverAliases[$alias] ?? $alias;
<add> }
<add>
<add> /**
<add> * Get the database name from the URL.
<add> *
<add> * @param array $url
<add> * @return string|null
<add> */
<add> protected function getDatabase($url)
<add> {
<add> $path = $url['path'] ?? null;
<add>
<add> return $path ? substr($path, 1) : null;
<add> }
<add>
<add> /**
<add> * Get all of the additional database options from the query string.
<add> *
<add> * @param array $url
<add> * @return array
<add> */
<add> protected function getQueryOptions($url)
<add> {
<add> $queryString = $url['query'] ?? null;
<add>
<add> if (! $queryString) {
<add> return [];
<add> }
<add>
<add> $query = [];
<add>
<add> parse_str($queryString, $query);
<add>
<add> return $this->parseStringsToNativeTypes($query);
<add> }
<add>
<add> /**
<add> * Parse the string URL to an array of components.
<add> *
<add> * @param string $url
<add> * @return array
<add> */
<add> protected function parseUrl($url)
<add> {
<add> $url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url);
<add>
<add> $parsedUrl = parse_url($url);
<add>
<add> if ($parsedUrl === false) {
<add> throw new InvalidArgumentException('The database configuration URL is malformed.');
<add> }
<add>
<add> return $this->parseStringsToNativeTypes(
<add> array_map('rawurldecode', $parsedUrl)
<add> );
<add> }
<add>
<add> /**
<add> * Convert string casted values to their native types.
<add> *
<add> * @param mixed $value
<add> * @return mixed
<add> */
<add> protected function parseStringsToNativeTypes($value)
<add> {
<add> if (is_array($value)) {
<add> return array_map([$this, 'parseStringsToNativeTypes'], $value);
<add> }
<add>
<add> if (! is_string($value)) {
<add> return $value;
<add> }
<add>
<add> $parsedValue = json_decode($value, true);
<add>
<add> if (json_last_error() === JSON_ERROR_NONE) {
<add> return $parsedValue;
<add> }
<add>
<add> return $value;
<add> }
<add>
<add> /**
<add> * Get all of the current drivers aliases.
<add> *
<add> * @return array
<add> */
<add> public static function getDriverAliases()
<add> {
<add> return static::$driverAliases;
<add> }
<add>
<add> /**
<add> * Add the given driver alias to the driver aliases array.
<add> *
<add> * @param string $alias
<add> * @param string $driver
<add> * @return void
<add> */
<add> public static function addDriverAlias($alias, $driver)
<add> {
<add> static::$driverAliases[$alias] = $driver;
<add> }
<add>}
<ide><path>tests/Support/ConfigurationUrlParserTest.php
<add><?php
<add>
<add>namespace Illuminate\Tests\Support;
<add>
<add>use Illuminate\Support\ConfigurationUrlParser;
<add>use PHPUnit\Framework\TestCase;
<add>
<add>class ConfigurationUrlParserTest extends TestCase
<add>{
<add> /**
<add> * @dataProvider databaseUrls
<add> */
<add> public function testDatabaseUrlsAreParsed($config, $expectedOutput)
<add> {
<add> $this->assertEquals($expectedOutput, (new ConfigurationUrlParser)->parseConfiguration($config));
<add> }
<add>
<add> public function testDriversAliases()
<add> {
<add> $this->assertEquals([
<add> 'mssql' => 'sqlsrv',
<add> 'mysql2' => 'mysql',
<add> 'postgres' => 'pgsql',
<add> 'postgresql' => 'pgsql',
<add> 'sqlite3' => 'sqlite',
<add> ], \Illuminate\Support\ConfigurationUrlParser::getDriverAliases());
<add>
<add> ConfigurationUrlParser::addDriverAlias('some-particular-alias', 'mysql');
<add>
<add> $this->assertEquals([
<add> 'mssql' => 'sqlsrv',
<add> 'mysql2' => 'mysql',
<add> 'postgres' => 'pgsql',
<add> 'postgresql' => 'pgsql',
<add> 'sqlite3' => 'sqlite',
<add> 'some-particular-alias' => 'mysql',
<add> ], ConfigurationUrlParser::getDriverAliases());
<add>
<add> $this->assertEquals([
<add> 'driver' => 'mysql',
<add> ], (new ConfigurationUrlParser)->parseConfiguration('some-particular-alias://null'));
<add> }
<add>
<add> public function databaseUrls()
<add> {
<add> return [
<add> 'simple URL' => [
<add> 'mysql://foo:bar@localhost/baz',
<add> [
<add> 'driver' => 'mysql',
<add> 'username' => 'foo',
<add> 'password' => 'bar',
<add> 'host' => 'localhost',
<add> 'database' => 'baz',
<add> ],
<add> ],
<add> 'simple URL with port' => [
<add> 'mysql://foo:bar@localhost:134/baz',
<add> [
<add> 'driver' => 'mysql',
<add> 'username' => 'foo',
<add> 'password' => 'bar',
<add> 'host' => 'localhost',
<add> 'port' => 134,
<add> 'database' => 'baz',
<add> ],
<add> ],
<add> 'sqlite relative URL with host' => [
<add> 'sqlite://localhost/foo/database.sqlite',
<add> [
<add> 'database' => 'foo/database.sqlite',
<add> 'driver' => 'sqlite',
<add> 'host' => 'localhost',
<add> ],
<add> ],
<add> 'sqlite absolute URL with host' => [
<add> 'sqlite://localhost//tmp/database.sqlite',
<add> [
<add> 'database' => '/tmp/database.sqlite',
<add> 'driver' => 'sqlite',
<add> 'host' => 'localhost',
<add> ],
<add> ],
<add> 'sqlite relative URL without host' => [
<add> 'sqlite:///foo/database.sqlite',
<add> [
<add> 'database' => 'foo/database.sqlite',
<add> 'driver' => 'sqlite',
<add> ],
<add> ],
<add> 'sqlite absolute URL without host' => [
<add> 'sqlite:////tmp/database.sqlite',
<add> [
<add> 'database' => '/tmp/database.sqlite',
<add> 'driver' => 'sqlite',
<add> ],
<add> ],
<add> 'sqlite memory' => [
<add> 'sqlite:///:memory:',
<add> [
<add> 'database' => ':memory:',
<add> 'driver' => 'sqlite',
<add> ],
<add> ],
<add> 'params parsed from URL override individual params' => [
<add> [
<add> 'url' => 'mysql://foo:bar@localhost/baz',
<add> 'password' => 'lulz',
<add> 'driver' => 'sqlite',
<add> ],
<add> [
<add> 'username' => 'foo',
<add> 'password' => 'bar',
<add> 'host' => 'localhost',
<add> 'database' => 'baz',
<add> 'driver' => 'mysql',
<add> ],
<add> ],
<add> 'params not parsed from URL but individual params are preserved' => [
<add> [
<add> 'url' => 'mysql://foo:bar@localhost/baz',
<add> 'port' => 134,
<add> ],
<add> [
<add> 'username' => 'foo',
<add> 'password' => 'bar',
<add> 'host' => 'localhost',
<add> 'port' => 134,
<add> 'database' => 'baz',
<add> 'driver' => 'mysql',
<add> ],
<add> ],
<add> 'query params from URL are used as extra params' => [
<add> 'url' => 'mysql://foo:bar@localhost/database?charset=UTF-8',
<add> [
<add> 'driver' => 'mysql',
<add> 'database' => 'database',
<add> 'host' => 'localhost',
<add> 'username' => 'foo',
<add> 'password' => 'bar',
<add> 'charset' => 'UTF-8',
<add> ],
<add> ],
<add> 'simple URL with driver set apart' => [
<add> [
<add> 'url' => '//foo:bar@localhost/baz',
<add> 'driver' => 'sqlsrv',
<add> ],
<add> [
<add> 'username' => 'foo',
<add> 'password' => 'bar',
<add> 'host' => 'localhost',
<add> 'database' => 'baz',
<add> 'driver' => 'sqlsrv',
<add> ],
<add> ],
<add> 'simple URL with percent encoding' => [
<add> 'mysql://foo%3A:bar%2F@localhost/baz+baz%40',
<add> [
<add> 'username' => 'foo:',
<add> 'password' => 'bar/',
<add> 'host' => 'localhost',
<add> 'database' => 'baz+baz@',
<add> 'driver' => 'mysql',
<add> ],
<add> ],
<add> 'simple URL with percent sign in password' => [
<add> 'mysql://foo:bar%25bar@localhost/baz',
<add> [
<add> 'username' => 'foo',
<add> 'password' => 'bar%bar',
<add> 'host' => 'localhost',
<add> 'database' => 'baz',
<add> 'driver' => 'mysql',
<add> ],
<add> ],
<add> 'URL with mssql alias driver' => [
<add> 'mssql://null',
<add> [
<add> 'driver' => 'sqlsrv',
<add> ],
<add> ],
<add> 'URL with sqlsrv alias driver' => [
<add> 'sqlsrv://null',
<add> [
<add> 'driver' => 'sqlsrv',
<add> ],
<add> ],
<add> 'URL with mysql alias driver' => [
<add> 'mysql://null',
<add> [
<add> 'driver' => 'mysql',
<add> ],
<add> ],
<add> 'URL with mysql2 alias driver' => [
<add> 'mysql2://null',
<add> [
<add> 'driver' => 'mysql',
<add> ],
<add> ],
<add> 'URL with postgres alias driver' => [
<add> 'postgres://null',
<add> [
<add> 'driver' => 'pgsql',
<add> ],
<add> ],
<add> 'URL with postgresql alias driver' => [
<add> 'postgresql://null',
<add> [
<add> 'driver' => 'pgsql',
<add> ],
<add> ],
<add> 'URL with pgsql alias driver' => [
<add> 'pgsql://null',
<add> [
<add> 'driver' => 'pgsql',
<add> ],
<add> ],
<add> 'URL with sqlite alias driver' => [
<add> 'sqlite://null',
<add> [
<add> 'driver' => 'sqlite',
<add> ],
<add> ],
<add> 'URL with sqlite3 alias driver' => [
<add> 'sqlite3://null',
<add> [
<add> 'driver' => 'sqlite',
<add> ],
<add> ],
<add>
<add> 'URL with unknown driver' => [
<add> 'foo://null',
<add> [
<add> 'driver' => 'foo',
<add> ],
<add> ],
<add> 'Sqlite with foreign_key_constraints' => [
<add> 'sqlite:////absolute/path/to/database.sqlite?foreign_key_constraints=true',
<add> [
<add> 'driver' => 'sqlite',
<add> 'database' => '/absolute/path/to/database.sqlite',
<add> 'foreign_key_constraints' => true,
<add> ],
<add> ],
<add>
<add> 'Most complex example with read and write subarrays all in string' => [
<add> 'mysql://root:@null/database?read[host][]=192.168.1.1&write[host][]=196.168.1.2&sticky=true&charset=utf8mb4&collation=utf8mb4_unicode_ci&prefix=',
<add> [
<add> 'read' => [
<add> 'host' => ['192.168.1.1'],
<add> ],
<add> 'write' => [
<add> 'host' => ['196.168.1.2'],
<add> ],
<add> 'sticky' => true,
<add> 'driver' => 'mysql',
<add> 'database' => 'database',
<add> 'username' => 'root',
<add> 'password' => '',
<add> 'charset' => 'utf8mb4',
<add> 'collation' => 'utf8mb4_unicode_ci',
<add> 'prefix' => '',
<add> ],
<add> ],
<add>
<add> 'Full example from doc that prove that there isn\'t any Breaking Change' => [
<add> [
<add> 'driver' => 'mysql',
<add> 'host' => '127.0.0.1',
<add> 'port' => '3306',
<add> 'database' => 'forge',
<add> 'username' => 'forge',
<add> 'password' => '',
<add> 'unix_socket' => '',
<add> 'charset' => 'utf8mb4',
<add> 'collation' => 'utf8mb4_unicode_ci',
<add> 'prefix' => '',
<add> 'prefix_indexes' => true,
<add> 'strict' => true,
<add> 'engine' => null,
<add> 'options' => ['foo' => 'bar'],
<add> ],
<add> [
<add> 'driver' => 'mysql',
<add> 'host' => '127.0.0.1',
<add> 'port' => '3306',
<add> 'database' => 'forge',
<add> 'username' => 'forge',
<add> 'password' => '',
<add> 'unix_socket' => '',
<add> 'charset' => 'utf8mb4',
<add> 'collation' => 'utf8mb4_unicode_ci',
<add> 'prefix' => '',
<add> 'prefix_indexes' => true,
<add> 'strict' => true,
<add> 'engine' => null,
<add> 'options' => ['foo' => 'bar'],
<add> ],
<add> ],
<add>
<add> 'Full example from doc with url overwriting parameters' => [
<add> [
<add> 'url' => 'mysql://root:pass@db/local',
<add> 'driver' => 'mysql',
<add> 'host' => '127.0.0.1',
<add> 'port' => '3306',
<add> 'database' => 'forge',
<add> 'username' => 'forge',
<add> 'password' => '',
<add> 'unix_socket' => '',
<add> 'charset' => 'utf8mb4',
<add> 'collation' => 'utf8mb4_unicode_ci',
<add> 'prefix' => '',
<add> 'prefix_indexes' => true,
<add> 'strict' => true,
<add> 'engine' => null,
<add> 'options' => ['foo' => 'bar'],
<add> ],
<add> [
<add> 'driver' => 'mysql',
<add> 'host' => 'db',
<add> 'port' => '3306',
<add> 'database' => 'local',
<add> 'username' => 'root',
<add> 'password' => 'pass',
<add> 'unix_socket' => '',
<add> 'charset' => 'utf8mb4',
<add> 'collation' => 'utf8mb4_unicode_ci',
<add> 'prefix' => '',
<add> 'prefix_indexes' => true,
<add> 'strict' => true,
<add> 'engine' => null,
<add> 'options' => ['foo' => 'bar'],
<add> ],
<add> ],
<add> 'Redis Example' => [
<add> [
<add> // Coming directly from Heroku documentation
<add> 'url' => 'redis://h:asdfqwer1234asdf@ec2-111-1-1-1.compute-1.amazonaws.com:111',
<add> 'host' => '127.0.0.1',
<add> 'password' => null,
<add> 'port' => 6379,
<add> 'database' => 0,
<add> ],
<add> [
<add> 'driver' => 'redis',
<add> 'host' => 'ec2-111-1-1-1.compute-1.amazonaws.com',
<add> 'port' => 111,
<add> 'database' => 0,
<add> 'username' => 'h',
<add> 'password' => 'asdfqwer1234asdf',
<add> ],
<add> ],
<add> ];
<add> }
<add>} | 3 |
Javascript | Javascript | fix comma splice | 2013db23d3d75dc9a50caebe5a07d793d4fd8258 | <ide><path>src/vendor/core/invariant.js
<ide> function invariant(condition) {
<ide> if (!condition) {
<ide> var error = new Error(
<del> 'Minified exception occured, use the non-minified dev environment for ' +
<add> 'Minified exception occured; use the non-minified dev environment for ' +
<ide> 'the full error message and additional helpful warnings.'
<ide> );
<ide> error.framesToPop = 1; | 1 |
Javascript | Javascript | float patch on npm to fix citgm | a85b48cbd37e4c0b1cf2f99f2e9f7d30d7fa34cf | <ide><path>deps/npm/lib/view.js
<ide> function printData (data, name, cb) {
<ide> log.disableProgress()
<ide>
<ide> // print directly to stdout to not unnecessarily add blank lines
<del> process.stdout.write(msg)
<del>
<del> cb(null, data)
<add> process.stdout.write(msg, () => cb(null, data))
<ide> }
<ide> function cleanup (data) {
<ide> if (Array.isArray(data)) { | 1 |
Javascript | Javascript | remove unused variables | ef6b83956d5869b1a6b076b60f13940138ac8358 | <ide><path>packages/ember-testing/lib/helpers.js
<ide> function find(app, selector, context) {
<ide> }
<ide>
<ide> function wait(app, value) {
<del> var promise, obj = {}, helperName;
<add> var promise;
<ide>
<ide> promise = Ember.Test.promise(function(resolve) {
<ide> if (++countAsync === 1) {
<ide><path>packages/ember-testing/lib/test.js
<ide> Ember.Test = {
<ide> chained: false
<ide> };
<ide> thenable.then = function(onSuccess, onFailure) {
<del> var self = this, thenPromise, nextPromise;
<add> var thenPromise, nextPromise;
<ide> thenable.chained = true;
<ide> thenPromise = promise.then(onSuccess, onFailure);
<ide> // this is to ensure all downstream fulfillment | 2 |
PHP | PHP | apply fixes from styleci | 4c9557734ae70a20b3af0fdd69a9dc392b61fab4 | <ide><path>src/Illuminate/View/Component.php
<ide> public function __toString()
<ide> {
<ide> return (string) $this->__invoke();
<ide> }
<add>
<ide> };
<ide> }
<ide> | 1 |
Javascript | Javascript | fix style of filter links | 211f324058ab6f9a66c8ea5fc0ecc39fd7b96e91 | <ide><path>examples/todomvc/components/Footer.js
<ide> class Footer extends Component {
<ide>
<ide> return (
<ide> <a className={classnames({ selected: filter === selectedFilter })}
<del> style={{ cursor: 'hand' }}
<add> style={{ cursor: 'pointer' }}
<ide> onClick={() => onShow(filter)}>
<ide> {title}
<ide> </a> | 1 |
Python | Python | prepare 1.0.8 release | d0659327bd2d70e47d8608ea9a48a9b9f4cd4a3d | <ide><path>keras/__init__.py
<ide> from . import optimizers
<ide> from . import regularizers
<ide>
<del>__version__ = '1.0.7'
<add>__version__ = '1.0.8'
<ide><path>setup.py
<ide>
<ide>
<ide> setup(name='Keras',
<del> version='1.0.7',
<add> version='1.0.8',
<ide> description='Deep Learning for Python',
<ide> author='Francois Chollet',
<ide> author_email='francois.chollet@gmail.com',
<ide> url='https://github.com/fchollet/keras',
<del> download_url='https://github.com/fchollet/keras/tarball/1.0.7',
<add> download_url='https://github.com/fchollet/keras/tarball/1.0.8',
<ide> license='MIT',
<ide> install_requires=['theano', 'pyyaml', 'six'],
<ide> extras_require={ | 2 |
PHP | PHP | add description for `@method` annotations | c6e2f8182fdda1537f030e7553179a93cbf3c3f2 | <ide><path>src/Console/Shell.php
<ide> * Is the equivalent of Cake\Controller\Controller on the command line.
<ide> *
<ide> * @deprecated 3.6.0 ShellDispatcher and Shell will be removed in 5.0
<del> * @method int|bool|null|void main(...$args)
<add> * @method int|bool|null|void main(...$args) Main entry method for the shell.
<ide> */
<ide> class Shell
<ide> {
<ide><path>src/Core/Exception/Exception.php
<ide> /**
<ide> * Base class that all CakePHP Exceptions extend.
<ide> *
<del> * @method int getCode()
<add> * @method int getCode() Gets the Exception code.
<ide> */
<ide> class Exception extends RuntimeException
<ide> {
<ide><path>src/Datasource/ConnectionInterface.php
<ide> * This interface defines the methods you can depend on in
<ide> * a connection.
<ide> *
<del> * @method object getDriver() Gets the driver instance.
<del> * @method $this setLogger($logger) Set the current logger.
<del> * @method bool supportsDynamicConstraints()
<del> * @method \Cake\Database\Schema\Collection getSchemaCollection()
<del> * @method \Cake\Database\Query newQuery()
<del> * @method \Cake\Database\StatementInterface prepare($sql)
<del> * @method \Cake\Database\StatementInterface execute($query, $params = [], array $types = [])
<del> * @method \Cake\Database\StatementInterface query(string $sql)
<add> * @method object getDriver() Gets the driver instance. {@see \Cake\Database\Connnection::getDriver()}
<add> * @method $this setLogger($logger) Set the current logger. {@see \Cake\Database\Connnection::setLogger()}
<add> * @method bool supportsDynamicConstraints() Returns whether the driver supports adding or dropping constraints to
<add> * already created tables. {@see \Cake\Database\Connnection::supportsDynamicConstraints()}
<add> * @method \Cake\Database\Schema\Collection getSchemaCollection() Gets a Schema\Collection object for this connection.
<add> * {@see \Cake\Database\Connnection::getSchemaCollection()}
<add> * @method \Cake\Database\Query newQuery() Create a new Query instance for this connection.
<add> * {@see \Cake\Database\Connnection::newQuery()}
<add> * @method \Cake\Database\StatementInterface prepare($sql) Prepares a SQL statement to be executed.
<add> * {@see \Cake\Database\Connnection::prepare()}
<add> * @method \Cake\Database\StatementInterface execute($query, $params = [], array $types = []) Executes a query using
<add> * `$params` for interpolating values and $types as a hint for each those params.
<add> * {@see \Cake\Database\Connnection::execute()}
<add> * @method \Cake\Database\StatementInterface query(string $sql) Executes a SQL statement and returns the Statement
<add> * object as result. {@see \Cake\Database\Connnection::query()}
<ide> */
<ide> interface ConnectionInterface extends LoggerAwareInterface
<ide> {
<ide><path>src/Datasource/QueryInterface.php
<ide> /**
<ide> * The basis for every query object
<ide> *
<del> * @method $this andWhere($conditions, array $types = [])
<del> * @method \Cake\Datasource\EntityInterface|array firstOrFail()
<add> * @method $this andWhere($conditions, array $types = []) Connects any previously defined set of conditions to the
<add> * provided list using the AND operator. {@see \Cake\Database\Query::andWhere()}
<add> * @method \Cake\Datasource\EntityInterface|array firstOrFail() Get the first result from the executing query or raise an exception.
<add> * {@see \Cake\Database\Query::firstOrFail()}
<ide> */
<ide> interface QueryInterface
<ide> {
<ide><path>src/Mailer/Mailer.php
<ide> * Our mailer could either be registered in the application bootstrap, or
<ide> * in the Table class' initialize() hook.
<ide> *
<del> * @method $this setTo($email, $name = null)
<del> * @method array getTo()
<del> * @method $this setFrom($email, $name = null)
<del> * @method array getFrom()
<del> * @method $this setSender($email, $name = null)
<del> * @method array getSender()
<del> * @method $this setReplyTo($email, $name = null)
<del> * @method array getReplyTo()
<del> * @method $this setReadReceipt($email, $name = null)
<del> * @method array getReadReceipt()
<del> * @method $this setReturnPath($email, $name = null)
<del> * @method array getReturnPath()
<del> * @method $this addTo($email, $name = null)
<del> * @method $this setCc($email, $name = null)
<del> * @method array getCc()
<del> * @method $this addCc($email, $name = null)
<del> * @method $this setBcc($email, $name = null)
<del> * @method array getBcc()
<del> * @method $this addBcc($email, $name = null)
<del> * @method $this setCharset($charset)
<del> * @method string getCharset()
<del> * @method $this setHeaderCharset($charset)
<del> * @method string getHeaderCharset()
<del> * @method $this setSubject($subject)
<del> * @method string getSubject()
<del> * @method $this setHeaders(array $headers)
<del> * @method $this addHeaders(array $headers)
<del> * @method $this getHeaders(array $include = [])
<del> * @method $this setEmailFormat($format)
<del> * @method string getEmailFormat()
<del> * @method $this setMessageId($message)
<del> * @method bool|string getMessageId()
<del> * @method $this setDomain($domain)
<del> * @method string getDomain()
<del> * @method $this setAttachments($attachments)
<del> * @method array getAttachments()
<del> * @method $this addAttachments($attachments)
<del> * @method string|array getBody(?string $type = null)
<add> * @method $this setTo($email, $name = null) Sets "to" address. {@see \Cake\Mailer\Message::setTo()}
<add> * @method array getTo() Gets "to" address. {@see \Cake\Mailer\Message::getTo()}
<add> * @method $this setFrom($email, $name = null) Sets "from" address. {@see \Cake\Mailer\Message::setFrom()}
<add> * @method array getFrom() Gets "from" address. {@see \Cake\Mailer\Message::getFrom()}
<add> * @method $this setSender($email, $name = null) Sets "sender" address. {@see \Cake\Mailer\Message::setSender()}
<add> * @method array getSender() Gets "sender" address. {@see \Cake\Mailer\Message::getSender()}
<add> * @method $this setReplyTo($email, $name = null) Sets "Reply-To" address. {@see \Cake\Mailer\Message::setReplyTo()}
<add> * @method array getReplyTo() Gets "Reply-To" address. {@see \Cake\Mailer\Message::getReplyTo()}
<add> * @method $this setReadReceipt($email, $name = null) Sets Read Receipt (Disposition-Notification-To header).
<add> * {@see \Cake\Mailer\Message::setReadReceipt()}
<add> * @method array getReadReceipt() Gets Read Receipt (Disposition-Notification-To header).
<add> * {@see \Cake\Mailer\Message::getReadReceipt()}
<add> * @method $this setReturnPath($email, $name = null) Sets return path. {@see \Cake\Mailer\Message::setReturnPath()}
<add> * @method array getReturnPath() Gets return path. {@see \Cake\Mailer\Message::getReturnPath()}
<add> * @method $this addTo($email, $name = null) Add "To" address. {@see \Cake\Mailer\Message::addTo()}
<add> * @method $this setCc($email, $name = null) Sets "cc" address. {@see \Cake\Mailer\Message::setCc()}
<add> * @method array getCc() Gets "cc" address. {@see \Cake\Mailer\Message::getCc()}
<add> * @method $this addCc($email, $name = null) Add "cc" address. {@see \Cake\Mailer\Message::addCc()}
<add> * @method $this setBcc($email, $name = null) Sets "bcc" address. {@see \Cake\Mailer\Message::setBcc()}
<add> * @method array getBcc() Gets "bcc" address. {@see \Cake\Mailer\Message::getBcc()}
<add> * @method $this addBcc($email, $name = null) Add "bcc" address. {@see \Cake\Mailer\Message::addBcc()}
<add> * @method $this setCharset($charset) Charset setter. {@see \Cake\Mailer\Message::setCharset()}
<add> * @method string getCharset() Charset getter. {@see \Cake\Mailer\Message::getCharset()}
<add> * @method $this setHeaderCharset($charset) HeaderCharset setter. {@see \Cake\Mailer\Message::setHeaderCharset()}
<add> * @method string getHeaderCharset() HeaderCharset getter. {@see \Cake\Mailer\Message::getHeaderCharset()}
<add> * @method $this setSubject($subject) Sets subject. {@see \Cake\Mailer\Message::setSubject()}
<add> * @method string getSubject() Gets subject. {@see \Cake\Mailer\Message::getSubject()}
<add> * @method $this setHeaders(array $headers) Sets headers for the message. {@see \Cake\Mailer\Message::setHeaders()}
<add> * @method $this addHeaders(array $headers) Add header for the message. {@see \Cake\Mailer\Message::addHeaders()}
<add> * @method $this getHeaders(array $include = []) Get list of headers. {@see \Cake\Mailer\Message::getHeaders()}
<add> * @method $this setEmailFormat($format) Sets email format. {@see \Cake\Mailer\Message::getHeaders()}
<add> * @method string getEmailFormat() Gets email format. {@see \Cake\Mailer\Message::getEmailFormat()}
<add> * @method $this setMessageId($message) Sets message ID. {@see \Cake\Mailer\Message::setMessageId()}
<add> * @method bool|string getMessageId() Gets message ID. {@see \Cake\Mailer\Message::getMessageId()}
<add> * @method $this setDomain($domain) Sets domain. {@see \Cake\Mailer\Message::setDomain()}
<add> * @method string getDomain() Gets domain. {@see \Cake\Mailer\Message::getDomain()}
<add> * @method $this setAttachments($attachments) Add attachments to the email message. {@see \Cake\Mailer\Message::setAttachments()}
<add> * @method array getAttachments() Gets attachments to the email message. {@see \Cake\Mailer\Message::getAttachments()}
<add> * @method $this addAttachments($attachments) Add attachments. {@see \Cake\Mailer\Message::addAttachments()}
<add> * @method string|array getBody(?string $type = null) Get generated message body as array.
<add> * {@see \Cake\Mailer\Message::getBody()}
<ide> */
<ide> class Mailer implements EventListenerInterface
<ide> {
<ide><path>src/Mailer/Message.php
<ide> public function getReadReceipt(): array
<ide> }
<ide>
<ide> /**
<del> * Return Path
<add> * Sets return path.
<ide> *
<ide> * @param string|array $email String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> public function getTo(): array
<ide> }
<ide>
<ide> /**
<del> * Add To
<add> * Add "To" address.
<ide> *
<ide> * @param string|array $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> public function getCc(): array
<ide> }
<ide>
<ide> /**
<del> * Add Cc
<add> * Add "cc" address.
<ide> *
<ide> * @param string|array $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide> public function getBcc(): array
<ide> }
<ide>
<ide> /**
<del> * Add Bcc
<add> * Add "bcc" address.
<ide> *
<ide> * @param string|array $email Null to get, String with email,
<ide> * Array with email as key, name as value or email as value (without name)
<ide><path>src/View/Helper/FormHelper.php
<ide> *
<ide> * Automatic generation of HTML FORMs from given data.
<ide> *
<del> * @method string text(string $fieldName, array $options = [])
<del> * @method string number(string $fieldName, array $options = [])
<del> * @method string email(string $fieldName, array $options = [])
<del> * @method string password(string $fieldName, array $options = [])
<del> * @method string search(string $fieldName, array $options = [])
<add> * @method string text(string $fieldName, array $options = []) Creates input of type text.
<add> * @method string number(string $fieldName, array $options = []) Creates input of type number.
<add> * @method string email(string $fieldName, array $options = []) Creates input of type email.
<add> * @method string password(string $fieldName, array $options = []) Creates input of type password.
<add> * @method string search(string $fieldName, array $options = []) Creates input of type search.
<ide> * @property \Cake\View\Helper\HtmlHelper $Html
<ide> * @property \Cake\View\Helper\UrlHelper $Url
<ide> * @link https://book.cakephp.org/4/en/views/helpers/form.html | 7 |
Go | Go | add more locking to storage drivers | fc1cf1911bb92def95f407364372992d57b11ca2 | <ide><path>daemon/graphdriver/aufs/aufs.go
<ide> import (
<ide> "github.com/docker/docker/pkg/chrootarchive"
<ide> "github.com/docker/docker/pkg/directory"
<ide> "github.com/docker/docker/pkg/idtools"
<add> "github.com/docker/docker/pkg/locker"
<ide> mountpk "github.com/docker/docker/pkg/mount"
<ide>
<ide> "github.com/opencontainers/runc/libcontainer/label"
<ide> type Driver struct {
<ide> pathCacheLock sync.Mutex
<ide> pathCache map[string]string
<ide> naiveDiff graphdriver.DiffDriver
<add> locker *locker.Locker
<ide> }
<ide>
<ide> // Init returns a new AUFS driver.
<ide> func Init(root string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
<ide> gidMaps: gidMaps,
<ide> pathCache: make(map[string]string),
<ide> ctr: graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicAufs)),
<add> locker: locker.New(),
<ide> }
<ide>
<ide> rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
<ide> func debugEBusy(mountPath string) (out []string, err error) {
<ide>
<ide> // Remove will unmount and remove the given id.
<ide> func (a *Driver) Remove(id string) error {
<add> a.locker.Lock(id)
<add> defer a.locker.Unlock(id)
<ide> a.pathCacheLock.Lock()
<ide> mountpoint, exists := a.pathCache[id]
<ide> a.pathCacheLock.Unlock()
<ide> func (a *Driver) Remove(id string) error {
<ide> // Get returns the rootfs path for the id.
<ide> // This will mount the dir at its given path
<ide> func (a *Driver) Get(id, mountLabel string) (string, error) {
<add> a.locker.Lock(id)
<add> defer a.locker.Unlock(id)
<ide> parents, err := a.getParentLayerPaths(id)
<ide> if err != nil && !os.IsNotExist(err) {
<ide> return "", err
<ide> func (a *Driver) Get(id, mountLabel string) (string, error) {
<ide>
<ide> // Put unmounts and updates list of active mounts.
<ide> func (a *Driver) Put(id string) error {
<add> a.locker.Lock(id)
<add> defer a.locker.Unlock(id)
<ide> a.pathCacheLock.Lock()
<ide> m, exists := a.pathCache[id]
<ide> if !exists {
<ide><path>daemon/graphdriver/devmapper/driver.go
<ide> import (
<ide> "github.com/docker/docker/daemon/graphdriver"
<ide> "github.com/docker/docker/pkg/devicemapper"
<ide> "github.com/docker/docker/pkg/idtools"
<add> "github.com/docker/docker/pkg/locker"
<ide> "github.com/docker/docker/pkg/mount"
<del> "github.com/docker/go-units"
<add> units "github.com/docker/go-units"
<ide> )
<ide>
<ide> func init() {
<ide> type Driver struct {
<ide> uidMaps []idtools.IDMap
<ide> gidMaps []idtools.IDMap
<ide> ctr *graphdriver.RefCounter
<add> locker *locker.Locker
<ide> }
<ide>
<ide> // Init creates a driver with the given home and the set of options.
<ide> func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
<ide> uidMaps: uidMaps,
<ide> gidMaps: gidMaps,
<ide> ctr: graphdriver.NewRefCounter(graphdriver.NewDefaultChecker()),
<add> locker: locker.New(),
<ide> }
<ide>
<ide> return graphdriver.NewNaiveDiffDriver(d, uidMaps, gidMaps), nil
<ide> func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
<ide>
<ide> // Remove removes a device with a given id, unmounts the filesystem.
<ide> func (d *Driver) Remove(id string) error {
<add> d.locker.Lock(id)
<add> defer d.locker.Unlock(id)
<ide> if !d.DeviceSet.HasDevice(id) {
<ide> // Consider removing a non-existing device a no-op
<ide> // This is useful to be able to progress on container removal
<ide> func (d *Driver) Remove(id string) error {
<ide>
<ide> // Get mounts a device with given id into the root filesystem
<ide> func (d *Driver) Get(id, mountLabel string) (string, error) {
<add> d.locker.Lock(id)
<add> defer d.locker.Unlock(id)
<ide> mp := path.Join(d.home, "mnt", id)
<ide> rootFs := path.Join(mp, "rootfs")
<ide> if count := d.ctr.Increment(mp); count > 1 {
<ide> func (d *Driver) Get(id, mountLabel string) (string, error) {
<ide>
<ide> // Put unmounts a device and removes it.
<ide> func (d *Driver) Put(id string) error {
<add> d.locker.Lock(id)
<add> defer d.locker.Unlock(id)
<ide> mp := path.Join(d.home, "mnt", id)
<ide> if count := d.ctr.Decrement(mp); count > 0 {
<ide> return nil
<ide><path>daemon/graphdriver/overlay/overlay.go
<ide> import (
<ide> "github.com/docker/docker/pkg/archive"
<ide> "github.com/docker/docker/pkg/fsutils"
<ide> "github.com/docker/docker/pkg/idtools"
<add> "github.com/docker/docker/pkg/locker"
<ide> "github.com/docker/docker/pkg/mount"
<ide> "github.com/opencontainers/runc/libcontainer/label"
<ide> )
<ide> type Driver struct {
<ide> gidMaps []idtools.IDMap
<ide> ctr *graphdriver.RefCounter
<ide> supportsDType bool
<add> locker *locker.Locker
<ide> }
<ide>
<ide> func init() {
<ide> func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
<ide> gidMaps: gidMaps,
<ide> ctr: graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicOverlay)),
<ide> supportsDType: supportsDType,
<add> locker: locker.New(),
<ide> }
<ide>
<ide> return NaiveDiffDriverWithApply(d, uidMaps, gidMaps), nil
<ide> func (d *Driver) dir(id string) string {
<ide>
<ide> // Remove cleans the directories that are created for this id.
<ide> func (d *Driver) Remove(id string) error {
<add> d.locker.Lock(id)
<add> defer d.locker.Unlock(id)
<ide> if err := os.RemoveAll(d.dir(id)); err != nil && !os.IsNotExist(err) {
<ide> return err
<ide> }
<ide> func (d *Driver) Remove(id string) error {
<ide>
<ide> // Get creates and mounts the required file system for the given id and returns the mount path.
<ide> func (d *Driver) Get(id string, mountLabel string) (s string, err error) {
<add> d.locker.Lock(id)
<add> defer d.locker.Unlock(id)
<ide> dir := d.dir(id)
<ide> if _, err := os.Stat(dir); err != nil {
<ide> return "", err
<ide> func (d *Driver) Get(id string, mountLabel string) (s string, err error) {
<ide>
<ide> // Put unmounts the mount path created for the give id.
<ide> func (d *Driver) Put(id string) error {
<add> d.locker.Lock(id)
<add> defer d.locker.Unlock(id)
<ide> // If id has a root, just return
<ide> if _, err := os.Stat(path.Join(d.dir(id), "root")); err == nil {
<ide> return nil
<ide><path>daemon/graphdriver/overlay2/overlay.go
<ide> import (
<ide> "github.com/docker/docker/pkg/directory"
<ide> "github.com/docker/docker/pkg/fsutils"
<ide> "github.com/docker/docker/pkg/idtools"
<add> "github.com/docker/docker/pkg/locker"
<ide> "github.com/docker/docker/pkg/mount"
<ide> "github.com/docker/docker/pkg/parsers"
<ide> "github.com/docker/docker/pkg/parsers/kernel"
<ide> type Driver struct {
<ide> options overlayOptions
<ide> naiveDiff graphdriver.DiffDriver
<ide> supportsDType bool
<add> locker *locker.Locker
<ide> }
<ide>
<ide> var (
<ide> func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
<ide> gidMaps: gidMaps,
<ide> ctr: graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicOverlay)),
<ide> supportsDType: supportsDType,
<add> locker: locker.New(),
<ide> }
<ide>
<ide> d.naiveDiff = graphdriver.NewNaiveDiffDriver(d, uidMaps, gidMaps)
<ide> func (d *Driver) getLowerDirs(id string) ([]string, error) {
<ide>
<ide> // Remove cleans the directories that are created for this id.
<ide> func (d *Driver) Remove(id string) error {
<add> d.locker.Lock(id)
<add> defer d.locker.Unlock(id)
<ide> dir := d.dir(id)
<ide> lid, err := ioutil.ReadFile(path.Join(dir, "link"))
<ide> if err == nil {
<ide> func (d *Driver) Remove(id string) error {
<ide>
<ide> // Get creates and mounts the required file system for the given id and returns the mount path.
<ide> func (d *Driver) Get(id string, mountLabel string) (s string, err error) {
<add> d.locker.Lock(id)
<add> defer d.locker.Unlock(id)
<ide> dir := d.dir(id)
<ide> if _, err := os.Stat(dir); err != nil {
<ide> return "", err
<ide> func (d *Driver) Get(id string, mountLabel string) (s string, err error) {
<ide>
<ide> // Put unmounts the mount path created for the give id.
<ide> func (d *Driver) Put(id string) error {
<add> d.locker.Lock(id)
<add> defer d.locker.Unlock(id)
<ide> dir := d.dir(id)
<ide> _, err := ioutil.ReadFile(path.Join(dir, lowerFile))
<ide> if err != nil { | 4 |
Go | Go | skip testbuildemptycmd on rs1 | 45da1274421ba7484dcf2bf1a398f9e3683600d1 | <ide><path>integration-cli/docker_cli_build_test.go
<ide> func (s *DockerSuite) TestBuildClearCmd(c *check.C) {
<ide> }
<ide>
<ide> func (s *DockerSuite) TestBuildEmptyCmd(c *check.C) {
<add> // Windows Server 2016 RS1 builds load the windowsservercore image from a tar rather than
<add> // a .WIM file, and the tar layer has the default CMD set (same as the Linux ubuntu image),
<add> // where-as the TP5 .WIM had a blank CMD. Hence this test is not applicable on RS1 or later
<add> // builds
<add> if daemonPlatform == "windows" && windowsDaemonKV >= 14375 {
<add> c.Skip("Not applicable on Windows RS1 or later builds")
<add> }
<add>
<ide> name := "testbuildemptycmd"
<ide> if _, err := buildImage(name, "FROM "+minimalBaseImage()+"\nMAINTAINER quux\n", true); err != nil {
<ide> c.Fatal(err) | 1 |
Text | Text | remove old whitespace doc warning | 6f305505a79732a212e425078efcd28f908985d3 | <ide><path>docs/docs/02.2-jsx-gotchas.md
<ide> JSX looks like HTML but there are some important differences you may run into.
<ide> >
<ide> > For DOM differences, such as the inline `style` attribute, check [here](/react/docs/dom-differences.html).
<ide>
<del>## Whitespace Removal
<del>
<del>JSX doesn't follow the same whitespace elimination rules as HTML. JSX removes all whitespace between two curly braces expressions. If you want to have whitespace, simply add `{' '}`.
<del>
<del>```javascript
<del><div>{this.props.name} {' '} {this.props.surname}</div>
<del>```
<del>
<del>Follow [Issue #65](https://github.com/facebook/react/issues/65) for discussion on this behavior.
<del>
<del>
<ide> ## HTML Entities
<ide>
<ide> You can insert HTML entities within literal text in JSX: | 1 |
Go | Go | fix selinux errors caused by multi-threading | 12934ef3a40d814cb307dfea0cc86124ec997593 | <ide><path>pkg/selinux/selinux.go
<ide> func Setfilecon(path string, scon string) error {
<ide> }
<ide>
<ide> func Setfscreatecon(scon string) error {
<del> return writeCon("/proc/self/attr/fscreate", scon)
<add> return writeCon(fmt.Sprintf("/proc/self/task/%d/attr/fscreate", system.Gettid()), scon)
<ide> }
<ide>
<ide> func Getfscreatecon() (string, error) {
<del> return readCon("/proc/self/attr/fscreate")
<add> return readCon(fmt.Sprintf("/proc/self/task/%d/attr/fscreate", system.Gettid()))
<ide> }
<ide>
<ide> func getcon() (string, error) {
<del> return readCon("/proc/self/attr/current")
<add> return readCon(fmt.Sprintf("/proc/self/task/%d/attr/current", system.Gettid()))
<ide> }
<ide>
<ide> func Getpidcon(pid int) (string, error) { | 1 |
Ruby | Ruby | push the node->ar cache up one level | e6dfff2af515a7610e54fcfdb374d6eafc026c0a | <ide><path>activerecord/lib/active_record/associations/join_dependency.rb
<ide> def columns
<ide> end
<ide>
<ide> def instantiate(result_set)
<del> parents = {}
<del>
<ide> primary_key = join_root.aliased_primary_key
<ide> type_caster = result_set.column_type primary_key
<ide>
<ide> def instantiate(result_set)
<ide> }
<ide> }
<ide>
<add> model_cache = Hash.new { |h,klass| h[klass] = {} }
<add> parents = model_cache[join_root]
<add>
<ide> result_set.each { |row_hash|
<ide> primary_id = type_caster.type_cast row_hash[primary_key]
<ide> parent = parents[primary_id] ||= join_root.instantiate(row_hash)
<del> construct(parent, join_root, row_hash, result_set, seen)
<add> construct(parent, join_root, row_hash, result_set, seen, model_cache)
<ide> }
<ide>
<ide> parents.values
<ide> def build_join_association(reflection, parent, join_type)
<ide> node
<ide> end
<ide>
<del> def construct(ar_parent, parent, row, rs, seen)
<add> def construct(ar_parent, parent, row, rs, seen, model_cache)
<ide> primary_id = ar_parent.id
<ide>
<ide> parent.children.each do |node|
<ide> def construct(ar_parent, parent, row, rs, seen)
<ide> else
<ide> if ar_parent.association_cache.key?(node.reflection.name)
<ide> model = ar_parent.association(node.reflection.name).target
<del> construct(model, node, row, rs, seen)
<add> construct(model, node, row, rs, seen, model_cache)
<ide> next
<ide> end
<ide> end
<ide> def construct(ar_parent, parent, row, rs, seen)
<ide> model = seen[parent.base_klass][primary_id][node.base_klass][id]
<ide>
<ide> if model
<del> construct(model, node, row, rs, seen)
<add> construct(model, node, row, rs, seen, model_cache)
<ide> else
<del> model = construct_model(ar_parent, node, row)
<add> model = construct_model(ar_parent, node, row, model_cache, id)
<ide> seen[parent.base_klass][primary_id][node.base_klass][id] = model
<del> construct(model, node, row, rs, seen)
<add> construct(model, node, row, rs, seen, model_cache)
<ide> end
<ide> end
<ide> end
<ide>
<del> def construct_model(record, node, row)
<del> model = node.instantiate(row)
<add> def construct_model(record, node, row, model_cache, id)
<add> model = model_cache[node][id] ||= node.instantiate(row)
<ide> other = record.association(node.reflection.name)
<ide>
<ide> if node.reflection.collection?
<ide><path>activerecord/lib/active_record/associations/join_dependency/join_part.rb
<ide> class JoinPart # :nodoc:
<ide>
<ide> def initialize(base_klass)
<ide> @base_klass = base_klass
<del> @cached_record = {}
<ide> @column_names_with_alias = nil
<ide> @children = []
<ide> end
<ide> def extract_record(row)
<ide> hash
<ide> end
<ide>
<del> def record_id(row)
<del> row[aliased_primary_key]
<del> end
<del>
<ide> def instantiate(row)
<del> @cached_record[record_id(row)] ||= base_klass.instantiate(extract_record(row))
<add> base_klass.instantiate(extract_record(row))
<ide> end
<ide> end
<ide> end | 2 |
PHP | PHP | add test for new relative-path option | cef07d3c3c6be6cd6357e58f3f8926463645304c | <ide><path>tests/TestCase/Shell/Task/ExtractTaskTest.php
<ide> public function testExtractWithExclude()
<ide> $pattern = '/\#: .*default\.ctp:\d+\n/';
<ide> $this->assertNotRegExp($pattern, $result);
<ide> }
<add>
<ide> /**
<ide> * testExtractWithoutLocations method
<ide> *
<ide> public function testExtractCore()
<ide> $pattern = '/#: Test\//';
<ide> $this->assertNotRegExp($pattern, $result);
<ide> }
<add>
<add> /**
<add> * test relative-paths option
<add> *
<add> * @return void
<add> */
<add> public function testExtractWithRelativePaths()
<add> {
<add> $this->Task->interactive = false;
<add>
<add> $this->Task->params['paths'] = TEST_APP . 'TestApp/Template';
<add> $this->Task->params['output'] = $this->path . DS;
<add> $this->Task->params['extract-core'] = 'no';
<add> $this->Task->params['relative-paths'] = true;
<add>
<add> $this->Task->method('in')
<add> ->will($this->returnValue('y'));
<add>
<add> $this->Task->main();
<add> $this->assertFileExists($this->path . DS . 'default.pot');
<add> $result = file_get_contents($this->path . DS . 'default.pot');
<add>
<add> $expected = '#: ./tests/test_app/TestApp/Template/Pages/extract.ctp:';
<add> $this->assertContains($expected, $result);
<add> }
<ide> } | 1 |
Ruby | Ruby | treat single c operations in memorystore as atomic | fbc6129acd9ecb6b7435931b472d3226985ba4c4 | <ide><path>activesupport/lib/active_support/cache/memory_store.rb
<ide> def fetch(key, options = {})
<ide> end
<ide>
<ide> def read(name, options = nil)
<del> @mutex.synchronize do
<del> super
<del> @data[name]
<del> end
<add> super
<add> @data[name]
<ide> end
<ide>
<ide> def write(name, value, options = nil)
<del> @mutex.synchronize do
<del> super
<del> @data[name] = value
<del> end
<add> super
<add> @data[name] = value
<ide> end
<ide>
<ide> def delete(name, options = nil)
<del> @mutex.synchronize do
<del> super
<del> @data.delete(name)
<del> end
<add> @data.delete(name)
<ide> end
<ide>
<ide> def delete_matched(matcher, options = nil)
<del> @mutex.synchronize do
<del> super
<del> @data.delete_if { |k,v| k =~ matcher }
<del> end
<add> @data.delete_if { |k,v| k =~ matcher }
<ide> end
<ide>
<ide> def exist?(name,options = nil)
<del> @mutex.synchronize do
<del> super
<del> @data.has_key?(name)
<del> end
<add> @data.has_key?(name)
<ide> end
<ide>
<ide> def increment(key, amount = 1)
<ide> def decrement(key, amount = 1)
<ide> end
<ide>
<ide> def clear
<del> @mutex.synchronize do
<del> @data.clear
<del> end
<add> @data.clear
<ide> end
<ide> end
<ide> end | 1 |
Text | Text | add redbubble link to airflow merch | 558be73ae808b551a8ccf59a5c1896b5718f2f44 | <ide><path>README.md
<ide> Use Airflow to author workflows as directed acyclic graphs (DAGs) of tasks. The
<ide> - [Who uses Apache Airflow?](#who-uses-apache-airflow)
<ide> - [Who Maintains Apache Airflow?](#who-maintains-apache-airflow)
<ide> - [Can I use the Apache Airflow logo in my presentation?](#can-i-use-the-apache-airflow-logo-in-my-presentation)
<add>- [Airflow merchandise](#airflow-merchandise)
<ide> - [Links](#links)
<ide>
<ide> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
<ide> If you would like to become a maintainer, please review the Apache Airflow
<ide>
<ide> Yes! Be sure to abide by the Apache Foundation [trademark policies](https://www.apache.org/foundation/marks/#books) and the Apache Airflow [Brandbook](https://cwiki.apache.org/confluence/display/AIRFLOW/Brandbook). The most up to date logos are found in [this repo](/docs/img/logos) and on the Apache Software Foundation [website](https://www.apache.org/logos/about.html).
<ide>
<add>## Airflow merchandise
<add>
<add>If you would love to have Apache Airflow stickers, t-shirt etc. then check out
<add>[Redbubble Shop](https://www.redbubble.com/i/sticker/Apache-Airflow-by-comdev/40497530.EJUG5).
<add>
<ide> ## Links
<ide>
<ide> - [Documentation](https://airflow.apache.org/docs/stable/) | 1 |
Ruby | Ruby | remove `name` from `establish_connection` | 779ccf8a0e6a8bf7bb362c30dac4a340599ab113 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
<ide> def connection_pool_list
<ide> end
<ide> alias :connection_pools :connection_pool_list
<ide>
<del> def establish_connection(spec_or_config, name: "primary")
<del> if spec_or_config.is_a?(ConnectionSpecification)
<del> spec = spec_or_config
<del> else
<del> resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(ActiveRecord::Base.configurations)
<del> spec = resolver.spec(spec_or_config, name)
<del> end
<add> def establish_connection(config)
<add> resolver = ConnectionSpecification::Resolver.new(Base.configurations)
<add> spec = resolver.spec(config)
<ide>
<ide> remove_connection(spec.name)
<ide> owner_to_pool[spec.name] = ConnectionAdapters::ConnectionPool.new(spec)
<ide> def clear_all_connections!
<ide> # for (not necessarily the current class).
<ide> def retrieve_connection(spec_name) #:nodoc:
<ide> pool = retrieve_connection_pool(spec_name)
<del> raise ConnectionNotEstablished, "No connection pool with id #{spec_name} found." unless pool
<add> raise ConnectionNotEstablished, "No connection pool with id '#{spec_name}' found." unless pool
<ide> conn = pool.connection
<del> raise ConnectionNotEstablished, "No connection for #{spec_name} in connection pool" unless conn
<add> raise ConnectionNotEstablished, "No connection for '#{spec_name}' in connection pool" unless conn
<ide> conn
<ide> end
<ide>
<ide> def retrieve_connection_pool(spec_name)
<ide> # A connection was established in an ancestor process that must have
<ide> # subsequently forked. We can't reuse the connection, but we can copy
<ide> # the specification and establish a new connection with it.
<del> establish_connection(ancestor_pool.spec).tap do |pool|
<add> spec = ancestor_pool.spec
<add> establish_connection(spec.config.merge("name" => spec.name)).tap do |pool|
<ide> pool.schema_cache = ancestor_pool.schema_cache if ancestor_pool.schema_cache
<ide> end
<ide> else
<ide><path>activerecord/lib/active_record/connection_adapters/connection_specification.rb
<ide> def resolve_all
<ide> # spec.config
<ide> # # => { "host" => "localhost", "database" => "foo", "adapter" => "sqlite3" }
<ide> #
<del> def spec(config, name = nil)
<add> def spec(config)
<ide> spec = resolve(config).symbolize_keys
<ide>
<ide> raise(AdapterNotSpecified, "database configuration does not specify adapter") unless spec.key?(:adapter)
<ide> def spec(config, name = nil)
<ide> raise AdapterNotFound, "database configuration specifies nonexistent #{spec.config[:adapter]} adapter"
<ide> end
<ide>
<del> name ||=
<del> if config.is_a?(Symbol)
<del> config.to_s
<del> else
<del> "primary"
<del> end
<del> ConnectionSpecification.new(name, spec, adapter_method)
<add> ConnectionSpecification.new(spec.delete(:name) || "primary", spec, adapter_method)
<ide> end
<ide>
<ide> private
<ide> def resolve_connection(spec)
<ide> #
<ide> def resolve_symbol_connection(spec)
<ide> if config = configurations[spec.to_s]
<del> resolve_connection(config)
<add> resolve_connection(config).merge("name" => spec.to_s)
<ide> else
<ide> raise(AdapterNotSpecified, "'#{spec}' database is not configured. Available: #{configurations.keys.inspect}")
<ide> end
<ide><path>activerecord/lib/active_record/connection_handling.rb
<ide> def establish_connection(config = nil)
<ide> config ||= DEFAULT_ENV.call.to_sym
<ide> spec_name = self == Base ? "primary" : name
<ide> self.connection_specification_name = spec_name
<del> connection_handler.establish_connection(config, name: spec_name)
<add>
<add> resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(Base.configurations)
<add> spec = resolver.resolve(config).symbolize_keys
<add> spec[:name] = spec_name
<add>
<add> connection_handler.establish_connection(spec)
<ide> end
<ide>
<ide> class MergeAndResolveDefaultUrlConfig # :nodoc:
<ide><path>activerecord/lib/active_record/tasks/database_tasks.rb
<ide> def create_all
<ide> old_pool = ActiveRecord::Base.connection_handler.retrieve_connection_pool(ActiveRecord::Base.connection_specification_name)
<ide> each_local_configuration { |configuration| create configuration }
<ide> if old_pool
<del> ActiveRecord::Base.connection_handler.establish_connection(old_pool.spec)
<add> ActiveRecord::Base.connection_handler.establish_connection(old_pool.spec.config.merge("name" => old_pool.spec.name))
<ide> end
<ide> end
<ide>
<ide><path>activerecord/test/cases/connection_adapters/connection_handler_test.rb
<ide> module ConnectionAdapters
<ide> class ConnectionHandlerTest < ActiveRecord::TestCase
<ide> def setup
<ide> @handler = ConnectionHandler.new
<del> resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new Base.configurations
<ide> @spec_name = "primary"
<del> @pool = @handler.establish_connection(resolver.spec(:arunit, @spec_name))
<add> @pool = @handler.establish_connection(ActiveRecord::Base.configurations['arunit'])
<ide> end
<ide>
<ide> def test_establish_connection_uses_spec_name
<ide> config = {"readonly" => {"adapter" => 'sqlite3'}}
<ide> resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(config)
<ide> spec = resolver.spec(:readonly)
<del> @handler.establish_connection(spec)
<add> @handler.establish_connection(spec.config.merge("name" => spec.name))
<ide>
<ide> assert_not_nil @handler.retrieve_connection_pool('readonly')
<ide> ensure
<ide><path>activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb
<ide> def test_resolver_with_database_uri_and_current_env_symbol_key
<ide> ENV['DATABASE_URL'] = "postgres://localhost/foo"
<ide> config = { "not_production" => { "adapter" => "not_postgres", "database" => "not_foo" } }
<ide> actual = resolve_spec(:default_env, config)
<del> expected = { "adapter"=>"postgresql", "database"=>"foo", "host"=>"localhost" }
<add> expected = { "adapter"=>"postgresql", "database"=>"foo", "host"=>"localhost", "name"=>"default_env" }
<ide> assert_equal expected, actual
<ide> end
<ide>
<ide> def test_resolver_with_database_uri_and_current_env_symbol_key_and_rails_env
<ide>
<ide> config = { "not_production" => { "adapter" => "not_postgres", "database" => "not_foo" } }
<ide> actual = resolve_spec(:foo, config)
<del> expected = { "adapter" => "postgresql", "database" => "foo", "host" => "localhost" }
<add> expected = { "adapter" => "postgresql", "database" => "foo", "host" => "localhost","name"=>"foo" }
<ide> assert_equal expected, actual
<ide> end
<ide>
<ide> def test_resolver_with_database_uri_and_current_env_symbol_key_and_rack_env
<ide>
<ide> config = { "not_production" => { "adapter" => "not_postgres", "database" => "not_foo" } }
<ide> actual = resolve_spec(:foo, config)
<del> expected = { "adapter" => "postgresql", "database" => "foo", "host" => "localhost" }
<add> expected = { "adapter" => "postgresql", "database" => "foo", "host" => "localhost","name"=>"foo" }
<ide> assert_equal expected, actual
<ide> end
<ide>
<ide> def test_resolver_with_database_uri_and_known_key
<ide> ENV['DATABASE_URL'] = "postgres://localhost/foo"
<ide> config = { "production" => { "adapter" => "not_postgres", "database" => "not_foo", "host" => "localhost" } }
<ide> actual = resolve_spec(:production, config)
<del> expected = { "adapter"=>"not_postgres", "database"=>"not_foo", "host"=>"localhost" }
<add> expected = { "adapter"=>"not_postgres", "database"=>"not_foo", "host"=>"localhost", "name"=>"production" }
<ide> assert_equal expected, actual
<ide> end
<ide>
<ide> def test_url_with_hyphenated_scheme
<ide> ENV['DATABASE_URL'] = "ibm-db://localhost/foo"
<ide> config = { "default_env" => { "adapter" => "not_postgres", "database" => "not_foo", "host" => "localhost" } }
<ide> actual = resolve_spec(:default_env, config)
<del> expected = { "adapter"=>"ibm_db", "database"=>"foo", "host"=>"localhost" }
<add> expected = { "adapter"=>"ibm_db", "database"=>"foo", "host"=>"localhost", "name"=>"default_env" }
<ide> assert_equal expected, actual
<ide> end
<ide>
<ide><path>activerecord/test/cases/connection_specification/resolver_test.rb
<ide> def test_url_from_environment
<ide> assert_equal({
<ide> "adapter" => "abstract",
<ide> "host" => "foo",
<del> "encoding" => "utf8" }, spec)
<add> "encoding" => "utf8",
<add> "name" => "production"}, spec)
<ide> end
<ide>
<ide> def test_url_sub_key
<ide> spec = resolve :production, 'production' => {"url" => 'abstract://foo?encoding=utf8'}
<ide> assert_equal({
<ide> "adapter" => "abstract",
<ide> "host" => "foo",
<del> "encoding" => "utf8" }, spec)
<add> "encoding" => "utf8",
<add> "name" => "production"}, spec)
<ide> end
<ide>
<ide> def test_url_sub_key_merges_correctly
<ide> def test_url_sub_key_merges_correctly
<ide> "adapter" => "abstract",
<ide> "host" => "foo",
<ide> "encoding" => "utf8",
<del> "pool" => "3" }, spec)
<add> "pool" => "3",
<add> "name" => "production"}, spec)
<ide> end
<ide>
<ide> def test_url_host_no_db
<ide> def test_url_sub_key_for_sqlite3
<ide> assert_equal({
<ide> "adapter" => "sqlite3",
<ide> "database" => "foo",
<del> "encoding" => "utf8" }, spec)
<add> "encoding" => "utf8",
<add> "name" => "production"}, spec)
<ide> end
<ide>
<ide> def test_spec_name_on_key_lookup | 7 |
Ruby | Ruby | save another array allocation | a929b4d4c59551189b8162f30b061c6ed5755bd5 | <ide><path>activerecord/lib/active_record/relation/query_methods.rb
<ide> def order!(*args) # :nodoc:
<ide> arg
<ide> }
<ide>
<del> self.order_values = args + self.order_values
<add> self.order_values = args.concat self.order_values
<ide> self
<ide> end
<ide> | 1 |
Text | Text | remove extra space between two sentences | 43a42542e6316ceb3124abd225ec7f61a635103b | <ide><path>guides/source/configuring.md
<ide> The schema dumper adds one additional configuration option:
<ide>
<ide> * `config.action_controller.per_form_csrf_tokens` configures whether CSRF tokens are only valid for the method/action they were generated for.
<ide>
<del>* `config.action_controller.default_protect_from_forgery` determines whether forgery protection is added on `ActionController:Base`. This is false by default, but enabled when loading defaults for Rails 5.2.
<add>* `config.action_controller.default_protect_from_forgery` determines whether forgery protection is added on `ActionController:Base`. This is false by default, but enabled when loading defaults for Rails 5.2.
<ide>
<ide> * `config.action_controller.relative_url_root` can be used to tell Rails that you are [deploying to a subdirectory](configuring.html#deploy-to-a-subdirectory-relative-url-root). The default is `ENV['RAILS_RELATIVE_URL_ROOT']`.
<ide> | 1 |
Java | Java | set mocksessioncookieconfig#maxage default to -1 | 83beb9d57d558d1386c194b7792c88134105dfa4 | <ide><path>spring-test/src/main/java/org/springframework/mock/web/MockSessionCookieConfig.java
<ide> /*
<del> * Copyright 2002-2013 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public class MockSessionCookieConfig implements SessionCookieConfig {
<ide>
<ide> private boolean secure;
<ide>
<del> private int maxAge;
<add> private int maxAge = -1;
<ide>
<ide>
<ide> @Override
<ide><path>spring-web/src/test/java/org/springframework/mock/web/test/MockSessionCookieConfig.java
<ide> /*
<del> * Copyright 2002-2013 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public class MockSessionCookieConfig implements SessionCookieConfig {
<ide>
<ide> private boolean secure;
<ide>
<del> private int maxAge;
<add> private int maxAge = -1;
<ide>
<ide>
<ide> @Override | 2 |
Javascript | Javascript | fix prettier lint | 22553427d4bdba0f511d887bb05f00811ecc05bc | <ide><path>test/Compiler.test.js
<ide> describe("Compiler", () => {
<ide> });
<ide> });
<ide> });
<del> it('should flag watchMode as true in watch', function(done) {
<add> it("should flag watchMode as true in watch", function(done) {
<ide> const compiler = webpack({
<ide> context: __dirname,
<ide> mode: "production",
<ide> describe("Compiler", () => {
<ide> });
<ide>
<ide> compiler.outputFileSystem = new MemoryFs();
<del> compiler.watch({}, (err) => {
<add> compiler.watch({}, err => {
<ide> if (err) return done(err);
<del> expect(compiler.watchMode).toBeTruthy();
<del> done();
<add> expect(compiler.watchMode).toBeTruthy();
<add> done();
<ide> });
<del> });
<add> });
<ide> it("should use cache on second run call", function(done) {
<ide> const compiler = webpack({
<ide> context: __dirname, | 1 |
Go | Go | hide dots on daemon startup when loglevel != info | 88dc6cc2dfcc538f433c98c18652a5c84b0769d9 | <ide><path>daemon/daemon.go
<ide> func (daemon *Daemon) restore() error {
<ide> for _, v := range dir {
<ide> id := v.Name()
<ide> container, err := daemon.load(id)
<del> if !debug {
<add> if !debug && log.GetLevel() == log.InfoLevel {
<ide> fmt.Print(".")
<ide> }
<ide> if err != nil {
<ide> func (daemon *Daemon) restore() error {
<ide>
<ide> if entities := daemon.containerGraph.List("/", -1); entities != nil {
<ide> for _, p := range entities.Paths() {
<del> if !debug {
<add> if !debug && log.GetLevel() == log.InfoLevel {
<ide> fmt.Print(".")
<ide> }
<ide>
<ide> func (daemon *Daemon) restore() error {
<ide> }
<ide>
<ide> if !debug {
<del> fmt.Println()
<add> if log.GetLevel() == log.InfoLevel {
<add> fmt.Println()
<add> }
<ide> log.Infof("Loading containers: done.")
<ide> }
<ide>
<ide><path>integration-cli/docker_cli_daemon_test.go
<ide> func TestDaemonLoggingDriverNoneLogsError(t *testing.T) {
<ide> }
<ide> logDone("daemon - logs not available for non-json-file drivers")
<ide> }
<add>
<add>func TestDaemonDots(t *testing.T) {
<add> defer deleteAllContainers()
<add> d := NewDaemon(t)
<add> if err := d.StartWithBusybox(); err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> // Now create 4 containers
<add> if _, err := d.Cmd("create", "busybox"); err != nil {
<add> t.Fatalf("Error creating container: %q", err)
<add> }
<add> if _, err := d.Cmd("create", "busybox"); err != nil {
<add> t.Fatalf("Error creating container: %q", err)
<add> }
<add> if _, err := d.Cmd("create", "busybox"); err != nil {
<add> t.Fatalf("Error creating container: %q", err)
<add> }
<add> if _, err := d.Cmd("create", "busybox"); err != nil {
<add> t.Fatalf("Error creating container: %q", err)
<add> }
<add>
<add> d.Stop()
<add>
<add> d.Start("--log-level=debug")
<add> d.Stop()
<add> content, _ := ioutil.ReadFile(d.logFile.Name())
<add> if strings.Contains(string(content), "....") {
<add> t.Fatalf("Debug level should not have ....\n%s", string(content))
<add> }
<add>
<add> d.Start("--log-level=error")
<add> d.Stop()
<add> content, _ = ioutil.ReadFile(d.logFile.Name())
<add> if strings.Contains(string(content), "....") {
<add> t.Fatalf("Error level should not have ....\n%s", string(content))
<add> }
<add>
<add> d.Start("--log-level=info")
<add> d.Stop()
<add> content, _ = ioutil.ReadFile(d.logFile.Name())
<add> if !strings.Contains(string(content), "....") {
<add> t.Fatalf("Info level should have ....\n%s", string(content))
<add> }
<add>
<add> logDone("daemon - test dots on INFO")
<add>} | 2 |
PHP | PHP | apply fixes from styleci | 7b39e0825ce3c837e1cae6be6e821ce22cad3efd | <ide><path>src/Illuminate/Support/Str.php
<ide> protected static function charsArray()
<ide> '7' => ['⁷', '₇', '۷', '7'],
<ide> '8' => ['⁸', '₈', '۸', '8'],
<ide> '9' => ['⁹', '₉', '۹', '9'],
<del> 'a' => ['à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ', 'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'ā', 'ą', 'å', 'α', 'ά', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ', 'ἇ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ὰ', 'ά', 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'а', 'أ', 'အ', 'ာ', 'ါ', 'ǻ', 'ǎ', 'ª', 'ა', 'अ', 'ا', 'a', 'ä','א'],
<del> 'b' => ['б', 'β', 'ب', 'ဗ', 'ბ', 'b','ב'],
<add> 'a' => ['à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ', 'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'ā', 'ą', 'å', 'α', 'ά', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ', 'ἇ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ὰ', 'ά', 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'а', 'أ', 'အ', 'ာ', 'ါ', 'ǻ', 'ǎ', 'ª', 'ა', 'अ', 'ا', 'a', 'ä', 'א'],
<add> 'b' => ['б', 'β', 'ب', 'ဗ', 'ბ', 'b', 'ב'],
<ide> 'c' => ['ç', 'ć', 'č', 'ĉ', 'ċ', 'c'],
<ide> 'd' => ['ď', 'ð', 'đ', 'ƌ', 'ȡ', 'ɖ', 'ɗ', 'ᵭ', 'ᶁ', 'ᶑ', 'д', 'δ', 'د', 'ض', 'ဍ', 'ဒ', 'დ', 'd', 'ד'],
<ide> 'e' => ['é', 'è', 'ẻ', 'ẽ', 'ẹ', 'ê', 'ế', 'ề', 'ể', 'ễ', 'ệ', 'ë', 'ē', 'ę', 'ě', 'ĕ', 'ė', 'ε', 'έ', 'ἐ', 'ἑ', 'ἒ', 'ἓ', 'ἔ', 'ἕ', 'ὲ', 'έ', 'е', 'ё', 'э', 'є', 'ə', 'ဧ', 'ေ', 'ဲ', 'ე', 'ए', 'إ', 'ئ', 'e'],
<ide> 'f' => ['ф', 'φ', 'ف', 'ƒ', 'ფ', 'f', 'פ', 'ף'],
<del> 'g' => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ဂ', 'გ', 'گ', 'g','ג'],
<add> 'g' => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ဂ', 'გ', 'گ', 'g', 'ג'],
<ide> 'h' => ['ĥ', 'ħ', 'η', 'ή', 'ح', 'ه', 'ဟ', 'ှ', 'ჰ', 'h', 'ה'],
<del> 'i' => ['í', 'ì', 'ỉ', 'ĩ', 'ị', 'î', 'ï', 'ī', 'ĭ', 'į', 'ı', 'ι', 'ί', 'ϊ', 'ΐ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ', 'ἵ', 'ἶ', 'ἷ', 'ὶ', 'ί', 'ῐ', 'ῑ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'і', 'ї', 'и', 'ဣ', 'ိ', 'ီ', 'ည်', 'ǐ', 'ი', 'इ', 'ی', 'i','י'],
<add> 'i' => ['í', 'ì', 'ỉ', 'ĩ', 'ị', 'î', 'ï', 'ī', 'ĭ', 'į', 'ı', 'ι', 'ί', 'ϊ', 'ΐ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ', 'ἵ', 'ἶ', 'ἷ', 'ὶ', 'ί', 'ῐ', 'ῑ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'і', 'ї', 'и', 'ဣ', 'ိ', 'ီ', 'ည်', 'ǐ', 'ი', 'इ', 'ی', 'i', 'י'],
<ide> 'j' => ['ĵ', 'ј', 'Ј', 'ჯ', 'ج', 'j'],
<ide> 'k' => ['ķ', 'ĸ', 'к', 'κ', 'Ķ', 'ق', 'ك', 'က', 'კ', 'ქ', 'ک', 'k', 'ק'],
<ide> 'l' => ['ł', 'ľ', 'ĺ', 'ļ', 'ŀ', 'л', 'λ', 'ل', 'လ', 'ლ', 'l', 'ל'],
<del> 'm' => ['м', 'μ', 'م', 'မ', 'მ', 'm', 'מ' , 'ם'],
<add> 'm' => ['м', 'μ', 'م', 'မ', 'მ', 'm', 'מ', 'ם'],
<ide> 'n' => ['ñ', 'ń', 'ň', 'ņ', 'ʼn', 'ŋ', 'ν', 'н', 'ن', 'န', 'ნ', 'n', 'נ'],
<ide> 'o' => ['ó', 'ò', 'ỏ', 'õ', 'ọ', 'ô', 'ố', 'ồ', 'ổ', 'ỗ', 'ộ', 'ơ', 'ớ', 'ờ', 'ở', 'ỡ', 'ợ', 'ø', 'ō', 'ő', 'ŏ', 'ο', 'ὀ', 'ὁ', 'ὂ', 'ὃ', 'ὄ', 'ὅ', 'ὸ', 'ό', 'о', 'و', 'ို', 'ǒ', 'ǿ', 'º', 'ო', 'ओ', 'o', 'ö'],
<ide> 'p' => ['п', 'π', 'ပ', 'პ', 'پ', 'p', 'פ', 'ף'],
<ide> protected static function languageSpecificCharsArray($language)
<ide> ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'],
<ide> ],
<ide> 'he' => [
<del> ['א','ב','ג','ד','ה','ו'],
<del> ['ז','ח','ט','י','כ','ל'],
<del> ['מ','נ','ס','ע','פ','צ'],
<del> ['ק','ר','ש','ת','ן','ץ','ך','ם', 'ף'],
<add> ['א', 'ב', 'ג', 'ד', 'ה', 'ו'],
<add> ['ז', 'ח', 'ט', 'י', 'כ', 'ל'],
<add> ['מ', 'נ', 'ס', 'ע', 'פ', 'צ'],
<add> ['ק', 'ר', 'ש', 'ת', 'ן', 'ץ', 'ך', 'ם', 'ף'],
<ide> ],
<ide> 'ro' => [
<ide> ['ă', 'â', 'î', 'ș', 'ț', 'Ă', 'Â', 'Î', 'Ș', 'Ț'], | 1 |
Javascript | Javascript | fix increasing delay with multistep hmr | 991ec20881bfe22cf1a32fa790cce9aaeb5c733c | <ide><path>lib/HotModuleReplacementPlugin.js
<ide> module.exports = class HotModuleReplacementPlugin {
<ide> const requestTimeout = this.requestTimeout;
<ide> const hotUpdateChunkFilename = compiler.options.output.hotUpdateChunkFilename;
<ide> const hotUpdateMainFilename = compiler.options.output.hotUpdateMainFilename;
<add> compiler.plugin("additional-pass", callback => {
<add> if(multiStep)
<add> return setTimeout(callback, fullBuildTimeout);
<add> return callback();
<add> });
<ide> compiler.plugin("compilation", (compilation, params) => {
<ide> const hotUpdateChunkTemplate = compilation.hotUpdateChunkTemplate;
<ide> if(!hotUpdateChunkTemplate) return;
<ide> module.exports = class HotModuleReplacementPlugin {
<ide> if(multiStep && !recompilation && !initialPass)
<ide> return true;
<ide> });
<del> compiler.plugin("additional-pass", callback => {
<del> if(multiStep)
<del> return setTimeout(callback, fullBuildTimeout);
<del> return callback();
<del> });
<ide> compilation.plugin("additional-chunk-assets", function() {
<ide> const records = this.records;
<ide> if(records.hash === this.hash) return; | 1 |
Ruby | Ruby | add tests for uninstall_* and zap stanzas | 917c138eeb4af0cee212f94edc425512dfbade99 | <ide><path>Library/Homebrew/test/cask/audit_spec.rb
<ide> def include_msg?(messages, msg)
<ide> end
<ide> end
<ide>
<add> describe "preflight stanza checks" do
<add> let(:error_msg) { "only a single preflight stanza is allowed" }
<add>
<add> context "when the cask has no preflight stanza" do
<add> let(:cask_token) { "with-zap-rmdir" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has only one preflight stanza" do
<add> let(:cask_token) { "with-preflight" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has multiple preflight stanzas" do
<add> let(:cask_token) { "with-preflight-multi" }
<add> it { is_expected.to warn_with(error_msg) }
<add> end
<add> end
<add>
<add> describe "uninstall_postflight stanza checks" do
<add> let(:error_msg) { "only a single postflight stanza is allowed" }
<add>
<add> context "when the cask has no postflight stanza" do
<add> let(:cask_token) { "with-zap-rmdir" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has only one postflight stanza" do
<add> let(:cask_token) { "with-postflight" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has multiple postflight stanzas" do
<add> let(:cask_token) { "with-postflight-multi" }
<add> it { is_expected.to warn_with(error_msg) }
<add> end
<add> end
<add>
<add> describe "uninstall stanza checks" do
<add> let(:error_msg) { "only a single uninstall stanza is allowed" }
<add>
<add> context "when the cask has no uninstall stanza" do
<add> let(:cask_token) { "with-zap-rmdir" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has only one uninstall stanza" do
<add> let(:cask_token) { "with-uninstall-rmdir" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has multiple uninstall stanzas" do
<add> let(:cask_token) { "with-uninstall-multi" }
<add> it { is_expected.to warn_with(error_msg) }
<add> end
<add> end
<add>
<add> describe "uninstall_preflight stanza checks" do
<add> let(:error_msg) { "only a single uninstall_preflight stanza is allowed" }
<add>
<add> context "when the cask has no uninstall_preflight stanza" do
<add> let(:cask_token) { "with-zap-rmdir" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has only one uninstall_preflight stanza" do
<add> let(:cask_token) { "with-uninstall-preflight" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has multiple uninstall_preflight stanzas" do
<add> let(:cask_token) { "with-uninstall-preflight-multi" }
<add> it { is_expected.to warn_with(error_msg) }
<add> end
<add> end
<add>
<add> describe "uninstall_postflight stanza checks" do
<add> let(:error_msg) { "only a single uninstall_postflight stanza is allowed" }
<add>
<add> context "when the cask has no uninstall_postflight stanza" do
<add> let(:cask_token) { "with-zap-rmdir" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has only one uninstall_postflight stanza" do
<add> let(:cask_token) { "with-uninstall-postflight" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has multiple uninstall_postflight stanzas" do
<add> let(:cask_token) { "with-uninstall-postflight-multi" }
<add> it { is_expected.to warn_with(error_msg) }
<add> end
<add> end
<add>
<add> describe "zap stanza checks" do
<add> let(:error_msg) { "only a single zap stanza is allowed" }
<add>
<add> context "when the cask has no zap stanza" do
<add> let(:cask_token) { "with-uninstall-rmdir" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has only one zap stanza" do
<add> let(:cask_token) { "with-zap-rmdir" }
<add> it { should_not warn_with(error_msg) }
<add> end
<add>
<add> context "when the cask has multiple zap stanzas" do
<add> let(:cask_token) { "with-zap-multi" }
<add> it { is_expected.to warn_with(error_msg) }
<add> end
<add> end
<add>
<ide> describe "version checks" do
<ide> let(:error_msg) { "you should use version :latest instead of version 'latest'" }
<ide>
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight-multi.rb
<add>cask 'with-postflight-multi' do
<add> version '1.2.3'
<add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
<add>
<add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
<add> homepage 'http://example.com/fancy-pkg'
<add>
<add> pkg 'MyFancyPkg/Fancy.pkg'
<add>
<add> postflight do end
<add>
<add> postflight do end
<add>end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight.rb
<add>cask 'with-postflight' do
<add> version '1.2.3'
<add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
<add>
<add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
<add> homepage 'http://example.com/fancy-pkg'
<add>
<add> pkg 'MyFancyPkg/Fancy.pkg'
<add>
<add> postflight do end
<add>end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight-multi.rb
<add>cask 'with-preflight-multi' do
<add> version '1.2.3'
<add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
<add>
<add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
<add> homepage 'http://example.com/fancy-pkg'
<add>
<add> pkg 'MyFancyPkg/Fancy.pkg'
<add>
<add> preflight do end
<add>
<add> preflight do end
<add>end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight.rb
<add>cask 'with-preflight' do
<add> version '1.2.3'
<add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
<add>
<add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
<add> homepage 'http://example.com/fancy-pkg'
<add>
<add> pkg 'MyFancyPkg/Fancy.pkg'
<add>
<add> preflight do end
<add>end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-multi.rb
<add>cask 'with-uninstall-multi' do
<add> version '1.2.3'
<add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
<add>
<add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
<add> homepage 'http://example.com/fancy-pkg'
<add>
<add> pkg 'MyFancyPkg/Fancy.pkg'
<add>
<add> uninstall rmdir: "#{TEST_TMPDIR}/empty_directory_path"
<add>
<add> uninstall delete: "#{TEST_TMPDIR}/empty_directory_path"
<add>end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight-multi.rb
<add>cask 'with-uninstall-postflight-multi' do
<add> version '1.2.3'
<add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
<add>
<add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
<add> homepage 'http://example.com/fancy-pkg'
<add>
<add> pkg 'MyFancyPkg/Fancy.pkg'
<add>
<add> uninstall_postflight do end
<add>
<add> uninstall_postflight do end
<add>end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight.rb
<add>cask 'with-uninstall-postflight' do
<add> version '1.2.3'
<add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
<add>
<add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
<add> homepage 'http://example.com/fancy-pkg'
<add>
<add> pkg 'MyFancyPkg/Fancy.pkg'
<add>
<add> uninstall_postflight do end
<add>end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight-multi.rb
<add>cask 'with-uninstall-preflight-multi' do
<add> version '1.2.3'
<add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
<add>
<add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
<add> homepage 'http://example.com/fancy-pkg'
<add>
<add> pkg 'MyFancyPkg/Fancy.pkg'
<add>
<add> uninstall_preflight do end
<add>
<add> uninstall_preflight do end
<add>end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight.rb
<add>cask 'with-uninstall-preflight' do
<add> version '1.2.3'
<add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
<add>
<add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
<add> homepage 'http://example.com/fancy-pkg'
<add>
<add> pkg 'MyFancyPkg/Fancy.pkg'
<add>
<add> uninstall_preflight do end
<add>end
<ide><path>Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-multi.rb
<add>cask 'with-zap-multi' do
<add> version '1.2.3'
<add> sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
<add>
<add> url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
<add> homepage 'http://example.com/fancy-pkg'
<add>
<add> pkg 'MyFancyPkg/Fancy.pkg'
<add>
<add> zap rmdir: "#{TEST_TMPDIR}/empty_directory_path"
<add>
<add> zap delete: "#{TEST_TMPDIR}/empty_directory_path"
<add>end | 11 |
Javascript | Javascript | call callbacks from setstate in component context | f1231e60b0fda262cb617cd73a56d1e5bdbf0778 | <ide><path>src/core/ReactUpdates.js
<ide> function batchedUpdates(callback) {
<ide> component.performUpdateIfNecessary();
<ide> if (callbacks) {
<ide> for (var j = 0; j < callbacks.length; j++) {
<del> callbacks[j]();
<add> callbacks[j].call(component);
<ide> }
<ide> }
<ide> }
<ide><path>src/core/__tests__/ReactUpdates-test.js
<ide> describe('ReactUpdates', function() {
<ide> ReactUpdates.batchedUpdates(function() {
<ide> instance.setState({x: 1}, function() {
<ide> instance.setState({x: 2}, function() {
<add> expect(this).toBe(instance);
<ide> innerCallbackRun = true;
<ide> expect(instance.state.x).toBe(2);
<ide> expect(updateCount).toBe(2); | 2 |
Text | Text | add the rctnetwork to the podfile | 56ac2a45d71443764f0aff8fcd9c77b88dcd44ac | <ide><path>docs/IntegrationWithExistingApps.md
<ide> target 'NumberTileGame' do
<ide> pod 'React', :path => '../node_modules/react-native', :subspecs => [
<ide> 'Core',
<ide> 'RCTText',
<add> 'RCTNetwork',
<ide> 'RCTWebSocket', # needed for debugging
<ide> # Add any other subspecs you want to use in your project
<ide> ]
<ide> target 'swift-2048' do
<ide> pod 'React', :path => '../node_modules/react-native', :subspecs => [
<ide> 'Core',
<ide> 'RCTText',
<add> 'RCTNetwork',
<ide> 'RCTWebSocket', # needed for debugging
<ide> # Add any other subspecs you want to use in your project
<ide> ] | 1 |
Javascript | Javascript | simplify getpath code to use split(".") | 0b8cd8dbe42da615d965ae29ac29011600ead61a | <ide><path>packages/ember-metal/lib/accessors.js
<ide> Ember.set = set;
<ide> // PATHS
<ide> //
<ide>
<del>// assumes normalized input; no *, normalized path, always a target...
<ide> /** @private */
<ide> function getPath(target, path) {
<del> var len = path.length, idx, next, key;
<del>
<del> idx = 0;
<del> while(target && idx<len) {
<del> next = path.indexOf('.', idx);
<del> if (next<0) next = len;
<del> key = path.slice(idx, next);
<del> target = get(target, key);
<del>
<add> var parts = path.split(".");
<add> for (var i=0, l=parts.length; target && i<l; i++) {
<add> target = get(target, parts[i]);
<ide> if (target && target.isDestroyed) { return undefined; }
<del>
<del> idx = next+1;
<ide> }
<del> return target ;
<add> return target;
<ide> }
<ide>
<ide> var TUPLE_RET = []; | 1 |
Go | Go | add logs around service records modifications | eb8c603046730529f3b4be9c1ddedc8ae38fba2f | <ide><path>libnetwork/network.go
<ide> func (n *network) addSvcRecords(name string, epIP net.IP, epIPv6 net.IP, ipMapUp
<ide> return
<ide> }
<ide>
<add> logrus.Debugf("(%s).addSvcRecords(%s, %s, %s, %t)", n.ID()[0:7], name, epIP, epIPv6, ipMapUpdate)
<add>
<ide> c := n.getController()
<ide> c.Lock()
<ide> defer c.Unlock()
<ide> func (n *network) deleteSvcRecords(name string, epIP net.IP, epIPv6 net.IP, ipMa
<ide> return
<ide> }
<ide>
<add> logrus.Debugf("(%s).deleteSvcRecords(%s, %s, %s, %t)", n.ID()[0:7], name, epIP, epIPv6, ipMapUpdate)
<add>
<ide> c := n.getController()
<ide> c.Lock()
<ide> defer c.Unlock() | 1 |
Text | Text | add v3.22.0-beta.5 to changelog | 7fd407c2f80feb14d24a22ec762521bad563a746 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.22.0-beta.5 (September 30, 2020)
<add>
<add>- [#19172](https://github.com/emberjs/ember.js/pull/19172) [BUGFIX] Ensures that tracked properties initialize property
<add>
<ide> ### v3.22.0-beta.4 (September 30, 2020)
<ide>
<ide> - [#19138](https://github.com/emberjs/ember.js/pull/19138) [BUGFIX] Fix tag cycles in query parameters | 1 |
Javascript | Javascript | add id to inline segment script | 3ca8ce07a6c4f456cc70fe5c23b6f9f253c4d027 | <ide><path>examples/with-segment-analytics/pages/_app.js
<ide> function MyApp({ Component, pageProps }) {
<ide> return (
<ide> <Page>
<ide> {/* Inject the Segment snippet into the <head> of the document */}
<del> <Script dangerouslySetInnerHTML={{ __html: renderSnippet() }} />
<add> <Script
<add> id="segment-script"
<add> dangerouslySetInnerHTML={{ __html: renderSnippet() }}
<add> />
<ide> <Component {...pageProps} />
<ide> </Page>
<ide> ) | 1 |
Ruby | Ruby | fix indentation here | a11ddf3ee2d2db0378c241a1fd0648b74ff48e20 | <ide><path>activerecord/lib/active_record/attribute_methods/before_type_cast.rb
<ide> def attributes_before_type_cast
<ide> end
<ide>
<ide> private
<del> # Handle *_before_type_cast for method_missing.
<del> def attribute_before_type_cast(attribute_name)
<del> if attribute_name == 'id'
<del> read_attribute_before_type_cast(self.class.primary_key)
<del> else
<del> read_attribute_before_type_cast(attribute_name)
<del> end
<add>
<add> # Handle *_before_type_cast for method_missing.
<add> def attribute_before_type_cast(attribute_name)
<add> if attribute_name == 'id'
<add> read_attribute_before_type_cast(self.class.primary_key)
<add> else
<add> read_attribute_before_type_cast(attribute_name)
<ide> end
<add> end
<ide> end
<ide> end
<ide> end | 1 |
Go | Go | fix incorrect spelling in error message | f962bd06ed8824d1f75d8546b428965cd61bdf7f | <ide><path>daemon/logger/jsonfilelog/jsonfilelog.go
<ide> func New(info logger.Info) (logger.Logger, error) {
<ide> return nil, err
<ide> }
<ide> if capval <= 0 {
<del> return nil, fmt.Errorf("max-size should be a positive numbler")
<add> return nil, fmt.Errorf("max-size must be a positive number")
<ide> }
<ide> }
<ide> var maxFiles = 1 | 1 |
Go | Go | fix resolvconf logic | 35a88f2c291c882e49f7c448c1581dfdd3e35a9c | <ide><path>runtime/container.go
<ide> func (container *Container) DisableLink(name string) {
<ide> }
<ide>
<ide> func (container *Container) setupContainerDns() error {
<del> if container.ResolvConfPath == "" {
<add> if container.ResolvConfPath != "" {
<ide> return nil
<ide> }
<ide> var ( | 1 |
PHP | PHP | allow multi-line echos | 60f26afc13d943b5a2ae546307224c8178c41005 | <ide><path>src/Illuminate/View/Compilers/BladeCompiler.php
<ide> protected function compileComments($value)
<ide> */
<ide> protected function compileEchos($value)
<ide> {
<del> return preg_replace('/\{\{\s*(.+?)\s*\}\}/', '<?php echo $1; ?>', $value);
<add> return preg_replace('/\{\{\s*(.+?)\s*\}\}/s', '<?php echo $1; ?>', $value);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | fix indentation issues | 0dc6596dc2e6a0de229bff43adc28d6c514334ba | <ide><path>src/renderers/dom/client/wrappers/ReactDOMInput.js
<ide> function forceUpdateIfMounted() {
<ide> function warnIfValueIsNull(props) {
<ide> if (props != null && props.value === null && !didWarnValueNull) {
<ide> warning(
<del> false,
<del> '`value` prop on `input` should not be null. ' +
<del> 'Consider using the empty string to clear the component or' +
<del> ' `undefined` for uncontrolled components.'
<add> false,
<add> '`value` prop on `input` should not be null. ' +
<add> 'Consider using the empty string to clear the component or `undefined` ' +
<add> 'for uncontrolled components.'
<ide> );
<ide>
<ide> didWarnValueNull = true;
<ide><path>src/renderers/dom/client/wrappers/ReactDOMSelect.js
<ide> function getDeclarationErrorAddendum(owner) {
<ide> function warnIfValueIsNull(props) {
<ide> if (props != null && props.value === null && !didWarnValueNull) {
<ide> warning(
<del> false,
<del> '`value` prop on `select` should not be null. ' +
<del> 'Consider using the empty string to clear the component or' +
<del> ' `undefined` for uncontrolled components.'
<add> false,
<add> '`value` prop on `select` should not be null. ' +
<add> 'Consider using the empty string to clear the component or `undefined` ' +
<add> 'for uncontrolled components.'
<ide> );
<ide>
<ide> didWarnValueNull = true;
<ide><path>src/renderers/dom/client/wrappers/ReactDOMTextarea.js
<ide> function forceUpdateIfMounted() {
<ide> function warnIfValueIsNull(props) {
<ide> if (props != null && props.value === null && !didWarnValueNull) {
<ide> warning(
<del> false,
<del> '`value` prop on `textarea` should not be null. ' +
<del> 'Consider using the empty string to clear the component or' +
<del> ' `undefined` for uncontrolled components.'
<add> false,
<add> '`value` prop on `textarea` should not be null. ' +
<add> 'Consider using the empty string to clear the component or `undefined` ' +
<add> 'for uncontrolled components.'
<ide> );
<ide>
<ide> didWarnValueNull = true;
<ide><path>src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js
<ide> describe('ReactDOMInput', function() {
<ide> it('should throw warning message if value is null', function() {
<ide> ReactTestUtils.renderIntoDocument(<input type="text" value={null} />);
<ide> expect(console.error.argsForCall[0][0]).toContain(
<del> '`value` prop on `input` should not be null. Consider using the empty string to clear the component or'
<del> + ' `undefined` for uncontrolled components.'
<add> '`value` prop on `input` should not be null. ' +
<add> 'Consider using the empty string to clear the component or `undefined` ' +
<add> 'for uncontrolled components.'
<ide> );
<ide>
<ide> ReactTestUtils.renderIntoDocument(<input type="text" value={null} />);
<ide><path>src/renderers/dom/client/wrappers/__tests__/ReactDOMSelect-test.js
<ide> describe('ReactDOMSelect', function() {
<ide>
<ide> ReactTestUtils.renderIntoDocument(<select value={null}><option value="test"/></select>);
<ide> expect(console.error.argsForCall[0][0]).toContain(
<del> '`value` prop on `select` should not be null. Consider using the empty string to clear the component or'
<del> + ' `undefined` for uncontrolled components.'
<add> '`value` prop on `select` should not be null. ' +
<add> 'Consider using the empty string to clear the component or `undefined` ' +
<add> 'for uncontrolled components.'
<ide> );
<ide>
<ide> ReactTestUtils.renderIntoDocument(<select value={null}><option value="test"/></select>);
<ide><path>src/renderers/dom/client/wrappers/__tests__/ReactDOMTextarea-test.js
<ide> describe('ReactDOMTextarea', function() {
<ide>
<ide> ReactTestUtils.renderIntoDocument(<textarea value={null} />);
<ide> expect(console.error.argsForCall[0][0]).toContain(
<del> '`value` prop on `textarea` should not be null. Consider using the empty string to clear the component or'
<del> + ' `undefined` for uncontrolled components.'
<add> '`value` prop on `textarea` should not be null. ' +
<add> 'Consider using the empty string to clear the component or `undefined` ' +
<add> 'for uncontrolled components.'
<ide> );
<ide>
<ide> ReactTestUtils.renderIntoDocument(<textarea value={null} />); | 6 |
Javascript | Javascript | fix permanent deoptimizations | 8491c705b17b62ca7a11df0da530b6051523380f | <ide><path>lib/internal/url.js
<ide> class URL {
<ide> if (typeof depth === 'number' && depth < 0)
<ide> return opts.stylize('[Object]', 'special');
<ide>
<del> const ctor = getConstructorOf(this);
<add> var ctor = getConstructorOf(this);
<ide>
<del> const obj = Object.create({
<add> var obj = Object.create({
<ide> constructor: ctor === null ? URL : ctor
<ide> });
<ide>
<ide> class URLSearchParams {
<ide> if (typeof recurseTimes === 'number' && recurseTimes < 0)
<ide> return ctx.stylize('[Object]', 'special');
<ide>
<del> const separator = ', ';
<del> const innerOpts = Object.assign({}, ctx);
<add> var separator = ', ';
<add> var innerOpts = Object.assign({}, ctx);
<ide> if (recurseTimes !== null) {
<ide> innerOpts.depth = recurseTimes - 1;
<ide> }
<del> const innerInspect = (v) => util.inspect(v, innerOpts);
<add> var innerInspect = (v) => util.inspect(v, innerOpts);
<ide>
<del> const list = this[searchParams];
<del> const output = [];
<add> var list = this[searchParams];
<add> var output = [];
<ide> for (var i = 0; i < list.length; i += 2)
<ide> output.push(`${innerInspect(list[i])} => ${innerInspect(list[i + 1])}`);
<ide>
<del> const colorRe = /\u001b\[\d\d?m/g;
<del> const length = output.reduce(
<add> var colorRe = /\u001b\[\d\d?m/g;
<add> var length = output.reduce(
<ide> (prev, cur) => prev + cur.replace(colorRe, '').length + separator.length,
<ide> -separator.length
<ide> ); | 1 |
Text | Text | update repository list in onboarding doc | b5927439aaa7afec95612a96664efbcc5dc1d188 | <ide><path>onboarding.md
<ide> needs to be pointed out separately during the onboarding.
<ide> * <https://github.com/nodejs/TSC>
<ide> * <https://github.com/nodejs/build>
<ide> * <https://github.com/nodejs/nodejs.org>
<del> * <https://github.com/nodejs/readable-stream>
<del> * <https://github.com/nodejs/LTS>
<add> * <https://github.com/nodejs/Release>
<ide> * <https://github.com/nodejs/citgm>
<ide> * The OpenJS Foundation hosts regular summits for active contributors to the
<ide> Node.js project, where we have face-to-face discussions about our work on the | 1 |
PHP | PHP | remove some useless import. | dec6b72b690d8bc673413856bbb9b72f4f05078d | <ide><path>src/Illuminate/Mail/Mailable.php
<ide> use Symfony\Component\Mailer\Header\MetadataHeader;
<ide> use Symfony\Component\Mailer\Header\TagHeader;
<ide> use Symfony\Component\Mime\Address;
<del>use Symfony\Component\Mime\Email;
<ide>
<ide> class Mailable implements MailableContract, Renderable
<ide> { | 1 |
Java | Java | use regex comparison in websocket stats test | ea7ae8949e1b0411beddd74347e5c33123d8a91d | <ide><path>spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java
<ide> public void stompBrokerRelay() {
<ide>
<ide> String name = "webSocketMessageBrokerStats";
<ide> WebSocketMessageBrokerStats stats = this.appContext.getBean(name, WebSocketMessageBrokerStats.class);
<del> assertEquals("WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), " +
<del> "0 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], " +
<del> "stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], " +
<del> "stompBrokerRelay[0 sessions, relayhost:1234 (not available), processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], " +
<del> "inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], " +
<del> "outboundChannelpool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], " +
<del> "sockJsScheduler[pool size = 1, active threads = 0, queued tasks = 1, completed tasks = 0]",
<del> stats.toString());
<add> String actual = stats.toString();
<add> String expected = "WebSocketSession\\[0 current WS\\(0\\)-HttpStream\\(0\\)-HttpPoll\\(0\\), " +
<add> "0 total, 0 closed abnormally \\(0 connect failure, 0 send limit, 0 transport error\\)\\], " +
<add> "stompSubProtocol\\[processed CONNECT\\(0\\)-CONNECTED\\(0\\)-DISCONNECT\\(0\\)\\], " +
<add> "stompBrokerRelay\\[0 sessions, relayhost:1234 \\(not available\\), processed CONNECT\\(0\\)-CONNECTED\\(0\\)-DISCONNECT\\(0\\)\\], " +
<add> "inboundChannel\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], " +
<add> "outboundChannelpool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], " +
<add> "sockJsScheduler\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\]";
<add>
<add> assertTrue("\nExpected: " + expected.replace("\\", "") + "\n Actual: " + actual, actual.matches(expected));
<ide> }
<ide>
<ide> @Test
<ide><path>spring-websocket/src/test/java/org/springframework/web/socket/config/annotation/WebSocketMessageBrokerConfigurationSupportTests.java
<ide> import java.util.Set;
<ide> import java.util.concurrent.ScheduledThreadPoolExecutor;
<ide>
<add>import org.hamcrest.Description;
<add>import org.hamcrest.Matcher;
<add>import org.hamcrest.Matchers;
<add>import org.hamcrest.TypeSafeMatcher;
<ide> import org.junit.Before;
<ide> import org.junit.Test;
<ide>
<ide> public void messageBrokerSockJsTaskScheduler() {
<ide> public void webSocketMessageBrokerStats() {
<ide> String name = "webSocketMessageBrokerStats";
<ide> WebSocketMessageBrokerStats stats = this.config.getBean(name, WebSocketMessageBrokerStats.class);
<del> assertEquals("WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), " +
<del> "0 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], " +
<del> "stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], " +
<del> "stompBrokerRelay[null], " +
<del> "inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], " +
<del> "outboundChannelpool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], " +
<del> "sockJsScheduler[pool size = 1, active threads = 0, queued tasks = 1, completed tasks = 0]",
<del> stats.toString());
<add> String actual = stats.toString();
<add> String expected = "WebSocketSession\\[0 current WS\\(0\\)-HttpStream\\(0\\)-HttpPoll\\(0\\), " +
<add> "0 total, 0 closed abnormally \\(0 connect failure, 0 send limit, 0 transport error\\)\\], " +
<add> "stompSubProtocol\\[processed CONNECT\\(0\\)-CONNECTED\\(0\\)-DISCONNECT\\(0\\)\\], " +
<add> "stompBrokerRelay\\[null\\], " +
<add> "inboundChannel\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], " +
<add> "outboundChannelpool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], " +
<add> "sockJsScheduler\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\]";
<add>
<add> assertTrue("\nExpected: " + expected.replace("\\", "") + "\n Actual: " + actual, actual.matches(expected));
<ide> }
<ide>
<ide> | 2 |
Python | Python | add spaces after commas | 5d380b98f9bd029bbc5ac55f8a23bc16cebe076d | <ide><path>doc/source/reference/random/performance.py
<ide> col[key] = 1000 * min(t)
<ide> table['RandomState'] = pd.Series(col)
<ide>
<del>columns = ['MT19937','PCG64','PCG64DXSM','Philox','SFC64', 'RandomState']
<add>columns = ['MT19937', 'PCG64', 'PCG64DXSM', 'Philox', 'SFC64', 'RandomState']
<ide> table = pd.DataFrame(table)
<ide> order = np.log(table).mean().sort_values().index
<ide> table = table.T | 1 |
Javascript | Javascript | add support for classnamebindings in sc.view | ceb66b5505674f29534552adf72d69d819c322a0 | <ide><path>lib/sproutcore-views/lib/views/view.js
<ide> SC.TEMPLATES = SC.Object.create();
<ide> SC.View = SC.Object.extend(
<ide> /** @scope SC.View.prototype */ {
<ide>
<del> concatenatedProperties: ['classNames'],
<add> concatenatedProperties: ['classNames', 'classNameBindings'],
<ide>
<ide> /** walk like a duck */
<ide> isView: YES,
<ide> SC.View = SC.Object.extend(
<ide> buffer.push(output);
<ide> },
<ide>
<add> /** @property
<add> Iterates over the view's `classNameBindings` array, inserts the value
<add> of the specified property into the `classNames` array, then creates an
<add> observer to update the view's element if the bound property ever changes
<add> in the future.
<add> */
<add> _applyClassNameBindings: function() {
<add> var classBindings = this.get('classNameBindings'),
<add> classNames = this.get('classNames'),
<add> dasherizedClass;
<add>
<add> if (!classBindings) { return; }
<add>
<add> // Loop through all of the configured bindings. These will be either
<add> // property names ('isUrgent') or property paths relative to the view
<add> // ('content.isUrgent')
<add> classBindings.forEach(function(property) {
<add>
<add> // Variable in which the old class value is saved. The observer function
<add> // closes over this variable, so it knows which string to remove when
<add> // the property changes.
<add> var oldClass;
<add>
<add> // Set up an observer on the context. If the property changes, toggle the
<add> // class name.
<add> var observer = function() {
<add>
<add> // Get the current value of the property
<add> newClass = this._classStringForProperty(property);
<add> elem = this.$();
<add>
<add> // If we had previously added a class to the element, remove it.
<add> if (oldClass) {
<add> elem.removeClass(oldClass);
<add> }
<add>
<add> // If necessary, add a new class. Make sure we keep track of it so
<add> // it can be removed in the future.
<add> if (newClass) {
<add> elem.addClass(newClass);
<add> oldClass = newClass;
<add> } else {
<add> oldClass = null;
<add> }
<add> };
<add>
<add> this.addObserver(property, observer);
<add>
<add> // Get the class name for the property at its current value
<add> dasherizedClass = this._classStringForProperty(property);
<add>
<add> if (dasherizedClass) {
<add> // Ensure that it gets into the classNames array
<add> // so it is displayed when we render.
<add> classNames.push(dasherizedClass);
<add>
<add> // Save a reference to the class name so we can remove it
<add> // if the observer fires. Remember that this variable has
<add> // been closed over by the observer.
<add> oldClass = dasherizedClass;
<add> }
<add> }, this);
<add> },
<add>
<add> /** @private
<add> Given a property name, returns a dasherized version of that
<add> property name if the property evaluates to a non-falsy value.
<add>
<add> For example, if the view has property `isUrgent` that evaluates to true,
<add> passing `isUrgent` to this method will return `"is-urgent"`.
<add> */
<add> _classStringForProperty: function(property) {
<add> var split = property.split(':'), className = split[1];
<add> property = split[0];
<add>
<add> var val = this.getPath(property);
<add>
<add> // If value is a Boolean and true, return the dasherized property
<add> // name.
<add> if (val === YES) {
<add> if (className) { return className; }
<add>
<add> // Normalize property path to be suitable for use
<add> // as a class name. For exaple, content.foo.barBaz
<add> // becomes bar-baz.
<add> return SC.String.dasherize(property.split('.').get('lastObject'));
<add>
<add> // If the value is not NO, undefined, or null, return the current
<add> // value of the property.
<add> } else if (val !== NO && val !== undefined && val !== null) {
<add> return val;
<add>
<add> // Nothing to display. Return null so that the old class is removed
<add> // but no new class is added.
<add> } else {
<add> return null;
<add> }
<add> },
<add>
<ide> // ..........................................................
<ide> // ELEMENT SUPPORT
<ide> //
<ide> SC.View = SC.Object.extend(
<ide> },
<ide>
<ide> applyAttributesToBuffer: function(buffer) {
<del> buffer.addClass(this.get('classNames'));
<add> // Creates observers for all registered class name bindings,
<add> // then adds them to the classNames array.
<add> this._applyClassNameBindings();
<add>
<add> buffer.addClass(this.get('classNames').join(' '));
<ide> buffer.id(this.get('elementId'));
<ide> buffer.attr('role', this.get('ariaRole'));
<ide>
<ide> SC.View = SC.Object.extend(
<ide> */
<ide> classNames: ['sc-view'],
<ide>
<add> /**
<add> A list of properties of the view to apply as class names. If the property
<add> is a string value, the value of that string will be applied as a class
<add> name.
<add>
<add> // Applies the 'high' class to the view element
<add> SC.View.create({
<add> classNameBindings: ['priority']
<add> priority: 'high'
<add> });
<add>
<add> If the value of the property is a Boolean, the name of that property is
<add> added as a dasherized class name.
<add>
<add> // Applies the 'is-urgent' class to the view element
<add> SC.View.create({
<add> classNameBindings: ['isUrgent']
<add> isUrgent: true
<add> });
<add>
<add> If you would prefer to use a custom value instead of the dasherized
<add> property name, you can pass a binding like this:
<add>
<add> // Applies the 'urgent' class to the view element
<add> SC.View.create({
<add> classNameBindings: ['isUrgent:urgent']
<add> isUrgent: true
<add> });
<add>
<add> This list of properties is inherited from the view's superclasses as well.
<add>
<add> @type Array
<add> */
<add>
<add> classNameBindings: [],
<add>
<ide> // .......................................................
<ide> // CORE DISPLAY METHODS
<ide> //
<ide> SC.View = SC.Object.extend(
<ide>
<ide> // setup child views. be sure to clone the child views array first
<ide> this.childViews = this.get('childViews').slice();
<add> this.classNameBindings = this.get('classNameBindings').slice();
<add> this.classNames = this.get('classNames').slice();
<add>
<ide> this.createChildViews(); // setup child Views
<ide> },
<ide>
<ide><path>lib/sproutcore-views/tests/views/view/class_name_bindings_test.js
<add>require('sproutcore-views/views/view');
<add>
<add>module("SC.View - Bound Class Names");
<add>
<add>test("should apply bound class names to the element", function() {
<add> var view = SC.View.create({
<add> classNameBindings: ['priority', 'isUrgent', 'isClassified:classified', 'canIgnore'],
<add>
<add> priority: 'high',
<add> isUrgent: true,
<add> isClassified: true,
<add> canIgnore: false
<add> });
<add>
<add> view.createElement();
<add> ok(view.$().hasClass('high'), "adds string values as class name");
<add> ok(view.$().hasClass('is-urgent'), "adds true Boolean values by dasherizing");
<add> ok(view.$().hasClass('classified'), "supports customizing class name for Boolean values");
<add> ok(!view.$().hasClass('can-ignore'), "does not add false Boolean values as class");
<add>});
<add>
<add>test("should add, remove, or change class names if changed after element is created", function() {
<add> var view = SC.View.create({
<add> classNameBindings: ['priority', 'isUrgent', 'canIgnore'],
<add>
<add> priority: 'high',
<add> isUrgent: true,
<add> canIgnore: false
<add> });
<add>
<add> view.createElement();
<add>
<add> view.set('priority', 'orange');
<add> view.set('isUrgent', false);
<add> view.set('canIgnore', true);
<add>
<add> ok(view.$().hasClass('orange'), "updates string values");
<add> ok(!view.$().hasClass('high'), "removes old string value");
<add>
<add> ok(!view.$().hasClass('is-urgent', "removes dasherized class when changed from true to false"));
<add> ok(view.$().hasClass('can-ignore'), "adds dasherized class when changed from false to true");
<add>}); | 2 |
Text | Text | remove busywork of upgrade docs, move to symbols | bafc6ddbd1bef5895a19c3adf02142027325398e | <ide><path>docs/Upgrading.md
<ide> Note the latest version of the `react-native` npm package from here (or use `npm
<ide>
<ide> * https://www.npmjs.com/package/react-native
<ide>
<del>Now install that version of `react-native` in your project with `npm install --save`. For example, to upgrade to the version `0.34`, in a terminal run:
<add>Now install that version of `react-native` in your project with `npm install --save`.
<ide>
<ide> ```sh
<del>$ npm install --save react-native@0.34
<add>$ npm install --save react-native@X.Y
<add># where X.Y is the semantic version you are upgrading to
<ide> ```
<ide>
<ide> ## 2. Upgrade your project templates | 1 |
Ruby | Ruby | add initial tests | 2c81083f3c9679b9c70c2d0a3e1d8f496707588a | <ide><path>Library/Homebrew/test/test_gpg.rb
<add>require "testing_env"
<add>require "gpg"
<add>
<add>class GpgTest < Homebrew::TestCase
<add> def setup
<add> skip "GPG Unavailable" unless Gpg.available?
<add> @dir = Pathname.new(mktmpdir)
<add> end
<add>
<add> def teardown
<add> @dir.rmtree
<add> end
<add>
<add> def test_create_test_key
<add> Dir.chdir(@dir) do
<add> with_environment("HOME" => @dir) do
<add> shutup { Gpg.create_test_key(@dir) }
<add> assert_predicate @dir/".gnupg/secring.gpg", :exist?
<add> end
<add> end
<add> end
<add>end | 1 |
Go | Go | fix "retreive" typo in plugin store | 03bf37884d089b69fd7e05491eff658420f40c5d | <ide><path>plugin/store.go
<ide> func (name ErrAmbiguous) Error() string {
<ide> return fmt.Sprintf("multiple plugins found for %q", string(name))
<ide> }
<ide>
<del>// GetV2Plugin retreives a plugin by name, id or partial ID.
<add>// GetV2Plugin retrieves a plugin by name, id or partial ID.
<ide> func (ps *Store) GetV2Plugin(refOrID string) (*v2.Plugin, error) {
<ide> ps.RLock()
<ide> defer ps.RUnlock()
<ide> func (ps *Store) validateName(name string) error {
<ide> return nil
<ide> }
<ide>
<del>// GetAll retreives all plugins.
<add>// GetAll retrieves all plugins.
<ide> func (ps *Store) GetAll() map[string]*v2.Plugin {
<ide> ps.RLock()
<ide> defer ps.RUnlock() | 1 |
Python | Python | add a small test that checks issue 9267 | 8be65329ec49049bffa8fb990b949fdc5b845c2b | <ide><path>tests/keras/engine/test_topology.py
<ide> def test_recursion_with_bn_and_loss():
<ide> model2.fit(x, y, verbose=0, epochs=1)
<ide>
<ide>
<add>@keras_test
<add>def test_activity_regularization_with_model_composition():
<add> # Ensures that the shape of the input to the activity
<add> # regularizer is the same under model composition.
<add> # Tests for regressions of issue #9267
<add> wrong_size = 10
<add> correct_size = 2
<add> def reg(x):
<add> assert x.shape[-1] == correct_size
<add> return 0
<add>
<add> net_a_input = Input([2])
<add> net_a = net_a_input
<add> net_a = Dense(wrong_size)(net_a)
<add> net_a = Dense(correct_size, activity_regularizer=reg)(net_a)
<add> model_a = Model([net_a_input], [net_a])
<add>
<add> net_b_input = Input([2])
<add> net_b = Dense(10)(model_a(net_b_input))
<add> model_b = Model([net_b_input], [net_b])
<add>
<add>
<ide> @keras_test
<ide> def test_shared_layer_depth_is_correct():
<ide> # Basic outline here: we have a shared embedding layer, and two inputs that go through | 1 |
Text | Text | add static tweet link | f98e38c9b634b85e6679e7b5f953a9d98074cfc3 | <ide><path>docs/basic-features/data-fetching.md
<ide> export default Post
<ide>
<ide> #### `fallback: true`
<ide>
<add><details>
<add> <summary><b>Examples</b></summary>
<add> <ul>
<add> <li><a href="https://static-tweet.now.sh">Static generation of a large number of pages</a></li>
<add> </ul>
<add></details>
<add>
<ide> If `fallback` is `true`, then the behavior of `getStaticProps` changes:
<ide>
<ide> - The paths returned from `getStaticPaths` will be rendered to HTML at build time. | 1 |
Python | Python | add weight to (squared) hinge | c0b7044ce68e288e1cd34cadd60cbf4960bc3645 | <ide><path>keras/objectives.py
<ide> def mean_absolute_error(y_true, y_pred, weight=None):
<ide> return T.abs_(y_pred - y_true).mean()
<ide>
<ide> def squared_hinge(y_true, y_pred, weight=None):
<del> return T.sqr(T.maximum(1. - y_true * y_pred, 0.)).mean()
<add> if weight is not None:
<add> return T.sqr(T.maximum(1. - weight*(y_true * y_pred), 0.)).mean()
<add> else:
<add> return T.sqr(T.maximum(1. - y_true * y_pred, 0.)).mean()
<ide>
<ide> def hinge(y_true, y_pred, weight=None):
<del> return T.maximum(1. - y_true * y_pred, 0.).mean()
<add> if weight is not None:
<add> return T.maximum(1. - weight*(y_true * y_pred), 0.).mean()
<add> else:
<add> return T.maximum(1. - y_true * y_pred, 0.).mean()
<ide>
<ide> def categorical_crossentropy(y_true, y_pred, weight=None):
<ide> '''Expects a binary class matrix instead of a vector of scalar classes | 1 |
Javascript | Javascript | remove redundant oneoftype declaration | eb80a2b7f3ff8e84d13ec8ce01f72e01f2bad5d0 | <ide><path>src/Container.js
<ide> export default class ReduxContainer extends Component {
<ide> static propTypes = {
<ide> children: PropTypes.func.isRequired,
<ide> actions: PropTypes.object.isRequired,
<del> stores: PropTypes.oneOfType([
<del> PropTypes.arrayOf(PropTypes.func.isRequired).isRequired
<del> ]).isRequired
<add> stores: PropTypes.arrayOf(PropTypes.func.isRequired).isRequired
<ide> }
<ide>
<ide> static defaultProps = { | 1 |
Python | Python | improve authorization in gcp system tests | beef6c230e4ff266af7c16b639bfda659b2bf6c0 | <ide><path>airflow/providers/google/cloud/utils/credentials_provider.py
<ide> import json
<ide> import logging
<ide> import tempfile
<del>from contextlib import contextmanager
<add>from contextlib import ExitStack, contextmanager
<ide> from typing import Dict, Optional, Sequence, Tuple
<ide> from urllib.parse import urlencode
<ide>
<ide> import google.auth
<ide> import google.oauth2.service_account
<del>from google.auth.environment_vars import CREDENTIALS
<add>from google.auth.environment_vars import CREDENTIALS, LEGACY_PROJECT, PROJECT
<ide>
<ide> from airflow.exceptions import AirflowException
<ide> from airflow.utils.process_utils import patch_environ
<ide> def provide_gcp_conn_and_credentials(
<ide> :param project_id: The id of GCP project for the connection.
<ide> :type project_id: str
<ide> """
<del> with provide_gcp_credentials(key_file_path), provide_gcp_connection(
<del> key_file_path, scopes, project_id
<del> ):
<add> with ExitStack() as stack:
<add> if key_file_path:
<add> stack.enter_context( # type; ignore # pylint: disable=no-member
<add> provide_gcp_credentials(key_file_path)
<add> )
<add> if project_id:
<add> stack.enter_context( # type; ignore # pylint: disable=no-member
<add> patch_environ({PROJECT: project_id, LEGACY_PROJECT: project_id})
<add> )
<add>
<add> stack.enter_context( # type; ignore # pylint: disable=no-member
<add> provide_gcp_connection(key_file_path, scopes, project_id)
<add> )
<ide> yield
<ide>
<ide>
<ide><path>tests/providers/google/cloud/operators/test_cloud_build_operator_system.py
<ide> class CloudBuildExampleDagsSystemTest(GoogleSystemTest):
<ide> @provide_gcp_context(GCP_CLOUD_BUILD_KEY)
<ide> def setUp(self):
<ide> super().setUp()
<del> with self.authentication():
<del> self.helper.create_repository_and_bucket()
<add> self.helper.create_repository_and_bucket()
<ide>
<ide> @provide_gcp_context(GCP_CLOUD_BUILD_KEY)
<ide> def test_run_example_dag(self):
<ide> self.run_dag("example_gcp_cloud_build", CLOUD_DAG_FOLDER)
<ide>
<ide> @provide_gcp_context(GCP_CLOUD_BUILD_KEY)
<ide> def tearDown(self):
<del> with self.authentication():
<del> self.helper.delete_bucket()
<del> self.helper.delete_docker_images()
<del> self.helper.delete_repo()
<add> self.helper.delete_bucket()
<add> self.helper.delete_docker_images()
<add> self.helper.delete_repo()
<ide> super().tearDown()
<ide><path>tests/providers/google/cloud/operators/test_cloud_sql_system.py
<ide> def tearDown(self):
<ide> self.log.info("Skip deleting instances as they were created manually (helps to iterate on tests)")
<ide> else:
<ide> # Delete instances just in case the test failed and did not cleanup after itself
<del> with self.authentication():
<del> SQL_QUERY_TEST_HELPER.delete_instances(instance_suffix="-failover-replica")
<del> SQL_QUERY_TEST_HELPER.delete_instances(instance_suffix="-read-replica")
<del> SQL_QUERY_TEST_HELPER.delete_instances()
<del> SQL_QUERY_TEST_HELPER.delete_instances(instance_suffix="2")
<del> SQL_QUERY_TEST_HELPER.delete_service_account_acls()
<add> SQL_QUERY_TEST_HELPER.delete_instances(instance_suffix="-failover-replica")
<add> SQL_QUERY_TEST_HELPER.delete_instances(instance_suffix="-read-replica")
<add> SQL_QUERY_TEST_HELPER.delete_instances()
<add> SQL_QUERY_TEST_HELPER.delete_instances(instance_suffix="2")
<add> SQL_QUERY_TEST_HELPER.delete_service_account_acls()
<ide> super().tearDown()
<ide>
<ide> @provide_gcp_context(GCP_CLOUDSQL_KEY)
<ide><path>tests/providers/google/cloud/operators/test_compute_system.py
<ide> class GcpComputeExampleDagsSystemTest(GoogleSystemTest):
<ide> @provide_gcp_context(GCP_COMPUTE_KEY)
<ide> def setUp(self):
<ide> super().setUp()
<del> with self.authentication():
<del> self.helper.delete_instance()
<del> self.helper.create_instance()
<add> self.helper.delete_instance()
<add> self.helper.create_instance()
<ide>
<ide> @provide_gcp_context(GCP_COMPUTE_KEY)
<ide> def tearDown(self):
<del> with self.authentication():
<del> self.helper.delete_instance()
<add> self.helper.delete_instance()
<ide> super().tearDown()
<ide>
<ide> @provide_gcp_context(GCP_COMPUTE_KEY)
<ide> class GcpComputeIgmExampleDagsSystemTest(GoogleSystemTest):
<ide> @provide_gcp_context(GCP_COMPUTE_KEY)
<ide> def setUp(self):
<ide> super().setUp()
<del> with self.authentication():
<del> self.helper.delete_instance_group_and_template(silent=True)
<del> self.helper.create_instance_group_and_template()
<add> self.helper.delete_instance_group_and_template(silent=True)
<add> self.helper.create_instance_group_and_template()
<ide>
<ide> @provide_gcp_context(GCP_COMPUTE_KEY)
<ide> def tearDown(self):
<del> with self.authentication():
<del> self.helper.delete_instance_group_and_template()
<add> self.helper.delete_instance_group_and_template()
<ide> super().tearDown()
<ide>
<ide> @provide_gcp_context(GCP_COMPUTE_KEY)
<ide><path>tests/test_utils/gcp_system_helpers.py
<ide> # specific language governing permissions and limitations
<ide> # under the License.
<ide> import os
<add>import tempfile
<ide> from contextlib import contextmanager
<ide> from tempfile import TemporaryDirectory
<ide> from typing import List, Optional, Sequence
<add>from unittest import mock
<ide>
<ide> import pytest
<del>from google.auth.environment_vars import CREDENTIALS
<add>from google.auth.environment_vars import CLOUD_SDK_CONFIG_DIR, CREDENTIALS
<ide>
<ide> from airflow.providers.google.cloud.utils.credentials_provider import provide_gcp_conn_and_credentials
<ide> from tests.providers.google.cloud.utils.gcp_authenticator import GCP_GCS_KEY
<ide> def resolve_full_gcp_key_path(key: str) -> str:
<ide> return key
<ide>
<ide>
<add>@contextmanager
<ide> def provide_gcp_context(
<ide> key_file_path: Optional[str] = None,
<ide> scopes: Optional[Sequence] = None,
<ide> project_id: Optional[str] = None,
<ide> ):
<ide> """
<del> Context manager that provides both:
<add> Context manager that provides:
<ide>
<ide> - GCP credentials for application supporting `Application Default Credentials (ADC)
<ide> strategy <https://cloud.google.com/docs/authentication/production>`__.
<ide> - temporary value of ``AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT`` connection
<add> - the ``gcloud`` config directory isolated from user configuration
<ide>
<ide> Moreover it resolves full path to service keys so user can pass ``myservice.json``
<ide> as ``key_file_path``.
<ide> def provide_gcp_context(
<ide> :type project_id: str
<ide> """
<ide> key_file_path = resolve_full_gcp_key_path(key_file_path) # type: ignore
<del> return provide_gcp_conn_and_credentials(
<del> key_file_path=key_file_path, scopes=scopes, project_id=project_id
<del> )
<add> with provide_gcp_conn_and_credentials(key_file_path, scopes, project_id), \
<add> tempfile.TemporaryDirectory() as gcloud_config_tmp, \
<add> mock.patch.dict('os.environ', {CLOUD_SDK_CONFIG_DIR: gcloud_config_tmp}):
<add> executor = get_executor()
<add>
<add> if project_id:
<add> executor.execute_cmd([
<add> "gcloud", "config", "set", "core/project", project_id
<add> ])
<add> if key_file_path:
<add> executor.execute_cmd([
<add> "gcloud", "auth", "activate-service-account", f"--key-file={key_file_path}",
<add> ])
<add> yield
<ide>
<ide>
<ide> @pytest.mark.system("google")
<ide> def _project_id():
<ide> def _service_key():
<ide> return os.environ.get(CREDENTIALS)
<ide>
<del> @staticmethod
<del> @contextmanager
<del> def authentication():
<del> GoogleSystemTest._authenticate()
<del> try:
<del> yield
<del> finally:
<del> GoogleSystemTest._revoke_authentication()
<del>
<del> @staticmethod
<del> def _authenticate():
<del> """
<del> Authenticate with service account specified via key name.
<del> Required only when we use gcloud / gsutil.
<del> """
<del> executor = get_executor()
<del> executor.execute_cmd(
<del> [
<del> "gcloud",
<del> "auth",
<del> "activate-service-account",
<del> f"--key-file={GoogleSystemTest._service_key()}",
<del> f"--project={GoogleSystemTest._project_id()}",
<del> ]
<del> )
<del>
<del> @staticmethod
<del> def _revoke_authentication():
<del> """
<del> Change default authentication to none - which is not existing one.
<del> """
<del> executor = get_executor()
<del> executor.execute_cmd(
<del> [
<del> "gcloud",
<del> "config",
<del> "set",
<del> "account",
<del> "none",
<del> f"--project={GoogleSystemTest._project_id()}",
<del> ]
<del> )
<del>
<del> @staticmethod
<del> def execute_with_ctx(cmd: List[str], key: str = GCP_GCS_KEY):
<add> @classmethod
<add> def execute_with_ctx(cls, cmd: List[str], key: str = GCP_GCS_KEY, project_id=None, scopes=None):
<ide> """
<ide> Executes command with context created by provide_gcp_context and activated
<ide> service key.
<ide> """
<ide> executor = get_executor()
<del> with provide_gcp_context(key), GoogleSystemTest.authentication():
<del> env = os.environ.copy()
<del> executor.execute_cmd(cmd=cmd, env=env)
<add> current_project_id = project_id or cls._project_id()
<add> with provide_gcp_context(key, project_id=current_project_id, scopes=scopes):
<add> executor.execute_cmd(cmd=cmd)
<ide>
<del> @staticmethod
<del> def create_gcs_bucket(name: str, location: Optional[str] = None) -> None:
<add> @classmethod
<add> def create_gcs_bucket(cls, name: str, location: Optional[str] = None) -> None:
<ide> bucket_name = f"gs://{name}" if not name.startswith("gs://") else name
<ide> cmd = ["gsutil", "mb"]
<ide> if location:
<ide> cmd += ["-c", "regional", "-l", location]
<ide> cmd += [bucket_name]
<del> GoogleSystemTest.execute_with_ctx(cmd, key=GCP_GCS_KEY)
<add> cls.execute_with_ctx(cmd, key=GCP_GCS_KEY)
<ide>
<del> @staticmethod
<del> def delete_gcs_bucket(name: str):
<add> @classmethod
<add> def delete_gcs_bucket(cls, name: str):
<ide> bucket_name = f"gs://{name}" if not name.startswith("gs://") else name
<ide> cmd = ["gsutil", "-m", "rm", "-r", bucket_name]
<del> GoogleSystemTest.execute_with_ctx(cmd, key=GCP_GCS_KEY)
<add> cls.execute_with_ctx(cmd, key=GCP_GCS_KEY)
<ide>
<del> @staticmethod
<del> def upload_to_gcs(source_uri: str, target_uri: str):
<del> GoogleSystemTest.execute_with_ctx(
<add> @classmethod
<add> def upload_to_gcs(cls, source_uri: str, target_uri: str):
<add> cls.execute_with_ctx(
<ide> ["gsutil", "cp", f"{target_uri}", f"{source_uri}"], key=GCP_GCS_KEY
<ide> )
<ide>
<del> @staticmethod
<del> def upload_content_to_gcs(lines: str, bucket_uri: str, filename: str):
<add> @classmethod
<add> def upload_content_to_gcs(cls, lines: str, bucket_uri: str, filename: str):
<ide> with TemporaryDirectory(prefix="airflow-gcp") as tmp_dir:
<ide> tmp_path = os.path.join(tmp_dir, filename)
<ide> with open(tmp_path, "w") as file:
<ide> file.writelines(lines)
<ide> file.flush()
<ide> os.chmod(tmp_path, 555)
<del> GoogleSystemTest.upload_to_gcs(bucket_uri, tmp_path)
<add> cls.upload_to_gcs(bucket_uri, tmp_path)
<ide>
<del> @staticmethod
<del> def get_project_number(project_id: str) -> str:
<del> with GoogleSystemTest.authentication():
<del> cmd = ['gcloud', 'projects', 'describe', project_id, '--format', 'value(projectNumber)']
<del> return GoogleSystemTest.check_output(cmd).decode("utf-8").strip()
<add> @classmethod
<add> def get_project_number(cls, project_id: str) -> str:
<add> cmd = ['gcloud', 'projects', 'describe', project_id, '--format', 'value(projectNumber)']
<add> return cls.check_output(cmd).decode("utf-8").strip()
<ide>
<del> @staticmethod
<del> def grant_bucket_access(bucket: str, account_email: str):
<add> @classmethod
<add> def grant_bucket_access(cls, bucket: str, account_email: str):
<ide> bucket_name = f"gs://{bucket}" if not bucket.startswith("gs://") else bucket
<del> with GoogleSystemTest.authentication():
<del> GoogleSystemTest.execute_cmd(
<del> [
<del> "gsutil",
<del> "iam",
<del> "ch",
<del> "serviceAccount:%s:admin" % account_email,
<del> bucket_name,
<del> ]
<del> )
<add> cls.execute_cmd(
<add> [
<add> "gsutil",
<add> "iam",
<add> "ch",
<add> "serviceAccount:%s:admin" % account_email,
<add> bucket_name,
<add> ]
<add> ) | 5 |
Javascript | Javascript | handle undefined default_configuration | 70281ce1f0598822d536a8c80c1a2b8fdfcd2a63 | <ide><path>test/common/index.js
<ide> const enoughTestCpu = Array.isArray(cpus) &&
<ide>
<ide> const rootDir = isWindows ? 'c:\\' : '/';
<ide>
<del>const buildType = process.config.target_defaults.default_configuration;
<del>
<add>const buildType = process.config.target_defaults ?
<add> process.config.target_defaults.default_configuration :
<add> 'Release';
<ide>
<ide> // If env var is set then enable async_hook hooks for all tests.
<ide> if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) { | 1 |
Javascript | Javascript | reset lasteffect when resuming suspenselist | 689d27586e30f94be1b7a7bb634b82633c2baf42 | <ide><path>packages/react-reconciler/src/ReactFiberBeginWork.js
<ide> function beginWork(
<ide> // update in the past but didn't complete it.
<ide> renderState.rendering = null;
<ide> renderState.tail = null;
<add> renderState.lastEffect = null;
<ide> }
<ide> pushSuspenseContext(workInProgress, suspenseStackCursor.current);
<ide>
<ide><path>packages/react-reconciler/src/__tests__/ReactSuspenseList-test.internal.js
<ide> describe('ReactSuspenseList', () => {
<ide> // remount.
<ide> expect(previousInst).toBe(setAsyncB);
<ide> });
<add>
<add> it('is able to re-suspend the last rows during an update with hidden', async () => {
<add> let AsyncB = createAsyncText('B');
<add>
<add> let setAsyncB;
<add>
<add> function B() {
<add> let [shouldBeAsync, setAsync] = React.useState(false);
<add> setAsyncB = setAsync;
<add>
<add> return shouldBeAsync ? (
<add> <Suspense fallback={<Text text="Loading B" />}>
<add> <AsyncB />
<add> </Suspense>
<add> ) : (
<add> <Text text="Sync B" />
<add> );
<add> }
<add>
<add> function Foo({updateList}) {
<add> return (
<add> <SuspenseList revealOrder="forwards" tail="hidden">
<add> <Suspense key="A" fallback={<Text text="Loading A" />}>
<add> <Text text="A" />
<add> </Suspense>
<add> <B key="B" updateList={updateList} />
<add> </SuspenseList>
<add> );
<add> }
<add>
<add> ReactNoop.render(<Foo />);
<add>
<add> expect(Scheduler).toFlushAndYield(['A', 'Sync B']);
<add>
<add> expect(ReactNoop).toMatchRenderedOutput(
<add> <>
<add> <span>A</span>
<add> <span>Sync B</span>
<add> </>,
<add> );
<add>
<add> let previousInst = setAsyncB;
<add>
<add> // During an update we suspend on B.
<add> ReactNoop.act(() => setAsyncB(true));
<add>
<add> expect(Scheduler).toHaveYielded([
<add> 'Suspend! [B]',
<add> 'Loading B',
<add> // The second pass is the "force hide" pass
<add> 'Loading B',
<add> ]);
<add>
<add> expect(ReactNoop).toMatchRenderedOutput(
<add> <>
<add> <span>A</span>
<add> <span>Loading B</span>
<add> </>,
<add> );
<add>
<add> // Before we resolve we'll rerender the whole list.
<add> // This should leave the tree intact.
<add> ReactNoop.act(() => ReactNoop.render(<Foo updateList={true} />));
<add>
<add> expect(Scheduler).toHaveYielded(['A', 'Suspend! [B]', 'Loading B']);
<add>
<add> expect(ReactNoop).toMatchRenderedOutput(
<add> <>
<add> <span>A</span>
<add> <span>Loading B</span>
<add> </>,
<add> );
<add>
<add> await AsyncB.resolve();
<add>
<add> expect(Scheduler).toFlushAndYield(['B']);
<add>
<add> expect(ReactNoop).toMatchRenderedOutput(
<add> <>
<add> <span>A</span>
<add> <span>B</span>
<add> </>,
<add> );
<add>
<add> // This should be the same instance. I.e. it didn't
<add> // remount.
<add> expect(previousInst).toBe(setAsyncB);
<add> });
<add>
<add> it('is able to interrupt a partially rendered tree and continue later', async () => {
<add> let AsyncA = createAsyncText('A');
<add>
<add> let updateLowPri;
<add> let updateHighPri;
<add>
<add> function Bar() {
<add> let [highPriState, setHighPriState] = React.useState(false);
<add> updateHighPri = setHighPriState;
<add> return highPriState ? <AsyncA /> : null;
<add> }
<add>
<add> function Foo() {
<add> let [lowPriState, setLowPriState] = React.useState(false);
<add> updateLowPri = setLowPriState;
<add> return (
<add> <SuspenseList revealOrder="forwards" tail="hidden">
<add> <Suspense key="A" fallback={<Text text="Loading A" />}>
<add> <Bar />
<add> </Suspense>
<add> {lowPriState ? <Text text="B" /> : null}
<add> {lowPriState ? <Text text="C" /> : null}
<add> {lowPriState ? <Text text="D" /> : null}
<add> </SuspenseList>
<add> );
<add> }
<add>
<add> ReactNoop.render(<Foo />);
<add>
<add> expect(Scheduler).toFlushAndYield([]);
<add>
<add> expect(ReactNoop).toMatchRenderedOutput(null);
<add>
<add> ReactNoop.act(() => {
<add> // Add a few items at the end.
<add> updateLowPri(true);
<add>
<add> // Flush partially through.
<add> expect(Scheduler).toFlushAndYieldThrough(['B', 'C']);
<add>
<add> // Schedule another update at higher priority.
<add> Scheduler.unstable_runWithPriority(
<add> Scheduler.unstable_UserBlockingPriority,
<add> () => updateHighPri(true),
<add> );
<add>
<add> // That will intercept the previous render.
<add> });
<add>
<add> jest.runAllTimers();
<add>
<add> expect(Scheduler).toHaveYielded(
<add> __DEV__
<add> ? [
<add> // First attempt at high pri.
<add> 'Suspend! [A]',
<add> 'Loading A',
<add> // Re-render at forced.
<add> 'Suspend! [A]',
<add> 'Loading A',
<add> // We auto-commit this on DEV.
<add> // Try again on low-pri.
<add> 'Suspend! [A]',
<add> 'Loading A',
<add> ]
<add> : [
<add> // First attempt at high pri.
<add> 'Suspend! [A]',
<add> 'Loading A',
<add> // Re-render at forced.
<add> 'Suspend! [A]',
<add> 'Loading A',
<add> // We didn't commit so retry at low-pri.
<add> 'Suspend! [A]',
<add> 'Loading A',
<add> // Re-render at forced.
<add> 'Suspend! [A]',
<add> 'Loading A',
<add> ],
<add> );
<add>
<add> expect(ReactNoop).toMatchRenderedOutput(<span>Loading A</span>);
<add>
<add> await AsyncA.resolve();
<add>
<add> expect(Scheduler).toFlushAndYield(['A', 'B', 'C', 'D']);
<add>
<add> expect(ReactNoop).toMatchRenderedOutput(
<add> <>
<add> <span>A</span>
<add> <span>B</span>
<add> <span>C</span>
<add> <span>D</span>
<add> </>,
<add> );
<add> });
<ide> }); | 2 |
Text | Text | add note about resource type in async_hooks | 064783cf5a8ffff697dbba092ed92eab535822b9 | <ide><path>doc/api/async_hooks.md
<ide> The `type` is a string identifying the type of resource that caused
<ide> `init` to be called. Generally, it will correspond to the name of the
<ide> resource's constructor.
<ide>
<add>Valid values are:
<add>
<ide> ```text
<ide> FSEVENTWRAP, FSREQCALLBACK, GETADDRINFOREQWRAP, GETNAMEINFOREQWRAP, HTTPINCOMINGMESSAGE,
<ide> HTTPCLIENTREQUEST, JSSTREAM, PIPECONNECTWRAP, PIPEWRAP, PROCESSWRAP, QUERYWRAP,
<ide> TTYWRAP, UDPSENDWRAP, UDPWRAP, WRITEWRAP, ZLIB, SSLCONNECTION, PBKDF2REQUEST,
<ide> RANDOMBYTESREQUEST, TLSWRAP, Microtask, Timeout, Immediate, TickObject
<ide> ```
<ide>
<add>These values can change in any Node.js release. Furthermore users of [`AsyncResource`][]
<add>likely provide other values.
<add>
<ide> There is also the `PROMISE` resource type, which is used to track `Promise`
<ide> instances and asynchronous work scheduled by them.
<ide> | 1 |
PHP | PHP | use numberformatter at the top of file | 782322b808b6300d414c41887d5dc0a01efe41fe | <ide><path>src/Validation/Validation.php
<ide>
<ide> use Cake\Utility\Text;
<ide> use LogicException;
<add>use NumberFormatter;
<ide> use RuntimeException;
<ide>
<ide> /**
<ide> public static function decimal($check, $places = null, $regex = null)
<ide>
<ide> // account for localized floats.
<ide> $locale = ini_get('intl.default_locale') ?: 'en_US';
<del> $formatter = new \NumberFormatter($locale, \NumberFormatter::DECIMAL);
<del> $decimalPoint = $formatter->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
<del> $groupingSep = $formatter->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL);
<add> $formatter = new NumberFormatter($locale, NumberFormatter::DECIMAL);
<add> $decimalPoint = $formatter->getSymbol(NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
<add> $groupingSep = $formatter->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL);
<ide>
<ide> $check = str_replace($groupingSep, '', $check);
<ide> $check = str_replace($decimalPoint, '.', $check); | 1 |
Ruby | Ruby | improve the error message | 1d9309a5b2391b9f839dd23a213031267d03a281 | <ide><path>activerecord/lib/active_record/migration.rb
<ide> def run
<ide> record_version_state_after_migrating(migration.version)
<ide> end
<ide> rescue => e
<del> canceled_msg = use_transaction?(migration) ? ", the migration canceled" : ""
<add> canceled_msg = use_transaction?(migration) ? ", this migration was canceled" : ""
<ide> raise StandardError, "An error has occurred#{canceled_msg}:\n\n#{e}", e.backtrace
<ide> end
<ide> end
<ide><path>activerecord/test/cases/migration_test.rb
<ide> def migrate(x)
<ide>
<ide> e = assert_raise(StandardError) { migrator.run }
<ide>
<del> assert_equal "An error has occurred, the migration canceled:\n\nSomething broke", e.message
<add> assert_equal "An error has occurred, this migration was canceled:\n\nSomething broke", e.message
<ide>
<ide> Person.reset_column_information
<ide> assert_not Person.column_methods_hash.include?(:last_name), | 2 |
Javascript | Javascript | fix tests for value change | cf1a96611f2c47b277bd8243159a2aa7a4f52180 | <ide><path>src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
<ide>
<ide> describe('ReactDOMComponent', function() {
<ide> var React;
<del>
<ide> var ReactDOM;
<add> var ReactDOMFeatureFlags;
<ide> var ReactDOMServer;
<ide>
<ide> beforeEach(function() {
<ide> jest.resetModuleRegistry();
<ide> React = require('React');
<add> ReactDOMFeatureFlags = require('ReactDOMFeatureFlags')
<ide> ReactDOM = require('ReactDOM');
<ide> ReactDOMServer = require('ReactDOMServer');
<ide> });
<ide> describe('ReactDOMComponent', function() {
<ide> }),
<ide> });
<ide>
<del> ReactDOM.render(<div value="" />, container);
<del> expect(nodeValueSetter.mock.calls.length).toBe(0);
<del>
<del> ReactDOM.render(<div value="foo" />, container);
<del> expect(nodeValueSetter.mock.calls.length).toBe(1);
<del>
<del> ReactDOM.render(<div value="foo" />, container);
<del> expect(nodeValueSetter.mock.calls.length).toBe(1);
<del>
<del> ReactDOM.render(<div />, container);
<del> expect(nodeValueSetter.mock.calls.length).toBe(2);
<del>
<del> ReactDOM.render(<div value={null} />, container);
<del> expect(nodeValueSetter.mock.calls.length).toBe(2);
<del>
<del> ReactDOM.render(<div value="" />, container);
<del> expect(nodeValueSetter.mock.calls.length).toBe(3);
<add> function renderWithValueAndExpect(value, expected) {
<add> ReactDOM.render(<div value={value} />, container);
<add> expect(nodeValueSetter.mock.calls.length).toBe(expected);
<add> }
<ide>
<del> ReactDOM.render(<div />, container);
<del> expect(nodeValueSetter.mock.calls.length).toBe(3);
<add> if (ReactDOMFeatureFlags.useCreateElement) {
<add> renderWithValueAndExpect(undefined, 0);
<add> renderWithValueAndExpect('', 1);
<add> renderWithValueAndExpect('foo', 2);
<add> renderWithValueAndExpect('foo', 2);
<add> renderWithValueAndExpect(undefined, 3);
<add> renderWithValueAndExpect(null, 3);
<add> renderWithValueAndExpect('', 4);
<add> renderWithValueAndExpect(undefined, 4);
<add> } else {
<add> renderWithValueAndExpect(undefined, 0);
<add> // This differs because we will have created a node with the value
<add> // attribute set. This means it will hasAttribute, so we won't try to
<add> // set the value.
<add> renderWithValueAndExpect('', 0);
<add> renderWithValueAndExpect('foo', 1);
<add> renderWithValueAndExpect('foo', 1);
<add> renderWithValueAndExpect(undefined, 2);
<add> renderWithValueAndExpect(null, 2);
<add> // Again, much like the initial update case, we will always have the
<add> // attribute set so we won't set the value.
<add> renderWithValueAndExpect('', 2);
<add> renderWithValueAndExpect(undefined, 2);
<add> }
<ide> });
<ide>
<ide> it('should not incur unnecessary DOM mutations for boolean properties', function() { | 1 |
Javascript | Javascript | allow loading pdf fonts into another document | 9b16b8ef7138ff4a165c2d5e0d075aafb11f449e | <ide><path>src/display/api.js
<ide> function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
<ide> * parsed font data from the worker-thread. This may be useful for debugging
<ide> * purposes (and backwards compatibility), but note that it will lead to
<ide> * increased memory usage. The default value is `false`.
<add> * @property {HTMLDocument} [ownerDocument] - Specify an explicit document
<add> * context to create elements with and to load resources, such as fonts,
<add> * into. Defaults to the current document.
<ide> * @property {boolean} [disableRange] - Disable range request loading
<ide> * of PDF files. When enabled, and if the server supports partial content
<ide> * requests, then the PDF will be fetched in chunks.
<ide> function getDocument(src) {
<ide> if (typeof params.disableFontFace !== "boolean") {
<ide> params.disableFontFace = apiCompatibilityParams.disableFontFace || false;
<ide> }
<add> if (typeof params.ownerDocument === "undefined") {
<add> params.ownerDocument = globalThis.document;
<add> }
<ide>
<ide> if (typeof params.disableRange !== "boolean") {
<ide> params.disableRange = false;
<ide> class PDFDocumentProxy {
<ide> * @alias PDFPageProxy
<ide> */
<ide> class PDFPageProxy {
<del> constructor(pageIndex, pageInfo, transport, pdfBug = false) {
<add> constructor(pageIndex, pageInfo, transport, ownerDocument, pdfBug = false) {
<ide> this._pageIndex = pageIndex;
<ide> this._pageInfo = pageInfo;
<add> this._ownerDocument = ownerDocument;
<ide> this._transport = transport;
<ide> this._stats = pdfBug ? new StatTimer() : null;
<ide> this._pdfBug = pdfBug;
<ide> class PDFPageProxy {
<ide> intentState.streamReaderCancelTimeout = null;
<ide> }
<ide>
<del> const canvasFactoryInstance = canvasFactory || new DefaultCanvasFactory();
<add> const canvasFactoryInstance =
<add> canvasFactory ||
<add> new DefaultCanvasFactory({ ownerDocument: this._ownerDocument });
<ide> const webGLContext = new WebGLContext({
<ide> enable: enableWebGL,
<ide> });
<ide> class WorkerTransport {
<ide> this.fontLoader = new FontLoader({
<ide> docId: loadingTask.docId,
<ide> onUnsupportedFeature: this._onUnsupportedFeature.bind(this),
<add> ownerDocument: params.ownerDocument,
<ide> });
<ide> this._params = params;
<ide> this.CMapReaderFactory = new params.CMapReaderFactory({
<ide> class WorkerTransport {
<ide> pageIndex,
<ide> pageInfo,
<ide> this,
<add> this._params.ownerDocument,
<ide> this._params.pdfBug
<ide> );
<ide> this.pageCache[pageIndex] = page;
<ide><path>src/display/display_utils.js
<ide> class BaseCanvasFactory {
<ide> }
<ide>
<ide> class DOMCanvasFactory extends BaseCanvasFactory {
<add> constructor({ ownerDocument = globalThis.document } = {}) {
<add> super();
<add> this._document = ownerDocument;
<add> }
<add>
<ide> create(width, height) {
<ide> if (width <= 0 || height <= 0) {
<ide> throw new Error("Invalid canvas size");
<ide> }
<del> const canvas = document.createElement("canvas");
<add> const canvas = this._document.createElement("canvas");
<ide> const context = canvas.getContext("2d");
<ide> canvas.width = width;
<ide> canvas.height = height;
<ide><path>src/display/font_loader.js
<ide> import {
<ide> } from "../shared/util.js";
<ide>
<ide> class BaseFontLoader {
<del> constructor({ docId, onUnsupportedFeature }) {
<add> constructor({
<add> docId,
<add> onUnsupportedFeature,
<add> ownerDocument = globalThis.document,
<add> }) {
<ide> if (this.constructor === BaseFontLoader) {
<ide> unreachable("Cannot initialize BaseFontLoader.");
<ide> }
<ide> this.docId = docId;
<ide> this._onUnsupportedFeature = onUnsupportedFeature;
<add> this._document = ownerDocument;
<ide>
<ide> this.nativeFontFaces = [];
<ide> this.styleElement = null;
<ide> }
<ide>
<ide> addNativeFontFace(nativeFontFace) {
<ide> this.nativeFontFaces.push(nativeFontFace);
<del> document.fonts.add(nativeFontFace);
<add> this._document.fonts.add(nativeFontFace);
<ide> }
<ide>
<ide> insertRule(rule) {
<ide> let styleElement = this.styleElement;
<ide> if (!styleElement) {
<del> styleElement = this.styleElement = document.createElement("style");
<add> styleElement = this.styleElement = this._document.createElement("style");
<ide> styleElement.id = `PDFJS_FONT_STYLE_TAG_${this.docId}`;
<del> document.documentElement
<add> this._document.documentElement
<ide> .getElementsByTagName("head")[0]
<ide> .appendChild(styleElement);
<ide> }
<ide> class BaseFontLoader {
<ide> }
<ide>
<ide> clear() {
<del> this.nativeFontFaces.forEach(function (nativeFontFace) {
<del> document.fonts.delete(nativeFontFace);
<add> this.nativeFontFaces.forEach(nativeFontFace => {
<add> this._document.fonts.delete(nativeFontFace);
<ide> });
<ide> this.nativeFontFaces.length = 0;
<ide>
<ide> class BaseFontLoader {
<ide> }
<ide>
<ide> get isFontLoadingAPISupported() {
<del> const supported = typeof document !== "undefined" && !!document.fonts;
<add> const supported =
<add> typeof this._document !== "undefined" && !!this._document.fonts;
<ide> return shadow(this, "isFontLoadingAPISupported", supported);
<ide> }
<ide>
<ide> if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
<ide> // PDFJSDev.test('CHROME || GENERIC')
<ide>
<ide> FontLoader = class GenericFontLoader extends BaseFontLoader {
<del> constructor(docId) {
<del> super(docId);
<add> constructor(params) {
<add> super(params);
<ide> this.loadingContext = {
<ide> requests: [],
<ide> nextRequestId: 0,
<ide> if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
<ide> let i, ii;
<ide>
<ide> // The temporary canvas is used to determine if fonts are loaded.
<del> const canvas = document.createElement("canvas");
<add> const canvas = this._document.createElement("canvas");
<ide> canvas.width = 1;
<ide> canvas.height = 1;
<ide> const ctx = canvas.getContext("2d");
<ide> if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
<ide> }
<ide> names.push(loadTestFontId);
<ide>
<del> const div = document.createElement("div");
<add> const div = this._document.createElement("div");
<ide> div.style.visibility = "hidden";
<ide> div.style.width = div.style.height = "10px";
<ide> div.style.position = "absolute";
<ide> div.style.top = div.style.left = "0px";
<ide>
<ide> for (i = 0, ii = names.length; i < ii; ++i) {
<del> const span = document.createElement("span");
<add> const span = this._document.createElement("span");
<ide> span.textContent = "Hi";
<ide> span.style.fontFamily = names[i];
<ide> div.appendChild(span);
<ide> }
<del> document.body.appendChild(div);
<add> this._document.body.appendChild(div);
<ide>
<del> isFontReady(loadTestFontId, function () {
<del> document.body.removeChild(div);
<add> isFontReady(loadTestFontId, () => {
<add> this._document.body.removeChild(div);
<ide> request.complete();
<ide> });
<ide> /** Hack end */
<ide><path>src/display/text_layer.js
<ide> var renderTextLayer = (function renderTextLayerClosure() {
<ide> this._textContent = textContent;
<ide> this._textContentStream = textContentStream;
<ide> this._container = container;
<add> this._document = container.ownerDocument;
<ide> this._viewport = viewport;
<ide> this._textDivs = textDivs || [];
<ide> this._textContentItemsStr = textContentItemsStr || [];
<ide> var renderTextLayer = (function renderTextLayerClosure() {
<ide> let styleCache = Object.create(null);
<ide>
<ide> // The temporary canvas is used to measure text length in the DOM.
<del> const canvas = document.createElement("canvas");
<add> const canvas = this._document.createElement("canvas");
<ide> if (
<ide> typeof PDFJSDev === "undefined" ||
<ide> PDFJSDev.test("MOZCENTRAL || GENERIC")
<ide><path>test/unit/custom_spec.js
<ide> describe("custom canvas rendering", function () {
<ide> .catch(done.fail);
<ide> });
<ide> });
<add>
<add>describe("alternate document context", function () {
<add> const FontFace = global.FontFace;
<add>
<add> let altDocument;
<add> let CanvasFactory;
<add> let elements;
<add>
<add> beforeEach(() => {
<add> global.FontFace = function MockFontFace(name) {
<add> this.family = name;
<add> };
<add>
<add> elements = [];
<add> const createElement = name => {
<add> const element = {
<add> tagName: name,
<add> remove() {
<add> this.remove.called = true;
<add> },
<add> };
<add> if (name === "style") {
<add> element.sheet = {
<add> cssRules: [],
<add> insertRule(rule) {
<add> this.cssRules.push(rule);
<add> },
<add> };
<add> }
<add> elements.push(element);
<add> return element;
<add> };
<add> altDocument = {
<add> fonts: new Set(),
<add> createElement,
<add> documentElement: {
<add> getElementsByTagName: () => [{ appendChild: () => {} }],
<add> },
<add> };
<add>
<add> CanvasFactory = isNodeJS
<add> ? new NodeCanvasFactory()
<add> : new DOMCanvasFactory({ ownerDocument: altDocument });
<add> });
<add>
<add> afterEach(() => {
<add> global.FontFace = FontFace;
<add> CanvasFactory = null;
<add> elements = null;
<add> });
<add>
<add> it("should use given document for loading fonts (with Font Loading API)", async function () {
<add> const getDocumentParams = buildGetDocumentParams(
<add> "TrueType_without_cmap.pdf",
<add> {
<add> disableFontFace: false,
<add> ownerDocument: altDocument,
<add> }
<add> );
<add>
<add> const loadingTask = getDocument(getDocumentParams);
<add> const doc = await loadingTask.promise;
<add> const page = await doc.getPage(1);
<add>
<add> const viewport = page.getViewport({ scale: 1 });
<add> const canvasAndCtx = CanvasFactory.create(viewport.width, viewport.height);
<add>
<add> await page.render({
<add> canvasContext: canvasAndCtx.context,
<add> viewport,
<add> }).promise;
<add>
<add> expect(elements).toEqual([]);
<add> expect(altDocument.fonts.size).toBe(1);
<add> const [font] = Array.from(altDocument.fonts);
<add> expect(font.family).toMatch(/g_d\d+_f1/);
<add>
<add> await doc.destroy();
<add> await loadingTask.destroy();
<add> CanvasFactory.destroy(canvasAndCtx);
<add> expect(altDocument.fonts.size).toBe(0);
<add> });
<add>
<add> it("should use given document for loading fonts (with CSS rules)", async function () {
<add> altDocument.fonts = null;
<add> const getDocumentParams = buildGetDocumentParams(
<add> "TrueType_without_cmap.pdf",
<add> {
<add> disableFontFace: false,
<add> ownerDocument: altDocument,
<add> }
<add> );
<add>
<add> const loadingTask = getDocument(getDocumentParams);
<add> const doc = await loadingTask.promise;
<add> const page = await doc.getPage(1);
<add>
<add> const viewport = page.getViewport({ scale: 1 });
<add> const canvasAndCtx = CanvasFactory.create(viewport.width, viewport.height);
<add>
<add> await page.render({
<add> canvasContext: canvasAndCtx.context,
<add> viewport,
<add> }).promise;
<add>
<add> const style = elements.find(element => element.tagName === "style");
<add> expect(style.sheet.cssRules.length).toBe(1);
<add> expect(style.sheet.cssRules[0]).toMatch(
<add> /^@font-face {font-family:"g_d\d+_f1";src:/
<add> );
<add> await doc.destroy();
<add> await loadingTask.destroy();
<add> CanvasFactory.destroy(canvasAndCtx);
<add> expect(style.remove.called).toBe(true);
<add> });
<add>}); | 5 |
Text | Text | use openpgp.org for keyserver examples | d274d63de211140b598e3117c82a23d6713c98c8 | <ide><path>README.md
<ide> For Current and LTS, the GPG detached signature of `SHASUMS256.txt` is in
<ide> import the keys:
<ide>
<ide> ```console
<del>$ gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D
<add>$ gpg --keyserver hkps://keys.openpgp.org --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D
<ide> ```
<ide>
<ide> See the bottom of this README for a full script to import active release keys.
<ide> To import the full set of trusted release keys (including subkeys possibly used
<ide> to sign releases):
<ide>
<ide> ```bash
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys 74F12602B6F1C4E913FAA37AD3A89613643B6201
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys A48C2BEE680E841632CD4E44F07496B3EB3C1762
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys 108F52B48DB57BB0CC439B2997B01419BD92F80A
<del>gpg --keyserver pool.sks-keyservers.net --recv-keys B9E2F5981AA6E0CD28160D9FF13993A75599653C
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys 74F12602B6F1C4E913FAA37AD3A89613643B6201
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys A48C2BEE680E841632CD4E44F07496B3EB3C1762
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys 108F52B48DB57BB0CC439B2997B01419BD92F80A
<add>gpg --keyserver hkps://keys.openpgp.org --recv-keys B9E2F5981AA6E0CD28160D9FF13993A75599653C
<ide> ```
<ide>
<ide> See the section above on [Verifying binaries](#verifying-binaries) for how to | 1 |
Ruby | Ruby | add new command | 11d47e8325f50ab7993f3fca0432876da0ea1c11 | <ide><path>Library/Homebrew/dev-cmd/boneyard-formula-pr.rb
<add># Creates a pull request to boneyard a formula.
<add>#
<add># Usage: brew boneyard-formula-pr [options...] <formula-name>
<add>#
<add># Options:
<add># --dry-run: Print what would be done rather than doing it.
<add>
<add>require "formula"
<add>require "utils/json"
<add>require "fileutils"
<add>
<add>begin
<add> require "json"
<add>rescue LoadError
<add> puts "Homebrew does not provide Ruby dependencies; install with:"
<add> puts " gem install json"
<add> odie "Dependency json is not installed."
<add>end
<add>
<add>module Homebrew
<add> def boneyard_formula_pr
<add> formula = ARGV.formulae.first
<add> odie "No formula found!" unless formula
<add>
<add> formula_relpath = formula.path.relative_path_from(formula.tap.path)
<add> formula_file = "#{formula.name}.rb"
<add> bottle_block = File.read(formula.path).include? " bottle do"
<add> boneyard_tap = Tap.fetch("homebrew", "boneyard")
<add> tap_migrations_path = formula.tap.path/"tap_migrations.json"
<add> if ARGV.dry_run?
<add> puts "brew update"
<add> puts "brew tap #{boneyard_tap.name}"
<add> puts "cd #{formula.tap.path}"
<add> cd formula.tap.path
<add> puts "cp #{formula_relpath} #{boneyard_tap.path}"
<add> puts "git rm #{formula_relpath}"
<add> unless File.exist? tap_migrations_path
<add> puts "Creating tap_migrations.json for #{formula.tap.name}"
<add> puts "git add #{tap_migrations_path}"
<add> end
<add> puts "Loading tap_migrations.json"
<add> puts "Adding #{formula.name} to tap_migrations.json"
<add> else
<add> safe_system HOMEBREW_BREW_FILE, "update"
<add> safe_system HOMEBREW_BREW_FILE, "tap", boneyard_tap.name
<add> cd formula.tap.path
<add> cp formula_relpath, boneyard_tap.formula_dir
<add> safe_system "git", "rm", formula_relpath
<add> unless File.exist? tap_migrations_path
<add> tap_migrations_path.write <<-EOS.undent
<add> {
<add> }
<add> EOS
<add> safe_system "git", "add", tap_migrations_path
<add> end
<add> tap_migrations = Utils::JSON.load(File.read(tap_migrations_path))
<add> tap_migrations[formula.name] = boneyard_tap.name
<add> tap_migrations = tap_migrations.sort.inject({}) { |a, e| a.merge!(e[0] => e[1]) }
<add> tap_migrations_path.atomic_write(JSON.pretty_generate(tap_migrations) + "\n")
<add> end
<add> unless Formula["hub"].any_version_installed?
<add> if ARGV.dry_run?
<add> puts "brew install hub"
<add> else
<add> safe_system HOMEBREW_BREW_FILE, "install", "hub"
<add> end
<add> end
<add> branch = "#{formula.name}-boneyard"
<add> if ARGV.dry_run?
<add> puts "cd #{formula.tap.path}"
<add> puts "git checkout -b #{branch} origin/master"
<add> puts "git commit --no-edit --verbose --message=\"#{formula.name}: migrate to boneyard\" -- #{formula_relpath} #{tap_migrations_path.basename}"
<add> puts "hub fork --no-remote"
<add> puts "hub fork"
<add> puts "hub fork (to read $HUB_REMOTE)"
<add> puts "git push $HUB_REMOTE #{branch}:#{branch}"
<add> puts "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`.'"
<add> else
<add> cd formula.tap.path
<add> safe_system "git", "checkout", "-b", branch, "origin/master"
<add> safe_system "git", "commit", "--no-edit", "--verbose",
<add> "--message=#{formula.name}: migrate to boneyard",
<add> "--", formula_relpath, tap_migrations_path.basename
<add> safe_system "hub", "fork", "--no-remote"
<add> quiet_system "hub", "fork"
<add> remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists./, 1]
<add> odie "cannot get remote from 'hub'!" unless remote
<add> safe_system "git", "push", remote, "#{branch}:#{branch}"
<add> pr_message = <<-EOS.undent
<add> #{formula.name}: migrate to boneyard
<add>
<add> Created with `brew boneyard-formula-pr`.
<add> EOS
<add> pr_url = Utils.popen_read("hub", "pull-request", "-m", pr_message).chomp
<add> end
<add>
<add> if ARGV.dry_run?
<add> puts "cd #{boneyard_tap.path}"
<add> puts "git checkout -b #{branch} origin/master"
<add> if bottle_block
<add> puts "Removing bottle block"
<add> else
<add> puts "No bottle block to remove"
<add> end
<add> puts "git add #{formula_file}"
<add> puts "git commit --no-edit --verbose --message=\"#{formula.name}: migrate from #{formula.tap.repo}\" -- #{formula_file}"
<add> puts "hub fork --no-remote"
<add> puts "hub fork"
<add> puts "hub fork (to read $HUB_REMOTE)"
<add> puts "git push $HUB_REMOTE #{branch}:#{branch}"
<add> puts "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`.'"
<add> else
<add> cd boneyard_tap.formula_dir
<add> safe_system "git", "checkout", "-b", branch, "origin/master"
<add> if bottle_block
<add> Utils::Inreplace.inreplace formula_file, / bottle do.+?end\n\n/m, ""
<add> end
<add> safe_system "git", "add", formula_file
<add> safe_system "git", "commit", "--no-edit", "--verbose",
<add> "--message=#{formula.name}: migrate from #{formula.tap.repo}",
<add> "--", formula_file
<add> safe_system "hub", "fork", "--no-remote"
<add> quiet_system "hub", "fork"
<add> remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists./, 1]
<add> odie "cannot get remote from 'hub'!" unless remote
<add> safe_system "git", "push", remote, "#{branch}:#{branch}"
<add> safe_system "hub", "pull-request", "--browse", "-m", <<-EOS.undent
<add> #{formula.name}: migrate from #{formula.tap.repo}
<add>
<add> Goes together with #{pr_url}.
<add>
<add> Created with `brew boneyard-formula-pr`.
<add> EOS
<add> end
<add> end
<add>end | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.