content_type stringclasses 8
values | main_lang stringclasses 7
values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Javascript | Javascript | fix import for glimmer-runtime -> @glimmer/runtime | 061b3ee7e134b740eb1d0f8b02a6f9d14274ca06 | <ide><path>packages/ember-glimmer/tests/unit/utils/iterable-test.js
<ide> import { moduleFor, TestCase } from 'ember-glimmer/tests/utils/test-case';
<ide> import iterableFor from 'ember-glimmer/utils/iterable';
<ide> import { UpdatableReference } from 'ember-glimmer/utils/references';
<ide> import eachIn from 'ember-glimmer/helpers/each-in';
<del>import { EvaluatedPositionalArgs } from 'glimmer-runtime';
<add>import { EvaluatedPositionalArgs } from '@glimmer/runtime';
<ide>
<ide> const ITERATOR_KEY_GUID = 'be277757-bbbe-4620-9fcb-213ef433cca2';
<ide> | 1 |
PHP | PHP | reduce usage of error_reporting() | 4091a9b0420c1bb2c40780c792448c205ffe3a36 | <ide><path>tests/TestCase/Database/Schema/TableTest.php
<ide> public function testPrimaryKey()
<ide> }
<ide>
<ide> /**
<del> * Test the options method.
<add> * Test the setOptions/getOptions methods.
<ide> *
<ide> * @return void
<ide> */
<ide> public function testOptions()
<ide> */
<ide> public function testOptionsDeprecated()
<ide> {
<del> $errorLevel = error_reporting(E_ALL & ~E_USER_DEPRECATED);
<ide> $table = new Table('articles');
<ide> $options = [
<ide> 'engine' => 'InnoDB'
<ide> ];
<del> $return = $table->options($options);
<del> $this->assertInstanceOf('Cake\Database\Schema\Table', $return);
<del> $this->assertEquals($options, $table->options());
<del> error_reporting($errorLevel);
<add> $this->deprecated(function () use ($table, $options) {
<add> $return = $table->options($options);
<add> $this->assertInstanceOf('Cake\Database\Schema\Table', $return);
<add> $this->assertEquals($options, $table->options());
<add> });
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | simplify getvisiblepages() in presentation mode | 433397f87787777a2964ddd63f65863378229397 | <ide><path>web/viewer.js
<ide> var PDFView = {
<ide> },
<ide>
<ide> getVisiblePages: function pdfViewGetVisiblePages() {
<del> if (!this.isPresentationMode) {
<del> return this.getVisibleElements(this.container, this.pages, true);
<del> } else {
<del> // The algorithm in getVisibleElements is broken in presentation mode.
<del> var visible = [], page = this.page;
<del> var currentPage = this.pages[page - 1];
<del> visible.push({ id: currentPage.id, view: currentPage });
<del>
<del> return { first: currentPage, last: currentPage, views: visible};
<del> }
<add> return this.getVisibleElements(this.container, this.pages,
<add> !this.isPresentationMode);
<ide> },
<ide>
<ide> getVisibleThumbs: function pdfViewGetVisibleThumbs() {
<ide> var PageView = function pageView(container, id, scale,
<ide> };
<ide>
<ide> this.scrollIntoView = function pageViewScrollIntoView(dest) {
<add> if (PDFView.isPresentationMode) { // Avoid breaking presentation mode.
<add> dest = null;
<add> }
<ide> if (!dest) {
<ide> scrollIntoView(div);
<ide> return;
<ide> }
<del> if (PDFView.isPresentationMode) { // Avoid breaking presentation mode.
<del> PDFView.page = id;
<del> return;
<del> }
<ide>
<ide> var x = 0, y = 0;
<ide> var width = 0, height = 0, widthScale, heightScale;
<ide> function updateViewarea() {
<ide> currentId = visiblePages[0].id;
<ide> }
<ide>
<del> if (!PDFView.isPresentationMode) {
<del> updateViewarea.inProgress = true; // used in "set page"
<del> PDFView.page = currentId;
<del> updateViewarea.inProgress = false;
<del> }
<add> updateViewarea.inProgress = true; // used in "set page"
<add> PDFView.page = currentId;
<add> updateViewarea.inProgress = false;
<ide>
<ide> var currentScale = PDFView.currentScale;
<ide> var currentScaleValue = PDFView.currentScaleValue; | 1 |
Text | Text | add explanation on how to run the samples locally | b78b7c3534eb55e1294679a32dd93cfc74b45f48 | <ide><path>docs/getting-started/index.md
<ide> Finally, render the chart using our configuration:
<ide> It's that easy to get started using Chart.js! From here you can explore the many options that can help you customise your charts with scales, tooltips, labels, colors, custom actions, and much more.
<ide>
<ide> All our examples are [available online](/samples/) but you can also download the `Chart.js.zip` archive attached to every [release](https://github.com/chartjs/Chart.js/releases) to experiment with our samples locally from the `/samples` folder.
<add>
<add>To run the samples locally you first have to install all the necessary packages using the `npm ci` command, after this you can run `npm run docs:dev` to build the documentation. As soon as the build is done, you can go to [http://localhost:8080/samples/](http://localhost:8080/samples/) to see the samples. | 1 |
Ruby | Ruby | permit head for non-official taps | 3f2803110ad983293c79e1d0a73efd032e514a38 | <ide><path>Library/Homebrew/dev-cmd/audit.rb
<ide> def audit_specs
<ide> end
<ide> end
<ide>
<del> if formula.head || formula.devel
<add> if @official_tap && (formula.head || formula.devel)
<ide> unstable_spec_message = "Formulae should not have a `HEAD` or `devel` spec"
<ide> if @new_formula
<ide> new_formula_problem unstable_spec_message | 1 |
Ruby | Ruby | prefer cached_location over tarball_path | 0909b12eb907c550a24a7641e29dcb2a8d58fd77 | <ide><path>Library/Homebrew/download_strategy.rb
<ide> def initialize(name, resource)
<ide> super
<ide> @mirrors = resource.mirrors.dup
<ide> @tarball_path = HOMEBREW_CACHE.join("#{name}-#{resource.version}#{ext}")
<del> @temporary_path = Pathname.new("#{tarball_path}.incomplete")
<add> @temporary_path = Pathname.new("#{cached_location}.incomplete")
<ide> end
<ide>
<ide> def fetch
<ide> ohai "Downloading #{@url}"
<del> unless tarball_path.exist?
<add> unless cached_location.exist?
<ide> had_incomplete_download = temporary_path.exist?
<ide> begin
<ide> _fetch
<ide> def fetch
<ide> raise CurlDownloadStrategyError, msg
<ide> end
<ide> end
<del> ignore_interrupts { temporary_path.rename(tarball_path) }
<add> ignore_interrupts { temporary_path.rename(cached_location) }
<ide> else
<del> puts "Already downloaded: #{tarball_path}"
<add> puts "Already downloaded: #{cached_location}"
<ide> end
<ide> rescue CurlDownloadStrategyError
<ide> raise if mirrors.empty?
<ide> def fetch
<ide> end
<ide>
<ide> def stage
<del> case tarball_path.compression_type
<add> case cached_location.compression_type
<ide> when :zip
<del> with_system_path { quiet_safe_system 'unzip', {:quiet_flag => '-qq'}, tarball_path }
<add> with_system_path { quiet_safe_system 'unzip', {:quiet_flag => '-qq'}, cached_location }
<ide> chdir
<ide> when :gzip_only
<ide> with_system_path { buffered_write("gunzip") }
<ide> when :bzip2_only
<ide> with_system_path { buffered_write("bunzip2") }
<ide> when :gzip, :bzip2, :compress, :tar
<ide> # Assume these are also tarred
<del> with_system_path { safe_system 'tar', 'xf', tarball_path }
<add> with_system_path { safe_system 'tar', 'xf', cached_location }
<ide> chdir
<ide> when :xz
<del> with_system_path { safe_system "#{xzpath} -dc \"#{tarball_path}\" | tar xf -" }
<add> with_system_path { safe_system "#{xzpath} -dc \"#{cached_location}\" | tar xf -" }
<ide> chdir
<ide> when :lzip
<del> with_system_path { safe_system "#{lzippath} -dc \"#{tarball_path}\" | tar xf -" }
<add> with_system_path { safe_system "#{lzippath} -dc \"#{cached_location}\" | tar xf -" }
<ide> chdir
<ide> when :xar
<del> safe_system "/usr/bin/xar", "-xf", tarball_path
<add> safe_system "/usr/bin/xar", "-xf", cached_location
<ide> when :rar
<del> quiet_safe_system 'unrar', 'x', {:quiet_flag => '-inul'}, tarball_path
<add> quiet_safe_system 'unrar', 'x', {:quiet_flag => '-inul'}, cached_location
<ide> when :p7zip
<del> safe_system '7zr', 'x', tarball_path
<add> safe_system '7zr', 'x', cached_location
<ide> else
<del> cp tarball_path, basename_without_params
<add> cp cached_location, basename_without_params
<ide> end
<ide> end
<ide>
<ide> def chdir
<ide> # file regardless of the current working directory, so we need to write it to
<ide> # the correct location ourselves.
<ide> def buffered_write(tool)
<del> target = File.basename(basename_without_params, tarball_path.extname)
<add> target = File.basename(basename_without_params, cached_location.extname)
<ide>
<del> Utils.popen_read(tool, "-f", tarball_path.to_s, "-c") do |pipe|
<add> Utils.popen_read(tool, "-f", cached_location.to_s, "-c") do |pipe|
<ide> File.open(target, "wb") do |f|
<ide> buf = ""
<ide> f.write(buf) while pipe.read(1024, buf)
<ide> def _fetch
<ide> # Useful for installing jars.
<ide> class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
<ide> def stage
<del> cp tarball_path, basename_without_params
<add> cp cached_location, basename_without_params
<ide> end
<ide> end
<ide>
<ide> def curl(*args)
<ide> end
<ide>
<ide> def stage
<del> ohai "Pouring #{tarball_path.basename}"
<add> ohai "Pouring #{cached_location.basename}"
<ide> super
<ide> end
<ide> end
<ide> def initialize formula
<ide> end
<ide>
<ide> def stage
<del> ohai "Pouring #{tarball_path.basename}"
<add> ohai "Pouring #{cached_location.basename}"
<ide> super
<ide> end
<ide> end | 1 |
PHP | PHP | implement fluent json assertions | add249472cd192cabcb4f113ff7915f667394141 | <ide><path>src/Illuminate/Testing/Fluent/Assert.php
<add><?php
<add>
<add>namespace Illuminate\Testing\Fluent;
<add>
<add>use Closure;
<add>use Illuminate\Contracts\Support\Arrayable;
<add>use Illuminate\Support\Arr;
<add>use Illuminate\Support\Traits\Macroable;
<add>use Illuminate\Support\Traits\Tappable;
<add>use Illuminate\Testing\AssertableJsonString;
<add>use PHPUnit\Framework\Assert as PHPUnit;
<add>
<add>class Assert implements Arrayable
<add>{
<add> use Concerns\Has,
<add> Concerns\Matching,
<add> Concerns\Debugging,
<add> Concerns\Interaction,
<add> Macroable,
<add> Tappable;
<add>
<add> /** @var array */
<add> private $props;
<add>
<add> /** @var string */
<add> private $path;
<add>
<add> protected function __construct(array $props, string $path = null)
<add> {
<add> $this->path = $path;
<add> $this->props = $props;
<add> }
<add>
<add> protected function dotPath($key): string
<add> {
<add> if (is_null($this->path)) {
<add> return $key;
<add> }
<add>
<add> return implode('.', [$this->path, $key]);
<add> }
<add>
<add> protected function prop(string $key = null)
<add> {
<add> return Arr::get($this->props, $key);
<add> }
<add>
<add> protected function scope($key, Closure $callback): self
<add> {
<add> $props = $this->prop($key);
<add> $path = $this->dotPath($key);
<add>
<add> PHPUnit::assertIsArray($props, sprintf('Property [%s] is not scopeable.', $path));
<add>
<add> $scope = new self($props, $path);
<add> $callback($scope);
<add> $scope->interacted();
<add>
<add> return $this;
<add> }
<add>
<add> public static function fromArray(array $data): self
<add> {
<add> return new self($data);
<add> }
<add>
<add> public static function fromAssertableJsonString(AssertableJsonString $json): self
<add> {
<add> return self::fromArray($json->json());
<add> }
<add>
<add> public function toArray()
<add> {
<add> return $this->props;
<add> }
<add>}
<ide><path>src/Illuminate/Testing/Fluent/Concerns/Debugging.php
<add><?php
<add>
<add>namespace Illuminate\Testing\Fluent\Concerns;
<add>
<add>trait Debugging
<add>{
<add> public function dump(string $prop = null): self
<add> {
<add> dump($this->prop($prop));
<add>
<add> return $this;
<add> }
<add>
<add> public function dd(string $prop = null): void
<add> {
<add> dd($this->prop($prop));
<add> }
<add>
<add> abstract protected function prop(string $key = null);
<add>}
<ide><path>src/Illuminate/Testing/Fluent/Concerns/Has.php
<add><?php
<add>
<add>namespace Illuminate\Testing\Fluent\Concerns;
<add>
<add>use Closure;
<add>use Illuminate\Support\Arr;
<add>use PHPUnit\Framework\Assert as PHPUnit;
<add>
<add>trait Has
<add>{
<add> protected function count(string $key, $length): self
<add> {
<add> PHPUnit::assertCount(
<add> $length,
<add> $this->prop($key),
<add> sprintf('Property [%s] does not have the expected size.', $this->dotPath($key))
<add> );
<add>
<add> return $this;
<add> }
<add>
<add> public function hasAll($key): self
<add> {
<add> $keys = is_array($key) ? $key : func_get_args();
<add>
<add> foreach ($keys as $prop => $count) {
<add> if (is_int($prop)) {
<add> $this->has($count);
<add> } else {
<add> $this->has($prop, $count);
<add> }
<add> }
<add>
<add> return $this;
<add> }
<add>
<add> public function has(string $key, $value = null, Closure $scope = null): self
<add> {
<add> $prop = $this->prop();
<add>
<add> PHPUnit::assertTrue(
<add> Arr::has($prop, $key),
<add> sprintf('Property [%s] does not exist.', $this->dotPath($key))
<add> );
<add>
<add> $this->interactsWith($key);
<add>
<add> // When all three arguments are provided, this indicates a short-hand
<add> // expression that combines both a `count`-assertion, followed by
<add> // directly creating a `scope` on the first element.
<add> if (is_int($value) && ! is_null($scope)) {
<add> $prop = $this->prop($key);
<add> $path = $this->dotPath($key);
<add>
<add> PHPUnit::assertTrue($value > 0, sprintf('Cannot scope directly onto the first entry of property [%s] when asserting that it has a size of 0.', $path));
<add> PHPUnit::assertIsArray($prop, sprintf('Direct scoping is unsupported for non-array like properties such as [%s].', $path));
<add>
<add> $this->count($key, $value);
<add>
<add> return $this->scope($key.'.'.array_keys($prop)[0], $scope);
<add> }
<add>
<add> if (is_callable($value)) {
<add> $this->scope($key, $value);
<add> } elseif (! is_null($value)) {
<add> $this->count($key, $value);
<add> }
<add>
<add> return $this;
<add> }
<add>
<add> public function missingAll($key): self
<add> {
<add> $keys = is_array($key) ? $key : func_get_args();
<add>
<add> foreach ($keys as $prop) {
<add> $this->missing($prop);
<add> }
<add>
<add> return $this;
<add> }
<add>
<add> public function missing(string $key): self
<add> {
<add> PHPUnit::assertNotTrue(
<add> Arr::has($this->prop(), $key),
<add> sprintf('Property [%s] was found while it was expected to be missing.', $this->dotPath($key))
<add> );
<add>
<add> return $this;
<add> }
<add>
<add> abstract protected function prop(string $key = null);
<add>
<add> abstract protected function dotPath($key): string;
<add>
<add> abstract protected function interactsWith(string $key): void;
<add>
<add> abstract protected function scope($key, Closure $callback);
<add>}
<ide><path>src/Illuminate/Testing/Fluent/Concerns/Interaction.php
<add><?php
<add>
<add>namespace Illuminate\Testing\Fluent\Concerns;
<add>
<add>use Illuminate\Support\Str;
<add>use PHPUnit\Framework\Assert as PHPUnit;
<add>
<add>trait Interaction
<add>{
<add> /** @var array */
<add> protected $interacted = [];
<add>
<add> protected function interactsWith(string $key): void
<add> {
<add> $prop = Str::before($key, '.');
<add>
<add> if (! in_array($prop, $this->interacted, true)) {
<add> $this->interacted[] = $prop;
<add> }
<add> }
<add>
<add> public function interacted(): void
<add> {
<add> PHPUnit::assertSame(
<add> [],
<add> array_diff(array_keys($this->prop()), $this->interacted),
<add> $this->path
<add> ? sprintf('Unexpected properties were found in scope [%s].', $this->path)
<add> : 'Unexpected properties were found on the root level.'
<add> );
<add> }
<add>
<add> public function etc(): self
<add> {
<add> $this->interacted = array_keys($this->prop());
<add>
<add> return $this;
<add> }
<add>
<add> abstract protected function prop(string $key = null);
<add>}
<ide><path>src/Illuminate/Testing/Fluent/Concerns/Matching.php
<add><?php
<add>
<add>namespace Illuminate\Testing\Fluent\Concerns;
<add>
<add>use Closure;
<add>use Illuminate\Contracts\Support\Arrayable;
<add>use Illuminate\Support\Collection;
<add>use PHPUnit\Framework\Assert as PHPUnit;
<add>
<add>trait Matching
<add>{
<add> public function whereAll(array $bindings): self
<add> {
<add> foreach ($bindings as $key => $value) {
<add> $this->where($key, $value);
<add> }
<add>
<add> return $this;
<add> }
<add>
<add> public function where($key, $expected): self
<add> {
<add> $this->has($key);
<add>
<add> $actual = $this->prop($key);
<add>
<add> if ($expected instanceof Closure) {
<add> PHPUnit::assertTrue(
<add> $expected(is_array($actual) ? Collection::make($actual) : $actual),
<add> sprintf('Property [%s] was marked as invalid using a closure.', $this->dotPath($key))
<add> );
<add>
<add> return $this;
<add> }
<add>
<add> if ($expected instanceof Arrayable) {
<add> $expected = $expected->toArray();
<add> }
<add>
<add> $this->ensureSorted($expected);
<add> $this->ensureSorted($actual);
<add>
<add> PHPUnit::assertSame(
<add> $expected,
<add> $actual,
<add> sprintf('Property [%s] does not match the expected value.', $this->dotPath($key))
<add> );
<add>
<add> return $this;
<add> }
<add>
<add> protected function ensureSorted(&$value): void
<add> {
<add> if (! is_array($value)) {
<add> return;
<add> }
<add>
<add> foreach ($value as &$arg) {
<add> $this->ensureSorted($arg);
<add> }
<add>
<add> ksort($value);
<add> }
<add>
<add> abstract protected function dotPath($key): string;
<add>
<add> abstract protected function prop(string $key = null);
<add>
<add> abstract public function has(string $key, $value = null, Closure $scope = null);
<add>}
<ide><path>src/Illuminate/Testing/TestResponse.php
<ide> use Illuminate\Support\Traits\Tappable;
<ide> use Illuminate\Testing\Assert as PHPUnit;
<ide> use Illuminate\Testing\Constraints\SeeInOrder;
<add>use Illuminate\Testing\Fluent\Assert as FluentAssert;
<ide> use LogicException;
<ide> use Symfony\Component\HttpFoundation\StreamedResponse;
<ide>
<ide> public function assertDontSeeText($value, $escape = true)
<ide> /**
<ide> * Assert that the response is a superset of the given JSON.
<ide> *
<del> * @param array $data
<add> * @param array|callable $value
<ide> * @param bool $strict
<ide> * @return $this
<ide> */
<del> public function assertJson(array $data, $strict = false)
<add> public function assertJson($value, $strict = false)
<ide> {
<del> $this->decodeResponseJson()->assertSubset($data, $strict);
<add> $json = $this->decodeResponseJson();
<add>
<add> if (is_array($value)) {
<add> $json->assertSubset($value, $strict);
<add> } else {
<add> $assert = FluentAssert::fromAssertableJsonString($json);
<add>
<add> $value($assert);
<add>
<add> if ($strict) {
<add> $assert->interacted();
<add> }
<add> }
<add>
<ide>
<ide> return $this;
<ide> }
<ide><path>tests/Testing/Fluent/AssertTest.php
<add><?php
<add>
<add>namespace Illuminate\Tests\Testing\Fluent;
<add>
<add>use Illuminate\Support\Collection;
<add>use Illuminate\Testing\Fluent\Assert;
<add>use Illuminate\Tests\Testing\Stubs\ArrayableStubObject;
<add>use PHPUnit\Framework\AssertionFailedError;
<add>use PHPUnit\Framework\TestCase;
<add>use RuntimeException;
<add>use TypeError;
<add>
<add>class AssertTest extends TestCase
<add>{
<add> public function testAssertHas()
<add> {
<add> $assert = Assert::fromArray([
<add> 'prop' => 'value',
<add> ]);
<add>
<add> $assert->has('prop');
<add> }
<add>
<add> public function testAssertHasFailsWhenPropMissing()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => 'value',
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [prop] does not exist.');
<add>
<add> $assert->has('prop');
<add> }
<add>
<add> public function testAssertHasNestedProp()
<add> {
<add> $assert = Assert::fromArray([
<add> 'example' => [
<add> 'nested' => 'nested-value',
<add> ],
<add> ]);
<add>
<add> $assert->has('example.nested');
<add> }
<add>
<add> public function testAssertHasFailsWhenNestedPropMissing()
<add> {
<add> $assert = Assert::fromArray([
<add> 'example' => [
<add> 'nested' => 'nested-value',
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [example.another] does not exist.');
<add>
<add> $assert->has('example.another');
<add> }
<add>
<add> public function testAssertCountItemsInProp()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => 'example',
<add> 'prop' => 'value',
<add> ],
<add> ]);
<add>
<add> $assert->has('bar', 2);
<add> }
<add>
<add> public function testAssertCountFailsWhenAmountOfItemsDoesNotMatch()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => 'example',
<add> 'prop' => 'value',
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [bar] does not have the expected size.');
<add>
<add> $assert->has('bar', 1);
<add> }
<add>
<add> public function testAssertCountFailsWhenPropMissing()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => 'example',
<add> 'prop' => 'value',
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [baz] does not exist.');
<add>
<add> $assert->has('baz', 1);
<add> }
<add>
<add> public function testAssertHasFailsWhenSecondArgumentUnsupportedType()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => 'baz',
<add> ]);
<add>
<add> $this->expectException(TypeError::class);
<add>
<add> $assert->has('bar', 'invalid');
<add> }
<add>
<add> public function testAssertMissing()
<add> {
<add> $assert = Assert::fromArray([
<add> 'foo' => [
<add> 'bar' => true,
<add> ],
<add> ]);
<add>
<add> $assert->missing('foo.baz');
<add> }
<add>
<add> public function testAssertMissingFailsWhenPropExists()
<add> {
<add> $assert = Assert::fromArray([
<add> 'prop' => 'value',
<add> 'foo' => [
<add> 'bar' => true,
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [foo.bar] was found while it was expected to be missing.');
<add>
<add> $assert->missing('foo.bar');
<add> }
<add>
<add> public function testAssertMissingAll()
<add> {
<add> $assert = Assert::fromArray([
<add> 'baz' => 'foo',
<add> ]);
<add>
<add> $assert->missingAll([
<add> 'foo',
<add> 'bar',
<add> ]);
<add> }
<add>
<add> public function testAssertMissingAllFailsWhenAtLeastOnePropExists()
<add> {
<add> $assert = Assert::fromArray([
<add> 'baz' => 'foo',
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [baz] was found while it was expected to be missing.');
<add>
<add> $assert->missingAll([
<add> 'bar',
<add> 'baz',
<add> ]);
<add> }
<add>
<add> public function testAssertMissingAllAcceptsMultipleArgumentsInsteadOfArray()
<add> {
<add> $assert = Assert::fromArray([
<add> 'baz' => 'foo',
<add> ]);
<add>
<add> $assert->missingAll('foo', 'bar');
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [baz] was found while it was expected to be missing.');
<add>
<add> $assert->missingAll('bar', 'baz');
<add> }
<add>
<add> public function testAssertWhereMatchesValue()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => 'value',
<add> ]);
<add>
<add> $assert->where('bar', 'value');
<add> }
<add>
<add> public function testAssertWhereFailsWhenDoesNotMatchValue()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => 'value',
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [bar] does not match the expected value.');
<add>
<add> $assert->where('bar', 'invalid');
<add> }
<add>
<add> public function testAssertWhereFailsWhenMissing()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => 'value',
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [baz] does not exist.');
<add>
<add> $assert->where('baz', 'invalid');
<add> }
<add>
<add> public function testAssertWhereFailsWhenMachingLoosely()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => 1,
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [bar] does not match the expected value.');
<add>
<add> $assert->where('bar', true);
<add> }
<add>
<add> public function testAssertWhereUsingClosure()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => 'baz',
<add> ]);
<add>
<add> $assert->where('bar', function ($value) {
<add> return $value === 'baz';
<add> });
<add> }
<add>
<add> public function testAssertWhereFailsWhenDoesNotMatchValueUsingClosure()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => 'baz',
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [bar] was marked as invalid using a closure.');
<add>
<add> $assert->where('bar', function ($value) {
<add> return $value === 'invalid';
<add> });
<add> }
<add>
<add> public function testAssertWhereClosureArrayValuesAreAutomaticallyCastedToCollections()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => 'foo',
<add> 'example' => 'value',
<add> ],
<add> ]);
<add>
<add> $assert->where('bar', function ($value) {
<add> $this->assertInstanceOf(Collection::class, $value);
<add>
<add> return $value->count() === 2;
<add> });
<add> }
<add>
<add> public function testAssertWhereMatchesValueUsingArrayable()
<add> {
<add> $stub = ArrayableStubObject::make(['foo' => 'bar']);
<add>
<add> $assert = Assert::fromArray([
<add> 'bar' => $stub->toArray(),
<add> ]);
<add>
<add> $assert->where('bar', $stub);
<add> }
<add>
<add> public function testAssertWhereMatchesValueUsingArrayableWhenSortedDifferently()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => 'foo',
<add> 'example' => 'value',
<add> ],
<add> ]);
<add>
<add> $assert->where('bar', function ($value) {
<add> $this->assertInstanceOf(Collection::class, $value);
<add>
<add> return $value->count() === 2;
<add> });
<add> }
<add>
<add> public function testAssertWhereFailsWhenDoesNotMatchValueUsingArrayable()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => ['id' => 1, 'name' => 'Example'],
<add> 'baz' => [
<add> 'id' => 1,
<add> 'name' => 'Taylor Otwell',
<add> 'email' => 'taylor@laravel.com',
<add> 'email_verified_at' => '2021-01-22T10:34:42.000000Z',
<add> 'created_at' => '2021-01-22T10:34:42.000000Z',
<add> 'updated_at' => '2021-01-22T10:34:42.000000Z',
<add> ],
<add> ]);
<add>
<add> $assert
<add> ->where('bar', ArrayableStubObject::make(['name' => 'Example', 'id' => 1]))
<add> ->where('baz', [
<add> 'name' => 'Taylor Otwell',
<add> 'email' => 'taylor@laravel.com',
<add> 'id' => 1,
<add> 'email_verified_at' => '2021-01-22T10:34:42.000000Z',
<add> 'updated_at' => '2021-01-22T10:34:42.000000Z',
<add> 'created_at' => '2021-01-22T10:34:42.000000Z',
<add> ]);
<add> }
<add>
<add> public function testAssertNestedWhereMatchesValue()
<add> {
<add> $assert = Assert::fromArray([
<add> 'example' => [
<add> 'nested' => 'nested-value',
<add> ],
<add> ]);
<add>
<add> $assert->where('example.nested', 'nested-value');
<add> }
<add>
<add> public function testAssertNestedWhereFailsWhenDoesNotMatchValue()
<add> {
<add> $assert = Assert::fromArray([
<add> 'example' => [
<add> 'nested' => 'nested-value',
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [example.nested] does not match the expected value.');
<add>
<add> $assert->where('example.nested', 'another-value');
<add> }
<add>
<add> public function testScope()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => 'example',
<add> 'prop' => 'value',
<add> ],
<add> ]);
<add>
<add> $called = false;
<add> $assert->has('bar', function (Assert $assert) use (&$called) {
<add> $called = true;
<add> $assert
<add> ->where('baz', 'example')
<add> ->where('prop', 'value');
<add> });
<add>
<add> $this->assertTrue($called, 'The scoped query was never actually called.');
<add> }
<add>
<add> public function testScopeFailsWhenPropMissing()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => 'example',
<add> 'prop' => 'value',
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [baz] does not exist.');
<add>
<add> $assert->has('baz', function (Assert $item) {
<add> $item->where('baz', 'example');
<add> });
<add> }
<add>
<add> public function testScopeFailsWhenPropSingleValue()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => 'value',
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [bar] is not scopeable.');
<add>
<add> $assert->has('bar', function (Assert $item) {
<add> //
<add> });
<add> }
<add>
<add> public function testScopeShorthand()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> ['key' => 'first'],
<add> ['key' => 'second'],
<add> ],
<add> ]);
<add>
<add> $called = false;
<add> $assert->has('bar', 2, function (Assert $item) use (&$called) {
<add> $item->where('key', 'first');
<add> $called = true;
<add> });
<add>
<add> $this->assertTrue($called, 'The scoped query was never actually called.');
<add> }
<add>
<add> public function testScopeShorthandFailsWhenAssertingZeroItems()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> ['key' => 'first'],
<add> ['key' => 'second'],
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Cannot scope directly onto the first entry of property [bar] when asserting that it has a size of 0.');
<add>
<add> $assert->has('bar', 0, function (Assert $item) {
<add> $item->where('key', 'first');
<add> });
<add> }
<add>
<add> public function testScopeShorthandFailsWhenAmountOfItemsDoesNotMatch()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> ['key' => 'first'],
<add> ['key' => 'second'],
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [bar] does not have the expected size.');
<add>
<add> $assert->has('bar', 1, function (Assert $item) {
<add> $item->where('key', 'first');
<add> });
<add> }
<add>
<add> public function testFailsWhenNotInteractingWithAllPropsInScope()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => 'example',
<add> 'prop' => 'value',
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Unexpected properties were found in scope [bar].');
<add>
<add> $assert->has('bar', function (Assert $item) {
<add> $item->where('baz', 'example');
<add> });
<add> }
<add>
<add> public function testDisableInteractionCheckForCurrentScope()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => 'example',
<add> 'prop' => 'value',
<add> ],
<add> ]);
<add>
<add> $assert->has('bar', function (Assert $item) {
<add> $item->etc();
<add> });
<add> }
<add>
<add> public function testCannotDisableInteractionCheckForDifferentScopes()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => [
<add> 'foo' => 'bar',
<add> 'example' => 'value',
<add> ],
<add> 'prop' => 'value',
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Unexpected properties were found in scope [bar.baz].');
<add>
<add> $assert->has('bar', function (Assert $item) {
<add> $item
<add> ->etc()
<add> ->has('baz', function (Assert $item) {
<add> //
<add> });
<add> });
<add> }
<add>
<add> public function testTopLevelPropInteractionDisabledByDefault()
<add> {
<add> $assert = Assert::fromArray([
<add> 'foo' => 'bar',
<add> 'bar' => 'baz',
<add> ]);
<add>
<add> $assert->has('foo');
<add> }
<add>
<add> public function testTopLevelInteractionEnabledWhenInteractedFlagSet()
<add> {
<add> $assert = Assert::fromArray([
<add> 'foo' => 'bar',
<add> 'bar' => 'baz',
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Unexpected properties were found on the root level.');
<add>
<add> $assert
<add> ->has('foo')
<add> ->interacted();
<add> }
<add>
<add> public function testAssertWhereAllMatchesValues()
<add> {
<add> $assert = Assert::fromArray([
<add> 'foo' => [
<add> 'bar' => 'value',
<add> 'example' => ['hello' => 'world'],
<add> ],
<add> 'baz' => 'another',
<add> ]);
<add>
<add> $assert->whereAll([
<add> 'foo.bar' => 'value',
<add> 'foo.example' => ArrayableStubObject::make(['hello' => 'world']),
<add> 'baz' => function ($value) {
<add> return $value === 'another';
<add> },
<add> ]);
<add> }
<add>
<add> public function testAssertWhereAllFailsWhenAtLeastOnePropDoesNotMatchValue()
<add> {
<add> $assert = Assert::fromArray([
<add> 'foo' => 'bar',
<add> 'baz' => 'example',
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [baz] was marked as invalid using a closure.');
<add>
<add> $assert->whereAll([
<add> 'foo' => 'bar',
<add> 'baz' => function ($value) {
<add> return $value === 'foo';
<add> },
<add> ]);
<add> }
<add>
<add> public function testAssertHasAll()
<add> {
<add> $assert = Assert::fromArray([
<add> 'foo' => [
<add> 'bar' => 'value',
<add> 'example' => ['hello' => 'world'],
<add> ],
<add> 'baz' => 'another',
<add> ]);
<add>
<add> $assert->hasAll([
<add> 'foo.bar',
<add> 'foo.example',
<add> 'baz',
<add> ]);
<add> }
<add>
<add> public function testAssertHasAllFailsWhenAtLeastOnePropMissing()
<add> {
<add> $assert = Assert::fromArray([
<add> 'foo' => [
<add> 'bar' => 'value',
<add> 'example' => ['hello' => 'world'],
<add> ],
<add> 'baz' => 'another',
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [foo.baz] does not exist.');
<add>
<add> $assert->hasAll([
<add> 'foo.bar',
<add> 'foo.baz',
<add> 'baz',
<add> ]);
<add> }
<add>
<add> public function testAssertHasAllAcceptsMultipleArgumentsInsteadOfArray()
<add> {
<add> $assert = Assert::fromArray([
<add> 'foo' => [
<add> 'bar' => 'value',
<add> 'example' => ['hello' => 'world'],
<add> ],
<add> 'baz' => 'another',
<add> ]);
<add>
<add> $assert->hasAll('foo.bar', 'foo.example', 'baz');
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [foo.baz] does not exist.');
<add>
<add> $assert->hasAll('foo.bar', 'foo.baz', 'baz');
<add> }
<add>
<add> public function testAssertCountMultipleProps()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'key' => 'value',
<add> 'prop' => 'example',
<add> ],
<add> 'baz' => [
<add> 'another' => 'value',
<add> ],
<add> ]);
<add>
<add> $assert->hasAll([
<add> 'bar' => 2,
<add> 'baz' => 1,
<add> ]);
<add> }
<add>
<add> public function testAssertCountMultiplePropsFailsWhenPropMissing()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'key' => 'value',
<add> 'prop' => 'example',
<add> ],
<add> ]);
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Property [baz] does not exist.');
<add>
<add> $assert->hasAll([
<add> 'bar' => 2,
<add> 'baz' => 1,
<add> ]);
<add> }
<add>
<add> public function testMacroable()
<add> {
<add> Assert::macro('myCustomMacro', function () {
<add> throw new RuntimeException('My Custom Macro was called!');
<add> });
<add>
<add> $this->expectException(RuntimeException::class);
<add> $this->expectExceptionMessage('My Custom Macro was called!');
<add>
<add> $assert = Assert::fromArray(['foo' => 'bar']);
<add> $assert->myCustomMacro();
<add> }
<add>
<add> public function testTappable()
<add> {
<add> $assert = Assert::fromArray([
<add> 'bar' => [
<add> 'baz' => 'example',
<add> 'prop' => 'value',
<add> ],
<add> ]);
<add>
<add> $called = false;
<add> $assert->has('bar', function (Assert $assert) use (&$called) {
<add> $assert->etc();
<add> $assert->tap(function (Assert $assert) use (&$called) {
<add> $called = true;
<add> });
<add> });
<add>
<add> $this->assertTrue($called, 'The scoped query was never actually called.');
<add> }
<add>}
<ide><path>tests/Testing/Stubs/ArrayableStubObject.php
<add><?php
<add>
<add>namespace Illuminate\Tests\Testing\Stubs;
<add>
<add>use Illuminate\Contracts\Support\Arrayable;
<add>
<add>class ArrayableStubObject implements Arrayable
<add>{
<add> protected $data;
<add>
<add> public function __construct($data = [])
<add> {
<add> $this->data = $data;
<add> }
<add>
<add> public static function make($data = [])
<add> {
<add> return new self($data);
<add> }
<add>
<add> public function toArray()
<add> {
<add> return $this->data;
<add> }
<add>}
<ide><path>tests/Testing/TestResponseTest.php
<ide> use Illuminate\Encryption\Encrypter;
<ide> use Illuminate\Filesystem\Filesystem;
<ide> use Illuminate\Http\Response;
<add>use Illuminate\Testing\Fluent\Assert;
<ide> use Illuminate\Testing\TestResponse;
<ide> use JsonSerializable;
<ide> use Mockery as m;
<ide> public function testAssertJsonWithNull()
<ide> $response->assertJson($resource->jsonSerialize());
<ide> }
<ide>
<add> public function testAssertJsonWithFluent()
<add> {
<add> $response = TestResponse::fromBaseResponse(new Response(new JsonSerializableSingleResourceStub));
<add>
<add> $response->assertJson(function (Assert $json) {
<add> $json->where('0.foo', 'foo 0');
<add> });
<add> }
<add>
<add> public function testAssertJsonWithFluentStrict()
<add> {
<add> $response = TestResponse::fromBaseResponse(new Response(new JsonSerializableSingleResourceStub));
<add>
<add> $this->expectException(AssertionFailedError::class);
<add> $this->expectExceptionMessage('Unexpected properties were found on the root level.');
<add>
<add> $response->assertJson(function (Assert $json) {
<add> $json->where('0.foo', 'foo 0');
<add> }, true);
<add> }
<add>
<ide> public function testAssertSimilarJsonWithMixed()
<ide> {
<ide> $response = TestResponse::fromBaseResponse(new Response(new JsonSerializableMixedResourcesStub)); | 9 |
PHP | PHP | change method order | 7d13619e8a6fff8a31ab984e53e87c57358294b9 | <ide><path>src/Illuminate/Auth/UserInterface.php
<ide> public function getAuthIdentifier();
<ide> */
<ide> public function getAuthPassword();
<ide>
<del> /**
<del> * Get the column name for the "remember me" token.
<del> *
<del> * @return string
<del> */
<del> public function getRememberTokenName();
<del>
<ide> /**
<ide> * Get the token value for the "remember me" session.
<ide> *
<ide> public function getRememberToken();
<ide> */
<ide> public function setRememberToken($value);
<ide>
<add> /**
<add> * Get the column name for the "remember me" token.
<add> *
<add> * @return string
<add> */
<add> public function getRememberTokenName();
<add>
<ide> } | 1 |
Ruby | Ruby | put all private method together | 53d316c2697e7b001d835da7cb85082ec421ac05 | <ide><path>actionmailer/lib/action_mailer/base.rb
<ide> def mail(headers = {}, &block)
<ide> message
<ide> end
<ide>
<del> private
<del>
<del> def apply_defaults(headers)
<del> default_values = self.class.default.map do |key, value|
<del> [
<del> key,
<del> value.is_a?(Proc) ? instance_eval(&value) : value
<del> ]
<del> end.to_h
<del>
<del> headers_with_defaults = headers.reverse_merge(default_values)
<del> headers_with_defaults[:subject] ||= default_i18n_subject
<del> headers_with_defaults
<del> end
<del>
<del> def assign_headers_to_message(message, headers)
<del> assignable = headers.except(:parts_order, :content_type, :body, :template_name,
<del> :template_path, :delivery_method, :delivery_method_options)
<del> assignable.each { |k, v| message[k] = v }
<del> end
<del>
<del> protected
<add> protected
<ide>
<ide> # Used by #mail to set the content type of the message.
<ide> #
<ide> def collect_responses(headers) #:nodoc:
<ide> end
<ide> end
<ide>
<del> def collect_responses_from_templates(headers)
<del> templates_path = headers[:template_path] || self.class.mailer_name
<del> templates_name = headers[:template_name] || action_name
<del>
<del> each_template(Array(templates_path), templates_name).map do |template|
<del> self.formats = template.formats
<del> {
<del> body: render(template: template),
<del> content_type: template.type.to_s
<del> }
<del> end
<del> end
<del> private :collect_responses_from_templates
<del>
<ide> def each_template(paths, name, &block) #:nodoc:
<ide> templates = lookup_context.find_all(name, paths)
<ide> if templates.empty?
<ide> def self.supports_path?
<ide> false
<ide> end
<ide>
<add> private
<add>
<add> def apply_defaults(headers)
<add> default_values = self.class.default.map do |key, value|
<add> [
<add> key,
<add> value.is_a?(Proc) ? instance_eval(&value) : value
<add> ]
<add> end.to_h
<add>
<add> headers_with_defaults = headers.reverse_merge(default_values)
<add> headers_with_defaults[:subject] ||= default_i18n_subject
<add> headers_with_defaults
<add> end
<add>
<add> def assign_headers_to_message(message, headers)
<add> assignable = headers.except(:parts_order, :content_type, :body, :template_name,
<add> :template_path, :delivery_method, :delivery_method_options)
<add> assignable.each { |k, v| message[k] = v }
<add> end
<add>
<add> def collect_responses_from_templates(headers)
<add> templates_path = headers[:template_path] || self.class.mailer_name
<add> templates_name = headers[:template_name] || action_name
<add>
<add> each_template(Array(templates_path), templates_name).map do |template|
<add> self.formats = template.formats
<add> {
<add> body: render(template: template),
<add> content_type: template.type.to_s
<add> }
<add> end
<add> end
<add>
<ide> ActiveSupport.run_load_hooks(:action_mailer, self)
<ide> end
<ide> end | 1 |
Python | Python | add missing import | d5f18f83077487011f794444bbdf873b3bca7271 | <ide><path>spacy/util.py
<ide> import srsly
<ide> import catalogue
<ide> import sys
<add>import warnings
<ide>
<ide> try:
<ide> import jsonschema | 1 |
Javascript | Javascript | specify correct version of npm package | f6d8be8ad3b8cd5a8be058d1c44a8ab1fb5cfffb | <ide><path>src/ngComponentRouter/Router.js
<ide> * on Bower or the Google CDN.
<ide> *
<ide> * ```bash
<del> * npm install @angular/router --save
<add> * npm install @angular/router@0.2.0 --save
<ide> * ```
<ide> *
<ide> * Include `angular_1_router.js` in your HTML: | 1 |
Javascript | Javascript | use common.expectserror in tests | d8c896cac5b3e31cbffb3da2c657dd59c83fbfeb | <ide><path>test/parallel/test-buffer-slow.js
<ide> const bufferMaxSizeMsg = common.expectsError({
<ide> assert.throws(function() {
<ide> SlowBuffer(Infinity);
<ide> }, bufferMaxSizeMsg);
<del>assert.throws(function() {
<add>common.expectsError(function() {
<ide> SlowBuffer(-1);
<del>}, common.expectsError({
<add>}, {
<ide> code: 'ERR_INVALID_OPT_VALUE',
<ide> type: RangeError,
<ide> message: 'The value "-1" is invalid for option "size"'
<del>}));
<add>});
<ide>
<ide> assert.throws(function() {
<ide> SlowBuffer(buffer.kMaxLength + 1);
<ide><path>test/parallel/test-buffer-tostring-range.js
<ide> assert.strictEqual(rangeBuffer.toString({ toString: function() {
<ide> } }), 'abc');
<ide>
<ide> // try toString() with 0 and null as the encoding
<del>assert.throws(() => {
<add>common.expectsError(() => {
<ide> rangeBuffer.toString(0, 1, 2);
<del>}, common.expectsError({
<add>}, {
<ide> code: 'ERR_UNKNOWN_ENCODING',
<ide> type: TypeError,
<ide> message: 'Unknown encoding: 0'
<del>}));
<del>assert.throws(() => {
<add>});
<add>common.expectsError(() => {
<ide> rangeBuffer.toString(null, 1, 2);
<del>}, common.expectsError({
<add>}, {
<ide> code: 'ERR_UNKNOWN_ENCODING',
<ide> type: TypeError,
<ide> message: 'Unknown encoding: null'
<del>}));
<add>});
<ide><path>test/parallel/test-child-process-send-type-error.js
<ide> const assert = require('assert');
<ide> const cp = require('child_process');
<ide>
<ide> function fail(proc, args) {
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> proc.send.apply(proc, args);
<del> }, common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }));
<add> }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError });
<ide> }
<ide>
<ide> let target = process;
<ide><path>test/parallel/test-child-process-spawnsync-kill-signal.js
<ide> if (process.argv[2] === 'child') {
<ide> }
<ide>
<ide> // Verify that an error is thrown for unknown signals.
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> spawn('SIG_NOT_A_REAL_SIGNAL');
<del> }, common.expectsError({ code: 'ERR_UNKNOWN_SIGNAL', type: TypeError }));
<add> }, { code: 'ERR_UNKNOWN_SIGNAL', type: TypeError });
<ide>
<ide> // Verify that the default kill signal is SIGTERM.
<ide> {
<ide><path>test/parallel/test-child-process-stdio.js
<ide> options = { stdio: 'ignore' };
<ide> child = spawnSync('cat', [], options);
<ide> assert.deepStrictEqual(options, { stdio: 'ignore' });
<ide>
<del>assert.throws(() => {
<add>common.expectsError(() => {
<ide> common.spawnPwd({ stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'ipc'] });
<del>}, common.expectsError({ code: 'ERR_IPC_ONE_PIPE', type: Error }));
<add>}, { code: 'ERR_IPC_ONE_PIPE', type: Error });
<ide><path>test/parallel/test-child-process-validate-stdio.js
<ide> assert.throws(() => _validateStdio(600), expectedError);
<ide>
<ide> // should throw if stdio has ipc and sync is true
<ide> const stdio2 = ['ipc', 'ipc', 'ipc'];
<del>assert.throws(() => _validateStdio(stdio2, true),
<del> common.expectsError({ code: 'ERR_IPC_SYNC_FORK', type: Error }));
<add>common.expectsError(() => _validateStdio(stdio2, true),
<add> { code: 'ERR_IPC_SYNC_FORK', type: Error }
<add>);
<ide>
<ide> {
<ide> const stdio3 = [process.stdin, process.stdout, process.stderr];
<ide><path>test/parallel/test-common.js
<ide> assert.throws(function() {
<ide> }, /^TypeError: Invalid minimum value: \/foo\/$/);
<ide>
<ide> // assert.fail() tests
<del>assert.throws(
<add>common.expectsError(
<ide> () => { assert.fail('fhqwhgads'); },
<del> common.expectsError({
<add> {
<ide> code: 'ERR_ASSERTION',
<ide> message: /^fhqwhgads$/
<del> }));
<add> });
<ide>
<ide> const fnOnce = common.mustCall(() => {});
<ide> fnOnce();
<ide><path>test/parallel/test-console-instance.js
<ide> assert.strictEqual('function', typeof Console);
<ide>
<ide> // make sure that the Console constructor throws
<ide> // when not given a writable stream instance
<del>assert.throws(
<add>common.expectsError(
<ide> () => { new Console(); },
<del> common.expectsError({
<add> {
<ide> code: 'ERR_CONSOLE_WRITABLE_STREAM',
<ide> type: TypeError,
<ide> message: /stdout/
<del> })
<add> }
<ide> );
<ide>
<ide> // Console constructor should throw if stderr exists but is not writable
<ide><path>test/parallel/test-dgram-bind.js
<ide> const dgram = require('dgram');
<ide> const socket = dgram.createSocket('udp4');
<ide>
<ide> socket.on('listening', common.mustCall(() => {
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> socket.bind();
<del> }, common.expectsError({
<add> }, {
<ide> code: 'ERR_SOCKET_ALREADY_BOUND',
<ide> type: Error,
<ide> message: /^Socket is already bound$/
<del> }));
<add> });
<ide>
<ide> socket.close();
<ide> }));
<ide><path>test/parallel/test-dgram-create-socket-handle.js
<ide> const UDP = process.binding('udp_wrap').UDP;
<ide> const _createSocketHandle = dgram._createSocketHandle;
<ide>
<ide> // Throws if an "existing fd" is passed in.
<del>assert.throws(() => {
<add>common.expectsError(() => {
<ide> _createSocketHandle(common.localhostIPv4, 0, 'udp4', 42);
<del>}, common.expectsError({
<add>}, {
<ide> code: 'ERR_ASSERTION',
<ide> message: /^false == true$/
<del>}));
<add>});
<ide>
<ide> {
<ide> // Create a handle that is not bound. | 10 |
Java | Java | use parseint without substring method | 804b343cabe8a16a02a714f2f51d4b3815f9f6ff | <ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java
<ide> else if (LAZY_INIT_KEY.equals(property)) {
<ide> }
<ide> else if (property.startsWith(CONSTRUCTOR_ARG_PREFIX)) {
<ide> if (property.endsWith(REF_SUFFIX)) {
<del> int index = Integer.parseInt(property.substring(1, property.length() - REF_SUFFIX.length()));
<add> int index = Integer.parseInt(property, 1, property.length() - REF_SUFFIX.length(), 10);
<ide> cas.addIndexedArgumentValue(index, new RuntimeBeanReference(entry.getValue().toString()));
<ide> }
<ide> else {
<del> int index = Integer.parseInt(property.substring(1));
<add> int index = Integer.parseInt(property, 1, property.length(), 10);
<ide> cas.addIndexedArgumentValue(index, readValue(entry));
<ide> }
<ide> }
<ide><path>spring-context/src/main/java/org/springframework/scheduling/config/TaskExecutorFactoryBean.java
<ide> /*
<del> * Copyright 2002-2020 the original author or authors.
<add> * Copyright 2002-2021 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> private void determinePoolSizeRange(ThreadPoolTaskExecutor executor) {
<ide> int maxPoolSize;
<ide> int separatorIndex = this.poolSize.indexOf('-');
<ide> if (separatorIndex != -1) {
<del> corePoolSize = Integer.parseInt(this.poolSize.substring(0, separatorIndex));
<del> maxPoolSize = Integer.parseInt(this.poolSize.substring(separatorIndex + 1));
<add> corePoolSize = Integer.parseInt(this.poolSize, 0, separatorIndex, 10);
<add> maxPoolSize = Integer.parseInt(this.poolSize, separatorIndex + 1, this.poolSize.length(), 10);
<ide> if (corePoolSize > maxPoolSize) {
<ide> throw new IllegalArgumentException(
<ide> "Lower bound of pool-size range must not exceed the upper bound");
<ide><path>spring-context/src/main/java/org/springframework/scheduling/support/BitsCronField.java
<ide> private static ValueRange parseRange(String value, Type type) {
<ide> return ValueRange.of(result, result);
<ide> }
<ide> else {
<del> int min = Integer.parseInt(value.substring(0, hyphenPos));
<del> int max = Integer.parseInt(value.substring(hyphenPos + 1));
<add> int min = Integer.parseInt(value, 0, hyphenPos, 10);
<add> int max = Integer.parseInt(value, hyphenPos + 1, value.length(), 10);
<ide> min = type.checkValidValue(min);
<ide> max = type.checkValidValue(max);
<ide> if (type == Type.DAY_OF_WEEK && min == 7) {
<ide><path>spring-context/src/main/java/org/springframework/scheduling/support/QuartzCronField.java
<ide> else if (value.length() == 2 && value.charAt(1) == 'W') { // "LW"
<ide> adjuster = lastDayOfMonth();
<ide> }
<ide> else { // "L-[0-9]+"
<del> int offset = Integer.parseInt(value.substring(idx + 1));
<add> int offset = Integer.parseInt(value, idx + 1, value.length(), 10);
<ide> if (offset >= 0) {
<ide> throw new IllegalArgumentException("Offset '" + offset + " should be < 0 '" + value + "'");
<ide> }
<ide> else if (idx != value.length() - 1) {
<ide> throw new IllegalArgumentException("Unrecognized characters after 'W' in '" + value + "'");
<ide> }
<ide> else { // "[0-9]+W"
<del> int dayOfMonth = Integer.parseInt(value.substring(0, idx));
<add> int dayOfMonth = Integer.parseInt(value, 0, idx, 10);
<ide> dayOfMonth = Type.DAY_OF_MONTH.checkValidValue(dayOfMonth);
<ide> TemporalAdjuster adjuster = weekdayNearestTo(dayOfMonth);
<ide> return new QuartzCronField(Type.DAY_OF_MONTH, adjuster, value);
<ide> else if (idx == value.length() - 1) {
<ide> }
<ide> // "[0-7]#[0-9]+"
<ide> DayOfWeek dayOfWeek = parseDayOfWeek(value.substring(0, idx));
<del> int ordinal = Integer.parseInt(value.substring(idx + 1));
<add> int ordinal = Integer.parseInt(value, idx + 1, value.length(), 10);
<ide> if (ordinal <= 0) {
<ide> throw new IllegalArgumentException("Ordinal '" + ordinal + "' in '" + value +
<ide> "' must be positive number ");
<ide><path>spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceFactoryBeanTests.java
<ide> /*
<del> * Copyright 2002-2019 the original author or authors.
<add> * Copyright 2002-2021 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 Parser<?> getParser(SpecialInt annotation, Class<?> fieldType) {
<ide> return new Parser<Integer>() {
<ide> @Override
<ide> public Integer parse(String text, Locale locale) throws ParseException {
<del> return Integer.parseInt(text.substring(1));
<add> return Integer.parseInt(text, 1, text.length(), 10);
<ide> }
<ide> };
<ide> }
<ide><path>spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java
<ide> public void setConcurrency(String concurrency) {
<ide> try {
<ide> int separatorIndex = concurrency.indexOf('-');
<ide> if (separatorIndex != -1) {
<del> setConcurrentConsumers(Integer.parseInt(concurrency.substring(0, separatorIndex)));
<del> setMaxConcurrentConsumers(Integer.parseInt(concurrency.substring(separatorIndex + 1)));
<add> setConcurrentConsumers(Integer.parseInt(concurrency, 0, separatorIndex, 10));
<add> setMaxConcurrentConsumers(Integer.parseInt(concurrency, separatorIndex + 1, concurrency.length(), 10));
<ide> }
<ide> else {
<ide> setConcurrentConsumers(1);
<ide><path>spring-jms/src/main/java/org/springframework/jms/listener/SimpleMessageListenerContainer.java
<ide> public void setConcurrency(String concurrency) {
<ide> try {
<ide> int separatorIndex = concurrency.indexOf('-');
<ide> if (separatorIndex != -1) {
<del> setConcurrentConsumers(Integer.parseInt(concurrency.substring(separatorIndex + 1)));
<add> setConcurrentConsumers(Integer.parseInt(concurrency, separatorIndex + 1, concurrency.length(), 10));
<ide> }
<ide> else {
<ide> setConcurrentConsumers(Integer.parseInt(concurrency));
<ide><path>spring-jms/src/main/java/org/springframework/jms/listener/endpoint/JmsActivationSpecConfig.java
<ide> /*
<del> * Copyright 2002-2020 the original author or authors.
<add> * Copyright 2002-2021 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 setConcurrency(String concurrency) {
<ide> try {
<ide> int separatorIndex = concurrency.indexOf('-');
<ide> if (separatorIndex != -1) {
<del> setMaxConcurrency(Integer.parseInt(concurrency.substring(separatorIndex + 1)));
<add> setMaxConcurrency(Integer.parseInt(concurrency, separatorIndex + 1, concurrency.length(), 10));
<ide> }
<ide> else {
<ide> setMaxConcurrency(Integer.parseInt(concurrency));
<ide><path>spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java
<ide> public int getServerPort() {
<ide> idx = host.indexOf(':');
<ide> }
<ide> if (idx != -1) {
<del> return Integer.parseInt(host.substring(idx + 1));
<add> return Integer.parseInt(host, idx + 1, host.length(), 10);
<ide> }
<ide> }
<ide>
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java
<ide> private static URI resolveBaseUrl(HttpServerRequest request) throws URISyntaxExc
<ide> if (portIndex != -1) {
<ide> try {
<ide> return new URI(scheme, null, header.substring(0, portIndex),
<del> Integer.parseInt(header.substring(portIndex + 1)), null, null, null);
<add> Integer.parseInt(header, portIndex + 1, header.length(), 10), null, null, null);
<ide> }
<ide> catch (NumberFormatException ex) {
<ide> throw new URISyntaxException(header, "Unable to parse port", portIndex);
<ide><path>spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java
<ide> public static InetSocketAddress parseForwardedFor(
<ide> }
<ide> host = value.substring(0, portSeparatorIdx);
<ide> try {
<del> port = Integer.parseInt(value.substring(portSeparatorIdx + 1));
<add> port = Integer.parseInt(value, portSeparatorIdx + 1, value.length(), 10);
<ide> }
<ide> catch (NumberFormatException ex) {
<ide> throw new IllegalArgumentException(
<ide> private void adaptForwardedHost(String rawValue) {
<ide> throw new IllegalArgumentException("Invalid IPv4 address: " + rawValue);
<ide> }
<ide> host(rawValue.substring(0, portSeparatorIdx));
<del> port(Integer.parseInt(rawValue.substring(portSeparatorIdx + 1)));
<add> port(Integer.parseInt(rawValue, portSeparatorIdx + 1, rawValue.length(), 10));
<ide> }
<ide> else {
<ide> host(rawValue);
<ide><path>spring-web/src/test/java/org/springframework/web/util/HtmlCharacterEntityReferencesTests.java
<ide> /*
<del> * Copyright 2002-2020 the original author or authors.
<add> * Copyright 2002-2021 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> private boolean navigateToNextEntity() throws IOException {
<ide> private int nextReferredCharacterId() throws IOException {
<ide> String reference = nextWordToken();
<ide> if (reference != null && reference.startsWith("&#") && reference.endsWith(";")) {
<del> return Integer.parseInt(reference.substring(2, reference.length() - 1));
<add> return Integer.parseInt(reference, 2, reference.length() - 1, 10);
<ide> }
<ide> return -1;
<ide> }
<ide><path>spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletRequest.java
<ide> public int getServerPort() {
<ide> idx = host.indexOf(':');
<ide> }
<ide> if (idx != -1) {
<del> return Integer.parseInt(host.substring(idx + 1));
<add> return Integer.parseInt(host, idx + 1, host.length(), 10);
<ide> }
<ide> }
<ide> | 13 |
Javascript | Javascript | restore 1.8.1 ajax crossdomain logic. close gh-944 | da3ff3afe4d8421ae4ad04d6653f04ed6d7768e3 | <ide><path>src/ajax.js
<ide> jQuery.extend({
<ide>
<ide> // A cross-domain request is in order when we have a protocol:host:port mismatch
<ide> if ( s.crossDomain == null ) {
<del> parts = rurl.exec( s.url.toLowerCase() ) || false;
<del> s.crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !==
<del> ( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) );
<add> parts = rurl.exec( s.url.toLowerCase() );
<add> s.crossDomain = !!( parts &&
<add> ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
<add> ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
<add> ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
<add> );
<ide> }
<ide>
<ide> // Convert data if not already a string
<ide><path>test/unit/ajax.js
<ide> test(".ajax() - hash", function() {
<ide>
<ide> test("jQuery ajax - cross-domain detection", function() {
<ide>
<del> expect( 6 );
<add> expect( 7 );
<ide>
<ide> var loc = document.location,
<add> samePort = loc.port || ( loc.protocol === "http:" ? 80 : 443 ),
<ide> otherPort = loc.port === 666 ? 667 : 666,
<ide> otherProtocol = loc.protocol === "http:" ? "https:" : "http:";
<ide>
<add> jQuery.ajax({
<add> dataType: "jsonp",
<add> url: loc.protocol + "//" + loc.host + ":" + samePort,
<add> beforeSend: function( _ , s ) {
<add> ok( !s.crossDomain , "Test matching ports are not detected as cross-domain" );
<add> return false;
<add> }
<add> });
<add>
<ide> jQuery.ajax({
<ide> dataType: "jsonp",
<ide> url: otherProtocol + "//" + loc.host, | 2 |
Python | Python | make test work for python 2.7 | 40edb65ee751dfe4cf6e04ee59891266d8b14f30 | <ide><path>spacy/tests/regression/test_issue1380.py
<add>from __future__ import unicode_literals
<ide> import pytest
<ide>
<ide> from ...language import Language | 1 |
Python | Python | clarify relationship between row_stack and vstack | 06e413f6a3041ce484901e3a33389028362cd012 | <ide><path>numpy/core/shape_base.py
<ide> def vstack(tup, *, dtype=None, casting="same_kind"):
<ide> and r/g/b channels (third axis). The functions `concatenate`, `stack` and
<ide> `block` provide more general stacking and concatenation operations.
<ide>
<add> ``np.row_stack`` is an alias for `vstack`. They are the same function.
<add>
<ide> Parameters
<ide> ----------
<ide> tup : sequence of ndarrays | 1 |
Ruby | Ruby | use sha1 as the default checksum for new formulae | 73d047d3ac4fd2d3b6fc87caf92f9e08b5bcb1e9 | <ide><path>Library/Homebrew/cmd/create.rb
<ide> def __gets
<ide>
<ide> class FormulaCreator
<ide> attr :url
<del> attr :md5
<add> attr :sha1
<ide> attr :name, true
<ide> attr :path, true
<ide> attr :mode, true
<ide> def generate
<ide>
<ide> unless ARGV.include? "--no-fetch" and version
<ide> strategy = detect_download_strategy url
<del> @md5 = strategy.new(url, name, version, nil).fetch.md5 if strategy == CurlDownloadStrategy
<add> @sha1 = strategy.new(url, name, version, nil).fetch.sha1 if strategy == CurlDownloadStrategy
<ide> end
<ide>
<ide> path.write ERB.new(template, nil, '>').result(binding)
<ide> def template; <<-EOS.undent
<ide> class #{Formula.class_s name} < Formula
<ide> homepage ''
<ide> url '#{url}'
<del> md5 '#{md5}'
<add> sha1 '#{sha1}'
<ide>
<ide> <% if mode == :cmake %>
<ide> depends_on 'cmake' => :build | 1 |
Javascript | Javascript | add quotation marks to reserved keyword "short" | 502bb648ff8e8250d29c65c9690500c6a3b40e92 | <ide><path>src/ng/locale.js
<ide> function $LocaleProvider(){
<ide> SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','),
<ide> AMPMS: ['AM','PM'],
<ide> medium: 'MMM d, y h:mm:ss a',
<del> short: 'M/d/yy h:mm a',
<add> 'short': 'M/d/yy h:mm a',
<ide> fullDate: 'EEEE, MMMM d, y',
<ide> longDate: 'MMMM d, y',
<ide> mediumDate: 'MMM d, y', | 1 |
Text | Text | codify security release commit message | b3be0bf21aab2837d64b33e44a54a80230e50465 | <ide><path>doc/releases.md
<ide> Notable changes:
<ide> * Copy the notable changes list here, reformatted for plain-text
<ide> ```
<ide>
<add>For security releases, begin the commit message with the phrase
<add>`This is a security release.` to allow the
<add>[distribution indexer](https://github.com/nodejs/nodejs-dist-indexer) to
<add>identify it as such:
<add>
<add>```txt
<add>YYYY-MM-DD, Version x.y.z (Release Type)
<add>
<add>This is a security release.
<add>
<add>Notable changes:
<add>
<add>* Copy the notable changes list here, reformatted for plain-text
<add>```
<add>
<ide> ### 6. Propose Release on GitHub
<ide>
<ide> Push the release branch to `nodejs/node`, not to your own fork. This allows | 1 |
Ruby | Ruby | remove dead code | 485eec407ae7f9791d120380d637bd43d9177851 | <ide><path>activerecord/lib/active_record/associations/join_dependency.rb
<ide> def build(associations, parent, join_type)
<ide> end
<ide> end
<ide>
<del> def build_scalar(reflection, parent, join_type)
<del> join_association = build_join_association(reflection, parent, join_type)
<del> parent.children << join_association
<del> end
<del>
<ide> def build_join_association(reflection, parent, join_type)
<ide> reflection.check_validity!
<ide> | 1 |
Ruby | Ruby | remove busted tests | 05b760d95991c75fbe3be83336d0a4479c66e803 | <ide><path>test/server_test.rb
<del>require 'test_helper'
<del>
<del># FIXME: Currently busted.
<del>#
<del># class ServerTest < ActionCableTest
<del># class ChatChannel < ActionCable::Channel::Base
<del># end
<del>#
<del># class ChatServer < ActionCable::Server::Base
<del># register_channels ChatChannel
<del># end
<del>#
<del># def app
<del># ChatServer
<del># end
<del>#
<del># test "channel registration" do
<del># assert_equal ChatServer.channel_classes, Set.new([ ChatChannel ])
<del># end
<del>#
<del># test "subscribing to a channel with valid params" do
<del># ws = Faye::WebSocket::Client.new(websocket_url)
<del>#
<del># ws.on(:message) do |message|
<del># puts message.inspect
<del># end
<del>#
<del># ws.send command: 'subscribe', identifier: { channel: 'chat'}.to_json
<del># end
<del>#
<del># test "subscribing to a channel with invalid params" do
<del># end
<del># end
<ide><path>test/test_helper.rb
<ide>
<ide> # Require all the stubs and models
<ide> Dir[File.dirname(__FILE__) + '/stubs/*.rb'].each {|file| require file }
<del>
<del>class ActionCableTest < ActiveSupport::TestCase
<del> PORT = 420420
<del>
<del> setup :start_puma_server
<del> teardown :stop_puma_server
<del>
<del> def start_puma_server
<del> events = Puma::Events.new(StringIO.new, StringIO.new)
<del> binder = Puma::Binder.new(events)
<del> binder.parse(["tcp://0.0.0.0:#{PORT}"], self)
<del> @server = Puma::Server.new(app, events)
<del> @server.binder = binder
<del> @server.run
<del> end
<del>
<del> def stop_puma_server
<del> @server.stop(true)
<del> end
<del>
<del> def websocket_url
<del> "ws://0.0.0.0:#{PORT}/"
<del> end
<del>
<del> def log(*args)
<del> end
<del>
<del>end | 2 |
PHP | PHP | allow _ in domain names that email can be sent to | 8dea5d8c6a5cb01e9e0e52948c8700f55a7c4d70 | <ide><path>src/Mailer/Email.php
<ide> class Email implements JsonSerializable, Serializable
<ide> *
<ide> * @var string
<ide> */
<del> const EMAIL_PATTERN = '/^((?:[\p{L}0-9.!#$%&\'*+\/=?^_`{|}~-]+)*@[\p{L}0-9-.]+)$/ui';
<add> const EMAIL_PATTERN = '/^((?:[\p{L}0-9.!#$%&\'*+\/=?^_`{|}~-]+)*@[\p{L}0-9-._]+)$/ui';
<ide>
<ide> /**
<ide> * Recipient of the email
<ide><path>tests/TestCase/Mailer/EmailTest.php
<ide> public function testTo()
<ide> $this->assertSame($this->Email, $result);
<ide> }
<ide>
<add> /**
<add> * test to address with _ in domain name
<add> *
<add> * @return void
<add> */
<add> public function testToUnderscoreDomain()
<add> {
<add> $result = $this->Email->to('cake@cake_php.org');
<add> $expected = ['cake@cake_php.org' => 'cake@cake_php.org'];
<add> $this->assertSame($expected, $this->Email->to());
<add> $this->assertSame($this->Email, $result);
<add> }
<add>
<ide> /**
<ide> * Data provider function for testBuildInvalidData
<ide> *
<ide> public function testJsonSerialize()
<ide> 'mimetype' => 'image/png'
<ide> ]
<ide> ],
<del> '_emailPattern' => '/^((?:[\p{L}0-9.!#$%&\'*+\/=?^_`{|}~-]+)*@[\p{L}0-9-.]+)$/ui'
<add> '_emailPattern' => '/^((?:[\p{L}0-9.!#$%&\'*+\/=?^_`{|}~-]+)*@[\p{L}0-9-._]+)$/ui'
<ide> ];
<ide> $this->assertEquals($expected, $result);
<ide> | 2 |
Text | Text | fix typo in changelog.md [ci skip] | 776384de5068b7bfad7de0b5f49aeccdd5c42d51 | <ide><path>activerecord/CHANGELOG.md
<del>* Deprecate mismatched collation comparison for uniquness validator.
<add>* Deprecate mismatched collation comparison for uniqueness validator.
<ide>
<ide> Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1.
<ide> To continue case sensitive comparison on the case insensitive column, | 1 |
Ruby | Ruby | add tests for implications | f1bf6c03c3f6585cdcc648ccc387ef933ab9a446 | <ide><path>Library/Homebrew/cask/audit.rb
<ide> class Audit
<ide>
<ide> attr_reader :cask, :download
<ide>
<del> attr_predicate :appcast?, :new_cask?, :strict?, :online?
<add> attr_predicate :appcast?, :new_cask?, :strict?, :online?, :token_conflicts?
<ide>
<ide> def initialize(cask, appcast: nil, download: nil, quarantine: nil,
<ide> token_conflicts: nil, online: nil, strict: nil,
<ide> def check_languages
<ide> end
<ide>
<ide> def check_token_conflicts
<del> return unless @token_conflicts
<add> return unless token_conflicts?
<ide> return unless core_formula_names.include?(cask.token)
<ide>
<ide> add_warning "possible duplicate, cask token conflicts with Homebrew core formula: #{core_formula_url}"
<ide><path>Library/Homebrew/test/cask/audit_spec.rb
<ide> def include_msg?(messages, msg)
<ide> end
<ide>
<ide> let(:cask) { instance_double(Cask::Cask) }
<del> let(:download) { false }
<del> let(:token_conflicts) { false }
<del> let(:strict) { false }
<del> let(:new_cask) { false }
<add> let(:new_cask) { nil }
<add> let(:online) { nil }
<add> let(:strict) { nil }
<add> let(:token_conflicts) { nil }
<ide> let(:audit) {
<del> described_class.new(cask, download: download,
<del> token_conflicts: token_conflicts,
<add> described_class.new(cask, online: online,
<add>
<ide> strict: strict,
<del> new_cask: new_cask)
<add> new_cask: new_cask,
<add> token_conflicts: token_conflicts)
<ide> }
<ide>
<add> describe "#new" do
<add> context "when `new_cask` is specified" do
<add> let(:new_cask) { true }
<add>
<add> it "implies `online`" do
<add> expect(audit).to be_online
<add> end
<add>
<add> it "implies `strict`" do
<add> expect(audit).to be_strict
<add> end
<add> end
<add>
<add> context "when `online` is specified" do
<add> let(:online) { true }
<add>
<add> it "implies `appcast`" do
<add> expect(audit.appcast?).to be true
<add> end
<add>
<add> it "implies `download`" do
<add> expect(audit.download).to be_truthy
<add> end
<add> end
<add>
<add> context "when `strict` is specified" do
<add> let(:strict) { true }
<add>
<add> it "implies `token_conflicts`" do
<add> expect(audit.token_conflicts?).to be true
<add> end
<add> end
<add> end
<add>
<ide> describe "#result" do
<ide> subject { audit.result }
<ide> | 2 |
Javascript | Javascript | allow disabling of default components | 94044afe74b9bbbff930eb3bb0024058423be175 | <ide><path>src/component.js
<ide> _V_.Component = _V_.Class.extend({
<ide> // Loop through components and add them to the player
<ide> this.eachProp(options.components, function(name, opts){
<ide>
<add> // Allow for disabling default components
<add> // e.g. _V_.options.components.posterImage = false
<add> if (opts === false) return;
<add>
<ide> // Allow waiting to add components until a specific event is called
<ide> var tempAdd = this.proxy(function(){
<ide> // Set property name on player. Could cause conflicts with other prop names, but it's worth making refs easy. | 1 |
Ruby | Ruby | simplify project view handling | c6b6fc678e66668b08d31e7a55950768e0e4d687 | <ide><path>Library/Homebrew/dev-cmd/edit.rb
<ide> def edit
<ide> end
<ide>
<ide> # If no brews are listed, open the project root in an editor.
<del> if ARGV.named.empty?
<del> editor = File.basename which_editor
<del> if ["atom", "subl", "mate"].include?(editor)
<del> # If the user is using Atom, Sublime Text or TextMate
<del> # give a nice project view instead.
<del> exec_editor HOMEBREW_REPOSITORY/"bin/brew",
<del> HOMEBREW_REPOSITORY/"README.md",
<del> HOMEBREW_REPOSITORY/".gitignore",
<del> *library_folders
<del> else
<del> exec_editor HOMEBREW_REPOSITORY
<del> end
<del> else
<del> # Don't use ARGV.formulae as that will throw if the file doesn't parse
<del> paths = ARGV.named.map do |name|
<del> path = Formulary.path(name)
<add> paths = [HOMEBREW_REPOSITORY] if ARGV.named.empty?
<ide>
<del> raise FormulaUnavailableError, name unless path.file? || args.force?
<del>
<del> path
<del> end
<del> exec_editor(*paths)
<add> # Don't use ARGV.formulae as that will throw if the file doesn't parse
<add> paths ||= ARGV.named.map do |name|
<add> path = Formulary.path(name)
<add> raise FormulaUnavailableError, name if !path.file? && !args.force?
<add> path
<ide> end
<del> end
<ide>
<del> def library_folders
<del> Dir["#{HOMEBREW_LIBRARY}/*"].reject do |d|
<del> case File.basename(d)
<del> when "LinkedKegs", "Aliases" then true
<del> end
<del> end
<add> exec_editor(*paths)
<ide> end
<ide> end | 1 |
Javascript | Javascript | fix prod tests | f4eb13b345afdfea9e0bc041d1aae2426be085e0 | <ide><path>packages/@ember/-internals/glimmer/tests/integration/components/link-to/query-params-curly-test.js
<ide> moduleFor(
<ide> }
<ide>
<ide> ['@test `(query-params)` must be used in conjunction with `{{link-to}}'](assert) {
<del> if (DEBUG) {
<del> this.addTemplate(
<del> 'index',
<del> `{{#let (query-params foo='456' bar='NAW') as |qp|}}{{link-to 'Index' 'index' qp}}{{/let}}`
<del> );
<del>
<del> return assert.rejectsAssertion(
<del> this.visit('/'),
<del> /The `\(query-params\)` helper can only be used when invoking the `{{link-to}}` component\./
<del> );
<add> if (!DEBUG) {
<add> assert.expect(0);
<add> return;
<ide> }
<add>
<add> this.addTemplate(
<add> 'index',
<add> `{{#let (query-params foo='456' bar='NAW') as |qp|}}{{link-to 'Index' 'index' qp}}{{/let}}`
<add> );
<add>
<add> return assert.rejectsAssertion(
<add> this.visit('/'),
<add> /The `\(query-params\)` helper can only be used when invoking the `{{link-to}}` component\./
<add> );
<ide> }
<ide> }
<ide> );
<ide><path>packages/@ember/-internals/glimmer/tests/integration/components/link-to/routing-angle-test.js
<ide> import { alias } from '@ember/-internals/metal';
<ide> import { subscribe, reset } from '@ember/instrumentation';
<ide> import { Route, NoneLocation } from '@ember/-internals/routing';
<ide> import { EMBER_IMPROVED_INSTRUMENTATION } from '@ember/canary-features';
<add>import { DEBUG } from '@glimmer/env';
<ide>
<ide> // IE includes the host name
<ide> function normalizeUrl(url) {
<ide> moduleFor(
<ide> }
<ide>
<ide> async [`@test the <LinkTo /> component throws a useful error if you invoke it wrong`](assert) {
<del> assert.expect(1);
<add> if (!DEBUG) {
<add> assert.expect(0);
<add> return;
<add> }
<ide>
<ide> this.router.map(function() {
<ide> this.route('post', { path: 'post/:post_id' });
<ide><path>packages/@ember/-internals/glimmer/tests/integration/components/link-to/routing-curly-test.js
<ide> import { alias } from '@ember/-internals/metal';
<ide> import { subscribe, reset } from '@ember/instrumentation';
<ide> import { Route, NoneLocation } from '@ember/-internals/routing';
<ide> import { EMBER_IMPROVED_INSTRUMENTATION } from '@ember/canary-features';
<add>import { DEBUG } from '@glimmer/env';
<ide>
<ide> // IE includes the host name
<ide> function normalizeUrl(url) {
<ide> moduleFor(
<ide> }
<ide>
<ide> async [`@test the {{link-to}} component throws a useful error if you invoke it wrong`](assert) {
<del> assert.expect(1);
<add> if (!DEBUG) {
<add> assert.expect(0);
<add> return;
<add> }
<ide>
<ide> this.router.map(function() {
<ide> this.route('post', { path: 'post/:post_id' }); | 3 |
Javascript | Javascript | add strict equalities in src/display/canvas.js | c1f1f2f0e10f102de2795a5fb32c3b0db7a55b52 | <ide><path>src/display/canvas.js
<ide> var CanvasGraphics = (function CanvasGraphicsClosure() {
<ide> // the current transformation matrix before the fillText/strokeText.
<ide> // See https://bugzilla.mozilla.org/show_bug.cgi?id=726227
<ide> var browserFontSize = size >= MIN_FONT_SIZE ? size : MIN_FONT_SIZE;
<del> this.current.fontSizeScale = browserFontSize != MIN_FONT_SIZE ? 1.0 :
<add> this.current.fontSizeScale = browserFontSize !== MIN_FONT_SIZE ? 1.0 :
<ide> size / MIN_FONT_SIZE;
<ide>
<ide> var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface;
<ide> var CanvasGraphics = (function CanvasGraphicsClosure() {
<ide> lineWidth /= scale;
<ide> }
<ide>
<del> if (fontSizeScale != 1.0) {
<add> if (fontSizeScale !== 1.0) {
<ide> ctx.scale(fontSizeScale, fontSizeScale);
<ide> lineWidth /= fontSizeScale;
<ide> } | 1 |
Ruby | Ruby | add config option for `replica` | 2fd997c111b3d2921d011d8023314dbfc2dec317 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
<ide> def initialize(connection, logger = nil, config = {}) # :nodoc:
<ide> )
<ide> end
<ide>
<add> def replica?
<add> @config[:replica] || false
<add> end
<add>
<ide> def migrations_paths # :nodoc:
<ide> @config[:migrations_paths] || Migrator.migrations_paths
<ide> end | 1 |
Javascript | Javascript | make reloads faster for simple file changes | 3f504ec147479374757987da6d66c77cb9b4675b | <ide><path>packager/react-packager/src/Bundler/Bundle.js
<ide> class Bundle extends BundleBase {
<ide> this._addRequireCall(super.getMainModuleId());
<ide> }
<ide>
<del> super.finalize();
<add> super.finalize(options);
<ide> }
<ide>
<ide> _addRequireCall(moduleId) {
<ide><path>packager/react-packager/src/Bundler/BundleBase.js
<ide> class BundleBase {
<ide> }
<ide>
<ide> finalize(options) {
<del> Object.freeze(this._modules);
<del> Object.freeze(this._assets);
<add> if (!options.allowUpdates) {
<add> Object.freeze(this._modules);
<add> Object.freeze(this._assets);
<add> }
<ide>
<ide> this._finalized = true;
<ide> }
<ide> class BundleBase {
<ide> return this._source;
<ide> }
<ide>
<add> invalidateSource() {
<add> this._source = null;
<add> }
<add>
<ide> assertFinalized(message) {
<ide> if (!this._finalized) {
<ide> throw new Error(message || 'Bundle needs to be finalized before getting any source');
<ide><path>packager/react-packager/src/Bundler/__tests__/Bundler-test.js
<ide> describe('Bundler', function() {
<ide> dependencies: modules,
<ide> transformOptions,
<ide> getModuleId: () => 123,
<add> getResolvedDependencyPairs: () => [],
<ide> })
<ide> );
<ide>
<ide> describe('Bundler', function() {
<ide> });
<ide> });
<ide>
<del> pit('create a bundle', function() {
<add> it('create a bundle', function() {
<ide> assetServer.getAssetData.mockImpl(() => {
<ide> return {
<ide> scales: [1,2,3],
<ide> describe('Bundler', function() {
<ide> expect(ithAddedModule(3)).toEqual('/root/img/new_image.png');
<ide> expect(ithAddedModule(4)).toEqual('/root/file.json');
<ide>
<del> expect(bundle.finalize.mock.calls[0]).toEqual([
<del> {runMainModule: true, runBeforeMainModule: []}
<del> ]);
<add> expect(bundle.finalize.mock.calls[0]).toEqual([{
<add> runMainModule: true,
<add> runBeforeMainModule: [],
<add> allowUpdates: false,
<add> }]);
<ide>
<ide> expect(bundle.addAsset.mock.calls[0]).toEqual([{
<ide> __packager_asset: true,
<ide><path>packager/react-packager/src/Bundler/index.js
<ide> const validateOpts = declareOpts({
<ide> type: 'boolean',
<ide> default: false,
<ide> },
<add> allowBundleUpdates: {
<add> type: 'boolean',
<add> default: false,
<add> },
<ide> });
<ide>
<ide> const assetPropertyBlacklist = new Set([
<ide> class Bundler {
<ide> bundle.finalize({
<ide> runMainModule,
<ide> runBeforeMainModule: runBeforeMainModuleIds,
<add> allowUpdates: this._opts.allowBundleUpdates,
<ide> });
<ide> return bundle;
<ide> });
<ide> class Bundler {
<ide> entryFilePath,
<ide> transformOptions: response.transformOptions,
<ide> getModuleId: response.getModuleId,
<add> dependencyPairs: response.getResolvedDependencyPairs(module),
<ide> }).then(transformed => {
<ide> modulesByName[transformed.name] = module;
<ide> onModuleTransformed({
<ide> class Bundler {
<ide> );
<ide> }
<ide>
<del> _toModuleTransport({module, bundle, entryFilePath, transformOptions, getModuleId}) {
<add> _toModuleTransport({
<add> module,
<add> bundle,
<add> entryFilePath,
<add> transformOptions,
<add> getModuleId,
<add> dependencyPairs,
<add> }) {
<ide> let moduleTransport;
<ide> const moduleId = getModuleId(module);
<ide>
<ide> class Bundler {
<ide> id: moduleId,
<ide> code,
<ide> map,
<del> meta: {dependencies, dependencyOffsets, preloaded},
<add> meta: {dependencies, dependencyOffsets, preloaded, dependencyPairs},
<ide> sourceCode: source,
<ide> sourcePath: module.path
<ide> });
<ide><path>packager/react-packager/src/Server/index.js
<ide> const mime = require('mime-types');
<ide> const path = require('path');
<ide> const url = require('url');
<ide>
<del>function debounce(fn, delay) {
<del> var timeout;
<del> return () => {
<add>const debug = require('debug')('ReactNativePackager:Server');
<add>
<add>function debounceAndBatch(fn, delay) {
<add> let timeout, args = [];
<add> return (value) => {
<add> args.push(value);
<ide> clearTimeout(timeout);
<del> timeout = setTimeout(fn, delay);
<add> timeout = setTimeout(() => {
<add> const a = args;
<add> args = [];
<add> fn(a);
<add> }, delay);
<ide> };
<ide> }
<ide>
<ide> const bundleOpts = declareOpts({
<ide> isolateModuleIDs: {
<ide> type: 'boolean',
<ide> default: false
<del> }
<add> },
<add> resolutionResponse: {
<add> type: 'object',
<add> },
<ide> });
<ide>
<ide> const dependencyOpts = declareOpts({
<ide> const dependencyOpts = declareOpts({
<ide> type: 'boolean',
<ide> default: false,
<ide> },
<add> minify: {
<add> type: 'boolean',
<add> default: undefined,
<add> },
<ide> });
<ide>
<add>const bundleDeps = new WeakMap();
<add>
<ide> class Server {
<ide> constructor(options) {
<ide> const opts = validateOpts(options);
<ide> class Server {
<ide> const bundlerOpts = Object.create(opts);
<ide> bundlerOpts.fileWatcher = this._fileWatcher;
<ide> bundlerOpts.assetServer = this._assetServer;
<add> bundlerOpts.allowBundleUpdates = !options.nonPersistent;
<ide> this._bundler = new Bundler(bundlerOpts);
<ide>
<ide> this._fileWatcher.on('all', this._onFileChange.bind(this));
<ide>
<del> this._debouncedFileChangeHandler = debounce(filePath => {
<del> this._clearBundles();
<add> this._debouncedFileChangeHandler = debounceAndBatch(filePaths => {
<add> // only clear bundles for non-JS changes
<add> if (filePaths.every(RegExp.prototype.test, /\.js(?:on)?$/i)) {
<add> for (const key in this._bundles) {
<add> this._bundles[key].then(bundle => {
<add> const deps = bundleDeps.get(bundle);
<add> filePaths.forEach(filePath => {
<add> if (deps.files.has(filePath)) {
<add> deps.outdated.add(filePath);
<add> }
<add> });
<add> });
<add> }
<add> } else {
<add> this._clearBundles();
<add> }
<ide> this._informChangeWatchers();
<ide> }, 50);
<ide> }
<ide> class Server {
<ide> }
<ide>
<ide> const opts = bundleOpts(options);
<del> return this._bundler.bundle(opts);
<add> const building = this._bundler.bundle(opts);
<add> building.then(bundle => {
<add> const modules = bundle.getModules().filter(m => !m.virtual);
<add> bundleDeps.set(bundle, {
<add> files: new Map(
<add> modules
<add> .map(({sourcePath, meta = {dependencies: []}}) =>
<add> [sourcePath, meta.dependencies])
<add> ),
<add> idToIndex: new Map(modules.map(({id}, i) => [id, i])),
<add> dependencyPairs: new Map(
<add> modules
<add> .filter(({meta}) => meta && meta.dependencyPairs)
<add> .map(m => [m.sourcePath, m.meta.dependencyPairs])
<add> ),
<add> outdated: new Set(),
<add> });
<add> });
<add> return building;
<ide> });
<ide> }
<ide>
<ide> class Server {
<ide> ).done(() => Activity.endEvent(assetEvent));
<ide> }
<ide>
<add> _useCachedOrUpdateOrCreateBundle(options) {
<add> const optionsJson = JSON.stringify(options);
<add> const bundleFromScratch = () => {
<add> const building = this.buildBundle(options);
<add> this._bundles[optionsJson] = building;
<add> return building;
<add> };
<add>
<add> if (optionsJson in this._bundles) {
<add> return this._bundles[optionsJson].then(bundle => {
<add> const deps = bundleDeps.get(bundle);
<add> const {dependencyPairs, files, idToIndex, outdated} = deps;
<add> if (outdated.size) {
<add> debug('Attempt to update existing bundle');
<add> const changedModules =
<add> Array.from(outdated, this.getModuleForPath, this);
<add> deps.outdated = new Set();
<add>
<add> const opts = bundleOpts(options);
<add> const {platform, dev, minify, hot} = opts;
<add>
<add> // Need to create a resolution response to pass to the bundler
<add> // to process requires after transform. By providing a
<add> // specific response we can compute a non recursive one which
<add> // is the least we need and improve performance.
<add> const bundlePromise = this._bundles[optionsJson] =
<add> this.getDependencies({
<add> platform, dev, hot, minify,
<add> entryFile: options.entryFile,
<add> recursive: false,
<add> }).then(response => {
<add> debug('Update bundle: rebuild shallow bundle');
<add>
<add> changedModules.forEach(m => {
<add> response.setResolvedDependencyPairs(
<add> m,
<add> dependencyPairs.get(m.path),
<add> {ignoreFinalized: true},
<add> );
<add> });
<add>
<add> return this.buildBundle({
<add> ...options,
<add> resolutionResponse: response.copy({
<add> dependencies: changedModules,
<add> })
<add> }).then(updateBundle => {
<add> const oldModules = bundle.getModules();
<add> const newModules = updateBundle.getModules();
<add> for (let i = 0, n = newModules.length; i < n; i++) {
<add> const moduleTransport = newModules[i];
<add> const {meta, sourcePath} = moduleTransport;
<add> if (outdated.has(sourcePath)) {
<add> if (!contentsEqual(meta.dependencies, new Set(files.get(sourcePath)))) {
<add> // bail out if any dependencies changed
<add> return Promise.reject(Error(
<add> `Dependencies of ${sourcePath} changed from [${
<add> files.get(sourcePath).join(', ')
<add> }] to [${meta.dependencies.join(', ')}]`
<add> ));
<add> }
<add>
<add> oldModules[idToIndex.get(moduleTransport.id)] = moduleTransport;
<add> }
<add> }
<add>
<add> bundle.invalidateSource();
<add> debug('Successfully updated existing bundle');
<add> return bundle;
<add> });
<add> }).catch(e => {
<add> debug('Failed to update existing bundle, rebuilding...', e.stack || e.message);
<add> return bundleFromScratch();
<add> });
<add> return bundlePromise;
<add> } else {
<add> debug('Using cached bundle');
<add> return bundle;
<add> }
<add> });
<add> }
<add>
<add> return bundleFromScratch();
<add> }
<add>
<ide> processRequest(req, res, next) {
<ide> const urlObj = url.parse(req.url, true);
<ide> const pathname = urlObj.pathname;
<ide> class Server {
<ide>
<ide> const startReqEventId = Activity.startEvent('request:' + req.url);
<ide> const options = this._getOptionsFromUrl(req.url);
<del> const optionsJson = JSON.stringify(options);
<del> const building = this._bundles[optionsJson] || this.buildBundle(options);
<del>
<del> this._bundles[optionsJson] = building;
<add> debug('Getting bundle for request');
<add> const building = this._useCachedOrUpdateOrCreateBundle(options);
<ide> building.then(
<ide> p => {
<ide> if (requestType === 'bundle') {
<add> debug('Generating source code');
<ide> const bundleSource = p.getSource({
<ide> inlineSourceMap: options.inlineSourceMap,
<ide> minify: options.minify,
<ide> dev: options.dev,
<ide> });
<add> debug('Writing response headers');
<ide> res.setHeader('Content-Type', 'application/javascript');
<ide> res.setHeader('ETag', p.getEtag());
<ide> if (req.headers['if-none-match'] === res.getHeader('ETag')){
<add> debug('Responding with 304');
<ide> res.statusCode = 304;
<ide> res.end();
<ide> } else {
<add> debug('Writing request body');
<ide> res.end(bundleSource);
<ide> }
<add> debug('Finished response');
<ide> Activity.endEvent(startReqEventId);
<ide> } else if (requestType === 'map') {
<ide> let sourceMap = p.getSourceMap({
<ide> class Server {
<ide> Activity.endEvent(startReqEventId);
<ide> }
<ide> },
<del> this._handleError.bind(this, res, optionsJson)
<add> error => this._handleError(res, JSON.stringify(options), error)
<ide> ).done();
<ide> }
<ide>
<ide> class Server {
<ide>
<ide> _sourceMapForURL(reqUrl) {
<ide> const options = this._getOptionsFromUrl(reqUrl);
<del> const optionsJson = JSON.stringify(options);
<del> const building = this._bundles[optionsJson] || this.buildBundle(options);
<del> this._bundles[optionsJson] = building;
<add> const building = this._useCachedOrUpdateOrCreateBundle(options);
<ide> return building.then(p => {
<ide> const sourceMap = p.getSourceMap({
<ide> minify: options.minify,
<ide> class Server {
<ide> }
<ide> }
<ide>
<add>function contentsEqual(array, set) {
<add> return array.length === set.size && array.every(set.has, set);
<add>}
<add>
<ide> module.exports = Server;
<ide><path>packager/react-packager/src/node-haste/DependencyGraph/ResolutionResponse.js
<ide> */
<ide> 'use strict';
<ide>
<add>const NO_OPTIONS = {};
<add>
<ide> class ResolutionResponse {
<ide> constructor({transformOptions}) {
<ide> this.transformOptions = transformOptions;
<ide> class ResolutionResponse {
<ide> this.numPrependedDependencies += 1;
<ide> }
<ide>
<del> setResolvedDependencyPairs(module, pairs) {
<del> this._assertNotFinalized();
<add> setResolvedDependencyPairs(module, pairs, options = NO_OPTIONS) {
<add> if (!options.ignoreFinalized) {
<add> this._assertNotFinalized();
<add> }
<ide> const hash = module.hash();
<ide> if (this._mappings[hash] == null) {
<ide> this._mappings[hash] = pairs; | 6 |
Java | Java | use initcause to initialize assertionerror | 596ecd2a53f119086d406da21f0190a257437743 | <ide><path>src/main/java/rx/observers/TestSubscriber.java
<ide> public void assertError(Class<? extends Throwable> clazz) {
<ide> throw new AssertionError("No errors");
<ide> } else
<ide> if (err.size() > 1) {
<del> // can't use AssertionError because (message, cause) doesn't exist until Java 7
<del> throw new RuntimeException("Multiple errors: " + err.size(), new CompositeException(err));
<add> AssertionError ae = new AssertionError("Multiple errors: " + err.size());
<add> ae.initCause(new CompositeException(err));
<add> throw ae;
<ide> } else
<ide> if (!clazz.isInstance(err.get(0))) {
<del> // can't use AssertionError because (message, cause) doesn't exist until Java 7
<del> throw new RuntimeException("Exceptions differ; expected: " + clazz + ", actual: " + err.get(0), err.get(0));
<add> AssertionError ae = new AssertionError("Exceptions differ; expected: " + clazz + ", actual: " + err.get(0));
<add> ae.initCause(err.get(0));
<add> throw ae;
<ide> }
<ide> }
<ide>
<ide> public void assertError(Throwable throwable) {
<ide> throw new AssertionError("No errors");
<ide> } else
<ide> if (err.size() > 1) {
<del> // can't use AssertionError because (message, cause) doesn't exist until Java 7
<del> throw new RuntimeException("Multiple errors: " + err.size(), new CompositeException(err));
<add> AssertionError ae = new AssertionError("Multiple errors: " + err.size());
<add> ae.initCause(new CompositeException(err));
<add> throw ae;
<ide> } else
<ide> if (!throwable.equals(err.get(0))) {
<del> // can't use AssertionError because (message, cause) doesn't exist until Java 7
<del> throw new RuntimeException("Exceptions differ; expected: " + throwable + ", actual: " + err.get(0), err.get(0));
<add> AssertionError ae = new AssertionError("Exceptions differ; expected: " + throwable + ", actual: " + err.get(0));
<add> ae.initCause(err.get(0));
<add> throw ae;
<ide> }
<ide> }
<ide>
<ide> public void assertNoTerminalEvent() {
<ide> throw new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none");
<ide> } else
<ide> if (err.size() == 1) {
<del> // can't use AssertionError because (message, cause) doesn't exist until Java 7
<del> throw new RuntimeException("Found " + err.size() + " errors and " + s + " completion events instead of none", err.get(0));
<add> AssertionError ae = new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none");
<add> ae.initCause(err.get(0));
<add> throw ae;
<ide> } else {
<del> // can't use AssertionError because (message, cause) doesn't exist until Java 7
<del> throw new RuntimeException("Found " + err.size() + " errors and " + s + " completion events instead of none", new CompositeException(err));
<add> AssertionError ae = new AssertionError("Found " + err.size() + " errors and " + s + " completion events instead of none");
<add> ae.initCause(new CompositeException(err));
<add> throw ae;
<ide> }
<ide> }
<ide> } | 1 |
Python | Python | add a test for ticket | 0713354fa282f096e30886e7617d84ee2938390d | <ide><path>numpy/core/tests/test_regression.py
<ide> def test_searchsorted_wrong_dtype(self):
<ide> # proper exception.
<ide> a = np.array([('a', 1)], dtype='S1, int')
<ide> assert_raises(TypeError, np.searchsorted, a, 1.2)
<add> # Ticket #2066, similar problem:
<add> dtype = np.format_parser(['i4', 'i4'], [], [])
<add> a = np.recarray((2, ), dtype)
<add> assert_raises(TypeError, np.searchsorted, a, 1)
<ide>
<ide> if __name__ == "__main__":
<ide> run_module_suite() | 1 |
Text | Text | add introduction sentence for cjs | 2dea9ccd8a5e8776b232740fa3fc3af93c335d92 | <ide><path>doc/api/modules.md
<ide>
<ide> <!--name=module-->
<ide>
<del>In the Node.js module system, each file is treated as a separate module. For
<add>CommonJS modules are the original way to package JavaScript code for Node.js.
<add>Node.js also supports the [ECMAScript modules][] standard used by browsers
<add>and other JavaScript runtimes.
<add>
<add>In Node.js, each file is treated as a separate module. For
<ide> example, consider a file named `foo.js`:
<ide>
<ide> ```js | 1 |
Javascript | Javascript | add test for profile command of node inspect | 887816d8f23830634e3824ed62278b28e956d2c0 | <ide><path>test/sequential/test-debugger-profile-command.js
<add>'use strict';
<add>const common = require('../common');
<add>
<add>common.skipIfInspectorDisabled();
<add>
<add>const fixtures = require('../common/fixtures');
<add>const startCLI = require('../common/debugger');
<add>
<add>const assert = require('assert');
<add>const fs = require('fs');
<add>const path = require('path');
<add>
<add>const cli = startCLI([fixtures.path('debugger/empty.js')]);
<add>
<add>const rootDir = path.resolve(__dirname, '..', '..');
<add>
<add>(async () => {
<add> await cli.waitForInitialBreak();
<add> await cli.waitForPrompt();
<add> await cli.command('profile');
<add> await cli.command('profileEnd');
<add> assert.match(cli.output, /\[Profile \d+μs\]/);
<add> await cli.command('profiles');
<add> assert.match(cli.output, /\[ \[Profile \d+μs\] \]/);
<add> await cli.command('profiles[0].save()');
<add> assert.match(cli.output, /Saved profile to .*node\.cpuprofile/);
<add>
<add> const cpuprofile = path.resolve(rootDir, 'node.cpuprofile');
<add> const data = JSON.parse(fs.readFileSync(cpuprofile, 'utf8'));
<add> assert.strictEqual(Array.isArray(data.nodes), true);
<add>
<add> fs.rmSync(cpuprofile);
<add>})()
<add>.then(common.mustCall())
<add>.finally(() => cli.quit()); | 1 |
Text | Text | fix a typo | a10d49b75a8f2d7a2a87d30f340f20a0ffebec3d | <ide><path>curriculum/challenges/english/09-information-security/information-security-projects/port-scanner.md
<ide> get_open_ports("www.stackoverflow.com", [79, 82])
<ide>
<ide> The function should return a list of open ports in the given range.
<ide>
<del>The `get_open_ports` function should also take an optional third argument of `True` to indicate "Verbose" mode. If this is set to true, the function shourd return a descriptive string instead of a list of ports.
<add>The `get_open_ports` function should also take an optional third argument of `True` to indicate "Verbose" mode. If this is set to true, the function should return a descriptive string instead of a list of ports.
<ide>
<ide> Here is the format of the string that should be returned in verbose mode (text inside `{}` indicates the information that should appear):
<ide> | 1 |
Python | Python | fix internal lint errors | 7546a9e3d1c51798bd20407ea1749e13b87b0368 | <ide><path>official/recommendation/ncf_common.py
<ide> def xla_validator(flag_dict):
<ide> help=flags_core.help_wrap(
<ide> "If True, we use a custom training loop for keras."))
<ide>
<add>
<ide> def convert_to_softmax_logits(logits):
<ide> '''Convert the logits returned by the base model to softmax logits.
<ide>
<ide><path>official/recommendation/ncf_keras_main.py
<ide> def step_fn(inputs):
<ide> train_loss += train_step()
<ide> time_callback.on_batch_end(step+epoch*num_train_steps)
<ide> logging.info("Done training epoch %s, epoch loss=%s.",
<del> epoch+1, train_loss/num_train_steps)
<add> epoch+1, train_loss/num_train_steps)
<ide> eval_input_iterator.initialize()
<ide> hr_sum = 0
<ide> hr_count = 0
<ide><path>official/resnet/keras/keras_imagenet_benchmark.py
<ide> def benchmark_xla_8_gpu_fp16_tweaked(self):
<ide> self._run_and_report_benchmark()
<ide>
<ide> def benchmark_xla_8_gpu_fp16_cloning_tweaked(self):
<del> """Test Keras model with manual config tuning, XLA, 8 GPUs, fp16, and
<del> cloning.
<del> """
<add> """Test with manual config tuning, XLA, 8 GPUs, fp16, and cloning."""
<ide> self._setup()
<ide>
<ide> FLAGS.num_gpus = 8
<ide> def benchmark_xla_8_gpu_fp16_cloning_tweaked(self):
<ide> self._run_and_report_benchmark()
<ide>
<ide> def benchmark_xla_8_gpu_fp16_tweaked_delay_measure(self):
<del> """Test Keras model with manual config tuning, XLA, 8 GPUs and fp16. Delay
<del> performance measurement for stable performance on 96 vCPU platforms.
<add> """Test with manual config tuning, XLA, 8 GPUs and fp16.
<add>
<add> Delay performance measurement for stable performance on 96 vCPU platforms.
<ide> """
<ide> self._setup()
<ide>
<ide> def benchmark_xla_8_gpu_fp16_tweaked_delay_measure(self):
<ide> self._run_and_report_benchmark()
<ide>
<ide> def benchmark_xla_8_gpu_fp16_cloning_tweaked_delay_measure(self):
<del> """Test Keras model with manual config tuning, XLA, 8 GPUs, fp16, and
<del> cloning. Delay performance measurement for stable performance on 96 vCPU
<del> platforms.
<add> """Test with manual config tuning, XLA, 8 GPUs, fp16, and cloning.
<add>
<add> Delay performance measurement for stable performance on 96 vCPU platforms.
<ide> """
<ide> self._setup()
<ide>
<ide> def benchmark_graph_xla_8_gpu_fp16_tweaked(self):
<ide> self._run_and_report_benchmark()
<ide>
<ide> def benchmark_graph_xla_8_gpu_fp16_tweaked_delay_measure(self):
<del> """Test Keras model in legacy graph mode with manual config tuning, XLA,
<del> 8 GPUs and fp16. Delay performance measurement for stable performance
<del> on 96 vCPU platforms.
<add> """Test in legacy graph mode with manual config tuning, XLA, 8 GPUs, fp16.
<add>
<add> Delay performance measurement for stable performance on 96 vCPU platforms.
<ide> """
<ide> self._setup()
<ide>
<ide> def benchmark_graph_xla_8_gpu_fp16_tweaked_delay_measure(self):
<ide> self._run_and_report_benchmark()
<ide>
<ide> def benchmark_graph_xla_8_gpu_fp16_tweaked_optional_next(self):
<del> """Test Keras model in legacy graph mode with manual config tuning, XLA,
<del> 8 GPUs and fp16.
<add> """Test in legacy graph mode with manual config tuning, XLA, 8 GPUs, fp16.
<ide>
<ide> This test also enables get_next_as_optional.
<ide> """
<ide><path>official/transformer/v2/data_pipeline.py
<ide> def _read_and_batch_from_files(
<ide> ([max_length], [max_length]), drop_remainder=True)
<ide> else:
<ide> # Group and batch such that each batch has examples of similar length.
<del> # TODO: _batch_examples might need to do something special for num_replicas.
<add> # TODO(xunkai): _batch_examples might need to do something special for
<add> # num_replicas.
<ide> dataset = _batch_examples(dataset, batch_size, max_length)
<ide>
<ide> dataset = dataset.repeat(repeat)
<ide><path>official/transformer/v2/transformer_main.py
<ide> import os
<ide> import tempfile
<ide>
<del>from absl import app as absl_app
<add>from absl import app as absl_app # pylint: disable=unused-import
<ide> from absl import flags
<ide> import tensorflow as tf
<ide> | 5 |
Go | Go | remove unnecessary initerr type | b65e57bed534b00350d091db1894fdff1c4230d5 | <ide><path>cli/cli.go
<ide> func New(handlers ...Handler) *Cli {
<ide> return cli
<ide> }
<ide>
<del>// initErr is an error returned upon initialization of a handler implementing Initializer.
<del>type initErr struct{ error }
<del>
<del>func (err initErr) Error() string {
<del> return err.Error()
<del>}
<add>var errCommandNotFound = errors.New("command not found")
<ide>
<ide> func (cli *Cli) command(args ...string) (func(...string) error, error) {
<ide> for _, c := range cli.handlers {
<ide> func (cli *Cli) command(args ...string) (func(...string) error, error) {
<ide> if cmd := c.Command(strings.Join(args, " ")); cmd != nil {
<ide> if ci, ok := c.(Initializer); ok {
<ide> if err := ci.Initialize(); err != nil {
<del> return nil, initErr{err}
<add> return nil, err
<ide> }
<ide> }
<ide> return cmd, nil
<ide> }
<ide> }
<del> return nil, errors.New("command not found")
<add> return nil, errCommandNotFound
<ide> }
<ide>
<ide> // Run executes the specified command.
<ide> func (cli *Cli) Run(args ...string) error {
<ide> if len(args) > 1 {
<ide> command, err := cli.command(args[:2]...)
<del> switch err := err.(type) {
<del> case nil:
<add> if err == nil {
<ide> return command(args[2:]...)
<del> case initErr:
<del> return err.error
<add> }
<add> if err != errCommandNotFound {
<add> return err
<ide> }
<ide> }
<ide> if len(args) > 0 {
<ide> command, err := cli.command(args[0])
<del> switch err := err.(type) {
<del> case nil:
<del> return command(args[1:]...)
<del> case initErr:
<del> return err.error
<add> if err != nil {
<add> if err == errCommandNotFound {
<add> cli.noSuchCommand(args[0])
<add> return nil
<add> }
<add> return err
<ide> }
<del> cli.noSuchCommand(args[0])
<add> return command(args[1:]...)
<ide> }
<ide> return cli.CmdHelp()
<ide> }
<ide> func (cli *Cli) Command(name string) func(...string) error {
<ide> func (cli *Cli) CmdHelp(args ...string) error {
<ide> if len(args) > 1 {
<ide> command, err := cli.command(args[:2]...)
<del> switch err := err.(type) {
<del> case nil:
<add> if err == nil {
<ide> command("--help")
<ide> return nil
<del> case initErr:
<del> return err.error
<add> }
<add> if err != errCommandNotFound {
<add> return err
<ide> }
<ide> }
<ide> if len(args) > 0 {
<ide> command, err := cli.command(args[0])
<del> switch err := err.(type) {
<del> case nil:
<del> command("--help")
<del> return nil
<del> case initErr:
<del> return err.error
<add> if err != nil {
<add> if err == errCommandNotFound {
<add> cli.noSuchCommand(args[0])
<add> return nil
<add> }
<add> return err
<ide> }
<del> cli.noSuchCommand(args[0])
<add> command("--help")
<add> return nil
<ide> }
<ide>
<ide> if cli.Usage == nil { | 1 |
Text | Text | fix some typos in roadmap.md | 974294600fcbe3d3030a1edbbbf2b927d902e42e | <ide><path>ROADMAP.md
<ide> Moby currently only utilizes containerd for basic runtime state management, e.g.
<ide> and stopping a container, which is what the pre-containerd 1.0 daemon provided.
<ide> Now that containerd is a full-fledged container runtime which supports full
<ide> container life-cycle management, we would like to start relying more on containerd
<del>and removing the bits in Moby which are now duplicated. This will neccessitate
<del>a signficant effort to refactor and even remove large parts of Moby's codebase.
<add>and removing the bits in Moby which are now duplicated. This will necessitate
<add>a significant effort to refactor and even remove large parts of Moby's codebase.
<ide>
<ide> Tracking issues:
<ide> | 1 |
Javascript | Javascript | publish local branch and delete | 4049c635abd2b6364b739c188f537511c99ccdef | <ide><path>script/lib/update-dependency/check-apm.js
<ide> module.exports = async function({ dependencies, packageDependencies }) {
<ide> const packages = await Promise.all(promises);
<ide> const outdatedPackages = [];
<ide> packages.map(dependency => {
<del> if (dependency.name) {
<add> if (dependency.hasOwnProperty('name')) {
<ide> const latestVersion = dependency.releases.latest;
<ide> const installed = packageDependencies[dependency.name];
<ide> if (latestVersion > installed) {
<ide><path>script/lib/update-dependency/git.js
<ide> module.exports = {
<ide> },
<ide> createCommit: async function({ moduleName, latest }) {
<ide> try {
<del> const commitMessage = `:arrow_up:${moduleName}@${latest}`;
<add> const commitMessage = `:arrow_up: ${moduleName}@${latest}`;
<ide> await git.add([packageJsonFilePath, packageLockFilePath]);
<ide> await git.commit(commitMessage);
<ide> } catch (ex) {
<ide> module.exports = {
<ide> },
<ide> publishBranch: async function(branch) {
<ide> try {
<del> return git.push('origin', branch);
<add> await git.push('origin', branch);
<ide> } catch (ex) {
<ide> throw Error(ex.message);
<ide> }
<ide><path>script/lib/update-dependency/main.js
<ide> const {
<ide> makeBranch,
<ide> createCommit,
<ide> switchToMaster,
<del> publishBranch
<add> publishBranch,
<add> deleteBranch
<ide> } = require('./git');
<ide> const {
<ide> updatePackageJson,
<ide> module.exports = async function() {
<ide> console.log(`pull request found!`);
<ide> } else {
<ide> console.log(`pull request not found!`);
<del> pendingPRs.push({ dependency, branch: newBranch });
<add> const pr = { dependency, branch: newBranch, branchIsRemote: false };
<add> // confirm if branch found is a local branch
<add> if (found.indexOf('remotes') === -1) {
<add> await publishBranch(found);
<add> } else {
<add> pr.branchIsRemote = true;
<add> }
<add> pendingPRs.push(pr);
<ide> }
<ide> } else {
<ide> await updatePackageJson(dependency);
<ide> await runApmInstall();
<ide> await createCommit(dependency);
<ide> await publishBranch(newBranch);
<del> pendingPRs.push({ dependency, branch: newBranch });
<add> pendingPRs.push({
<add> dependency,
<add> branch: newBranch,
<add> branchIsRemote: false
<add> });
<ide> }
<ide>
<ide> await switchToMaster();
<ide> }
<ide> // create PRs here
<del> for (const { dependency, branch } of pendingPRs) {
<add> for (const { dependency, branch, branchIsRemote } of pendingPRs) {
<ide> const { status } = await createPR(dependency, branch);
<ide> status === 201
<ide> ? successfullBumps.push(dependency)
<ide> : failedBumps.push({
<ide> module: dependency.moduleName,
<ide> reason: `couldn't create pull request`
<ide> });
<add>
<add> if (!branchIsRemote) {
<add> await deleteBranch(branch);
<add> }
<ide> // https://developer.github.com/v3/guides/best-practices-for-integrators/#dealing-with-abuse-rate-limits
<ide> await sleep(2000);
<ide> }
<ide> module.exports = async function() {
<ide> // TODO: log other useful information
<ide> } catch (ex) {
<ide> // TODO: handle errors
<add> console.log(ex.message);
<ide> }
<ide> };
<ide><path>script/lib/update-dependency/pull-request.js
<ide> module.exports = {
<ide> description = `*List of changes between ${moduleName}@${installed} and ${moduleName}@${latest}: https://github.com/atom/${moduleName}/compare/v${installed}...v${latest}*`;
<ide> }
<ide> return requestWithAuth('POST /repos/:owner/:repo/pulls', {
<del> title: `:arrow_up: ${moduleName}@${latest}`,
<add> title: `⬆️ ${moduleName}@${latest}`,
<ide> body: description,
<ide> base: 'master',
<ide> head: branch | 4 |
Javascript | Javascript | use alert to make users more aware of errors | 159da0de8e515c935d44bea5921fb1c18180776b | <ide><path>editor/js/Loader.js
<ide> var Loader = function ( editor ) {
<ide>
<ide> if ( isGLTF1( contents ) ) {
<ide>
<del> console.error( 'Import of glTF asset not possible. Only versions >= 2.0 are supported. Please try to upgrade the file to glTF 2.0 using glTF-Pipeline.' );
<add> alert( 'Import of glTF asset not possible. Only versions >= 2.0 are supported. Please try to upgrade the file to glTF 2.0 using glTF-Pipeline.' );
<ide>
<ide> } else {
<ide>
<ide> var Loader = function ( editor ) {
<ide>
<ide> } catch ( error ) {
<ide>
<del> console.error( error );
<add> alert( error );
<ide> return;
<ide>
<ide> } | 1 |
Text | Text | add missing fields for networksettings | 205844875cb848b04fef401d3e7fcc3a8959bba0 | <ide><path>docs/reference/api/docker_remote_api_v1.22.md
<ide> List containers
<ide> },
<ide> "SizeRw": 12288,
<ide> "SizeRootFs": 0,
<add> "HostConfig": {
<add> "NetworkMode": "default"
<add> },
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "IPAMConfig": null,
<add> "Links": null,
<add> "Aliases": null,
<ide> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
<ide> "Gateway": "172.17.0.1",
<ide> List containers
<ide> "Labels": {},
<ide> "SizeRw": 12288,
<ide> "SizeRootFs": 0,
<add> "HostConfig": {
<add> "NetworkMode": "default"
<add> },
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "IPAMConfig": null,
<add> "Links": null,
<add> "Aliases": null,
<ide> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
<ide> "Gateway": "172.17.0.1",
<ide> List containers
<ide> "Labels": {},
<ide> "SizeRw":12288,
<ide> "SizeRootFs":0,
<add> "HostConfig": {
<add> "NetworkMode": "default"
<add> },
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "IPAMConfig": null,
<add> "Links": null,
<add> "Aliases": null,
<ide> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
<ide> "Gateway": "172.17.0.1",
<ide> List containers
<ide> "Labels": {},
<ide> "SizeRw": 12288,
<ide> "SizeRootFs": 0,
<add> "HostConfig": {
<add> "NetworkMode": "default"
<add> },
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "IPAMConfig": null,
<add> "Links": null,
<add> "Aliases": null,
<ide> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
<ide> "Gateway": "172.17.0.1",
<ide><path>docs/reference/api/docker_remote_api_v1.23.md
<ide> List containers
<ide> },
<ide> "SizeRw": 12288,
<ide> "SizeRootFs": 0,
<add> "HostConfig": {
<add> "NetworkMode": "default"
<add> },
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "IPAMConfig": null,
<add> "Links": null,
<add> "Aliases": null,
<ide> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
<ide> "Gateway": "172.17.0.1",
<ide> List containers
<ide> "Labels": {},
<ide> "SizeRw": 12288,
<ide> "SizeRootFs": 0,
<add> "HostConfig": {
<add> "NetworkMode": "default"
<add> },
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "IPAMConfig": null,
<add> "Links": null,
<add> "Aliases": null,
<ide> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
<ide> "Gateway": "172.17.0.1",
<ide> List containers
<ide> "Labels": {},
<ide> "SizeRw":12288,
<ide> "SizeRootFs":0,
<add> "HostConfig": {
<add> "NetworkMode": "default"
<add> },
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "IPAMConfig": null,
<add> "Links": null,
<add> "Aliases": null,
<ide> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
<ide> "Gateway": "172.17.0.1",
<ide> List containers
<ide> "Labels": {},
<ide> "SizeRw": 12288,
<ide> "SizeRootFs": 0,
<add> "HostConfig": {
<add> "NetworkMode": "default"
<add> },
<ide> "NetworkSettings": {
<ide> "Networks": {
<ide> "bridge": {
<add> "IPAMConfig": null,
<add> "Links": null,
<add> "Aliases": null,
<ide> "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
<ide> "Gateway": "172.17.0.1", | 2 |
Ruby | Ruby | fix retry condition when auto-tapping deps | 9b4bb3d9e4b1ea9380595d9f673d86b529f6b297 | <ide><path>Library/Homebrew/formula_installer.rb
<ide> def prelude
<ide> end
<ide>
<ide> def verify_deps_exist
<del> f.recursive_dependencies.map(&:to_formula)
<del> rescue TapFormulaUnavailableError => e
<del> Homebrew.install_tap(e.user, e.repo)
<del> retry
<add> begin
<add> f.recursive_dependencies.map(&:to_formula)
<add> rescue TapFormulaUnavailableError => e
<add> if Homebrew.install_tap(e.user, e.repo)
<add> retry
<add> else
<add> raise
<add> end
<add> end
<ide> rescue FormulaUnavailableError => e
<ide> e.dependent = f.name
<ide> raise | 1 |
Text | Text | fix broken link for minitest. [ci skip] | 879f3169952a1a37f1ef4b7a8cc6383ac536ef5d | <ide><path>guides/source/testing.md
<ide> All the basic assertions such as `assert_equal` defined in `Minitest::Assertions
<ide>
<ide> Each of these classes include `Minitest::Assertions`, allowing us to use all of the basic assertions in our tests.
<ide>
<del>NOTE: For more information on `Minitest`, refer to [Minitest](http://ruby-doc.org/stdlib-2.2.2/libdoc/minitest/rdoc/MiniTest.html)
<add>NOTE: For more information on `Minitest`, refer to [Minitest](http://docs.seattlerb.org/minitest)
<ide>
<ide> Functional Tests for Your Controllers
<ide> ------------------------------------- | 1 |
Javascript | Javascript | remove console in quaternion | 72f72f4dc9c693305e29d5692dfe9ffeed6b5495 | <ide><path>test/unit/math/Quaternion.js
<ide> function slerpTestSkeleton( doSlerp, maxError ) {
<ide> result = doSlerp( [ 0, D, 0, D ], [ 0, -D, 0, D ], 0.5 );
<ide> ok( result.equals( 0, 0, 0, 1 ), "W-Unit from diagonals" );
<ide> ok( isNormal( result ), "Approximately normal (W-Unit)" );
<del>
<del> console.log( "maxNormError", maxNormError );
<del>
<ide> }
<ide>
<ide> | 1 |
Javascript | Javascript | add layout support to ember.view | 4331b5365034565ae1fadffb0a824c9e4967a00d | <ide><path>packages/ember-views/lib/views/view.js
<ide> Ember.View = Ember.Object.extend(
<ide> */
<ide> templateName: null,
<ide>
<add> /**
<add> The name of the layout to lookup if no layout is provided.
<add>
<add> Ember.View will look for a template with this name in this view's
<add> `templates` object. By default, this will be a global object
<add> shared in `Ember.TEMPLATES`.
<add>
<add> @type String
<add> @default null
<add> */
<add> layoutName: null,
<add>
<ide> /**
<ide> The hash in which to look for `templateName`.
<ide>
<ide> Ember.View = Ember.Object.extend(
<ide> template: Ember.computed(function(key, value) {
<ide> if (value !== undefined) { return value; }
<ide>
<del> var templateName = get(this, 'templateName'), template;
<add> var templateName = get(this, 'templateName'),
<add> template = this.templateForName(templateName, 'template');
<ide>
<del> if (templateName) { template = get(get(this, 'templates'), templateName); }
<add> return template || get(this, 'defaultTemplate');
<add> }).property('templateName').cacheable(),
<ide>
<del> // If there is no template but a templateName has been specified,
<del> // try to lookup as a spade module
<del> if (!template && templateName) {
<del> if ('undefined' !== require && require.exists) {
<del> if (require.exists(templateName)) { template = require(templateName); }
<del> }
<add> /**
<add> A view may contain a layout. A layout is a regular template but
<add> supercedes the `template` property during rendering. It is the
<add> responsibility of the layout template to retrieve the `template`
<add> property from the view and render it in the correct location.
<ide>
<del> if (!template) {
<del> throw new Ember.Error(fmt('%@ - Unable to find template "%@".', [this, templateName]));
<del> }
<add> This is useful for a view that has a shared wrapper, but which delegates
<add> the rendering of the contents of the wrapper to the `template` property
<add> on a subclass.
<add>
<add> @field
<add> @type Function
<add> */
<add> layout: Ember.computed(function(key, value) {
<add> if (arguments.length === 2) { return value; }
<add>
<add> var layoutName = get(this, 'layoutName'),
<add> layout = this.templateForName(layoutName, 'layout');
<add>
<add> return layout || get(this, 'defaultLayout');
<add> }).property('layoutName').cacheable(),
<add>
<add> templateForName: function(name, type) {
<add> if (!name) { return; }
<add>
<add> var templates = get(this, 'templates'),
<add> template = get(templates, name);
<add>
<add> if (!template) {
<add> throw new Ember.Error(fmt('%@ - Unable to find %@ "%@".', [this, type, name]));
<ide> }
<ide>
<del> // return the template, or undefined if no template was found
<del> return template || get(this, 'defaultTemplate');
<del> }).property('templateName').cacheable(),
<add> return template;
<add> },
<ide>
<ide> /**
<ide> The object from which templates should access properties.
<ide> Ember.View = Ember.Object.extend(
<ide> @param {Ember.RenderBuffer} buffer The render buffer
<ide> */
<ide> render: function(buffer) {
<del> var template = get(this, 'template');
<add> // If this view has a layout, it is the responsibility of the
<add> // the layout to render the view's template. Otherwise, render the template
<add> // directly.
<add> var template = get(this, 'layout') || get(this, 'template');
<ide>
<ide> if (template) {
<ide> var context = get(this, 'templateContext'),
<ide><path>packages/ember-views/tests/views/view/layout_test.js
<add>var set = Ember.set, get = Ember.get;
<add>
<add>module("Ember.View - Template Functionality");
<add>
<add>test("should call the function of the associated layout", function() {
<add> var view;
<add> var templateCalled = 0, layoutCalled = 0;
<add>
<add> view = Ember.View.create({
<add> layoutName: 'layout',
<add> templateName: 'template',
<add>
<add> templates: {
<add> template: function() {
<add> templateCalled++;
<add> },
<add>
<add> layout: function() {
<add> layoutCalled++;
<add> }
<add> }
<add> });
<add>
<add> view.createElement();
<add>
<add> equal(templateCalled, 0, "template is not called when layout is present");
<add> equal(layoutCalled, 1, "layout is called when layout is present");
<add>});
<add>
<add>test("should call the function of the associated template with itself as the context", function() {
<add> var view;
<add>
<add> view = Ember.View.create({
<add> layoutName: 'test_template',
<add>
<add> personName: "Tom DAAAALE",
<add>
<add> templates: Ember.Object.create({
<add> test_template: function(dataSource) {
<add> return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>";
<add> }
<add> })
<add> });
<add>
<add> view.createElement();
<add>
<add> equal("template was called for Tom DAAAALE", view.$('#twas-called').text(), "the named template was called with the view as the data source");
<add>});
<add>
<add>test("should fall back to defaultTemplate if neither template nor templateName are provided", function() {
<add> var View, view;
<add>
<add> View = Ember.View.extend({
<add> defaultLayout: function(dataSource) { return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>"; }
<add> });
<add>
<add> view = View.create({
<add> personName: "Tom DAAAALE"
<add> });
<add>
<add> view.createElement();
<add>
<add> equal("template was called for Tom DAAAALE", view.$('#twas-called').text(), "the named template was called with the view as the data source");
<add>});
<add>
<add>test("should not use defaultLayout if layout is provided", function() {
<add> var View, view;
<add>
<add> View = Ember.View.extend({
<add> layout: function() { return "foo"; },
<add> defaultLayout: function(dataSource) { return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>"; }
<add> });
<add>
<add> view = View.create();
<add> view.createElement();
<add>
<add> equal("foo", view.$().text(), "default layout was not printed");
<add>});
<add>
<add>test("the template property is available to the layout template", function() {
<add> var view = Ember.View.create({
<add> template: function(context, options) {
<add> options.data.buffer.push(" derp");
<add> },
<add>
<add> layout: function(context, options) {
<add> options.data.buffer.push("Herp");
<add> get(context, 'template')(context, options);
<add> }
<add> });
<add>
<add> view.createElement();
<add>
<add> equal("Herp derp", view.$().text(), "the layout has access to the template");
<add>}); | 2 |
Text | Text | remove incorrect apostrophe | c09ad1bedc8559b2e6eadf0e5b8f3732af2d9d29 | <ide><path>docs/topics/release-notes.md
<ide> You can determine your currently installed version using `pip freeze`:
<ide> ### Master
<ide>
<ide> * JSON renderer now deals with objects that implement a dict-like interface.
<del>* Bugfix: Refine behavior that call's model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.
<add>* Bugfix: Refine behavior that calls model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.
<ide>
<ide> ### 2.3.10
<ide> | 1 |
Text | Text | add documentation about deleting files | b973c259059b92b633388c5c067cd4de37712e53 | <ide><path>laravel/documentation/files.md
<ide>
<ide> - [Reading Files](#get)
<ide> - [Writing Files](#put)
<add>- [Removing files](#delete)
<ide> - [File Uploads](#upload)
<ide> - [File Extensions](#ext)
<ide> - [Checking File Types](#is)
<ide>
<ide> File::append('path/to/file', 'appended file content');
<ide>
<add><a name="delete"></a>
<add>## Removing Files
<add>
<add>#### Deleting a single file:
<add>
<add> File::delete('path/to/file');
<add>
<ide> <a name="upload"></a>
<ide> ## File Uploads
<ide> | 1 |
PHP | PHP | avoid double slash | 16228203c1a8338b5aea69f080b3d43dd9407159 | <ide><path>src/Routing/RouteBuilder.php
<ide> public function prefix($name, $params = [], callable $callback = null)
<ide> }
<ide> $name = Inflector::underscore($name);
<ide> if (isset($params['path'])) {
<del> $path = '/' . $params['path'];
<add> $path = ($params['path'][0] === '/' ? '' : '/') . $params['path'];
<ide> unset($params['path']);
<ide> } else {
<ide> $path = '/' . $name;
<ide><path>tests/TestCase/Routing/RouteBuilderTest.php
<ide> public function testPathWithDotInPrefix()
<ide> $r->prefix('v10', ['path' => 'v1.0'], function ($r2) {
<ide> $this->assertEquals('/admin/api/v1.0', $r2->path());
<ide> $this->assertEquals(['prefix' => 'admin/api/v10'], $r2->params());
<add> $r2->prefix('b1', ['path' => '/beta.1'], function ($r3) {
<add> $this->assertEquals('/admin/api/v1.0/beta.1', $r3->path());
<add> $this->assertEquals(['prefix' => 'admin/api/v10/b1'], $r3->params());
<add> });
<ide> });
<ide> });
<ide> $this->assertNull($res); | 2 |
Javascript | Javascript | rollup more leaf packages | cce1f08a9f8b7a0ecca3574d43be98691d761afe | <ide><path>ember-cli-build.js
<ide> const SHOULD_ROLLUP = true;
<ide>
<ide> module.exports = function(options) {
<ide> let tokenizer = simpleHTMLTokenizerES();
<del> let container = emberPkgES('container');
<add> let container = emberPkgES('container', SHOULD_ROLLUP, ['ember-debug', 'ember-utils', 'ember-environment']);
<ide> let emberMetal = emberPkgES('ember-metal', SHOULD_ROLLUP, ['ember-debug', 'ember-environment', 'ember-utils', '@glimmer/reference', 'require', 'backburner', 'ember-console']);
<del> let emberEnvironment = emberPkgES('ember-environment');
<del> let emberConsole = emberPkgES('ember-console');
<add> let emberEnvironment = emberPkgES('ember-environment', SHOULD_ROLLUP);
<add> let emberConsole = emberPkgES('ember-console', SHOULD_ROLLUP, ['ember-environment']);
<ide> let emberMain = emberPkgES('ember');
<ide> let emberViews = emberPkgES('ember-views');
<ide> let emberApplication = emberPkgES('ember-application');
<ide> module.exports = function(options) {
<ide> let emberRouting = emberPkgES('ember-routing');
<ide> let emberGlimmer = emberGlimmerES();
<ide> let internalTestHelpers = emberPkgES('internal-test-helpers');
<del> let emberUtils = emberPkgES('ember-utils');
<add> let emberUtils = emberPkgES('ember-utils', SHOULD_ROLLUP);
<ide> let emberTemplateCompiler = emberPkgES('ember-template-compiler');
<ide> let backburner = backburnerES();
<ide> let glimmerWireFormat = glimmerPkgES('@glimmer/wire-format', ['@glimmer/util']);
<ide><path>packages/container/tests/container_test.js
<ide> import { getOwner, OWNER } from 'ember-utils';
<ide> import { ENV } from 'ember-environment';
<ide> import { get } from 'ember-metal';
<del>import { Registry } from '../index';
<add>import { Registry } from '..';
<ide> import { factory } from 'internal-test-helpers';
<ide> import { isFeatureEnabled } from 'ember-debug';
<ide> import { LOOKUP_FACTORY, FACTORY_FOR } from 'container';
<ide><path>packages/container/tests/registry_test.js
<del>import { Registry } from '../index';
<add>import { Registry } from '..';
<ide> import { factory } from 'internal-test-helpers';
<ide>
<ide> QUnit.module('Registry');
<ide><path>packages/ember-utils/tests/assign_test.js
<del>import assign from '../assign';
<add>import { assign } from '..';
<ide>
<ide> QUnit.module('Ember.assign');
<ide>
<ide><path>packages/ember-utils/tests/can_invoke_test.js
<del>import { canInvoke } from '../index';
<add>import { canInvoke } from '..';
<ide>
<ide> let obj;
<ide>
<ide><path>packages/ember-utils/tests/checkHasSuper_test.js
<ide> import { environment } from 'ember-environment';
<del>import { checkHasSuper } from '../index';
<add>import { checkHasSuper } from '..';
<ide>
<ide> QUnit.module('checkHasSuper');
<ide>
<ide><path>packages/ember-utils/tests/generate_guid_test.js
<del>import { generateGuid } from '../index';
<add>import { generateGuid } from '..';
<ide>
<ide> QUnit.module('Ember.generateGuid');
<ide>
<ide><path>packages/ember-utils/tests/guid_for_test.js
<ide> import {
<ide> guidFor
<del>} from '../index';
<add>} from '..';
<ide>
<ide> QUnit.module('guidFor');
<ide>
<ide><path>packages/ember-utils/tests/inspect_test.js
<del>import { inspect } from '../index';
<add>import { inspect } from '..';
<ide>
<ide> // Symbol is not defined on pre-ES2015 runtimes, so this let's us safely test
<ide> // for it's existence (where a simple `if (Symbol)` would ReferenceError)
<ide><path>packages/ember-utils/tests/make_array_test.js
<del>import makeArray from '../make-array';
<add>import { makeArray } from '..';
<ide>
<ide> QUnit.module('Ember.makeArray');
<ide>
<ide><path>packages/ember-utils/tests/to-string-test.js
<del>import { toString } from '../index';
<add>import { toString } from '..';
<ide>
<ide> QUnit.module('ember-utils toString');
<ide>
<ide><path>packages/ember-utils/tests/try_invoke_test.js
<del>import { tryInvoke } from '../index';
<add>import { tryInvoke } from '..';
<ide>
<ide> let obj;
<ide> | 12 |
Javascript | Javascript | set isintransaction to false even if close throws | 17f602f9245e7dc38b2dc1528f2fe9f5324b9b8e | <ide><path>src/utils/Transaction.js
<ide> var Mixin = {
<ide> } finally {
<ide> var memberEnd = Date.now();
<ide> this.methodInvocationTime += (memberEnd - memberStart);
<del> if (errorThrown) {
<del> // If `method` throws, prefer to show that stack trace over any thrown
<del> // by invoking `closeAll`.
<del> try {
<add> try {
<add> if (errorThrown) {
<add> // If `method` throws, prefer to show that stack trace over any thrown
<add> // by invoking `closeAll`.
<add> try {
<add> this.closeAll(0);
<add> } catch (err) {
<add> }
<add> } else {
<add> // Since `method` didn't throw, we don't want to silence the exception
<add> // here.
<ide> this.closeAll(0);
<del> } catch (err) {
<ide> }
<del> } else {
<del> // Since `method` didn't throw, we don't want to silence the exception
<del> // here.
<del> this.closeAll(0);
<add> } finally {
<add> this._isInTransaction = false;
<ide> }
<del> this._isInTransaction = false;
<ide> }
<ide> return ret;
<ide> },
<ide><path>src/utils/__tests__/Transaction-test.js
<ide> describe('Transaction', function() {
<ide> expect(function() {
<ide> transaction.perform(function() {});
<ide> }).toThrow(exceptionMsg);
<add> expect(transaction.isInTransaction()).toBe(false);
<ide> });
<ide>
<ide> it('should allow nesting of transactions', function() { | 2 |
Javascript | Javascript | add regex check in test-vm-is-context | bc05436a891da91211c9bbcff08d43133558a1d6 | <ide><path>test/parallel/test-vm-is-context.js
<ide> const vm = require('vm');
<ide>
<ide> assert.throws(function() {
<ide> vm.isContext('string is not supported');
<del>}, TypeError);
<add>}, /^TypeError: sandbox must be an object$/);
<ide>
<ide> assert.strictEqual(vm.isContext({}), false);
<ide> assert.strictEqual(vm.isContext([]), false); | 1 |
Javascript | Javascript | improve progress display for persistent caching | 1d76d0797180eed0bf41ed4375684e4af690d447 | <ide><path>lib/Compilation.js
<ide> class Compilation {
<ide> failedModule: new SyncHook(["module", "error"]),
<ide> /** @type {SyncHook<[Module]>} */
<ide> succeedModule: new SyncHook(["module"]),
<add> /** @type {SyncHook<[Module]>} */
<add> stillValidModule: new SyncHook(["module"]),
<ide>
<ide> /** @type {SyncHook<[Dependency, string]>} */
<ide> addEntry: new SyncHook(["entry", "name"]),
<ide> class Compilation {
<ide> if (currentProfile !== undefined) {
<ide> currentProfile.markBuildingEnd();
<ide> }
<add> this.hooks.stillValidModule.call(module);
<ide> return callback();
<ide> }
<ide>
<ide><path>lib/ProgressPlugin.js
<ide> class ProgressPlugin {
<ide> for (const m of activeModules) {
<ide> lastActiveModule = m;
<ide> }
<add> if (doneModules % 100 !== 0) update();
<ide> }
<ide> }
<ide> }
<del> update();
<add> if (doneModules % 100 === 0) update();
<ide> };
<ide>
<ide> const entryDone = (entry, name) => {
<ide> class ProgressPlugin {
<ide> doneModules = doneEntries = 0;
<ide> handler(0, "compiling");
<ide>
<del> compilation.buildQueue.hooks.added.tap("ProgressPlugin", moduleAdd);
<add> compilation.addModuleQueue.hooks.added.tap("ProgressPlugin", moduleAdd);
<ide> compilation.hooks.buildModule.tap("ProgressPlugin", moduleBuild);
<ide> compilation.hooks.failedModule.tap("ProgressPlugin", moduleDone);
<ide> compilation.hooks.succeedModule.tap("ProgressPlugin", moduleDone);
<add> compilation.hooks.stillValidModule.tap("ProgressPlugin", moduleDone);
<ide>
<ide> compilation.hooks.addEntry.tap("ProgressPlugin", entryAdd);
<ide> compilation.hooks.failedEntry.tap("ProgressPlugin", entryDone); | 2 |
Go | Go | use filepath.join() to make path cross-platform | 05e18429cf50afbc40456a6f4eff1cfd6f1da707 | <ide><path>integration/volume/volume_test.go
<ide> package volume
<ide>
<ide> import (
<ide> "context"
<del> "fmt"
<add> "path/filepath"
<ide> "strings"
<ide> "testing"
<ide> "time"
<ide> func TestVolumesCreateAndList(t *testing.T) {
<ide> Driver: "local",
<ide> Scope: "local",
<ide> Name: name,
<del> Mountpoint: fmt.Sprintf("%s/volumes/%s/_data", testEnv.DaemonInfo.DockerRootDir, name),
<add> Mountpoint: filepath.Join(testEnv.DaemonInfo.DockerRootDir, "volumes", name, "_data"),
<ide> }
<ide> assert.Check(t, is.DeepEqual(vol, expected, cmpopts.EquateEmpty()))
<ide> | 1 |
PHP | PHP | remove unused view tests | f12df3e2061707720671327ef67decd364b0184e | <ide><path>tests/View/ViewBladeCompilerTest.php
<ide> protected function getFiles()
<ide> {
<ide> return m::mock('Illuminate\Filesystem\Filesystem');
<ide> }
<del>
<del> public function testGetTagsProvider()
<del> {
<del> return [
<del> ['{{', '}}'],
<del> ['{{{', '}}}'],
<del> ['[[', ']]'],
<del> ['[[[', ']]]'],
<del> ['((', '))'],
<del> ['(((', ')))'],
<del> ];
<del> }
<ide> } | 1 |
Javascript | Javascript | fix lint issues | b98313f17626c95050c19b620acd1eb750d64641 | <ide><path>packages/react-dom/src/__tests__/ReactDOMServerIntegration-test.js
<ide> let ReactDOMServer;
<ide> let ReactTestUtils;
<ide>
<ide> const stream = require('stream');
<del>const ReactFeatureFlags = require('shared/ReactFeatureFlags');
<ide>
<ide> const TEXT_NODE_TYPE = 3;
<ide>
<ide><path>packages/react-dom/src/events/ReactDOMEventListener.js
<ide> var ReactGenericBatching = require('events/ReactGenericBatching');
<ide> var ReactFiberTreeReflection = require('shared/ReactFiberTreeReflection');
<ide> var ReactTypeOfWork = require('shared/ReactTypeOfWork');
<ide> var EventListener = require('fbjs/lib/EventListener');
<del>var warning = require('fbjs/lib/warning');
<ide> var {HostRoot} = ReactTypeOfWork;
<ide>
<ide> var getEventTarget = require('./getEventTarget');
<ide><path>packages/react-reconciler/src/__tests__/ReactFragment-test.js
<ide> */
<ide> 'use strict';
<ide>
<del>var ReactFeatureFlags = require('shared/ReactFeatureFlags');
<del>
<ide> let React;
<ide> let ReactNoop;
<ide>
<ide><path>packages/react/src/__tests__/ReactJSXElementValidator-test.js
<ide>
<ide> 'use strict';
<ide>
<del>var ReactFeatureFlags = require('shared/ReactFeatureFlags');
<del>
<ide> // TODO: All these warnings should become static errors using Flow instead
<ide> // of dynamic errors when using JSX with Flow.
<ide> var React; | 4 |
Javascript | Javascript | improve test coverage of dns/promises | 0f31d2993b9dfc24937511ee9024d4127f588aef | <ide><path>test/parallel/test-dns.js
<ide> dns.lookup('', {
<ide> await dnsPromises.lookup('', {
<ide> hints: dns.ADDRCONFIG | dns.V4MAPPED | dns.ALL
<ide> });
<add> await dnsPromises.lookup('', { verbatim: true });
<ide> })().then(common.mustCall());
<ide>
<ide> { | 1 |
Ruby | Ruby | add append_lines method | ff4d16deebaabc374f4dae2786bd01e2865875a4 | <ide><path>Library/Homebrew/extend/pathname.rb
<ide> def write(content, *open_args)
<ide> open("w", *open_args) { |f| f.write(content) }
<ide> end
<ide>
<add> # Only appends to a file that is already created.
<add> def append_lines(content, *open_args)
<add> raise "Cannot append file that doesn't exist: #{self}" unless exist?
<add> open("a", *open_args) { |f| f.puts(content) }
<add> end
<add>
<ide> def binwrite(contents, *open_args)
<ide> open("wb", *open_args) { |f| f.write(contents) }
<ide> end unless method_defined?(:binwrite) | 1 |
PHP | PHP | fix cs error | 99c018a8c9698bce23da22b7b7646b049a3282e5 | <ide><path>tests/TestCase/Validation/ValidationRuleTest.php
<ide> public function testCallableOn()
<ide> *
<ide> * @return void
<ide> */
<del> public function testGet() {
<add> public function testGet()
<add> {
<ide> $Rule = new ValidationRule(['rule' => 'myTestRule', 'message' => 'foo']);
<ide>
<ide> $this->assertEquals('myTestRule', $Rule->get('rule')); | 1 |
Ruby | Ruby | remove the old initializer file | d0965892456e0ec76f9cb95a151d3b8e11622e36 | <ide><path>railties/lib/rails/initializer_old.rb
<del>require 'logger'
<del>require 'set'
<del>require 'pathname'
<del>
<del>$LOAD_PATH.unshift File.dirname(__FILE__)
<del>require 'railties_path'
<del>require 'rails/version'
<del>require 'rails/gem_dependency'
<del>require 'rails/rack'
<del>
<del>RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV)
<del>
<del>module Rails
<del> class << self
<del> # The Configuration instance used to configure the Rails environment
<del> def configuration
<del> @@configuration
<del> end
<del>
<del> def configuration=(configuration)
<del> @@configuration = configuration
<del> end
<del>
<del> def initialized?
<del> @initialized || false
<del> end
<del>
<del> def initialized=(initialized)
<del> @initialized ||= initialized
<del> end
<del>
<del> def logger
<del> if defined?(RAILS_DEFAULT_LOGGER)
<del> RAILS_DEFAULT_LOGGER
<del> else
<del> nil
<del> end
<del> end
<del>
<del> def backtrace_cleaner
<del> @@backtrace_cleaner ||= begin
<del> # Relies on ActiveSupport, so we have to lazy load to postpone definition until AS has been loaded
<del> require 'rails/backtrace_cleaner'
<del> Rails::BacktraceCleaner.new
<del> end
<del> end
<del>
<del> def root
<del> Pathname.new(RAILS_ROOT) if defined?(RAILS_ROOT)
<del> end
<del>
<del> def env
<del> @_env ||= ActiveSupport::StringInquirer.new(RAILS_ENV)
<del> end
<del>
<del> def cache
<del> RAILS_CACHE
<del> end
<del>
<del> def version
<del> VERSION::STRING
<del> end
<del>
<del> def public_path
<del> @@public_path ||= self.root ? File.join(self.root, "public") : "public"
<del> end
<del>
<del> def public_path=(path)
<del> @@public_path = path
<del> end
<del> end
<del>
<del> # The Initializer is responsible for processing the Rails configuration, such
<del> # as setting the $LOAD_PATH, requiring the right frameworks, initializing
<del> # logging, and more. It can be run either as a single command that'll just
<del> # use the default configuration, like this:
<del> #
<del> # Rails::Initializer.run
<del> #
<del> # But normally it's more interesting to pass in a custom configuration
<del> # through the block running:
<del> #
<del> # Rails::Initializer.run do |config|
<del> # config.frameworks -= [ :action_mailer ]
<del> # end
<del> #
<del> # This will use the default configuration options from Rails::Configuration,
<del> # but allow for overwriting on select areas.
<del> class Initializer
<del> # The Configuration instance used by this Initializer instance.
<del> attr_reader :configuration
<del>
<del> # The set of loaded plugins.
<del> attr_reader :loaded_plugins
<del>
<del> # Whether or not all the gem dependencies have been met
<del> attr_reader :gems_dependencies_loaded
<del>
<del> # Runs the initializer. By default, this will invoke the #process method,
<del> # which simply executes all of the initialization routines. Alternately,
<del> # you can specify explicitly which initialization routine you want:
<del> #
<del> # Rails::Initializer.run(:set_load_path)
<del> #
<del> # This is useful if you only want the load path initialized, without
<del> # incurring the overhead of completely loading the entire environment.
<del> def self.run(command = :process, configuration = Configuration.new)
<del> yield configuration if block_given?
<del> initializer = new configuration
<del> initializer.send(command)
<del> initializer
<del> end
<del>
<del> # Create a new Initializer instance that references the given Configuration
<del> # instance.
<del> def initialize(configuration)
<del> @configuration = configuration
<del> @loaded_plugins = []
<del> end
<del>
<del> # Sequentially step through all of the available initialization routines,
<del> # in order (view execution order in source).
<del> def process
<del> Rails.configuration = configuration
<del>
<del> check_ruby_version
<del> install_gem_spec_stubs
<del> set_load_path
<del> add_gem_load_paths
<del>
<del> require_frameworks
<del> set_autoload_paths
<del> add_plugin_load_paths
<del> load_environment
<del> preload_frameworks
<del>
<del> initialize_encoding
<del> initialize_database
<del>
<del> initialize_cache
<del> initialize_framework_caches
<del>
<del> initialize_logger
<del> initialize_framework_logging
<del>
<del> initialize_dependency_mechanism
<del> initialize_whiny_nils
<del>
<del> initialize_time_zone
<del> initialize_i18n
<del>
<del> initialize_framework_settings
<del> initialize_framework_views
<del>
<del> initialize_metal
<del>
<del> add_support_load_paths
<del>
<del> check_for_unbuilt_gems
<del>
<del> load_gems
<del> load_plugins
<del>
<del> # pick up any gems that plugins depend on
<del> add_gem_load_paths
<del> load_gems
<del> check_gem_dependencies
<del>
<del> # bail out if gems are missing - note that check_gem_dependencies will have
<del> # already called abort() unless $gems_rake_task is set
<del> return unless gems_dependencies_loaded
<del>
<del> load_application_initializers
<del>
<del> # the framework is now fully initialized
<del> after_initialize
<del>
<del> # Setup database middleware after initializers have run
<del> initialize_database_middleware
<del>
<del> # Prepare dispatcher callbacks and run 'prepare' callbacks
<del> prepare_dispatcher
<del>
<del> # Routing must be initialized after plugins to allow the former to extend the routes
<del> initialize_routing
<del>
<del> # Observers are loaded after plugins in case Observers or observed models are modified by plugins.
<del> load_observers
<del>
<del> # Load view path cache
<del> load_view_paths
<del>
<del> # Load application classes
<del> load_application_classes
<del>
<del> # Disable dependency loading during request cycle
<del> disable_dependency_loading
<del>
<del> # Flag initialized
<del> Rails.initialized = true
<del> end
<del>
<del> # Check for valid Ruby version
<del> # This is done in an external file, so we can use it
<del> # from the `rails` program as well without duplication.
<del> def check_ruby_version
<del> require 'ruby_version_check'
<del> end
<del>
<del> # If Rails is vendored and RubyGems is available, install stub GemSpecs
<del> # for Rails, Active Support, Active Record, Action Pack, Action Mailer, and
<del> # Active Resource. This allows Gem plugins to depend on Rails even when
<del> # the Gem version of Rails shouldn't be loaded.
<del> def install_gem_spec_stubs
<del> unless Rails.respond_to?(:vendor_rails?)
<del> abort %{Your config/boot.rb is outdated: Run "rake rails:update".}
<del> end
<del>
<del> if Rails.vendor_rails?
<del> begin; require "rubygems"; rescue LoadError; return; end
<del>
<del> stubs = %w(rails activesupport activerecord actionpack actionmailer activeresource)
<del> stubs.reject! { |s| Gem.loaded_specs.key?(s) }
<del>
<del> stubs.each do |stub|
<del> Gem.loaded_specs[stub] = Gem::Specification.new do |s|
<del> s.name = stub
<del> s.version = Rails::VERSION::STRING
<del> s.loaded_from = ""
<del> end
<del> end
<del> end
<del> end
<del>
<del> # Set the <tt>$LOAD_PATH</tt> based on the value of
<del> # Configuration#load_paths. Duplicates are removed.
<del> def set_load_path
<del> load_paths = configuration.load_paths + configuration.framework_paths
<del> load_paths.reverse_each { |dir| $LOAD_PATH.unshift(dir) if File.directory?(dir) }
<del> $LOAD_PATH.uniq!
<del> end
<del>
<del> # Set the paths from which Rails will automatically load source files, and
<del> # the load_once paths.
<del> def set_autoload_paths
<del> require 'active_support/dependencies'
<del> ActiveSupport::Dependencies.load_paths = configuration.load_paths.uniq
<del> ActiveSupport::Dependencies.load_once_paths = configuration.load_once_paths.uniq
<del>
<del> extra = ActiveSupport::Dependencies.load_once_paths - ActiveSupport::Dependencies.load_paths
<del> unless extra.empty?
<del> abort <<-end_error
<del> load_once_paths must be a subset of the load_paths.
<del> Extra items in load_once_paths: #{extra * ','}
<del> end_error
<del> end
<del>
<del> # Freeze the arrays so future modifications will fail rather than do nothing mysteriously
<del> configuration.load_once_paths.freeze
<del> end
<del>
<del> # Requires all frameworks specified by the Configuration#frameworks
<del> # list. By default, all frameworks (Active Record, Active Support,
<del> # Action Pack, Action Mailer, and Active Resource) are loaded.
<del> def require_frameworks
<del> require 'active_support/all'
<del> configuration.frameworks.each { |framework| require(framework.to_s) }
<del> rescue LoadError => e
<del> # Re-raise as RuntimeError because Mongrel would swallow LoadError.
<del> raise e.to_s
<del> end
<del>
<del> # Preload all frameworks specified by the Configuration#frameworks.
<del> # Used by Passenger to ensure everything's loaded before forking and
<del> # to avoid autoload race conditions in JRuby.
<del> def preload_frameworks
<del> if configuration.preload_frameworks
<del> configuration.frameworks.each do |framework|
<del> # String#classify and #constantize aren't available yet.
<del> toplevel = Object.const_get(framework.to_s.gsub(/(?:^|_)(.)/) { $1.upcase })
<del> toplevel.load_all! if toplevel.respond_to?(:load_all!)
<del> end
<del> end
<del> end
<del>
<del> # Add the load paths used by support functions such as the info controller
<del> def add_support_load_paths
<del> end
<del>
<del> # Adds all load paths from plugins to the global set of load paths, so that
<del> # code from plugins can be required (explicitly or automatically via ActiveSupport::Dependencies).
<del> def add_plugin_load_paths
<del> require 'active_support/dependencies'
<del> plugin_loader.add_plugin_load_paths
<del> end
<del>
<del> def add_gem_load_paths
<del> require 'rails/gem_dependency'
<del> Rails::GemDependency.add_frozen_gem_path
<del> unless @configuration.gems.empty?
<del> require "rubygems"
<del> @configuration.gems.each { |gem| gem.add_load_paths }
<del> end
<del> end
<del>
<del> def load_gems
<del> unless $gems_rake_task
<del> @configuration.gems.each { |gem| gem.load }
<del> end
<del> end
<del>
<del> def check_for_unbuilt_gems
<del> unbuilt_gems = @configuration.gems.select {|gem| gem.frozen? && !gem.built? }
<del> if unbuilt_gems.size > 0
<del> # don't print if the gems:build rake tasks are being run
<del> unless $gems_build_rake_task
<del> abort <<-end_error
<del>The following gems have native components that need to be built
<del> #{unbuilt_gems.map { |gemm| "#{gemm.name} #{gemm.requirement}" } * "\n "}
<del>
<del>You're running:
<del> ruby #{Gem.ruby_version} at #{Gem.ruby}
<del> rubygems #{Gem::RubyGemsVersion} at #{Gem.path * ', '}
<del>
<del>Run `rake gems:build` to build the unbuilt gems.
<del> end_error
<del> end
<del> end
<del> end
<del>
<del> def check_gem_dependencies
<del> unloaded_gems = @configuration.gems.reject { |g| g.loaded? }
<del> if unloaded_gems.size > 0
<del> @gems_dependencies_loaded = false
<del> # don't print if the gems rake tasks are being run
<del> unless $gems_rake_task
<del> abort <<-end_error
<del>Missing these required gems:
<del> #{unloaded_gems.map { |gemm| "#{gemm.name} #{gemm.requirement}" } * "\n "}
<del>
<del>You're running:
<del> ruby #{Gem.ruby_version} at #{Gem.ruby}
<del> rubygems #{Gem::RubyGemsVersion} at #{Gem.path * ', '}
<del>
<del>Run `rake gems:install` to install the missing gems.
<del> end_error
<del> end
<del> else
<del> @gems_dependencies_loaded = true
<del> end
<del> end
<del>
<del> # Loads all plugins in <tt>config.plugin_paths</tt>. <tt>plugin_paths</tt>
<del> # defaults to <tt>vendor/plugins</tt> but may also be set to a list of
<del> # paths, such as
<del> # config.plugin_paths = ["#{RAILS_ROOT}/lib/plugins", "#{RAILS_ROOT}/vendor/plugins"]
<del> #
<del> # In the default implementation, as each plugin discovered in <tt>plugin_paths</tt> is initialized:
<del> # * its +lib+ directory, if present, is added to the load path (immediately after the applications lib directory)
<del> # * <tt>init.rb</tt> is evaluated, if present
<del> #
<del> # After all plugins are loaded, duplicates are removed from the load path.
<del> # If an array of plugin names is specified in config.plugins, only those plugins will be loaded
<del> # and they plugins will be loaded in that order. Otherwise, plugins are loaded in alphabetical
<del> # order.
<del> #
<del> # if config.plugins ends contains :all then the named plugins will be loaded in the given order and all other
<del> # plugins will be loaded in alphabetical order
<del> def load_plugins
<del> plugin_loader.load_plugins
<del> end
<del>
<del> def plugin_loader
<del> @plugin_loader ||= configuration.plugin_loader.new(self)
<del> end
<del>
<del> # Loads the environment specified by Configuration#environment_path, which
<del> # is typically one of development, test, or production.
<del> def load_environment
<del> silence_warnings do
<del> return if @environment_loaded
<del> @environment_loaded = true
<del>
<del> config = configuration
<del> constants = self.class.constants
<del>
<del> eval(IO.read(configuration.environment_path), binding, configuration.environment_path)
<del>
<del> (self.class.constants - constants).each do |const|
<del> Object.const_set(const, self.class.const_get(const))
<del> end
<del> end
<del> end
<del>
<del> def load_observers
<del> if gems_dependencies_loaded && configuration.frameworks.include?(:active_record)
<del> ActiveRecord::Base.instantiate_observers
<del> end
<del> end
<del>
<del> def load_view_paths
<del> if configuration.frameworks.include?(:action_view)
<del> if configuration.cache_classes
<del> view_path = ActionView::FileSystemResolverWithFallback.new(configuration.view_path)
<del> ActionController::Base.view_paths = view_path if configuration.frameworks.include?(:action_controller)
<del> ActionMailer::Base.template_root = view_path if configuration.frameworks.include?(:action_mailer)
<del> end
<del> end
<del> end
<del>
<del> # Eager load application classes
<del> def load_application_classes
<del> return if $rails_rake_task
<del> if configuration.cache_classes
<del> configuration.eager_load_paths.each do |load_path|
<del> matcher = /\A#{Regexp.escape(load_path)}(.*)\.rb\Z/
<del> Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
<del> require_dependency file.sub(matcher, '\1')
<del> end
<del> end
<del> end
<del> end
<del>
<del> # For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
<del> # multibyte safe operations. Plugin authors supporting other encodings
<del> # should override this behaviour and set the relevant +default_charset+
<del> # on ActionController::Base.
<del> #
<del> # For Ruby 1.9, UTF-8 is the default internal and external encoding.
<del> def initialize_encoding
<del> if RUBY_VERSION < '1.9'
<del> $KCODE='u'
<del> else
<del> Encoding.default_internal = Encoding::UTF_8
<del> Encoding.default_external = Encoding::UTF_8
<del> end
<del> end
<del>
<del> # This initialization routine does nothing unless <tt>:active_record</tt>
<del> # is one of the frameworks to load (Configuration#frameworks). If it is,
<del> # this sets the database configuration from Configuration#database_configuration
<del> # and then establishes the connection.
<del> def initialize_database
<del> if configuration.frameworks.include?(:active_record)
<del> ActiveRecord::Base.configurations = configuration.database_configuration
<del> ActiveRecord::Base.establish_connection
<del> end
<del> end
<del>
<del> def initialize_database_middleware
<del> if configuration.frameworks.include?(:active_record)
<del> if configuration.frameworks.include?(:action_controller) &&
<del> ActionController::Base.session_store.name == 'ActiveRecord::SessionStore'
<del> configuration.middleware.insert_before :"ActiveRecord::SessionStore", ActiveRecord::ConnectionAdapters::ConnectionManagement
<del> configuration.middleware.insert_before :"ActiveRecord::SessionStore", ActiveRecord::QueryCache
<del> else
<del> configuration.middleware.use ActiveRecord::ConnectionAdapters::ConnectionManagement
<del> configuration.middleware.use ActiveRecord::QueryCache
<del> end
<del> end
<del> end
<del>
<del> def initialize_cache
<del> unless defined?(RAILS_CACHE)
<del> silence_warnings { Object.const_set "RAILS_CACHE", ActiveSupport::Cache.lookup_store(configuration.cache_store) }
<del>
<del> if RAILS_CACHE.respond_to?(:middleware)
<del> # Insert middleware to setup and teardown local cache for each request
<del> configuration.middleware.insert_after(:"Rack::Lock", RAILS_CACHE.middleware)
<del> end
<del> end
<del> end
<del>
<del> def initialize_framework_caches
<del> if configuration.frameworks.include?(:action_controller)
<del> ActionController::Base.cache_store ||= RAILS_CACHE
<del> end
<del> end
<del>
<del> # If the RAILS_DEFAULT_LOGGER constant is already set, this initialization
<del> # routine does nothing. If the constant is not set, and Configuration#logger
<del> # is not +nil+, this also does nothing. Otherwise, a new logger instance
<del> # is created at Configuration#log_path, with a default log level of
<del> # Configuration#log_level.
<del> #
<del> # If the log could not be created, the log will be set to output to
<del> # +STDERR+, with a log level of +WARN+.
<del> def initialize_logger
<del> # if the environment has explicitly defined a logger, use it
<del> return if Rails.logger
<del>
<del> unless logger = configuration.logger
<del> begin
<del> logger = ActiveSupport::BufferedLogger.new(configuration.log_path)
<del> logger.level = ActiveSupport::BufferedLogger.const_get(configuration.log_level.to_s.upcase)
<del> if configuration.environment == "production"
<del> logger.auto_flushing = false
<del> end
<del> rescue StandardError => e
<del> logger = ActiveSupport::BufferedLogger.new(STDERR)
<del> logger.level = ActiveSupport::BufferedLogger::WARN
<del> logger.warn(
<del> "Rails Error: Unable to access log file. Please ensure that #{configuration.log_path} exists and is chmod 0666. " +
<del> "The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
<del> )
<del> end
<del> end
<del>
<del> silence_warnings { Object.const_set "RAILS_DEFAULT_LOGGER", logger }
<del> end
<del>
<del> # Sets the logger for Active Record, Action Controller, and Action Mailer
<del> # (but only for those frameworks that are to be loaded). If the framework's
<del> # logger is already set, it is not changed, otherwise it is set to use
<del> # RAILS_DEFAULT_LOGGER.
<del> def initialize_framework_logging
<del> for framework in ([ :active_record, :action_controller, :action_mailer ] & configuration.frameworks)
<del> framework.to_s.camelize.constantize.const_get("Base").logger ||= Rails.logger
<del> end
<del>
<del> ActiveSupport::Dependencies.logger ||= Rails.logger
<del> Rails.cache.logger ||= Rails.logger
<del> end
<del>
<del> # Sets +ActionController::Base#view_paths+ and +ActionMailer::Base#template_root+
<del> # (but only for those frameworks that are to be loaded). If the framework's
<del> # paths have already been set, it is not changed, otherwise it is
<del> # set to use Configuration#view_path.
<del> def initialize_framework_views
<del> if configuration.frameworks.include?(:action_view)
<del> view_path = ActionView::PathSet.type_cast(configuration.view_path)
<del> ActionMailer::Base.template_root = view_path if configuration.frameworks.include?(:action_mailer) && ActionMailer::Base.view_paths.blank?
<del> ActionController::Base.view_paths = view_path if configuration.frameworks.include?(:action_controller) && ActionController::Base.view_paths.blank?
<del> end
<del> end
<del>
<del> # If Action Controller is not one of the loaded frameworks (Configuration#frameworks)
<del> # this does nothing. Otherwise, it loads the routing definitions and sets up
<del> # loading module used to lazily load controllers (Configuration#controller_paths).
<del> def initialize_routing
<del> return unless configuration.frameworks.include?(:action_controller)
<del>
<del> ActionController::Routing.controller_paths += configuration.controller_paths
<del> ActionController::Routing::Routes.add_configuration_file(configuration.routes_configuration_file)
<del> ActionController::Routing::Routes.reload!
<del> end
<del>
<del> # Sets the dependency loading mechanism based on the value of
<del> # Configuration#cache_classes.
<del> def initialize_dependency_mechanism
<del> ActiveSupport::Dependencies.mechanism = configuration.cache_classes ? :require : :load
<del> end
<del>
<del> # Loads support for "whiny nil" (noisy warnings when methods are invoked
<del> # on +nil+ values) if Configuration#whiny_nils is true.
<del> def initialize_whiny_nils
<del> require('active_support/whiny_nil') if configuration.whiny_nils
<del> end
<del>
<del> # Sets the default value for Time.zone, and turns on ActiveRecord::Base#time_zone_aware_attributes.
<del> # If assigned value cannot be matched to a TimeZone, an exception will be raised.
<del> def initialize_time_zone
<del> if configuration.time_zone
<del> zone_default = Time.__send__(:get_zone, configuration.time_zone)
<del>
<del> unless zone_default
<del> raise \
<del> 'Value assigned to config.time_zone not recognized.' +
<del> 'Run "rake -D time" for a list of tasks for finding appropriate time zone names.'
<del> end
<del>
<del> Time.zone_default = zone_default
<del>
<del> if configuration.frameworks.include?(:active_record)
<del> ActiveRecord::Base.time_zone_aware_attributes = true
<del> ActiveRecord::Base.default_timezone = :utc
<del> end
<del> end
<del> end
<del>
<del> # Set the i18n configuration from config.i18n but special-case for the load_path which should be
<del> # appended to what's already set instead of overwritten.
<del> def initialize_i18n
<del> configuration.i18n.each do |setting, value|
<del> if setting == :load_path
<del> I18n.load_path += value
<del> else
<del> I18n.send("#{setting}=", value)
<del> end
<del> end
<del> end
<del>
<del> def initialize_metal
<del> Rails::Rack::Metal.requested_metals = configuration.metals
<del> Rails::Rack::Metal.metal_paths += plugin_loader.engine_metal_paths
<del>
<del> configuration.middleware.insert_before(
<del> :"ActionDispatch::ParamsParser",
<del> Rails::Rack::Metal, :if => Rails::Rack::Metal.metals.any?)
<del> end
<del>
<del> # Initializes framework-specific settings for each of the loaded frameworks
<del> # (Configuration#frameworks). The available settings map to the accessors
<del> # on each of the corresponding Base classes.
<del> def initialize_framework_settings
<del> configuration.frameworks.each do |framework|
<del> base_class = framework.to_s.camelize.constantize.const_get("Base")
<del>
<del> configuration.send(framework).each do |setting, value|
<del> base_class.send("#{setting}=", value)
<del> end
<del> end
<del> configuration.active_support.each do |setting, value|
<del> ActiveSupport.send("#{setting}=", value)
<del> end
<del> end
<del>
<del> # Fires the user-supplied after_initialize block (Configuration#after_initialize)
<del> def after_initialize
<del> if gems_dependencies_loaded
<del> configuration.after_initialize_blocks.each do |block|
<del> block.call
<del> end
<del> end
<del> end
<del>
<del> def load_application_initializers
<del> if gems_dependencies_loaded
<del> Dir["#{configuration.root_path}/config/initializers/**/*.rb"].sort.each do |initializer|
<del> load(initializer)
<del> end
<del> end
<del> end
<del>
<del> def prepare_dispatcher
<del> return unless configuration.frameworks.include?(:action_controller)
<del> require 'dispatcher' unless defined?(::Dispatcher)
<del> Dispatcher.define_dispatcher_callbacks(configuration.cache_classes)
<del> end
<del>
<del> def disable_dependency_loading
<del> if configuration.cache_classes && !configuration.dependency_loading
<del> ActiveSupport::Dependencies.unhook!
<del> end
<del> end
<del> end
<del>
<del> # The Configuration class holds all the parameters for the Initializer and
<del> # ships with defaults that suites most Rails applications. But it's possible
<del> # to overwrite everything. Usually, you'll create an Configuration file
<del> # implicitly through the block running on the Initializer, but it's also
<del> # possible to create the Configuration instance in advance and pass it in
<del> # like this:
<del> #
<del> # config = Rails::Configuration.new
<del> # Rails::Initializer.run(:process, config)
<del> class Configuration
<del> # The application's base directory.
<del> attr_reader :root_path
<del>
<del> # A stub for setting options on ActionController::Base.
<del> attr_accessor :action_controller
<del>
<del> # A stub for setting options on ActionMailer::Base.
<del> attr_accessor :action_mailer
<del>
<del> # A stub for setting options on ActionView::Base.
<del> attr_accessor :action_view
<del>
<del> # A stub for setting options on ActiveRecord::Base.
<del> attr_accessor :active_record
<del>
<del> # A stub for setting options on ActiveResource::Base.
<del> attr_accessor :active_resource
<del>
<del> # A stub for setting options on ActiveSupport.
<del> attr_accessor :active_support
<del>
<del> # Whether to preload all frameworks at startup.
<del> attr_accessor :preload_frameworks
<del>
<del> # Whether or not classes should be cached (set to false if you want
<del> # application classes to be reloaded on each request)
<del> attr_accessor :cache_classes
<del>
<del> # The list of paths that should be searched for controllers. (Defaults
<del> # to <tt>app/controllers</tt>.)
<del> attr_accessor :controller_paths
<del>
<del> # The path to the database configuration file to use. (Defaults to
<del> # <tt>config/database.yml</tt>.)
<del> attr_accessor :database_configuration_file
<del>
<del> # The path to the routes configuration file to use. (Defaults to
<del> # <tt>config/routes.rb</tt>.)
<del> attr_accessor :routes_configuration_file
<del>
<del> # The list of rails framework components that should be loaded. (Defaults
<del> # to <tt>:active_record</tt>, <tt>:action_controller</tt>,
<del> # <tt>:action_view</tt>, <tt>:action_mailer</tt>, and
<del> # <tt>:active_resource</tt>).
<del> attr_accessor :frameworks
<del>
<del> # An array of additional paths to prepend to the load path. By default,
<del> # all +app+, +lib+, +vendor+ and mock paths are included in this list.
<del> attr_accessor :load_paths
<del>
<del> # An array of paths from which Rails will automatically load from only once.
<del> # All elements of this array must also be in +load_paths+.
<del> attr_accessor :load_once_paths
<del>
<del> # An array of paths from which Rails will eager load on boot if cache
<del> # classes is enabled. All elements of this array must also be in
<del> # +load_paths+.
<del> attr_accessor :eager_load_paths
<del>
<del> # The log level to use for the default Rails logger. In production mode,
<del> # this defaults to <tt>:info</tt>. In development mode, it defaults to
<del> # <tt>:debug</tt>.
<del> attr_accessor :log_level
<del>
<del> # The path to the log file to use. Defaults to log/#{environment}.log
<del> # (e.g. log/development.log or log/production.log).
<del> attr_accessor :log_path
<del>
<del> # The specific logger to use. By default, a logger will be created and
<del> # initialized using #log_path and #log_level, but a programmer may
<del> # specifically set the logger to use via this accessor and it will be
<del> # used directly.
<del> attr_accessor :logger
<del>
<del> # The specific cache store to use. By default, the ActiveSupport::Cache::Store will be used.
<del> attr_accessor :cache_store
<del>
<del> # The root of the application's views. (Defaults to <tt>app/views</tt>.)
<del> attr_accessor :view_path
<del>
<del> # Set to +true+ if you want to be warned (noisily) when you try to invoke
<del> # any method of +nil+. Set to +false+ for the standard Ruby behavior.
<del> attr_accessor :whiny_nils
<del>
<del> # The list of plugins to load. If this is set to <tt>nil</tt>, all plugins will
<del> # be loaded. If this is set to <tt>[]</tt>, no plugins will be loaded. Otherwise,
<del> # plugins will be loaded in the order specified.
<del> attr_reader :plugins
<del> def plugins=(plugins)
<del> @plugins = plugins.nil? ? nil : plugins.map { |p| p.to_sym }
<del> end
<del>
<del> # The list of metals to load. If this is set to <tt>nil</tt>, all metals will
<del> # be loaded in alphabetical order. If this is set to <tt>[]</tt>, no metals will
<del> # be loaded. Otherwise metals will be loaded in the order specified
<del> attr_accessor :metals
<del>
<del> # The path to the root of the plugins directory. By default, it is in
<del> # <tt>vendor/plugins</tt>.
<del> attr_accessor :plugin_paths
<del>
<del> # The classes that handle finding the desired plugins that you'd like to load for
<del> # your application. By default it is the Rails::Plugin::FileSystemLocator which finds
<del> # plugins to load in <tt>vendor/plugins</tt>. You can hook into gem location by subclassing
<del> # Rails::Plugin::Locator and adding it onto the list of <tt>plugin_locators</tt>.
<del> attr_accessor :plugin_locators
<del>
<del> # The class that handles loading each plugin. Defaults to Rails::Plugin::Loader, but
<del> # a sub class would have access to fine grained modification of the loading behavior. See
<del> # the implementation of Rails::Plugin::Loader for more details.
<del> attr_accessor :plugin_loader
<del>
<del> # Enables or disables plugin reloading. You can get around this setting per plugin.
<del> # If <tt>reload_plugins?</tt> is false, add this to your plugin's <tt>init.rb</tt>
<del> # to make it reloadable:
<del> #
<del> # ActiveSupport::Dependencies.load_once_paths.delete lib_path
<del> #
<del> # If <tt>reload_plugins?</tt> is true, add this to your plugin's <tt>init.rb</tt>
<del> # to only load it once:
<del> #
<del> # ActiveSupport::Dependencies.load_once_paths << lib_path
<del> #
<del> attr_accessor :reload_plugins
<del>
<del> # Returns true if plugin reloading is enabled.
<del> def reload_plugins?
<del> !!@reload_plugins
<del> end
<del>
<del> # Enables or disables dependency loading during the request cycle. Setting
<del> # <tt>dependency_loading</tt> to true will allow new classes to be loaded
<del> # during a request. Setting it to false will disable this behavior.
<del> #
<del> # Those who want to run in a threaded environment should disable this
<del> # option and eager load or require all there classes on initialization.
<del> #
<del> # If <tt>cache_classes</tt> is disabled, dependency loaded will always be
<del> # on.
<del> attr_accessor :dependency_loading
<del>
<del> # An array of gems that this rails application depends on. Rails will automatically load
<del> # these gems during installation, and allow you to install any missing gems with:
<del> #
<del> # rake gems:install
<del> #
<del> # You can add gems with the #gem method.
<del> attr_accessor :gems
<del>
<del> # Adds a single Gem dependency to the rails application. By default, it will require
<del> # the library with the same name as the gem. Use :lib to specify a different name.
<del> #
<del> # # gem 'aws-s3', '>= 0.4.0'
<del> # # require 'aws/s3'
<del> # config.gem 'aws-s3', :lib => 'aws/s3', :version => '>= 0.4.0', \
<del> # :source => "http://code.whytheluckystiff.net"
<del> #
<del> # To require a library be installed, but not attempt to load it, pass :lib => false
<del> #
<del> # config.gem 'qrp', :version => '0.4.1', :lib => false
<del> def gem(name, options = {})
<del> @gems << Rails::GemDependency.new(name, options)
<del> end
<del>
<del> # Deprecated options:
<del> def breakpoint_server(_ = nil)
<del> $stderr.puts %(
<del> *******************************************************************
<del> * config.breakpoint_server has been deprecated and has no effect. *
<del> *******************************************************************
<del> )
<del> end
<del> alias_method :breakpoint_server=, :breakpoint_server
<del>
<del> # Sets the default +time_zone+. Setting this will enable +time_zone+
<del> # awareness for Active Record models and set the Active Record default
<del> # timezone to <tt>:utc</tt>.
<del> attr_accessor :time_zone
<del>
<del> # Accessor for i18n settings.
<del> attr_accessor :i18n
<del>
<del> # Create a new Configuration instance, initialized with the default
<del> # values.
<del> def initialize
<del> set_root_path!
<del>
<del> self.frameworks = default_frameworks
<del> self.load_paths = default_load_paths
<del> self.load_once_paths = default_load_once_paths
<del> self.eager_load_paths = default_eager_load_paths
<del> self.log_path = default_log_path
<del> self.log_level = default_log_level
<del> self.view_path = default_view_path
<del> self.controller_paths = default_controller_paths
<del> self.preload_frameworks = default_preload_frameworks
<del> self.cache_classes = default_cache_classes
<del> self.dependency_loading = default_dependency_loading
<del> self.whiny_nils = default_whiny_nils
<del> self.plugins = default_plugins
<del> self.plugin_paths = default_plugin_paths
<del> self.plugin_locators = default_plugin_locators
<del> self.plugin_loader = default_plugin_loader
<del> self.database_configuration_file = default_database_configuration_file
<del> self.routes_configuration_file = default_routes_configuration_file
<del> self.gems = default_gems
<del> self.i18n = default_i18n
<del>
<del> for framework in default_frameworks
<del> self.send("#{framework}=", Rails::OrderedOptions.new)
<del> end
<del> self.active_support = Rails::OrderedOptions.new
<del> end
<del>
<del> # Set the root_path to RAILS_ROOT and canonicalize it.
<del> def set_root_path!
<del> raise 'RAILS_ROOT is not set' unless defined?(::RAILS_ROOT)
<del> raise 'RAILS_ROOT is not a directory' unless File.directory?(::RAILS_ROOT)
<del>
<del> @root_path =
<del> # Pathname is incompatible with Windows, but Windows doesn't have
<del> # real symlinks so File.expand_path is safe.
<del> if RUBY_PLATFORM =~ /(:?mswin|mingw)/
<del> File.expand_path(::RAILS_ROOT)
<del>
<del> # Otherwise use Pathname#realpath which respects symlinks.
<del> else
<del> Pathname.new(::RAILS_ROOT).realpath.to_s
<del> end
<del>
<del> Object.const_set(:RELATIVE_RAILS_ROOT, ::RAILS_ROOT.dup) unless defined?(::RELATIVE_RAILS_ROOT)
<del> ::RAILS_ROOT.replace @root_path
<del> end
<del>
<del> # Enable threaded mode. Allows concurrent requests to controller actions and
<del> # multiple database connections. Also disables automatic dependency loading
<del> # after boot, and disables reloading code on every request, as these are
<del> # fundamentally incompatible with thread safety.
<del> def threadsafe!
<del> self.preload_frameworks = true
<del> self.cache_classes = true
<del> self.dependency_loading = false
<del> self.action_controller.allow_concurrency = true
<del> self
<del> end
<del>
<del> # Loads and returns the contents of the #database_configuration_file. The
<del> # contents of the file are processed via ERB before being sent through
<del> # YAML::load.
<del> def database_configuration
<del> require 'erb'
<del> YAML::load(ERB.new(IO.read(database_configuration_file)).result)
<del> end
<del>
<del> # The path to the current environment's file (<tt>development.rb</tt>, etc.). By
<del> # default the file is at <tt>config/environments/#{environment}.rb</tt>.
<del> def environment_path
<del> "#{root_path}/config/environments/#{environment}.rb"
<del> end
<del>
<del> # Return the currently selected environment. By default, it returns the
<del> # value of the RAILS_ENV constant.
<del> def environment
<del> ::RAILS_ENV
<del> end
<del>
<del> # Adds a block which will be executed after rails has been fully initialized.
<del> # Useful for per-environment configuration which depends on the framework being
<del> # fully initialized.
<del> def after_initialize(&after_initialize_block)
<del> after_initialize_blocks << after_initialize_block if after_initialize_block
<del> end
<del>
<del> # Returns the blocks added with Configuration#after_initialize
<del> def after_initialize_blocks
<del> @after_initialize_blocks ||= []
<del> end
<del>
<del> # Add a preparation callback that will run before every request in development
<del> # mode, or before the first request in production.
<del> #
<del> # See Dispatcher#to_prepare.
<del> def to_prepare(&callback)
<del> after_initialize do
<del> require 'dispatcher' unless defined?(::Dispatcher)
<del> Dispatcher.to_prepare(&callback)
<del> end
<del> end
<del>
<del> def middleware
<del> require 'action_controller'
<del> ActionController::Dispatcher.middleware
<del> end
<del>
<del> def builtin_directories
<del> # Include builtins only in the development environment.
<del> (environment == 'development') ? Dir["#{RAILTIES_PATH}/builtin/*/"] : []
<del> end
<del>
<del> def framework_paths
<del> paths = %w(railties railties/lib activesupport/lib)
<del> paths << 'actionpack/lib' if frameworks.include?(:action_controller) || frameworks.include?(:action_view)
<del>
<del> [:active_record, :action_mailer, :active_resource, :action_web_service].each do |framework|
<del> paths << "#{framework.to_s.gsub('_', '')}/lib" if frameworks.include?(framework)
<del> end
<del>
<del> paths.map { |dir| "#{framework_root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
<del> end
<del>
<del> private
<del> def framework_root_path
<del> defined?(::RAILS_FRAMEWORK_ROOT) ? ::RAILS_FRAMEWORK_ROOT : "#{root_path}/vendor/rails"
<del> end
<del>
<del> def default_frameworks
<del> [ :active_record, :action_controller, :action_view, :action_mailer, :active_resource ]
<del> end
<del>
<del> def default_load_paths
<del> paths = []
<del>
<del> # Add the old mock paths only if the directories exists
<del> paths.concat(Dir["#{root_path}/test/mocks/#{environment}"]) if File.exists?("#{root_path}/test/mocks/#{environment}")
<del>
<del> # Add the app's controller directory
<del> paths.concat(Dir["#{root_path}/app/controllers/"])
<del>
<del> # Followed by the standard includes.
<del> paths.concat %w(
<del> app
<del> app/metal
<del> app/models
<del> app/controllers
<del> app/helpers
<del> app/services
<del> lib
<del> vendor
<del> ).map { |dir| "#{root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
<del>
<del> paths.concat builtin_directories
<del> end
<del>
<del> # Doesn't matter since plugins aren't in load_paths yet.
<del> def default_load_once_paths
<del> []
<del> end
<del>
<del> def default_eager_load_paths
<del> %w(
<del> app/metal
<del> app/models
<del> app/controllers
<del> app/helpers
<del> ).map { |dir| "#{root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
<del> end
<del>
<del> def default_log_path
<del> File.join(root_path, 'log', "#{environment}.log")
<del> end
<del>
<del> def default_log_level
<del> environment == 'production' ? :info : :debug
<del> end
<del>
<del> def default_database_configuration_file
<del> File.join(root_path, 'config', 'database.yml')
<del> end
<del>
<del> def default_routes_configuration_file
<del> File.join(root_path, 'config', 'routes.rb')
<del> end
<del>
<del> def default_view_path
<del> File.join(root_path, 'app', 'views')
<del> end
<del>
<del> def default_controller_paths
<del> paths = [File.join(root_path, 'app', 'controllers')]
<del> paths.concat builtin_directories
<del> paths
<del> end
<del>
<del> def default_dependency_loading
<del> true
<del> end
<del>
<del> def default_preload_frameworks
<del> false
<del> end
<del>
<del> def default_cache_classes
<del> true
<del> end
<del>
<del> def default_whiny_nils
<del> false
<del> end
<del>
<del> def default_plugins
<del> nil
<del> end
<del>
<del> def default_plugin_paths
<del> ["#{root_path}/vendor/plugins"]
<del> end
<del>
<del> def default_plugin_locators
<del> require 'rails/plugin/locator'
<del> locators = []
<del> locators << Plugin::GemLocator if defined? Gem
<del> locators << Plugin::FileSystemLocator
<del> end
<del>
<del> def default_plugin_loader
<del> require 'rails/plugin/loader'
<del> Plugin::Loader
<del> end
<del>
<del> def default_cache_store
<del> if File.exist?("#{root_path}/tmp/cache/")
<del> [ :file_store, "#{root_path}/tmp/cache/" ]
<del> else
<del> :memory_store
<del> end
<del> end
<del>
<del> def default_gems
<del> []
<del> end
<del>
<del> def default_i18n
<del> i18n = Rails::OrderedOptions.new
<del> i18n.load_path = []
<del>
<del> if File.exist?(File.join(RAILS_ROOT, 'config', 'locales'))
<del> i18n.load_path << Dir[File.join(RAILS_ROOT, 'config', 'locales', '*.{rb,yml}')]
<del> i18n.load_path.flatten!
<del> end
<del>
<del> i18n
<del> end
<del> end
<del>end
<del>
<del># Needs to be duplicated from Active Support since its needed before Active
<del># Support is available. Here both Options and Hash are namespaced to prevent
<del># conflicts with other implementations AND with the classes residing in Active Support.
<del>class Rails::OrderedOptions < Array #:nodoc:
<del> def []=(key, value)
<del> key = key.to_sym
<del>
<del> if pair = find_pair(key)
<del> pair.pop
<del> pair << value
<del> else
<del> self << [key, value]
<del> end
<del> end
<del>
<del> def [](key)
<del> pair = find_pair(key.to_sym)
<del> pair ? pair.last : nil
<del> end
<del>
<del> def method_missing(name, *args)
<del> if name.to_s =~ /(.*)=$/
<del> self[$1.to_sym] = args.first
<del> else
<del> self[name]
<del> end
<del> end
<del>
<del> private
<del> def find_pair(key)
<del> self.each { |i| return i if i.first == key }
<del> return false
<del> end
<del>end
<del> | 1 |
PHP | PHP | add tests for self relationships | 6f8ad3ca95e5f1037c78adee593bcef5ed3f1ad1 | <ide><path>tests/Database/DatabaseEloquentBuilderTest.php
<ide> public function testOrHasNested()
<ide> $this->assertEquals($builder->toSql(), $result);
<ide> }
<ide>
<add> public function testSelfHasNested()
<add> {
<add> $model = new EloquentBuilderTestModelSelfRelatedStub;
<add>
<add> $nestedSql = $model->whereHas('parentFoo', function ($q) {
<add> $q->has('childFoo');
<add> })->toSql();
<add>
<add> $dotSql = $model->has('parentFoo.childFoo')->toSql();
<add>
<add> // alias has a dynamic hash, so replace with a static string for comparison
<add> $alias = 'self_alias_hash';
<add> $aliasRegex = '/\b(self_[a-f0-9]{32})(\b|$)/i';
<add>
<add> $nestedSql = preg_replace($aliasRegex, $alias, $nestedSql);
<add> $dotSql = preg_replace($aliasRegex, $alias, $dotSql);
<add>
<add> $this->assertEquals($nestedSql, $dotSql);
<add> }
<add>
<add> public function testSelfHasNestedUsesAlias()
<add> {
<add> $model = new EloquentBuilderTestModelSelfRelatedStub;
<add>
<add> $sql = $model->has('parentFoo.childFoo')->toSql();
<add>
<add> // alias has a dynamic hash, so replace with a static string for comparison
<add> $alias = 'self_alias_hash';
<add> $aliasRegex = '/\b(self_[a-f0-9]{32})(\b|$)/i';
<add>
<add> $sql = preg_replace($aliasRegex, $alias, $sql);
<add>
<add> $this->assertContains('"self_related_stubs"."parent_id" = "self_alias_hash"."id"', $sql);
<add> }
<add>
<ide> protected function mockConnectionForModel($model, $database)
<ide> {
<ide> $grammarClass = 'Illuminate\Database\Query\Grammars\\'.$database.'Grammar';
<ide> public function baz()
<ide> class EloquentBuilderTestModelFarRelatedStub extends Illuminate\Database\Eloquent\Model
<ide> {
<ide> }
<add>
<add>class EloquentBuilderTestModelSelfRelatedStub extends Illuminate\Database\Eloquent\Model
<add>{
<add> protected $table = 'self_related_stubs';
<add>
<add> public function parentFoo()
<add> {
<add> return $this->belongsTo('EloquentBuilderTestModelSelfRelatedStub', 'parent_id', 'id', 'parent');
<add> }
<add>
<add> public function childFoo()
<add> {
<add> return $this->hasOne('EloquentBuilderTestModelSelfRelatedStub', 'parent_id', 'id', 'child');
<add> }
<add>
<add> public function childFoos()
<add> {
<add> return $this->hasMany('EloquentBuilderTestModelSelfRelatedStub', 'parent_id', 'id', 'children');
<add> }
<add>
<add> public function parentBars()
<add> {
<add> return $this->belongsToMany('EloquentBuilderTestModelSelfRelatedStub', 'self_pivot', 'child_id', 'parent_id', 'parent_bars');
<add> }
<add>
<add> public function childBars()
<add> {
<add> return $this->belongsToMany('EloquentBuilderTestModelSelfRelatedStub', 'self_pivot', 'parent_id', 'child_id', 'child_bars');
<add> }
<add>
<add> public function bazes()
<add> {
<add> return $this->hasMany('EloquentBuilderTestModelFarRelatedStub', 'foreign_key', 'id', 'bar');
<add> }
<add>}
<ide><path>tests/Database/DatabaseEloquentIntegrationTest.php
<ide> public function testHasOnSelfReferencingBelongsToManyRelationship()
<ide> $this->assertEquals('taylorotwell@gmail.com', $results->first()->email);
<ide> }
<ide>
<add> public function testWhereHasOnSelfReferencingBelongsToManyRelationship()
<add> {
<add> $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
<add> $friend = $user->friends()->create(['email' => 'abigailotwell@gmail.com']);
<add>
<add> $results = EloquentTestUser::whereHas('friends', function ($query) {
<add> $query->where('email', 'abigailotwell@gmail.com');
<add> })->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('taylorotwell@gmail.com', $results->first()->email);
<add> }
<add>
<add> public function testHasOnNestedSelfReferencingBelongsToManyRelationship()
<add> {
<add> $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
<add> $friend = $user->friends()->create(['email' => 'abigailotwell@gmail.com']);
<add> $nestedFriend = $friend->friends()->create(['email' => 'foo@gmail.com']);
<add>
<add> $results = EloquentTestUser::has('friends.friends')->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('taylorotwell@gmail.com', $results->first()->email);
<add> }
<add>
<add> public function testWhereHasOnNestedSelfReferencingBelongsToManyRelationship()
<add> {
<add> $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
<add> $friend = $user->friends()->create(['email' => 'abigailotwell@gmail.com']);
<add> $nestedFriend = $friend->friends()->create(['email' => 'foo@gmail.com']);
<add>
<add> $results = EloquentTestUser::whereHas('friends.friends', function ($query) {
<add> $query->where('email', 'foo@gmail.com');
<add> })->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('taylorotwell@gmail.com', $results->first()->email);
<add> }
<add>
<add> public function testHasOnSelfReferencingBelongsToManyRelationshipWithWherePivot()
<add> {
<add> $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
<add> $friend = $user->friends()->create(['email' => 'abigailotwell@gmail.com']);
<add>
<add> $results = EloquentTestUser::has('friendsOne')->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('taylorotwell@gmail.com', $results->first()->email);
<add> }
<add>
<add> public function testHasOnNestedSelfReferencingBelongsToManyRelationshipWithWherePivot()
<add> {
<add> $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
<add> $friend = $user->friends()->create(['email' => 'abigailotwell@gmail.com']);
<add> $nestedFriend = $friend->friends()->create(['email' => 'foo@gmail.com']);
<add>
<add> $results = EloquentTestUser::has('friendsOne.friendsTwo')->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('taylorotwell@gmail.com', $results->first()->email);
<add> }
<add>
<ide> public function testHasOnSelfReferencingBelongsToRelationship()
<ide> {
<ide> $parentPost = EloquentTestPost::create(['name' => 'Parent Post', 'user_id' => 1]);
<ide> public function testHasOnSelfReferencingBelongsToRelationship()
<ide> $this->assertEquals('Child Post', $results->first()->name);
<ide> }
<ide>
<add> public function testWhereHasOnSelfReferencingBelongsToRelationship()
<add> {
<add> $parentPost = EloquentTestPost::create(['name' => 'Parent Post', 'user_id' => 1]);
<add> $childPost = EloquentTestPost::create(['name' => 'Child Post', 'parent_id' => $parentPost->id, 'user_id' => 2]);
<add>
<add> $results = EloquentTestPost::whereHas('parentPost', function ($query) {
<add> $query->where('name', 'Parent Post');
<add> })->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('Child Post', $results->first()->name);
<add> }
<add>
<add> public function testHasOnNestedSelfReferencingBelongsToRelationship()
<add> {
<add> $grandParentPost = EloquentTestPost::create(['name' => 'Grandparent Post', 'user_id' => 1]);
<add> $parentPost = EloquentTestPost::create(['name' => 'Parent Post', 'parent_id' => $grandParentPost->id, 'user_id' => 2]);
<add> $childPost = EloquentTestPost::create(['name' => 'Child Post', 'parent_id' => $parentPost->id, 'user_id' => 3]);
<add>
<add> $results = EloquentTestPost::has('parentPost.parentPost')->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('Child Post', $results->first()->name);
<add> }
<add>
<add> public function testWhereHasOnNestedSelfReferencingBelongsToRelationship()
<add> {
<add> $grandParentPost = EloquentTestPost::create(['name' => 'Grandparent Post', 'user_id' => 1]);
<add> $parentPost = EloquentTestPost::create(['name' => 'Parent Post', 'parent_id' => $grandParentPost->id, 'user_id' => 2]);
<add> $childPost = EloquentTestPost::create(['name' => 'Child Post', 'parent_id' => $parentPost->id, 'user_id' => 3]);
<add>
<add> $results = EloquentTestPost::whereHas('parentPost.parentPost', function ($query) {
<add> $query->where('name', 'Grandparent Post');
<add> })->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('Child Post', $results->first()->name);
<add> }
<add>
<ide> public function testHasOnSelfReferencingHasManyRelationship()
<ide> {
<ide> $parentPost = EloquentTestPost::create(['name' => 'Parent Post', 'user_id' => 1]);
<ide> public function testHasOnSelfReferencingHasManyRelationship()
<ide> $this->assertEquals('Parent Post', $results->first()->name);
<ide> }
<ide>
<add> public function testWhereHasOnSelfReferencingHasManyRelationship()
<add> {
<add> $parentPost = EloquentTestPost::create(['name' => 'Parent Post', 'user_id' => 1]);
<add> $childPost = EloquentTestPost::create(['name' => 'Child Post', 'parent_id' => $parentPost->id, 'user_id' => 2]);
<add>
<add> $results = EloquentTestPost::whereHas('childPosts', function ($query) {
<add> $query->where('name', 'Child Post');
<add> })->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('Parent Post', $results->first()->name);
<add> }
<add>
<add> public function testHasOnNestedSelfReferencingHasManyRelationship()
<add> {
<add> $grandParentPost = EloquentTestPost::create(['name' => 'Grandparent Post', 'user_id' => 1]);
<add> $parentPost = EloquentTestPost::create(['name' => 'Parent Post', 'parent_id' => $grandParentPost->id, 'user_id' => 2]);
<add> $childPost = EloquentTestPost::create(['name' => 'Child Post', 'parent_id' => $parentPost->id, 'user_id' => 3]);
<add>
<add> $results = EloquentTestPost::has('childPosts.childPosts')->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('Grandparent Post', $results->first()->name);
<add> }
<add>
<add> public function testWhereHasOnNestedSelfReferencingHasManyRelationship()
<add> {
<add> $grandParentPost = EloquentTestPost::create(['name' => 'Grandparent Post', 'user_id' => 1]);
<add> $parentPost = EloquentTestPost::create(['name' => 'Parent Post', 'parent_id' => $grandParentPost->id, 'user_id' => 2]);
<add> $childPost = EloquentTestPost::create(['name' => 'Child Post', 'parent_id' => $parentPost->id, 'user_id' => 3]);
<add>
<add> $results = EloquentTestPost::whereHas('childPosts.childPosts', function ($query) {
<add> $query->where('name', 'Child Post');
<add> })->get();
<add>
<add> $this->assertEquals(1, count($results));
<add> $this->assertEquals('Grandparent Post', $results->first()->name);
<add> }
<add>
<ide> public function testBelongsToManyRelationshipModelsAreProperlyHydratedOverChunkedRequest()
<ide> {
<ide> $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
<ide> public function testBasicHasManyEagerLoading()
<ide> $this->assertEquals('taylorotwell@gmail.com', $post->first()->user->email);
<ide> }
<ide>
<add> public function testBasicNestedSelfReferencingHasManyEagerLoading()
<add> {
<add> $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
<add> $post = $user->posts()->create(['name' => 'First Post']);
<add> $post->childPosts()->create(['name' => 'Child Post', 'user_id' => $user->id]);
<add>
<add> $user = EloquentTestUser::with('posts.childPosts')->where('email', 'taylorotwell@gmail.com')->first();
<add>
<add> $this->assertNotNull($user->posts->first());
<add> $this->assertEquals('First Post', $user->posts->first()->name);
<add>
<add> $this->assertNotNull($user->posts->first()->childPosts->first());
<add> $this->assertEquals('Child Post', $user->posts->first()->childPosts->first()->name);
<add>
<add> $post = EloquentTestPost::with('parentPost.user')->where('name', 'Child Post')->get();
<add> $this->assertNotNull($post->first()->parentPost);
<add> $this->assertNotNull($post->first()->parentPost->user);
<add> $this->assertEquals('taylorotwell@gmail.com', $post->first()->parentPost->user->email);
<add> }
<add>
<ide> public function testBasicMorphManyRelationship()
<ide> {
<ide> $user = EloquentTestUser::create(['email' => 'taylorotwell@gmail.com']);
<ide> public function friends()
<ide> return $this->belongsToMany('EloquentTestUser', 'friends', 'user_id', 'friend_id');
<ide> }
<ide>
<add> public function friendsOne()
<add> {
<add> return $this->belongsToMany('EloquentTestUser', 'friends', 'user_id', 'friend_id')->wherePivot('user_id', 1);
<add> }
<add>
<add> public function friendsTwo()
<add> {
<add> return $this->belongsToMany('EloquentTestUser', 'friends', 'user_id', 'friend_id')->wherePivot('user_id', 2);
<add> }
<add>
<ide> public function posts()
<ide> {
<ide> return $this->hasMany('EloquentTestPost', 'user_id'); | 2 |
Javascript | Javascript | allow relative urls in getdocument | af4bd10c705afb76ee497897e6d5d7cda0b33f21 | <ide><path>src/api.js
<ide> PDFJS.getDocument = function getDocument(source) {
<ide> if (!source.url && !source.data)
<ide> error('Invalid parameter array, need either .data or .url');
<ide>
<add> // copy/use all keys as is except 'url' -- full path is required
<add> var params = {};
<add> for (var key in source) {
<add> if (key === 'url' && typeof window !== 'undefined') {
<add> params[key] = combineUrl(window.location.href, source[key]);
<add> continue;
<add> }
<add> params[key] = source[key];
<add> }
<add>
<ide> workerInitializedPromise = new PDFJS.Promise();
<ide> workerReadyPromise = new PDFJS.Promise();
<ide> transport = new WorkerTransport(workerInitializedPromise, workerReadyPromise);
<ide> workerInitializedPromise.then(function transportInitialized() {
<del> transport.fetchDocument(source);
<add> transport.fetchDocument(params);
<ide> });
<ide> return workerReadyPromise;
<ide> };
<ide><path>src/util.js
<ide> function combineUrl(baseUrl, url) {
<ide> return baseUrl.substring(0, prefixLength + 1) + url;
<ide> }
<ide> }
<del>PDFJS.combineUrl = combineUrl;
<ide>
<ide> // In a well-formed PDF, |cond| holds. If it doesn't, subsequent
<ide> // behavior is undefined.
<ide><path>web/viewer.js
<ide> var PDFView = {
<ide> if (typeof url === 'string') { // URL
<ide> this.url = url;
<ide> document.title = decodeURIComponent(getFileName(url)) || url;
<del> parameters.url = PDFJS.combineUrl(window.location.href, url);
<add> parameters.url = url;
<ide> } else if (url && 'byteLength' in url) { // ArrayBuffer
<ide> parameters.data = url;
<ide> } | 3 |
PHP | PHP | add doc blocks | fad7c83e1159b73723fbc0b53bb11d3b157c3920 | <ide><path>src/Console/Shell.php
<ide> protected function _stop($status = 0)
<ide> exit($status);
<ide> }
<ide>
<add> /**
<add> * Returns an array that can be used to describe the internal state of this
<add> * object.
<add> *
<add> * @return array
<add> */
<ide> public function __debugInfo()
<ide> {
<ide> return [
<ide><path>src/Controller/Component.php
<ide> public function implementedEvents()
<ide> return $events;
<ide> }
<ide>
<add> /**
<add> * Returns an array that can be used to describe the internal state of this
<add> * object.
<add> *
<add> * @return array
<add> */
<ide> public function __debugInfo()
<ide> {
<ide> return [
<ide><path>src/View/Helper.php
<ide> public function implementedEvents()
<ide> return $events;
<ide> }
<ide>
<add> /**
<add> * Returns an array that can be used to describe the internal state of this
<add> * object.
<add> *
<add> * @return array
<add> */
<ide> public function __debugInfo()
<ide> {
<ide> return [ | 3 |
PHP | PHP | add checked helper | 84d433d7d7acd44cce5d9f0b7562439346e6fe19 | <ide><path>src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php
<ide> public function setUpRedis()
<ide> */
<ide> public function tearDownRedis()
<ide> {
<del> $this->redis['phpredis']->connection()->flushdb();
<add> if (isset($this->redis['phpredis'])) {
<add> $this->redis['phpredis']->connection()->flushdb();
<add> }
<ide>
<ide> foreach ($this->redisDriverProvider() as $driver) {
<del> $this->redis[$driver[0]]->connection()->disconnect();
<add> if (isset($this->redis[$driver[0]])) {
<add> $this->redis[$driver[0]]->connection()->disconnect();
<add> }
<ide> }
<ide> }
<ide>
<ide><path>src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php
<ide> public function compileEndOnce()
<ide> {
<ide> return '<?php endif; ?>';
<ide> }
<add>
<add> /**
<add> * Compile a checked block into valid PHP.
<add> *
<add> * @param string $condition
<add> * @return string
<add> */
<add> protected function compileChecked($condition)
<add> {
<add> return "<?php if{$condition}: echo 'checked'; endif; ?>";
<add> }
<ide> }
<ide><path>tests/View/Blade/BladeCheckedStatementsTest.php
<add><?php
<add>
<add>namespace Illuminate\Tests\View\Blade;
<add>
<add>class BladeCheckedStatementsTest extends AbstractBladeTestCase
<add>{
<add> public function testCheckedStatementsAreCompiled()
<add> {
<add> $string = '<input @checked(name(foo(bar)))/>';
<add> $expected = "<input <?php if(name(foo(bar))): echo 'checked'; endif; ?>/>";
<add>
<add> $this->assertEquals($expected, $this->compiler->compileString($string));
<add> }
<add>} | 3 |
Mixed | Text | improve docs for when using head or similar flags | bd0533448718bbf323e58070fc711d662c54b855 | <ide><path>Library/Contributions/manpages/brew.1.md
<ide> Note that these flags should only appear after a command.
<ide> A few formulae provide a test method. `brew test <formula>` runs this
<ide> test method. There is no standard output or return code, but it should
<ide> generally indicate to the user if something is wrong with the installed
<del> formula.
<add> formula. Options passed to `brew install` such as `--HEAD` also need to
<add> be provided to `brew test`.
<ide>
<ide> Example: `brew install jruby && brew test jruby`
<ide>
<ide><path>Library/Homebrew/cmd/create.rb
<ide> def install
<ide> #
<ide> # This test will fail and we won't accept that! It's enough to just replace
<ide> # "false" with the main program this formula installs, but it'd be nice if you
<del> # were more thorough. Run the test with `brew test #{name}`.
<add> # were more thorough. Run the test with `brew test #{name}`. Options passed
<add> # to `brew install` such as `--HEAD` also need to be provided to `brew test`.
<ide> #
<ide> # The installed folder is not in the path, so use the entire path to any
<ide> # executables being tested: `system "\#{bin}/program", "do", "something"`. | 2 |
Javascript | Javascript | improve flaky test-listen-fd-ebadf.js | 1d8789188fa156d5eb75c155f6c648c2bd96b842 | <ide><path>test/parallel/test-listen-fd-ebadf.js
<ide>
<ide> 'use strict';
<ide> const common = require('../common');
<add>
<ide> const assert = require('assert');
<add>const fs = require('fs');
<ide> const net = require('net');
<ide>
<ide> net.createServer(common.mustNotCall()).listen({ fd: 2 })
<ide> .on('error', common.mustCall(onError));
<del>net.createServer(common.mustNotCall()).listen({ fd: 42 })
<add>
<add>let invalidFd = 2;
<add>
<add>// Get first known bad file descriptor.
<add>try {
<add> while (fs.fstatSync(++invalidFd));
<add>} catch (e) {
<add> // do nothing; we now have an invalid fd
<add>}
<add>
<add>net.createServer(common.mustNotCall()).listen({ fd: invalidFd })
<ide> .on('error', common.mustCall(onError));
<ide>
<ide> function onError(ex) { | 1 |
PHP | PHP | implement method support | 46dd880e745421afb5e5f3a703096c3346e56b0f | <ide><path>src/Illuminate/Queue/Queue.php
<ide> protected function createObjectPayload($job, $queue)
<ide> 'displayName' => $this->getDisplayName($job),
<ide> 'job' => 'Illuminate\Queue\CallQueuedHandler@call',
<ide> 'maxTries' => $job->tries ?? null,
<del> 'delay' => $job->delay ?? null,
<add> 'delay' => $this->getJobRetryDelay($job),
<ide> 'timeout' => $job->timeout ?? null,
<ide> 'timeoutAt' => $this->getJobExpiration($job),
<ide> 'data' => [
<ide> protected function getDisplayName($job)
<ide> ? $job->displayName() : get_class($job);
<ide> }
<ide>
<add> /**
<add> * Get the retry delay for an object-based queue handler.
<add> *
<add> * @param mixed $job
<add> * @return mixed
<add> */
<add> public function getJobRetryDelay($job)
<add> {
<add> if (! method_exists($job, 'retryAfter') && ! isset($job->retryAfter)) {
<add> return;
<add> }
<add>
<add> $delay = $job->retryAfter ?? $job->retryAfter();
<add>
<add> return $delay instanceof DateTimeInterface
<add> ? $this->secondsUntil($delay) : $delay;
<add> }
<add>
<ide> /**
<ide> * Get the expiration timestamp for an object-based queue handler.
<ide> *
<ide><path>tests/Queue/QueueWorkerTest.php
<ide> public function test_job_based_max_retries()
<ide> $this->assertNull($job->failedWith);
<ide> }
<ide>
<add>
<add> public function test_job_based_failed_delay()
<add> {
<add> $job = new WorkerFakeJob(function ($job) {
<add> throw new \Exception('Something went wrong.');
<add> });
<add>
<add> $job->attempts = 1;
<add> $job->delaySeconds = 10;
<add>
<add> $worker = $this->getWorker('default', ['queue' => [$job]]);
<add> $worker->runNextJob('default', 'queue', $this->workerOptions(['delay' => 3]));
<add>
<add> $this->assertEquals(10, $job->releaseAfter);
<add> }
<add>
<add>
<ide> /**
<ide> * Helpers...
<ide> */
<ide> class WorkerFakeJob implements QueueJobContract
<ide> public $releaseAfter;
<ide> public $released = false;
<ide> public $maxTries;
<add> public $delaySeconds;
<ide> public $timeoutAt;
<ide> public $attempts = 0;
<ide> public $failedWith;
<ide> public function maxTries()
<ide> return $this->maxTries;
<ide> }
<ide>
<add> public function delaySeconds()
<add> {
<add> return $this->delaySeconds;
<add> }
<add>
<ide> public function timeoutAt()
<ide> {
<ide> return $this->timeoutAt; | 2 |
Ruby | Ruby | support version format | eec8cc6a12b6676e8a8da3a7cced4547d8bd3c8b | <ide><path>Library/Homebrew/test/test_versions.rb
<ide> def test_apache_version_style
<ide> assert_version_detected '1.2.0-rc2', 'http://www.apache.org/dyn/closer.cgi?path=/cassandra/1.2.0/apache-cassandra-1.2.0-rc2-bin.tar.gz'
<ide> end
<ide>
<add> def test_jpeg_style
<add> assert_version_detected '8d', 'http://www.ijg.org/files/jpegsrc.v8d.tar.gz'
<add> end
<add>
<ide> # def test_version_ghc_style
<ide> # assert_version_detected '7.0.4', 'http://www.haskell.org/ghc/dist/7.0.4/ghc-7.0.4-x86_64-apple-darwin.tar.bz2'
<ide> # assert_version_detected '7.0.4', 'http://www.haskell.org/ghc/dist/7.0.4/ghc-7.0.4-i386-apple-darwin.tar.bz2'
<ide><path>Library/Homebrew/version.rb
<ide> def self._parse spec
<ide> # e.g. http://mirrors.jenkins-ci.org/war/1.486/jenkins.war
<ide> m = /\/(\d\.\d+)\//.match(spec.to_s)
<ide> return m.captures.first unless m.nil?
<add>
<add> # e.g. http://www.ijg.org/files/jpegsrc.v8d.tar.gz
<add> m = /\.v(\d+[a-z]?)/.match(stem)
<add> return m.captures.first unless m.nil?
<ide> end
<ide>
<ide> # DSL for defining comparators | 2 |
Java | Java | fix minor javadoc typos | 39c236baa8c3f189cc422f2814443fd9652876fb | <ide><path>spring-jms/src/main/java/org/springframework/jms/listener/endpoint/JmsMessageEndpointFactory.java
<ide> /*
<del> * Copyright 2002-2012 the original author or authors.
<add> * Copyright 2002-2013 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> protected ClassLoader getEndpointClassLoader() {
<ide>
<ide>
<ide> /**
<del> * Internal exception thrown when a ResourceExeption has been encountered
<add> * Internal exception thrown when a ResourceException has been encountered
<ide> * during the endpoint invocation.
<ide> * <p>Will only be used if the ResourceAdapter does not invoke the
<ide> * endpoint's {@code beforeDelivery} and {@code afterDelivery}
<del> * directly, leavng it up to the concrete endpoint to apply those -
<add> * directly, leaving it up to the concrete endpoint to apply those -
<ide> * and to handle any ResourceExceptions thrown from them.
<ide> */
<ide> @SuppressWarnings("serial")
<ide><path>spring-tx/src/main/java/org/springframework/jca/endpoint/GenericMessageEndpointFactory.java
<ide> /*
<del> * Copyright 2002-2012 the original author or authors.
<add> * Copyright 2002-2013 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> protected ClassLoader getEndpointClassLoader() {
<ide>
<ide>
<ide> /**
<del> * Internal exception thrown when a ResourceExeption has been encountered
<add> * Internal exception thrown when a ResourceException has been encountered
<ide> * during the endpoint invocation.
<ide> * <p>Will only be used if the ResourceAdapter does not invoke the
<ide> * endpoint's {@code beforeDelivery} and {@code afterDelivery}
<del> * directly, leavng it up to the concrete endpoint to apply those -
<add> * directly, leaving it up to the concrete endpoint to apply those -
<ide> * and to handle any ResourceExceptions thrown from them.
<ide> */
<ide> @SuppressWarnings("serial") | 2 |
Java | Java | refine check for multiple subscribers | 7a5f8e03bc53ad78f76be82ecdd5fc8b8e86797a | <ide><path>spring-web/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpResponse.java
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.HttpStatus;
<ide> import org.springframework.http.ResponseCookie;
<del>import org.springframework.util.Assert;
<ide> import org.springframework.util.CollectionUtils;
<ide> import org.springframework.util.LinkedMultiValueMap;
<ide> import org.springframework.util.MultiValueMap;
<ide> class ReactorClientHttpResponse implements ClientHttpResponse {
<ide>
<ide> private final NettyInbound inbound;
<ide>
<del> private final AtomicBoolean bodyConsumed = new AtomicBoolean();
<add> private final AtomicBoolean rejectSubscribers = new AtomicBoolean();
<ide>
<ide>
<ide> public ReactorClientHttpResponse(HttpClientResponse response, NettyInbound inbound, ByteBufAllocator alloc) {
<ide> public ReactorClientHttpResponse(HttpClientResponse response, NettyInbound inbou
<ide> @Override
<ide> public Flux<DataBuffer> getBody() {
<ide> return this.inbound.receive()
<del> .doOnSubscribe(s ->
<del> // See https://github.com/reactor/reactor-netty/issues/503
<del> Assert.state(this.bodyConsumed.compareAndSet(false, true),
<del> "The client response body can only be consumed once."))
<add> .doOnSubscribe(s -> {
<add> if (this.rejectSubscribers.get()) {
<add> throw new IllegalStateException("The client response body can only be consumed once.");
<add> }
<add> })
<add> .doOnCancel(() -> {
<add> // https://github.com/reactor/reactor-netty/issues/503
<add> // FluxReceive rejects multiple subscribers, but not after a cancel().
<add> // Subsequent subscribers after cancel() will not be rejected, but will hang instead.
<add> // So we need to intercept and reject them in that case.
<add> this.rejectSubscribers.set(true);
<add> })
<ide> .map(byteBuf -> {
<ide> byteBuf.retain();
<ide> return this.bufferFactory.wrap(byteBuf);
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java
<ide> private <T extends Publisher<?>> T handleBody(ClientResponse response,
<ide> @SuppressWarnings("unchecked")
<ide> private <T> Mono<T> drainBody(ClientResponse response, Throwable ex) {
<ide> // Ensure the body is drained, even if the StatusHandler didn't consume it,
<del> // but ignore errors in case it did consume it.
<del> return (Mono<T>) response.bodyToMono(Void.class).onErrorMap(ex2 -> ex).thenReturn(ex);
<add> // but ignore exception, in case the handler did consume.
<add> return (Mono<T>) response.bodyToMono(Void.class)
<add> .onErrorResume(ex2 -> Mono.empty()).thenReturn(ex);
<ide> }
<ide>
<ide> private static Mono<WebClientResponseException> createResponseException(ClientResponse response) { | 2 |
Text | Text | fix incorrect changelog headings [ci skip] | 8a714c4d804d2502c4b1bdfccb3e9175c4add7b8 | <ide><path>actionmailer/CHANGELOG.md
<del>## Rails 4.0.0 (unreleased) ##
<add>## Rails 3.2.3 (unreleased) ##
<ide>
<ide> * Upgrade mail version to 2.4.3 *ML*
<ide>
<ide><path>actionpack/CHANGELOG.md
<ide> ## Rails 4.0.0 (unreleased) ##
<ide>
<del>* Upgrade rack-cache to 1.2. *José Valim*
<del>
<del>* ActionController::SessionManagement is removed. *Santiago Pastorino*
<del>
<del>* Since the router holds references to many parts of the system like engines, controllers and the application itself, inspecting the route set can actually be really slow, therefore we default alias inspect to to_s. *José Valim*
<del>
<del>* Add a new line after the textarea opening tag. Closes #393 *rafaelfranca*
<del>
<del>* Always pass a respond block from to responder. We should let the responder to decide what to do with the given overridden response block, and not short circuit it. *sikachu*
<del>
<del>* Fixes layout rendering regression from 3.2.2. *José Valim*
<del>
<ide> * Adds support for layouts when rendering a partial with a given collection. *serabe*
<ide>
<ide> * Allows the route helper `root` to take a string argument. For example, `root 'pages#main'`. *bcardarella*
<ide> * `ActionView::Helpers::TextHelper#highlight` now defaults to the
<ide> HTML5 `mark` element. *Brian Cardarella*
<ide>
<add>## Rails 3.2.3 (unreleased) ##
<add>
<add>* Upgrade rack-cache to 1.2. *José Valim*
<add>
<add>* ActionController::SessionManagement is removed. *Santiago Pastorino*
<add>
<add>* Since the router holds references to many parts of the system like engines, controllers and the application itself, inspecting the route set can actually be really slow, therefore we default alias inspect to to_s. *José Valim*
<add>
<add>* Add a new line after the textarea opening tag. Closes #393 *rafaelfranca*
<add>
<add>* Always pass a respond block from to responder. We should let the responder to decide what to do with the given overridden response block, and not short circuit it. *sikachu*
<add>
<add>* Fixes layout rendering regression from 3.2.2. *José Valim*
<ide>
<ide> ## Rails 3.2.2 (March 1, 2012) ##
<ide>
<ide><path>activerecord/CHANGELOG.md
<ide> ## Rails 4.0.0 (unreleased) ##
<ide>
<del>* Whitelist all attribute assignment by default. Change the default for newly generated applications to whitelist all attribute assignment. Also update the generated model classes so users are reminded of the importance of attr_accessible. *NZKoz*
<del>
<del>* Update ActiveRecord::AttributeMethods#attribute_present? to return false for empty strings. *Jacobkg*
<del>
<del>* Fix associations when using per class databases. *larskanis*
<del>
<del>* Revert setting NOT NULL constraints in add_timestamps *fxn*
<del>
<del>* Fix mysql to use proper text types. Fixes #3931. *kennyj*
<del>
<del>* Fix #5069 - Protect foreign key from mass assignment through association builder. *byroot*
<del>
<ide> * Added the schema cache dump feature.
<ide>
<ide> `Schema cache dump` feature was implemetend. This feature can dump/load internal state of `SchemaCache` instance
<ide>
<ide> * PostgreSQL hstore types are automatically deserialized from the database.
<ide>
<add>## Rails 3.2.3 (unreleased) ##
<add>
<add>* Whitelist all attribute assignment by default. Change the default for newly generated applications to whitelist all attribute assignment. Also update the generated model classes so users are reminded of the importance of attr_accessible. *NZKoz*
<add>
<add>* Update ActiveRecord::AttributeMethods#attribute_present? to return false for empty strings. *Jacobkg*
<add>
<add>* Fix associations when using per class databases. *larskanis*
<add>
<add>* Revert setting NOT NULL constraints in add_timestamps *fxn*
<add>
<add>* Fix mysql to use proper text types. Fixes #3931. *kennyj*
<add>
<add>* Fix #5069 - Protect foreign key from mass assignment through association builder. *byroot*
<ide>
<ide> ## Rails 3.2.1 (January 26, 2012) ##
<ide> | 3 |
Javascript | Javascript | remove btoa from domstubs.js | 3479a19bf08884c08e353385b433380ad0ff5e49 | <ide><path>examples/node/domstubs.js
<ide> function xmlEncode(s){
<ide> return buf;
<ide> }
<ide>
<del>function btoa(chars) {
<del> var digits =
<del> 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
<del> var buffer = '';
<del> var i, n;
<del> for (i = 0, n = chars.length; i < n; i += 3) {
<del> var b1 = chars.charCodeAt(i) & 0xFF;
<del> var b2 = chars.charCodeAt(i + 1) & 0xFF;
<del> var b3 = chars.charCodeAt(i + 2) & 0xFF;
<del> var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4);
<del> var d3 = i + 1 < n ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64;
<del> var d4 = i + 2 < n ? (b3 & 0x3F) : 64;
<del> buffer += (digits.charAt(d1) + digits.charAt(d2) +
<del> digits.charAt(d3) + digits.charAt(d4));
<del> }
<del> return buffer;
<del>}
<del>
<ide> function DOMElement(name) {
<ide> this.nodeName = name;
<ide> this.childNodes = [];
<ide> Image.prototype = {
<ide> }
<ide> }
<ide>
<del>exports.btoa = btoa;
<ide> exports.document = document;
<ide> exports.Image = Image;
<ide> | 1 |
Java | Java | set a size of the root view before running test | 0bbfe79623c97d349586266885b5af58137d771f | <ide><path>ReactAndroid/src/test/java/com/facebook/react/views/textinput/TextInputTest.java
<ide> public void testPropsApplied() {
<ide> UIManagerModule uiManager = getUIManagerModule();
<ide>
<ide> ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application);
<add> rootView.setLayoutParams(new ReactRootView.LayoutParams(100, 100));
<ide> int rootTag = uiManager.addMeasuredRootView(rootView);
<ide> int textInputTag = rootTag + 1;
<ide> final String hintStr = "placeholder text";
<ide> public void testPropsUpdate() {
<ide> UIManagerModule uiManager = getUIManagerModule();
<ide>
<ide> ReactRootView rootView = new ReactRootView(RuntimeEnvironment.application);
<add> rootView.setLayoutParams(new ReactRootView.LayoutParams(100, 100));
<ide> int rootTag = uiManager.addMeasuredRootView(rootView);
<ide> int textInputTag = rootTag + 1;
<ide> final String hintStr = "placeholder text"; | 1 |
Ruby | Ruby | correct the dedup code | 23c5558f37c2c55807e7603415214f2b4b7b22c1 | <ide><path>actionpack/lib/action_dispatch/journey/scanner.rb
<ide> def next_token
<ide> end
<ide>
<ide> private
<del>
<add>
<ide> # takes advantage of String @- deduping capabilities in Ruby 2.5 upwards
<ide> # see: https://bugs.ruby-lang.org/issues/13077
<ide> def dedup_scan(regex)
<ide> def scan
<ide> [:SYMBOL, text]
<ide> when text = dedup_scan(/\*\w+/)
<ide> [:STAR, text]
<del> when text = dedup_scan(/(?:[\w%\-~!$&'*+,;=@]|\\[:()])+/)
<add> when text = @ss.scan(/(?:[\w%\-~!$&'*+,;=@]|\\[:()])+/)
<ide> text.tr! "\\", ""
<del> [:LITERAL, text]
<add> [:LITERAL, -text]
<ide> # any char
<ide> when text = dedup_scan(/./)
<ide> [:LITERAL, text] | 1 |
PHP | PHP | add $localkey to morphtomany relation | c0f425cd5838d9b00c10c51137e99a88b5f28c93 | <ide><path>src/Illuminate/Database/Eloquent/Relations/MorphToMany.php
<ide> class MorphToMany extends BelongsToMany
<ide> * @param string $table
<ide> * @param string $foreignKey
<ide> * @param string $relatedKey
<del> * @param string $localKey
<ide> * @param string $parentKey
<add> * @param string $localKey
<ide> * @param string $relationName
<ide> * @param bool $inverse
<ide> * @return void
<ide> */
<del> public function __construct(Builder $query, Model $parent, $name, $table, $foreignKey, $relatedKey, $localKey, $parentKey, $relationName = null, $inverse = false)
<add> public function __construct(Builder $query, Model $parent, $name, $table, $foreignKey, $relatedKey, $parentKey, $localKey, $relationName = null, $inverse = false)
<ide> {
<ide> $this->inverse = $inverse;
<ide> $this->morphType = $name.'_type';
<ide> $this->morphClass = $inverse ? $query->getModel()->getMorphClass() : $parent->getMorphClass();
<ide>
<del> parent::__construct($query, $parent, $table, $foreignKey, $relatedKey, $localKey, $parentKey, $relationName);
<add> parent::__construct($query, $parent, $table, $foreignKey, $relatedKey, $parentKey, $localKey, $relationName);
<ide> }
<ide>
<ide> /** | 1 |
Ruby | Ruby | add missing test cases for asset_path | 21208d2ab0ab98426069dfc0c86f5dd1a2876b8c | <ide><path>actionview/test/template/asset_tag_helper_test.rb
<ide> def url_for(*args)
<ide> end
<ide>
<ide> AssetPathToTag = {
<add> %(asset_path("")) => %(),
<add> %(asset_path(" ")) => %(),
<ide> %(asset_path("foo")) => %(/foo),
<ide> %(asset_path("style.css")) => %(/style.css),
<ide> %(asset_path("xmlhr.js")) => %(/xmlhr.js), | 1 |
Javascript | Javascript | update snapshot path exclusions | ebc824abd17e04814cefe170cf5701476a7c165f | <ide><path>script/lib/generate-startup-snapshot.js
<ide> module.exports = function (packagedAppPath) {
<ide> modulePath.endsWith('.node') ||
<ide> coreModules.has(modulePath) ||
<ide> (relativePath.startsWith(path.join('..', 'src')) && relativePath.endsWith('-element.js')) ||
<add> relativePath.startsWith(path.join('..', 'node_modules', 'dugite')) ||
<ide> relativePath == path.join('..', 'exports', 'atom.js') ||
<ide> relativePath == path.join('..', 'src', 'electron-shims.js') ||
<ide> relativePath == path.join('..', 'src', 'safe-clipboard.js') ||
<ide> module.exports = function (packagedAppPath) {
<ide> relativePath == path.join('..', 'node_modules', 'cson-parser', 'node_modules', 'coffee-script', 'lib', 'coffee-script', 'register.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'decompress-zip', 'lib', 'decompress-zip.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'debug', 'node.js') ||
<add> relativePath == path.join('..', 'node_modules', 'fs-extra', 'lib', 'index.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'git-utils', 'lib', 'git.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'glob', 'glob.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'graceful-fs', 'graceful-fs.js') ||
<ide> module.exports = function (packagedAppPath) {
<ide> relativePath == path.join('..', 'node_modules', 'less', 'lib', 'less-node', 'index.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'less', 'node_modules', 'graceful-fs', 'graceful-fs.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'minimatch', 'minimatch.js') ||
<add> relativePath == path.join('..', 'node_modules', 'node-fetch', 'lib', 'fetch-error.js') ||
<add> relativePath == path.join('..', 'node_modules', 'nsfw', 'node_modules', 'fs-extra', 'lib', 'index.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'superstring', 'index.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'oniguruma', 'src', 'oniguruma.js') ||
<ide> relativePath == path.join('..', 'node_modules', 'request', 'index.js') || | 1 |
Javascript | Javascript | use ember.$ in the tests | 635de93a9329f3f3fbf53473542b266805f81cc6 | <ide><path>packages/ember-views/tests/system/render_buffer_test.js
<ide> test("properly handles old IE's zero-scope bug", function() {
<ide> buffer.push('<script></script>foo');
<ide>
<ide> var element = buffer.element();
<del> ok($(element).html().match(/script/i), "should have script tag");
<del> ok(!$(element).html().match(/­/), "should not have ­");
<add> ok(Ember.$(element).html().match(/script/i), "should have script tag");
<add> ok(!Ember.$(element).html().match(/­/), "should not have ­");
<ide> }); | 1 |
Python | Python | remove some tests to see build status changes | 7a2adc46337d786c1ba91521783fddc19fed9f0c | <ide><path>spacy/tests/regression/test_issue1769.py
<ide> from ...lang.en.lex_attrs import like_num as en_like_num
<ide> from ...lang.fr.lex_attrs import like_num as fr_like_num
<ide> from ...lang.id.lex_attrs import like_num as id_like_num
<del>from ...lang.nl.lex_attrs import like_num as nl_like_num
<del>from ...lang.pt.lex_attrs import like_num as pt_like_num
<del>from ...lang.ru.lex_attrs import like_num as ru_like_num
<add># from ...lang.nl.lex_attrs import like_num as nl_like_num
<add># from ...lang.pt.lex_attrs import like_num as pt_like_num
<add># from ...lang.ru.lex_attrs import like_num as ru_like_num
<ide>
<ide> import pytest
<ide>
<ide> def words():
<ide> }
<ide>
<ide>
<del>
<ide> def like_num(words, fn):
<ide> ok = True
<ide> for word in words:
<ide> def test_id_lex_attrs(words):
<ide> assert like_num(words["id"]["num_words"], id_like_num) == True
<ide>
<ide>
<del>def test_nl_lex_attrs(words):
<del> assert like_num(words["nl"]["num_words"], nl_like_num) == True
<del> assert like_num(words["nl"]["ord_words"], nl_like_num) == True
<del>
<del>
<del>def test_pt_lex_attrs(words):
<del> assert like_num(words["pt"]["num_words"], pt_like_num) == True
<del> assert like_num(words["pt"]["ord_words"], pt_like_num) == True
<del>
<del>
<del>def test_ru_lex_attrs(words):
<del> assert like_num(words["ru"]["num_words"], ru_like_num) == True
<add># def test_nl_lex_attrs(words):
<add># assert like_num(words["nl"]["num_words"], nl_like_num) == True
<add># assert like_num(words["nl"]["ord_words"], nl_like_num) == True
<add>#
<add>#
<add># def test_pt_lex_attrs(words):
<add># assert like_num(words["pt"]["num_words"], pt_like_num) == True
<add># assert like_num(words["pt"]["ord_words"], pt_like_num) == True
<add>#
<add>#
<add># def test_ru_lex_attrs(words):
<add># assert like_num(words["ru"]["num_words"], ru_like_num) == True | 1 |
Python | Python | add missing feature extractors | 33b7c9a8aaa9b94dd67549be8755e3f051bacee9 | <ide><path>src/transformers/models/auto/feature_extraction_auto.py
<ide> ("speech_to_text", "Speech2TextFeatureExtractor"),
<ide> ("vit", "ViTFeatureExtractor"),
<ide> ("wav2vec2", "Wav2Vec2FeatureExtractor"),
<add> ("detr", "DetrFeatureExtractor"),
<add> ("layoutlmv2", "LayoutLMv2FeatureExtractor"),
<add> ("clip", "ClipFeatureExtractor"),
<ide> ]
<ide> )
<ide> | 1 |
Text | Text | add resources for version control | 8324537a4646caa9cf69448ecf6473a0c7d5284d | <ide><path>guide/english/working-in-tech/code-reviews/index.md
<ide> title: Code Reviews
<ide> ---
<ide> ## Code Reviews
<add>
<ide> Code Reviews exist in order to improve the quality of the code in a software project and are common practice for many software development teams.
<ide> Code reviews involve team members looking into each others' code submissions to check for bugs, incorrect logic or
<ide> potential improvements. A code review can be done amongst developers of the project under review, as well as developers from other teams in the same company.
<ide> It is important to be humble throughout the code review process. Accept your mis
<ide> and be professional when pointing out improvements or errors in the code of your fellow
<ide> team members.
<ide>
<del>[How to Do Code Reviews Like a Human (Part One)](https://mtlynch.io/human-code-reviews-1/)
<add>## Want to learn more?
<add>
<add>* [GitHub Documentation](https://github.com/features/code-review) : Learn how to write better code and document your changes with version control
<add>* [How to Do Code Reviews Like a Human (Part One)](https://mtlynch.io/human-code-reviews-1/) | 1 |
Go | Go | fix nat integration tests | 4f4209788378e580247d4baff65ae5b58afac4ba | <ide><path>integration-cli/docker_cli_nat_test.go
<ide> package main
<ide>
<ide> import (
<ide> "fmt"
<add> "io/ioutil"
<ide> "net"
<ide> "os/exec"
<ide> "strings"
<ide>
<ide> "github.com/go-check/check"
<ide> )
<ide>
<del>func startServerContainer(c *check.C, proto string, port int) string {
<del> pStr := fmt.Sprintf("%d:%d", port, port)
<del> bCmd := fmt.Sprintf("nc -lp %d && echo bye", port)
<del> cmd := []string{"-d", "-p", pStr, "busybox", "sh", "-c", bCmd}
<del> if proto == "udp" {
<del> cmd = append(cmd, "-u")
<del> }
<del>
<add>func startServerContainer(c *check.C, msg string, port int) string {
<ide> name := "server"
<add> cmd := []string{
<add> "-d",
<add> "-p", fmt.Sprintf("%d:%d", port, port),
<add> "busybox",
<add> "sh", "-c", fmt.Sprintf("echo %q | nc -lp %d", msg, port),
<add> }
<ide> if err := waitForContainer(name, cmd...); err != nil {
<ide> c.Fatalf("Failed to launch server container: %v", err)
<ide> }
<ide> func getContainerStatus(c *check.C, containerID string) string {
<ide>
<ide> func (s *DockerSuite) TestNetworkNat(c *check.C) {
<ide> testRequires(c, SameHostDaemon, NativeExecDriver)
<del>
<del> srv := startServerContainer(c, "tcp", 8080)
<del>
<del> // Spawn a new container which connects to the server through the
<del> // interface address.
<add> msg := "it works"
<add> startServerContainer(c, msg, 8080)
<ide> endpoint := getExternalAddress(c)
<del> runCmd := exec.Command(dockerBinary, "run", "busybox", "sh", "-c", fmt.Sprintf("echo hello world | nc -w 30 %s 8080", endpoint))
<del> if out, _, err := runCommandWithOutput(runCmd); err != nil {
<del> c.Fatalf("Failed to connect to server: %v (output: %q)", err, string(out))
<add> conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", endpoint.String(), 8080))
<add> if err != nil {
<add> c.Fatalf("Failed to connect to container (%v)", err)
<ide> }
<del>
<del> result := getContainerLogs(c, srv)
<del>
<del> // Ideally we'd like to check for "hello world" but sometimes
<del> // nc doesn't show the data it received so instead let's look for
<del> // the output of the 'echo bye' that should be printed once
<del> // the nc command gets a connection
<del> expected := "bye"
<del> if !strings.Contains(result, expected) {
<del> c.Fatalf("Unexpected output. Expected: %q, received: %q", expected, result)
<add> data, err := ioutil.ReadAll(conn)
<add> conn.Close()
<add> if err != nil {
<add> c.Fatal(err)
<add> }
<add> final := strings.TrimRight(string(data), "\n")
<add> if final != msg {
<add> c.Fatalf("Expected message %q but received %q", msg, final)
<ide> }
<ide> }
<ide>
<ide> func (s *DockerSuite) TestNetworkLocalhostTCPNat(c *check.C) {
<ide> testRequires(c, SameHostDaemon, NativeExecDriver)
<del>
<del> srv := startServerContainer(c, "tcp", 8081)
<del>
<del> // Attempt to connect from the host to the listening container.
<add> var (
<add> msg = "hi yall"
<add> )
<add> startServerContainer(c, msg, 8081)
<ide> conn, err := net.Dial("tcp", "localhost:8081")
<ide> if err != nil {
<ide> c.Fatalf("Failed to connect to container (%v)", err)
<ide> }
<del> if _, err := conn.Write([]byte("hello world\n")); err != nil {
<add> data, err := ioutil.ReadAll(conn)
<add> conn.Close()
<add> if err != nil {
<ide> c.Fatal(err)
<ide> }
<del> conn.Close()
<del>
<del> result := getContainerLogs(c, srv)
<del>
<del> // Ideally we'd like to check for "hello world" but sometimes
<del> // nc doesn't show the data it received so instead let's look for
<del> // the output of the 'echo bye' that should be printed once
<del> // the nc command gets a connection
<del> expected := "bye"
<del> if !strings.Contains(result, expected) {
<del> c.Fatalf("Unexpected output. Expected: %q, received: %q", expected, result)
<add> final := strings.TrimRight(string(data), "\n")
<add> if final != msg {
<add> c.Fatalf("Expected message %q but received %q", msg, final)
<ide> }
<ide> } | 1 |
Javascript | Javascript | fix invalid write after end error | f7f0a6aa5d25a7221afb3ff7543fad019413110d | <ide><path>lib/net.js
<ide> const {
<ide> NumberParseInt,
<ide> ObjectDefineProperty,
<ide> ObjectSetPrototypeOf,
<add> ReflectApply,
<ide> Symbol,
<ide> } = primordials;
<ide>
<ide> function afterShutdown() {
<ide> // of the other side sending a FIN. The standard 'write after end'
<ide> // is overly vague, and makes it seem like the user's code is to blame.
<ide> function writeAfterFIN(chunk, encoding, cb) {
<add> if (!this.writableEnded) {
<add> return ReflectApply(
<add> stream.Duplex.prototype.write, this, [chunk, encoding, cb]);
<add> }
<add>
<ide> if (typeof encoding === 'function') {
<ide> cb = encoding;
<ide> encoding = null;
<ide> Socket.prototype.connect = function(...args) {
<ide> this._unrefTimer();
<ide>
<ide> this.connecting = true;
<del> this.writable = true;
<ide>
<ide> if (pipe) {
<ide> validateString(path, 'options.path');
<ide><path>test/parallel/test-net-writable.js
<add>'use strict';
<add>const common = require('../common');
<add>const assert = require('assert');
<add>const net = require('net');
<add>
<add>const server = net.createServer(common.mustCall(function(s) {
<add> server.close();
<add> s.end();
<add>})).listen(0, 'localhost', common.mustCall(function() {
<add> const socket = net.connect(this.address().port, 'localhost');
<add> socket.on('end', common.mustCall(() => {
<add> assert.strictEqual(socket.writable, true);
<add> socket.write('hello world');
<add> }));
<add>}));
<ide><path>test/parallel/test-socket-write-after-fin-error.js
<ide> const server = net.createServer(function(sock) {
<ide> });
<ide> sock.on('end', function() {
<ide> gotServerEnd = true;
<del> sock.write(serverData);
<del> sock.end();
<add> setImmediate(() => {
<add> sock.write(serverData);
<add> sock.end();
<add> });
<ide> });
<ide> server.close();
<ide> }); | 3 |
Python | Python | remove unnecessary check | c44376c613333cce36e830eb846b4cdcecabaf6c | <ide><path>rest_framework/fields.py
<ide> def __init__(self, protocol='both', unpack_ipv4=False, **kwargs):
<ide> self.validators.extend(validators)
<ide>
<ide> def to_internal_value(self, data):
<del> if data == '' and self.allow_blank:
<del> return ''
<del> data = data.strip()
<del>
<ide> if data and ':' in data:
<ide> try:
<ide> return clean_ipv6_address(data, self.unpack_ipv4)
<ide> except DjangoValidationError:
<ide> self.fail('invalid', value=data)
<ide>
<del> return data
<add> return super(IPAddressField, self).to_internal_value(data)
<ide>
<ide>
<ide> # Number types... | 1 |
Python | Python | prepare 2.2.4 release | 1931e2186843ad3ca2507a3b16cb09a7a3db5285 | <ide><path>keras/__init__.py
<ide> from .models import Model
<ide> from .models import Sequential
<ide>
<del>__version__ = '2.2.3'
<add>__version__ = '2.2.4'
<ide><path>setup.py
<ide> '''
<ide>
<ide> setup(name='Keras',
<del> version='2.2.3',
<add> version='2.2.4',
<ide> description='Deep Learning for humans',
<ide> long_description=long_description,
<ide> author='Francois Chollet',
<ide> author_email='francois.chollet@gmail.com',
<ide> url='https://github.com/keras-team/keras',
<del> download_url='https://github.com/keras-team/keras/tarball/2.2.3',
<add> download_url='https://github.com/keras-team/keras/tarball/2.2.4',
<ide> license='MIT',
<ide> install_requires=['numpy>=1.9.1',
<ide> 'scipy>=0.14', | 2 |
Java | Java | apply padding to rcttext | d9ed1a84c5862f16d0e22fddb5e9a5ca2716af0b | <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/RCTText.java
<ide>
<ide> import com.facebook.csslayout.CSSNode;
<ide> import com.facebook.csslayout.MeasureOutput;
<add>import com.facebook.csslayout.Spacing;
<ide> import com.facebook.fbui.widget.text.staticlayouthelper.StaticLayoutHelper;
<ide> import com.facebook.react.uimanager.PixelUtil;
<del>import com.facebook.react.uimanager.annotations.ReactProp;
<ide> import com.facebook.react.uimanager.ViewDefaults;
<ide> import com.facebook.react.uimanager.ViewProps;
<add>import com.facebook.react.uimanager.annotations.ReactProp;
<ide>
<ide> /**
<ide> * RCTText is a top-level node for text. It extends {@link RCTVirtualText} because it can contain
<ide> public boolean isVirtualAnchor() {
<ide> @Override
<ide> public void measure(CSSNode node, float width, float height, MeasureOutput measureOutput) {
<ide> CharSequence text = getText();
<del>
<ide> if (TextUtils.isEmpty(text)) {
<ide> // to indicate that we don't have anything to display
<ide> mText = null;
<ide> protected void collectState(
<ide> INCLUDE_PADDING));
<ide> }
<ide>
<add> Spacing padding = getPadding();
<add>
<add> left += padding.get(Spacing.LEFT);
<add> top += padding.get(Spacing.TOP);
<add>
<ide> // these are actual right/bottom coordinates where this DrawCommand will draw.
<ide> float layoutRight = left + mDrawCommand.getLayoutWidth();
<ide> float layoutBottom = top + mDrawCommand.getLayoutHeight(); | 1 |
Python | Python | fix init-model for npz vectors | dee8bdb900d32b0aa72da4809ffe4e0e751ece0d | <ide><path>spacy/cli/init_model.py
<ide> def init_model(lang, output_dir, freqs_loc=None, clusters_loc=None, jsonl_loc=No
<ide> if freqs_loc is not None and not freqs_loc.exists():
<ide> prints(freqs_loc, title=Messages.M037, exits=1)
<ide> lex_attrs = read_attrs_from_deprecated(freqs_loc, clusters_loc)
<del> vectors_loc = ensure_path(vectors_loc)
<del> if vectors_loc and vectors_loc.parts[-1].endswith('.npz'):
<del> vectors_data = numpy.load(vectors_loc.open('rb'))
<del> vector_keys = [lex['orth'] for lex in lex_attrs
<del> if 'id' in lex and lex['id'] < vectors_data.shape[0]]
<del> else:
<del> vectors_data, vector_keys = read_vectors(vectors_loc) if vectors_loc else (None, None)
<del> nlp = create_model(lang, lex_attrs, vectors_data, vector_keys, prune_vectors)
<add>
<add> nlp = create_model(lang, lex_attrs)
<add> if vectors_loc is not None:
<add> add_vectors(nlp, vectors_loc, prune_vectors)
<add> vec_added = len(nlp.vocab.vectors)
<add> lex_added = len(nlp.vocab)
<add> prints(Messages.M039.format(entries=lex_added, vectors=vec_added),
<add> title=Messages.M038)
<ide> if not output_dir.exists():
<ide> output_dir.mkdir()
<ide> nlp.to_disk(output_dir)
<ide> def read_attrs_from_deprecated(freqs_loc, clusters_loc):
<ide> return lex_attrs
<ide>
<ide>
<del>def create_model(lang, lex_attrs, vectors_data, vector_keys, prune_vectors):
<add>def create_model(lang, lex_attrs):
<ide> print("Creating model...")
<ide> lang_class = get_lang_class(lang)
<ide> nlp = lang_class()
<ide> for lexeme in nlp.vocab:
<ide> lexeme.rank = 0
<ide> lex_added = 0
<ide> for attrs in lex_attrs:
<add> if 'settings' in attrs:
<add> continue
<ide> lexeme = nlp.vocab[attrs['orth']]
<del> lexeme.set_attrs(**intify_attrs(attrs))
<add> lexeme.set_attrs(**attrs)
<ide> lexeme.is_oov = False
<ide> lex_added += 1
<ide> lex_added += 1
<ide> oov_prob = min(lex.prob for lex in nlp.vocab)
<ide> nlp.vocab.cfg.update({'oov_prob': oov_prob-1})
<del> if vector_keys is not None:
<del> for word in vector_keys:
<del> if word not in nlp.vocab:
<del> lexeme = nlp.vocab[word]
<del> lexeme.is_oov = False
<del> lex_added += 1
<del> if vectors_data is not None:
<del> nlp.vocab.vectors = Vectors(data=vectors_data, keys=vector_keys)
<del> if prune_vectors >= 1:
<del> nlp.vocab.prune_vectors(prune_vectors)
<del> vec_added = len(nlp.vocab.vectors)
<del> prints(Messages.M039.format(entries=lex_added, vectors=vec_added),
<del> title=Messages.M038)
<ide> return nlp
<ide>
<add>def add_vectors(nlp, vectors_loc, prune_vectors):
<add> vectors_loc = ensure_path(vectors_loc)
<add> if vectors_loc and vectors_loc.parts[-1].endswith('.npz'):
<add> nlp.vocab.vectors = Vectors(data=numpy.load(vectors_loc.open('rb')))
<add> for lex in nlp.vocab:
<add> if lex.rank:
<add> nlp.vocab.vectors.add(lex.orth, row=lex.rank)
<add> else:
<add> vectors_data, vector_keys = read_vectors(vectors_loc) if vectors_loc else (None, None)
<add> if vector_keys is not None:
<add> for word in vector_keys:
<add> if word not in nlp.vocab:
<add> lexeme = nlp.vocab[word]
<add> lexeme.is_oov = False
<add> lex_added += 1
<add> if vectors_data is not None:
<add> nlp.vocab.vectors = Vectors(data=vectors_data, keys=vector_keys)
<add> nlp.vocab.vectors.name = '%s_model.vectors' % nlp.meta['lang']
<add> nlp.meta['vectors']['name'] = nlp.vocab.vectors.name
<add> if prune_vectors >= 1:
<add> nlp.vocab.prune_vectors(prune_vectors)
<ide>
<ide> def read_vectors(vectors_loc):
<ide> print("Reading vectors from %s" % vectors_loc) | 1 |
Javascript | Javascript | make querystring.parse() even faster | 5e3ca981556c305830553d006b76d5dcaaf49276 | <ide><path>lib/querystring.js
<ide> QueryString.parse = QueryString.decode = function(qs, sep, eq, options) {
<ide> return obj;
<ide> }
<ide>
<add> var regexp = /\+/g;
<ide> qs = qs.split(sep);
<ide>
<ide> // maxKeys <= 0 means that we should not limit keys count
<ide> if (maxKeys > 0) {
<ide> qs = qs.slice(0, maxKeys);
<ide> }
<ide>
<del> qs.forEach(function(kvp) {
<del> var x = kvp.split(eq), k, v, useQS = false;
<add> for (var i = 0, len = qs.length; i < len; ++i) {
<add> var x = qs[i].replace(regexp, '%20'),
<add> idx = x.indexOf(eq),
<add> kstr = x.substring(0, idx),
<add> vstr = x.substring(idx + 1), k, v;
<add>
<ide> try {
<del> if (kvp.match(/\+/)) { // decodeURIComponent does not decode + to space
<del> throw 'has +';
<del> }
<del> k = decodeURIComponent(x[0]);
<del> v = decodeURIComponent(x.slice(1).join(eq) || '');
<del> } catch (e) {
<del> k = QueryString.unescape(x[0], true);
<del> v = QueryString.unescape(x.slice(1).join(eq), true);
<add> k = decodeURIComponent(kstr);
<add> v = decodeURIComponent(vstr);
<add> } catch(e) {
<add> k = QueryString.unescape(kstr, true);
<add> v = QueryString.unescape(vstr, true);
<ide> }
<ide>
<ide> if (!hasOwnProperty(obj, k)) {
<ide> QueryString.parse = QueryString.decode = function(qs, sep, eq, options) {
<ide> } else {
<ide> obj[k].push(v);
<ide> }
<del> });
<add> }
<ide>
<ide> return obj;
<ide> }; | 1 |
Text | Text | fix broken link to github pr helper | 7a91d7fa7e9e5156c728288e6ec66512fb70a693 | <ide><path>CONTRIBUTING.md
<ide> We track Pull Requests by attaching labels and assigning to milestones. For som
<ide> does not provide a good UI for managing labels on Pull Requests (unlike Issues). We have developed
<ide> a simple Chrome Extension that enables you to view (and manage if you have permission) the labels
<ide> on Pull Requests. You can get the extension from the Chrome WebStore -
<del>[GitHub PR Helper](github-pr-helper)
<add>[GitHub PR Helper][github-pr-helper]
<ide>
<ide> ## Coding Rules
<ide> To ensure consistency throughout the source code, keep these rules in mind as you are working:
<ide> You can find out more detailed information about contributing in the
<ide> [individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
<ide> [corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
<ide> [commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
<del>[github-pr-helper]: https://chrome.google.com/webstore/detail/github-pr-helper/mokbklfnaddkkbolfldepnkfmanfhpen
<ide>\ No newline at end of file
<add>[github-pr-helper]: https://chrome.google.com/webstore/detail/github-pr-helper/mokbklfnaddkkbolfldepnkfmanfhpen | 1 |
Text | Text | add maclover7 to collaborators | 9ec78101fad90e6469677598b6bc3e8196d1b17f | <ide><path>README.md
<ide> For more information about the governance of the Node.js project, see
<ide> **Luigi Pinca** <luigipinca@gmail.com> (he/him)
<ide> * [lucamaraschi](https://github.com/lucamaraschi) -
<ide> **Luca Maraschi** <luca.maraschi@gmail.com> (he/him)
<add>* [maclover7](https://github.com/maclover7) -
<add>**Jon Moss** <me@jonathanmoss.me> (he/him)
<ide> * [matthewloring](https://github.com/matthewloring) -
<ide> **Matthew Loring** <mattloring@google.com>
<ide> * [mcollina](https://github.com/mcollina) - | 1 |
Go | Go | remove unused functions | c546894aefbd661adc73ba3cf952d38f94627924 | <ide><path>pkg/ioutils/fmt.go
<del>package ioutils
<del>
<del>import (
<del> "fmt"
<del> "io"
<del>)
<del>
<del>// FprintfIfNotEmpty prints the string value if it's not empty
<del>func FprintfIfNotEmpty(w io.Writer, format, value string) (int, error) {
<del> if value != "" {
<del> return fmt.Fprintf(w, format, value)
<del> }
<del> return 0, nil
<del>}
<del>
<del>// FprintfIfTrue prints the boolean value if it's true
<del>func FprintfIfTrue(w io.Writer, format string, ok bool) (int, error) {
<del> if ok {
<del> return fmt.Fprintf(w, format, ok)
<del> }
<del> return 0, nil
<del>}
<ide><path>pkg/ioutils/fmt_test.go
<del>package ioutils
<del>
<del>import "testing"
<del>
<del>func TestFprintfIfNotEmpty(t *testing.T) {
<del> wc := NewWriteCounter(&NopWriter{})
<del> n, _ := FprintfIfNotEmpty(wc, "foo%s", "")
<del>
<del> if wc.Count != 0 || n != 0 {
<del> t.Errorf("Wrong count: %v vs. %v vs. 0", wc.Count, n)
<del> }
<del>
<del> n, _ = FprintfIfNotEmpty(wc, "foo%s", "bar")
<del> if wc.Count != 6 || n != 6 {
<del> t.Errorf("Wrong count: %v vs. %v vs. 6", wc.Count, n)
<del> }
<del>} | 2 |
Java | Java | introduce failing tests for httpheaders | e187a42bfca79b75548cdf6dd5c46298ccfa8134 | <ide><path>spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java
<ide> import java.util.TimeZone;
<ide>
<ide> import org.hamcrest.Matchers;
<add>import org.junit.Ignore;
<ide> import org.junit.Test;
<ide>
<ide> import static org.hamcrest.Matchers.*;
<ide> public void bearerAuth() {
<ide> assertEquals("Bearer foo", authorization);
<ide> }
<ide>
<add> @Test
<add> @Ignore("Disabled until gh-22821 is resolved")
<add> public void removalFromKeySetRemovesEntryFromUnderlyingMap() {
<add> String headerName = "MyHeader";
<add> String headerValue = "value";
<add>
<add> assertTrue(headers.isEmpty());
<add> headers.add(headerName, headerValue);
<add> assertTrue(headers.containsKey(headerName));
<add> headers.keySet().removeIf(key -> key.equals(headerName));
<add> assertTrue(headers.isEmpty());
<add> headers.add(headerName, headerValue);
<add> assertEquals(headerValue, headers.get(headerName));
<add> }
<add>
<add> @Test
<add> @Ignore("Disabled until gh-22821 is resolved")
<add> public void removalFromEntrySetRemovesEntryFromUnderlyingMap() {
<add> String headerName = "MyHeader";
<add> String headerValue = "value";
<add>
<add> assertTrue(headers.isEmpty());
<add> headers.add(headerName, headerValue);
<add> assertTrue(headers.containsKey(headerName));
<add> headers.entrySet().removeIf(entry -> entry.getKey().equals(headerName));
<add> assertTrue(headers.isEmpty());
<add> headers.add(headerName, headerValue);
<add> assertEquals(headerValue, headers.get(headerName));
<add> }
<add>
<ide> } | 1 |
Text | Text | fix typo in engine dashboard | 3ae3df73408167d242731ac163d8dec96df5fa30 | <ide><path>object_detection/g3doc/running_on_cloud.md
<ide> training checkpoints and events will be written to and
<ide> Google Cloud Storage.
<ide>
<ide> Users can monitor the progress of their training job on the [ML Engine
<del>Dasboard](https://pantheon.corp.google.com/mlengine/jobs).
<add>Dashboard](https://pantheon.corp.google.com/mlengine/jobs).
<ide>
<ide> ## Running an Evaluation Job on Cloud
<ide> | 1 |
Text | Text | add third party packages | df2d9034c2a5a07dc3aa5455db892ee94cbed467 | <ide><path>docs/api-guide/filtering.md
<ide> For example, you might need to restrict users to only being able to see objects
<ide>
<ide> We could achieve the same behavior by overriding `get_queryset()` on the views, but using a filter backend allows you to more easily add this restriction to multiple views, or to apply it across the entire API.
<ide>
<add># Third party packages
<add>
<add>The following third party packages provide additional filter implementations.
<add>
<add>## Django REST framework chain
<add>
<add>The [django-rest-framework-chain package][django-rest-framework-chain] works together with the `DjangoFilterBackend` class, and allows you to easily create filters across relationships, or create multiple filter lookup types for a given field.
<add>
<ide> [cite]: https://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-specific-objects-with-filters
<ide> [django-filter]: https://github.com/alex/django-filter
<ide> [django-filter-docs]: https://django-filter.readthedocs.org/en/latest/index.html
<ide> We could achieve the same behavior by overriding `get_queryset()` on the views,
<ide> [view-permissions-blogpost]: http://blog.nyaruka.com/adding-a-view-permission-to-django-models
<ide> [nullbooleanselect]: https://github.com/django/django/blob/master/django/forms/widgets.py
<ide> [search-django-admin]: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.search_fields
<add>[django-rest-framework-chain]: https://github.com/philipn/django-rest-framework-chain
<ide><path>docs/api-guide/routers.md
<ide> If you want to provide totally custom behavior, you can override `BaseRouter` an
<ide>
<ide> You may also want to override the `get_default_base_name(self, viewset)` method, or else always explicitly set the `base_name` argument when registering your viewsets with the router.
<ide>
<add># Third Party Packages
<add>
<add>The following third party packages provide router implementations that extend the default functionality provided by REST framework.
<add>
<add>## DRF Nested Routers
<add>
<add>The [drf-nested-routers package][drf-nested-routers] provides routers and relationship fields for working with nested resources.
<add>
<ide> [cite]: http://guides.rubyonrails.org/routing.html
<add>[drf-nested-routers]: https://github.com/alanjds/drf-nested-routers | 2 |
Text | Text | remove extra closing parenthesis | f1cb4ea8674cd09397d1e7837b529a4a0a4cd4aa | <ide><path>docs/basic-features/data-fetching.md
<ide> If `fallback` is `true`, then the behavior of `getStaticProps` changes:
<ide> In the “fallback” version of a page:
<ide>
<ide> - The page’s props will be empty.
<del>- Using the [router](/docs/api-reference/next/router.md)), you can detect if the fallback is being rendered, `router.isFallback` will be `true`.
<add>- Using the [router](/docs/api-reference/next/router.md), you can detect if the fallback is being rendered, `router.isFallback` will be `true`.
<ide>
<ide> Here’s an example that uses `isFallback`:
<ide> | 1 |
Javascript | Javascript | add a (failing on glimmer) test for | 40fe91a21e39cca4e042278628abf8813b8365f8 | <ide><path>packages/ember-glimmer/tests/integration/syntax/each-test.js
<ide> class SingleEachTest extends AbstractEachTest {
<ide> this.assertText('No Thing bar');
<ide> }
<ide>
<add> ['@test content that are not initially present updates correctly GH#13983']() {
<add> // The root cause of this bug is that Glimmer did not call `didInitializeChildren`
<add> // on the inserted `TryOpcode`, causing that `TryOpcode` to have an uninitialized
<add> // tag. Currently the only way to observe this the "JUMP-IF-NOT-MODIFIED", i.e. by
<add> // wrapping it in an component.
<add>
<add> this.registerComponent('x-wrapper', { template: '{{yield}}' });
<add>
<add> this.makeList([]);
<add>
<add> this.render(`{{#x-wrapper}}{{#each list as |obj|}}[{{obj.text}}]{{/each}}{{/x-wrapper}}`);
<add>
<add> this.assertText('');
<add>
<add> this.runTask(() => this.rerender());
<add>
<add> this.assertText('');
<add>
<add> this.runTask(() => this.pushObject({ text: 'foo' }));
<add>
<add> this.assertText('[foo]');
<add>
<add> this.runTask(() => set(this.objectAt(0), 'text', 'FOO'));
<add>
<add> this.assertText('[FOO]');
<add>
<add> this.runTask(() => this.pushObject({ text: 'bar' }));
<add>
<add> this.assertText('[FOO][bar]');
<add>
<add> this.runTask(() => set(this.objectAt(1), 'text', 'BAR'));
<add>
<add> this.assertText('[FOO][BAR]');
<add>
<add> this.runTask(() => set(this.objectAt(1), 'text', 'baz'));
<add>
<add> this.assertText('[FOO][baz]');
<add>
<add> this.runTask(() => this.replace(1, 1, [{ text: 'BAZ' }]));
<add>
<add> this.assertText('[FOO][BAZ]');
<add>
<add> this.replaceList([]);
<add>
<add> this.assertText('');
<add> }
<ide> }
<ide>
<ide> moduleFor('Syntax test: {{#each}} with arrays', class extends SingleEachTest { | 1 |
Text | Text | fix broken link in automated build doc | 8e66e627d701101e583c31fba419b0ae8cf2fb89 | <ide><path>docs/userguide/dockerrepos.md
<ide> build and, in a few minutes, you should see your new Automated Build on the [Doc
<ide> Registry. It will stay in sync with your GitHub and Bitbucket repository until you
<ide> deactivate the Automated Build.
<ide>
<del>If you want to see the status of your Automated Builds, you can go to your
<del>[Automated Builds page](https://registry.hub.docker.com/builds/) on the Docker Hub,
<del>and it will show you the status of your builds and their build history.
<add>To check the output and status of your Automated Build repositories, click on a repository name within the ["Your Repositories" page](https://registry.hub.docker.com/repos/). Automated Builds are indicated by a check-mark icon next to the repository name. Within the repository details page, you may click on the "Build Details" tab to view the status and output of all builds triggered by the Docker Hub.
<ide>
<ide> Once you've created an Automated Build you can deactivate or delete it. You
<ide> cannot, however, push to an Automated Build with the `docker push` command.
<ide> webhooks](https://docs.docker.com/docker-hub/repos/#webhooks)
<ide> ## Next steps
<ide>
<ide> Go and use Docker!
<del> | 1 |
Python | Python | fix model download | 9b75d872b08fe66a5a5c0a8534e36c0e252d3089 | <ide><path>spacy/en/download.py
<ide> import shutil
<ide>
<ide> import plac
<del>from sputnik import Sputnik
<add>import sputnik
<add>
<add>from .. import about
<ide>
<ide>
<ide> def migrate(path):
<ide> def link(package, path):
<ide> force=("Force overwrite", "flag", "f", bool),
<ide> )
<ide> def main(data_size='all', force=False):
<del> # TODO read version from the same source as the setup
<del> sputnik = Sputnik('spacy', '0.100.0', console=sys.stdout)
<del>
<ide> path = os.path.dirname(os.path.abspath(__file__))
<ide>
<ide> data_path = os.path.abspath(os.path.join(path, '..', 'data'))
<ide> if not os.path.isdir(data_path):
<ide> os.mkdir(data_path)
<ide>
<del> command = sputnik.command(
<del> data_path=data_path,
<del> repository_url='https://index.spacy.io')
<del>
<ide> if force:
<del> command.purge()
<add> sputnik.purge('spacy', about.short_version, data_path=data_path)
<ide>
<del> package = command.install('en_default')
<add> package = sputnik.install('spacy', about.short_version, 'en_default==1.0.4',
<add> data_path=data_path)
<ide>
<ide> # FIXME clean up old-style packages
<ide> migrate(path)
<ide><path>spacy/util.py
<ide> import sputnik
<ide> from sputnik.dir_package import DirPackage
<ide> from sputnik.package_stub import PackageStub
<add>from sputnik.package_list import PackageNotFoundException, CompatiblePackageNotFoundException
<ide>
<ide> from . import about
<ide> from .attrs import TAG, HEAD, DEP, ENT_IOB, ENT_TYPE
<ide> def get_package(value=None, data_path=None):
<ide> elif value is None and data_path is not None:
<ide> return DirPackage(data_path)
<ide>
<del> return sputnik.package('spacy', about.short_version,
<del> value or 'en_default==1.0.4', data_path=data_path)
<add> try:
<add> return sputnik.package('spacy', about.short_version,
<add> value or 'en_default==1.0.4',
<add> data_path=data_path)
<add>
<add> except PackageNotFoundException as e:
<add> raise RuntimeError("Model not installed. Please run 'python -m "
<add> "spacy.en.download' to install latest compatible "
<add> "model.")
<add> except CompatiblePackageNotFoundException as e:
<add> raise RuntimeError("Installed model is not compatible with spaCy "
<add> "version. Please run 'python -m spacy.en.download "
<add> "--force' to install latest compatible model.")
<ide>
<ide>
<ide> def normalize_slice(length, start, stop, step=None): | 2 |
PHP | PHP | add methods for unloading and retrieving behaviors | 80edbe48ed9d65e9decc9fcfdf5f28321be2b31c | <ide><path>src/ORM/Table.php
<ide> public function addBehavior($name, array $options = []) {
<ide> $this->_behaviors->load($name, $options);
<ide> }
<ide>
<add>/**
<add> * Removes a behavior.
<add> *
<add> * Removes a behavior from this table's behavior collection.
<add> *
<add> * Example:
<add> *
<add> * Unload a behavior, with some settings.
<add> *
<add> * {{{
<add> * $this->removeBehavior('Tree');
<add> * }}}
<add> *
<add> * @param string $name The alias that the behavior was added with.
<add> *
<add> * @return void
<add> * @see \Cake\ORM\Behavior
<add> */
<add> public function removeBehavior($name) {
<add> $this->_behaviors->unload($name);
<add> }
<add>
<ide> /**
<ide> * Get the list of Behaviors loaded.
<ide> *
<ide> public function hasBehavior($name) {
<ide> }
<ide>
<ide> /**
<add> * Returns a behavior instance with the given alias.
<add> *
<add> * @param string $name The behavior alias to check.
<add> *
<add> * @return \Cake\ORM\Behavior or null
<add> */
<add> public function getBehavior($name) {
<add> return $this->_behaviors->{$name};
<add> }
<add>
<add> /**
<ide> * Returns a association objected configured for the specified alias if any
<ide> *
<ide> * @param string $name the alias used for the association
<ide><path>tests/TestCase/ORM/TableTest.php
<ide> public function testAddBehavior() {
<ide> $table->addBehavior('Sluggable');
<ide> }
<ide>
<add>/**
<add> * Test removing a behavior from a table.
<add> *
<add> * @return void
<add> */
<add> public function testRemoveBehavior() {
<add> $mock = $this->getMock('Cake\ORM\BehaviorRegistry', [], [], '', false);
<add> $mock->expects($this->once())
<add> ->method('unload')
<add> ->with('Sluggable');
<add>
<add> $table = new Table([
<add> 'table' => 'articles',
<add> 'behaviors' => $mock
<add> ]);
<add> $table->removeBehavior('Sluggable');
<add> }
<add>
<add>/**
<add> * Test getting a behavior instance from a table.
<add> *
<add> * @return void
<add> */
<add> public function testGetBehavior() {
<add> $returnValue = 'MockSlugInstance';
<add> $mock = $this->getMock('Cake\ORM\BehaviorRegistry', [], [], '', false);
<add> $mock->expects($this->once())
<add> ->method('__get')
<add> ->with('Sluggable')
<add> ->will($this->returnValue($returnValue));
<add>
<add> $table = new Table([
<add> 'table' => 'articles',
<add> 'behaviors' => $mock
<add> ]);
<add> $result = $table->getBehavior('Sluggable');
<add> $this->assertSame($returnValue, $result);
<add> }
<add>
<ide> /**
<ide> * Ensure exceptions are raised on missing behaviors.
<ide> * | 2 |
Text | Text | fix worker example to receive message | 42be4c3befbb619b335816eecbe459faa4194531 | <ide><path>doc/api/worker_threads.md
<ide> added: v10.5.0
<ide> * `transferList` {Object[]}
<ide>
<ide> Send a message to the worker that will be received via
<del>[`require('worker_threads').on('message')`][].
<add>[`require('worker_threads').parentPort.on('message')`][].
<ide> See [`port.postMessage()`][] for more details.
<ide>
<ide> ### worker.ref()
<ide> active handle in the event system. If the worker is already `unref()`ed calling
<ide> [`process.stdout`]: process.html#process_process_stdout
<ide> [`process.title`]: process.html#process_process_title
<ide> [`require('worker_threads').workerData`]: #worker_threads_worker_workerdata
<del>[`require('worker_threads').on('message')`]: #worker_threads_event_message_1
<add>[`require('worker_threads').parentPort.on('message')`]: #worker_threads_event_message
<ide> [`require('worker_threads').postMessage()`]: #worker_threads_worker_postmessage_value_transferlist
<ide> [`require('worker_threads').isMainThread`]: #worker_threads_worker_ismainthread
<ide> [`require('worker_threads').parentPort`]: #worker_threads_worker_parentport | 1 |
Javascript | Javascript | add unhandled rejection guard | ef49f55e9376cdc2ef99f3e4cd3021d3a253a1c9 | <ide><path>test/addons-napi/test_promise/test.js
<ide> const common = require('../../common');
<ide> const assert = require('assert');
<ide> const test_promise = require(`./build/${common.buildType}/test_promise`);
<ide>
<add>common.crashOnUnhandledRejection();
<add>
<ide> // A resolution
<ide> {
<ide> const expected_result = 42;
<ide> const test_promise = require(`./build/${common.buildType}/test_promise`);
<ide> }
<ide>
<ide> assert.strictEqual(test_promise.isPromise(test_promise.createPromise()), true);
<del>assert.strictEqual(test_promise.isPromise(Promise.reject(-1)), true);
<add>
<add>const rejectPromise = Promise.reject(-1);
<add>const expected_reason = -1;
<add>assert.strictEqual(test_promise.isPromise(rejectPromise), true);
<add>rejectPromise.catch((reason) => {
<add> assert.strictEqual(reason, expected_reason);
<add>});
<add>
<ide> assert.strictEqual(test_promise.isPromise(2.4), false);
<ide> assert.strictEqual(test_promise.isPromise('I promise!'), false);
<ide> assert.strictEqual(test_promise.isPromise(undefined), false); | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.