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
|
|---|---|---|---|---|---|
Python
|
Python
|
standardize aws redshift naming
|
88ea1575079c0e94e1f62df38d6d592b8c827bbd
|
<ide><path>airflow/providers/amazon/aws/sensors/redshift.py
<ide> # under the License.
<ide> import warnings
<ide>
<del>from airflow.providers.amazon.aws.sensors.redshift_cluster import AwsRedshiftClusterSensor
<add>from airflow.providers.amazon.aws.sensors.redshift_cluster import RedshiftClusterSensor
<add>
<add>AwsRedshiftClusterSensor = RedshiftClusterSensor
<ide>
<ide> warnings.warn(
<ide> "This module is deprecated. Please use `airflow.providers.amazon.aws.sensors.redshift_cluster`.",
<ide> DeprecationWarning,
<ide> stacklevel=2,
<ide> )
<ide>
<del>__all__ = ["AwsRedshiftClusterSensor"]
<add>__all__ = ["AwsRedshiftClusterSensor", "RedshiftClusterSensor"]
<ide><path>airflow/providers/amazon/aws/sensors/redshift_cluster.py
<ide> # KIND, either express or implied. See the License for the
<ide> # specific language governing permissions and limitations
<ide> # under the License.
<del>
<ide> from typing import TYPE_CHECKING, Optional, Sequence
<ide>
<ide> from airflow.providers.amazon.aws.hooks.redshift_cluster import RedshiftHook
<ide> from airflow.utils.context import Context
<ide>
<ide>
<del>class AwsRedshiftClusterSensor(BaseSensorOperator):
<add>class RedshiftClusterSensor(BaseSensorOperator):
<ide> """
<ide> Waits for a Redshift cluster to reach a specific status.
<ide>
<ide><path>dev/provider_packages/prepare_provider_packages.py
<ide> def summarise_total_vs_bad_and_warnings(total: int, bad: int, warns: List[warnin
<ide> 'This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.emr`.',
<ide> 'This module is deprecated. Please use `airflow.providers.opsgenie.hooks.opsgenie`.',
<ide> 'This module is deprecated. Please use `airflow.providers.opsgenie.operators.opsgenie`.',
<add> 'This module is deprecated. Please use `airflow.hooks.redshift_sql` '
<add> 'or `airflow.hooks.redshift_cluster` as appropriate.',
<add> 'This module is deprecated. Please use `airflow.providers.amazon.aws.operators.redshift_sql` or '
<add> '`airflow.providers.amazon.aws.operators.redshift_cluster` as appropriate.',
<add> 'This module is deprecated. Please use `airflow.providers.amazon.aws.sensors.redshift_cluster`.',
<ide> }
<ide>
<ide>
<ide><path>tests/deprecated_classes.py
<ide> "airflow.providers.amazon.aws.sensors.s3.S3PrefixSensor",
<ide> "airflow.providers.amazon.aws.sensors.s3_prefix.S3PrefixSensor",
<ide> ),
<add> (
<add> "airflow.providers.amazon.aws.sensors.redshift_cluster.RedshiftClusterSensor",
<add> "airflow.providers.amazon.aws.sensors.redshift.RedshiftClusterSensor",
<add> ),
<ide> ]
<ide>
<ide> TRANSFERS = [
<ide><path>tests/providers/amazon/aws/sensors/test_redshift_cluster.py
<ide>
<ide> import boto3
<ide>
<del>from airflow.providers.amazon.aws.sensors.redshift_cluster import AwsRedshiftClusterSensor
<add>from airflow.providers.amazon.aws.sensors.redshift_cluster import RedshiftClusterSensor
<ide>
<ide> try:
<ide> from moto import mock_redshift
<ide> except ImportError:
<ide> mock_redshift = None
<ide>
<ide>
<del>class TestAwsRedshiftClusterSensor(unittest.TestCase):
<add>class TestRedshiftClusterSensor(unittest.TestCase):
<ide> @staticmethod
<ide> def _create_cluster():
<ide> client = boto3.client('redshift', region_name='us-east-1')
<ide> def _create_cluster():
<ide> @mock_redshift
<ide> def test_poke(self):
<ide> self._create_cluster()
<del> op = AwsRedshiftClusterSensor(
<add> op = RedshiftClusterSensor(
<ide> task_id='test_cluster_sensor',
<ide> poke_interval=1,
<ide> timeout=5,
<ide> aws_conn_id='aws_default',
<ide> cluster_identifier='test_cluster',
<ide> target_status='available',
<ide> )
<del> assert op.poke(None)
<add> assert op.poke({})
<ide>
<ide> @unittest.skipIf(mock_redshift is None, 'mock_redshift package not present')
<ide> @mock_redshift
<ide> def test_poke_false(self):
<ide> self._create_cluster()
<del> op = AwsRedshiftClusterSensor(
<add> op = RedshiftClusterSensor(
<ide> task_id='test_cluster_sensor',
<ide> poke_interval=1,
<ide> timeout=5,
<ide> def test_poke_false(self):
<ide> target_status='available',
<ide> )
<ide>
<del> assert not op.poke(None)
<add> assert not op.poke({})
<ide>
<ide> @unittest.skipIf(mock_redshift is None, 'mock_redshift package not present')
<ide> @mock_redshift
<ide> def test_poke_cluster_not_found(self):
<ide> self._create_cluster()
<del> op = AwsRedshiftClusterSensor(
<add> op = RedshiftClusterSensor(
<ide> task_id='test_cluster_sensor',
<ide> poke_interval=1,
<ide> timeout=5,
<ide> def test_poke_cluster_not_found(self):
<ide> target_status='cluster_not_found',
<ide> )
<ide>
<del> assert op.poke(None)
<add> assert op.poke({})
| 5
|
Go
|
Go
|
use --numeric-owner for tar and untar
|
d7d42ff4feab59ca6566addc20926a27aeaba8ef
|
<ide><path>archive.go
<ide> func Tar(path string, compression Compression) (io.Reader, error) {
<ide> // Tar creates an archive from the directory at `path`, only including files whose relative
<ide> // paths are included in `filter`. If `filter` is nil, then all files are included.
<ide> func TarFilter(path string, compression Compression, filter []string) (io.Reader, error) {
<del> args := []string{"tar", "-f", "-", "-C", path}
<add> args := []string{"tar", "--numeric-owner", "-f", "-", "-C", path}
<ide> if filter == nil {
<ide> filter = []string{"."}
<ide> }
<ide> func Untar(archive io.Reader, path string) error {
<ide>
<ide> utils.Debugf("Archive compression detected: %s", compression.Extension())
<ide>
<del> cmd := exec.Command("tar", "-f", "-", "-C", path, "-x"+compression.Flag())
<add> cmd := exec.Command("tar", "--numeric-owner", "-f", "-", "-C", path, "-x"+compression.Flag())
<ide> cmd.Stdin = bufferedArchive
<ide> // Hardcode locale environment for predictable outcome regardless of host configuration.
<ide> // (see https://github.com/dotcloud/docker/issues/355)
| 1
|
Javascript
|
Javascript
|
use var instead of const
|
a355aa803bb47d0725bf17bf39e9a0a8865e981b
|
<ide><path>src/math/Box3.js
<ide> Object.assign( Box3.prototype, {
<ide> // transform of empty box is an empty box.
<ide> if ( this.isEmpty( ) ) return this;
<ide>
<del> const m = matrix.elements;
<add> var m = matrix.elements;
<ide>
<del> const xax = m[ 0 ] * this.min.x;
<del> const xay = m[ 1 ] * this.min.x;
<del> const xaz = m[ 2 ] * this.min.x;
<add> var xax = m[ 0 ] * this.min.x;
<add> var xay = m[ 1 ] * this.min.x;
<add> var xaz = m[ 2 ] * this.min.x;
<ide>
<del> const xbx = m[ 0 ] * this.max.x;
<del> const xby = m[ 1 ] * this.max.x;
<del> const xbz = m[ 2 ] * this.max.x;
<add> var xbx = m[ 0 ] * this.max.x;
<add> var xby = m[ 1 ] * this.max.x;
<add> var xbz = m[ 2 ] * this.max.x;
<ide>
<del> const yax = m[ 4 ] * this.min.y;
<del> const yay = m[ 5 ] * this.min.y;
<del> const yaz = m[ 6 ] * this.min.y;
<add> var yax = m[ 4 ] * this.min.y;
<add> var yay = m[ 5 ] * this.min.y;
<add> var yaz = m[ 6 ] * this.min.y;
<ide>
<del> const ybx = m[ 4 ] * this.max.y;
<del> const yby = m[ 5 ] * this.max.y;
<del> const ybz = m[ 6 ] * this.max.y;
<add> var ybx = m[ 4 ] * this.max.y;
<add> var yby = m[ 5 ] * this.max.y;
<add> var ybz = m[ 6 ] * this.max.y;
<ide>
<del> const zax = m[ 8 ] * this.min.z;
<del> const zay = m[ 9 ] * this.min.z;
<del> const zaz = m[ 10 ] * this.min.z;
<add> var zax = m[ 8 ] * this.min.z;
<add> var zay = m[ 9 ] * this.min.z;
<add> var zaz = m[ 10 ] * this.min.z;
<ide>
<del> const zbx = m[ 8 ] * this.max.z;
<del> const zby = m[ 9 ] * this.max.z;
<del> const zbz = m[ 10 ] * this.max.z;
<add> var zbx = m[ 8 ] * this.max.z;
<add> var zby = m[ 9 ] * this.max.z;
<add> var zbz = m[ 10 ] * this.max.z;
<ide>
<ide> this.min.x = Math.min( xax, xbx ) + Math.min( yax, ybx ) + Math.min( zax, zbx ) + m[ 12 ];
<ide> this.min.y = Math.min( xay, xby ) + Math.min( yay, yby ) + Math.min( zay, zby ) + m[ 13 ];
| 1
|
PHP
|
PHP
|
remove periods from optimize command
|
ad98047f612e66f14c279dd64a642c83cdc01787
|
<ide><path>src/Illuminate/Foundation/Console/OptimizeCommand.php
<ide> public function __construct(Composer $composer)
<ide> */
<ide> public function fire()
<ide> {
<del> $this->info('Generating optimized class loader...');
<add> $this->info('Generating optimized class loader');
<ide>
<ide> $this->composer->dumpOptimized();
<ide>
<del> $this->info('Compiling common classes...');
<add> $this->info('Compiling common classes');
<ide>
<ide> $this->compileClasses();
<ide> }
| 1
|
Javascript
|
Javascript
|
add test for
|
3e033ffeb8f69e7f386afc632b107bd60b2cb1ae
|
<ide><path>packages/ember-old-router/tests/view_test.js
<add>var set = Ember.set, get = Ember.get;
<add>
<add>module("Ember.View - Old Router Functionality", {
<add> setup: function() {
<add> Ember.TEMPLATES = {};
<add> }
<add>});
<add>
<add>test("should load named templates from View.templates", function() {
<add> var view;
<add>
<add>
<add> view = Ember.View.create({
<add> templates: {
<add> testTemplate: function() {
<add> return "<h1 id='old-router-template-was-called'>template was called</h1>";
<add> }
<add> },
<add> templateName: 'testTemplate'
<add> });
<add>
<add> Ember.run(function(){
<add> view.createElement();
<add> });
<add>
<add> ok(view.$('#old-router-template-was-called').length, "the named template was called");
<add>});
| 1
|
Javascript
|
Javascript
|
ensure reflexivity of deepequal
|
aae51ecf7d407b2fb56c1f3e1edf91a16940c973
|
<ide><path>lib/assert.js
<ide> function objEquiv(a, b) {
<ide> if (a.prototype !== b.prototype) return false;
<ide> //~~~I've managed to break Object.keys through screwy arguments passing.
<ide> // Converting to array solves the problem.
<del> if (isArguments(a)) {
<del> if (!isArguments(b)) {
<del> return false;
<del> }
<add> var aIsArgs = isArguments(a),
<add> bIsArgs = isArguments(b);
<add> if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
<add> return false;
<add> if (aIsArgs) {
<ide> a = pSlice.call(a);
<ide> b = pSlice.call(b);
<ide> return _deepEqual(a, b);
<ide><path>test/simple/test-assert.js
<ide> try {
<ide> gotError = true;
<ide> }
<ide>
<add>// GH-7178. Ensure reflexivity of deepEqual with `arguments` objects.
<add>var args = (function() { return arguments; })();
<add>a.throws(makeBlock(a.deepEqual, [], args));
<add>a.throws(makeBlock(a.deepEqual, args, []));
<add>
<ide> console.log('All OK');
<ide> assert.ok(gotError);
<ide>
| 2
|
Python
|
Python
|
use augmented assignment
|
d8d13fadc91e3dca0ace8d0f8743911f9f2cb1b8
|
<ide><path>airflow/www/views.py
<ide> def gantt(self, session=None):
<ide> end_date = failed_task_instance.end_date or timezone.utcnow()
<ide> start_date = failed_task_instance.start_date or end_date
<ide> if tf_count != 0 and failed_task_instance.task_id == prev_task_id:
<del> try_count = try_count + 1
<add> try_count += 1
<ide> else:
<ide> try_count = 1
<ide> prev_task_id = failed_task_instance.task_id
<ide> gantt_bar_items.append((failed_task_instance.task_id, start_date, end_date, State.FAILED,
<ide> try_count))
<del> tf_count = tf_count + 1
<add> tf_count += 1
<ide> task = dag.get_task(failed_task_instance.task_id)
<ide> task_dict = alchemy_to_dict(failed_task_instance)
<ide> task_dict['state'] = State.FAILED
| 1
|
Text
|
Text
|
add security section to readme.md
|
8ac50819b69f962c13f9b436e0c7c5488276a6fd
|
<ide><path>README.md
<ide> Instructions:
<ide> [#io.js on Freenode.net](http://webchat.freenode.net?channels=io.js&uio=d4)
<ide> * [iojs/io.js on Gitter](https://gitter.im/nodejs/io.js)
<ide>
<add>## Security
<ide>
<add>All security bugs in io.js are taken seriously and should be reported by
<add>emailing security@iojs.org. This will be delivered to a subset of the project
<add>team who handle security issues. Please don't disclose security bugs
<add>public until they have been handled by the security team.
<add>
<add>Your email will be acknowledged within 24 hours, and you’ll receive a more
<add>detailed response to your email within 48 hours indicating the next steps in
<add>handling your report.
<ide>
<ide> ## Current Project Team Members
<ide>
| 1
|
Ruby
|
Ruby
|
add helpers for formula tests
|
c003e805bea98f6d0be62c0938ccad4f4a7e4ce0
|
<ide><path>Library/Homebrew/cmd/test.rb
<ide> module Homebrew
<ide> FailedAssertion = Test::Unit::AssertionFailedError
<ide> end
<ide>
<add> require "formula_assertions"
<add>
<ide> def test
<ide> raise FormulaUnspecifiedError if ARGV.named.empty?
<ide>
<ide> def test
<ide> puts "Testing #{f.name}"
<ide>
<ide> f.extend(Test::Unit::Assertions)
<add> f.extend(Homebrew::Assertions)
<ide>
<ide> begin
<ide> # tests can also return false to indicate failure
<ide><path>Library/Homebrew/formula_assertions.rb
<add>require 'test/unit/assertions'
<add>
<add>module Homebrew
<add> module Assertions
<add> include Test::Unit::Assertions
<add>
<add> # Returns the output of running cmd, and asserts the exit status
<add> def shell_output(cmd, result=0)
<add> output = `#{cmd}`
<add> assert_equal result, $?.exitstatus
<add> output
<add> end
<add>
<add> # Returns the output of running the cmd, with the optional input
<add> def pipe_output(cmd, input=nil)
<add> IO.popen(cmd, "w+") do |pipe|
<add> pipe.write(input) unless input.nil?
<add> pipe.close_write
<add> pipe.read
<add> end
<add> end
<add> end
<add>end
| 2
|
PHP
|
PHP
|
remove depecated code from datasource classes
|
6ef27d293be14764b1a8f97d85dbba888e6236b6
|
<ide><path>src/Datasource/ConnectionInterface.php
<ide> public function disableConstraints(callable $operation);
<ide> * @return bool
<ide> */
<ide> public function logQueries($enable = null);
<del>
<del> /**
<del> * Sets the logger object instance. When called with no arguments
<del> * it returns the currently setup logger instance.
<del> *
<del> * @param object|null $instance logger object instance
<del> * @return object logger instance
<del> * @deprecated 3.5.0 Will be replaced by getLogger()/setLogger()
<del> */
<del> public function logger($instance = null);
<ide> }
<ide><path>src/Datasource/EntityInterface.php
<ide> public function has($property);
<ide> */
<ide> public function unsetProperty($property);
<ide>
<del> /**
<del> * Get/Set the hidden properties on this entity.
<del> *
<del> * If the properties argument is null, the currently hidden properties
<del> * will be returned. Otherwise the hidden properties will be set.
<del> *
<del> * @param null|array $properties Either an array of properties to hide or null to get properties
<del> * @return array|\Cake\Datasource\EntityInterface
<del> */
<del> public function hiddenProperties($properties = null);
<del>
<del> /**
<del> * Get/Set the virtual properties on this entity.
<del> *
<del> * If the properties argument is null, the currently virtual properties
<del> * will be returned. Otherwise the virtual properties will be set.
<del> *
<del> * @param null|array $properties Either an array of properties to treat as virtual or null to get properties
<del> * @return array|\Cake\Datasource\EntityInterface
<del> */
<del> public function virtualProperties($properties = null);
<del>
<ide> /**
<ide> * Get the list of visible properties.
<ide> *
<ide> public function toArray();
<ide> */
<ide> public function extract(array $properties, $onlyDirty = false);
<ide>
<del> /**
<del> * Sets the dirty status of a single property. If called with no second
<del> * argument, it will return whether the property was modified or not
<del> * after the object creation.
<del> *
<del> * When called with no arguments it will return whether or not there are any
<del> * dirty property in the entity
<del> *
<del> * @deprecated 3.4.0 Use setDirty() and isDirty() instead.
<del> * @param string|null $property the field to set or check status for
<del> * @param null|bool $isDirty true means the property was changed, false means
<del> * it was not changed and null will make the function return current state
<del> * for that property
<del> * @return bool whether the property was changed or not
<del> */
<del> public function dirty($property = null, $isDirty = null);
<del>
<ide> /**
<ide> * Sets the entire entity as clean, which means that it will appear as
<ide> * no properties being modified or added at all. This is an useful call
<ide> public function clean();
<ide> * null otherwise
<ide> */
<ide> public function isNew($new = null);
<del>
<del> /**
<del> * Sets the error messages for a field or a list of fields. When called
<del> * without the second argument it returns the validation
<del> * errors for the specified fields. If called with no arguments it returns
<del> * all the validation error messages stored in this entity.
<del> *
<del> * When used as a setter, this method will return this entity instance for method
<del> * chaining.
<del> *
<del> * @deprecated 3.4.0 Use setErrors() and getErrors() instead.
<del> * @param string|array|null $field The field to get errors for.
<del> * @param string|array|null $errors The errors to be set for $field
<del> * @param bool $overwrite Whether or not to overwrite pre-existing errors for $field
<del> * @return array|\Cake\Datasource\EntityInterface
<del> */
<del> public function errors($field = null, $errors = null, $overwrite = false);
<del>
<del> /**
<del> * Stores whether or not a property value can be changed or set in this entity.
<del> * The special property `*` can also be marked as accessible or protected, meaning
<del> * that any other property specified before will take its value. For example
<del> * `$entity->accessible('*', true)` means that any property not specified already
<del> * will be accessible by default.
<del> *
<del> * @deprecated 3.4.0 Use setAccess() and isAccessible() instead.
<del> * @param string|array $property Either a single or list of properties to change its accessibility.
<del> * @param bool|null $set true marks the property as accessible, false will
<del> * mark it as protected.
<del> * @return \Cake\Datasource\EntityInterface|bool
<del> */
<del> public function accessible($property, $set = null);
<ide> }
<ide><path>src/Datasource/EntityTrait.php
<ide> trait EntityTrait
<ide> */
<ide> protected $_virtual = [];
<ide>
<del> /**
<del> * Holds the name of the class for the instance object
<del> *
<del> * @var string
<del> *
<del> * @deprecated 3.2 This field is no longer being used
<del> */
<del> protected $_className;
<del>
<ide> /**
<ide> * Holds a list of the properties that were modified or added after this object
<ide> * was originally created.
<ide> public function unsetProperty($property)
<ide> return $this;
<ide> }
<ide>
<del> /**
<del> * Get/Set the hidden properties on this entity.
<del> *
<del> * If the properties argument is null, the currently hidden properties
<del> * will be returned. Otherwise the hidden properties will be set.
<del> *
<del> * @deprecated 3.4.0 Use EntityTrait::setHidden() and EntityTrait::getHidden()
<del> * @param null|array $properties Either an array of properties to hide or null to get properties
<del> * @return array|$this
<del> */
<del> public function hiddenProperties($properties = null)
<del> {
<del> deprecationWarning(
<del> get_called_class() . '::hiddenProperties() is deprecated. ' .
<del> 'Use setHidden()/getHidden() instead.'
<del> );
<del> if ($properties === null) {
<del> return $this->_hidden;
<del> }
<del> $this->_hidden = $properties;
<del>
<del> return $this;
<del> }
<del>
<ide> /**
<ide> * Sets hidden properties.
<ide> *
<ide> public function getHidden()
<ide> return $this->_hidden;
<ide> }
<ide>
<del> /**
<del> * Get/Set the virtual properties on this entity.
<del> *
<del> * If the properties argument is null, the currently virtual properties
<del> * will be returned. Otherwise the virtual properties will be set.
<del> *
<del> * @deprecated 3.4.0 Use EntityTrait::getVirtual() and EntityTrait::setVirtual()
<del> * @param null|array $properties Either an array of properties to treat as virtual or null to get properties
<del> * @return array|$this
<del> */
<del> public function virtualProperties($properties = null)
<del> {
<del> deprecationWarning(
<del> get_called_class() . '::virtualProperties() is deprecated. ' .
<del> 'Use setVirtual()/getVirtual() instead.'
<del> );
<del> if ($properties === null) {
<del> return $this->getVirtual();
<del> }
<del>
<del> return $this->setVirtual($properties);
<del> }
<del>
<ide> /**
<ide> * Sets the virtual properties on this entity.
<ide> *
<ide> public function extractOriginalChanged(array $properties)
<ide> return $result;
<ide> }
<ide>
<del> /**
<del> * Sets the dirty status of a single property. If called with no second
<del> * argument, it will return whether the property was modified or not
<del> * after the object creation.
<del> *
<del> * When called with no arguments it will return whether or not there are any
<del> * dirty property in the entity
<del> *
<del> * @deprecated 3.4.0 Use EntityTrait::setDirty() and EntityTrait::isDirty()
<del> * @param string|null $property the field to set or check status for
<del> * @param null|bool $isDirty true means the property was changed, false means
<del> * it was not changed and null will make the function return current state
<del> * for that property
<del> * @return bool Whether the property was changed or not
<del> */
<del> public function dirty($property = null, $isDirty = null)
<del> {
<del> deprecationWarning(
<del> get_called_class() . '::dirty() is deprecated. ' .
<del> 'Use setDirty()/isDirty() instead.'
<del> );
<del> if ($property === null) {
<del> return $this->isDirty();
<del> }
<del>
<del> if ($isDirty === null) {
<del> return $this->isDirty($property);
<del> }
<del>
<del> $this->setDirty($property, $isDirty);
<del>
<del> return true;
<del> }
<del>
<ide> /**
<ide> * Sets the dirty status of a single property.
<ide> *
<ide> public function setError($field, $errors, $overwrite = false)
<ide> return $this->setErrors([$field => $errors], $overwrite);
<ide> }
<ide>
<del> /**
<del> * Sets the error messages for a field or a list of fields. When called
<del> * without the second argument it returns the validation
<del> * errors for the specified fields. If called with no arguments it returns
<del> * all the validation error messages stored in this entity and any other nested
<del> * entity.
<del> *
<del> * ### Example
<del> *
<del> * ```
<del> * // Sets the error messages for a single field
<del> * $entity->errors('salary', ['must be numeric', 'must be a positive number']);
<del> *
<del> * // Returns the error messages for a single field
<del> * $entity->errors('salary');
<del> *
<del> * // Returns all error messages indexed by field name
<del> * $entity->errors();
<del> *
<del> * // Sets the error messages for multiple fields at once
<del> * $entity->errors(['salary' => ['message'], 'name' => ['another message']);
<del> * ```
<del> *
<del> * When used as a setter, this method will return this entity instance for method
<del> * chaining.
<del> *
<del> * @deprecated 3.4.0 Use EntityTrait::setError(), EntityTrait::setErrors(), EntityTrait::getError() and EntityTrait::getErrors()
<del> * @param string|array|null $field The field to get errors for, or the array of errors to set.
<del> * @param string|array|null $errors The errors to be set for $field
<del> * @param bool $overwrite Whether or not to overwrite pre-existing errors for $field
<del> * @return array|$this
<del> */
<del> public function errors($field = null, $errors = null, $overwrite = false)
<del> {
<del> deprecationWarning(
<del> get_called_class() . '::errors() is deprecated. ' .
<del> 'Use setError()/getError() or setErrors()/getErrors() instead.'
<del> );
<del> if ($field === null) {
<del> return $this->getErrors();
<del> }
<del>
<del> if (is_string($field) && $errors === null) {
<del> return $this->getError($field);
<del> }
<del>
<del> if (!is_array($field)) {
<del> $field = [$field => $errors];
<del> }
<del>
<del> return $this->setErrors($field, $overwrite);
<del> }
<del>
<ide> /**
<ide> * Auxiliary method for getting errors in nested entities
<ide> *
<ide> public function setInvalidField($field, $value)
<ide> return $this;
<ide> }
<ide>
<del> /**
<del> * Sets a field as invalid and not patchable into the entity.
<del> *
<del> * This is useful for batch operations when one needs to get the original value for an error message after patching.
<del> * This value could not be patched into the entity and is simply copied into the _invalid property for debugging purposes
<del> * or to be able to log it away.
<del> *
<del> * @deprecated 3.5 Use getInvalid()/getInvalidField()/setInvalid() instead.
<del> * @param string|array|null $field The field to get invalid value for, or the value to set.
<del> * @param mixed|null $value The invalid value to be set for $field.
<del> * @param bool $overwrite Whether or not to overwrite pre-existing values for $field.
<del> * @return $this|mixed
<del> */
<del> public function invalid($field = null, $value = null, $overwrite = false)
<del> {
<del> deprecationWarning(
<del> get_called_class() . '::invalid() is deprecated. ' .
<del> 'Use setInvalid()/getInvalid()/getInvalidField() instead.'
<del> );
<del> if ($field === null) {
<del> return $this->_invalid;
<del> }
<del>
<del> if (is_string($field) && $value === null) {
<del> $value = isset($this->_invalid[$field]) ? $this->_invalid[$field] : null;
<del>
<del> return $value;
<del> }
<del>
<del> if (!is_array($field)) {
<del> $field = [$field => $value];
<del> }
<del>
<del> foreach ($field as $f => $value) {
<del> if ($overwrite) {
<del> $this->_invalid[$f] = $value;
<del> continue;
<del> }
<del> $this->_invalid += [$f => $value];
<del> }
<del>
<del> return $this;
<del> }
<del>
<del> /**
<del> * Stores whether or not a property value can be changed or set in this entity.
<del> * The special property `*` can also be marked as accessible or protected, meaning
<del> * that any other property specified before will take its value. For example
<del> * `$entity->accessible('*', true)` means that any property not specified already
<del> * will be accessible by default.
<del> *
<del> * You can also call this method with an array of properties, in which case they
<del> * will each take the accessibility value specified in the second argument.
<del> *
<del> * ### Example:
<del> *
<del> * ```
<del> * $entity->accessible('id', true); // Mark id as not protected
<del> * $entity->accessible('author_id', false); // Mark author_id as protected
<del> * $entity->accessible(['id', 'user_id'], true); // Mark both properties as accessible
<del> * $entity->accessible('*', false); // Mark all properties as protected
<del> * ```
<del> *
<del> * When called without the second param it will return whether or not the property
<del> * can be set.
<del> *
<del> * ### Example:
<del> *
<del> * ```
<del> * $entity->accessible('id'); // Returns whether it can be set or not
<del> * ```
<del> *
<del> * @deprecated 3.4.0 Use EntityTrait::setAccess() and EntityTrait::isAccessible()
<del> * @param string|array $property single or list of properties to change its accessibility
<del> * @param bool|null $set true marks the property as accessible, false will
<del> * mark it as protected.
<del> * @return $this|bool
<del> */
<del> public function accessible($property, $set = null)
<del> {
<del> deprecationWarning(
<del> get_called_class() . '::accessible() is deprecated. ' .
<del> 'Use setAccess()/isAccessible() instead.'
<del> );
<del> if ($set === null) {
<del> return $this->isAccessible($property);
<del> }
<del>
<del> return $this->setAccess($property, $set);
<del> }
<del>
<ide> /**
<ide> * Stores whether or not a property value can be changed or set in this entity.
<ide> * The special property `*` can also be marked as accessible or protected, meaning
<ide> public function setSource($alias)
<ide> return $this;
<ide> }
<ide>
<del> /**
<del> * Returns the alias of the repository from which this entity came from.
<del> *
<del> * If called with no arguments, it returns the alias of the repository
<del> * this entity came from if it is known.
<del> *
<del> * @deprecated 3.4.0 Use EntityTrait::getSource() and EntityTrait::setSource()
<del> * @param string|null $alias the alias of the repository
<del> * @return string|$this
<del> */
<del> public function source($alias = null)
<del> {
<del> deprecationWarning(
<del> get_called_class() . '::source() is deprecated. ' .
<del> 'Use setSource()/getSource() instead.'
<del> );
<del> if ($alias === null) {
<del> return $this->getSource();
<del> }
<del>
<del> $this->setSource($alias);
<del>
<del> return $this;
<del> }
<del>
<ide> /**
<ide> * Returns a string representation of this object in a human readable format.
<ide> *
<ide><path>src/Datasource/InvalidPropertyInterface.php
<ide> */
<ide> interface InvalidPropertyInterface
<ide> {
<del> /**
<del> * Sets a field as invalid and not patchable into the entity.
<del> *
<del> * This is useful for batch operations when one needs to get the original value for an error message after patching.
<del> * This value could not be patched into the entity and is simply copied into the _invalid property for debugging purposes
<del> * or to be able to log it away.
<del> *
<del> * @param string|array|null $field The field to get invalid value for, or the value to set.
<del> * @param mixed|null $value The invalid value to be set for $field.
<del> * @param bool $overwrite Whether or not to overwrite pre-existing values for $field.
<del> * @return $this|mixed
<del> * @deprecated 3.5.0 Use getInvalid()/getInvalidField() and setInvalid()/setInvalidField() instead.
<del> */
<del> public function invalid($field = null, $value = null, $overwrite = false);
<ide> }
<ide><path>src/Datasource/ModelAwareTrait.php
<ide> public function setModelType($modelType)
<ide>
<ide> return $this;
<ide> }
<del>
<del> /**
<del> * Set or get the model type to be used by this class
<del> *
<del> * @deprecated 3.5.0 Use getModelType()/setModelType() instead.
<del> * @param string|null $modelType The model type or null to retrieve the current
<del> *
<del> * @return string|$this
<del> */
<del> public function modelType($modelType = null)
<del> {
<del> deprecationWarning(
<del> get_called_class() . '::modelType() is deprecated. ' .
<del> 'Use setModelType()/getModelType() instead.'
<del> );
<del> if ($modelType === null) {
<del> return $this->_modelType;
<del> }
<del>
<del> $this->_modelType = $modelType;
<del>
<del> return $this;
<del> }
<ide> }
<ide><path>src/Datasource/QueryInterface.php
<ide> public function toArray();
<ide> * Returns the default repository object that will be used by this query,
<ide> * that is, the repository that will appear in the from clause.
<ide> *
<del> * @param \Cake\Datasource\RepositoryInterface|null $repository The default repository object to use
<del> * @return \Cake\Datasource\RepositoryInterface|$this
<add> * @param \Cake\Datasource\RepositoryInterface $repository The default repository object to use
<add> * @return $this
<ide> */
<del> public function repository(RepositoryInterface $repository = null);
<add> public function repository(RepositoryInterface $repository);
<ide>
<ide> /**
<ide> * Adds a condition or set of conditions to be used in the WHERE clause for this
<ide><path>src/Datasource/QueryTrait.php
<ide> use BadMethodCallException;
<ide> use Cake\Collection\Iterator\MapReduce;
<ide> use Cake\Datasource\Exception\RecordNotFoundException;
<add>use InvalidArgumentException;
<ide>
<ide> /**
<ide> * Contains the characteristics for an object that is attached to a repository and
<ide> trait QueryTrait
<ide> * @var bool
<ide> */
<ide> protected $_eagerLoaded = false;
<del>
<ide> /**
<ide> * Returns the default table object that will be used by this query,
<ide> * that is, the table that will appear in the from clause.
<ide> *
<ide> * When called with a Table argument, the default table object will be set
<ide> * and this query object will be returned for chaining.
<ide> *
<del> * @param \Cake\Datasource\RepositoryInterface|\Cake\ORM\Table|null $table The default table object to use
<del> * @return \Cake\Datasource\RepositoryInterface|\Cake\ORM\Table|$this
<add> * @param \Cake\Datasource\RepositoryInterface|\Cake\ORM\Table $table The default table object to use
<add> * @return $this
<ide> */
<del> public function repository(RepositoryInterface $table = null)
<add> public function repository(RepositoryInterface $table)
<ide> {
<del> if ($table === null) {
<del> deprecationWarning(
<del> 'Using Query::repository() as getter is deprecated. ' .
<del> 'Use getRepository() instead.'
<del> );
<del>
<del> return $this->getRepository();
<del> }
<del>
<ide> $this->_repository = $table;
<ide>
<ide> return $this;
<ide> public function isEagerLoaded()
<ide> /**
<ide> * Sets the query instance to be an eager loaded query. If no argument is
<ide> * passed, the current configured query `_eagerLoaded` value is returned.
<del> *
<del> * @deprecated 3.5.0 Use isEagerLoaded() for the getter part instead.
<del> * @param bool|null $value Whether or not to eager load.
<del> * @return $this|\Cake\ORM\Query
<add>
<add> * @param bool $value Whether or not to eager load.
<add> * @return $this
<ide> */
<del> public function eagerLoaded($value = null)
<add> public function eagerLoaded($value)
<ide> {
<del> if ($value === null) {
<del> deprecationWarning(
<del> 'Using ' . get_called_class() . '::eagerLoaded() as a getter is deprecated. ' .
<del> 'Use isEagerLoaded() instead.'
<del> );
<del>
<del> return $this->_eagerLoaded;
<del> }
<ide> $this->_eagerLoaded = $value;
<ide>
<ide> return $this;
<ide> public function toArray()
<ide> * The MapReduce routing will only be run when the query is executed and the first
<ide> * result is attempted to be fetched.
<ide> *
<del> * If the first argument is set to null, it will return the list of previously
<del> * registered map reduce routines. This is deprecated as of 3.6.0 - use getMapReducers() instead.
<del> *
<ide> * If the third argument is set to true, it will erase previous map reducers
<ide> * and replace it with the arguments passed.
<ide> *
<ide> public function mapReduce(callable $mapper = null, callable $reducer = null, $ov
<ide> }
<ide> if ($mapper === null) {
<ide> if (!$overwrite) {
<del> deprecationWarning(
<del> 'Using QueryTrait::mapReduce() as a getter is deprecated. ' .
<del> 'Use getMapReducers() instead.'
<del> );
<add> throw new InvalidArgumentException('$mapper can be null only when $overwrite is false.');
<ide> }
<ide>
<del> return $this->_mapReduce;
<add> return $this;
<ide> }
<ide> $this->_mapReduce[] = compact('mapper', 'reducer');
<ide>
<ide> public function getMapReducers()
<ide> * the return value for this query's result. Formatter functions are applied
<ide> * after all the `MapReduce` routines for this query have been executed.
<ide> *
<del> * If the first argument is set to null, it will return the list of previously
<del> * registered format routines. This is deprecated as of 3.6.0 - use getResultFormatters() instead.
<del> *
<ide> * If the second argument is set to true, it will erase previous formatters
<ide> * and replace them with the passed first argument.
<ide> *
<ide> public function formatResults(callable $formatter = null, $mode = 0)
<ide> }
<ide> if ($formatter === null) {
<ide> if ($mode !== self::OVERWRITE) {
<del> deprecationWarning(
<del> 'Using QueryTrait::formatResults() as a getter is deprecated. ' .
<del> 'Use getResultFormatters() instead.'
<del> );
<add> throw new InvalidArgumentException('$formatter can be null only when $mode is overwrite.');
<ide> }
<ide>
<del> return $this->_formatters;
<add> return $this;
<ide> }
<ide>
<ide> if ($mode === self::PREPEND) {
<ide><path>src/Datasource/RepositoryInterface.php
<ide> */
<ide> interface RepositoryInterface
<ide> {
<del>
<del> /**
<del> * Returns the table alias or sets a new one
<del> *
<del> * @deprecated 3.4.0 Use setAlias()/getAlias() instead.
<del> * @param string|null $alias the new table alias
<del> * @return string
<del> */
<del> public function alias($alias = null);
<del>
<ide> /**
<ide> * Test to see if a Repository has a specific field/column.
<ide> *
<ide><path>tests/TestCase/Datasource/ModelAwareTraitTest.php
<ide> public function testModelFactory()
<ide> $this->assertEquals('Magic', $stub->Magic->name);
<ide> }
<ide>
<del> /**
<del> * test alternate default model type.
<del> *
<del> * @group deprecated
<del> * @return void
<del> */
<del> public function testModelType()
<del> {
<del> $this->deprecated(function () {
<del> $stub = new Stub();
<del> $stub->setProps('Articles');
<del>
<del> FactoryLocator::add('Test', function ($name) {
<del> $mock = new \StdClass();
<del> $mock->name = $name;
<del>
<del> return $mock;
<del> });
<del> $stub->modelType('Test');
<del>
<del> $result = $stub->loadModel('Magic');
<del> $this->assertInstanceOf('\StdClass', $result);
<del> $this->assertInstanceOf('\StdClass', $stub->Magic);
<del> $this->assertEquals('Magic', $stub->Magic->name);
<del> });
<del> }
<del>
<ide> /**
<ide> * test getModelType() and setModelType()
<ide> *
<ide><path>tests/TestCase/ORM/BehaviorRegistryTest.php
<ide> public function testCallFinder()
<ide> $this->Behaviors->set('Sluggable', $mockedBehavior);
<ide>
<ide> $query = $this->getMockBuilder('Cake\ORM\Query')
<del> ->setConstructorArgs([null, null])
<add> ->disableOriginalConstructor()
<ide> ->getMock();
<ide> $mockedBehavior
<ide> ->expects($this->once())
<ide><path>tests/TestCase/ORM/EntityTest.php
<ide> public function testSetVirtualWithMerge()
<ide> $this->assertSame(['virtual', 'name'], $result);
<ide> }
<ide>
<del> /**
<del> * Tests the errors method
<del> *
<del> * @group deprecated
<del> * @return void
<del> */
<del> public function testErrors()
<del> {
<del> $this->deprecated(function () {
<del> $entity = new Entity();
<del> $this->assertEmpty($entity->errors());
<del> $this->assertSame($entity, $entity->errors('foo', 'bar'));
<del> $this->assertEquals(['bar'], $entity->errors('foo'));
<del>
<del> $this->assertEquals([], $entity->errors('boo'));
<del> $entity['boo'] = [
<del> 'something' => 'stupid',
<del> 'and' => false
<del> ];
<del> $this->assertEquals([], $entity->errors('boo'));
<del>
<del> $entity->errors('foo', 'other error');
<del> $this->assertEquals(['bar', 'other error'], $entity->errors('foo'));
<del>
<del> $entity->errors('bar', ['something', 'bad']);
<del> $this->assertEquals(['something', 'bad'], $entity->errors('bar'));
<del>
<del> $expected = ['foo' => ['bar', 'other error'], 'bar' => ['something', 'bad']];
<del> $this->assertEquals($expected, $entity->errors());
<del>
<del> $errors = ['foo' => ['something'], 'bar' => 'else', 'baz' => ['error']];
<del> $this->assertSame($entity, $entity->errors($errors, null, true));
<del> $errors['bar'] = ['else'];
<del> $this->assertEquals($errors, $entity->errors());
<del> });
<del> }
<del>
<ide> /**
<ide> * Tests error getters and setters
<ide> *
<ide> public function testDebugInfo()
<ide> $this->assertSame($expected, $result);
<ide> }
<ide>
<del> /**
<del> * Tests the source method
<del> *
<del> * @group deprecated
<del> * @return void
<del> */
<del> public function testSource()
<del> {
<del> $this->deprecated(function () {
<del> $entity = new Entity();
<del> $this->assertNull($entity->source());
<del> $entity->source('foos');
<del> $this->assertEquals('foos', $entity->source());
<del> });
<del> }
<del>
<ide> /**
<ide> * Test the source getter
<ide> */
<ide> public function testIsDirtyFromClone()
<ide> $this->assertTrue($cloned->isDirty('b'));
<ide> }
<ide>
<del> /**
<del> * Provides empty values
<del> *
<del> * @group deprecated
<del> * @return void
<del> */
<del> public function testDirtyFromClone()
<del> {
<del> $this->deprecated(function () {
<del> $entity = new Entity(
<del> ['a' => 1, 'b' => 2],
<del> ['markNew' => false, 'markClean' => true]
<del> );
<del>
<del> $this->assertFalse($entity->isNew());
<del> $this->assertFalse($entity->dirty());
<del>
<del> $cloned = clone $entity;
<del> $cloned->isNew(true);
<del>
<del> $this->assertTrue($cloned->dirty());
<del> $this->assertTrue($cloned->dirty('a'));
<del> $this->assertTrue($cloned->dirty('b'));
<del> });
<del> }
<del>
<ide> /**
<ide> * Tests getInvalid and setInvalid
<ide> *
<ide><path>tests/TestCase/ORM/TableTest.php
<ide> function (Event $event, Entity $entity, ArrayObject $options) use (&$afterDelete
<ide> $this->assertEquals(1, $afterDeleteCount);
<ide> }
<ide>
<del> /**
<del> * Tests that calling newEntity() on a table sets the right source alias
<del> *
<del> * @group deprecated
<del> * @return void
<del> */
<del> public function testEntitySource()
<del> {
<del> $this->deprecated(function () {
<del> $table = $this->getTableLocator()->get('Articles');
<del> $this->assertEquals('Articles', $table->newEntity()->source());
<del>
<del> Plugin::load('TestPlugin');
<del> $table = $this->getTableLocator()->get('TestPlugin.Comments');
<del> $this->assertEquals('TestPlugin.Comments', $table->newEntity()->source());
<del> });
<del> }
<del>
<ide> /**
<ide> * Tests that calling newEntity() on a table sets the right source alias
<ide> *
| 12
|
Ruby
|
Ruby
|
use symbol for `respond_to?`
|
af56a99a37d93c252392129ab44ee18ea884c447
|
<ide><path>Library/Homebrew/dev-cmd/livecheck.rb
<ide> def livecheck
<ide> onoe e
<ide> end
<ide> end.sort_by do |formula_or_cask|
<del> formula_or_cask.respond_to?("token") ? formula_or_cask.token : formula_or_cask.name
<add> formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
<ide> end
<ide>
<ide> raise UsageError, "No formulae or casks to check." if formulae_and_casks_to_check.blank?
| 1
|
Ruby
|
Ruby
|
deduplicate the environment glob in engine paths
|
f77ec9aa67afd6f28dfbd21970df4f58acf025be
|
<ide><path>railties/lib/rails/engine/configuration.rb
<ide> def paths
<ide> paths.add "lib/tasks", glob: "**/*.rake"
<ide>
<ide> paths.add "config"
<del> paths.add "config/environments", glob: "#{Rails.env}.rb"
<add> paths.add "config/environments", glob: -"#{Rails.env}.rb"
<ide> paths.add "config/initializers", glob: "**/*.rb"
<ide> paths.add "config/locales", glob: "**/*.{rb,yml}"
<ide> paths.add "config/routes.rb"
| 1
|
Java
|
Java
|
simplify the generation of inner bean definitions
|
c541bde513443862e24e372c83f33e8c511d8903
|
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/generator/BeanParameterGenerator.java
<ide> import java.util.List;
<ide> import java.util.Map;
<ide> import java.util.Set;
<del>import java.util.function.BiConsumer;
<ide> import java.util.function.Function;
<ide> import java.util.function.Supplier;
<ide> import java.util.stream.Collectors;
<ide> public final class BeanParameterGenerator {
<ide>
<ide> private final ResolvableTypeGenerator typeGenerator = new ResolvableTypeGenerator();
<ide>
<del> private final BiConsumer<BeanDefinition, Builder> innerBeanDefinitionGenerator;
<add> private final Function<BeanDefinition, CodeBlock> innerBeanDefinitionGenerator;
<ide>
<ide>
<ide> /**
<ide> * Create an instance with the callback to use to generate an inner bean
<ide> * definition.
<ide> * @param innerBeanDefinitionGenerator the inner bean definition generator
<ide> */
<del> public BeanParameterGenerator(BiConsumer<BeanDefinition, Builder> innerBeanDefinitionGenerator) {
<add> public BeanParameterGenerator(Function<BeanDefinition, CodeBlock> innerBeanDefinitionGenerator) {
<ide> this.innerBeanDefinitionGenerator = innerBeanDefinitionGenerator;
<ide> }
<ide>
<ide> /**
<ide> * Create an instance with no support for inner bean definitions.
<ide> */
<ide> public BeanParameterGenerator() {
<del> this((beanDefinition, builder) -> {
<add> this(beanDefinition -> {
<ide> throw new IllegalStateException("Inner bean definition is not supported by this instance");
<ide> });
<ide> }
<ide> else if (value instanceof Class) {
<ide> else if (value instanceof ResolvableType) {
<ide> code.add(this.typeGenerator.generateTypeFor((ResolvableType) value));
<ide> }
<del> else if (value instanceof BeanDefinition) {
<del> this.innerBeanDefinitionGenerator.accept((BeanDefinition) value, code);
<add> else if (value instanceof BeanDefinition bd) {
<add> code.add(this.innerBeanDefinitionGenerator.apply(bd));
<ide> }
<ide> else if (value instanceof BeanReference) {
<ide> code.add("new $T($S)", RuntimeBeanReference.class, ((BeanReference) value).getBeanName());
<ide><path>spring-beans/src/test/java/org/springframework/beans/factory/generator/BeanParameterGeneratorTests.java
<ide> import org.springframework.beans.factory.support.RootBeanDefinition;
<ide> import org.springframework.core.ResolvableType;
<ide> import org.springframework.core.io.ResourceLoader;
<add>import org.springframework.javapoet.CodeBlock;
<ide> import org.springframework.javapoet.support.CodeSnippet;
<ide> import org.springframework.lang.Nullable;
<ide> import org.springframework.util.ReflectionUtils;
<ide> void generateBeanReference() {
<ide> @Test
<ide> void generateBeanDefinitionCallsConsumer() {
<ide> BeanParameterGenerator customGenerator = new BeanParameterGenerator(
<del> ((beanDefinition, builder) -> builder.add("test")));
<add> beanDefinition -> CodeBlock.of("test"));
<ide> assertThat(CodeSnippet.process(customGenerator.generateParameterValue(
<ide> new RootBeanDefinition()))).isEqualTo("test");
<ide> }
| 2
|
Python
|
Python
|
add note that apisettings is an internal class
|
5f3f2ef10636e4083433289ee007e12cd61d8e8b
|
<ide><path>rest_framework/settings.py
<ide> def import_from_string(val, setting_name):
<ide>
<ide> class APISettings:
<ide> """
<del> A settings object, that allows API settings to be accessed as properties.
<del> For example:
<add> A settings object that allows REST Framework settings to be accessed as
<add> properties. For example:
<ide>
<ide> from rest_framework.settings import api_settings
<ide> print(api_settings.DEFAULT_RENDERER_CLASSES)
<ide>
<ide> Any setting with string import paths will be automatically resolved
<ide> and return the class, rather than the string literal.
<add>
<add> Note:
<add> This is an internal class that is only compatible with settings namespaced
<add> under the REST_FRAMEWORK name. It is not intended to be used by 3rd-party
<add> apps, and test helpers like `override_settings` may not work as expected.
<ide> """
<ide> def __init__(self, user_settings=None, defaults=None, import_strings=None):
<ide> if user_settings:
| 1
|
Go
|
Go
|
fix panic in validate context for build
|
cd776cdd77239353d8bd17d3e05d66665f381157
|
<ide><path>utils/utils.go
<ide> func ValidateContextDirectory(srcPath string, excludes []string) error {
<ide> // skip checking if symlinks point to non-existing files, such symlinks can be useful
<ide> // also skip named pipes, because they hanging on open
<ide> lstat, _ := os.Lstat(filePath)
<del> if lstat.Mode()&(os.ModeSymlink|os.ModeNamedPipe) != 0 {
<add> if lstat != nil && lstat.Mode()&(os.ModeSymlink|os.ModeNamedPipe) != 0 {
<ide> return nil
<ide> }
<ide>
| 1
|
Javascript
|
Javascript
|
add missing semicolon in volumeslice
|
d8a6ab85bd1016c5628cf00cd5ea174d9b8cfc8f
|
<ide><path>examples/js/VolumeSlice.js
<ide> THREE.VolumeSlice = function( volume, index, axis ) {
<ide> */
<ide>
<ide>
<del>}
<add>};
<ide>
<ide> THREE.VolumeSlice.prototype = {
<ide>
<ide> THREE.VolumeSlice.prototype = {
<ide>
<ide> }
<ide>
<del>}
<add>};
| 1
|
Text
|
Text
|
capitalize first letter in sentence
|
387928c2348880c5801b422805a069e7c4910289
|
<ide><path>guides/source/routing.md
<ide> resources :user_permissions, controller: 'admin/user_permissions'
<ide>
<ide> This will route to the `Admin::UserPermissions` controller.
<ide>
<del>NOTE: Only the directory notation is supported. specifying the
<add>NOTE: Only the directory notation is supported. Specifying the
<ide> controller with ruby constant notation (eg. `:controller =>
<ide> 'Admin::UserPermissions'`) can lead to routing problems and results in
<ide> a warning.
| 1
|
Javascript
|
Javascript
|
switch assertequal arguments
|
b8106077b7e24723e275db1dfd1aea887b2764cc
|
<ide><path>test/fixtures/GH-892-request.js
<ide> var options = {
<ide> };
<ide>
<ide> var req = https.request(options, function(res) {
<del> assert.strictEqual(200, res.statusCode);
<add> assert.strictEqual(res.statusCode, 200);
<ide> gotResponse = true;
<ide> console.error('DONE');
<ide> res.resume();
| 1
|
Text
|
Text
|
add callback to setprops docs
|
2d66fc45185e98cfe11a824822ce44a90388cdeb
|
<ide><path>docs/docs/ref-02-component-api.md
<ide> If this component has been mounted into the DOM, this returns the corresponding
<ide> ### setProps
<ide>
<ide> ```javascript
<del>setProps(object nextProps)
<add>setProps(object nextProps[, function callback])
<ide> ```
<ide>
<del>When you're integrating with an external JavaScript application you may want to signal a change to a React component rendered with `renderComponent()`. Simply call `setProps()` to change its properties and trigger a re-render.
<add>When you're integrating with an external JavaScript application you may want to signal a change to a React component rendered with `renderComponent()`. Simply call `setProps()` to change its properties and trigger a re-render. In addition, you can supply an optional callback function that is executed once `setProps` is completed.
<ide>
<ide> > Note:
<ide> >
<ide> When you're integrating with an external JavaScript application you may want to
<ide> ### replaceProps
<ide>
<ide> ```javascript
<del>replaceProps(object nextProps)
<add>replaceProps(object nextProps[, function callback])
<ide> ```
<ide>
<ide> Like `setProps()` but deletes any pre-existing props instead of merging the two objects.
| 1
|
Ruby
|
Ruby
|
add tests with custom requirements
|
e9815bf2bd2950b5450f0c3ed3bb7eadd3b4cbb3
|
<ide><path>Library/Homebrew/test/install_test.rb
<ide> def test_install_with_invalid_option
<ide> assert_match "testball1: this formula has no --with-fo option so it will be ignored!",
<ide> cmd("install", "testball1", "--with-fo")
<ide> end
<add>
<add> def test_install_with_nonfatal_requirement
<add> setup_test_formula "testball1", <<-EOS.undent
<add> class NonFatalRequirement < Requirement
<add> satisfy { false }
<add> end
<add> depends_on NonFatalRequirement
<add> EOS
<add> message = "NonFatalRequirement unsatisfied!"
<add> assert_equal 1, cmd("install", "testball1").scan(message).size
<add> end
<add>
<add> def test_install_with_fatal_requirement
<add> setup_test_formula "testball1", <<-EOS.undent
<add> class FatalRequirement < Requirement
<add> fatal true
<add> satisfy { false }
<add> end
<add> depends_on FatalRequirement
<add> EOS
<add> message = "FatalRequirement unsatisfied!"
<add> assert_equal 1, cmd_fail("install", "testball1").scan(message).size
<add> end
<ide> end
| 1
|
Text
|
Text
|
add react-redux-form to ecosystem
|
9c42b70e1a69281b36b02fd1c899a97436a5bb0c
|
<ide><path>docs/introduction/Ecosystem.md
<ide> On this page we will only feature a few of them that the Redux maintainers have
<ide> ### Components
<ide>
<ide> * [redux-form](https://github.com/erikras/redux-form) — Keep React form state in Redux
<add>* [react-redux-form](https://github.com/davidkpiano/react-redux-form) — Create forms easily in React with Redux
<ide>
<ide> ### Enhancers
<ide>
| 1
|
PHP
|
PHP
|
improve property type
|
e0e516cd50882bc8de500d164cd7c28eacd64430
|
<ide><path>src/Illuminate/Pipeline/Pipeline.php
<ide> class Pipeline implements PipelineContract
<ide> /**
<ide> * The container implementation.
<ide> *
<del> * @var \Illuminate\Contracts\Container\Container
<add> * @var \Illuminate\Contracts\Container\Container|null
<ide> */
<ide> protected $container;
<ide>
| 1
|
Text
|
Text
|
use svg badge
|
b93ca855c0f99fbf6bd95d576c5667eb5615e102
|
<ide><path>README.md
<del>AngularJS [](https://travis-ci.org/angular/angular.js)
<add>AngularJS [](https://travis-ci.org/angular/angular.js)
<ide> =========
<ide>
<ide> AngularJS lets you write client-side web applications as if you had a smarter browser. It lets you
| 1
|
Python
|
Python
|
remove duplicate get_connection in snowflakehook
|
de9900539c9731325e29fd1bbac37c4bc1363bc4
|
<ide><path>airflow/providers/snowflake/hooks/snowflake.py
<ide> def run(self, sql: Union[str, list], autocommit: bool = False, parameters: Optio
<ide> """
<ide> self.query_ids = []
<ide>
<del> with self.get_conn() as conn:
<del> conn = self.get_conn()
<add> with closing(self.get_conn()) as conn:
<ide> self.set_autocommit(conn, autocommit)
<ide>
<ide> if isinstance(sql, str):
| 1
|
Go
|
Go
|
rearrange layerstore locking
|
cbf55b924f05a918c9b95795f6c69aa89d180530
|
<ide><path>layer/layer_store.go
<ide> func (ls *layerStore) Register(ts io.Reader, parent ChainID) (Layer, error) {
<ide> ls.layerL.Lock()
<ide> defer ls.layerL.Unlock()
<ide>
<del> if existingLayer := ls.getAndRetainLayer(layer.chainID); existingLayer != nil {
<add> if existingLayer := ls.getWithoutLock(layer.chainID); existingLayer != nil {
<ide> // Set error for cleanup, but do not return the error
<ide> err = errors.New("layer already exists")
<ide> return existingLayer.getReference(), nil
<ide> func (ls *layerStore) Register(ts io.Reader, parent ChainID) (Layer, error) {
<ide> return layer.getReference(), nil
<ide> }
<ide>
<del>func (ls *layerStore) get(l ChainID) *roLayer {
<del> ls.layerL.Lock()
<del> defer ls.layerL.Unlock()
<del>
<del> layer, ok := ls.layerMap[l]
<add>func (ls *layerStore) getWithoutLock(layer ChainID) *roLayer {
<add> l, ok := ls.layerMap[layer]
<ide> if !ok {
<ide> return nil
<ide> }
<ide>
<del> layer.referenceCount++
<add> l.referenceCount++
<add>
<add> return l
<add>}
<ide>
<del> return layer
<add>func (ls *layerStore) get(l ChainID) *roLayer {
<add> ls.layerL.Lock()
<add> defer ls.layerL.Unlock()
<add> return ls.getWithoutLock(l)
<ide> }
<ide>
<ide> func (ls *layerStore) Get(l ChainID) (Layer, error) {
<ide> func (ls *layerStore) saveMount(mount *mountedLayer) error {
<ide> return nil
<ide> }
<ide>
<del>func (ls *layerStore) getAndRetainLayer(layer ChainID) *roLayer {
<del> l, ok := ls.layerMap[layer]
<del> if !ok {
<del> return nil
<del> }
<del>
<del> l.referenceCount++
<del>
<del> return l
<del>}
<del>
<ide> func (ls *layerStore) initMount(graphID, parent, mountLabel string, initFunc MountInit) (string, error) {
<ide> // Use "<graph-id>-init" to maintain compatibility with graph drivers
<ide> // which are expecting this layer with this special name. If all
<ide> func (ls *layerStore) Mount(name string, parent ChainID, mountLabel string, init
<ide> var pid string
<ide> var p *roLayer
<ide> if string(parent) != "" {
<del> ls.layerL.Lock()
<del> p = ls.getAndRetainLayer(parent)
<del> ls.layerL.Unlock()
<add> p = ls.get(parent)
<ide> if p == nil {
<ide> return nil, ErrLayerDoesNotExist
<ide> }
<ide><path>layer/layer_windows.go
<ide> func (ls *layerStore) RegisterDiffID(graphID string, size int64) (Layer, error)
<ide> ls.layerL.Lock()
<ide> defer ls.layerL.Unlock()
<ide>
<del> if existingLayer := ls.getAndRetainLayer(layer.chainID); existingLayer != nil {
<add> if existingLayer := ls.getWithoutLock(layer.chainID); existingLayer != nil {
<ide> // Set error for cleanup, but do not return
<ide> err = errors.New("layer already exists")
<ide> return existingLayer.getReference(), nil
<ide><path>layer/migration.go
<ide> func (ls *layerStore) MountByGraphID(name string, graphID string, parent ChainID
<ide>
<ide> var p *roLayer
<ide> if string(parent) != "" {
<del> ls.layerL.Lock()
<del> p = ls.getAndRetainLayer(parent)
<del> ls.layerL.Unlock()
<add> p = ls.get(parent)
<ide> if p == nil {
<ide> return nil, ErrLayerDoesNotExist
<ide> }
<ide> func (ls *layerStore) RegisterByGraphID(graphID string, parent ChainID, tarDataF
<ide> ls.layerL.Lock()
<ide> defer ls.layerL.Unlock()
<ide>
<del> if existingLayer := ls.getAndRetainLayer(layer.chainID); existingLayer != nil {
<add> if existingLayer := ls.getWithoutLock(layer.chainID); existingLayer != nil {
<ide> // Set error for cleanup, but do not return
<ide> err = errors.New("layer already exists")
<ide> return existingLayer.getReference(), nil
| 3
|
Javascript
|
Javascript
|
add freelist deprecation and test
|
fef87fee1de60c3d5db2652ee2004a6e78d112ff
|
<ide><path>lib/freelist.js
<ide> 'use strict';
<ide>
<add>const util = require('internal/util');
<add>
<ide> module.exports = require('internal/freelist');
<add>util.printDeprecationMessage('freelist module is deprecated.');
<ide><path>test/parallel/test-freelist.js
<add>'use strict';
<add>
<add>// Flags: --expose-internals
<add>
<add>const assert = require('assert');
<add>const freelist = require('freelist');
<add>const internalFreelist = require('internal/freelist');
<add>
<add>assert.equal(typeof freelist, 'object');
<add>assert.equal(typeof freelist.FreeList, 'function');
<add>assert.strictEqual(freelist, internalFreelist);
<add>
<add>const flist1 = new freelist.FreeList('flist1', 3, String);
<add>
<add>// Allocating when empty, should not change the list size
<add>var result = flist1.alloc('test');
<add>assert.strictEqual(typeof result, 'string');
<add>assert.strictEqual(result, 'test');
<add>assert.strictEqual(flist1.list.length, 0);
<add>
<add>// Exhaust the free list
<add>assert(flist1.free('test1'));
<add>assert(flist1.free('test2'));
<add>assert(flist1.free('test3'));
<add>
<add>// Now it should not return 'true', as max length is exceeded
<add>assert.strictEqual(flist1.free('test4'), false);
<add>assert.strictEqual(flist1.free('test5'), false);
<add>
<add>// At this point 'alloc' should just return the stored values
<add>assert.strictEqual(flist1.alloc(), 'test1');
<add>assert.strictEqual(flist1.alloc(), 'test2');
<add>assert.strictEqual(flist1.alloc(), 'test3');
| 2
|
Javascript
|
Javascript
|
add coverage tests for sourcemapfromdataurl method
|
eb773217ae6f4b4ea0e906ff1cc492502c32a006
|
<ide><path>test/fixtures/source-map/inline-base64-json-error.js
<add>var cov_263bu3eqm8=function(){var path= "./branches.js";var hash="424788076537d051b5bf0e2564aef393124eabc7";var global=new Function("return this")();var gcv="__coverage__";var coverageData={path: "./branches.js",statementMap:{"0":{start:{line:1,column:0},end:{line:7,column:1}},"1":{start:{line:2,column:2},end:{line:2,column:29}},"2":{start:{line:3,column:7},end:{line:7,column:1}},"3":{start:{line:4,column:2},end:{line:4,column:27}},"4":{start:{line:6,column:2},end:{line:6,column:29}},"5":{start:{line:10,column:2},end:{line:16,column:3}},"6":{start:{line:11,column:4},end:{line:11,column:28}},"7":{start:{line:12,column:9},end:{line:16,column:3}},"8":{start:{line:13,column:4},end:{line:13,column:31}},"9":{start:{line:15,column:4},end:{line:15,column:29}},"10":{start:{line:19,column:0},end:{line:19,column:12}},"11":{start:{line:20,column:0},end:{line:20,column:13}}},fnMap:{"0":{name:"branch",decl:{start:{line:9,column:9},end:{line:9,column:15}},loc:{start:{line:9,column:20},end:{line:17,column:1}},line:9}},branchMap:{"0":{loc:{start:{line:1,column:0},end:{line:7,column:1}},type:"if",locations:[{start:{line:1,column:0},end:{line:7,column:1}},{start:{line:1,column:0},end:{line:7,column:1}}],line:1},"1":{loc:{start:{line:3,column:7},end:{line:7,column:1}},type:"if",locations:[{start:{line:3,column:7},end:{line:7,column:1}},{start:{line:3,column:7},end:{line:7,column:1}}],line:3},"2":{loc:{start:{line:10,column:2},end:{line:16,column:3}},type:"if",locations:[{start:{line:10,column:2},end:{line:16,column:3}},{start:{line:10,column:2},end:{line:16,column:3}}],line:10},"3":{loc:{start:{line:12,column:9},end:{line:16,column:3}},type:"if",locations:[{start:{line:12,column:9},end:{line:16,column:3}},{start:{line:12,column:9},end:{line:16,column:3}}],line:12}},s:{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0},f:{"0":0},b:{"0":[0,0],"1":[0,0],"2":[0,0],"3":[0,0]},_coverageSchema:"43e27e138ebf9cfc5966b082cf9a028302ed4184",hash:"424788076537d051b5bf0e2564aef393124eabc7"};var coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}return coverage[path]=coverageData;}();cov_263bu3eqm8.s[0]++;if(false){cov_263bu3eqm8.b[0][0]++;cov_263bu3eqm8.s[1]++;console.info('unreachable');}else{cov_263bu3eqm8.b[0][1]++;cov_263bu3eqm8.s[2]++;if(true){cov_263bu3eqm8.b[1][0]++;cov_263bu3eqm8.s[3]++;console.info('reachable');}else{cov_263bu3eqm8.b[1][1]++;cov_263bu3eqm8.s[4]++;console.info('unreachable');}}function branch(a){cov_263bu3eqm8.f[0]++;cov_263bu3eqm8.s[5]++;if(a){cov_263bu3eqm8.b[2][0]++;cov_263bu3eqm8.s[6]++;console.info('a = true');}else{cov_263bu3eqm8.b[2][1]++;cov_263bu3eqm8.s[7]++;if(undefined){cov_263bu3eqm8.b[3][0]++;cov_263bu3eqm8.s[8]++;console.info('unreachable');}else{cov_263bu3eqm8.b[3][1]++;cov_263bu3eqm8.s[9]++;console.info('a = false');}}}cov_263bu3eqm8.s[10]++;branch(true);cov_263bu3eqm8.s[11]++;branch(false);
<add>//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uOjMsInNvdXJjZXMiOlsiLi9icmFuY2hlcy5qcyJdLCJuYW1lcyI6WyJjb25zb2xlIiwiaW5mbyIsImJyYW5jaCIsImEiLCJ1bmRlZmluZWQiXSwibWFwcGluZ3MiOiJzdUVBQUEsR0FBSSxLQUFKLENBQVcsZ0RBQ1RBLE9BQU8sQ0FBQ0MsSUFBUixDQUFhLGFBQWIsRUFDRCxDQUZELElBRU8sbURBQUksSUFBSixDQUFVLGdEQUNmRCxPQUFPLENBQUNDLElBQVIsQ0FBYSxXQUFiLEVBQ0QsQ0FGTSxJQUVBLGdEQUNMRCxPQUFPLENBQUNDLElBQVIsQ0FBYSxhQUFiLEVBQ0QsRUFFRCxRQUFTQyxDQUFBQSxNQUFULENBQWlCQyxDQUFqQixDQUFvQiw2Q0FDbEIsR0FBSUEsQ0FBSixDQUFPLGdEQUNMSCxPQUFPLENBQUNDLElBQVIsQ0FBYSxVQUFiLEVBQ0QsQ0FGRCxJQUVPLG1EQUFJRyxTQUFKLENBQWUsZ0RBQ3BCSixPQUFPLENBQUNDLElBQVIsQ0FBYSxhQUFiLEVBQ0QsQ0FGTSxJQUVBLGdEQUNMRCxPQUFPLENBQUNDLElBQVIsQ0FBYSxXQUFiLEVBQ0QsRUFDRixDLHVCQUVEQyxNQUFNLENBQUMsSUFBRCxDQUFOLEMsdUJBQ0FBLE1BQU0sQ0FBQyxLQUFELENBQU4iLCJzb3VyY2VzQ29udGVudCI6WyJpZiAoZmFsc2UpIHtcbiAgY29uc29sZS5pbmZvKCd1bnJlYWNoYWJsZScpXG59IGVsc2UgaWYgKHRydWUpIHtcbiAgY29uc29sZS5pbmZvKCdyZWFjaGFibGUnKVxufSBlbHNlIHtcbiAgY29uc29sZS5pbmZvKCd1bnJlYWNoYWJsZScpXG59XG5cbmZ1bmN0aW9uIGJyYW5jaCAoYSkge1xuICBpZiAoYSkge1xuICAgIGNvbnNvbGUuaW5mbygnYSA9IHRydWUnKVxuICB9IGVsc2UgaWYgKHVuZGVmaW5lZCkge1xuICAgIGNvbnNvbGUuaW5mbygndW5yZWFjaGFibGUnKVxuICB9IGVsc2Uge1xuICAgIGNvbnNvbGUuaW5mbygnYSA9IGZhbHNlJylcbiAgfVxufVxuXG5icmFuY2godHJ1ZSlcbmJyYW5jaChmYWxzZSlcbiJdfQ==
<ide>\ No newline at end of file
<ide><path>test/fixtures/source-map/inline-base64-type-error.js
<add>var cov_263bu3eqm8=function(){var path= "./branches.js";var hash="424788076537d051b5bf0e2564aef393124eabc7";var global=new Function("return this")();var gcv="__coverage__";var coverageData={path: "./branches.js",statementMap:{"0":{start:{line:1,column:0},end:{line:7,column:1}},"1":{start:{line:2,column:2},end:{line:2,column:29}},"2":{start:{line:3,column:7},end:{line:7,column:1}},"3":{start:{line:4,column:2},end:{line:4,column:27}},"4":{start:{line:6,column:2},end:{line:6,column:29}},"5":{start:{line:10,column:2},end:{line:16,column:3}},"6":{start:{line:11,column:4},end:{line:11,column:28}},"7":{start:{line:12,column:9},end:{line:16,column:3}},"8":{start:{line:13,column:4},end:{line:13,column:31}},"9":{start:{line:15,column:4},end:{line:15,column:29}},"10":{start:{line:19,column:0},end:{line:19,column:12}},"11":{start:{line:20,column:0},end:{line:20,column:13}}},fnMap:{"0":{name:"branch",decl:{start:{line:9,column:9},end:{line:9,column:15}},loc:{start:{line:9,column:20},end:{line:17,column:1}},line:9}},branchMap:{"0":{loc:{start:{line:1,column:0},end:{line:7,column:1}},type:"if",locations:[{start:{line:1,column:0},end:{line:7,column:1}},{start:{line:1,column:0},end:{line:7,column:1}}],line:1},"1":{loc:{start:{line:3,column:7},end:{line:7,column:1}},type:"if",locations:[{start:{line:3,column:7},end:{line:7,column:1}},{start:{line:3,column:7},end:{line:7,column:1}}],line:3},"2":{loc:{start:{line:10,column:2},end:{line:16,column:3}},type:"if",locations:[{start:{line:10,column:2},end:{line:16,column:3}},{start:{line:10,column:2},end:{line:16,column:3}}],line:10},"3":{loc:{start:{line:12,column:9},end:{line:16,column:3}},type:"if",locations:[{start:{line:12,column:9},end:{line:16,column:3}},{start:{line:12,column:9},end:{line:16,column:3}}],line:12}},s:{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0},f:{"0":0},b:{"0":[0,0],"1":[0,0],"2":[0,0],"3":[0,0]},_coverageSchema:"43e27e138ebf9cfc5966b082cf9a028302ed4184",hash:"424788076537d051b5bf0e2564aef393124eabc7"};var coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}return coverage[path]=coverageData;}();cov_263bu3eqm8.s[0]++;if(false){cov_263bu3eqm8.b[0][0]++;cov_263bu3eqm8.s[1]++;console.info('unreachable');}else{cov_263bu3eqm8.b[0][1]++;cov_263bu3eqm8.s[2]++;if(true){cov_263bu3eqm8.b[1][0]++;cov_263bu3eqm8.s[3]++;console.info('reachable');}else{cov_263bu3eqm8.b[1][1]++;cov_263bu3eqm8.s[4]++;console.info('unreachable');}}function branch(a){cov_263bu3eqm8.f[0]++;cov_263bu3eqm8.s[5]++;if(a){cov_263bu3eqm8.b[2][0]++;cov_263bu3eqm8.s[6]++;console.info('a = true');}else{cov_263bu3eqm8.b[2][1]++;cov_263bu3eqm8.s[7]++;if(undefined){cov_263bu3eqm8.b[3][0]++;cov_263bu3eqm8.s[8]++;console.info('unreachable');}else{cov_263bu3eqm8.b[3][1]++;cov_263bu3eqm8.s[9]++;console.info('a = false');}}}cov_263bu3eqm8.s[10]++;branch(true);cov_263bu3eqm8.s[11]++;branch(false);
<add>//# sourceMappingURL=data:application/text;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4vYnJhbmNoZXMuanMiXSwibmFtZXMiOlsiY29uc29sZSIsImluZm8iLCJicmFuY2giLCJhIiwidW5kZWZpbmVkIl0sIm1hcHBpbmdzIjoic3VFQUFBLEdBQUksS0FBSixDQUFXLGdEQUNUQSxPQUFPLENBQUNDLElBQVIsQ0FBYSxhQUFiLEVBQ0QsQ0FGRCxJQUVPLG1EQUFJLElBQUosQ0FBVSxnREFDZkQsT0FBTyxDQUFDQyxJQUFSLENBQWEsV0FBYixFQUNELENBRk0sSUFFQSxnREFDTEQsT0FBTyxDQUFDQyxJQUFSLENBQWEsYUFBYixFQUNELEVBRUQsUUFBU0MsQ0FBQUEsTUFBVCxDQUFpQkMsQ0FBakIsQ0FBb0IsNkNBQ2xCLEdBQUlBLENBQUosQ0FBTyxnREFDTEgsT0FBTyxDQUFDQyxJQUFSLENBQWEsVUFBYixFQUNELENBRkQsSUFFTyxtREFBSUcsU0FBSixDQUFlLGdEQUNwQkosT0FBTyxDQUFDQyxJQUFSLENBQWEsYUFBYixFQUNELENBRk0sSUFFQSxnREFDTEQsT0FBTyxDQUFDQyxJQUFSLENBQWEsV0FBYixFQUNELEVBQ0YsQyx1QkFFREMsTUFBTSxDQUFDLElBQUQsQ0FBTixDLHVCQUNBQSxNQUFNLENBQUMsS0FBRCxDQUFOIiwic291cmNlc0NvbnRlbnQiOlsiaWYgKGZhbHNlKSB7XG4gIGNvbnNvbGUuaW5mbygndW5yZWFjaGFibGUnKVxufSBlbHNlIGlmICh0cnVlKSB7XG4gIGNvbnNvbGUuaW5mbygncmVhY2hhYmxlJylcbn0gZWxzZSB7XG4gIGNvbnNvbGUuaW5mbygndW5yZWFjaGFibGUnKVxufVxuXG5mdW5jdGlvbiBicmFuY2ggKGEpIHtcbiAgaWYgKGEpIHtcbiAgICBjb25zb2xlLmluZm8oJ2EgPSB0cnVlJylcbiAgfSBlbHNlIGlmICh1bmRlZmluZWQpIHtcbiAgICBjb25zb2xlLmluZm8oJ3VucmVhY2hhYmxlJylcbiAgfSBlbHNlIHtcbiAgICBjb25zb2xlLmluZm8oJ2EgPSBmYWxzZScpXG4gIH1cbn1cblxuYnJhbmNoKHRydWUpXG5icmFuY2goZmFsc2UpXG4iXX0=
<ide><path>test/parallel/test-source-map.js
<ide> function nextdir() {
<ide> );
<ide> }
<ide>
<add>// base64 encoding error does not crash application.
<add>{
<add> const coverageDirectory = nextdir();
<add> const output = spawnSync(process.execPath, [
<add> require.resolve('../fixtures/source-map/inline-base64-type-error.js')
<add> ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } });
<add> assert.strictEqual(output.status, 0);
<add> assert.strictEqual(output.stderr.toString(), '');
<add> const sourceMap = getSourceMapFromCache(
<add> 'inline-base64-type-error.js',
<add> coverageDirectory
<add> );
<add>
<add> assert.strictEqual(sourceMap.data, null);
<add>}
<add>
<add>// JSON error does not crash application.
<add>{
<add> const coverageDirectory = nextdir();
<add> const output = spawnSync(process.execPath, [
<add> require.resolve('../fixtures/source-map/inline-base64-json-error.js')
<add> ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } });
<add> assert.strictEqual(output.status, 0);
<add> assert.strictEqual(output.stderr.toString(), '');
<add> const sourceMap = getSourceMapFromCache(
<add> 'inline-base64-json-error.js',
<add> coverageDirectory
<add> );
<add>
<add> assert.strictEqual(sourceMap.data, null);
<add>}
<add>
<ide> // Does not apply source-map to stack trace if --experimental-modules
<ide> // is not set.
<ide> {
| 3
|
Ruby
|
Ruby
|
fix query cache for multiple connections
|
aec635dc2fa90a9c286527bf997b3b927f2379d2
|
<ide><path>activerecord/lib/active_record/query_cache.rb
<ide> def uncached(&block)
<ide> end
<ide>
<ide> def self.run
<del> ActiveRecord::Base.connection_handler.connection_pool_list.
<del> reject { |p| p.query_cache_enabled }.each { |p| p.enable_query_cache! }
<add> pools = []
<add>
<add> ActiveRecord::Base.connection_handlers.each do |key, handler|
<add> pools << handler.connection_pool_list.reject { |p| p.query_cache_enabled }.each { |p| p.enable_query_cache! }
<add> end
<add>
<add> pools.flatten
<ide> end
<ide>
<ide> def self.complete(pools)
<ide> pools.each { |pool| pool.disable_query_cache! }
<ide>
<del> ActiveRecord::Base.connection_handler.connection_pool_list.each do |pool|
<del> pool.release_connection if pool.active_connection? && !pool.connection.transaction_open?
<add> ActiveRecord::Base.connection_handlers.each do |_, handler|
<add> handler.connection_pool_list.each do |pool|
<add> pool.release_connection if pool.active_connection? && !pool.connection.transaction_open?
<add> end
<ide> end
<ide> end
<ide>
<ide><path>activerecord/test/cases/query_cache_test.rb
<ide> def test_exceptional_middleware_clears_and_disables_cache_on_error
<ide> assert_cache :off
<ide> end
<ide>
<add> def test_query_cache_is_applied_to_connections_in_all_handlers
<add> ActiveRecord::Base.connected_to(role: :reading) do
<add> ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations["arunit"])
<add> end
<add>
<add> mw = middleware { |env|
<add> ro_conn = ActiveRecord::Base.connection_handlers[:reading].connection_pool_list.first.connection
<add> assert_predicate ActiveRecord::Base.connection, :query_cache_enabled
<add> assert_predicate ro_conn, :query_cache_enabled
<add> }
<add>
<add> mw.call({})
<add> ensure
<add> ActiveRecord::Base.connection_handlers = { writing: ActiveRecord::Base.default_connection_handler }
<add> end
<add>
<ide> def test_query_cache_across_threads
<ide> with_temporary_connection_pool do
<ide> begin
| 2
|
Javascript
|
Javascript
|
update comments for eventpluginhub.js
|
c54249c86834c00bc13a1672455c3fb955308c05
|
<ide><path>src/renderers/shared/event/EventPluginHub.js
<ide> var EventPluginHub = {
<ide> /**
<ide> * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
<ide> *
<del> * @param {string} id ID of the DOM element.
<add> * @param {object} inst The instance, which is the source of events.
<ide> * @param {string} registrationName Name of listener (e.g. `onClick`).
<del> * @param {?function} listener The callback to store.
<add> * @param {function} listener The callback to store.
<ide> */
<ide> putListener: function(inst, registrationName, listener) {
<ide> invariant(
<ide> var EventPluginHub = {
<ide> },
<ide>
<ide> /**
<del> * @param {string} id ID of the DOM element.
<add> * @param {object} inst The instance, which is the source of events.
<ide> * @param {string} registrationName Name of listener (e.g. `onClick`).
<ide> * @return {?function} The stored callback.
<ide> */
<ide> var EventPluginHub = {
<ide> /**
<ide> * Deletes a listener from the registration bank.
<ide> *
<del> * @param {string} id ID of the DOM element.
<add> * @param {object} inst The instance, which is the source of events.
<ide> * @param {string} registrationName Name of listener (e.g. `onClick`).
<ide> */
<ide> deleteListener: function(inst, registrationName) {
<ide> var EventPluginHub = {
<ide> /**
<ide> * Deletes all listeners for the DOM element with the supplied ID.
<ide> *
<del> * @param {string} id ID of the DOM element.
<add> * @param {object} inst The instance, which is the source of events.
<ide> */
<ide> deleteAllListeners: function(inst) {
<ide> for (var registrationName in listenerBank) {
| 1
|
Python
|
Python
|
fix characterembed layer
|
5ae862857108db67d331ed68e703b034436b9e08
|
<ide><path>spacy/ml/_character_embed.py
<add>from typing import List
<ide> from thinc.api import Model
<add>from thinc.types import Floats2d
<add>from ..tokens import Doc
<ide>
<ide>
<del>def CharacterEmbed(nM, nC):
<add>def CharacterEmbed(nM: int, nC: int) -> Model[List[Doc], List[Floats2d]]:
<ide> # nM: Number of dimensions per character. nC: Number of characters.
<del> nO = nM * nC if (nM is not None and nC is not None) else None
<ide> return Model(
<ide> "charembed",
<ide> forward,
<ide> init=init,
<del> dims={"nM": nM, "nC": nC, "nO": nO, "nV": 256},
<add> dims={"nM": nM, "nC": nC, "nO": nM * nC, "nV": 256},
<ide> params={"E": None},
<del> ).initialize()
<add> )
<ide>
<ide>
<ide> def init(model, X=None, Y=None):
| 1
|
PHP
|
PHP
|
add a test class for trait usepusherchannelsnames
|
cdcb9e28205e1bd9104a79335619652772533f18
|
<ide><path>tests/Broadcasting/PusherBroadcasterTest.php
<ide> public function setUp()
<ide> $this->broadcaster = m::mock(PusherBroadcaster::class, [$this->pusher])->makePartial();
<ide> }
<ide>
<del> /**
<del> * @dataProvider channelsProvider
<del> */
<del> public function testChannelNameNormalization($requestChannelName, $normalizedName)
<del> {
<del> $this->assertEquals(
<del> $normalizedName,
<del> $this->broadcaster->normalizeChannelName($requestChannelName)
<del> );
<del> }
<del>
<del> /**
<del> * @dataProvider channelsProvider
<del> */
<del> public function testIsGuardedChannel($requestChannelName, $_, $guarded)
<del> {
<del> $this->assertEquals(
<del> $guarded,
<del> $this->broadcaster->isGuardedChannel($requestChannelName)
<del> );
<del> }
<del>
<ide> public function testAuthCallValidAuthenticationResponseWithPrivateChannelWhenCallbackReturnTrue()
<ide> {
<ide> $this->broadcaster->channel('test', function() {
<ide> public function testValidAuthenticationResponseCallPusherPresenceAuthMethodWithP
<ide> );
<ide> }
<ide>
<del> public function channelsProvider()
<del> {
<del> $prefixesInfos = [
<del> ['prefix' => 'private-', 'guarded' => true],
<del> ['prefix' => 'presence-', 'guarded' => true],
<del> ['prefix' => '', 'guarded' => false],
<del> ];
<del>
<del> $channels = [
<del> 'test',
<del> 'test-channel',
<del> 'test-private-channel',
<del> 'test-presence-channel',
<del> 'abcd.efgh',
<del> 'abcd.efgh.ijkl',
<del> 'test.{param}',
<del> 'test-{param}',
<del> '{a}.{b}',
<del> '{a}-{b}',
<del> '{a}-{b}.{c}',
<del> ];
<del>
<del> $tests = [];
<del> foreach ($prefixesInfos as $prefixInfos) {
<del> foreach ($channels as $channel) {
<del> $tests[] = [
<del> $prefixInfos['prefix'] . $channel,
<del> $channel,
<del> $prefixInfos['guarded'],
<del> ];
<del> }
<del> }
<del>
<del> $tests[] = ['private-private-test' , 'private-test', true];
<del> $tests[] = ['private-presence-test' , 'presence-test', true];
<del> $tests[] = ['presence-private-test' , 'private-test', true];
<del> $tests[] = ['presence-presence-test' , 'presence-test', true];
<del> $tests[] = ['public-test' , 'public-test', false];
<del>
<del> return $tests;
<del> }
<del>
<ide> /**
<ide> * @param string $channel
<ide> * @return \Illuminate\Http\Request
<ide><path>tests/Broadcasting/RedisBroadcasterTest.php
<ide> public function tearDown()
<ide> m::close();
<ide> }
<ide>
<del> /**
<del> * @dataProvider channelsProvider
<del> */
<del> public function testChannelNameNormalization($requestChannelName, $normalizedName)
<del> {
<del> $this->assertEquals(
<del> $normalizedName,
<del> $this->broadcaster->normalizeChannelName($requestChannelName)
<del> );
<del> }
<del>
<del> /**
<del> * @dataProvider channelsProvider
<del> */
<del> public function testIsGuardedChannel($requestChannelName, $_, $guarded)
<del> {
<del> $this->assertEquals(
<del> $guarded,
<del> $this->broadcaster->isGuardedChannel($requestChannelName)
<del> );
<del> }
<del>
<ide> public function testAuthCallValidAuthenticationResponseWithPrivateChannelWhenCallbackReturnTrue()
<ide> {
<ide> $this->broadcaster->channel('test', function() {
<ide> public function testValidAuthenticationResponseWithPresenceChannel()
<ide> );
<ide> }
<ide>
<del> public function channelsProvider()
<del> {
<del> $prefixesInfos = [
<del> ['prefix' => 'private-', 'guarded' => true],
<del> ['prefix' => 'presence-', 'guarded' => true],
<del> ['prefix' => '', 'guarded' => false],
<del> ];
<del>
<del> $channels = [
<del> 'test',
<del> 'test-channel',
<del> 'test-private-channel',
<del> 'test-presence-channel',
<del> 'abcd.efgh',
<del> 'abcd.efgh.ijkl',
<del> 'test.{param}',
<del> 'test-{param}',
<del> '{a}.{b}',
<del> '{a}-{b}',
<del> '{a}-{b}.{c}',
<del> ];
<del>
<del> $tests = [];
<del> foreach ($prefixesInfos as $prefixInfos) {
<del> foreach ($channels as $channel) {
<del> $tests[] = [
<del> $prefixInfos['prefix'] . $channel,
<del> $channel,
<del> $prefixInfos['guarded'],
<del> ];
<del> }
<del> }
<del>
<del> $tests[] = ['private-private-test' , 'private-test', true];
<del> $tests[] = ['private-presence-test' , 'presence-test', true];
<del> $tests[] = ['presence-private-test' , 'private-test', true];
<del> $tests[] = ['presence-presence-test' , 'presence-test', true];
<del> $tests[] = ['public-test' , 'public-test', false];
<del>
<del> return $tests;
<del> }
<del>
<ide> /**
<ide> * @param string $channel
<ide> * @return \Illuminate\Http\Request
<ide><path>tests/Broadcasting/UsePusherChannelsNamesTest.php
<add><?php
<add>
<add>namespace Illuminate\Tests\Broadcasting;
<add>
<add>use Illuminate\Broadcasting\Broadcasters\Broadcaster;
<add>use Illuminate\Broadcasting\Broadcasters\UsePusherChannelsNames;
<add>use Mockery as m;
<add>use PHPUnit\Framework\TestCase;
<add>
<add>class UsePusherChannelsNamesTest extends TestCase
<add>{
<add> /**
<add> * @var \Illuminate\Broadcasting\Broadcasters\RedisBroadcaster
<add> */
<add> public $broadcaster;
<add>
<add> public function setUp()
<add> {
<add> parent::setUp();
<add>
<add> $this->broadcaster = new FakeBroadcasterUsingPusherChannelsNames();
<add> }
<add>
<add> public function tearDown()
<add> {
<add> m::close();
<add> }
<add>
<add> /**
<add> * @dataProvider channelsProvider
<add> */
<add> public function testChannelNameNormalization($requestChannelName, $normalizedName)
<add> {
<add> $this->assertEquals(
<add> $normalizedName,
<add> $this->broadcaster->normalizeChannelName($requestChannelName)
<add> );
<add> }
<add>
<add> /**
<add> * @dataProvider channelsProvider
<add> */
<add> public function testIsGuardedChannel($requestChannelName, $_, $guarded)
<add> {
<add> $this->assertEquals(
<add> $guarded,
<add> $this->broadcaster->isGuardedChannel($requestChannelName)
<add> );
<add> }
<add>
<add> public function channelsProvider()
<add> {
<add> $prefixesInfos = [
<add> ['prefix' => 'private-', 'guarded' => true],
<add> ['prefix' => 'presence-', 'guarded' => true],
<add> ['prefix' => '', 'guarded' => false],
<add> ];
<add>
<add> $channels = [
<add> 'test',
<add> 'test-channel',
<add> 'test-private-channel',
<add> 'test-presence-channel',
<add> 'abcd.efgh',
<add> 'abcd.efgh.ijkl',
<add> 'test.{param}',
<add> 'test-{param}',
<add> '{a}.{b}',
<add> '{a}-{b}',
<add> '{a}-{b}.{c}',
<add> ];
<add>
<add> $tests = [];
<add> foreach ($prefixesInfos as $prefixInfos) {
<add> foreach ($channels as $channel) {
<add> $tests[] = [
<add> $prefixInfos['prefix'] . $channel,
<add> $channel,
<add> $prefixInfos['guarded'],
<add> ];
<add> }
<add> }
<add>
<add> $tests[] = ['private-private-test' , 'private-test', true];
<add> $tests[] = ['private-presence-test' , 'presence-test', true];
<add> $tests[] = ['presence-private-test' , 'private-test', true];
<add> $tests[] = ['presence-presence-test' , 'presence-test', true];
<add> $tests[] = ['public-test' , 'public-test', false];
<add>
<add> return $tests;
<add> }
<add>}
<add>
<add>class FakeBroadcasterUsingPusherChannelsNames extends Broadcaster
<add>{
<add> use UsePusherChannelsNames;
<add>
<add> public function auth($request)
<add> {
<add> }
<add>
<add> public function validAuthenticationResponse($request, $result)
<add> {
<add> }
<add>
<add> public function broadcast(array $channels, $event, array $payload = [])
<add> {
<add> }
<add>}
| 3
|
Text
|
Text
|
improve docs on android native modules
|
8d525b95dc0d7762838df9dc29fea25c5a9d1c0e
|
<ide><path>docs/NativeModulesAndroid.md
<ide> public class UIManagerModule extends ReactContextBaseJavaModule {
<ide>
<ide> promise.resolve(map);
<ide> } catch (IllegalViewOperationException e) {
<del> promise.reject(e.getMessage());
<add> promise.reject(e);
<ide> }
<ide> }
<ide>
<ide> componentWillMount: function() {
<ide> }
<ide> ...
<ide> ```
<add>
<add>### Getting activity result from `startActivityForResult`
<add>
<add>You'll need to listen to `onActivityResult` if you want to get results from an activity you started with `startActivityForResult`. To to do this, the module must implement `ActivityEventListener`. Then, you need to register a listener in the module's constructor,
<add>
<add>```java
<add>reactContext.addActivityEventListener(this);
<add>```
<add>
<add>Now you can listen to `onActivityResult` by implementing the following method:
<add>
<add>```java
<add>@Override
<add>public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
<add> // Your logic here
<add>}
<add>```
<add>
<add>We will implement a simple image picker to demonstrate this. The image picker will expose the method `pickImage` to JavaScript, which will return the path of the image when called.
<add>
<add>```java
<add>public class ImagePickerModule extends ReactContextBaseJavaModule implements ActivityEventListener {
<add>
<add> private static final int IMAGE_PICKER_REQUEST = 467081;
<add> private static final String E_ACTIVITY_DOES_NOT_EXIST = "E_ACTIVITY_DOES_NOT_EXIST";
<add> private static final String E_PICKER_CANCELLED = "E_PICKER_CANCELLED";
<add> private static final String E_FAILED_TO_SHOW_PICKER = "E_FAILED_TO_SHOW_PICKER";
<add> private static final String E_NO_IMAGE_DATA_FOUND = "E_NO_IMAGE_DATA_FOUND";
<add>
<add> private Promise mPickerPromise;
<add>
<add> public ImagePickerModule(ReactApplicationContext reactContext) {
<add> super(reactContext);
<add>
<add> // Add the listener for `onActivityResult`
<add> reactContext.addActivityEventListener(this);
<add> }
<add>
<add> @Override
<add> public String getName() {
<add> return "ImagePickerModule";
<add> }
<add>
<add> @ReactMethod
<add> public void pickImage(final Promise promise) {
<add> Activity currentActivity = getCurrentActivity();
<add>
<add> if (currentActivity == null) {
<add> promise.reject(E_ACTIVITY_DOES_NOT_EXIST, "Activity doesn't exist");
<add> return;
<add> }
<add>
<add> // Store the promise to resolve/reject when picker returns data
<add> mPickerPromise = promise;
<add>
<add> try {
<add> final Intent galleryIntent = new Intent(Intent.ACTION_PICK);
<add>
<add> galleryIntent.setType("image/*");
<add>
<add> final Intent chooserIntent = Intent.createChooser(galleryIntent, "Pick an image");
<add>
<add> currentActivity.startActivityForResult(chooserIntent, PICK_IMAGE);
<add> } catch (Exception e) {
<add> mPickerPromise.reject(E_FAILED_TO_SHOW_PICKER, e);
<add> mPickerPromise = null;
<add> }
<add> }
<add>
<add> // You can get the result here
<add> @Override
<add> public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
<add> if (requestCode == IMAGE_PICKER_REQUEST) {
<add> if (mPickerPromise != null) {
<add> if (resultCode == Activity.RESULT_CANCELED) {
<add> mPickerPromise.reject(E_PICKER_CANCELLED, "Image picker was cancelled");
<add> } else if (resultCode == Activity.RESULT_OK) {
<add> Uri uri = intent.getData();
<add>
<add> if (uri == null) {
<add> mPickerPromise.reject(E_NO_IMAGE_DATA_FOUND, "No image data found");
<add> } else {
<add> mPickerPromise.resolve(uri.toString());
<add> }
<add> }
<add>
<add> mPickerPromise = null;
<add> }
<add> }
<add> }
<add>}
<add>```
<add>
<add>### Listening to LifeCycle events
<add>
<add>Listening to the activity's LifeCycle events such as `onResume`, `onPause` etc. is very similar to how we implemented `ActivityEventListener`. The module must implement `ActivityEventListener`. Then, you need to register a listener in the module's constructor,
<add>
<add>```java
<add>reactContext.addLifecycleEventListener(this);
<add>```
<add>
<add>Now you can listen to the activity's LifeCycle events by implementing the following methods:
<add>
<add>```java
<add>@Override
<add>public void onHostResume() {
<add> // Actvity `onResume`
<add>}
<add>
<add>@Override
<add>public void onHostPause() {
<add> // Actvity `onPause`
<add>}
<add>
<add>@Override
<add>public void onHostDestroy() {
<add> // Actvity `onDestroy`
<add>}
<add>```
| 1
|
Ruby
|
Ruby
|
update the levenshtein distance method in guides
|
d740b58a26e86c5e02988cdb5990d707365efe3e
|
<ide><path>guides/rails_guides/levenshtein.rb
<ide> module RailsGuides
<ide> module Levenshtein
<del> # Based on the pseudocode in http://en.wikipedia.org/wiki/Levenshtein_distance
<del> def self.distance(s1, s2)
<del> s = s1.unpack('U*')
<del> t = s2.unpack('U*')
<del> m = s.length
<del> n = t.length
<add> # This code is based directly on the Text gem implementation
<add> # Returns a value representing the "cost" of transforming str1 into str2
<add> def self.distance str1, str2
<add> s = str1
<add> t = str2
<add> n = s.length
<add> m = t.length
<add> max = n/2
<ide>
<del> # matrix initialization
<del> d = []
<del> 0.upto(m) { |i| d << [i] }
<del> 0.upto(n) { |j| d[0][j] = j }
<add> return m if (0 == n)
<add> return n if (0 == m)
<add> return n if (n - m).abs > max
<ide>
<del> # distance computation
<del> 1.upto(m) do |i|
<del> 1.upto(n) do |j|
<del> cost = s[i] == t[j] ? 0 : 1
<del> d[i][j] = [
<del> d[i-1][j] + 1, # deletion
<del> d[i][j-1] + 1, # insertion
<del> d[i-1][j-1] + cost, # substitution
<del> ].min
<add> d = (0..m).to_a
<add> x = nil
<add>
<add> str1.each_char.each_with_index do |char1,i|
<add> e = i+1
<add>
<add> str2.each_char.each_with_index do |char2,j|
<add> cost = (char1 == char2) ? 0 : 1
<add> x = [
<add> d[j+1] + 1, # insertion
<add> e + 1, # deletion
<add> d[j] + cost # substitution
<add> ].min
<add> d[j] = e
<add> e = x
<ide> end
<add>
<add> d[m] = x
<ide> end
<ide>
<del> # all done
<del> return d[m][n]
<add> return x
<ide> end
<ide> end
<ide> end
| 1
|
Javascript
|
Javascript
|
make dns.promises enumerable
|
61e4d89098e63c1dad0b2de7beeed1277abf5af3
|
<ide><path>lib/dns.js
<ide> bindDefaultResolver(module.exports, getDefaultResolver());
<ide> Object.defineProperties(module.exports, {
<ide> promises: {
<ide> configurable: true,
<del> enumerable: false,
<add> enumerable: true,
<ide> get() {
<ide> if (promises === null) {
<ide> promises = require('internal/dns/promises');
| 1
|
PHP
|
PHP
|
allow top level array containing a table name
|
59e1cdd78038d73b573fc4f5208cfe46bb050896
|
<ide><path>Cake/ORM/Marshaller.php
<ide> public function __construct(Table $table, $safe = false) {
<ide> public function one(array $data, $include = []) {
<ide> $include = Hash::normalize($include);
<ide>
<add> $tableName = $this->_table->alias();
<ide> $entityClass = $this->_table->entityClass();
<del>
<ide> $entity = new $entityClass();
<add>
<add> if (isset($data[$tableName])) {
<add> $data = $data[$tableName];
<add> }
<add>
<ide> foreach ($data as $key => $value) {
<ide> $assoc = null;
<ide> if (array_key_exists($key, $include)) {
<ide><path>Cake/Test/TestCase/ORM/MarshallerTest.php
<ide> public function testOneSimple() {
<ide> $this->assertNull($result->isNew(), 'Should be detached');
<ide> }
<ide>
<add>/**
<add> * test one() with a wrapping model name.
<add> *
<add> * @return void
<add> */
<add> public function testOneWithAdditionalName() {
<add> $data = [
<add> 'Articles' => [
<add> 'title' => 'My title',
<add> 'body' => 'My content',
<add> 'author_id' => 1,
<add> 'not_in_schema' => true,
<add> 'Users' => [
<add> 'username' => 'mark',
<add> ]
<add> ]
<add> ];
<add> $marshall = new Marshaller($this->articles);
<add> $result = $marshall->one($data, ['Users']);
<add>
<add> $this->assertInstanceOf('Cake\ORM\Entity', $result);
<add> $this->assertTrue($result->dirty(), 'Should be a dirty entity.');
<add> $this->assertNull($result->isNew(), 'Should be detached');
<add> $this->assertEquals($data['Articles']['title'], $result->title);
<add> $this->assertEquals($data['Articles']['Users']['username'], $result->user->username);
<add> }
<add>
<ide> /**
<ide> * test one() with association data.
<ide> *
| 2
|
Text
|
Text
|
fix vm.script createcacheddata example
|
047cd618593372f91dada42f29cc9a8e35cda22c
|
<ide><path>doc/api/vm.md
<ide> Creates a code cache that can be used with the `Script` constructor's
<ide> `cachedData` option. Returns a `Buffer`. This method may be called at any
<ide> time and any number of times.
<ide>
<add>The code cache of the `Script` doesn't contain any JavaScript observable
<add>states. The code cache is safe to be saved along side the script source and
<add>used to construct new `Script` instances multiple times.
<add>
<add>Functions in the `Script` source can be marked as lazily compiled and they are
<add>not compiled at construction of the `Script`. These functions are going to be
<add>compiled when they are invoked the first time. The code cache serializes the
<add>metadata that V8 currently knows about the `Script` that it can use to speed up
<add>future compilations.
<add>
<ide> ```js
<ide> const script = new vm.Script(`
<ide> function add(a, b) {
<ide> function add(a, b) {
<ide> const x = add(1, 2);
<ide> `);
<ide>
<del>const cacheWithoutX = script.createCachedData();
<add>const cacheWithoutAdd = script.createCachedData();
<add>// In `cacheWithoutAdd` the function `add()` is marked for full compilation
<add>// upon invocation.
<ide>
<ide> script.runInThisContext();
<ide>
<del>const cacheWithX = script.createCachedData();
<add>const cacheWithAdd = script.createCachedData();
<add>// `cacheWithAdd` contains fully compiled function `add()`.
<ide> ```
<ide>
<ide> ### `script.runInContext(contextifiedObject[, options])`
<ide> Creates a code cache that can be used with the `SourceTextModule` constructor's
<ide> `cachedData` option. Returns a `Buffer`. This method may be called any number
<ide> of times before the module has been evaluated.
<ide>
<add>The code cache of the `SourceTextModule` doesn't contain any JavaScript
<add>observable states. The code cache is safe to be saved along side the script
<add>source and used to construct new `SourceTextModule` instances multiple times.
<add>
<add>Functions in the `SourceTextModule` source can be marked as lazily compiled
<add>and they are not compiled at construction of the `SourceTextModule`. These
<add>functions are going to be compiled when they are invoked the first time. The
<add>code cache serializes the metadata that V8 currently knows about the
<add>`SourceTextModule` that it can use to speed up future compilations.
<add>
<ide> ```js
<ide> // Create an initial module
<ide> const module = new vm.SourceTextModule('const a = 1;');
| 1
|
Text
|
Text
|
fix heading levels for test runner hooks
|
0076c38f76d7467d46343039261d28a7dd4bee75
|
<ide><path>doc/api/test.md
<ide> same as [`it([name], { skip: true }[, fn])`][it options].
<ide> Shorthand for marking a test as `TODO`,
<ide> same as [`it([name], { todo: true }[, fn])`][it options].
<ide>
<del>### `before([, fn][, options])`
<add>## `before([, fn][, options])`
<ide>
<ide> <!-- YAML
<ide> added: v18.8.0
<ide> describe('tests', async () => {
<ide> });
<ide> ```
<ide>
<del>### `after([, fn][, options])`
<add>## `after([, fn][, options])`
<ide>
<ide> <!-- YAML
<ide> added: v18.8.0
<ide> describe('tests', async () => {
<ide> });
<ide> ```
<ide>
<del>### `beforeEach([, fn][, options])`
<add>## `beforeEach([, fn][, options])`
<ide>
<ide> <!-- YAML
<ide> added: v18.8.0
<ide> describe('tests', async () => {
<ide> });
<ide> ```
<ide>
<del>### `afterEach([, fn][, options])`
<add>## `afterEach([, fn][, options])`
<ide>
<ide> <!-- YAML
<ide> added: v18.8.0
| 1
|
Javascript
|
Javascript
|
add static version of passive subtree tag
|
93a0c2830534cfbc4e6be3ecc9c9fc34dee3cfaa
|
<ide><path>packages/react-reconciler/src/ReactFiberWorkLoop.new.js
<ide> import {
<ide> Mutation as MutationSubtreeTag,
<ide> Layout as LayoutSubtreeTag,
<ide> Passive as PassiveSubtreeTag,
<add> PassiveStatic as PassiveStaticSubtreeTag,
<ide> } from './ReactSubtreeTags';
<ide> import {
<ide> NoLanePriority,
<ide> function resetChildLanes(completedWork: Fiber) {
<ide> if ((effectTag & PassiveMask) !== NoEffect) {
<ide> subtreeTag |= PassiveSubtreeTag;
<ide> }
<add> if ((effectTag & PassiveStatic) !== NoEffect) {
<add> subtreeTag |= PassiveStaticSubtreeTag;
<add> }
<ide>
<ide> // When a fiber is cloned, its actualDuration is reset to 0. This value will
<ide> // only be updated if work is done on the fiber (i.e. it doesn't bailout).
<ide> function resetChildLanes(completedWork: Fiber) {
<ide> if ((effectTag & PassiveMask) !== NoEffect) {
<ide> subtreeTag |= PassiveSubtreeTag;
<ide> }
<add> if ((effectTag & PassiveStatic) !== NoEffect) {
<add> subtreeTag |= PassiveStaticSubtreeTag;
<add> }
<ide>
<ide> child = child.sibling;
<ide> }
<ide> function flushPassiveUnmountEffects(firstChild: Fiber): void {
<ide> for (let i = 0; i < deletions.length; i++) {
<ide> const fiberToDelete = deletions[i];
<ide> // If this fiber (or anything below it) has passive effects then traverse the subtree.
<del> const primaryEffectTag = fiberToDelete.effectTag & PassiveMask;
<del> const primarySubtreeTag = fiberToDelete.subtreeTag & PassiveSubtreeTag;
<add> const primaryEffectTag = fiberToDelete.effectTag & PassiveStatic;
<add> const primarySubtreeTag =
<add> fiberToDelete.subtreeTag & PassiveStaticSubtreeTag;
<ide> if (
<ide> primarySubtreeTag !== NoSubtreeTag ||
<ide> primaryEffectTag !== NoEffect
<ide> function flushPassiveUnmountEffectsInsideOfDeletedTree(
<ide> // Note that this requires checking subtreeTag of the current Fiber,
<ide> // rather than the subtreeTag/effectsTag of the first child,
<ide> // since that would not cover passive effects in siblings.
<del> const primarySubtreeTag = fiber.subtreeTag & PassiveSubtreeTag;
<add> const primarySubtreeTag = fiber.subtreeTag & PassiveStaticSubtreeTag;
<ide> if (primarySubtreeTag !== NoSubtreeTag) {
<ide> flushPassiveUnmountEffectsInsideOfDeletedTree(child);
<ide> }
<ide><path>packages/react-reconciler/src/ReactSideEffectTags.js
<ide> export const PassiveStatic = /* */ 0b1000000000000000;
<ide> export const BeforeMutationMask = /* */ 0b0000001100001010;
<ide> export const MutationMask = /* */ 0b0000010010011110;
<ide> export const LayoutMask = /* */ 0b0000000010100100;
<del>export const PassiveMask = /* */ 0b1000001000001000;
<add>export const PassiveMask = /* */ 0b0000001000001000;
<ide>
<ide> // Union of tags that don't get reset on clones.
<ide> // This allows certain concepts to persist without recalculting them,
<ide><path>packages/react-reconciler/src/ReactSubtreeTags.js
<ide>
<ide> export type SubtreeTag = number;
<ide>
<del>export const NoEffect = /* */ 0b0000;
<del>export const BeforeMutation = /* */ 0b0001;
<del>export const Mutation = /* */ 0b0010;
<del>export const Layout = /* */ 0b0100;
<del>export const Passive = /* */ 0b1000;
<add>export const NoEffect = /* */ 0b00000;
<add>export const BeforeMutation = /* */ 0b00001;
<add>export const Mutation = /* */ 0b00010;
<add>export const Layout = /* */ 0b00100;
<add>export const Passive = /* */ 0b01000;
<add>export const PassiveStatic = /* */ 0b10000;
<ide><path>packages/react-reconciler/src/__tests__/SchedulingProfiler-test.internal.js
<ide> describe('SchedulingProfiler', () => {
<ide> '--layout-effects-start-1024',
<ide> '--layout-effects-stop',
<ide> '--commit-stop',
<del> '--passive-effects-start-1024',
<del> '--passive-effects-stop',
<ide> ]);
<ide> }
<ide> });
| 4
|
Ruby
|
Ruby
|
require "time" where we depend on time#xmlschema
|
74ab4d930d78180e13b5999b6623f2e924339162
|
<ide><path>activesupport/lib/active_support/core_ext.rb
<ide> # frozen_string_literal: true
<ide>
<del>Dir.glob(File.expand_path("core_ext/*.rb", __dir__)).each do |path|
<add>Dir.glob(File.expand_path("core_ext/*.rb", __dir__)).sort.each do |path|
<ide> require path
<ide> end
<ide><path>activesupport/lib/active_support/core_ext/time/conversions.rb
<ide> # frozen_string_literal: true
<ide>
<add>require "time"
<ide> require "active_support/inflector/methods"
<ide> require "active_support/values/time_zone"
<ide>
| 2
|
Ruby
|
Ruby
|
remove old setup from as test case
|
90745897b991e02e758c635a03062d1bec288300
|
<ide><path>activesupport/lib/active_support/test_case.rb
<ide> class TestCase < ::Minitest::Test
<ide>
<ide> alias_method :method_name, :name
<ide>
<del> $tags = {}
<del> def self.for_tag(tag)
<del> yield if $tags[tag]
<del> end
<del>
<ide> include ActiveSupport::Testing::TaggedLogging
<ide> include ActiveSupport::Testing::SetupAndTeardown
<ide> include ActiveSupport::Testing::Assertions
| 1
|
Ruby
|
Ruby
|
produce good error messages for bad tarballs
|
05991dd846ac54b10cd78453b140de8bfb259392
|
<ide><path>Library/Homebrew/extend/pathname.rb
<ide> def compression_type
<ide> when /^\xFD7zXZ\x00/ then :xz
<ide> when /^Rar!/ then :rar
<ide> else
<del> # Assume it is not an archive
<del> nil
<add> # This code so that bad-tarballs and zips produce good error messages
<add> # when they don't unarchive properly.
<add> case extname
<add> when ".tar.gz", ".tgz", ".tar.bz2", ".tbz" then :tar
<add> when ".zip" then :zip
<add> end
<ide> end
<ide> end
<ide>
| 1
|
Javascript
|
Javascript
|
set nodeintegration to true
|
1bc06505d5cccb452724c5628f6288787f16aa44
|
<ide><path>src/main-process/atom-window.js
<ide> module.exports = class AtomWindow extends EventEmitter {
<ide> // Disable the `auxclick` feature so that `click` events are triggered in
<ide> // response to a middle-click.
<ide> // (Ref: https://github.com/atom/atom/pull/12696#issuecomment-290496960)
<del> disableBlinkFeatures: 'Auxclick'
<add> disableBlinkFeatures: 'Auxclick',
<add> nodeIntegration: true
<ide> }
<ide> };
<ide>
| 1
|
Python
|
Python
|
replace reference to np.swapaxis with np.swapaxes
|
0c4f621ad18ce4fbf6740943de59c4e2d5c7841c
|
<ide><path>numpy/core/numeric.py
<ide> def moveaxis(a, source, destination):
<ide>
<ide> >>> np.transpose(x).shape
<ide> (5, 4, 3)
<del> >>> np.swapaxis(x, 0, -1).shape
<add> >>> np.swapaxes(x, 0, -1).shape
<ide> (5, 4, 3)
<ide> >>> np.moveaxis(x, [0, 1], [-1, -2]).shape
<ide> (5, 4, 3)
| 1
|
Text
|
Text
|
fix grammatical error in swarm_leave.md
|
248b1c23d37e1e32af66583f8d14d9f8742280ef
|
<ide><path>docs/reference/commandline/swarm_leave.md
<ide> Options:
<ide>
<ide> When you run this command on a worker, that worker leaves the swarm.
<ide>
<del>You can use the `--force` option to on a manager to remove it from the swarm.
<add>You can use the `--force` option on a manager to remove it from the swarm.
<ide> However, this does not reconfigure the swarm to ensure that there are enough
<ide> managers to maintain a quorum in the swarm. The safe way to remove a manager
<ide> from a swarm is to demote it to a worker and then direct it to leave the quorum
| 1
|
Python
|
Python
|
add more info to failure message
|
0f4dc765e24caca49eaf74b03ac56894c6f82b80
|
<ide><path>numpy/core/__init__.py
<ide>
<ide> IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
<ide>
<del>Importing the multiarray numpy extension module failed. Most
<del>likely you are trying to import a failed build of numpy.
<del>Here is how to proceed:
<del>- If you're working with a numpy git repository, try `git clean -xdf`
<del> (removes all files not under version control) and rebuild numpy.
<del>- If you are simply trying to use the numpy version that you have installed:
<del> your installation is broken - please reinstall numpy.
<del>- If you have already reinstalled and that did not fix the problem, then:
<del> 1. Check that you are using the Python you expect (you're using %s),
<add>Importing the numpy c-extensions failed.
<add>- Try uninstalling and reinstalling numpy.
<add>- If you have already done that, then:
<add> 1. Check that you expected to use Python%d.%d from "%s",
<ide> and that you have no directories in your PATH or PYTHONPATH that can
<del> interfere with the Python and numpy versions you're trying to use.
<add> interfere with the Python and numpy version "%s" you're trying to use.
<ide> 2. If (1) looks fine, you can open a new issue at
<ide> https://github.com/numpy/numpy/issues. Please include details on:
<ide> - how you installed Python
<ide> - whether or not you have multiple versions of Python installed
<ide> - if you built from source, your compiler versions and ideally a build log
<ide>
<del> Note: this error has many possible causes, so please don't comment on
<del> an existing issue about this - open a new one instead.
<add>- If you're working with a numpy git repository, try `git clean -xdf`
<add> (removes all files not under version control) and rebuild numpy.
<add>
<add>Note: this error has many possible causes, so please don't comment on
<add>an existing issue about this - open a new one instead.
<ide>
<ide> Original error was: %s
<del>""" % (sys.executable, exc)
<add>""" % (sys.version_info[0], sys.version_info[1], sys.executable,
<add> __version__, exc)
<ide> raise ImportError(msg)
<ide> finally:
<ide> for envkey in env_added:
| 1
|
Ruby
|
Ruby
|
create indexes inline in create table for mysql
|
afa148a4f0ac5e2a446b5fe87881a130e8a24f3d
|
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
<ide> def column_exists?(table_name, column_name, type = nil, options = {})
<ide> def create_table(table_name, options = {})
<ide> td = create_table_definition table_name, options[:temporary], options[:options], options[:as]
<ide>
<del> if !options[:as]
<del> unless options[:id] == false
<del> pk = options.fetch(:primary_key) {
<del> Base.get_primary_key table_name.to_s.singularize
<del> }
<del>
<del> td.primary_key pk, options.fetch(:id, :primary_key), options
<del> end
<add> unless options[:id] == false || options[:as]
<add> pk = options.fetch(:primary_key) {
<add> Base.get_primary_key table_name.to_s.singularize
<add> }
<ide>
<del> yield td if block_given?
<add> td.primary_key pk, options.fetch(:id, :primary_key), options
<ide> end
<ide>
<add> yield td if block_given?
<add>
<ide> if options[:force] && table_exists?(table_name)
<ide> drop_table(table_name, options)
<ide> end
<ide>
<del> execute schema_creation.accept td
<del> td.indexes.each_pair { |c,o| add_index table_name, c, o }
<add> result = execute schema_creation.accept td
<add> td.indexes.each_pair { |c,o| add_index table_name, c, o } unless supports_indexes_in_create?
<add> result
<ide> end
<ide>
<ide> # Creates a new join table with the name created using the lexical order of the first two
<ide><path>activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
<ide> def supports_extensions?
<ide> false
<ide> end
<ide>
<add> # Does this adapter support creating indexes in the same statement as
<add> # creating the table? As of this writing, only mysql does.
<add> def supports_indexes_in_create?
<add> false
<add> end
<add>
<ide> # This is meant to be implemented by the adapters that support extensions
<ide> def disable_extension(name)
<ide> end
<ide><path>activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
<ide> class AbstractMysqlAdapter < AbstractAdapter
<ide> include Savepoints
<ide>
<ide> class SchemaCreation < AbstractAdapter::SchemaCreation
<add> def visit_TableDefinition(o)
<add> create_sql = "CREATE#{' TEMPORARY' if o.temporary} TABLE "
<add> create_sql << "#{quote_table_name(o.name)} "
<add> statements = []
<add> statements.concat(o.columns.map { |c| accept c })
<add> statements.concat(o.indexes.map { |(column_name, options)| index_in_create(o.name, column_name, options) })
<add> create_sql << "(#{statements.join(', ')}) "
<add> create_sql << "#{o.options}"
<add> create_sql << " AS #{@conn.to_sql(o.as)}" if o.as
<add> create_sql
<add> end
<ide>
<ide> def visit_AddColumn(o)
<ide> add_column_position!(super, column_options(o))
<ide> def add_column_position!(sql, options)
<ide> end
<ide> sql
<ide> end
<add>
<add> def index_in_create(table_name, column_name, options)
<add> index_name, index_type, index_columns, index_options, index_algorithm, index_using = @conn.send(:add_index_options, table_name, column_name, options)
<add> "#{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})#{index_options} #{index_algorithm}".gsub(' ', ' ').strip
<add> end
<ide> end
<ide>
<ide> def schema_creation
<ide> def supports_transaction_isolation?
<ide> version[0] >= 5
<ide> end
<ide>
<add> def supports_indexes_in_create?
<add> true
<add> end
<add>
<ide> def native_database_types
<ide> NATIVE_DATABASE_TYPES
<ide> end
<ide><path>activerecord/test/cases/adapters/mysql/active_schema_test.rb
<ide> def test_remove_timestamps
<ide> end
<ide> end
<ide>
<add> def test_indexes_in_create
<add> begin
<add> ActiveRecord::Base.connection.stubs(:index_name_exists?).returns(false)
<add> expected = "CREATE TEMPORARY TABLE `temp` (INDEX `index_temp_on_zip` (`zip`)) ENGINE=InnoDB AS SELECT id, name, zip FROM a_really_complicated_query"
<add> actual = ActiveRecord::Base.connection.create_table(:temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query") do |t|
<add> t.index :zip
<add> end
<add> assert_equal expected, actual
<add> end
<add> end
<add>
<ide> private
<ide> def with_real_execute
<ide> ActiveRecord::Base.connection.singleton_class.class_eval do
<ide><path>activerecord/test/cases/adapters/mysql2/active_schema_test.rb
<ide> def test_remove_timestamps
<ide> end
<ide> end
<ide>
<add> def test_indexes_in_create
<add> begin
<add> ActiveRecord::Base.connection.stubs(:index_name_exists?).returns(false)
<add> expected = "CREATE TEMPORARY TABLE `temp` (INDEX `index_temp_on_zip` (`zip`)) ENGINE=InnoDB AS SELECT id, name, zip FROM a_really_complicated_query"
<add> actual = ActiveRecord::Base.connection.create_table(:temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query") do |t|
<add> t.index :zip
<add> end
<add> assert_equal expected, actual
<add> end
<add> end
<add>
<ide> private
<ide> def with_real_execute
<ide> ActiveRecord::Base.connection.singleton_class.class_eval do
| 5
|
PHP
|
PHP
|
add loadfactoriesfrom method
|
7c116138df46dfa19e48664a6f36f9283d896550
|
<ide><path>src/Illuminate/Support/ServiceProvider.php
<ide>
<ide> use Illuminate\Console\Application as Artisan;
<ide> use Illuminate\Contracts\Support\DeferrableProvider;
<add>use Illuminate\Database\Eloquent\Factory as ModelFactory;
<ide>
<ide> abstract class ServiceProvider
<ide> {
<ide> protected function loadMigrationsFrom($paths)
<ide> });
<ide> }
<ide>
<add> /**
<add> * Register an Eloquent model factory path.
<add> *
<add> * @param array|string $paths
<add> * @return void
<add> */
<add> protected function loadFactoriesFrom($paths)
<add> {
<add> $this->callAfterResolving(ModelFactory::class, function ($factory) use ($paths) {
<add> foreach ((array) $paths as $path) {
<add> $factory->load($path);
<add> }
<add> });
<add> }
<add>
<ide> /**
<ide> * Setup an after resolving listener, or fire immediately if already resolved.
<ide> *
| 1
|
Python
|
Python
|
fix loading from transfo-xl lm model
|
1756b5e9568c3f5d754d0fe6d7a39134e3753ab5
|
<ide><path>pytorch_pretrained_bert/modeling_transfo_xl.py
<ide> def build_tf_to_pytorch_map(model, config):
<ide> This time I use a map to keep the PyTorch model as identical to the original PyTorch model as possible.
<ide> """
<ide> tf_to_pt_map = {}
<add>
<add> if hasattr(model, 'transformer'):
<add> # We are loading in a TransfoXLLMHeadModel => we will load also the Adaptive Softmax
<add> tf_to_pt_map.update({
<add> "transformer/adaptive_softmax/cutoff_0/cluster_W": model.crit.cluster_weight,
<add> "transformer/adaptive_softmax/cutoff_0/cluster_b": model.crit.cluster_bias})
<add> for i, (out_l, proj_l, tie_proj) in enumerate(zip(
<add> model.crit.out_layers,
<add> model.crit.out_projs,
<add> config.tie_projs)):
<add> layer_str = "transformer/adaptive_softmax/cutoff_%d/" % i
<add> if config.tie_weight:
<add> tf_to_pt_map.update({
<add> layer_str + 'b': out_l.bias})
<add> else:
<add> raise NotImplementedError
<add> # I don't think this is implemented in the TF code
<add> tf_to_pt_map.update({
<add> layer_str + 'lookup_table': out_l.weight,
<add> layer_str + 'b': out_l.bias})
<add> if not tie_proj:
<add> tf_to_pt_map.update({
<add> layer_str + 'proj': proj_l
<add> })
<add> # Now load the rest of the transformer
<add> model = model.transformer
<add>
<ide> # Embeddings
<ide> for i, (embed_l, proj_l) in enumerate(zip(model.word_emb.emb_layers, model.word_emb.emb_projs)):
<ide> layer_str = "transformer/adaptive_embed/cutoff_%d/" % i
<ide> def build_tf_to_pytorch_map(model, config):
<ide> layer_str + "ff/layer_2/bias": b.pos_ff.CoreNet[3].bias,
<ide> })
<ide>
<del> # Adaptive Softmax
<del> tf_to_pt_map.update({
<del> "transformer/adaptive_softmax/cutoff_0/cluster_W": model.crit.cluster_weight,
<del> "transformer/adaptive_softmax/cutoff_0/cluster_b": model.crit.cluster_bias})
<del> for i, (out_l, proj_l, tie_proj) in enumerate(zip(
<del> model.crit.out_layers,
<del> model.crit.out_projs,
<del> config.tie_projs)):
<del> layer_str = "transformer/adaptive_softmax/cutoff_%d/" % i
<del> if config.tie_weight:
<del> tf_to_pt_map.update({
<del> layer_str + 'b': out_l.bias})
<del> else:
<del> raise NotImplementedError
<del> # I don't think this is implemented in the TF code
<del> tf_to_pt_map.update({
<del> layer_str + 'lookup_table': out_l.weight,
<del> layer_str + 'b': out_l.bias})
<del> if not tie_proj:
<del> tf_to_pt_map.update({
<del> layer_str + 'proj': proj_l
<del> })
<del>
<ide> # Relative positioning biases
<ide> if config.untie_r:
<ide> r_r_list = []
| 1
|
Python
|
Python
|
fix some spelling errors
|
48df7af2089d1f7be8aee646a89d5423b9a9a6b1
|
<ide><path>numpy/_array_api/_array_object.py
<ide> def __rxor__(self: Array, other: Union[int, bool, Array], /) -> Array:
<ide> @property
<ide> def dtype(self) -> Dtype:
<ide> """
<del> Array API compatible wrapper for :py:meth:`np.ndaray.dtype <numpy.ndarray.dtype>`.
<add> Array API compatible wrapper for :py:meth:`np.ndarray.dtype <numpy.ndarray.dtype>`.
<ide>
<ide> See its docstring for more information.
<ide> """
<ide> def device(self) -> Device:
<ide> @property
<ide> def ndim(self) -> int:
<ide> """
<del> Array API compatible wrapper for :py:meth:`np.ndaray.ndim <numpy.ndarray.ndim>`.
<add> Array API compatible wrapper for :py:meth:`np.ndarray.ndim <numpy.ndarray.ndim>`.
<ide>
<ide> See its docstring for more information.
<ide> """
<ide> def ndim(self) -> int:
<ide> @property
<ide> def shape(self) -> Tuple[int, ...]:
<ide> """
<del> Array API compatible wrapper for :py:meth:`np.ndaray.shape <numpy.ndarray.shape>`.
<add> Array API compatible wrapper for :py:meth:`np.ndarray.shape <numpy.ndarray.shape>`.
<ide>
<ide> See its docstring for more information.
<ide> """
<ide> def shape(self) -> Tuple[int, ...]:
<ide> @property
<ide> def size(self) -> int:
<ide> """
<del> Array API compatible wrapper for :py:meth:`np.ndaray.size <numpy.ndarray.size>`.
<add> Array API compatible wrapper for :py:meth:`np.ndarray.size <numpy.ndarray.size>`.
<ide>
<ide> See its docstring for more information.
<ide> """
<ide> def size(self) -> int:
<ide> @property
<ide> def T(self) -> Array:
<ide> """
<del> Array API compatible wrapper for :py:meth:`np.ndaray.T <numpy.ndarray.T>`.
<add> Array API compatible wrapper for :py:meth:`np.ndarray.T <numpy.ndarray.T>`.
<ide>
<ide> See its docstring for more information.
<ide> """
| 1
|
Ruby
|
Ruby
|
use hash#each to avoid a second hash lookup
|
8fb838ed1690fb38ea3dfced1827ef5e7683cc3b
|
<ide><path>activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
<ide> def empty_insert_statement_value
<ide> def select(sql, name = nil) #:nodoc:
<ide> execute(sql, name).map do |row|
<ide> record = {}
<del> row.each_key do |key|
<del> if key.is_a?(String)
<del> record[key.sub(/^"?\w+"?\./, '')] = row[key]
<del> end
<add> row.each do |key, value|
<add> record[key.sub(/^"?\w+"?\./, '')] = value if key.is_a?(String)
<ide> end
<ide> record
<ide> end
| 1
|
Go
|
Go
|
remove hack for rhel6 kernels
|
94334153b5090567f1d8320b0356bfea3ca07cb4
|
<ide><path>oci/caps/utils.go
<ide> var capabilityList Capabilities
<ide>
<ide> func init() {
<ide> last := capability.CAP_LAST_CAP
<del> // hack for RHEL6 which has no /proc/sys/kernel/cap_last_cap
<del> if last == capability.Cap(63) {
<del> last = capability.CAP_BLOCK_SUSPEND
<del> }
<ide> for _, cap := range capability.List() {
<ide> if cap > last {
<ide> continue
| 1
|
Javascript
|
Javascript
|
resolve protocol http, https when not in lowercase
|
d00bdb9bb8b9b11bce900689c7e28cebd2eb0807
|
<ide><path>Libraries/Linking/Linking.js
<ide> class Linking extends NativeEventEmitter {
<ide> * See https://facebook.github.io/react-native/docs/linking.html#openurl
<ide> */
<ide> openURL(url: string): Promise<any> {
<add> // Android Intent requires protocols http and https to be in lowercase.
<add> // https:// and http:// works, but Https:// and Http:// doesn't.
<add> if (url.toLowerCase().startsWith('https://')) {
<add> url = url.replace(url.substr(0, 8), 'https://');
<add> } else if (url.toLowerCase().startsWith('http://')) {
<add> url = url.replace(url.substr(0, 7), 'http://');
<add> }
<ide> this._validateURL(url);
<ide> return LinkingManager.openURL(url);
<ide> }
| 1
|
Python
|
Python
|
remove local variable assignment
|
1d0a64ccde04d738c2a19305d3a26732af10d095
|
<ide><path>libcloud/compute/drivers/linode.py
<ide> def ex_rename_node(self, node, name):
<ide> "LinodeID": node.id,
<ide> "Label": name
<ide> }
<del> data = self.connection.request(API_ROOT, params=params)
<add> self.connection.request(API_ROOT, params=params)
<ide> return True
<ide>
<ide> def list_sizes(self, location=None):
| 1
|
Javascript
|
Javascript
|
remove line element from scatter controller
|
03e9194be5e899e36ac077d8e33be6921d1eae2a
|
<ide><path>src/controllers/controller.line.js
<ide> import DatasetController from '../core/core.datasetController';
<ide> import {isNullOrUndef} from '../helpers';
<del>import {_limitValue, isNumber} from '../helpers/helpers.math';
<del>import {_lookupByKey} from '../helpers/helpers.collection';
<add>import {isNumber} from '../helpers/helpers.math';
<add>import {_getStartAndCountOfVisiblePoints, _scaleRangesChanged} from '../helpers/helpers.extras';
<ide>
<ide> export default class LineController extends DatasetController {
<ide>
<ide> export default class LineController extends DatasetController {
<ide> const {dataset: line, data: points = [], _dataset} = meta;
<ide> // @ts-ignore
<ide> const animationsDisabled = this.chart._animationsDisabled;
<del> let {start, count} = getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);
<add> let {start, count} = _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);
<ide>
<ide> this._drawStart = start;
<ide> this._drawCount = count;
<ide>
<del> if (scaleRangesChanged(meta)) {
<add> if (_scaleRangesChanged(meta)) {
<ide> start = 0;
<ide> count = points.length;
<ide> }
<ide> LineController.overrides = {
<ide> },
<ide> }
<ide> };
<del>
<del>function getStartAndCountOfVisiblePoints(meta, points, animationsDisabled) {
<del> const pointCount = points.length;
<del>
<del> let start = 0;
<del> let count = pointCount;
<del>
<del> if (meta._sorted) {
<del> const {iScale, _parsed} = meta;
<del> const axis = iScale.axis;
<del> const {min, max, minDefined, maxDefined} = iScale.getUserBounds();
<del>
<del> if (minDefined) {
<del> start = _limitValue(Math.min(
<del> _lookupByKey(_parsed, iScale.axis, min).lo,
<del> animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo),
<del> 0, pointCount - 1);
<del> }
<del> if (maxDefined) {
<del> count = _limitValue(Math.max(
<del> _lookupByKey(_parsed, iScale.axis, max, true).hi + 1,
<del> animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max), true).hi + 1),
<del> start, pointCount) - start;
<del> } else {
<del> count = pointCount - start;
<del> }
<del> }
<del>
<del> return {start, count};
<del>}
<del>
<del>function scaleRangesChanged(meta) {
<del> const {xScale, yScale, _scaleRanges} = meta;
<del> const newRanges = {
<del> xmin: xScale.min,
<del> xmax: xScale.max,
<del> ymin: yScale.min,
<del> ymax: yScale.max
<del> };
<del> if (!_scaleRanges) {
<del> meta._scaleRanges = newRanges;
<del> return true;
<del> }
<del> const changed = _scaleRanges.xmin !== xScale.min
<del> || _scaleRanges.xmax !== xScale.max
<del> || _scaleRanges.ymin !== yScale.min
<del> || _scaleRanges.ymax !== yScale.max;
<del>
<del> Object.assign(_scaleRanges, newRanges);
<del> return changed;
<del>}
<ide><path>src/controllers/controller.scatter.js
<del>import LineController from './controller.line';
<add>import DatasetController from '../core/core.datasetController';
<add>import {isNullOrUndef} from '../helpers';
<add>import {isNumber} from '../helpers/helpers.math';
<add>import {_getStartAndCountOfVisiblePoints, _scaleRangesChanged} from '../helpers/helpers.extras';
<add>import registry from '../core/core.registry';
<ide>
<del>export default class ScatterController extends LineController {
<add>export default class ScatterController extends DatasetController {
<add> update(mode) {
<add> const meta = this._cachedMeta;
<add> const {data: points = []} = meta;
<add> // @ts-ignore
<add> const animationsDisabled = this.chart._animationsDisabled;
<add> let {start, count} = _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);
<ide>
<add> this._drawStart = start;
<add> this._drawCount = count;
<add>
<add> if (_scaleRangesChanged(meta)) {
<add> start = 0;
<add> count = points.length;
<add> }
<add>
<add> if (this.options.showLine) {
<add>
<add> const {dataset: line, _dataset} = meta;
<add>
<add> // Update Line
<add> line._chart = this.chart;
<add> line._datasetIndex = this.index;
<add> line._decimated = !!_dataset._decimated;
<add> line.points = points;
<add>
<add> const options = this.resolveDatasetElementOptions(mode);
<add> options.segment = this.options.segment;
<add> this.updateElement(line, undefined, {
<add> animated: !animationsDisabled,
<add> options
<add> }, mode);
<add> }
<add>
<add> // Update Points
<add> this.updateElements(points, start, count, mode);
<add> }
<add>
<add> addElements() {
<add> const {showLine} = this.options;
<add>
<add> if (!this.datasetElementType && showLine) {
<add> this.datasetElementType = registry.getElement('line');
<add> }
<add>
<add> super.addElements();
<add> }
<add>
<add> updateElements(points, start, count, mode) {
<add> const reset = mode === 'reset';
<add> const {iScale, vScale, _stacked, _dataset} = this._cachedMeta;
<add> const firstOpts = this.resolveDataElementOptions(start, mode);
<add> const sharedOptions = this.getSharedOptions(firstOpts);
<add> const includeOptions = this.includeOptions(mode, sharedOptions);
<add> const iAxis = iScale.axis;
<add> const vAxis = vScale.axis;
<add> const {spanGaps, segment} = this.options;
<add> const maxGapLength = isNumber(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;
<add> const directUpdate = this.chart._animationsDisabled || reset || mode === 'none';
<add> let prevParsed = start > 0 && this.getParsed(start - 1);
<add>
<add> for (let i = start; i < start + count; ++i) {
<add> const point = points[i];
<add> const parsed = this.getParsed(i);
<add> const properties = directUpdate ? point : {};
<add> const nullData = isNullOrUndef(parsed[vAxis]);
<add> const iPixel = properties[iAxis] = iScale.getPixelForValue(parsed[iAxis], i);
<add> const vPixel = properties[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? this.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i);
<add>
<add> properties.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;
<add> properties.stop = i > 0 && (Math.abs(parsed[iAxis] - prevParsed[iAxis])) > maxGapLength;
<add> if (segment) {
<add> properties.parsed = parsed;
<add> properties.raw = _dataset.data[i];
<add> }
<add>
<add> if (includeOptions) {
<add> properties.options = sharedOptions || this.resolveDataElementOptions(i, point.active ? 'active' : mode);
<add> }
<add>
<add> if (!directUpdate) {
<add> this.updateElement(point, i, properties, mode);
<add> }
<add>
<add> prevParsed = parsed;
<add> }
<add>
<add> this.updateSharedOptions(sharedOptions, mode, firstOpts);
<add> }
<add>
<add> /**
<add> * @protected
<add> */
<add> getMaxOverflow() {
<add> const meta = this._cachedMeta;
<add> const data = meta.data || [];
<add>
<add> if (!this.options.showLine) {
<add> let max = 0;
<add> for (let i = data.length - 1; i >= 0; --i) {
<add> max = Math.max(max, data[i].size(this.resolveDataElementOptions(i)) / 2);
<add> }
<add> return max > 0 && max;
<add> }
<add>
<add> const dataset = meta.dataset;
<add> const border = dataset.options && dataset.options.borderWidth || 0;
<add>
<add> if (!data.length) {
<add> return border;
<add> }
<add>
<add> const firstPoint = data[0].size(this.resolveDataElementOptions(0));
<add> const lastPoint = data[data.length - 1].size(this.resolveDataElementOptions(data.length - 1));
<add> return Math.max(border, firstPoint, lastPoint) / 2;
<add> }
<ide> }
<ide>
<ide> ScatterController.id = 'scatter';
<ide> ScatterController.id = 'scatter';
<ide> * @type {any}
<ide> */
<ide> ScatterController.defaults = {
<add> datasetElementType: false,
<add> dataElementType: 'point',
<ide> showLine: false,
<ide> fill: false
<ide> };
<ide><path>src/helpers/helpers.extras.js
<add>import {_limitValue} from './helpers.math';
<add>import {_lookupByKey} from './helpers.collection';
<ide>
<ide> export function fontString(pixelSize, fontStyle, fontFamily) {
<ide> return fontStyle + ' ' + pixelSize + 'px ' + fontFamily;
<ide> export const _textX = (align, left, right, rtl) => {
<ide> const check = rtl ? 'left' : 'right';
<ide> return align === check ? right : align === 'center' ? (left + right) / 2 : left;
<ide> };
<add>
<add>/**
<add> * Return start and count of visible points.
<add> * @param {object} meta - dataset meta.
<add> * @param {array} points - array of point elements.
<add> * @param {boolean} animationsDisabled - if true animation is disabled.
<add> * @returns {{start: number; count: number}}
<add> * @private
<add> */
<add>export function _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled) {
<add> const pointCount = points.length;
<add>
<add> let start = 0;
<add> let count = pointCount;
<add>
<add> if (meta._sorted) {
<add> const {iScale, _parsed} = meta;
<add> const axis = iScale.axis;
<add> const {min, max, minDefined, maxDefined} = iScale.getUserBounds();
<add>
<add> if (minDefined) {
<add> start = _limitValue(Math.min(
<add> _lookupByKey(_parsed, iScale.axis, min).lo,
<add> animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo),
<add> 0, pointCount - 1);
<add> }
<add> if (maxDefined) {
<add> count = _limitValue(Math.max(
<add> _lookupByKey(_parsed, iScale.axis, max, true).hi + 1,
<add> animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max), true).hi + 1),
<add> start, pointCount) - start;
<add> } else {
<add> count = pointCount - start;
<add> }
<add> }
<add>
<add> return {start, count};
<add>}
<add>
<add>/**
<add> * Checks if the scale ranges have changed.
<add> * @param {object} meta - dataset meta.
<add> * @returns {boolean}
<add> * @private
<add> */
<add>export function _scaleRangesChanged(meta) {
<add> const {xScale, yScale, _scaleRanges} = meta;
<add> const newRanges = {
<add> xmin: xScale.min,
<add> xmax: xScale.max,
<add> ymin: yScale.min,
<add> ymax: yScale.max
<add> };
<add> if (!_scaleRanges) {
<add> meta._scaleRanges = newRanges;
<add> return true;
<add> }
<add> const changed = _scaleRanges.xmin !== xScale.min
<add> || _scaleRanges.xmax !== xScale.max
<add> || _scaleRanges.ymin !== yScale.min
<add> || _scaleRanges.ymax !== yScale.max;
<add>
<add> Object.assign(_scaleRanges, newRanges);
<add> return changed;
<add>}
<ide><path>test/specs/controller.scatter.tests.js
<ide> describe('Chart.controllers.scatter', function() {
<ide> await jasmine.triggerMouseEvent(chart, 'mousemove', point);
<ide> expect(chart.tooltip.body.length).toEqual(1);
<ide> });
<add>
<add> it('should not create line element by default', function() {
<add> var chart = window.acquireChart({
<add> type: 'scatter',
<add> data: {
<add> datasets: [{
<add> data: [{
<add> x: 10,
<add> y: 15
<add> },
<add> {
<add> x: 12,
<add> y: 10
<add> }],
<add> label: 'dataset1'
<add> },
<add> {
<add> data: [{
<add> x: 20,
<add> y: 10
<add> },
<add> {
<add> x: 4,
<add> y: 8
<add> }],
<add> label: 'dataset2'
<add> }]
<add> },
<add> });
<add>
<add> var meta = chart.getDatasetMeta(0);
<add> expect(meta.dataset instanceof Chart.elements.LineElement).toBe(false);
<add> });
<add>
<add> it('should create line element if showline is true at datasets options', function() {
<add> var chart = window.acquireChart({
<add> type: 'scatter',
<add> data: {
<add> datasets: [{
<add> showLine: true,
<add> data: [{
<add> x: 10,
<add> y: 15
<add> },
<add> {
<add> x: 12,
<add> y: 10
<add> }],
<add> label: 'dataset1'
<add> },
<add> {
<add> data: [{
<add> x: 20,
<add> y: 10
<add> },
<add> {
<add> x: 4,
<add> y: 8
<add> }],
<add> label: 'dataset2'
<add> }]
<add> },
<add> });
<add>
<add> var meta = chart.getDatasetMeta(0);
<add> expect(meta.dataset instanceof Chart.elements.LineElement).toBe(true);
<add> });
<add>
<add> it('should create line element if showline is true at root options', function() {
<add> var chart = window.acquireChart({
<add> type: 'scatter',
<add> data: {
<add> datasets: [{
<add> data: [{
<add> x: 10,
<add> y: 15
<add> },
<add> {
<add> x: 12,
<add> y: 10
<add> }],
<add> label: 'dataset1'
<add> },
<add> {
<add> data: [{
<add> x: 20,
<add> y: 10
<add> },
<add> {
<add> x: 4,
<add> y: 8
<add> }],
<add> label: 'dataset2'
<add> }]
<add> },
<add> options: {
<add> showLine: true
<add> }
<add> });
<add>
<add> var meta = chart.getDatasetMeta(0);
<add> expect(meta.dataset instanceof Chart.elements.LineElement).toBe(true);
<add> });
<ide> });
| 4
|
Text
|
Text
|
remove beta statement
|
763ff1ae8385784fa9e6d2a9fce207fed90b47b0
|
<ide><path>docs/how-to-help-with-video-challenges.md
<ide> # How to help with video challenges
<ide>
<del>Video challenges are a new type of challenge in the freeCodeCamp curriculum. They are currently only in beta and not available yet on freeCodeCamp.org.
<add>Video challenges are a new type of challenge in the freeCodeCamp curriculum.
<ide>
<ide> A video challenge is a small section of a full-length video course on a particular topic. A video challenge page embeds a YouTube video. Each challenge page has a single multiple-choice question related to the video. A user must answer the question correctly before moving on the the next video challenge in the course.
<ide>
| 1
|
PHP
|
PHP
|
fix some docblocks
|
45495066373ff6daa314f6550cab2b3de16f26f7
|
<ide><path>src/Illuminate/Container/Container.php
<ide> protected function keyParametersByArgument(array $dependencies, array $parameter
<ide> * Register a new resolving callback.
<ide> *
<ide> * @param string $abstract
<del> * @param \Closure $callback
<add> * @param \Closure|null $callback
<ide> * @return void
<ide> */
<ide> public function resolving($abstract, Closure $callback = null)
<ide> public function resolving($abstract, Closure $callback = null)
<ide> * Register a new after resolving callback for all types.
<ide> *
<ide> * @param string $abstract
<del> * @param \Closure $callback
<add> * @param \Closure|null $callback
<ide> * @return void
<ide> */
<ide> public function afterResolving($abstract, Closure $callback = null)
<ide><path>src/Illuminate/Contracts/Container/Container.php
<ide> public function resolved($abstract);
<ide> * Register a new resolving callback.
<ide> *
<ide> * @param string $abstract
<del> * @param \Closure $callback
<add> * @param \Closure|null $callback
<ide> * @return void
<ide> */
<ide> public function resolving($abstract, Closure $callback = null);
<ide> public function resolving($abstract, Closure $callback = null);
<ide> * Register a new after resolving callback.
<ide> *
<ide> * @param string $abstract
<del> * @param \Closure $callback
<add> * @param \Closure|null $callback
<ide> * @return void
<ide> */
<ide> public function afterResolving($abstract, Closure $callback = null);
<ide><path>src/Illuminate/Database/Eloquent/Builder.php
<ide> public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', C
<ide> * @param string $operator
<ide> * @param int $count
<ide> * @param string $boolean
<del> * @param \Closure $callback
<add> * @param \Closure|null $callback
<ide> * @return \Illuminate\Database\Eloquent\Builder|static
<ide> */
<ide> protected function hasNested($relations, $operator = '>=', $count = 1, $boolean = 'and', $callback = null)
<ide><path>src/Illuminate/Routing/Router.php
<ide> public function callRouteBefore($route, $request)
<ide> *
<ide> * @param \Illuminate\Routing\Route $route
<ide> * @param \Illuminate\Http\Request $request
<del> * @return mixed|null
<add> * @return mixed
<ide> */
<ide> protected function callPatternFilters($route, $request)
<ide> {
<ide><path>src/Illuminate/Support/Collection.php
<ide> public function whereLoose($key, $value)
<ide> /**
<ide> * Get the first item from the collection.
<ide> *
<del> * @param callable $callback
<add> * @param callable|null $callback
<ide> * @param mixed $default
<del> * @return mixed|null
<add> * @return mixed
<ide> */
<ide> public function first(callable $callback = null, $default = null)
<ide> {
<ide> public function keys()
<ide> /**
<ide> * Get the last item from the collection.
<ide> *
<del> * @return mixed|null
<add> * @return mixed
<ide> */
<ide> public function last()
<ide> {
<ide> public function forPage($page, $perPage)
<ide> /**
<ide> * Get and remove the last item from the collection.
<ide> *
<del> * @return mixed|null
<add> * @return mixed
<ide> */
<ide> public function pop()
<ide> {
<ide> public function search($value, $strict = false)
<ide> /**
<ide> * Get and remove the first item from the collection.
<ide> *
<del> * @return mixed|null
<add> * @return mixed
<ide> */
<ide> public function shift()
<ide> {
| 5
|
Ruby
|
Ruby
|
use foo/bar instead of foo_bar keys for fixtures
|
e0ef0936193491689724880599ae26a8f5c2b5a6
|
<ide><path>activerecord/lib/active_record/fixtures.rb
<ide> class Fixtures
<ide>
<ide> @@all_cached_fixtures = Hash.new { |h,k| h[k] = {} }
<ide>
<del> def self.find_table_name(table_name) # :nodoc:
<add> def self.default_fixture_model_name(fixture_name) # :nodoc:
<ide> ActiveRecord::Base.pluralize_table_names ?
<del> table_name.to_s.singularize.camelize :
<del> table_name.to_s.camelize
<add> fixture_name.singularize.camelize :
<add> fixture_name.camelize
<ide> end
<ide>
<ide> def self.reset_cache
<ide> def self.instantiate_all_loaded_fixtures(object, load_instances = true)
<ide>
<ide> def self.create_fixtures(fixtures_directory, table_names, class_names = {})
<ide> table_names = [table_names].flatten.map { |n| n.to_s }
<del> table_names.each { |n|
<del> class_names[n.tr('/', '_').to_sym] = n.classify if n.include?('/')
<del> }
<ide>
<ide> # FIXME: Apparently JK uses this.
<ide> connection = block_given? ? yield : ActiveRecord::Base.connection
<ide> def self.create_fixtures(fixtures_directory, table_names, class_names = {})
<ide>
<ide> fixture_files = files_to_read.map do |path|
<ide> table_name = path.tr '/', '_'
<add> fixture_name = path
<ide>
<del> fixtures_map[path] = ActiveRecord::Fixtures.new(
<add> fixtures_map[fixture_name] = new( # ActiveRecord::Fixtures.new
<ide> connection,
<ide> table_name,
<del> class_names[table_name.to_sym] || table_name.classify,
<add> class_names[fixture_name] || default_fixture_model_name(fixture_name),
<ide> ::File.join(fixtures_directory, path))
<ide> end
<ide>
<ide> module TestFixtures
<ide> self.use_instantiated_fixtures = false
<ide> self.pre_loaded_fixtures = false
<ide>
<del> self.fixture_class_names = Hash.new do |h, table_name|
<del> h[table_name] = ActiveRecord::Fixtures.find_table_name(table_name)
<add> self.fixture_class_names = Hash.new do |h, fixture_name|
<add> h[fixture_name] = ActiveRecord::Fixtures.default_fixture_model_name(fixture_name)
<ide> end
<ide> end
<ide>
<ide> module ClassMethods
<add> # Sets the model class for a fixture when the class name cannot be inferred from the fixture name.
<add> #
<add> # Examples:
<add> #
<add> # set_fixture_class :some_fixture => SomeModel,
<add> # 'namespaced/fixture' => Another::Model
<add> #
<add> # The keys must be the fixture names, that coincide with the short paths to the fixture files.
<add> #--
<add> # It is also possible to pass the class name instead of the class:
<add> # set_fixture_class 'some_fixture' => 'SomeModel'
<add> # I think this option is redundant, i propose to deprecate it.
<add> # Isn't it easier to always pass the class itself?
<add> # (2011-12-20 alexeymuranov)
<add> #++
<ide> def set_fixture_class(class_names = {})
<del> self.fixture_class_names = self.fixture_class_names.merge(class_names)
<add> self.fixture_class_names = self.fixture_class_names.merge(class_names.stringify_keys)
<ide> end
<ide>
<ide> def fixtures(*fixture_names)
<ide> def setup_fixture_accessors(fixture_names = nil)
<ide> fixture_names = Array.wrap(fixture_names || fixture_table_names)
<ide> methods = Module.new do
<ide> fixture_names.each do |fixture_name|
<del> fixture_name = fixture_name.to_s.tr('./', '_')
<add> fixture_name = fixture_name.to_s.tr('./', '_') # TODO: use fixture_name variable for only one form of fixture names ("admin/users" for example)
<ide>
<ide> define_method(fixture_name) do |*fixtures|
<ide> force_reload = fixtures.pop if fixtures.last == true || fixtures.last == :reload
| 1
|
PHP
|
PHP
|
add asssertion for session errors
|
dbaf3b10f1daa483a1db840c60ec95337c9a1f6e
|
<ide><path>src/Illuminate/Foundation/Testing/TestResponse.php
<ide> public function assertSessionHasAll(array $bindings)
<ide> return $this;
<ide> }
<ide>
<add> /**
<add> * Assert that the session has the given errors.
<add> *
<add> * @param string|array $keys
<add> * @param mixed $format
<add> * @return $this
<add> */
<add> public function assertSessionHasErrors($keys = [], $format = null)
<add> {
<add> $this->assertSessionHas('errors');
<add>
<add> $keys = (array) $keys;
<add>
<add> $errors = app('session.store')->get('errors');
<add>
<add> foreach ($keys as $key => $value) {
<add> if (is_int($key)) {
<add> PHPUnit::assertTrue($errors->has($value), "Session missing error: $value");
<add> } else {
<add> PHPUnit::assertContains($value, $errors->get($key, $format));
<add> }
<add> }
<add>
<add> return $this;
<add> }
<add>
<ide> /**
<ide> * Assert that the session does not have a given key.
<ide> *
| 1
|
Javascript
|
Javascript
|
remove some unused variables from src/
|
2e97c0d085d708959c632338ac37a50ddedaad38
|
<ide><path>src/core/bidi.js
<ide> var bidi = PDFJS.bidi = (function bidiClosure() {
<ide> }
<ide> }
<ide>
<del> function mirrorGlyphs(c) {
<del> /*
<del> # BidiMirroring-1.txt
<del> 0028; 0029 # LEFT PARENTHESIS
<del> 0029; 0028 # RIGHT PARENTHESIS
<del> 003C; 003E # LESS-THAN SIGN
<del> 003E; 003C # GREATER-THAN SIGN
<del> 005B; 005D # LEFT SQUARE BRACKET
<del> 005D; 005B # RIGHT SQUARE BRACKET
<del> 007B; 007D # LEFT CURLY BRACKET
<del> 007D; 007B # RIGHT CURLY BRACKET
<del> 00AB; 00BB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
<del> 00BB; 00AB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
<del> */
<del> switch (c) {
<del> case '(':
<del> return ')';
<del> case ')':
<del> return '(';
<del> case '<':
<del> return '>';
<del> case '>':
<del> return '<';
<del> case ']':
<del> return '[';
<del> case '[':
<del> return ']';
<del> case '}':
<del> return '{';
<del> case '{':
<del> return '}';
<del> case '\u00AB':
<del> return '\u00BB';
<del> case '\u00BB':
<del> return '\u00AB';
<del> default:
<del> return c;
<del> }
<del> }
<del>
<ide> function createBidiText(str, isLTR, vertical) {
<ide> return {
<ide> str: str,
<ide><path>src/core/chunked_stream.js
<ide> var ChunkedStream = (function ChunkedStreamClosure() {
<ide> var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
<ide>
<ide> function ChunkedStreamManager(length, chunkSize, url, args) {
<del> var self = this;
<ide> this.stream = new ChunkedStream(length, chunkSize, this);
<ide> this.length = length;
<ide> this.chunkSize = chunkSize;
<ide><path>src/core/evaluator.js
<ide> var PartialEvaluator = (function PartialEvaluatorClosure() {
<ide>
<ide> var self = this;
<ide> var xref = this.xref;
<del> var handler = this.handler;
<ide> var imageCache = {};
<ide>
<ide> operatorList = (operatorList || new OperatorList());
<ide> var PartialEvaluator = (function PartialEvaluatorClosure() {
<ide> var stateManager = new StateManager(initialState || new EvalState());
<ide> var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
<ide>
<del> var promise = new LegacyPromise();
<ide> var operation, i, ii;
<ide> while ((operation = preprocessor.read())) {
<ide> var args = operation.args;
<ide> var PartialEvaluator = (function PartialEvaluatorClosure() {
<ide> var xobjsCache = {};
<ide>
<ide> var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
<del> var res = resources;
<ide>
<ide> var operation;
<ide> var textState;
<ide> var PartialEvaluator = (function PartialEvaluatorClosure() {
<ide>
<ide> readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
<ide> var cmapObj = toUnicode;
<del> var charToUnicode = [];
<ide> if (isName(cmapObj)) {
<ide> return CMapFactory.create(cmapObj).map;
<ide> } else if (isStream(cmapObj)) {
<ide><path>src/core/font_renderer.js
<ide> var FontRendererFactory = (function FontRendererFactoryClosure() {
<ide>
<ide> var i = 0;
<ide> var numberOfContours = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
<del> var xMin = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
<del> var yMin = ((code[i + 4] << 24) | (code[i + 5] << 16)) >> 16;
<del> var xMax = ((code[i + 6] << 24) | (code[i + 7] << 16)) >> 16;
<del> var yMax = ((code[i + 8] << 24) | (code[i + 9] << 16)) >> 16;
<ide> var flags;
<ide> var x = 0, y = 0;
<ide> i += 10;
<ide><path>src/core/fonts.js
<ide> var Font = (function FontClosure() {
<ide> var isIdentityUnicode = properties.isIdentityUnicode;
<ide> var newMap = Object.create(null);
<ide> var toFontChar = [];
<del> var usedCharCodes = [];
<ide> var usedFontCharCodes = [];
<ide> var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
<ide> for (var originalCharCode in charCodeToGlyphId) {
<ide> var Font = (function FontClosure() {
<ide> var firstCode = font.getUint16();
<ide> var entryCount = font.getUint16();
<ide>
<del> var glyphs = [];
<del> var ids = [];
<ide> for (j = 0; j < entryCount; j++) {
<ide> glyphId = font.getUint16();
<ide> var charCode = firstCode + j;
<ide> var Font = (function FontClosure() {
<ide> }
<ide> font.pos = pos;
<ide> var nameIndex = record.name;
<del> var encoding = record.encoding ? 1 : 0;
<ide> if (record.encoding) {
<ide> // unicode
<ide> var str = '';
<ide> var Font = (function FontClosure() {
<ide> // to write the table entry information about a table and another offset
<ide> // representing the offset where to draw the actual data of a particular
<ide> // table
<del> var REQ_TABLES_CNT = 9;
<del>
<ide> var otf = {
<ide> file: '',
<ide> virtualOffset: 9 * (4 * 4)
<ide> var CFFParser = (function CFFParserClosure() {
<ide> var bytes = this.bytes;
<ide> var count = (bytes[pos++] << 8) | bytes[pos++];
<ide> var offsets = [];
<del> var start = pos;
<ide> var end = pos;
<ide> var i, ii;
<ide>
<ide> var CFFParser = (function CFFParserClosure() {
<ide> },
<ide> createDict: function CFFParser_createDict(Type, dict, strings) {
<ide> var cffDict = new Type(strings);
<del> var types = cffDict.types;
<del>
<ide> for (var i = 0, ii = dict.length; i < ii; ++i) {
<ide> var pair = dict[i];
<ide> var key = pair[0];
<ide> var CFFCharsetPredefinedTypes = {
<ide> EXPERT: 1,
<ide> EXPERT_SUBSET: 2
<ide> };
<del>var CFFCharsetEmbeddedTypes = {
<del> FORMAT0: 0,
<del> FORMAT1: 1,
<del> FORMAT2: 2
<del>};
<ide> var CFFCharset = (function CFFCharsetClosure() {
<ide> function CFFCharset(predefined, format, charset, raw) {
<ide> this.predefined = predefined;
<ide> var CFFCharset = (function CFFCharsetClosure() {
<ide> return CFFCharset;
<ide> })();
<ide>
<del>var CFFEncodingPredefinedTypes = {
<del> STANDARD: 0,
<del> EXPERT: 1
<del>};
<del>var CFFCharsetEmbeddedTypes = {
<del> FORMAT0: 0,
<del> FORMAT1: 1
<del>};
<ide> var CFFEncoding = (function CFFEncodingClosure() {
<ide> function CFFEncoding(predefined, format, encoding, raw) {
<ide> this.predefined = predefined;
<ide> var CFFCompiler = (function CFFCompilerClosure() {
<ide> relativeOffset += objects[i].length;
<ide> }
<ide> }
<del> var offset = data.length;
<ide>
<ide> for (i = 0; i < count; i++) {
<ide> // Notify the tracker where the object will be offset in the data.
<ide><path>src/core/image.js
<ide> var PDFImage = (function PDFImageClosure() {
<ide> },
<ide> decodeBuffer: function PDFImage_decodeBuffer(buffer) {
<ide> var bpc = this.bpc;
<del> var decodeMap = this.decode;
<ide> var numComps = this.numComps;
<ide>
<ide> var decodeAddends = this.decodeAddends;
<ide><path>src/core/jpx.js
<ide> var JpxImage = (function JpxImageClosure() {
<ide> var componentsCount = siz.Csiz;
<ide> for (var i = 0, ii = componentsCount; i < ii; i++) {
<ide> var component = components[i];
<del> var tileComponents = [];
<ide> for (var j = 0, jj = tiles.length; j < jj; j++) {
<ide> var tileComponent = {};
<ide> tile = tiles[j];
<ide> var JpxImage = (function JpxImageClosure() {
<ide> var precinctParameters = subband.resolution.precinctParameters;
<ide> var codeblocks = [];
<ide> var precincts = [];
<del> var i, ii, j, codeblock, precinctNumber;
<add> var i, j, codeblock, precinctNumber;
<ide> for (j = cby0; j < cby1; j++) {
<ide> for (i = cbx0; i < cbx1; i++) {
<ide> codeblock = {
<ide> var JpxImage = (function JpxImageClosure() {
<ide> codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
<ide> codeblock.precinctNumber = precinctNumber;
<ide> codeblock.subbandType = subband.type;
<del> var coefficientsLength = (codeblock.tbx1_ - codeblock.tbx0_) *
<del> (codeblock.tby1_ - codeblock.tby0_);
<ide> codeblock.Lblock = 3;
<ide> codeblocks.push(codeblock);
<ide> // building precinct for the sub-band
<ide> var JpxImage = (function JpxImageClosure() {
<ide> }
<ide> // Generate the packets sequence
<ide> var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
<del> var packetsIterator;
<ide> switch (progressionOrder) {
<ide> case 0:
<ide> tile.packetsIterator =
<ide> var JpxImage = (function JpxImageClosure() {
<ide> }
<ide>
<ide> var offset = (codeblock.tbx0_ - x0) + (codeblock.tby0_ - y0) * width;
<del> var n, nb, correction, position = 0;
<add> var n, nb, position = 0;
<ide> var irreversible = !reversible;
<ide> var sign = bitModel.coefficentsSign;
<ide> var magnitude = bitModel.coefficentsMagnitude;
<ide> var JpxImage = (function JpxImageClosure() {
<ide>
<ide> // Section G.2.2 Inverse multi component transform
<ide> var y0items, y1items, y2items, j, jj, y0, y1, y2;
<del> var component, offset, tileImage, items;
<add> var component, tileImage, items;
<ide> if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
<ide> var component0 = tile.components[0];
<ide> if (!component0.codingStyleParameters.reversibleTransformation) {
<ide> var JpxImage = (function JpxImageClosure() {
<ide> var siz = context.SIZ;
<ide> var componentsCount = siz.Csiz;
<ide> var tile = context.tiles[tileIndex];
<del> var resultTiles = [];
<ide> for (var c = 0; c < componentsCount; c++) {
<ide> var component = tile.components[c];
<ide> var qcdOrQcc = (c in context.currentTile.QCC ?
<ide> var JpxImage = (function JpxImageClosure() {
<ide> var width = this.width, height = this.height;
<ide> var coefficentsMagnitude = this.coefficentsMagnitude;
<ide> var coefficentsSign = this.coefficentsSign;
<del> var contextLabels = this.contextLabels;
<ide> var neighborsSignificance = this.neighborsSignificance;
<ide> var processingFlags = this.processingFlags;
<ide> var contexts = this.contexts;
<ide> var JpxImage = (function JpxImageClosure() {
<ide> var decoder = this.decoder;
<ide> var width = this.width, height = this.height;
<ide> var neighborsSignificance = this.neighborsSignificance;
<del> var significanceState = this.significanceState;
<ide> var coefficentsMagnitude = this.coefficentsMagnitude;
<ide> var coefficentsSign = this.coefficentsSign;
<ide> var contexts = this.contexts;
<ide> var JpxImage = (function JpxImageClosure() {
<ide> var delta = 0.443506852043971;
<ide> var K = 1.230174104914001;
<ide> var K_ = 1 / K;
<del> var j, n, nn;
<add> var j, n;
<ide>
<ide> // step 1 is combined with step 3
<ide>
<ide><path>src/core/obj.js
<ide> var XRef = (function XRefClosure() {
<ide> var buffer = stream.getBytes();
<ide> var position = stream.start, length = buffer.length;
<ide> var trailers = [], xrefStms = [];
<del> var state = 0;
<del> var currentToken;
<ide> while (position < length) {
<ide> var ch = buffer[position];
<ide> if (ch === 32 || ch === 9 || ch === 13 || ch === 10) {
<ide><path>src/core/parser.js
<ide> var Lexer = (function LexerClosure() {
<ide> } else if (ch === 0x45 || ch === 0x65) { // 'E', 'e'
<ide> // 'E' can be either a scientific notation or the beginning of a new
<ide> // operator
<del> var hasE = true;
<ide> ch = this.peekChar();
<ide> if (ch === 0x2B || ch === 0x2D) { // '+', '-'
<ide> powerValueSign = (ch === 0x2D) ? -1 : 1;
<ide> var Lexer = (function LexerClosure() {
<ide> return Cmd.get(str);
<ide> },
<ide> skipToNextLine: function Lexer_skipToNextLine() {
<del> var stream = this.stream;
<ide> var ch = this.currentChar;
<ide> while (ch >= 0) {
<ide> if (ch === 0x0D) { // CR
<ide><path>src/core/pattern.js
<ide> Shadings.Mesh = (function MeshClosure() {
<ide> function decodeType5Shading(mesh, reader, verticesPerRow) {
<ide> var coords = mesh.coords;
<ide> var colors = mesh.colors;
<del> var operators = [];
<ide> var ps = []; // not maintaining cs since that will match ps
<ide> while (reader.hasData) {
<ide> var coord = reader.readCoordinate();
<ide><path>src/core/ps_parser.js
<ide> var PostScriptLexer = (function PostScriptLexerClosure() {
<ide> return (this.currentChar = this.stream.getByte());
<ide> },
<ide> getToken: function PostScriptLexer_getToken() {
<del> var s = '';
<ide> var comment = false;
<ide> var ch = this.currentChar;
<ide>
<ide><path>src/core/stream.js
<ide> var CCITTFaxStream = (function CCITTFaxStreamClosure() {
<ide>
<ide> var code = 0;
<ide> var p;
<del> var n;
<ide> if (this.eoblock) {
<ide> code = this.lookBits(12);
<ide> if (code == EOF) {
<ide><path>src/display/canvas.js
<ide> var CanvasGraphics = (function CanvasGraphicsClosure() {
<ide> // imgData.kind tells us which one this is.
<ide> if (imgData.kind === ImageKind.GRAYSCALE_1BPP) {
<ide> // Grayscale, 1 bit per pixel (i.e. black-and-white).
<del> var destDataLength = dest.length;
<ide> var srcLength = src.byteLength;
<ide> var dest32 = PDFJS.hasCanvasTypedArrays ? new Uint32Array(dest.buffer) :
<ide> new Uint32ArrayView(dest);
<ide> var CanvasGraphics = (function CanvasGraphicsClosure() {
<ide> return i;
<ide> }
<ide>
<del> var executionEndIdx;
<ide> var endTime = Date.now() + EXECUTION_TIME;
<ide>
<ide> var commonObjs = this.commonObjs;
<ide> var CanvasGraphics = (function CanvasGraphicsClosure() {
<ide> var vertical = font.vertical;
<ide> var defaultVMetrics = font.defaultVMetrics;
<ide> var i, glyph, width;
<del> var VERTICAL_TEXT_ROTATION = Math.PI / 2;
<ide>
<ide> if (fontSize === 0) {
<ide> return;
<ide> var CanvasGraphics = (function CanvasGraphicsClosure() {
<ide> }
<ide> },
<ide> showSpacedText: function CanvasGraphics_showSpacedText(arr) {
<del> var ctx = this.ctx;
<ide> var current = this.current;
<ide> var font = current.font;
<ide> var fontSize = current.fontSize;
<ide> var CanvasGraphics = (function CanvasGraphicsClosure() {
<ide> var base = cs.base;
<ide> var color;
<ide> if (base) {
<del> var baseComps = base.numComps;
<del>
<ide> color = base.getRgb(args, 0);
<ide> }
<ide> pattern = new TilingPattern(IR, color, this.ctx, this.objs,
<ide><path>src/display/pattern_helper.js
<ide> var createMeshCanvas = (function createMeshCanvasClosure() {
<ide>
<ide> ShadingIRs.Mesh = {
<ide> fromIR: function Mesh_fromIR(raw) {
<del> var type = raw[1];
<add> //var type = raw[1];
<ide> var coords = raw[2];
<ide> var colors = raw[3];
<ide> var figures = raw[4];
<ide> var bounds = raw[5];
<ide> var matrix = raw[6];
<del> var bbox = raw[7];
<add> //var bbox = raw[7];
<ide> var background = raw[8];
<ide> return {
<ide> type: 'Pattern',
<ide> var TilingPattern = (function TilingPatternClosure() {
<ide> var color = this.color;
<ide> var objs = this.objs;
<ide> var commonObjs = this.commonObjs;
<del> var ctx = this.ctx;
<ide>
<ide> info('TilingType: ' + tilingType);
<ide>
<ide><path>src/shared/annotation.js
<ide> var Annotation = (function AnnotationClosure() {
<ide> var matrix = appearanceDict.get('Matrix') || [1, 0, 0, 1, 0 ,0];
<ide> var transform = getTransformMatrix(data.rect, bbox, matrix);
<ide>
<del> var border = data.border;
<del>
<ide> resourcesPromise.then(function(resources) {
<ide> var opList = new OperatorList();
<ide> opList.addOp(OPS.beginAnnotation, [data.rect, transform, matrix]);
<ide> var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
<ide> }
<ide>
<ide>
<del> var parent = WidgetAnnotation.prototype;
<ide> Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
<ide> hasHtml: function TextWidgetAnnotation_hasHtml() {
<ide> return !this.data.hasAppearance && !!this.data.fieldValue;
<ide> var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
<ide>
<ide> var fontObj = item.fontRefName ?
<ide> commonObjs.getData(item.fontRefName) : null;
<del> var cssRules = setTextStyles(content, item, fontObj);
<add> setTextStyles(content, item, fontObj);
<ide>
<ide> element.appendChild(content);
<ide>
<ide> var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
<ide> var appearanceFnArray = opList.fnArray;
<ide> var appearanceArgsArray = opList.argsArray;
<ide> var fnArray = [];
<del> var argsArray = [];
<ide>
<ide> // TODO(mack): Add support for stroke color
<ide> data.rgb = [0, 0, 0];
<ide> var TextAnnotation = (function TextAnnotationClosure() {
<ide> }
<ide> };
<ide>
<del> var self = this;
<ide> image.addEventListener('click', function image_clickHandler() {
<ide> toggleAnnotation();
<ide> }, false);
<ide> var LinkAnnotation = (function LinkAnnotationClosure() {
<ide> container.className = 'annotLink';
<ide>
<ide> var item = this.data;
<del> var rect = item.rect;
<ide>
<ide> container.style.borderColor = item.colorCssRgb;
<ide> container.style.borderStyle = 'solid';
<ide><path>src/shared/fonts_utils.js
<ide> function readCharstringEncoding(aString) {
<ide> } else if (value <= 18) {
<ide> token = CFFEncodingMap[value];
<ide> } else if (value <= 20) {
<del> var mask = aString[i++];
<add> ++i; // var mask = aString[i++];
<ide> token = CFFEncodingMap[value];
<ide> } else if (value <= 27) {
<ide> token = CFFEncodingMap[value];
<ide> var Type2Parser = function type2Parser(aFilePath) {
<ide> }
<ide>
<ide> // Parse the TopDict operator
<del> var objects = [];
<ide> var count = topDict.length;
<ide> for (i = 0; i < count; i++) {
<ide> parseAsToken(topDict[i], CFFDictDataMap);
<ide><path>src/shared/function.js
<ide> var PDFFunction = (function PDFFunctionClosure() {
<ide> constructSampled: function PDFFunction_constructSampled(str, dict) {
<ide> function toMultiArray(arr) {
<ide> var inputLength = arr.length;
<del> var outputLength = arr.length / 2;
<ide> var out = [];
<ide> var index = 0;
<ide> for (var i = 0; i < inputLength; i += 2) {
<ide> var PDFFunction = (function PDFFunctionClosure() {
<ide> var samples = IR[5];
<ide> var size = IR[6];
<ide> var n = IR[7];
<del> var mask = IR[8];
<add> //var mask = IR[8];
<ide> var range = IR[9];
<ide>
<ide> if (m != args.length) {
| 17
|
Text
|
Text
|
add explanation of raw_text
|
229033831aeeb4a78d9ebaa98ebfe1f06d6f9d28
|
<ide><path>website/docs/api/data-formats.md
<ide> process that are used when you run [`spacy train`](/api/cli#train).
<ide> | `dropout` | The dropout rate. Defaults to `0.1`. ~~float~~ |
<ide> | `accumulate_gradient` | Whether to divide the batch up into substeps. Defaults to `1`. ~~int~~ |
<ide> | `init_tok2vec` | Optional path to pretrained tok2vec weights created with [`spacy pretrain`](/api/cli#pretrain). Defaults to variable `${paths:init_tok2vec}`. ~~Optional[str]~~ |
<del>| `raw_text` | TODO: ... Defaults to variable `${paths:raw}`. ~~Optional[str]~~ |
<add>| `raw_text` | Optional path to a jsonl file with unlabelled text documents for a [rehearsel](/api/language#rehearse) step. Defaults to variable `${paths:raw}`. ~~Optional[str]~~ |
<ide> | `vectors` | Model name or path to model containing pretrained word vectors to use, e.g. created with [`init model`](/api/cli#init-model). Defaults to `null`. ~~Optional[str]~~ |
<ide> | `patience` | How many steps to continue without improvement in evaluation score. Defaults to `1600`. ~~int~~ |
<ide> | `max_epochs` | Maximum number of epochs to train for. Defaults to `0`. ~~int~~ |
| 1
|
Python
|
Python
|
update version number
|
33ccf40b76ddae790c34c294a133219e68efb946
|
<ide><path>rest_framework/__init__.py
<ide> """
<ide>
<ide> __title__ = 'Django REST framework'
<del>__version__ = '2.4.3'
<add>__version__ = '3.0.0'
<ide> __author__ = 'Tom Christie'
<ide> __license__ = 'BSD 2-Clause'
<ide> __copyright__ = 'Copyright 2011-2014 Tom Christie'
| 1
|
Javascript
|
Javascript
|
add comment explaining internalgetid
|
add809be2151a828f6a02fff393ad43b01486b28
|
<ide><path>src/core/ReactID.js
<ide> function getID(node) {
<ide> }
<ide>
<ide> function internalGetID(node) {
<add> // If node is something like a window, document, or text node, none of
<add> // which support attributes or a .getAttribute method, gracefully return
<add> // the empty string, as if the attribute were missing.
<ide> return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
<ide> }
<ide>
| 1
|
Ruby
|
Ruby
|
add comment to deprecate --env
|
1b4993c9ce9c1ba7966819298336c56f6f3b8861
|
<ide><path>Library/Homebrew/cmd/install.rb
<ide> def install_args
<ide> def install
<ide> args = install_args.parse
<ide>
<add> if args.env.present?
<add> # TODO: enable for Homebrew 2.8.0 and use `replacement: false` for 2.9.0.
<add> # odeprecated "brew install --env", "`env :std` in specific formula files"
<add> end
<add>
<ide> args.named.each do |name|
<ide> next if File.exist?(name)
<ide> next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX
| 1
|
Javascript
|
Javascript
|
add resolvebyproperty to clevermerge
|
67d2e227f42fc2789946dbaf59998cfed9249f82
|
<ide><path>lib/ResolverFactory.js
<ide> const Factory = require("enhanced-resolve").ResolverFactory;
<ide> const { HookMap, SyncHook, SyncWaterfallHook } = require("tapable");
<ide> const {
<del> cleverMerge,
<ide> cachedCleverMerge,
<del> removeOperations
<add> removeOperations,
<add> resolveByProperty
<ide> } = require("./util/cleverMerge");
<ide>
<ide> /** @typedef {import("enhanced-resolve").ResolveOptions} ResolveOptions */
<ide> const EMPTY_RESOLVE_OPTIONS = {};
<ide> * @returns {ResolveOptions} merged options
<ide> */
<ide> const convertToResolveOptions = resolveOptionsWithDepType => {
<del> const {
<del> dependencyType,
<del> byDependency,
<del> plugins,
<del> ...remaining
<del> } = resolveOptionsWithDepType;
<add> const { dependencyType, plugins, ...remaining } = resolveOptionsWithDepType;
<ide>
<ide> // check type compat
<ide> /** @type {Partial<ResolveOptions>} */
<ide> const convertToResolveOptions = resolveOptionsWithDepType => {
<ide> // These weird types validate that we checked all non-optional properties
<ide> const options = /** @type {Partial<ResolveOptions> & Pick<ResolveOptions, "fileSystem">} */ (partialOptions);
<ide>
<del> if (!resolveOptionsWithDepType.byDependency) {
<del> return options;
<del> }
<del>
<del> const usedDependencyType =
<del> dependencyType in byDependency ? `${dependencyType}` : "default";
<del>
<del> const depDependentOptions = byDependency[usedDependencyType];
<del> if (!depDependentOptions) return options;
<del> return removeOperations(cleverMerge(options, depDependentOptions));
<add> return removeOperations(
<add> resolveByProperty(options, "byDependency", dependencyType)
<add> );
<ide> };
<ide>
<ide> /**
<ide><path>lib/util/cleverMerge.js
<ide> const removeOperations = obj => {
<ide> return newObj;
<ide> };
<ide>
<add>/**
<add> * @param {object} obj the object
<add> * @param {string} byProperty the by description
<add> * @param {...any} values values
<add> * @returns {object} object with merged byProperty
<add> */
<add>const resolveByProperty = (obj, byProperty, ...values) => {
<add> if (!(byProperty in obj)) {
<add> return obj;
<add> }
<add> const { [byProperty]: byValue, ...remaining } = obj;
<add> if (typeof byValue === "object") {
<add> const key = values[0];
<add> if (key in byValue) {
<add> return cleverMerge(remaining, byValue[key]);
<add> } else if ("default" in byValue) {
<add> return cleverMerge(remaining, byValue.default);
<add> } else {
<add> return remaining;
<add> }
<add> } else if (typeof byValue === "function") {
<add> const result = resolveByProperty(
<add> byValue.apply(null, values),
<add> byProperty,
<add> ...values
<add> );
<add> return cleverMerge(remaining, result);
<add> }
<add>};
<add>
<ide> exports.cachedSetProperty = cachedSetProperty;
<ide> exports.cachedCleverMerge = cachedCleverMerge;
<ide> exports.cleverMerge = cleverMerge;
<add>exports.resolveByProperty = resolveByProperty;
<ide> exports.removeOperations = removeOperations;
<ide> exports.DELETE = DELETE;
| 2
|
Javascript
|
Javascript
|
test bad useeffect return value with noop-renderer
|
4ce89a58dac5287a2c7fc454e86562297e97a6d9
|
<ide><path>packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js
<ide> describe('ReactHooks', () => {
<ide> ReactTestRenderer.create(<App deps={undefined} />);
<ide> });
<ide>
<del> it('assumes useEffect clean-up function is either a function or undefined', () => {
<del> const {useLayoutEffect} = React;
<del>
<del> function App(props) {
<del> useLayoutEffect(() => {
<del> return props.return;
<del> });
<del> return null;
<del> }
<del>
<del> const root1 = ReactTestRenderer.create(null);
<del> expect(() => root1.update(<App return={17} />)).toErrorDev([
<del> 'Warning: An effect function must not return anything besides a ' +
<del> 'function, which is used for clean-up. You returned: 17',
<del> ]);
<del>
<del> const root2 = ReactTestRenderer.create(null);
<del> expect(() => root2.update(<App return={null} />)).toErrorDev([
<del> 'Warning: An effect function must not return anything besides a ' +
<del> 'function, which is used for clean-up. You returned null. If your ' +
<del> 'effect does not require clean up, return undefined (or nothing).',
<del> ]);
<del>
<del> const root3 = ReactTestRenderer.create(null);
<del> expect(() => root3.update(<App return={Promise.resolve()} />)).toErrorDev([
<del> 'Warning: An effect function must not return anything besides a ' +
<del> 'function, which is used for clean-up.\n\n' +
<del> 'It looks like you wrote useEffect(async () => ...) or returned a Promise.',
<del> ]);
<del>
<del> // Error on unmount because React assumes the value is a function
<del> expect(() => {
<del> root3.update(null);
<del> }).toThrow('is not a function');
<del> });
<del>
<ide> it('does not forget render phase useState updates inside an effect', () => {
<ide> const {useState, useEffect} = React;
<ide>
<ide><path>packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
<ide> describe('ReactHooksWithNoopRenderer', () => {
<ide> });
<ide> expect(Scheduler).toHaveYielded(['layout destroy', 'passive destroy']);
<ide> });
<add>
<add> it('assumes passive effect destroy function is either a function or undefined', () => {
<add> function App(props) {
<add> useEffect(() => {
<add> return props.return;
<add> });
<add> return null;
<add> }
<add>
<add> const root1 = ReactNoop.createRoot();
<add> expect(() =>
<add> act(() => {
<add> root1.render(<App return={17} />);
<add> }),
<add> ).toErrorDev([
<add> 'Warning: An effect function must not return anything besides a ' +
<add> 'function, which is used for clean-up. You returned: 17',
<add> ]);
<add>
<add> const root2 = ReactNoop.createRoot();
<add> expect(() =>
<add> act(() => {
<add> root2.render(<App return={null} />);
<add> }),
<add> ).toErrorDev([
<add> 'Warning: An effect function must not return anything besides a ' +
<add> 'function, which is used for clean-up. You returned null. If your ' +
<add> 'effect does not require clean up, return undefined (or nothing).',
<add> ]);
<add>
<add> const root3 = ReactNoop.createRoot();
<add> expect(() =>
<add> act(() => {
<add> root3.render(<App return={Promise.resolve()} />);
<add> }),
<add> ).toErrorDev([
<add> 'Warning: An effect function must not return anything besides a ' +
<add> 'function, which is used for clean-up.\n\n' +
<add> 'It looks like you wrote useEffect(async () => ...) or returned a Promise.',
<add> ]);
<add>
<add> // Error on unmount because React assumes the value is a function
<add> expect(() =>
<add> act(() => {
<add> root3.unmount();
<add> }),
<add> ).toThrow('is not a function');
<add> });
<ide> });
<ide>
<ide> describe('useLayoutEffect', () => {
<ide> describe('ReactHooksWithNoopRenderer', () => {
<ide> ]);
<ide> expect(ReactNoop.getChildren()).toEqual([span('OuterFallback')]);
<ide> });
<add>
<add> it('assumes layout effect destroy function is either a function or undefined', () => {
<add> function App(props) {
<add> useLayoutEffect(() => {
<add> return props.return;
<add> });
<add> return null;
<add> }
<add>
<add> const root1 = ReactNoop.createRoot();
<add> expect(() =>
<add> act(() => {
<add> root1.render(<App return={17} />);
<add> }),
<add> ).toErrorDev([
<add> 'Warning: An effect function must not return anything besides a ' +
<add> 'function, which is used for clean-up. You returned: 17',
<add> ]);
<add>
<add> const root2 = ReactNoop.createRoot();
<add> expect(() =>
<add> act(() => {
<add> root2.render(<App return={null} />);
<add> }),
<add> ).toErrorDev([
<add> 'Warning: An effect function must not return anything besides a ' +
<add> 'function, which is used for clean-up. You returned null. If your ' +
<add> 'effect does not require clean up, return undefined (or nothing).',
<add> ]);
<add>
<add> const root3 = ReactNoop.createRoot();
<add> expect(() =>
<add> act(() => {
<add> root3.render(<App return={Promise.resolve()} />);
<add> }),
<add> ).toErrorDev([
<add> 'Warning: An effect function must not return anything besides a ' +
<add> 'function, which is used for clean-up.\n\n' +
<add> 'It looks like you wrote useEffect(async () => ...) or returned a Promise.',
<add> ]);
<add>
<add> // Error on unmount because React assumes the value is a function
<add> expect(() =>
<add> act(() => {
<add> root3.unmount();
<add> }),
<add> ).toThrow('is not a function');
<add> });
<ide> });
<ide>
<ide> describe('useCallback', () => {
| 2
|
Javascript
|
Javascript
|
fix missed hmr events
|
520c5a408332c4269bc6251f437c40fd2a1d4954
|
<ide><path>packages/next/client/dev/error-overlay/hot-dev-client.js
<ide> import {
<ide> import stripAnsi from 'next/dist/compiled/strip-ansi'
<ide> import { addMessageListener } from './websocket'
<ide> import formatWebpackMessages from './format-webpack-messages'
<add>import Router from 'next/router'
<ide>
<ide> // This alternative WebpackDevServer combines the functionality of:
<ide> // https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
<ide> function clearOutdatedErrors() {
<ide> function handleSuccess() {
<ide> clearOutdatedErrors()
<ide>
<del> const isHotUpdate = !isFirstCompilation
<add> const isHotUpdate =
<add> !isFirstCompilation ||
<add> (Router.pathname !== '/_error' && isUpdateAvailable())
<ide> isFirstCompilation = false
<ide> hasCompileErrors = false
<ide>
| 1
|
PHP
|
PHP
|
remove scalar type
|
67a38ba0fa2acfbd1f4af4bf7d462bb4419cc091
|
<ide><path>src/Illuminate/Auth/Access/Response.php
<ide> class Response implements Arrayable
<ide> * @param mixed $code
<ide> * @return void
<ide> */
<del> public function __construct(bool $allowed, $message = '', $code = null)
<add> public function __construct($allowed, $message = '', $code = null)
<ide> {
<ide> $this->code = $code;
<ide> $this->allowed = $allowed;
| 1
|
PHP
|
PHP
|
use invalidargumentexception for exception
|
95763459070fc8cc19c02b85593321828d88c8a0
|
<ide><path>src/Routing/RouteBuilder.php
<ide> public static function parseShortString(string $routeString): array
<ide> $#ix';
<ide>
<ide> if (!preg_match($regex, $routeString, $matches)) {
<del> throw new RuntimeException("Could not parse `{$routeString}` route short string.");
<add> throw new InvalidArgumentException("Could not parse `{$routeString}` route short string.");
<ide> }
<ide>
<ide> $defaults = [];
<ide><path>src/Routing/Router.php
<ide> use Cake\Routing\Exception\MissingRouteException;
<ide> use Cake\Utility\Inflector;
<ide> use Exception;
<add>use InvalidArgumentException;
<ide> use Psr\Http\Message\ServerRequestInterface;
<ide> use ReflectionFunction;
<ide> use ReflectionMethod;
<ide> public static function setRouteCollection(RouteCollection $routeCollection): voi
<ide> protected static function unwrapShortString(array $url)
<ide> {
<ide> foreach (['plugin', 'prefix', 'controller', 'action'] as $key) {
<del> if (array_key_exists($key, $url)) {
<del> throw new RuntimeException("The `_path` string cannot be overriden by `$key` key.");
<add> if (isset($url[$key])) {
<add> throw new InvalidArgumentException("`$key` cannot be used to override `_path` value.");
<ide> }
<ide> }
<ide>
<ide> $url += RouteBuilder::parseShortString($url['_path']);
<ide> $url += [
<del> 'plugin' => null,
<add> 'plugin' => false,
<ide> 'prefix' => false,
<ide> ];
<ide>
<ide><path>tests/TestCase/Routing/RouteBuilderTest.php
<ide> use Cake\Routing\RouteCollection;
<ide> use Cake\Routing\Router;
<ide> use Cake\TestSuite\TestCase;
<del>use RuntimeException;
<add>use InvalidArgumentException;
<ide>
<ide> /**
<ide> * RouteBuilder test case
<ide> public function testConnectTrimTrailingSlash()
<ide> */
<ide> public function testConnectShortStringInvalid()
<ide> {
<del> $this->expectException(RuntimeException::class);
<add> $this->expectException(InvalidArgumentException::class);
<ide> $routes = new RouteBuilder($this->collection, '/');
<ide> $routes->connect('/my-articles/view', 'Articles:no');
<ide> }
<ide> public function invalidShortStringsProvider()
<ide> */
<ide> public function testParseShortInvalidString(string $value)
<ide> {
<del> $this->expectException(RuntimeException::class);
<add> $this->expectException(InvalidArgumentException::class);
<ide> $this->expectExceptionMessage('Could not parse');
<ide>
<ide> RouteBuilder::parseShortString($value);
<ide><path>tests/TestCase/Routing/RouterTest.php
<ide> use Cake\Routing\RouteCollection;
<ide> use Cake\Routing\Router;
<ide> use Cake\TestSuite\TestCase;
<add>use InvalidArgumentException;
<ide> use RuntimeException;
<ide>
<ide> /**
<ide> public function testUrlGenerationInShortStringSyntaxWithContext()
<ide>
<ide> $request = new ServerRequest([
<ide> 'params' => [
<del> 'plugin' => null,
<add> 'plugin' => 'Cms',
<ide> 'prefix' => 'admin',
<ide> 'controller' => 'Articles',
<ide> 'action' => 'edit',
<ide> public function testUrlGenerationInShortStringSyntaxWithContext()
<ide> public function invalidShortStringArrayProvider()
<ide> {
<ide> return [
<del> [['_path' => 'Articles::index', 'plugin' => null]],
<add> [['_path' => 'Articles::index', 'plugin' => false]],
<ide> [['_path' => 'Articles::index', 'plugin' => 'Cms']],
<ide> [['_path' => 'Articles::index', 'prefix' => false]],
<ide> [['_path' => 'Articles::index', 'prefix' => 'Manager']],
<ide> public function testUrlGenerationOverridingShortString(array $url)
<ide> {
<ide> Router::connect('/articles', 'Articles::index');
<ide>
<del> $this->expectException(RuntimeException::class);
<del> $this->expectExceptionMessage('The `_path` string cannot be overriden by ');
<add> $this->expectException(InvalidArgumentException::class);
<add> $this->expectExceptionMessage('cannot be used to override `_path` value.');
<ide>
<ide> Router::url($url);
<ide> }
| 4
|
Go
|
Go
|
fix race conditions in overlay network driver
|
b64997ea82a6094c5d4642a577fa3806afa6e9dd
|
<ide><path>libnetwork/drivers/overlay/ov_network.go
<ide> func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo d
<ide> n.subnets = append(n.subnets, s)
<ide> }
<ide>
<add> d.Lock()
<add> defer d.Unlock()
<add> if d.networks[n.id] != nil {
<add> return fmt.Errorf("attempt to create overlay network %v that already exists", n.id)
<add> }
<add>
<ide> if err := n.writeToStore(); err != nil {
<ide> return fmt.Errorf("failed to update data store for network %v: %v", n.id, err)
<ide> }
<ide> func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo d
<ide>
<ide> if nInfo != nil {
<ide> if err := nInfo.TableEventRegister(ovPeerTable, driverapi.EndpointObject); err != nil {
<add> // XXX Undo writeToStore? No method to so. Why?
<ide> return err
<ide> }
<ide> }
<ide>
<del> d.addNetwork(n)
<add> d.networks[id] = n
<add>
<ide> return nil
<ide> }
<ide>
<ide> func (d *driver) DeleteNetwork(nid string) error {
<ide> return err
<ide> }
<ide>
<del> n := d.network(nid)
<add> d.Lock()
<add> defer d.Unlock()
<add>
<add> // This is similar to d.network(), but we need to keep holding the lock
<add> // until we are done removing this network.
<add> n, ok := d.networks[nid]
<add> if !ok {
<add> n = d.restoreNetworkFromStore(nid)
<add> }
<ide> if n == nil {
<ide> return fmt.Errorf("could not find network with id %s", nid)
<ide> }
<ide> func (d *driver) DeleteNetwork(nid string) error {
<ide> }
<ide> // flush the peerDB entries
<ide> d.peerFlush(nid)
<del> d.deleteNetwork(nid)
<add> delete(d.networks, nid)
<ide>
<ide> vnis, err := n.releaseVxlanID()
<ide> if err != nil {
<ide> func (n *network) watchMiss(nlSock *nl.NetlinkSocket, nsPath string) {
<ide> }
<ide> }
<ide>
<del>func (d *driver) addNetwork(n *network) {
<del> d.Lock()
<del> d.networks[n.id] = n
<del> d.Unlock()
<del>}
<del>
<del>func (d *driver) deleteNetwork(nid string) {
<del> d.Lock()
<del> delete(d.networks, nid)
<del> d.Unlock()
<add>// Restore a network from the store to the driver if it is present.
<add>// Must be called with the driver locked!
<add>func (d *driver) restoreNetworkFromStore(nid string) *network {
<add> n := d.getNetworkFromStore(nid)
<add> if n != nil {
<add> n.driver = d
<add> n.endpoints = endpointTable{}
<add> n.once = &sync.Once{}
<add> d.networks[nid] = n
<add> }
<add> return n
<ide> }
<ide>
<ide> func (d *driver) network(nid string) *network {
<ide> d.Lock()
<add> defer d.Unlock()
<ide> n, ok := d.networks[nid]
<del> d.Unlock()
<ide> if !ok {
<del> n = d.getNetworkFromStore(nid)
<del> if n != nil {
<del> n.driver = d
<del> n.endpoints = endpointTable{}
<del> n.once = &sync.Once{}
<del> d.Lock()
<del> d.networks[nid] = n
<del> d.Unlock()
<del> }
<add> n = d.restoreNetworkFromStore(nid)
<ide> }
<ide>
<ide> return n
| 1
|
Ruby
|
Ruby
|
add support for table aliasing
|
752813016ed227ecfbe0bf69c92de2e2c3e7a988
|
<ide><path>lib/arel/algebra/relations/utilities/compound.rb
<ide> module Arel
<ide> class Compound < Relation
<ide> attr_reader :relation
<ide> delegate :joins, :join?, :inserts, :taken, :skipped, :name, :externalizable?,
<del> :column_for, :engine, :sources, :locked,
<add> :column_for, :engine, :sources, :locked, :table_alias,
<ide> :to => :relation
<ide>
<ide> [:attributes, :wheres, :groupings, :orders, :havings].each do |operation_name|
<ide><path>lib/arel/engines/sql/christener.rb
<ide> class Christener
<ide> def name_for(relation)
<ide> @used_names ||= Hash.new(0)
<ide> (@relation_names ||= Hash.new do |hash, relation|
<del> @used_names[name = relation.name] += 1
<add> name = relation.table_alias ? relation.table_alias : relation.name
<add> @used_names[name] += 1
<ide> hash[relation] = name + (@used_names[name] > 1 ? "_#{@used_names[name]}" : '')
<ide> end)[relation.table]
<ide> end
<ide><path>lib/arel/engines/sql/relations/table.rb
<ide> class Table < Relation
<ide> include Recursion::BaseCase
<ide>
<ide> cattr_accessor :engine
<del> attr_reader :name, :engine
<add> attr_reader :name, :engine, :table_alias, :options
<ide>
<del> def initialize(name, engine = Table.engine)
<del> @name, @engine = name.to_s, engine
<add> def initialize(name, options = {})
<add> @name = name.to_s
<add>
<add> if options.is_a?(Hash)
<add> @options = options
<add> @engine = options[:engine] || Table.engine
<add> @table_alias = options[:as].to_s if options[:as].present?
<add> else
<add> @engine = options # Table.new('foo', engine)
<add> end
<add> end
<add>
<add> def as(table_alias)
<add> Table.new(name, options.merge(:as => table_alias))
<ide> end
<ide>
<ide> def attributes
<ide><path>spec/arel/engines/sql/unit/relations/join_spec.rb
<ide> module Arel
<ide> before do
<ide> @relation1 = Table.new(:users)
<ide> @relation2 = Table.new(:photos)
<del> @predicate = @relation1[:id].eq(@relation2[:user_id])
<add> @predicate1 = @relation1[:id].eq(@relation2[:user_id])
<add>
<add> @relation3 = Table.new(:users, :as => :super_users)
<add> @relation4 = Table.new(:photos, :as => :super_photos)
<add>
<add> @predicate2 = @relation3[:id].eq(@relation2[:user_id])
<add> @predicate3 = @relation3[:id].eq(@relation4[:user_id])
<ide> end
<ide>
<ide> describe '#to_sql' do
<add>
<ide> describe 'when joining with another relation' do
<ide> it 'manufactures sql joining the two tables on the predicate' do
<del> sql = InnerJoin.new(@relation1, @relation2, @predicate).to_sql
<add> sql = InnerJoin.new(@relation1, @relation2, @predicate1).to_sql
<ide>
<ide> adapter_is :mysql do
<ide> sql.should be_like(%Q{
<ide> module Arel
<ide> })
<ide> end
<ide> end
<add>
<add> describe 'when joining with another relation with an aliased table' do
<add> it 'manufactures sql joining the two tables on the predicate respecting table aliasing' do
<add> sql = InnerJoin.new(@relation3, @relation2, @predicate2).to_sql
<add>
<add> adapter_is :mysql do
<add> sql.should be_like(%Q{
<add> SELECT `super_users`.`id`, `super_users`.`name`, `photos`.`id`, `photos`.`user_id`, `photos`.`camera_id`
<add> FROM `users` AS `super_users`
<add> INNER JOIN `photos` ON `super_users`.`id` = `photos`.`user_id`
<add> })
<add> end
<add>
<add> adapter_is_not :mysql do
<add> sql.should be_like(%Q{
<add> SELECT "super_users"."id", "super_users"."name", "photos"."id", "photos"."user_id", "photos"."camera_id"
<add> FROM "users" AS "super_users"
<add> INNER JOIN "photos" ON "super_users"."id" = "photos"."user_id"
<add> })
<add> end
<add> end
<add> end
<add>
<add> describe 'when joining with two relations with aliased tables' do
<add> it 'manufactures sql joining the two tables on the predicate respecting table aliasing' do
<add> sql = InnerJoin.new(@relation3, @relation4, @predicate3).to_sql
<add>
<add> adapter_is :mysql do
<add> sql.should be_like(%Q{
<add> SELECT `super_users`.`id`, `super_users`.`name`, `super_photos`.`id`, `super_photos`.`user_id`, `super_photos`.`camera_id`
<add> FROM `users` AS `super_users`
<add> INNER JOIN `photos` AS `super_photos` ON `super_users`.`id` = `super_photos`.`user_id`
<add> })
<add> end
<add>
<add> adapter_is_not :mysql do
<add> sql.should be_like(%Q{
<add> SELECT "super_users"."id", "super_users"."name", "super_photos"."id", "super_photos"."user_id", "super_photos"."camera_id"
<add> FROM "users" AS "super_users"
<add> INNER JOIN "photos" AS "super_photos" ON "super_users"."id" = "super_photos"."user_id"
<add> })
<add> end
<add> end
<add> end
<add>
<ide> end
<ide>
<ide> describe 'when joining with a string' do
<ide><path>spec/arel/engines/sql/unit/relations/table_spec.rb
<ide> module Arel
<ide> end
<ide> end
<ide>
<add> describe '#as' do
<add> it "manufactures a simple select query using aliases" do
<add> sql = @relation.as(:super_users).to_sql
<add>
<add> adapter_is :mysql do
<add> sql.should be_like(%Q{
<add> SELECT `super_users`.`id`, `super_users`.`name`
<add> FROM `users` AS `super_users`
<add> })
<add> end
<add>
<add> adapter_is_not :mysql do
<add> sql.should be_like(%Q{
<add> SELECT "super_users"."id", "super_users"."name"
<add> FROM "users" AS "super_users"
<add> })
<add> end
<add> end
<add> end
<add>
<ide> describe '#column_for' do
<ide> it "returns the column corresponding to the attribute" do
<ide> @relation.column_for(@relation[:id]).should == @relation.columns.detect { |c| c.name == 'id' }
| 5
|
Javascript
|
Javascript
|
replace duplicate conditions by functions
|
b404aa56c0e776c9722017ca020f9d04c7aa6de2
|
<ide><path>lib/path.js
<ide> function assertPath(path) {
<ide> }
<ide> }
<ide>
<add>function isPathSeparator(code) {
<add> return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
<add>}
<add>
<add>function isWindowsDeviceRoot(code) {
<add> return code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z ||
<add> code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z;
<add>}
<add>
<ide> // Resolves . and .. elements in a path with directory names
<ide> function normalizeStringWin32(path, allowAboveRoot) {
<ide> var res = '';
<ide> function normalizeStringWin32(path, allowAboveRoot) {
<ide> for (var i = 0; i <= path.length; ++i) {
<ide> if (i < path.length)
<ide> code = path.charCodeAt(i);
<del> else if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> else if (isPathSeparator(code))
<ide> break;
<ide> else
<ide> code = CHAR_FORWARD_SLASH;
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add>
<add> if (isPathSeparator(code)) {
<ide> if (lastSlash === i - 1 || dots === 1) {
<ide> // NOOP
<ide> } else if (lastSlash !== i - 1 && dots === 2) {
<ide> const win32 = {
<ide>
<ide> var len = path.length;
<ide> var rootEnd = 0;
<del> var code = path.charCodeAt(0);
<ide> var device = '';
<ide> var isAbsolute = false;
<add> const code = path.charCodeAt(0);
<ide>
<ide> // Try to match a root
<ide> if (len > 1) {
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(code)) {
<ide> // Possible UNC root
<ide>
<ide> // If we started with a separator, we know we at least have an
<ide> // absolute path of some kind (UNC or otherwise)
<ide> isAbsolute = true;
<ide>
<del> code = path.charCodeAt(1);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(path.charCodeAt(1))) {
<ide> // Matched double path separator at beginning
<ide> var j = 2;
<ide> var last = j;
<ide> // Match 1 or more non-path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> if (isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j < len && j !== last) {
<ide> const win32 = {
<ide> last = j;
<ide> // Match 1 or more path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code !== CHAR_FORWARD_SLASH && code !== CHAR_BACKWARD_SLASH)
<add> if (!isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j < len && j !== last) {
<ide> // Matched!
<ide> last = j;
<ide> // Match 1 or more non-path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> const isPathSeparator =
<del> code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
<del>
<del> if (isPathSeparator)
<add> if (isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j === len) {
<ide> const win32 = {
<ide> } else {
<ide> rootEnd = 1;
<ide> }
<del> } else if ((code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||
<del> (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z)) {
<add> } else if (isWindowsDeviceRoot(code)) {
<ide> // Possible device root
<ide>
<ide> if (path.charCodeAt(1) === CHAR_COLON) {
<ide> device = path.slice(0, 2);
<ide> rootEnd = 2;
<ide> if (len > 2) {
<del> code = path.charCodeAt(2);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(path.charCodeAt(2))) {
<ide> // Treat separator following drive name as an absolute path
<ide> // indicator
<ide> isAbsolute = true;
<ide> const win32 = {
<ide> }
<ide> }
<ide> }
<del> } else if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> } else if (isPathSeparator(code)) {
<ide> // `path` contains just a path separator
<ide> rootEnd = 1;
<ide> isAbsolute = true;
<ide> const win32 = {
<ide> if (len === 0)
<ide> return '.';
<ide> var rootEnd = 0;
<del> var code = path.charCodeAt(0);
<ide> var device;
<ide> var isAbsolute = false;
<add> const code = path.charCodeAt(0);
<ide>
<ide> // Try to match a root
<ide> if (len > 1) {
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(code)) {
<ide> // Possible UNC root
<ide>
<ide> // If we started with a separator, we know we at least have an absolute
<ide> // path of some kind (UNC or otherwise)
<ide> isAbsolute = true;
<ide>
<del> code = path.charCodeAt(1);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(path.charCodeAt(1))) {
<ide> // Matched double path separator at beginning
<ide> var j = 2;
<ide> var last = j;
<ide> // Match 1 or more non-path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> if (isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j < len && j !== last) {
<ide> const win32 = {
<ide> last = j;
<ide> // Match 1 or more path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code !== CHAR_FORWARD_SLASH && code !== CHAR_BACKWARD_SLASH)
<add> if (!isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j < len && j !== last) {
<ide> // Matched!
<ide> last = j;
<ide> // Match 1 or more non-path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> if (isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j === len) {
<ide> const win32 = {
<ide> } else {
<ide> rootEnd = 1;
<ide> }
<del> } else if ((code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||
<del> (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z)) {
<add> } else if (isWindowsDeviceRoot(code)) {
<ide> // Possible device root
<ide>
<ide> if (path.charCodeAt(1) === CHAR_COLON) {
<ide> device = path.slice(0, 2);
<ide> rootEnd = 2;
<ide> if (len > 2) {
<del> code = path.charCodeAt(2);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(path.charCodeAt(2))) {
<ide> // Treat separator following drive name as an absolute path
<ide> // indicator
<ide> isAbsolute = true;
<ide> const win32 = {
<ide> }
<ide> }
<ide> }
<del> } else if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> } else if (isPathSeparator(code)) {
<ide> // `path` contains just a path separator, exit early to avoid unnecessary
<ide> // work
<ide> return '\\';
<ide> }
<ide>
<del> code = path.charCodeAt(len - 1);
<del> var trailingSeparator =
<del> (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH);
<ide> var tail;
<ide> if (rootEnd < len)
<ide> tail = normalizeStringWin32(path.slice(rootEnd), !isAbsolute);
<ide> else
<ide> tail = '';
<ide> if (tail.length === 0 && !isAbsolute)
<ide> tail = '.';
<del> if (tail.length > 0 && trailingSeparator)
<add> if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1)))
<ide> tail += '\\';
<ide> if (device === undefined) {
<ide> if (isAbsolute) {
<ide> const win32 = {
<ide> const len = path.length;
<ide> if (len === 0)
<ide> return false;
<del> var code = path.charCodeAt(0);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add>
<add> const code = path.charCodeAt(0);
<add> if (isPathSeparator(code)) {
<ide> return true;
<del> } else if ((code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||
<del> (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z)) {
<add> } else if (isWindowsDeviceRoot(code)) {
<ide> // Possible device root
<ide>
<ide> if (len > 2 && path.charCodeAt(1) === CHAR_COLON) {
<del> code = path.charCodeAt(2);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> if (isPathSeparator(path.charCodeAt(2)))
<ide> return true;
<ide> }
<ide> }
<ide> const win32 = {
<ide> // path.join('//server', 'share') -> '\\\\server\\share\\')
<ide> var needsReplace = true;
<ide> var slashCount = 0;
<del> var code = firstPart.charCodeAt(0);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(firstPart.charCodeAt(0))) {
<ide> ++slashCount;
<ide> const firstLen = firstPart.length;
<ide> if (firstLen > 1) {
<del> code = firstPart.charCodeAt(1);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(firstPart.charCodeAt(1))) {
<ide> ++slashCount;
<ide> if (firstLen > 2) {
<del> code = firstPart.charCodeAt(2);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> if (isPathSeparator(firstPart.charCodeAt(2)))
<ide> ++slashCount;
<ide> else {
<ide> // We matched a UNC path in the first part
<ide> const win32 = {
<ide> if (needsReplace) {
<ide> // Find any more consecutive slashes we need to replace
<ide> for (; slashCount < joined.length; ++slashCount) {
<del> code = joined.charCodeAt(slashCount);
<del> if (code !== CHAR_FORWARD_SLASH && code !== CHAR_BACKWARD_SLASH)
<add> if (!isPathSeparator(joined.charCodeAt(slashCount)))
<ide> break;
<ide> }
<ide>
<ide> const win32 = {
<ide> const resolvedPath = win32.resolve(path);
<ide>
<ide> if (resolvedPath.length >= 3) {
<del> var code = resolvedPath.charCodeAt(0);
<del> if (code === CHAR_BACKWARD_SLASH) {
<add> if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {
<ide> // Possible UNC root
<ide>
<ide> if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {
<del> code = resolvedPath.charCodeAt(2);
<add> const code = resolvedPath.charCodeAt(2);
<ide> if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {
<ide> // Matched non-long UNC root, convert the path to a long UNC path
<ide> return '\\\\?\\UNC\\' + resolvedPath.slice(2);
<ide> }
<ide> }
<del> } else if ((code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||
<del> (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z)) {
<add> } else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) {
<ide> // Possible device root
<ide>
<ide> if (resolvedPath.charCodeAt(1) === CHAR_COLON &&
<ide> const win32 = {
<ide> var end = -1;
<ide> var matchedSlash = true;
<ide> var offset = 0;
<del> var code = path.charCodeAt(0);
<add> const code = path.charCodeAt(0);
<ide>
<ide> // Try to match a root
<ide> if (len > 1) {
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(code)) {
<ide> // Possible UNC root
<ide>
<ide> rootEnd = offset = 1;
<ide>
<del> code = path.charCodeAt(1);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(path.charCodeAt(1))) {
<ide> // Matched double path separator at beginning
<ide> var j = 2;
<ide> var last = j;
<ide> // Match 1 or more non-path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> if (isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j < len && j !== last) {
<ide> // Matched!
<ide> last = j;
<ide> // Match 1 or more path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code !== CHAR_FORWARD_SLASH && code !== CHAR_BACKWARD_SLASH)
<add> if (!isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j < len && j !== last) {
<ide> // Matched!
<ide> last = j;
<ide> // Match 1 or more non-path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> if (isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j === len) {
<ide> const win32 = {
<ide> }
<ide> }
<ide> }
<del> } else if ((code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||
<del> (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z)) {
<add> } else if (isWindowsDeviceRoot(code)) {
<ide> // Possible device root
<ide>
<ide> if (path.charCodeAt(1) === CHAR_COLON) {
<ide> rootEnd = offset = 2;
<ide> if (len > 2) {
<del> code = path.charCodeAt(2);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> if (isPathSeparator(path.charCodeAt(2)))
<ide> rootEnd = offset = 3;
<ide> }
<ide> }
<ide> }
<del> } else if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> } else if (isPathSeparator(code)) {
<ide> // `path` contains just a path separator, exit early to avoid
<ide> // unnecessary work
<ide> return path;
<ide> }
<ide>
<ide> for (var i = len - 1; i >= offset; --i) {
<del> code = path.charCodeAt(i);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(path.charCodeAt(i))) {
<ide> if (!matchedSlash) {
<ide> end = i;
<ide> break;
<ide> const win32 = {
<ide> // disregarded
<ide> if (path.length >= 2) {
<ide> const drive = path.charCodeAt(0);
<del> if ((drive >= CHAR_UPPERCASE_A && drive <= CHAR_UPPERCASE_Z) ||
<del> (drive >= CHAR_LOWERCASE_A && drive <= CHAR_LOWERCASE_Z)) {
<add> if (isWindowsDeviceRoot(drive)) {
<ide> if (path.charCodeAt(1) === CHAR_COLON)
<ide> start = 2;
<ide> }
<ide> const win32 = {
<ide> var firstNonSlashEnd = -1;
<ide> for (i = path.length - 1; i >= start; --i) {
<ide> const code = path.charCodeAt(i);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(code)) {
<ide> // If we reached a path separator that was not part of a set of path
<ide> // separators at the end of the string, stop now
<ide> if (!matchedSlash) {
<ide> const win32 = {
<ide> return path.slice(start, end);
<ide> } else {
<ide> for (i = path.length - 1; i >= start; --i) {
<del> const code = path.charCodeAt(i);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(path.charCodeAt(i))) {
<ide> // If we reached a path separator that was not part of a set of path
<ide> // separators at the end of the string, stop now
<ide> if (!matchedSlash) {
<ide> const win32 = {
<ide> // Check for a drive letter prefix so as not to mistake the following
<ide> // path separator as an extra separator at the end of the path that can be
<ide> // disregarded
<del> if (path.length >= 2) {
<del> const code = path.charCodeAt(0);
<del> if (path.charCodeAt(1) === CHAR_COLON &&
<del> ((code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||
<del> (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z))) {
<del> start = startPart = 2;
<del> }
<add>
<add> if (path.length >= 2 &&
<add> path.charCodeAt(1) === CHAR_COLON &&
<add> isWindowsDeviceRoot(path.charCodeAt(0))) {
<add> start = startPart = 2;
<ide> }
<ide>
<ide> for (var i = path.length - 1; i >= start; --i) {
<ide> const code = path.charCodeAt(i);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(code)) {
<ide> // If we reached a path separator that was not part of a set of path
<ide> // separators at the end of the string, stop now
<ide> if (!matchedSlash) {
<ide> const win32 = {
<ide>
<ide> var len = path.length;
<ide> var rootEnd = 0;
<del> var code = path.charCodeAt(0);
<add> let code = path.charCodeAt(0);
<ide>
<ide> // Try to match a root
<ide> if (len > 1) {
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(code)) {
<ide> // Possible UNC root
<ide>
<del> code = path.charCodeAt(1);
<ide> rootEnd = 1;
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(path.charCodeAt(1))) {
<ide> // Matched double path separator at beginning
<ide> var j = 2;
<ide> var last = j;
<ide> // Match 1 or more non-path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> if (isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j < len && j !== last) {
<ide> // Matched!
<ide> last = j;
<ide> // Match 1 or more path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code !== CHAR_FORWARD_SLASH && code !== CHAR_BACKWARD_SLASH)
<add> if (!isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j < len && j !== last) {
<ide> // Matched!
<ide> last = j;
<ide> // Match 1 or more non-path separators
<ide> for (; j < len; ++j) {
<del> code = path.charCodeAt(j);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH)
<add> if (isPathSeparator(path.charCodeAt(j)))
<ide> break;
<ide> }
<ide> if (j === len) {
<ide> const win32 = {
<ide> }
<ide> }
<ide> }
<del> } else if ((code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||
<del> (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z)) {
<add> } else if (isWindowsDeviceRoot(code)) {
<ide> // Possible device root
<ide>
<ide> if (path.charCodeAt(1) === CHAR_COLON) {
<ide> rootEnd = 2;
<ide> if (len > 2) {
<del> code = path.charCodeAt(2);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(path.charCodeAt(2))) {
<ide> if (len === 3) {
<ide> // `path` contains just a drive root, exit early to avoid
<ide> // unnecessary work
<ide> const win32 = {
<ide> }
<ide> }
<ide> }
<del> } else if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> } else if (isPathSeparator(code)) {
<ide> // `path` contains just a path separator, exit early to avoid
<ide> // unnecessary work
<ide> ret.root = ret.dir = path;
<ide> const win32 = {
<ide> // Get non-dir info
<ide> for (; i >= rootEnd; --i) {
<ide> code = path.charCodeAt(i);
<del> if (code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH) {
<add> if (isPathSeparator(code)) {
<ide> // If we reached a path separator that was not part of a set of path
<ide> // separators at the end of the string, stop now
<ide> if (!matchedSlash) {
<ide> const posix = {
<ide> assertPath(path);
<ide> if (path.length === 0)
<ide> return '.';
<del> var code = path.charCodeAt(0);
<del> var hasRoot = (code === CHAR_FORWARD_SLASH);
<add> const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
<ide> var end = -1;
<ide> var matchedSlash = true;
<ide> for (var i = path.length - 1; i >= 1; --i) {
<del> code = path.charCodeAt(i);
<del> if (code === CHAR_FORWARD_SLASH) {
<add> if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {
<ide> if (!matchedSlash) {
<ide> end = i;
<ide> break;
<ide> const posix = {
<ide> var ret = { root: '', dir: '', base: '', ext: '', name: '' };
<ide> if (path.length === 0)
<ide> return ret;
<del> var code = path.charCodeAt(0);
<del> var isAbsolute = (code === CHAR_FORWARD_SLASH);
<add> var isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
<ide> var start;
<ide> if (isAbsolute) {
<ide> ret.root = '/';
<ide> const posix = {
<ide>
<ide> // Get non-dir info
<ide> for (; i >= start; --i) {
<del> code = path.charCodeAt(i);
<add> const code = path.charCodeAt(i);
<ide> if (code === CHAR_FORWARD_SLASH) {
<ide> // If we reached a path separator that was not part of a set of path
<ide> // separators at the end of the string, stop now
| 1
|
Ruby
|
Ruby
|
fix some typos
|
2c92f5b92fafe036b53cef36428bd8df1bdb99b7
|
<ide><path>activesupport/lib/active_support/core_ext/module/delegation.rb
<ide> def delegate(*methods)
<ide> #
<ide> # Reason is twofold: On one hand doing less calls is in general better.
<ide> # On the other hand it could be that the target has side-effects,
<del> # whereas conceptualy, from the user point of view, the delegator should
<add> # whereas conceptually, from the user point of view, the delegator should
<ide> # be doing one call.
<ide> if allow_nil
<ide> module_eval(<<-EOS, file, line - 3)
<ide><path>activesupport/lib/active_support/file_update_checker.rb
<ide> def max_mtime(paths)
<ide> end
<ide>
<ide> def compile_glob(hash)
<del> hash.freeze # Freeze so changes aren't accidently pushed
<add> hash.freeze # Freeze so changes aren't accidentally pushed
<ide> return if hash.empty?
<ide>
<ide> globs = hash.map do |key, value|
| 2
|
Mixed
|
Javascript
|
add `maxarraylength` option to set and map
|
71ca6d7d6a3cd3e6e553350abbc40f0a331e964c
|
<ide><path>doc/api/util.md
<ide> stream.write('With ES6');
<ide> <!-- YAML
<ide> added: v0.3.0
<ide> changes:
<add> - version: REPLACEME
<add> pr-url: https://github.com/nodejs/node/pull/43576
<add> description: add support for `maxArrayLength` when inspecting `Set` and `Map`.
<ide> - version:
<ide> - v17.3.0
<ide> - v16.14.0
<ide> changes:
<ide> * `showProxy` {boolean} If `true`, `Proxy` inspection includes
<ide> the [`target` and `handler`][] objects. **Default:** `false`.
<ide> * `maxArrayLength` {integer} Specifies the maximum number of `Array`,
<del> [`TypedArray`][], [`WeakMap`][], and [`WeakSet`][] elements to include when
<del> formatting. Set to `null` or `Infinity` to show all elements. Set to `0` or
<add> [`TypedArray`][], [`Map`][], [`Set`][], [`WeakMap`][],
<add> and [`WeakSet`][] elements to include when formatting.
<add> Set to `null` or `Infinity` to show all elements. Set to `0` or
<ide> negative to show no elements. **Default:** `100`.
<ide> * `maxStringLength` {integer} Specifies the maximum number of characters to
<ide> include when formatting. Set to `null` or `Infinity` to show all elements.
<ide><path>lib/internal/util/inspect.js
<ide> function addNumericSeparatorEnd(integerString) {
<ide> `${result}${integerString.slice(i)}`;
<ide> }
<ide>
<add>const remainingText = (remaining) => `... ${remaining} more item${remaining > 1 ? 's' : ''}`;
<add>
<ide> function formatNumber(fn, number, numericSeparator) {
<ide> if (!numericSeparator) {
<ide> // Format -0 as '-0'. Checking `number === -0` won't distinguish 0 from -0.
<ide> function formatSpecialArray(ctx, value, recurseTimes, maxLength, output, i) {
<ide> output.push(ctx.stylize(message, 'undefined'));
<ide> }
<ide> } else if (remaining > 0) {
<del> output.push(`... ${remaining} more item${remaining > 1 ? 's' : ''}`);
<add> output.push(remainingText(remaining));
<ide> }
<ide> return output;
<ide> }
<ide> function formatArray(ctx, value, recurseTimes) {
<ide> output.push(formatProperty(ctx, value, recurseTimes, i, kArrayType));
<ide> }
<ide> if (remaining > 0)
<del> output.push(`... ${remaining} more item${remaining > 1 ? 's' : ''}`);
<add> output.push(remainingText(remaining));
<ide> return output;
<ide> }
<ide>
<ide> function formatTypedArray(value, length, ctx, ignored, recurseTimes) {
<ide> output[i] = elementFormatter(ctx.stylize, value[i], ctx.numericSeparator);
<ide> }
<ide> if (remaining > 0) {
<del> output[maxLength] = `... ${remaining} more item${remaining > 1 ? 's' : ''}`;
<add> output[maxLength] = remainingText(remaining);
<ide> }
<ide> if (ctx.showHidden) {
<ide> // .buffer goes last, it's not a primitive like the others.
<ide> function formatTypedArray(value, length, ctx, ignored, recurseTimes) {
<ide> }
<ide>
<ide> function formatSet(value, ctx, ignored, recurseTimes) {
<add> const length = value.size;
<add> const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length);
<add> const remaining = length - maxLength;
<ide> const output = [];
<ide> ctx.indentationLvl += 2;
<add> let i = 0;
<ide> for (const v of value) {
<add> if (i >= maxLength) break;
<ide> ArrayPrototypePush(output, formatValue(ctx, v, recurseTimes));
<add> i++;
<add> }
<add> if (remaining > 0) {
<add> ArrayPrototypePush(output, remainingText(remaining));
<ide> }
<ide> ctx.indentationLvl -= 2;
<ide> return output;
<ide> }
<ide>
<ide> function formatMap(value, ctx, ignored, recurseTimes) {
<add> const length = value.size;
<add> const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length);
<add> const remaining = length - maxLength;
<ide> const output = [];
<ide> ctx.indentationLvl += 2;
<add> let i = 0;
<ide> for (const { 0: k, 1: v } of value) {
<add> if (i >= maxLength) break;
<ide> output.push(
<ide> `${formatValue(ctx, k, recurseTimes)} => ${formatValue(ctx, v, recurseTimes)}`
<ide> );
<add> i++;
<add> }
<add> if (remaining > 0) {
<add> ArrayPrototypePush(output, remainingText(remaining));
<ide> }
<ide> ctx.indentationLvl -= 2;
<ide> return output;
<ide> function formatSetIterInner(ctx, recurseTimes, entries, state) {
<ide> }
<ide> const remaining = entries.length - maxLength;
<ide> if (remaining > 0) {
<del> ArrayPrototypePush(output,
<del> `... ${remaining} more item${remaining > 1 ? 's' : ''}`);
<add> ArrayPrototypePush(output, remainingText(remaining));
<ide> }
<ide> return output;
<ide> }
<ide> function formatMapIterInner(ctx, recurseTimes, entries, state) {
<ide> }
<ide> ctx.indentationLvl -= 2;
<ide> if (remaining > 0) {
<del> output.push(`... ${remaining} more item${remaining > 1 ? 's' : ''}`);
<add> output.push(remainingText(remaining));
<ide> }
<ide> return output;
<ide> }
<ide><path>test/parallel/test-util-inspect.js
<ide> if (typeof Symbol !== 'undefined') {
<ide> {
<ide> assert.strictEqual(util.inspect(new Set()), 'Set(0) {}');
<ide> assert.strictEqual(util.inspect(new Set([1, 2, 3])), 'Set(3) { 1, 2, 3 }');
<add> assert.strictEqual(util.inspect(new Set([1, 2, 3]), { maxArrayLength: 1 }), 'Set(3) { 1, ... 2 more items }');
<ide> const set = new Set(['foo']);
<ide> set.bar = 42;
<ide> assert.strictEqual(
<ide> if (typeof Symbol !== 'undefined') {
<ide> assert.strictEqual(util.inspect(new Map()), 'Map(0) {}');
<ide> assert.strictEqual(util.inspect(new Map([[1, 'a'], [2, 'b'], [3, 'c']])),
<ide> "Map(3) { 1 => 'a', 2 => 'b', 3 => 'c' }");
<add> assert.strictEqual(util.inspect(new Map([[1, 'a'], [2, 'b'], [3, 'c']]), { maxArrayLength: 1 }),
<add> "Map(3) { 1 => 'a', ... 2 more items }");
<ide> const map = new Map([['foo', null]]);
<ide> map.bar = 42;
<ide> assert.strictEqual(util.inspect(map, true),
| 3
|
Javascript
|
Javascript
|
fix regression in `unpipe()`
|
8043ca79c556619741defe929d6a0c4b8e98922c
|
<ide><path>lib/_stream_readable.js
<ide> Readable.prototype.unpipe = function(dest) {
<ide> if (index === -1)
<ide> return this;
<ide>
<del> state.pipes.splice(i, 1);
<add> state.pipes.splice(index, 1);
<ide> state.pipesCount -= 1;
<ide> if (state.pipesCount === 1)
<ide> state.pipes = state.pipes[0];
| 1
|
Javascript
|
Javascript
|
fix free http-parser too early
|
3fd13c6426b338196d138b0dc564020daed78bcd
|
<ide><path>lib/http.js
<ide> ClientRequest.prototype.onSocket = function(socket) {
<ide> socket.destroy();
<ide> }
<ide> freeParser();
<del> } else if (parser.incoming && parser.incoming.complete) {
<add> } else if (parser.incoming && parser.incoming.complete &&
<add> // When the status code is 100 (Continue), the server will
<add> // send a final response after this client sends a request
<add> // body. So, we must not free the parser.
<add> parser.incoming.statusCode !== 100) {
<ide> freeParser();
<ide> }
<ide> };
<ide><path>test/simple/test-http-expect-continue.js
<ide> server.on('checkContinue', function(req, res) {
<ide> common.debug('Server got Expect: 100-continue...');
<ide> res.writeContinue();
<ide> sent_continue = true;
<del> handler(req, res);
<add> setTimeout(function() {
<add> handler(req, res);
<add> }, 100);
<ide> });
<ide> server.listen(common.PORT);
<ide>
| 2
|
Go
|
Go
|
make setopts() a method of localvolume
|
a77b90c35e2ff95fa58aff1cd450db3ccbff36a6
|
<ide><path>volume/local/local.go
<ide> func (r *Root) Create(name string, opts map[string]string) (volume.Volume, error
<ide> }
<ide>
<ide> if len(opts) != 0 {
<del> if err = setOpts(v, opts); err != nil {
<add> if err = v.setOpts(opts); err != nil {
<ide> return nil, err
<ide> }
<ide> var b []byte
<ide><path>volume/local/local_unix.go
<ide> func (o *optsConfig) String() string {
<ide> return fmt.Sprintf("type='%s' device='%s' o='%s' size='%d'", o.MountType, o.MountDevice, o.MountOpts, o.Quota.Size)
<ide> }
<ide>
<del>func setOpts(v *localVolume, opts map[string]string) error {
<add>func (v *localVolume) setOpts(opts map[string]string) error {
<ide> if len(opts) == 0 {
<ide> return nil
<ide> }
<ide><path>volume/local/local_windows.go
<ide> import (
<ide>
<ide> type optsConfig struct{}
<ide>
<del>func setOpts(v *localVolume, opts map[string]string) error {
<add>func (v *localVolume) setOpts(opts map[string]string) error {
<ide> if len(opts) > 0 {
<ide> return errdefs.InvalidParameter(errors.New("options are not supported on this platform"))
<ide> }
| 3
|
Ruby
|
Ruby
|
fix safe navigation bug
|
3769bcc52338a4381d19443c18386f8261297fd7
|
<ide><path>Library/Homebrew/formula.rb
<ide> def to_hash
<ide> "oldname" => oldname,
<ide> "aliases" => aliases,
<ide> "versions" => {
<del> "stable" => stable&.version.to_s,
<add> "stable" => stable&.version&.to_s,
<ide> "bottle" => bottle ? true : false,
<del> "devel" => devel&.version.to_s,
<del> "head" => head&.version.to_s,
<add> "devel" => devel&.version&.to_s,
<add> "head" => head&.version&.to_s,
<ide> },
<ide> "revision" => revision,
<ide> "version_scheme" => version_scheme,
| 1
|
PHP
|
PHP
|
capitalize sql operators
|
144f541a2e109719f142703b61d1d5baa829917d
|
<ide><path>lib/Cake/Database/Expression/QueryExpression.php
<ide> protected function _parseCondition($field, $value, $types) {
<ide> if (in_array(strtolower(trim($operator)), ['in', 'not in']) || $typeMultiple) {
<ide> $type = $type ?: 'string';
<ide> $type .= $typeMultiple ? null : '[]';
<del> $operator = $operator == '=' ? 'in' : $operator;
<del> $operator = $operator == '!=' ? 'not in' : $operator;
<add> $operator = $operator == '=' ? 'IN' : $operator;
<add> $operator = $operator == '!=' ? 'NOT IN' : $operator;
<ide> $multi = true;
<ide> }
<ide>
| 1
|
PHP
|
PHP
|
add tests for exception bubble up
|
da5c182bc89d395b06f6c1279f63672212020731
|
<ide><path>tests/TestCase/TestSuite/IntegrationTestCaseTest.php
<ide> public function testPostAndErrorHandling()
<ide> $this->assertResponseContains('<!DOCTYPE html>');
<ide> }
<ide>
<add> /**
<add> * Test that exceptions being thrown are handled correctly.
<add> *
<add> * @return void
<add> */
<add> public function testWithExpectedException()
<add> {
<add> $this->get('/tests_apps/throw_exception');
<add> $this->assertResponseCode(500);
<add> }
<add>
<add> /**
<add> * Test that exceptions being thrown are handled correctly.
<add> *
<add> * @expectedException PHPUnit_Framework_AssertionFailedError
<add> * @return void
<add> */
<add> public function testWithUnexpectedException()
<add> {
<add> $this->get('/tests_apps/throw_exception');
<add> $this->assertResponseCode(501);
<add> }
<add>
<ide> /**
<ide> * Test redirecting and integration tests.
<ide> *
<ide><path>tests/test_app/TestApp/Controller/TestsAppsController.php
<ide> public function set_type()
<ide> $this->response->type('json');
<ide> return $this->response;
<ide> }
<add>
<add> public function throw_exception()
<add> {
<add> throw new \RuntimeException('Foo');
<add> }
<ide> }
| 2
|
Javascript
|
Javascript
|
add a basic integration test for glimmer
|
b8786badc7dd018487ac131283a4a462fcbd6e49
|
<ide><path>packages/ember-application/lib/system/application-instance.js
<ide> import run from 'ember-metal/run_loop';
<ide> import { computed } from 'ember-metal/computed';
<ide> import DOMHelper from 'ember-htmlbars/system/dom-helper';
<ide> import { buildFakeRegistryWithDeprecations } from 'ember-runtime/mixins/registry_proxy';
<del>import Renderer from 'ember-metal-views/renderer';
<add>import { Renderer } from 'ember-metal-views';
<ide> import assign from 'ember-metal/assign';
<ide> import environment from 'ember-metal/environment';
<ide> import RSVP from 'ember-runtime/ext/rsvp';
<ide> const ApplicationInstance = EngineInstance.extend({
<ide>
<ide> registry.register('renderer:-dom', {
<ide> create() {
<del> return new Renderer(new DOMHelper(options.document), options.isInteractive);
<add> return new Renderer(new DOMHelper(options.document), { destinedForDOM: options.isInteractive });
<ide> }
<ide> });
<ide>
<ide><path>packages/ember-application/lib/system/application.js
<ide> import { get } from 'ember-metal/property_get';
<ide> import { runLoadHooks } from 'ember-runtime/system/lazy_load';
<ide> import run from 'ember-metal/run_loop';
<ide> import Controller from 'ember-runtime/controllers/controller';
<del>import Renderer from 'ember-metal-views/renderer';
<add>import { Renderer } from 'ember-metal-views';
<ide> import DOMHelper from 'ember-htmlbars/system/dom-helper';
<ide> import SelectView from 'ember-views/views/select';
<ide> import { OutletView } from 'ember-routing-views/views/outlet';
<ide><path>packages/ember-glimmer/lib/ember-metal-views/index.js
<add>export class Renderer {
<add> constructor(domHelper, { destinedForDOM, env } = {}) {
<add> this._dom = domHelper;
<add> this._env = env;
<add> }
<add>
<add> appendTo(view, target) {
<add> let env = this._env;
<add>
<add> env.begin();
<add> view.template.render({ view }, env, { appendTo: target });
<add> env.commit();
<add> }
<add>
<add> componentInitAttrs() {
<add> // TODO: Remove me
<add> }
<add>}
<ide><path>packages/ember-glimmer/lib/ember-template-compiler/system/compile.js
<add>import template from './template';
<add>import require, { has } from 'require';
<add>
<add>let compileSpec;
<add>let Template;
<add>
<add>export default function compile(string, options) {
<add> if (!compileSpec && has('glimmer-compiler')) {
<add> compileSpec = require('glimmer-compiler').compileSpec;
<add> }
<add>
<add> if (!Template && has('glimmer-runtime')) {
<add> Template = require('glimmer-runtime').Template;
<add> }
<add>
<add> if (!compileSpec || !Template) {
<add> throw new Error('Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`.');
<add> }
<add>
<add> let templateSpec = template(compileSpec(string, options));
<add> return Template.fromSpec(templateSpec, options.env);
<add>}
<ide><path>packages/ember-glimmer/lib/ember-template-compiler/system/template.js
<add>export default function template(templateSpec) {
<add> return JSON.parse(templateSpec);
<add>}
<ide><path>packages/ember-glimmer/tests/dummy_test.js
<del>QUnit.module('ember-glimmer: main');
<del>
<del>QUnit.test('dummy test', function() {
<del> // The test runner will exit with error if we don't have any tests in the
<del> // package, so this is to convince the runner that everything is okay.
<del> // Remove me once we started testing real things.
<del> ok(true, 'it works');
<del>});
<ide><path>packages/ember-glimmer/tests/integration/content-test.js
<add>import { RenderingTest, moduleFor } from '../utils/test-case';
<add>
<add>moduleFor('Content tests', class extends RenderingTest {
<add>
<add> ['TEST: it can render static content']() {
<add> this.render('hello');
<add> this.assertText('hello');
<add> }
<add>
<add>});
<ide><path>packages/ember-glimmer/tests/utils/environment.js
<add>export { TestEnvironment as default } from 'glimmer-test-helpers';
<ide><path>packages/ember-glimmer/tests/utils/helpers.js
<add>export { DOMHelper } from 'glimmer-runtime';
<add>export { Renderer } from 'ember-glimmer/ember-metal-views';
<add>export { default as compile } from 'ember-glimmer/ember-template-compiler/system/compile';
<ide><path>packages/ember-glimmer/tests/utils/package-name.js
<add>export default 'glimmer';
<ide><path>packages/ember-glimmer/tests/utils/test-case.js
<add>import packageName from './package-name';
<add>import Environment from './environment';
<add>import { compile, DOMHelper, Renderer } from './helpers';
<add>import { runAppend, runDestroy } from 'ember-runtime/tests/utils';
<add>import Component from 'ember-views/components/component';
<add>import jQuery from 'ember-views/system/jquery';
<add>
<add>const packageTag = `${packageName.toUpperCase()}: `;
<add>
<add>export function moduleFor(description, TestClass) {
<add> let context;
<add>
<add> QUnit.module(description, {
<add> setup() {
<add> context = new TestClass();
<add> },
<add>
<add> teardown() {
<add> context.teardown();
<add> }
<add> });
<add>
<add> Object.keys(TestClass.prototype).forEach(name => {
<add> if (name.indexOf('TEST: ') === 0) {
<add> QUnit.test(name.slice(5), assert => context[name](assert));
<add> } else if (name.indexOf('SKIP: ') === 0) {
<add> QUnit.skip(name.slice(5), assert => context[name](assert));
<add> } else if (name.indexOf(packageTag) === 0) {
<add> QUnit.test(name.slice(packageTag.length), assert => context[name](assert));
<add> }
<add> });
<add>}
<add>
<add>let assert = QUnit.assert;
<add>
<add>export class TestCase {
<add> teardown() {}
<add>}
<add>
<add>export class RenderingTest extends TestCase {
<add> constructor() {
<add> super();
<add> let dom = new DOMHelper(document);
<add> let env = this.env = new Environment(dom);
<add> this.renderer = new Renderer(dom, { destinedForDOM: true, env });
<add> this.component = null;
<add> }
<add>
<add> teardown() {
<add> if (this.component) {
<add> runDestroy(this.component);
<add> }
<add> }
<add>
<add> render(templateStr, context = {}) {
<add> let { env, renderer } = this;
<add>
<add> let attrs = Object.assign({}, context, {
<add> renderer,
<add> template: compile(templateStr, { env })
<add> });
<add>
<add> this.component = Component.create(attrs);
<add>
<add> runAppend(this.component);
<add> }
<add>
<add> rerender() {
<add> this.component.rerender();
<add> }
<add>
<add> assertText(text) {
<add> assert.strictEqual(jQuery('#qunit-fixture').text(), text, `#qunit-fixture contents`);
<add> }
<add>}
<ide><path>packages/ember-htmlbars/lib/system/render-env.js
<ide> import defaultEnv from 'ember-htmlbars/env';
<del>import { MorphSet } from 'ember-metal-views/renderer';
<add>import { MorphSet } from 'ember-metal-views';
<ide> import { getOwner } from 'container/owner';
<ide>
<ide> export default function RenderEnv(options) {
<ide><path>packages/ember-htmlbars/tests/attr_nodes/data_test.js
<ide> import EmberView from 'ember-views/views/view';
<ide> import run from 'ember-metal/run_loop';
<ide> import EmberObject from 'ember-runtime/system/object';
<ide> import compile from 'ember-template-compiler/system/compile';
<del>import Renderer from 'ember-metal-views/renderer';
<add>import { Renderer } from 'ember-metal-views';
<ide> import { equalInnerHTML } from 'htmlbars-test-helpers';
<ide> import { domHelper as dom } from 'ember-htmlbars/env';
<ide> import { runAppend, runDestroy } from 'ember-runtime/tests/utils';
<add><path>packages/ember-metal-views/lib/htmlbars-renderer.js
<del><path>packages/ember-metal-views/lib/renderer.js
<ide> import setProperties from 'ember-metal/set_properties';
<ide> import buildComponentTemplate from 'ember-views/system/build-component-template';
<ide> import environment from 'ember-metal/environment';
<ide>
<del>function Renderer(domHelper, destinedForDOM) {
<add>export function Renderer(domHelper, { destinedForDOM } = {}) {
<ide> this._dom = domHelper;
<ide>
<ide> // This flag indicates whether the resulting rendered element will be
<ide> Renderer.prototype.didDestroyElement = function (view) {
<ide> view.trigger('didDestroyElement');
<ide> }
<ide> }; // element destroyed so view.destroy shouldn't try to remove it removedFromDOM
<del>
<del>export default Renderer;
<ide><path>packages/ember-metal-views/lib/index.js
<del>import Renderer from 'ember-metal-views/renderer';
<del>export { Renderer };
<add>export * from './htmlbars-renderer';
<ide><path>packages/ember-views/lib/index.js
<ide> import {
<ide> states
<ide> } from 'ember-views/views/states';
<ide>
<del>import Renderer from 'ember-metal-views/renderer';
<add>import { Renderer } from 'ember-metal-views';
<ide> import { DeprecatedCoreView } from 'ember-views/views/core_view';
<ide> import { DeprecatedView } from 'ember-views/views/view';
<ide> import { DeprecatedContainerView } from 'ember-views/views/container_view';
<ide><path>packages/ember-views/lib/views/core_view.js
<ide> import Evented from 'ember-runtime/mixins/evented';
<ide> import ActionHandler, { deprecateUnderscoreActions } from 'ember-runtime/mixins/action_handler';
<ide> import { typeOf } from 'ember-runtime/utils';
<ide>
<del>import Renderer from 'ember-metal-views/renderer';
<add>import { Renderer } from 'ember-metal-views';
<ide> import { cloneStates, states } from 'ember-views/views/states';
<ide> import { internal } from 'htmlbars-runtime';
<ide> import require from 'require';
| 17
|
Python
|
Python
|
add the key to the gpu plugin
|
781dfeef0cdeb4b059fa5ba826f7efa318c9082e
|
<ide><path>glances/plugins/glances_gpu.py
<ide> def get_device_stats(self):
<ide>
<ide> for index, device_handle in enumerate(self.device_handles):
<ide> device_stats = {}
<add> # Dictionnary key is the GPU_ID
<add> device_stats['key'] = self.get_key()
<add> # GPU id (for multiple GPU, start at 0)
<ide> device_stats['gpu_id'] = index
<add> # GPU name
<ide> device_stats['name'] = self.get_device_name(device_handle)
<add> # Memory consumption in % (not available on all GPU)
<ide> device_stats['memory_percent'] = self.get_memory_percent(device_handle)
<add> # Processor consumption in %
<ide> device_stats['processor_percent'] = self.get_processor_percent(device_handle)
<del>
<ide> stats.append(device_stats)
<ide>
<ide> return stats
| 1
|
Python
|
Python
|
correct error in smart unitest
|
c4ec6ecb8f64231a9b6897d6010f39d329d81bb0
|
<ide><path>unitest.py
<ide> def test_016_hddsmart(self):
<ide> if not is_admin():
<ide> print("INFO: Not admin, SMART list should be empty")
<ide> assert len(stats_grab) == 0
<add> elif stats_grab == {}:
<add> print("INFO: Admin but SMART list is empty")
<add> assert len(stats_grab) == 0
<ide> else:
<add> print(stats_grab)
<ide> self.assertTrue(stat in stats_grab[0].keys(), msg='Cannot find key: %s' % stat)
<ide>
<ide> print('INFO: SMART stats: %s' % stats_grab)
| 1
|
Ruby
|
Ruby
|
form encode workflow branch
|
a6d3e3c47c1e5e346b92721868f45f55379a9295
|
<ide><path>Library/Homebrew/utils/github.rb
<ide> def fetch_artifact(user, repo, pr, dir,
<ide> base_url = "#{API_URL}/repos/#{user}/#{repo}"
<ide> pr_payload = open_api("#{base_url}/pulls/#{pr}", scopes: scopes)
<ide> pr_sha = pr_payload["head"]["sha"]
<del> pr_branch = pr_payload["head"]["ref"]
<add> pr_branch = URI.encode_www_form_component(pr_payload["head"]["ref"])
<ide>
<ide> workflow = open_api("#{base_url}/actions/workflows/#{workflow_id}/runs?branch=#{pr_branch}", scopes: scopes)
<ide> workflow_run = workflow["workflow_runs"].select do |run|
| 1
|
Go
|
Go
|
pass plugingetter as part of swarm node config
|
fa784951ba0a29d436c60b7465167b5ef188d084
|
<ide><path>daemon/cluster/executor/backend.go
<ide> type Backend interface {
<ide> GetRepository(context.Context, reference.NamedTagged, *types.AuthConfig) (distribution.Repository, bool, error)
<ide> LookupImage(name string) (*types.ImageInspect, error)
<ide> PluginManager() *plugin.Manager
<add> PluginGetter() *plugin.Store
<ide> }
<ide><path>daemon/cluster/noderunner.go
<ide> func (n *nodeRunner) start(conf nodeStartConfig) error {
<ide> ElectionTick: 3,
<ide> UnlockKey: conf.lockKey,
<ide> AutoLockManagers: conf.autolock,
<add> PluginGetter: n.cluster.config.Backend.PluginGetter(),
<ide> }
<ide> if conf.availability != "" {
<ide> avail, ok := swarmapi.NodeSpec_Availability_value[strings.ToUpper(string(conf.availability))]
<ide><path>daemon/daemon.go
<ide> func (daemon *Daemon) PluginManager() *plugin.Manager { // set up before daemon
<ide> return daemon.pluginManager
<ide> }
<ide>
<add>// PluginGetter returns current pluginStore associated with the daemon
<add>func (daemon *Daemon) PluginGetter() *plugin.Store {
<add> return daemon.PluginStore
<add>}
<add>
<ide> // CreateDaemonRoot creates the root for the daemon
<ide> func CreateDaemonRoot(config *Config) error {
<ide> // get the canonical path to the Docker root directory
| 3
|
Javascript
|
Javascript
|
add test for redirecting with too large response
|
521444513969a08ec5ef943c41ba0812845ed4f9
|
<ide><path>test/unit/adapters/http.js
<ide> describe('supports http with nodejs', function () {
<ide> });
<ide> });
<ide>
<add> it('should support max content length for redirected', function (done) {
<add> var str = Array(100000).join('ж');
<add>
<add> server = http.createServer(function (req, res) {
<add> var parsed = url.parse(req.url);
<add>
<add> if (parsed.pathname === '/two') {
<add> res.setHeader('Content-Type', 'text/html; charset=UTF-8');
<add> res.end(str);
<add> } else {
<add> res.setHeader('Location', '/two');
<add> res.statusCode = 302;
<add> res.end();
<add> }
<add> }).listen(4444, function () {
<add> var success = false, failure = false, error;
<add>
<add> axios.get('http://localhost:4444/one', {
<add> maxContentLength: 2000
<add> }).then(function (res) {
<add> success = true;
<add> }).catch(function (err) {
<add> error = err;
<add> failure = true;
<add> });
<add>
<add> setTimeout(function () {
<add> assert.equal(success, false, 'request should not succeed');
<add> assert.equal(failure, true, 'request should fail');
<add> assert.equal(error.message, 'maxContentLength size of 2000 exceeded');
<add> done();
<add> }, 100);
<add> });
<add> });
<add>
<ide> it.skip('should support sockets', function (done) {
<ide> server = net.createServer(function (socket) {
<ide> socket.on('data', function () {
| 1
|
Java
|
Java
|
keep yaml entries that haven an empty array value
|
e51330e905473d2f193f667dbf4b93207a6454d3
|
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java
<ide> else if (value instanceof Collection) {
<ide> // Need a compound key
<ide> @SuppressWarnings("unchecked")
<ide> Collection<Object> collection = (Collection<Object>) value;
<del> int count = 0;
<del> for (Object object : collection) {
<del> buildFlattenedMap(result,
<del> Collections.singletonMap("[" + (count++) + "]", object), key);
<add> if (collection.isEmpty()) {
<add> result.put(key, "");
<add> } else {
<add> int count = 0;
<add> for (Object object : collection) {
<add> buildFlattenedMap(result, Collections.singletonMap(
<add> "[" + (count++) + "]", object), key);
<add> }
<ide> }
<ide> }
<ide> else {
<ide><path>spring-beans/src/test/java/org/springframework/beans/factory/config/YamlMapFactoryBeanTests.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> import java.io.IOException;
<ide> import java.io.InputStream;
<ide> import java.util.LinkedHashMap;
<add>import java.util.List;
<ide> import java.util.Map;
<ide>
<ide> import org.junit.Test;
<ide> public void testMapWithIntegerValue() throws Exception {
<ide> assertEquals(Integer.valueOf(3), sub.get("key1.key2"));
<ide> }
<ide>
<add> @Test
<add> public void mapWithEmptyArrayValue() {
<add> this.factory.setResources(new ByteArrayResource("a: alpha\ntest: []".getBytes()));
<add> assertTrue(this.factory.getObject().containsKey("test"));
<add> assertEquals(((List<?>)this.factory.getObject().get("test")).size(), 0);
<add> }
<add>
<add> @Test
<add> public void mapWithEmptyValue() {
<add> this.factory.setResources(new ByteArrayResource("a: alpha\ntest:".getBytes()));
<add> assertTrue(this.factory.getObject().containsKey("test"));
<add> assertNull(this.factory.getObject().get("test"));
<add> }
<add>
<ide> @Test
<ide> public void testDuplicateKey() throws Exception {
<ide> this.factory.setResources(new ByteArrayResource("mymap:\n foo: bar\nmymap:\n bar: foo".getBytes()));
<ide><path>spring-beans/src/test/java/org/springframework/beans/factory/config/YamlPropertiesFactoryBeanTests.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> public void testLoadNull() throws Exception {
<ide> assertThat(properties.getProperty("spam"), equalTo(""));
<ide> }
<ide>
<add> @Test
<add> public void testLoadEmptyArrayValue() {
<add> YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
<add> factory.setResources(new ByteArrayResource("a: alpha\ntest: []".getBytes()));
<add> Properties properties = factory.getObject();
<add> assertThat(properties.getProperty("a"), equalTo("alpha"));
<add> assertThat(properties.getProperty("test"), equalTo(""));
<add> }
<add>
<ide> @Test
<ide> public void testLoadArrayOfString() throws Exception {
<ide> YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
| 3
|
Text
|
Text
|
improve regex for advanced-node
|
cd9be3c291f5b4220ace46ce7f59a1b6418c1498
|
<ide><path>curriculum/challenges/english/06-quality-assurance/advanced-node-and-express/set-up-passport.md
<ide> Session and session secret should be correctly set up.
<ide> (data) => {
<ide> assert.match(
<ide> data,
<del> /secret:( |)process\.env(\.SESSION_SECRET|\[(?<q>"|')SESSION_SECRET\k<q>\])/g,
<add> /secret *: *process\.env(\.SESSION_SECRET|\[(?<q>"|')SESSION_SECRET\k<q>\])/g,
<ide> 'Your express app should have express-session set up with your secret as process.env.SESSION_SECRET'
<ide> );
<ide> },
| 1
|
Javascript
|
Javascript
|
fix incorrect test
|
d92310050ca7bf0b33825d64e052f9a8809c3e9e
|
<ide><path>test/data/jquery-1.9.1.js
<ide> jQuery.each( {
<ide> related = event.relatedTarget,
<ide> handleObj = event.handleObj;
<ide>
<del> // For mouseenter/leave call the handler if related is outside the target.
<add> // For mousenter/leave call the handler if related is outside the target.
<ide> // NB: No relatedTarget if the mouse left/entered the browser window
<ide> if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
<ide> event.type = handleObj.origType;
<ide><path>test/unit/event.js
<ide> QUnit.test( "withinElement implemented with jQuery.contains()", function( assert
<ide> jQuery( "#qunit-fixture" ).append( "<div id='jc-outer'><div id='jc-inner'></div></div>" );
<ide>
<ide> jQuery( "#jc-outer" ).on( "mouseenter mouseleave", function( event ) {
<del>
<ide> assert.equal( this.id, "jc-outer", this.id + " " + event.type );
<del>
<del> } ).trigger( "mouseenter" );
<add> } );
<ide>
<ide> jQuery( "#jc-inner" ).trigger( "mouseenter" );
<del>
<del> jQuery( "#jc-outer" ).off( "mouseenter mouseleave" ).remove();
<del> jQuery( "#jc-inner" ).remove();
<del>
<ide> } );
<ide>
<ide> QUnit.test( "mouseenter, mouseleave don't catch exceptions", function( assert ) {
| 2
|
Ruby
|
Ruby
|
call an inspector for inspector
|
5fd2fffcf6fc20e47e16924fd703f281b70e35a9
|
<ide><path>railties/lib/commands/process/inspector.rb
<ide> require 'optparse'
<ide>
<del>if RUBY_PLATFORM =~ /mswin32/ then abort("Reaper is only for Unix") end
<add>if RUBY_PLATFORM =~ /mswin32/ then abort("Inspector is only for Unix") end
<ide>
<ide> OPTIONS = {
<ide> :pid_path => File.expand_path(RAILS_ROOT + '/tmp/pids'),
| 1
|
Ruby
|
Ruby
|
remove unused require `benchmark`
|
77b2e46df41574f9fb5f39eca6527c1dfe1cddf9
|
<ide><path>activesupport/lib/active_support/cache.rb
<del>require "benchmark"
<ide> require "zlib"
<ide> require "active_support/core_ext/array/extract_options"
<ide> require "active_support/core_ext/array/wrap"
<del>require "active_support/core_ext/benchmark"
<ide> require "active_support/core_ext/module/attribute_accessors"
<ide> require "active_support/core_ext/numeric/bytes"
<ide> require "active_support/core_ext/numeric/time"
| 1
|
Javascript
|
Javascript
|
fix 4 lint errors
|
e1146b64adf3d9408e8679d06136aab6db6978f8
|
<ide><path>src/core.js
<ide> function getPdf(arg, callback) {
<ide> params = { url: arg };
<ide>
<ide> var xhr = new XMLHttpRequest();
<del>
<add>
<ide> xhr.open('GET', params.url);
<del>
<add>
<ide> var headers = params.headers;
<ide> if (headers) {
<ide> for (var property in headers) {
<ide> if (typeof headers[property] === 'undefined')
<ide> continue;
<del>
<add>
<ide> xhr.setRequestHeader(property, params.headers[property]);
<ide> }
<ide> }
<del>
<add>
<ide> xhr.mozResponseType = xhr.responseType = 'arraybuffer';
<ide> var protocol = params.url.indexOf(':') < 0 ? window.location.protocol :
<ide> params.url.substring(0, params.url.indexOf(':') + 1);
| 1
|
Javascript
|
Javascript
|
inline transpile call
|
e6ae7d836dd6a778b2001d67b9459b087f790c39
|
<ide><path>build/build.js
<ide> const transpileBabelPaths = require('./lib/transpile-babel-paths')
<ide> const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths')
<ide>
<del>function transpile () {
<del> transpileBabelPaths()
<del> transpileCoffeeScriptPaths()
<del>}
<del>
<del>transpile()
<add>transpileBabelPaths()
<add>transpileCoffeeScriptPaths()
| 1
|
Javascript
|
Javascript
|
use fixture files
|
e1c25c959c10f716e9ccbaeef4a8e1eaaa509f4e
|
<ide><path>node-tests/blueprints/helper-test-test.js
<ide> describe('Blueprint: helper-test', function() {
<ide> it('helper-test foo/bar-baz --integration', function() {
<ide> return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
<ide> expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
<del> .to.contain("import { describeComponent, it } from 'ember-mocha';")
<del> .to.contain("import hbs from 'htmlbars-inline-precompile';");
<add> .to.equal(fixture('helper-test/mocha.js'));
<ide> });
<ide> });
<ide> });
<ide> describe('Blueprint: helper-test', function() {
<ide> it('helper-test foo/bar-baz --integration', function() {
<ide> return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
<ide> expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
<del> .to.contain("import { describe, it } from 'mocha';")
<del> .to.contain("import { setupComponentTest } from 'ember-mocha';")
<del> .to.contain("import hbs from 'htmlbars-inline-precompile';")
<del> .to.contain("describe('Integration | Helper | foo/bar baz', function() {");
<add> .to.equal(fixture('helper-test/mocha-0.12.js'));
<ide> });
<ide> });
<ide>
<ide> it('helper-test foo/bar-baz for mocha', function() {
<ide> return emberGenerateDestroy(['helper-test', 'foo/bar-baz'], _file => {
<ide> expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
<del> .to.contain("import { describe, it } from 'mocha';")
<del> .to.contain("setupComponentTest('foo/bar-baz', {")
<del> .to.contain("describe('Integration | Helper | foo/bar baz', function() {");
<add> .to.equal(fixture('helper-test/mocha-0.12.js'));
<ide> });
<ide> });
<ide> });
<ide><path>node-tests/fixtures/helper-test/mocha-0.12.js
<add>import { expect } from 'chai';
<add>import { describe, it } from 'mocha';
<add>import { setupComponentTest } from 'ember-mocha';
<add>import hbs from 'htmlbars-inline-precompile';
<add>
<add>describe('Integration | Helper | foo/bar baz', function() {
<add> setupComponentTest('foo/bar-baz', {
<add> integration: true
<add> });
<add>
<add> it('renders', function() {
<add> // Set any properties with this.set('myProperty', 'value');
<add> // Handle any actions with this.on('myAction', function(val) { ... });
<add> // Template block usage:
<add> // this.render(hbs`
<add> // {{#foo/bar-baz}}
<add> // template content
<add> // {{/foo/bar-baz}}
<add> // `);
<add> this.set('inputValue', '1234');
<add>
<add> this.render(hbs`{{foo/bar-baz inputValue}}`);
<add>
<add> expect(this.$().text().trim()).to.equal('1234');
<add> });
<add>});
<add>
<ide><path>node-tests/fixtures/helper-test/mocha.js
<add>import { expect } from 'chai';
<add>
<add>import { describeComponent, it } from 'ember-mocha';
<add>import hbs from 'htmlbars-inline-precompile';
<add>
<add>describeComponent('foo/bar-baz', 'helper:foo/bar-baz',
<add> {
<add> integration: true
<add> },
<add> function() {
<add> it('renders', function() {
<add> // Set any properties with this.set('myProperty', 'value');
<add> // Handle any actions with this.on('myAction', function(val) { ... });
<add> // Template block usage:
<add> // this.render(hbs`
<add> // {{#foo/bar-baz}}
<add> // template content
<add> // {{/foo/bar-baz}}
<add> // `);
<add> this.set('inputValue', '1234');
<add>
<add> this.render(hbs`{{foo/bar-baz inputValue}}`);
<add>
<add> expect(this.$().text().trim()).to.equal('1234');
<add> });
<add> }
<add>);
<add>
| 3
|
Text
|
Text
|
add v3.11.0-beta.2 to changelog
|
16f9cd2905865c112e05859b6c56e68ac9cf1497
|
<ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.11.0-beta.2 (June 3, 2019)
<add>
<add>- [#18064](https://github.com/emberjs/ember.js/pull/18064) [BUGFIX] Fix 'hasAttribute is not a function' when jQuery is disabled
<add>
<ide> ### v3.11.0-beta.1 (May 13, 2019)
<ide>
<ide> - [#17842](https://github.com/emberjs/ember.js/pull/17842) / [#17901](https://github.com/emberjs/ember.js/pull/17901) [FEATURE] Implement the [Forwarding Element Modifiers with "Splattributes" RFC](https://github.com/emberjs/rfcs/blob/master/text/0435-modifier-splattributes.md).
| 1
|
Java
|
Java
|
fix cyclical package dependency
|
70b0b97b54d545118696b6fe279b57044f739e92
|
<add><path>spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java
<del><path>spring-web/src/main/java/org/springframework/web/bind/support/ControllerAdviceBean.java
<ide> * See the License for the specific language governing permissions and
<ide> * limitations under the License.
<ide> */
<del>package org.springframework.web.bind.support;
<add>package org.springframework.web.method;
<ide>
<ide> import java.util.ArrayList;
<ide> import java.util.List;
<ide>
<ide> /**
<ide> * Encapsulates information about an {@linkplain ControllerAdvice @ControllerAdvice}
<del> * bean without requiring the bean to be instantiated.
<add> * Spring-managed bean without necessarily requiring it to be instantiated.
<add> *
<add> * <p>The {@link #findAnnotatedBeans(ApplicationContext)} method can be used to discover
<add> * such beans. However, an {@code ControllerAdviceBean} may be created from
<add> * any object, including ones without an {@code @ControllerAdvice}.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @since 3.2
<ide> public ControllerAdviceBean(String beanName, BeanFactory beanFactory) {
<ide> "Bean factory [" + beanFactory + "] does not contain bean " + "with name [" + beanName + "]");
<ide> this.bean = beanName;
<ide> this.beanFactory = beanFactory;
<del> this.order = initOrder(this.beanFactory.getType(beanName));
<add> this.order = initOrderFromBeanType(this.beanFactory.getType(beanName));
<add> }
<add>
<add> private static int initOrderFromBeanType(Class<?> beanType) {
<add> Order annot = AnnotationUtils.findAnnotation(beanType, Order.class);
<add> return (annot != null) ? annot.value() : Ordered.LOWEST_PRECEDENCE;
<ide> }
<ide>
<ide> /**
<ide> public ControllerAdviceBean(String beanName, BeanFactory beanFactory) {
<ide> public ControllerAdviceBean(Object bean) {
<ide> Assert.notNull(bean, "'bean' must not be null");
<ide> this.bean = bean;
<del> this.order = initOrder(bean.getClass());
<add> this.order = initOrderFromBean(bean);
<ide> this.beanFactory = null;
<ide> }
<ide>
<del> private static int initOrder(Class<?> beanType) {
<del> Order orderAnnot = AnnotationUtils.findAnnotation(beanType, Order.class);
<del> return (orderAnnot != null) ? orderAnnot.value() : Ordered.LOWEST_PRECEDENCE;
<add> private static int initOrderFromBean(Object bean) {
<add> return (bean instanceof Ordered) ? ((Ordered) bean).getOrder() : initOrderFromBeanType(bean.getClass());
<ide> }
<ide>
<ide> /**
<ide> * Find the names of beans annotated with
<ide> * {@linkplain ControllerAdvice @ControllerAdvice} in the given
<ide> * ApplicationContext and wrap them as {@code ControllerAdviceBean} instances.
<ide> */
<del> public static List<ControllerAdviceBean> findBeans(ApplicationContext applicationContext) {
<add> public static List<ControllerAdviceBean> findAnnotatedBeans(ApplicationContext applicationContext) {
<ide> List<ControllerAdviceBean> beans = new ArrayList<ControllerAdviceBean>();
<ide> for (String name : applicationContext.getBeanDefinitionNames()) {
<ide> if (applicationContext.findAnnotationOnBean(name, ControllerAdvice.class) != null) {
<ide> public static List<ControllerAdviceBean> findBeans(ApplicationContext applicatio
<ide> }
<ide>
<ide> /**
<del> * Return a bean instance if necessary resolving the bean name through the BeanFactory.
<add> * Returns the order value extracted from the {@link ControllerAdvice}
<add> * annotation or {@link Ordered#LOWEST_PRECEDENCE} otherwise.
<ide> */
<del> public Object resolveBean() {
<del> return (this.bean instanceof String) ? this.beanFactory.getBean((String) this.bean) : this.bean;
<del> }
<del>
<ide> public int getOrder() {
<ide> return this.order;
<ide> }
<ide> public Class<?> getBeanType() {
<ide> return ClassUtils.getUserClass(clazz);
<ide> }
<ide>
<add> /**
<add> * Return a bean instance if necessary resolving the bean name through the BeanFactory.
<add> */
<add> public Object resolveBean() {
<add> return (this.bean instanceof String) ? this.beanFactory.getBean((String) this.bean) : this.bean;
<add> }
<add>
<ide> @Override
<ide> public boolean equals(Object o) {
<ide> if (this == o) {
<ide><path>spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java
<ide> import org.springframework.util.ClassUtils;
<ide>
<ide> /**
<del> * Encapsulates information about a bean method consisting of a {@linkplain #getMethod() method} and a
<del> * {@linkplain #getBean() bean}. Provides convenient access to method parameters, the method return value,
<del> * method annotations.
<add> * Encapsulates information about a bean method consisting of a
<add> * {@linkplain #getMethod() method} and a {@linkplain #getBean() bean}. Provides
<add> * convenient access to method parameters, the method return value, method
<add> * annotations.
<ide> *
<del> * <p>The class may be created with a bean instance or with a bean name (e.g. lazy bean, prototype bean).
<del> * Use {@link #createWithResolvedBean()} to obtain an {@link HandlerMethod} instance with a bean instance
<del> * initialized through the bean factory.
<add> * <p>The class may be created with a bean instance or with a bean name (e.g. lazy
<add> * bean, prototype bean). Use {@link #createWithResolvedBean()} to obtain an
<add> * {@link HandlerMethod} instance with a bean instance initialized through the
<add> * bean factory.
<ide> *
<ide> * @author Arjen Poutsma
<ide> * @author Rossen Stoyanchev
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java
<ide> import org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter;
<ide> import org.springframework.web.accept.ContentNegotiationManager;
<ide> import org.springframework.web.bind.annotation.ControllerAdvice;
<del>import org.springframework.web.bind.support.ControllerAdviceBean;
<ide> import org.springframework.web.context.request.ServletWebRequest;
<add>import org.springframework.web.method.ControllerAdviceBean;
<ide> import org.springframework.web.method.HandlerMethod;
<ide> import org.springframework.web.method.annotation.ExceptionHandlerMethodResolver;
<ide> import org.springframework.web.method.annotation.MapMethodProcessor;
<ide> private void initExceptionHandlerAdviceCache() {
<ide> logger.debug("Looking for exception mappings: " + getApplicationContext());
<ide> }
<ide>
<del> List<ControllerAdviceBean> beans = ControllerAdviceBean.findBeans(getApplicationContext());
<add> List<ControllerAdviceBean> beans = ControllerAdviceBean.findAnnotatedBeans(getApplicationContext());
<ide> Collections.sort(beans, new OrderComparator());
<ide>
<ide> for (ControllerAdviceBean bean : beans) {
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java
<ide> import org.springframework.web.bind.annotation.InitBinder;
<ide> import org.springframework.web.bind.annotation.ModelAttribute;
<ide> import org.springframework.web.bind.annotation.RequestMapping;
<del>import org.springframework.web.bind.support.ControllerAdviceBean;
<ide> import org.springframework.web.bind.support.DefaultDataBinderFactory;
<ide> import org.springframework.web.bind.support.DefaultSessionAttributeStore;
<ide> import org.springframework.web.bind.support.SessionAttributeStore;
<ide> import org.springframework.web.context.request.async.AsyncWebRequest;
<ide> import org.springframework.web.context.request.async.AsyncWebUtils;
<ide> import org.springframework.web.context.request.async.WebAsyncManager;
<add>import org.springframework.web.method.ControllerAdviceBean;
<ide> import org.springframework.web.method.HandlerMethod;
<ide> import org.springframework.web.method.HandlerMethodSelector;
<ide> import org.springframework.web.method.annotation.ErrorsMethodArgumentResolver;
<ide> private void initControllerAdviceCache() {
<ide> logger.debug("Looking for controller advice: " + getApplicationContext());
<ide> }
<ide>
<del> List<ControllerAdviceBean> beans = ControllerAdviceBean.findBeans(getApplicationContext());
<add> List<ControllerAdviceBean> beans = ControllerAdviceBean.findAnnotatedBeans(getApplicationContext());
<ide> Collections.sort(beans, new OrderComparator());
<ide>
<ide> for (ControllerAdviceBean bean : beans) {
| 4
|
Text
|
Text
|
improve release guide
|
7688a8bd1fb930cc8ebebeea92de0124fca4223b
|
<ide><path>doc/releases.md
<ide> were first added in this version. The relevant commits should already include
<ide> `sed -i "s/REPLACEME/$VERSION/g" doc/api/*.md` or
<ide> `perl -pi -e "s/REPLACEME/$VERSION/g" doc/api/*.md`.
<ide>
<add>*Note*: `$VERSION` should be prefixed with a `v`
<add>
<ide> If this release includes any new deprecations it is necessary to ensure that
<ide> those are assigned a proper static deprecation code. These are listed in the
<ide> docs (see `doc/api/deprecations.md`) and in the source as `DEP00XX`. The code
| 1
|
Mixed
|
Ruby
|
include default column limits in schema.rb
|
2c76793f087e212ff4c6d835656a9a95c8bfeaa5
|
<ide><path>activerecord/CHANGELOG.md
<add>* Include default column limits in schema.rb. Allows defaults to be changed
<add> in the future without affecting old migrations that assumed old defaults.
<add>
<add> *Jeremy Kemper*
<add>
<ide> * MySQL: schema.rb now includes TEXT and BLOB column limits.
<ide>
<ide> *Jeremy Kemper*
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb
<ide> def prepare_column_options(column, types)
<ide> spec = {}
<ide> spec[:name] = column.name.inspect
<ide> spec[:type] = column.type.to_s
<del> spec[:limit] = column.limit.inspect if column.limit != types[column.type][:limit]
<add> spec[:null] = 'false' unless column.null
<add>
<add> limit = column.limit || types[column.type][:limit]
<add> spec[:limit] = limit.inspect if limit
<ide> spec[:precision] = column.precision.inspect if column.precision
<ide> spec[:scale] = column.scale.inspect if column.scale
<del> spec[:null] = 'false' unless column.null
<del> spec[:default] = schema_default(column) if column.has_default?
<del> spec.delete(:default) if spec[:default].nil?
<add>
<add> default = schema_default(column) if column.has_default?
<add> spec[:default] = default unless default.nil?
<add>
<ide> spec
<ide> end
<ide>
<ide><path>activerecord/test/cases/schema_dumper_test.rb
<ide> def test_schema_dump_includes_not_null_columns
<ide> def test_schema_dump_includes_limit_constraint_for_integer_columns
<ide> output = dump_all_table_schema([/^(?!integer_limits)/])
<ide>
<add> assert_match %r{c_int_without_limit}, output
<add>
<ide> if current_adapter?(:PostgreSQLAdapter)
<add> assert_no_match %r{c_int_without_limit.*limit:}, output
<add>
<ide> assert_match %r{c_int_1.*limit: 2}, output
<ide> assert_match %r{c_int_2.*limit: 2}, output
<ide>
<ide> def test_schema_dump_includes_limit_constraint_for_integer_columns
<ide> assert_match %r{c_int_4.*}, output
<ide> assert_no_match %r{c_int_4.*limit:}, output
<ide> elsif current_adapter?(:MysqlAdapter, :Mysql2Adapter)
<add> assert_match %r{c_int_without_limit.*limit: 4}, output
<add>
<ide> assert_match %r{c_int_1.*limit: 1}, output
<ide> assert_match %r{c_int_2.*limit: 2}, output
<ide> assert_match %r{c_int_3.*limit: 3}, output
<ide>
<ide> assert_match %r{c_int_4.*}, output
<ide> assert_no_match %r{c_int_4.*:limit}, output
<ide> elsif current_adapter?(:SQLite3Adapter)
<add> assert_no_match %r{c_int_without_limit.*limit:}, output
<add>
<ide> assert_match %r{c_int_1.*limit: 1}, output
<ide> assert_match %r{c_int_2.*limit: 2}, output
<ide> assert_match %r{c_int_3.*limit: 3}, output
<ide> assert_match %r{c_int_4.*limit: 4}, output
<ide> end
<del> assert_match %r{c_int_without_limit.*}, output
<del> assert_no_match %r{c_int_without_limit.*limit:}, output
<ide>
<ide> if current_adapter?(:SQLite3Adapter)
<ide> assert_match %r{c_int_5.*limit: 5}, output
<ide> def test_schema_dump_keeps_id_column_when_id_is_false_and_id_column_added
<ide> match = output.match(%r{create_table "goofy_string_id"(.*)do.*\n(.*)\n})
<ide> assert_not_nil(match, "goofy_string_id table not found")
<ide> assert_match %r(id: false), match[1], "no table id not preserved"
<del> assert_match %r{t.string[[:space:]]+"id",[[:space:]]+null: false$}, match[2], "non-primary key id column not preserved"
<add> assert_match %r{t.string\s+"id",.*?null: false$}, match[2], "non-primary key id column not preserved"
<ide> end
<ide>
<ide> def test_schema_dump_keeps_id_false_when_id_is_false_and_unique_not_null_column_added
<ide> class SchemaDumperDefaultsTest < ActiveRecord::TestCase
<ide> def test_schema_dump_defaults_with_universally_supported_types
<ide> output = dump_table_schema('defaults')
<ide>
<del> assert_match %r{t\.string\s+"string_with_default",\s+default: "Hello!"}, output
<add> assert_match %r{t\.string\s+"string_with_default",.*?default: "Hello!"}, output
<ide> assert_match %r{t\.date\s+"date_with_default",\s+default: '2014-06-05'}, output
<ide> assert_match %r{t\.datetime\s+"datetime_with_default",\s+default: '2014-06-05 07:17:04'}, output
<ide> assert_match %r{t\.time\s+"time_with_default",\s+default: '2000-01-01 07:17:04'}, output
| 3
|
Ruby
|
Ruby
|
make symbol reference in docs appear as code
|
66844ece691d3821de8e6993e31e147df02b4b3b
|
<ide><path>railties/lib/rails/engine.rb
<ide> module Rails
<ide> # There are some places where an Engine's name is used:
<ide> #
<ide> # * routes: when you mount an Engine with <tt>mount(MyEngine::Engine => '/my_engine')</tt>,
<del> # it's used as default :as option
<add> # it's used as default <tt>:as</tt> option
<ide> # * rake task for installing migrations <tt>my_engine:install:migrations</tt>
<ide> #
<ide> # Engine name is set by default based on class name. For <tt>MyEngine::Engine</tt> it will be
| 1
|
PHP
|
PHP
|
parse url key in redis configuration
|
c88de24605e68de0a411193c99d364d85af0417e
|
<ide><path>src/Illuminate/Redis/RedisManager.php
<ide> use InvalidArgumentException;
<ide> use Illuminate\Contracts\Redis\Factory;
<ide> use Illuminate\Redis\Connections\Connection;
<add>use Illuminate\Support\ConfigurationUrlParser;
<ide>
<ide> /**
<ide> * @mixin \Illuminate\Redis\Connections\Connection
<ide> public function resolve($name = null)
<ide> $options = $this->config['options'] ?? [];
<ide>
<ide> if (isset($this->config[$name])) {
<del> return $this->connector()->connect($this->config[$name], $options);
<add> return $this->connector()->connect(
<add> $this->parseConnectionConfigWithUrl($this->config[$name]), $options
<add> );
<ide> }
<ide>
<ide> if (isset($this->config['clusters'][$name])) {
<ide> public function resolve($name = null)
<ide> */
<ide> protected function resolveCluster($name)
<ide> {
<del> $clusterOptions = $this->config['clusters']['options'] ?? [];
<del>
<ide> return $this->connector()->connectToCluster(
<del> $this->config['clusters'][$name], $clusterOptions, $this->config['options'] ?? []
<add> $this->parseConnectionConfigWithUrl($this->config['clusters'][$name]),
<add> $this->config['clusters']['options'] ?? [],
<add> $this->config['options'] ?? []
<ide> );
<ide> }
<ide>
<ide> protected function connector()
<ide> }
<ide> }
<ide>
<add> /**
<add> * Parse the redis configuration, hydrating options using a redis configuration URL if possible.
<add> *
<add> * @param array $config
<add> * @return array
<add> */
<add> protected function parseConnectionConfigWithUrl($config)
<add> {
<add> $parsedConfig = (new ConfigurationUrlParser)->parseConfiguration($config);
<add>
<add> return array_filter($parsedConfig, function ($key) {
<add> return !in_array($key, ['driver', 'username']);
<add> }, ARRAY_FILTER_USE_KEY);
<add> }
<add>
<ide> /**
<ide> * Return all of the created connections.
<ide> *
| 1
|
Text
|
Text
|
add syntax highlighting to the bibtex in readme
|
976e9afeced6e0e20124a365ae2d100b5b8ef902
|
<ide><path>README.md
<ide> for batch in train_data:
<ide> ## Citation
<ide>
<ide> We now have a paper you can cite for the 🤗 Transformers library:
<del>```
<add>```bibtex
<ide> @article{Wolf2019HuggingFacesTS,
<ide> title={HuggingFace's Transformers: State-of-the-art Natural Language Processing},
<ide> author={Thomas Wolf and Lysandre Debut and Victor Sanh and Julien Chaumond and Clement Delangue and Anthony Moi and Pierric Cistac and Tim Rault and R'emi Louf and Morgan Funtowicz and Jamie Brew},
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.