content_type
stringclasses 8
values | main_lang
stringclasses 7
values | message
stringlengths 1
50
| sha
stringlengths 40
40
| patch
stringlengths 52
962k
| file_count
int64 1
300
|
---|---|---|---|---|---|
PHP | PHP | allow a when callback to dictate retries | 85c08016c424f6c8e45f08282523f8785eda9673 | <ide><path>src/Illuminate/Support/helpers.php
<ide> function preg_replace_array($pattern, array $replacements, $subject)
<ide> * @param int $times
<ide> * @param callable $callback
<ide> * @param int $sleep
<add> * @param callable $when
<ide> * @return mixed
<ide> *
<ide> * @throws \Exception
<ide> */
<del> function retry($times, callable $callback, $sleep = 0)
<add> function retry($times, callable $callback, $sleep = 0, $when = null)
<ide> {
<ide> $attempts = 0;
<ide> $times--;
<ide> function retry($times, callable $callback, $sleep = 0)
<ide> try {
<ide> return $callback($attempts);
<ide> } catch (Exception $e) {
<del> if (! $times) {
<add> if (! $times || ($when && ! $when($e))) {
<ide> throw $e;
<ide> }
<ide>
<ide><path>tests/Support/SupportHelpersTest.php
<ide> public function testRetry()
<ide> $this->assertTrue(microtime(true) - $startTime >= 0.1);
<ide> }
<ide>
<add> public function testRetryWithPassingWhenCallback()
<add> {
<add> $startTime = microtime(true);
<add>
<add> $attempts = retry(2, function ($attempts) {
<add> if ($attempts > 1) {
<add> return $attempts;
<add> }
<add>
<add> throw new RuntimeException;
<add> }, 100, function ($ex) {
<add> return true;
<add> });
<add>
<add> // Make sure we made two attempts
<add> $this->assertEquals(2, $attempts);
<add>
<add> // Make sure we waited 100ms for the first attempt
<add> $this->assertTrue(microtime(true) - $startTime >= 0.1);
<add> }
<add>
<add> public function testRetryWithFailingWhenCallback()
<add> {
<add> $this->expectException(RuntimeException::class);
<add>
<add> $attempts = retry(2, function ($attempts) {
<add> if ($attempts > 1) {
<add> return $attempts;
<add> }
<add>
<add> throw new RuntimeException;
<add> }, 100, function ($ex) {
<add> return false;
<add> });
<add> }
<add>
<ide> public function testTransform()
<ide> {
<ide> $this->assertEquals(10, transform(5, function ($value) { | 2 |
Java | Java | add space between words | 978fa488ec2b3560d92b78b532909d74f88957da | <ide><path>ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerImpl.java
<ide> public void createReactContextInBackground() {
<ide> Assertions.assertCondition(
<ide> !mHasStartedCreatingInitialContext,
<ide> "createReactContextInBackground should only be called when creating the react " +
<del> "application for the first time. When reloading JS, e.g. from a new file, explicitly" +
<add> "application for the first time. When reloading JS, e.g. from a new file, explicitly " +
<ide> "use recreateReactContextInBackground");
<ide>
<ide> mHasStartedCreatingInitialContext = true; | 1 |
Javascript | Javascript | make fsop timeout injectable | 8edb9524035b0c034135a81551ba955ee514dbd4 | <ide><path>packager/react-packager/src/AssetServer/index.js
<ide> function timeoutableDenodeify(fsFunc, timeout) {
<ide> };
<ide> }
<ide>
<del>const stat = timeoutableDenodeify(fs.stat, 15000);
<del>const readDir = timeoutableDenodeify(fs.readdir, 15000);
<del>const readFile = timeoutableDenodeify(fs.readFile, 15000);
<add>const FS_OP_TIMEOUT = parseInt(process.env.REACT_NATIVE_FSOP_TIMEOUT, 10) || 15000;
<add>
<add>const stat = timeoutableDenodeify(fs.stat, FS_OP_TIMEOUT);
<add>const readDir = timeoutableDenodeify(fs.readdir, FS_OP_TIMEOUT);
<add>const readFile = timeoutableDenodeify(fs.readFile, FS_OP_TIMEOUT);
<ide>
<ide> const validateOpts = declareOpts({
<ide> projectRoots: { | 1 |
Text | Text | enhance user stories for header parser project | 313136031884c16d5667b33ab5a2d38a1af63552 | <ide><path>curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice.md
<ide> forumTopicId: 301507
<ide>
<ide> ## Description
<ide> <section id='description'>
<del>Build a full stack JavaScript app that is functionally similar to this: <a href='https://request-header-parser-microservice.freecodecamp.rocks/' target='_blank'>https://request-header-parser-microservice.freecodecamp.rocks/</a>.
<del>Working on this project will involve you writing your code on Repl.it on our starter project. After completing this project you can copy your public Repl.it URL (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.
<del>Start this project on Repl.it using <a href='https://repl.it/github/freeCodeCamp/boilerplate-project-headerparser' target='_blank'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-headerparser/'>this repository</a> on GitHub! If you use Repl.it, remember to save the link to your project somewhere safe!
<add>Build a full stack JavaScript app that is functionally similar to this: <a href='https://request-header-parser-microservice.freecodecamp.rocks/' target='_blank'>https://request-header-parser-microservice.freecodecamp.rocks/</a>. Working on this project will involve you writing your code using one of the following methods:
<add>
<add>- Clone <a href='https://github.com/freeCodeCamp/boilerplate-project-headerparser/'>this GitHub repo</a> and complete your project locally.
<add>- Use <a href='https://repl.it/github/freeCodeCamp/boilerplate-project-headerparser' target='_blank'>our repl.it starter project</a> to complete your project.
<add>- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
<add>
<add>When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
<ide> </section>
<ide>
<ide> ## Instructions
<ide> Start this project on Repl.it using <a href='https://repl.it/github/freeCodeCamp
<ide>
<ide> ```yml
<ide> tests:
<del> - text: I can provide my own project, not the example URL.
<add> - text: You should provide your own project, not the example URL.
<ide> testString: |
<ide> getUserInput => {
<ide> assert(!/.*\/request-header-parser-microservice\.freecodecamp\.rocks/.test(getUserInput('url')));
<ide> }
<del> - text: 'Your IP address should be returned in the <code>ipaddress</code> key.'
<add> - text: 'A request to `/api/whoami` should return a JSON object with your IP address in the <code>ipaddress</code> key.'
<ide> testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/whoami'').then(data => assert(data.ipaddress && data.ipaddress.length > 0), xhr => { throw new Error(xhr.responseText)})'
<del> - text: 'Your preferred language should be returned in the <code>language</code> key.'
<add> - text: 'A request to `/api/whoami` should return a JSON object with your preferred language in the <code>language</code> key.'
<ide> testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/whoami'').then(data => assert(data.language && data.language.length > 0), xhr => { throw new Error(xhr.responseText)})'
<del> - text: 'Your software should be returned in the <code>software</code> key.'
<add> - text: 'A request to `/api/whoami` should return a JSON object with your software in the <code>software</code> key.'
<ide> testString: 'getUserInput => $.get(getUserInput(''url'') + ''/api/whoami'').then(data => assert(data.software && data.software.length > 0), xhr => { throw new Error(xhr.responseText)})'
<ide>
<ide> ``` | 1 |
Ruby | Ruby | add additional php header ignore patterns | 85da3762331dda87bd6acaae2977cc470c9d2658 | <ide><path>Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
<ide> def check_shadowed_headers
<ide> formula.name.start_with?(formula_name)
<ide> end
<ide>
<del> return if formula.name =~ /^php\d+$/
<add> return if formula.name =~ /^php(@?\d+\.?\d*?)?$/
<ide>
<ide> return if MacOS.version < :mavericks && formula.name.start_with?("postgresql")
<ide> return if MacOS.version < :yosemite && formula.name.start_with?("memcached") | 1 |
PHP | PHP | use stricter assertions. | cfef0246e490b86289893833f0e15cb6f2ec240a | <ide><path>tests/Bus/BusBatchTest.php
<ide> public function test_failed_jobs_can_be_recorded_while_not_allowing_failures()
<ide> $this->assertTrue($batch->cancelled());
<ide> $this->assertEquals(1, $_SERVER['__finally.count']);
<ide> $this->assertEquals(1, $_SERVER['__catch.count']);
<del> $this->assertEquals('Something went wrong.', $_SERVER['__catch.exception']->getMessage());
<add> $this->assertSame('Something went wrong.', $_SERVER['__catch.exception']->getMessage());
<ide> }
<ide>
<ide> public function test_failed_jobs_can_be_recorded_while_allowing_failures()
<ide> public function test_failed_jobs_can_be_recorded_while_allowing_failures()
<ide> $this->assertFalse($batch->finished());
<ide> $this->assertFalse($batch->cancelled());
<ide> $this->assertEquals(1, $_SERVER['__catch.count']);
<del> $this->assertEquals('Something went wrong.', $_SERVER['__catch.exception']->getMessage());
<add> $this->assertSame('Something went wrong.', $_SERVER['__catch.exception']->getMessage());
<ide> }
<ide>
<ide> public function test_batch_can_be_cancelled()
<ide><path>tests/Bus/BusBatchableTest.php
<ide> public function test_batch_may_be_retrieved()
<ide> };
<ide>
<ide> $this->assertSame($class, $class->withBatchId('test-batch-id'));
<del> $this->assertEquals('test-batch-id', $class->batchId);
<add> $this->assertSame('test-batch-id', $class->batchId);
<ide>
<ide> Container::setInstance($container = new Container);
<ide>
<ide> $repository = m::mock(BatchRepository::class);
<ide> $repository->shouldReceive('find')->once()->with('test-batch-id')->andReturn('test-batch');
<ide> $container->instance(BatchRepository::class, $repository);
<ide>
<del> $this->assertEquals('test-batch', $class->batch());
<add> $this->assertSame('test-batch', $class->batch());
<ide>
<ide> Container::setInstance(null);
<ide> }
<ide><path>tests/Bus/BusPendingBatchTest.php
<ide> public function test_pending_batch_may_be_configured_and_dispatched()
<ide> //
<ide> })->allowFailures()->onConnection('test-connection')->onQueue('test-queue');
<ide>
<del> $this->assertEquals('test-connection', $pendingBatch->connection());
<del> $this->assertEquals('test-queue', $pendingBatch->queue());
<add> $this->assertSame('test-connection', $pendingBatch->connection());
<add> $this->assertSame('test-queue', $pendingBatch->queue());
<ide> $this->assertCount(1, $pendingBatch->thenCallbacks());
<ide> $this->assertCount(1, $pendingBatch->catchCallbacks());
<ide>
<ide><path>tests/Database/DatabaseEloquentFactoryTest.php
<ide> public function test_basic_model_can_be_created()
<ide>
<ide> $user = FactoryTestUserFactory::new()->create(['name' => 'Taylor Otwell']);
<ide> $this->assertInstanceOf(Eloquent::class, $user);
<del> $this->assertEquals('Taylor Otwell', $user->name);
<add> $this->assertSame('Taylor Otwell', $user->name);
<ide>
<ide> $users = FactoryTestUserFactory::new()->createMany([
<ide> ['name' => 'Taylor Otwell'],
<ide> public function test_expanded_closure_attributes_are_resolved_and_passed_to_clos
<ide> },
<ide> ]);
<ide>
<del> $this->assertEquals('taylor-options', $user->options);
<add> $this->assertSame('taylor-options', $user->options);
<ide> }
<ide>
<ide> public function test_make_creates_unpersisted_model_instance()
<ide> public function test_make_creates_unpersisted_model_instance()
<ide> $user = FactoryTestUserFactory::new()->make(['name' => 'Taylor Otwell']);
<ide>
<ide> $this->assertInstanceOf(Eloquent::class, $user);
<del> $this->assertEquals('Taylor Otwell', $user->name);
<add> $this->assertSame('Taylor Otwell', $user->name);
<ide> $this->assertCount(0, FactoryTestUser::all());
<ide> }
<ide>
<ide> public function test_basic_model_attributes_can_be_created()
<ide>
<ide> $user = FactoryTestUserFactory::new()->raw(['name' => 'Taylor Otwell']);
<ide> $this->assertIsArray($user);
<del> $this->assertEquals('Taylor Otwell', $user['name']);
<add> $this->assertSame('Taylor Otwell', $user['name']);
<ide> }
<ide>
<ide> public function test_expanded_model_attributes_can_be_created()
<ide> public function test_expanded_model_attributes_can_be_created()
<ide> $post = FactoryTestPostFactory::new()->raw(['title' => 'Test Title']);
<ide> $this->assertIsArray($post);
<ide> $this->assertIsInt($post['user_id']);
<del> $this->assertEquals('Test Title', $post['title']);
<add> $this->assertSame('Test Title', $post['title']);
<ide> }
<ide>
<ide> public function test_after_creating_and_making_callbacks_are_called()
<ide> public function test_morph_to_relationship()
<ide> ->for(FactoryTestPostFactory::new(['title' => 'Test Title']), 'commentable')
<ide> ->create();
<ide>
<del> $this->assertEquals('Test Title', FactoryTestPost::first()->title);
<add> $this->assertSame('Test Title', FactoryTestPost::first()->title);
<ide> $this->assertCount(3, FactoryTestPost::first()->comments);
<ide>
<ide> $this->assertCount(1, FactoryTestPost::all());
<ide> public function test_belongs_to_many_relationship()
<ide> $user = FactoryTestUser::latest()->first();
<ide>
<ide> $this->assertCount(3, $user->roles);
<del> $this->assertEquals('Y', $user->roles->first()->pivot->admin);
<add> $this->assertSame('Y', $user->roles->first()->pivot->admin);
<ide>
<ide> $this->assertInstanceOf(Eloquent::class, $_SERVER['__test.role.creating-role']);
<ide> $this->assertInstanceOf(Eloquent::class, $_SERVER['__test.role.creating-user']);
<ide> public function test_sequences()
<ide> ['name' => 'Abigail Otwell'],
<ide> )->create();
<ide>
<del> $this->assertEquals('Taylor Otwell', $users[0]->name);
<del> $this->assertEquals('Abigail Otwell', $users[1]->name);
<add> $this->assertSame('Taylor Otwell', $users[0]->name);
<add> $this->assertSame('Abigail Otwell', $users[1]->name);
<ide>
<ide> $user = FactoryTestUserFactory::new()
<ide> ->hasAttached(
<ide> public function test_dynamic_has_and_for_methods()
<ide> ->create();
<ide>
<ide> $this->assertInstanceOf(FactoryTestUser::class, $post->author);
<del> $this->assertEquals('Taylor Otwell', $post->author->name);
<add> $this->assertSame('Taylor Otwell', $post->author->name);
<ide> $this->assertCount(2, $post->comments);
<ide> }
<ide>
<ide><path>tests/Database/DatabaseEloquentModelTest.php
<ide> public function testAttributeManipulation()
<ide> $model->list_items = ['name' => 'taylor'];
<ide> $this->assertEquals(['name' => 'taylor'], $model->list_items);
<ide> $attributes = $model->getAttributes();
<del> $this->assertEquals(json_encode(['name' => 'taylor']), $attributes['list_items']);
<add> $this->assertSame(json_encode(['name' => 'taylor']), $attributes['list_items']);
<ide> }
<ide>
<ide> public function testSetAttributeWithNumericKey()
<ide><path>tests/Database/DatabaseEloquentPivotTest.php
<ide> public function testWithoutRelations()
<ide> $original->pivotParent = 'foo';
<ide> $original->setRelation('bar', 'baz');
<ide>
<del> $this->assertEquals('baz', $original->getRelation('bar'));
<add> $this->assertSame('baz', $original->getRelation('bar'));
<ide>
<ide> $pivot = $original->withoutRelations();
<ide>
<ide> $this->assertInstanceOf(Pivot::class, $pivot);
<ide> $this->assertNotSame($pivot, $original);
<del> $this->assertEquals('foo', $original->pivotParent);
<add> $this->assertSame('foo', $original->pivotParent);
<ide> $this->assertNull($pivot->pivotParent);
<ide> $this->assertTrue($original->relationLoaded('bar'));
<ide> $this->assertFalse($pivot->relationLoaded('bar'));
<ide><path>tests/Database/DatabaseQueryBuilderTest.php
<ide> public function testSubSelectResetBindings()
<ide> $query->from('two')->select('baz')->where('subkey', '=', 'subval');
<ide> }, 'sub');
<ide>
<del> $this->assertEquals('select (select "baz" from "two" where "subkey" = ?) as "sub" from "one"', $builder->toSql());
<add> $this->assertSame('select (select "baz" from "two" where "subkey" = ?) as "sub" from "one"', $builder->toSql());
<ide> $this->assertEquals(['subval'], $builder->getBindings());
<ide>
<ide> $builder->select('*');
<ide>
<del> $this->assertEquals('select * from "one"', $builder->toSql());
<add> $this->assertSame('select * from "one"', $builder->toSql());
<ide> $this->assertEquals([], $builder->getBindings());
<ide> }
<ide>
<ide><path>tests/Integration/Database/DatabaseEloquentModelCustomCastingTest.php
<ide> public function testBasicCustomCasting()
<ide>
<ide> $model->syncOriginal();
<ide> $model->uppercase = 'dries';
<del> $this->assertEquals('TAYLOR', $model->getOriginal('uppercase'));
<add> $this->assertSame('TAYLOR', $model->getOriginal('uppercase'));
<ide>
<ide> $model = new TestEloquentModelWithCustomCast;
<ide> $model->uppercase = 'taylor';
<ide> $model->syncOriginal();
<ide> $model->uppercase = 'dries';
<ide> $model->getOriginal();
<ide>
<del> $this->assertEquals('DRIES', $model->uppercase);
<add> $this->assertSame('DRIES', $model->uppercase);
<ide>
<ide> $model = new TestEloquentModelWithCustomCast;
<ide>
<ide> public function testBasicCustomCasting()
<ide> $this->assertEquals(['foo' => 'bar'], $model->options);
<ide> $this->assertEquals(['foo' => 'bar'], $model->options);
<ide>
<del> $this->assertEquals(json_encode(['foo' => 'bar']), $model->getAttributes()['options']);
<add> $this->assertSame(json_encode(['foo' => 'bar']), $model->getAttributes()['options']);
<ide>
<ide> $model = new TestEloquentModelWithCustomCast(['options' => []]);
<ide> $model->syncOriginal();
<ide> public function testGetOriginalWithCastValueObjects()
<ide>
<ide> $model->address = new Address('117 Spencer St.', 'Another house.');
<ide>
<del> $this->assertEquals('117 Spencer St.', $model->address->lineOne);
<del> $this->assertEquals('110 Kingsbrook St.', $model->getOriginal('address')->lineOne);
<del> $this->assertEquals('117 Spencer St.', $model->address->lineOne);
<add> $this->assertSame('117 Spencer St.', $model->address->lineOne);
<add> $this->assertSame('110 Kingsbrook St.', $model->getOriginal('address')->lineOne);
<add> $this->assertSame('117 Spencer St.', $model->address->lineOne);
<ide>
<ide> $model = new TestEloquentModelWithCustomCast([
<ide> 'address' => new Address('110 Kingsbrook St.', 'My Childhood House'),
<ide> public function testGetOriginalWithCastValueObjects()
<ide>
<ide> $model->address = new Address('117 Spencer St.', 'Another house.');
<ide>
<del> $this->assertEquals('117 Spencer St.', $model->address->lineOne);
<del> $this->assertEquals('110 Kingsbrook St.', $model->getOriginal()['address_line_one']);
<del> $this->assertEquals('117 Spencer St.', $model->address->lineOne);
<del> $this->assertEquals('110 Kingsbrook St.', $model->getOriginal()['address_line_one']);
<add> $this->assertSame('117 Spencer St.', $model->address->lineOne);
<add> $this->assertSame('110 Kingsbrook St.', $model->getOriginal()['address_line_one']);
<add> $this->assertSame('117 Spencer St.', $model->address->lineOne);
<add> $this->assertSame('110 Kingsbrook St.', $model->getOriginal()['address_line_one']);
<ide>
<ide> $model = new TestEloquentModelWithCustomCast([
<ide> 'address' => new Address('110 Kingsbrook St.', 'My Childhood House'),
<ide> public function testWithCastableInterface()
<ide> 'value_object_caster_with_argument' => null,
<ide> ]);
<ide>
<del> $this->assertEquals('argument', $model->value_object_caster_with_argument);
<add> $this->assertSame('argument', $model->value_object_caster_with_argument);
<ide>
<ide> $model->setRawAttributes([
<ide> 'value_object_caster_with_caster_instance' => serialize(new ValueObject('hello')),
<ide><path>tests/Integration/Database/DatabaseSchemaBuilderAlterTableWithEnumTest.php
<ide> public function testChangeColumnOnTableWithEnum()
<ide> $table->unsignedInteger('age')->charset('')->change();
<ide> });
<ide>
<del> $this->assertEquals('integer', Schema::getColumnType('users', 'age'));
<add> $this->assertSame('integer', Schema::getColumnType('users', 'age'));
<ide> }
<ide>
<ide> protected function setUp(): void
<ide><path>tests/Integration/Database/EloquentModelWithoutEventsTest.php
<ide> public function testWithoutEventsRegistersBootedListenersForLater()
<ide>
<ide> $model->save();
<ide>
<del> $this->assertEquals('Laravel', $model->project);
<add> $this->assertSame('Laravel', $model->project);
<ide> }
<ide> }
<ide>
<ide><path>tests/Integration/Foundation/MaintenanceModeTest.php
<ide> public function testMaintenanceModeCanHaveCustomTemplate()
<ide>
<ide> $response->assertStatus(503);
<ide> $response->assertHeader('Retry-After', '60');
<del> $this->assertEquals('Rendered Content', $response->original);
<add> $this->assertSame('Rendered Content', $response->original);
<ide> }
<ide>
<ide> public function testMaintenanceModeCanRedirectWithBypassCookie()
<ide> public function testMaintenanceModeCanBeBypassedWithValidCookie()
<ide> ])->get('/test');
<ide>
<ide> $response->assertStatus(200);
<del> $this->assertEquals('Hello World', $response->original);
<add> $this->assertSame('Hello World', $response->original);
<ide> }
<ide>
<ide> public function testMaintenanceModeCantBeBypassedWithInvalidCookie()
<ide> public function testCanCreateBypassCookies()
<ide> $cookie = MaintenanceModeBypassCookie::create('test-key');
<ide>
<ide> $this->assertInstanceOf(Cookie::class, $cookie);
<del> $this->assertEquals('laravel_maintenance', $cookie->getName());
<add> $this->assertSame('laravel_maintenance', $cookie->getName());
<ide>
<ide> $this->assertTrue(MaintenanceModeBypassCookie::isValid($cookie->getValue(), 'test-key'));
<ide> $this->assertFalse(MaintenanceModeBypassCookie::isValid($cookie->getValue(), 'wrong-key'));
<ide><path>tests/Integration/View/BladeTest.php
<ide> public function test_basic_blade_rendering()
<ide> {
<ide> $view = View::make('hello', ['name' => 'Taylor'])->render();
<ide>
<del> $this->assertEquals('Hello Taylor', trim($view));
<add> $this->assertSame('Hello Taylor', trim($view));
<ide> }
<ide>
<ide> public function test_rendering_a_component()
<ide> public function test_rendering_a_dynamic_component()
<ide> {
<ide> $view = View::make('uses-panel-dynamically', ['name' => 'Taylor'])->render();
<ide>
<del> $this->assertEquals('<div class="ml-2" wire:model="foo" wire:model.lazy="bar">
<add> $this->assertSame('<div class="ml-2" wire:model="foo" wire:model.lazy="bar">
<ide> Hello Taylor
<ide> </div>', trim($view));
<ide> }
<ide><path>tests/Queue/QueueDatabaseQueueUnitTest.php
<ide> public function testPushProperlyPushesJobOntoDatabase()
<ide> $database->shouldReceive('table')->with('table')->andReturn($query = m::mock(stdClass::class));
<ide> $query->shouldReceive('insertGetId')->once()->andReturnUsing(function ($array) use ($uuid) {
<ide> $this->assertSame('default', $array['queue']);
<del> $this->assertEquals(json_encode(['uuid' => $uuid, 'displayName' => 'foo', 'job' => 'foo', 'maxTries' => null, 'maxExceptions' => null, 'backoff' => null, 'timeout' => null, 'data' => ['data']]), $array['payload']);
<add> $this->assertSame(json_encode(['uuid' => $uuid, 'displayName' => 'foo', 'job' => 'foo', 'maxTries' => null, 'maxExceptions' => null, 'backoff' => null, 'timeout' => null, 'data' => ['data']]), $array['payload']);
<ide> $this->assertEquals(0, $array['attempts']);
<ide> $this->assertNull($array['reserved_at']);
<ide> $this->assertIsInt($array['available_at']);
<ide> public function testDelayedPushProperlyPushesJobOntoDatabase()
<ide> $database->shouldReceive('table')->with('table')->andReturn($query = m::mock(stdClass::class));
<ide> $query->shouldReceive('insertGetId')->once()->andReturnUsing(function ($array) use ($uuid) {
<ide> $this->assertSame('default', $array['queue']);
<del> $this->assertEquals(json_encode(['uuid' => $uuid, 'displayName' => 'foo', 'job' => 'foo', 'maxTries' => null, 'maxExceptions' => null, 'backoff' => null, 'timeout' => null, 'data' => ['data']]), $array['payload']);
<add> $this->assertSame(json_encode(['uuid' => $uuid, 'displayName' => 'foo', 'job' => 'foo', 'maxTries' => null, 'maxExceptions' => null, 'backoff' => null, 'timeout' => null, 'data' => ['data']]), $array['payload']);
<ide> $this->assertEquals(0, $array['attempts']);
<ide> $this->assertNull($array['reserved_at']);
<ide> $this->assertIsInt($array['available_at']);
<ide><path>tests/Redis/RedisConnectorTest.php
<ide> public function testDefaultConfiguration()
<ide>
<ide> $predisClient = $this->redis['predis']->connection()->client();
<ide> $parameters = $predisClient->getConnection()->getParameters();
<del> $this->assertEquals('tcp', $parameters->scheme);
<add> $this->assertSame('tcp', $parameters->scheme);
<ide> $this->assertEquals($host, $parameters->host);
<ide> $this->assertEquals($port, $parameters->port);
<ide>
<ide> public function testUrl()
<ide> ]);
<ide> $predisClient = $predis->connection()->client();
<ide> $parameters = $predisClient->getConnection()->getParameters();
<del> $this->assertEquals('tcp', $parameters->scheme);
<add> $this->assertSame('tcp', $parameters->scheme);
<ide> $this->assertEquals($host, $parameters->host);
<ide> $this->assertEquals($port, $parameters->port);
<ide>
<ide> public function testUrl()
<ide> ],
<ide> ]);
<ide> $phpRedisClient = $phpRedis->connection()->client();
<del> $this->assertEquals("tcp://{$host}", $phpRedisClient->getHost());
<add> $this->assertSame("tcp://{$host}", $phpRedisClient->getHost());
<ide> $this->assertEquals($port, $phpRedisClient->getPort());
<ide> }
<ide>
<ide> public function testUrlWithScheme()
<ide> ]);
<ide> $predisClient = $predis->connection()->client();
<ide> $parameters = $predisClient->getConnection()->getParameters();
<del> $this->assertEquals('tls', $parameters->scheme);
<add> $this->assertSame('tls', $parameters->scheme);
<ide> $this->assertEquals($host, $parameters->host);
<ide> $this->assertEquals($port, $parameters->port);
<ide>
<ide> public function testUrlWithScheme()
<ide> ],
<ide> ]);
<ide> $phpRedisClient = $phpRedis->connection()->client();
<del> $this->assertEquals("tcp://{$host}", $phpRedisClient->getHost());
<add> $this->assertSame("tcp://{$host}", $phpRedisClient->getHost());
<ide> $this->assertEquals($port, $phpRedisClient->getPort());
<ide> }
<ide>
<ide> public function testScheme()
<ide> ]);
<ide> $predisClient = $predis->connection()->client();
<ide> $parameters = $predisClient->getConnection()->getParameters();
<del> $this->assertEquals('tls', $parameters->scheme);
<add> $this->assertSame('tls', $parameters->scheme);
<ide> $this->assertEquals($host, $parameters->host);
<ide> $this->assertEquals($port, $parameters->port);
<ide>
<ide> public function testScheme()
<ide> ],
<ide> ]);
<ide> $phpRedisClient = $phpRedis->connection()->client();
<del> $this->assertEquals("tcp://{$host}", $phpRedisClient->getHost());
<add> $this->assertSame("tcp://{$host}", $phpRedisClient->getHost());
<ide> $this->assertEquals($port, $phpRedisClient->getPort());
<ide> }
<ide> }
<ide><path>tests/Routing/RoutingRouteTest.php
<ide> public function testMiddlewareCanBeSkipped()
<ide> return 'hello';
<ide> }])->withoutMiddleware(RoutingTestMiddlewareGroupTwo::class);
<ide>
<del> $this->assertEquals('hello', $router->dispatch(Request::create('foo/bar', 'GET'))->getContent());
<add> $this->assertSame('hello', $router->dispatch(Request::create('foo/bar', 'GET'))->getContent());
<ide> }
<ide>
<ide> public function testMiddlewareCanBeSkippedFromResources()
<ide> public function testMiddlewareCanBeSkippedFromResources()
<ide> ->middleware('web')
<ide> ->withoutMiddleware(RoutingTestMiddlewareGroupTwo::class);
<ide>
<del> $this->assertEquals('Hello World', $router->dispatch(Request::create('foo', 'GET'))->getContent());
<add> $this->assertSame('Hello World', $router->dispatch(Request::create('foo', 'GET'))->getContent());
<ide> }
<ide>
<ide> public function testMiddlewareWorksIfControllerThrowsHttpResponseException()
<ide><path>tests/Validation/ValidationValidatorTest.php
<ide> public function testNestedErrorMessagesAreRetrievedFromLocalArray()
<ide> ]);
<ide>
<ide> $this->assertFalse($v->passes());
<del> $this->assertEquals('post name is required', $v->errors()->all()[0]);
<add> $this->assertSame('post name is required', $v->errors()->all()[0]);
<ide> }
<ide>
<ide> public function testSometimesWorksOnNestedArrays()
<ide><path>tests/View/ViewComponentTest.php
<ide> public function testAttributeParentInheritance()
<ide>
<ide> $component->withAttributes(['class' => 'foo', 'attributes' => new ComponentAttributeBag(['class' => 'bar', 'type' => 'button'])]);
<ide>
<del> $this->assertEquals('class="foo bar" type="button"', (string) $component->attributes);
<add> $this->assertSame('class="foo bar" type="button"', (string) $component->attributes);
<ide> }
<ide>
<ide> public function testPublicMethodsWithNoArgsAreConvertedToStringableCallablesInvokedAndNotCached() | 17 |
Java | Java | change the exception message of time drift | ac18025d7c03424b4ec38bf38d79026c2d937154 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java
<ide> public void createTimer(
<ide> long driftTime = Math.abs(remoteTime - deviceTime);
<ide> if (driftTime > 60000) {
<ide> throw new RuntimeException(
<del> "Debugger and device times have drifted by " + driftTime + "ms. " +
<add> "Debugger and device times have drifted by more than 60s." +
<ide> "Please correct this by running adb shell " +
<del> "\"date `date +%m%d%H%M%Y.%S`\" on your debugger machine.\n" +
<del> "Debugger Time = " + remoteTime + "\n" +
<del> "Device Time = " + deviceTime
<add> "\"date `date +%m%d%H%M%Y.%S`\" on your debugger machine."
<ide> );
<ide> }
<ide> } | 1 |
Text | Text | add categories for tools | a3ea4f31ffab43a1d9ee5d6e8fcf8d7a1769a115 | <ide><path>client/src/pages/guide/english/designer-tools/index.md
<ide> title: Designer Tools
<ide>
<ide> In this section, we'll have guides to a wide variety of tools used by designers.
<ide>
<del>These are some of them:
<add>### UI
<add>Great for static content.
<ide>
<ide> [Sketch](https://www.sketchapp.com) - [Guide](https://github.com/freeCodeCamp/guides/blob/master/src/pages/designer-tools/sketch/index.md)
<ide>
<del>[Adobe Experience Design](www.adobe.com/products/experience-design.html) - [Guide](https://github.com/freeCodeCamp/guides/blob/master/src/pages/designer-tools/Experience-design/index.md)
<del>
<ide> [Adobe Photoshop](http://adobe.com/Photoshop) - [Guide](https://github.com/freeCodeCamp/guides/blob/master/src/pages/designer-tools/photoshop/index.md)
<ide>
<ide> [Adobe Illustrator](http://adobe.com/Illustrator) - [Guide](https://github.com/freeCodeCamp/guides/blob/master/src/pages/designer-tools/illustrator/index.md)
<ide>
<ide> [Figma](https://www.figma.com) - [Guide](https://github.com/freeCodeCamp/guides/blob/master/src/pages/designer-tools/Figma/index.md)
<ide>
<add>### Interaction
<add>Better for complicated interactions.
<add>
<add>[Adobe Experience Design](www.adobe.com/products/experience-design.html) - [Guide](https://github.com/freeCodeCamp/guides/blob/master/src/pages/designer-tools/Experience-design/index.md)
<add>
<ide> [Framer](https://framer.com) - [Guide](https://github.com/freeCodeCamp/guides/blob/master/src/pages/designer-tools/framer/index.md)
<ide>
<del>[CLIP STUDIO PAINT](https://www.clipstudio.net/en)
<add>### Wireframes and prototyping
<add>Ideal for click-through prototypes.
<add>
<add>[InVision](https://www.invisionapp.com/)
<add>
<add>[Marvel](https://marvelapp.com/)
<ide>
<ide> [Moqups](https://moqups.com/)
<ide>
<del>[Krita] (https://krita.org/en/homepage/)
<add>### Painting
<add>Great for artists.
<ide>
<del>[MediBang Paint] (https://medibangpaint.com/en/)
<add>[Clip Studio Paint](https://www.clipstudio.net/en)
<ide>
<del>[Autodesk Sketchbook] (https://www.sketchbook.com/)
<add>[Krita](https://krita.org/en/homepage/)
<ide>
<del>In this section, you can see popular Firefox plug-ins used by designers.
<add>[MediBang Paint](https://medibangpaint.com/en/)
<add>
<add>[Autodesk Sketchbook](https://www.sketchbook.com/)
<ide>
<del>These are some of them:
<add>## Plug-ins
<add>
<add>### For Firefox
<add>
<add>In this section, you can see popular Firefox plug-ins used by designers.
<ide>
<ide> - [Color Picker](https://addons.mozilla.org/en-us/firefox/addon/colorzilla/?src=collection&collection_id=90e68e6a-f13f-5921-3412-5228262ca9db)
<ide> - [React Developer Tools](https://addons.mozilla.org/en-US/firefox/addon/react-devtools/) | 1 |
PHP | PHP | use braces around one-liner | 4a0b0569c860fd364e860471d730c1021fe4b517 | <ide><path>src/Illuminate/Events/Annotations/Scanner.php
<ide> public function __construct($scan, $rootNamespace)
<ide> $this->rootNamespace = rtrim($rootNamespace, '\\').'\\';
<ide>
<ide> foreach (Finder::create()->files()->in(__DIR__.'/Annotations') as $file)
<add> {
<ide> AnnotationRegistry::registerFile($file->getRealPath());
<add> }
<ide> }
<ide>
<ide> /** | 1 |
Text | Text | update deprecation notes about v1 registry | c8f826f4077b15af30d8810f62abd517908bb712 | <ide><path>docs/deprecated.md
<ide> of the `--changes` flag that allows to pass `Dockerfile` commands.
<ide>
<ide> ### Interacting with V1 registries
<ide>
<del>Version 1.9 adds a flag (`--disable-legacy-registry=false`) which prevents the docker daemon from `pull`, `push`, and `login` operations against v1 registries. Though disabled by default, this signals the intent to deprecate the v1 protocol.
<add>**Disabled By Default In Release: v1.14**
<add>
<add>**Target For Removal In Release: v1.17**
<add>
<add>Version 1.9 adds a flag (`--disable-legacy-registry=false`) which prevents the
<add>docker daemon from `pull`, `push`, and `login` operations against v1
<add>registries. Though enabled by default, this signals the intent to deprecate
<add>the v1 protocol.
<add>
<add>Support for the v1 protocol to the public registry was removed in 1.13. Any
<add>mirror configurations using v1 should be updated to use a
<add>[v2 registry mirror](https://docs.docker.com/registry/recipes/mirror/).
<ide>
<ide> ### Docker Content Trust ENV passphrase variables name change
<ide> **Deprecated In Release: [v1.9.0](https://github.com/docker/docker/releases/tag/v1.9.0)** | 1 |
Javascript | Javascript | add tests for iso bubbling | b728ddbad6653e4e48ae8c92a887ea673b1b167e | <ide><path>src/test/moment/duration.js
<ide> test('serialization to ISO 8601 duration strings', function (assert) {
<ide> assert.equal(moment.duration({s: -0.5}).toISOString(), '-PT0.5S', 'one half second ago');
<ide> assert.equal(moment.duration({y: -0.5, M: 1}).toISOString(), '-P5M', 'a month after half a year ago');
<ide> assert.equal(moment.duration({}).toISOString(), 'P0D', 'zero duration');
<add> assert.equal(moment.duration({M: 16, d:40, s: 86465}).toISOString(), 'P1Y4M40DT24H1M5S', 'all fields');
<ide> });
<ide>
<ide> test('toString acts as toISOString', function (assert) {
<ide> test('toString acts as toISOString', function (assert) {
<ide> assert.equal(moment.duration({s: -0.5}).toString(), '-PT0.5S', 'one half second ago');
<ide> assert.equal(moment.duration({y: -0.5, M: 1}).toString(), '-P5M', 'a month after half a year ago');
<ide> assert.equal(moment.duration({}).toString(), 'P0D', 'zero duration');
<add> assert.equal(moment.duration({M: 16, d:40, s: 86465}).toString(), 'P1Y4M40DT24H1M5S', 'all fields');
<ide> });
<ide>
<ide> test('toIsoString deprecation', function (assert) { | 1 |
Ruby | Ruby | reuse options from last time | cae03e33630ccae6d3b11e63f5fe6a61d8b989ea | <ide><path>Library/Homebrew/cmd/reinstall.rb
<ide>
<ide> module Homebrew extend self
<ide> def reinstall
<del> self.uninstall
<del> self.install
<add> # At first save the named formulae and remove them from ARGV
<add> named = ARGV.named
<add> ARGV.delete_if { |arg| named.include? arg }
<add> clean_ARGV = ARGV.clone
<add>
<add> # Add the used_options for each named formula separately so
<add> # that the options apply to the right formula.
<add> named.each do |name|
<add> ARGV.replace(clean_ARGV)
<add> ARGV << name
<add> tab = Tab.for_name(name)
<add> tab.used_options.each { |option| ARGV << option.to_s }
<add> ARGV << '--build-bottle' if tab.built_as_bottle
<add> # Todo: Be as smart as upgrade to restore the old state if reinstall fails.
<add> self.uninstall
<add> oh1 "Reinstalling #{name} #{ARGV.options_only*' '}"
<add> self.install
<add> end
<ide> end
<ide> end | 1 |
Go | Go | fix apparmor load profile | 2ab8f2e389b4ae90d0cec6555ea5708ceca1cc3c | <ide><path>pkg/aaparser/aaparser.go
<ide> package aaparser
<ide> import (
<ide> "fmt"
<ide> "os/exec"
<del> "path/filepath"
<ide> "strconv"
<ide> "strings"
<ide> )
<ide> func GetVersion() (int, error) {
<ide> // LoadProfile runs `apparmor_parser -r` on a specified apparmor profile to
<ide> // replace the profile.
<ide> func LoadProfile(profilePath string) error {
<del> _, err := cmd("", "-r", filepath.Dir(profilePath))
<add> _, err := cmd("", "-r", profilePath)
<ide> if err != nil {
<ide> return err
<ide> }
<ide><path>profiles/apparmor/template.go
<ide> profile {{.Name}} flags=(attach_disconnected,mediate_deleted) {
<ide>
<ide> {{if ge .Version 208095}}
<ide> # suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
<del> ptrace (trace,read) peer=docker-default,
<add> ptrace (trace,read) peer={{.Name}},
<ide> {{end}}
<ide> }
<ide> ` | 2 |
PHP | PHP | change all the strings to use the constant values | 6ff34340127d785767be7a4993a6877c165c0f50 | <ide><path>src/Database/Statement/BufferedStatement.php
<ide> public function fetch($type = parent::FETCH_TYPE_NUM)
<ide> {
<ide> if ($this->_allFetched) {
<ide> $row = ($this->_counter < $this->_count) ? $this->_records[$this->_counter++] : false;
<del> $row = ($row && $type === 'num') ? array_values($row) : $row;
<add> $row = ($row && $type === parent::FETCH_TYPE_NUM) ? array_values($row) : $row;
<ide>
<ide> return $row;
<ide> }
<ide> public function fetchObject()
<ide> * @param string $type The type to fetch.
<ide> * @return array
<ide> */
<del> public function fetchAll($type = 'num')
<add> public function fetchAll($type = parent::FETCH_TYPE_NUM)
<ide> {
<ide> if ($this->_allFetched) {
<ide> return $this->_records;
<ide> public function rowCount()
<ide> {
<ide> if (!$this->_allFetched) {
<ide> $counter = $this->_counter;
<del> while ($this->fetch('assoc')) {
<add> while ($this->fetch(parent::FETCH_TYPE_ASSOC)) {
<ide> }
<ide> $this->_counter = $counter;
<ide> }
<ide><path>src/Database/Statement/CallbackStatement.php
<ide> public function __construct($statement, $driver, $callback)
<ide> * @param string $type Either 'num' or 'assoc' to indicate the result format you would like.
<ide> * @return array|false
<ide> */
<del> public function fetch($type = 'num')
<add> public function fetch($type = parent::FETCH_TYPE_NUM)
<ide> {
<ide> $callback = $this->_callback;
<ide> $row = $this->_statement->fetch($type);
<ide> public function fetch($type = 'num')
<ide> * @param string $type Either 'num' or 'assoc' to indicate the result format you would like.
<ide> * @return array
<ide> */
<del> public function fetchAll($type = 'num')
<add> public function fetchAll($type = parent::FETCH_TYPE_NUM)
<ide> {
<ide> return array_map($this->_callback, $this->_statement->fetchAll($type));
<ide> }
<ide><path>src/Database/Statement/PDOStatement.php
<ide> public function bindValue($column, $value, $type = 'string')
<ide> * @return array|false Result array containing columns and values or false if no results
<ide> * are left
<ide> */
<del> public function fetch($type = 'num')
<add> public function fetch($type = parent::FETCH_TYPE_NUM)
<ide> {
<ide> if ($type === static::FETCH_TYPE_NUM) {
<ide> return $this->_statement->fetch(PDO::FETCH_NUM);
<ide> public function fetch($type = 'num')
<ide> * @param string $type num for fetching columns as positional keys or assoc for column names as keys
<ide> * @return array list of all results from database for this statement
<ide> */
<del> public function fetchAll($type = 'num')
<add> public function fetchAll($type = parent::FETCH_TYPE_NUM)
<ide> {
<ide> if ($type === static::FETCH_TYPE_NUM) {
<ide> return $this->_statement->fetchAll(PDO::FETCH_NUM);
<ide><path>src/Database/Statement/StatementDecorator.php
<ide> public function execute($params = null)
<ide> * @return array|false Result array containing columns and values or false if no results
<ide> * are left
<ide> */
<del> public function fetch($type = 'num')
<add> public function fetch($type = self::FETCH_TYPE_NUM)
<ide> {
<ide> return $this->_statement->fetch($type);
<ide> }
<ide> public function fetchColumn($position)
<ide> * @param string $type num for fetching columns as positional keys or assoc for column names as keys
<ide> * @return array List of all results from database for this statement
<ide> */
<del> public function fetchAll($type = 'num')
<add> public function fetchAll($type = self::FETCH_TYPE_NUM)
<ide> {
<ide> return $this->_statement->fetchAll($type);
<ide> }
<ide> public function lastInsertId($table = null, $column = null)
<ide> {
<ide> $row = null;
<ide> if ($column && $this->columnCount()) {
<del> $row = $this->fetch('assoc');
<add> $row = $this->fetch(static::FETCH_TYPE_ASSOC);
<ide> }
<ide> if (isset($row[$column])) {
<ide> return $row[$column]; | 4 |
Javascript | Javascript | add test cases to test-readline-keys.js | 2db3b941a9384a0336acc7c67d5c8e32a37aacb3 | <ide><path>test/parallel/test-readline-keys.js
<ide> const fo = new FakeInput();
<ide> new Interface({ input: fi, output: fo, terminal: true });
<ide>
<ide> let keys = [];
<del>fi.on('keypress', function(s, k) {
<add>fi.on('keypress', (s, k) => {
<ide> keys.push(k);
<ide> });
<ide>
<ide> function addTest(sequences, expectedKeys) {
<ide> expectedKeys = [ expectedKeys ];
<ide> }
<ide>
<del> expectedKeys = expectedKeys.map(function(k) {
<add> expectedKeys = expectedKeys.map((k) => {
<ide> return k ? extend({ ctrl: false, meta: false, shift: false }, k) : k;
<ide> });
<ide>
<ide> keys = [];
<ide>
<del> sequences.forEach(function(sequence) {
<add> sequences.forEach((sequence) => {
<ide> fi.write(sequence);
<ide> });
<ide> assert.deepStrictEqual(keys, expectedKeys);
<ide> const addKeyIntervalTest = (sequences, expectedKeys, interval = 550,
<ide> expectedKeys = [ expectedKeys ];
<ide> }
<ide>
<del> expectedKeys = expectedKeys.map(function(k) {
<add> expectedKeys = expectedKeys.map((k) => {
<ide> return k ? extend({ ctrl: false, meta: false, shift: false }, k) : k;
<ide> });
<ide>
<ide> addTest('a\x1baA\x1bA', [
<ide> { name: 'a', sequence: '\x1bA', meta: true, shift: true },
<ide> ]);
<ide>
<del>// xterm/gnome
<del>addTest('\x1bOA\x1bOB', [
<add>// xterm/gnome ESC O letter
<add>addTest('\x1bOP\x1bOQ\x1bOR\x1bOS', [
<add> { name: 'f1', sequence: '\x1bOP', code: 'OP' },
<add> { name: 'f2', sequence: '\x1bOQ', code: 'OQ' },
<add> { name: 'f3', sequence: '\x1bOR', code: 'OR' },
<add> { name: 'f4', sequence: '\x1bOS', code: 'OS' },
<add>]);
<add>
<add>// xterm/rxvt ESC [ number ~ */
<add>addTest('\x1b[11~\x1b[12~\x1b[13~\x1b[14~', [
<add> { name: 'f1', sequence: '\x1b[11~', code: '[11~' },
<add> { name: 'f2', sequence: '\x1b[12~', code: '[12~' },
<add> { name: 'f3', sequence: '\x1b[13~', code: '[13~' },
<add> { name: 'f4', sequence: '\x1b[14~', code: '[14~' },
<add>]);
<add>
<add>// from Cygwin and used in libuv
<add>addTest('\x1b[[A\x1b[[B\x1b[[C\x1b[[D\x1b[[E', [
<add> { name: 'f1', sequence: '\x1b[[A', code: '[[A' },
<add> { name: 'f2', sequence: '\x1b[[B', code: '[[B' },
<add> { name: 'f3', sequence: '\x1b[[C', code: '[[C' },
<add> { name: 'f4', sequence: '\x1b[[D', code: '[[D' },
<add> { name: 'f5', sequence: '\x1b[[E', code: '[[E' },
<add>]);
<add>
<add>// common
<add>addTest('\x1b[15~\x1b[17~\x1b[18~\x1b[19~\x1b[20~\x1b[21~\x1b[23~\x1b[24~', [
<add> { name: 'f5', sequence: '\x1b[15~', code: '[15~' },
<add> { name: 'f6', sequence: '\x1b[17~', code: '[17~' },
<add> { name: 'f7', sequence: '\x1b[18~', code: '[18~' },
<add> { name: 'f8', sequence: '\x1b[19~', code: '[19~' },
<add> { name: 'f9', sequence: '\x1b[20~', code: '[20~' },
<add> { name: 'f10', sequence: '\x1b[21~', code: '[21~' },
<add> { name: 'f11', sequence: '\x1b[23~', code: '[23~' },
<add> { name: 'f12', sequence: '\x1b[24~', code: '[24~' },
<add>]);
<add>
<add>// xterm ESC [ letter
<add>addTest('\x1b[A\x1b[B\x1b[C\x1b[D\x1b[E\x1b[F\x1b[H', [
<add> { name: 'up', sequence: '\x1b[A', code: '[A' },
<add> { name: 'down', sequence: '\x1b[B', code: '[B' },
<add> { name: 'right', sequence: '\x1b[C', code: '[C' },
<add> { name: 'left', sequence: '\x1b[D', code: '[D' },
<add> { name: 'clear', sequence: '\x1b[E', code: '[E' },
<add> { name: 'end', sequence: '\x1b[F', code: '[F' },
<add> { name: 'home', sequence: '\x1b[H', code: '[H' },
<add>]);
<add>
<add>// xterm/gnome ESC O letter
<add>addTest('\x1bOA\x1bOB\x1bOC\x1bOD\x1bOE\x1bOF\x1bOH', [
<ide> { name: 'up', sequence: '\x1bOA', code: 'OA' },
<ide> { name: 'down', sequence: '\x1bOB', code: 'OB' },
<add> { name: 'right', sequence: '\x1bOC', code: 'OC' },
<add> { name: 'left', sequence: '\x1bOD', code: 'OD' },
<add> { name: 'clear', sequence: '\x1bOE', code: 'OE' },
<add> { name: 'end', sequence: '\x1bOF', code: 'OF' },
<add> { name: 'home', sequence: '\x1bOH', code: 'OH' },
<ide> ]);
<ide>
<ide> // old xterm shift-arrows
<ide> addTest('\x1bO2A\x1bO2B', [
<ide> { name: 'down', sequence: '\x1bO2B', code: 'OB', shift: true },
<ide> ]);
<ide>
<add>// xterm/rxvt ESC [ number ~
<add>addTest('\x1b[1~\x1b[2~\x1b[3~\x1b[4~\x1b[5~\x1b[6~', [
<add> { name: 'home', sequence: '\x1b[1~', code: '[1~' },
<add> { name: 'insert', sequence: '\x1b[2~', code: '[2~' },
<add> { name: 'delete', sequence: '\x1b[3~', code: '[3~' },
<add> { name: 'end', sequence: '\x1b[4~', code: '[4~' },
<add> { name: 'pageup', sequence: '\x1b[5~', code: '[5~' },
<add> { name: 'pagedown', sequence: '\x1b[6~', code: '[6~' },
<add>]);
<add>
<add>// putty
<add>addTest('\x1b[[5~\x1b[[6~', [
<add> { name: 'pageup', sequence: '\x1b[[5~', code: '[[5~' },
<add> { name: 'pagedown', sequence: '\x1b[[6~', code: '[[6~' },
<add>]);
<add>
<add>// rxvt
<add>addTest('\x1b[7~\x1b[8~', [
<add> { name: 'home', sequence: '\x1b[7~', code: '[7~' },
<add> { name: 'end', sequence: '\x1b[8~', code: '[8~' },
<add>]);
<add>
<ide> // gnome terminal
<ide> addTest('\x1b[A\x1b[B\x1b[2A\x1b[2B', [
<ide> { name: 'up', sequence: '\x1b[A', code: '[A' },
<ide> addTest('\x1b[A\x1b[B\x1b[2A\x1b[2B', [
<ide> { name: 'down', sequence: '\x1b[2B', code: '[B', shift: true },
<ide> ]);
<ide>
<del>// rxvt
<del>addTest('\x1b[20~\x1b[2$\x1b[2^', [
<add>// rxvt keys with modifiers
<add>// eslint-disable-next-line max-len
<add>addTest('\x1b[20~\x1b[2$\x1b[2^\x1b[3$\x1b[3^\x1b[5$\x1b[5^\x1b[6$\x1b[6^\x1b[7$\x1b[7^\x1b[8$\x1b[8^', [
<ide> { name: 'f9', sequence: '\x1b[20~', code: '[20~' },
<ide> { name: 'insert', sequence: '\x1b[2$', code: '[2$', shift: true },
<ide> { name: 'insert', sequence: '\x1b[2^', code: '[2^', ctrl: true },
<add> { name: 'delete', sequence: '\x1b[3$', code: '[3$', shift: true },
<add> { name: 'delete', sequence: '\x1b[3^', code: '[3^', ctrl: true },
<add> { name: 'pageup', sequence: '\x1b[5$', code: '[5$', shift: true },
<add> { name: 'pageup', sequence: '\x1b[5^', code: '[5^', ctrl: true },
<add> { name: 'pagedown', sequence: '\x1b[6$', code: '[6$', shift: true },
<add> { name: 'pagedown', sequence: '\x1b[6^', code: '[6^', ctrl: true },
<add> { name: 'home', sequence: '\x1b[7$', code: '[7$', shift: true },
<add> { name: 'home', sequence: '\x1b[7^', code: '[7^', ctrl: true },
<add> { name: 'end', sequence: '\x1b[8$', code: '[8$', shift: true },
<add> { name: 'end', sequence: '\x1b[8^', code: '[8^', ctrl: true },
<add>]);
<add>
<add>// misc
<add>addTest('\x1b[Z', [
<add> { name: 'tab', sequence: '\x1b[Z', code: '[Z', shift: true },
<ide> ]);
<ide>
<ide> // xterm + modifiers | 1 |
Mixed | Javascript | add maxheadersize property | 9ac108d834539122625c85bb0a88f51a62b22d36 | <ide><path>doc/api/http.md
<ide> added: v0.5.9
<ide> Global instance of `Agent` which is used as the default for all HTTP client
<ide> requests.
<ide>
<add>## http.maxHeaderSize
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>* {number}
<add>
<add>Read-only property specifying the maximum allowed size of HTTP headers in bytes.
<add>Defaults to 8KB. Configurable using the [`--max-http-header-size`][] CLI option.
<add>
<ide> ## http.request(options[, callback])
<ide> ## http.request(url[, options][, callback])
<ide> <!-- YAML
<ide> will be emitted in the following order:
<ide> Note that setting the `timeout` option or using the `setTimeout()` function will
<ide> not abort the request or do anything besides add a `'timeout'` event.
<ide>
<add>[`--max-http-header-size`]: cli.html#cli_max_http_header_size_size
<ide> [`'checkContinue'`]: #http_event_checkcontinue
<ide> [`'request'`]: #http_event_request
<ide> [`'response'`]: #http_event_response
<ide><path>lib/http.js
<ide> const {
<ide> Server,
<ide> ServerResponse
<ide> } = require('_http_server');
<add>let maxHeaderSize;
<ide>
<ide> function createServer(opts, requestListener) {
<ide> return new Server(opts, requestListener);
<ide> module.exports = {
<ide> get,
<ide> request
<ide> };
<add>
<add>Object.defineProperty(module.exports, 'maxHeaderSize', {
<add> configurable: true,
<add> enumerable: true,
<add> get() {
<add> if (maxHeaderSize === undefined) {
<add> const { getOptionValue } = require('internal/options');
<add> maxHeaderSize = getOptionValue('--max-http-header-size');
<add> }
<add>
<add> return maxHeaderSize;
<add> }
<add>});
<ide><path>test/parallel/test-http-max-header-size.js
<add>'use strict';
<add>
<add>require('../common');
<add>const assert = require('assert');
<add>const { spawnSync } = require('child_process');
<add>const http = require('http');
<add>
<add>assert.strictEqual(http.maxHeaderSize, 8 * 1024);
<add>const child = spawnSync(process.execPath, ['--max-http-header-size=10', '-p',
<add> 'http.maxHeaderSize']);
<add>assert.strictEqual(+child.stdout.toString().trim(), 10); | 3 |
PHP | PHP | use pure class name (stdclass) | 1e4486ad7e95929c7c4adda0c85273dc5cc4e150 | <ide><path>tests/Auth/AuthAccessGateTest.php
<ide> public function test_before_can_allow_guests()
<ide> $gate = new Gate(new Container, function () {
<ide> });
<ide>
<del> $gate->before(function (?StdClass $user) {
<add> $gate->before(function (?stdClass $user) {
<ide> return true;
<ide> });
<ide>
<ide> public function test_after_can_allow_guests()
<ide> $gate = new Gate(new Container, function () {
<ide> });
<ide>
<del> $gate->after(function (?StdClass $user) {
<add> $gate->after(function (?stdClass $user) {
<ide> return true;
<ide> });
<ide>
<ide> public function test_closures_can_allow_guest_users()
<ide> $gate = new Gate(new Container, function () {
<ide> });
<ide>
<del> $gate->define('foo', function (?StdClass $user) {
<add> $gate->define('foo', function (?stdClass $user) {
<ide> return true;
<ide> });
<ide>
<del> $gate->define('bar', function (StdClass $user) {
<add> $gate->define('bar', function (stdClass $user) {
<ide> return false;
<ide> });
<ide>
<ide> public function test_before_and_after_callbacks_can_allow_guests()
<ide> $gate = new Gate(new Container, function () {
<ide> });
<ide>
<del> $gate->before(function (?StdClass $user) {
<add> $gate->before(function (?stdClass $user) {
<ide> $_SERVER['__laravel.gateBefore'] = true;
<ide> });
<ide>
<del> $gate->after(function (?StdClass $user) {
<add> $gate->after(function (?stdClass $user) {
<ide> $_SERVER['__laravel.gateAfter'] = true;
<ide> });
<ide>
<del> $gate->before(function (StdClass $user) {
<add> $gate->before(function (stdClass $user) {
<ide> $_SERVER['__laravel.gateBefore2'] = true;
<ide> });
<ide>
<del> $gate->after(function (StdClass $user) {
<add> $gate->after(function (stdClass $user) {
<ide> $_SERVER['__laravel.gateAfter2'] = true;
<ide> });
<ide>
<ide> class AccessGateTestGuestNullableInvokable
<ide> {
<ide> public static $calledMethod = null;
<ide>
<del> public function __invoke(?StdClass $user)
<add> public function __invoke(?stdClass $user)
<ide> {
<ide> static::$calledMethod = 'Nullable __invoke was called';
<ide>
<ide> public function update($user, AccessGateTestDummy $dummy)
<ide>
<ide> class AccessGateTestPolicyThatAllowsGuests
<ide> {
<del> public function before(?StdClass $user)
<add> public function before(?stdClass $user)
<ide> {
<ide> $_SERVER['__laravel.testBefore'] = true;
<ide> }
<ide>
<del> public function edit(?StdClass $user, AccessGateTestDummy $dummy)
<add> public function edit(?stdClass $user, AccessGateTestDummy $dummy)
<ide> {
<ide> return true;
<ide> }
<ide> public function update($user, AccessGateTestDummy $dummy)
<ide>
<ide> class AccessGateTestPolicyWithNonGuestBefore
<ide> {
<del> public function before(StdClass $user)
<add> public function before(stdClass $user)
<ide> {
<ide> $_SERVER['__laravel.testBefore'] = true;
<ide> }
<ide>
<del> public function edit(?StdClass $user, AccessGateTestDummy $dummy)
<add> public function edit(?stdClass $user, AccessGateTestDummy $dummy)
<ide> {
<ide> return true;
<ide> } | 1 |
Go | Go | fix error message and typos in swarm cluster | 39bc10c36d40677c11a800b4346c5cddec2b997d | <ide><path>api/server/router/swarm/cluster_routes.go
<ide> func (sr *swarmRouter) createService(ctx context.Context, w http.ResponseWriter,
<ide>
<ide> id, err := sr.backend.CreateService(service)
<ide> if err != nil {
<del> logrus.Errorf("Error reating service %s: %v", id, err)
<add> logrus.Errorf("Error creating service %s: %v", id, err)
<ide> return err
<ide> }
<ide>
<ide><path>daemon/cluster/cluster.go
<ide> type Config struct {
<ide> Backend executorpkg.Backend
<ide> }
<ide>
<del>// Cluster provides capabilities to pariticipate in a cluster as worker or a
<del>// manager and a worker.
<add>// Cluster provides capabilities to participate in a cluster as a worker or a
<add>// manager.
<ide> type Cluster struct {
<ide> sync.RWMutex
<ide> root string
<ide> func (c *Cluster) Leave(force bool) error {
<ide> c.Unlock()
<ide> return fmt.Errorf(msg)
<ide> }
<del> msg += fmt.Sprintf("Leaving cluster will leave you with %v managers out of %v. This means Raft quorum will be lost and your cluster will become inaccessible. ", reachable-1, reachable+unreachable)
<add> msg += fmt.Sprintf("Leaving cluster will leave you with %v managers out of %v. This means Raft quorum will be lost and your cluster will become inaccessible. ", reachable-1, reachable+unreachable)
<ide> }
<ide> }
<ide> } else {
<del> msg += "Doing so may lose the consenus of your cluster. "
<add> msg += "Doing so may lose the consensus of your cluster. "
<ide> }
<ide>
<ide> msg += "Only way to restore a cluster that has lost consensus is to reinitialize it with `--force-new-cluster`. Use `--force` to ignore this message."
<ide> func (c *Cluster) getRequestContext() context.Context { // TODO: not needed when
<ide> return ctx
<ide> }
<ide>
<del>// Inspect retrives the confuguration properties of managed swarm cluster.
<add>// Inspect retrieves the configuration properties of a managed swarm cluster.
<ide> func (c *Cluster) Inspect() (types.Swarm, error) {
<ide> c.RLock()
<ide> defer c.RUnlock()
<ide> func (c *Cluster) Update(version uint64, spec types.Spec) error {
<ide> return err
<ide> }
<ide>
<del>// IsManager returns true is Cluster is participating as a manager.
<add>// IsManager returns true if Cluster is participating as a manager.
<ide> func (c *Cluster) IsManager() bool {
<ide> c.RLock()
<ide> defer c.RUnlock()
<ide> return c.isActiveManager()
<ide> }
<ide>
<del>// IsAgent returns true is Cluster is participating as a worker/agent.
<add>// IsAgent returns true if Cluster is participating as a worker/agent.
<ide> func (c *Cluster) IsAgent() bool {
<ide> c.RLock()
<ide> defer c.RUnlock()
<ide> return c.ready
<ide> }
<ide>
<del>// GetListenAddress returns the listening address for current maanger's
<add>// GetListenAddress returns the listening address for current manager's
<ide> // consensus and dispatcher APIs.
<ide> func (c *Cluster) GetListenAddress() string {
<ide> c.RLock()
<ide> func (c *Cluster) GetListenAddress() string {
<ide> return ""
<ide> }
<ide>
<del>// GetRemoteAddress returns a known advertise address of a remote maanger if
<add>// GetRemoteAddress returns a known advertise address of a remote manager if
<ide> // available.
<ide> // todo: change to array/connect with info
<ide> func (c *Cluster) GetRemoteAddress() string {
<ide> func (c *Cluster) CreateService(s types.ServiceSpec) (string, error) {
<ide> return r.Service.ID, nil
<ide> }
<ide>
<del>// GetService returns a service based on a ID or name.
<add>// GetService returns a service based on an ID or name.
<ide> func (c *Cluster) GetService(input string) (types.Service, error) {
<ide> c.RLock()
<ide> defer c.RUnlock()
<ide> func (c *Cluster) GetNodes(options apitypes.NodeListOptions) ([]types.Node, erro
<ide> return nodes, nil
<ide> }
<ide>
<del>// GetNode returns a node based on a ID or name.
<add>// GetNode returns a node based on an ID or name.
<ide> func (c *Cluster) GetNode(input string) (types.Node, error) {
<ide> c.RLock()
<ide> defer c.RUnlock()
<ide> func (c *Cluster) GetTask(input string) (types.Task, error) {
<ide> return convert.TaskFromGRPC(*task), nil
<ide> }
<ide>
<del>// GetNetwork returns a cluster network by ID.
<add>// GetNetwork returns a cluster network by an ID.
<ide> func (c *Cluster) GetNetwork(input string) (apitypes.NetworkResource, error) {
<ide> c.RLock()
<ide> defer c.RUnlock() | 2 |
Ruby | Ruby | use block variable instead of global | c70aee8eea066d911410f40974a3ee9d387cd834 | <ide><path>activerecord/lib/active_record/sanitization.rb
<ide> def replace_bind_variable(value, c = connection) #:nodoc:
<ide> end
<ide>
<ide> def replace_named_bind_variables(statement, bind_vars) #:nodoc:
<del> statement.gsub(/(:?):([a-zA-Z]\w*)/) do
<add> statement.gsub(/(:?):([a-zA-Z]\w*)/) do |match|
<ide> if $1 == ':' # skip postgresql casts
<del> $& # return the whole match
<add> match # return the whole match
<ide> elsif bind_vars.include?(match = $2.to_sym)
<ide> replace_bind_variable(bind_vars[match])
<ide> else
<ide><path>activesupport/lib/active_support/inflector/methods.rb
<ide> def humanize(lower_case_and_underscored_word, options = {})
<ide> # titleize('TheManWithoutAPast') # => "The Man Without A Past"
<ide> # titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark"
<ide> def titleize(word)
<del> humanize(underscore(word)).gsub(/\b(?<!['’`])[a-z]/) { $&.capitalize }
<add> humanize(underscore(word)).gsub(/\b(?<!['’`])[a-z]/) { |match| match.capitalize }
<ide> end
<ide>
<ide> # Creates the name of a table like Rails does for models to table names. | 2 |
Go | Go | move git functions to pkg/gitutils | 135cca6f52c7862f13f50c30ccf5925038ba40a9 | <ide><path>api/client/build.go
<ide> import (
<ide> "github.com/docker/docker/opts"
<ide> "github.com/docker/docker/pkg/archive"
<ide> "github.com/docker/docker/pkg/fileutils"
<add> "github.com/docker/docker/pkg/gitutils"
<ide> "github.com/docker/docker/pkg/httputils"
<ide> "github.com/docker/docker/pkg/jsonmessage"
<ide> flag "github.com/docker/docker/pkg/mflag"
<ide> func getContextFromReader(r io.Reader, dockerfileName string) (absContextDir, re
<ide> // path of the dockerfile in that context directory, and a non-nil error on
<ide> // success.
<ide> func getContextFromGitURL(gitURL, dockerfileName string) (absContextDir, relDockerfile string, err error) {
<del> if absContextDir, err = utils.GitClone(gitURL); err != nil {
<add> if absContextDir, err = gitutils.Clone(gitURL); err != nil {
<ide> return "", "", fmt.Errorf("unable to 'git clone' to temporary context directory: %v", err)
<ide> }
<ide>
<ide><path>builder/git.go
<ide> import (
<ide> "os"
<ide>
<ide> "github.com/docker/docker/pkg/archive"
<del> "github.com/docker/docker/utils"
<add> "github.com/docker/docker/pkg/gitutils"
<ide> )
<ide>
<ide> // MakeGitContext returns a Context from gitURL that is cloned in a temporary directory.
<ide> func MakeGitContext(gitURL string) (ModifiableContext, error) {
<del> root, err := utils.GitClone(gitURL)
<add> root, err := gitutils.Clone(gitURL)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<add><path>pkg/gitutils/gitutils.go
<del><path>utils/git.go
<del>package utils
<add>package gitutils
<ide>
<ide> import (
<ide> "fmt"
<ide> import (
<ide> "github.com/docker/docker/pkg/urlutil"
<ide> )
<ide>
<del>// GitClone clones a repository into a newly created directory which
<add>// Clone clones a repository into a newly created directory which
<ide> // will be under "docker-build-git"
<del>func GitClone(remoteURL string) (string, error) {
<add>func Clone(remoteURL string) (string, error) {
<ide> if !urlutil.IsGitTransport(remoteURL) {
<ide> remoteURL = "https://" + remoteURL
<ide> }
<add><path>pkg/gitutils/gitutils_test.go
<del><path>utils/git_test.go
<del>package utils
<add>package gitutils
<ide>
<ide> import (
<ide> "fmt" | 4 |
Python | Python | fix typo in example | f4745c8ce1955c28676b5afe129a88a61aa743b9 | <ide><path>airflow/providers/google/cloud/example_dags/example_bigquery_queries.py
<ide> configuration={
<ide> "query": {
<ide> "query": INSERT_ROWS_QUERY,
<del> "useLegacySql": "False",
<add> "useLegacySql": False,
<ide> }
<ide> },
<ide> location=location, | 1 |
Javascript | Javascript | fix common.cancreatesymlink() on non-windows | 6ec43fc28b66587eb176019f488d682d256bd189 | <ide><path>test/common/index.js
<ide> exports.canCreateSymLink = function() {
<ide> return false;
<ide> }
<ide> }
<add> // On non-Windows platforms, this always returns `true`
<add> return true;
<ide> };
<ide>
<ide> exports.getCallSite = function getCallSite(top) { | 1 |
Python | Python | fix vsphere driver | 040d2955a264472e2fec968e5c7d8418a2176c78 | <ide><path>libcloud/compute/drivers/vsphere.py
<ide>
<ide> class VSphereConnection(ConnectionUserAndKey):
<ide> def __init__(self, user_id, key, secure=True,
<del> host=None, port=None, url=None, timeout=None):
<add> host=None, port=None, url=None, timeout=None, **kwargs):
<ide> if host and url:
<ide> raise ValueError('host and url arguments are mutually exclusive')
<ide>
<ide> def __init__(self, user_id, key, secure=True,
<ide> super(VSphereConnection, self).__init__(user_id=user_id,
<ide> key=key, secure=secure,
<ide> host=host, port=port,
<del> url=url, timeout=timeout)
<add> url=url, timeout=timeout,
<add> **kwargs)
<ide>
<ide> def connect(self):
<ide> self.client = VIServer()
<ide> class VSphereNodeDriver(NodeDriver):
<ide> }
<ide>
<ide> def __new__(cls, username, password, secure=True, host=None, port=None,
<del> url=None, api_version=DEFAULT_API_VERSION, **kwargs):
<add> url=None, api_version=DEFAULT_API_VERSION):
<ide> if cls is VSphereNodeDriver:
<ide> if api_version == '5.5':
<ide> cls = VSphere_5_5_NodeDriver | 1 |
Javascript | Javascript | update examples to use modules | c0360890c58858e2d3a7ee25e0eeae3c5d32e96c | <ide><path>src/ngCookies/cookies.js
<ide> angular.module('ngCookies', ['ng']).
<ide> * @example
<ide> *
<ide> * ```js
<del> * function ExampleController($cookies) {
<del> * // Retrieving a cookie
<del> * var favoriteCookie = $cookies.myFavorite;
<del> * // Setting a cookie
<del> * $cookies.myFavorite = 'oatmeal';
<del> * }
<add> * angular.module('cookiesExample', ['ngCookies'])
<add> * .controller('ExampleController', ['$cookies', function($cookies) {
<add> * // Retrieving a cookie
<add> * var favoriteCookie = $cookies.myFavorite;
<add> * // Setting a cookie
<add> * $cookies.myFavorite = 'oatmeal';
<add> * }]);
<ide> * ```
<ide> */
<ide> factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
<ide> angular.module('ngCookies', ['ng']).
<ide> * @example
<ide> *
<ide> * ```js
<del> * function ExampleController($cookieStore) {
<del> * // Put cookie
<del> * $cookieStore.put('myFavorite','oatmeal');
<del> * // Get cookie
<del> * var favoriteCookie = $cookieStore.get('myFavorite');
<del> * // Removing a cookie
<del> * $cookieStore.remove('myFavorite');
<del> * }
<add> * angular.module('cookieStoreExample', ['ngCookies'])
<add> * .controller('ExampleController', ['$cookieStore', function($cookieStore) {
<add> * // Put cookie
<add> * $cookieStore.put('myFavorite','oatmeal');
<add> * // Get cookie
<add> * var favoriteCookie = $cookieStore.get('myFavorite');
<add> * // Removing a cookie
<add> * $cookieStore.remove('myFavorite');
<add> * }]);
<ide> * ```
<ide> */
<ide> factory('$cookieStore', ['$cookies', function($cookies) { | 1 |
Go | Go | pass pipes into exec function | c8fd81c27821576f339ccf4fd85c47375ba34042 | <ide><path>pkg/libcontainer/nsinit/exec.go
<ide> import (
<ide>
<ide> // Exec performes setup outside of a namespace so that a container can be
<ide> // executed. Exec is a high level function for working with container namespaces.
<del>func Exec(container *libcontainer.Container, logFile string, args []string) (int, error) {
<add>func Exec(container *libcontainer.Container, stdin io.Reader, stdout, stderr io.Writer, logFile string, args []string) (int, error) {
<ide> var (
<ide> master *os.File
<ide> console string
<ide> func Exec(container *libcontainer.Container, logFile string, args []string) (int
<ide>
<ide> if container.Tty {
<ide> log.Printf("starting copy for tty")
<del> go io.Copy(os.Stdout, master)
<del> go io.Copy(master, os.Stdin)
<add> go io.Copy(stdout, master)
<add> go io.Copy(master, stdin)
<ide>
<ide> state, err := setupWindow(master)
<ide> if err != nil {
<ide> command.Process.Kill()
<ide> return -1, err
<ide> }
<del> defer term.RestoreTerminal(os.Stdin.Fd(), state)
<add> defer term.RestoreTerminal(uintptr(syscall.Stdin), state)
<ide> } else {
<ide> log.Printf("starting copy for std pipes")
<ide> go func() {
<ide> defer inPipe.Close()
<del> io.Copy(inPipe, os.Stdin)
<add> io.Copy(inPipe, stdin)
<ide> }()
<del> go io.Copy(os.Stdout, outPipe)
<del> go io.Copy(os.Stderr, errPipe)
<add> go io.Copy(stdout, outPipe)
<add> go io.Copy(stderr, errPipe)
<ide> }
<ide>
<ide> log.Printf("waiting on process")
<ide><path>pkg/libcontainer/nsinit/nsinit/main.go
<ide> func main() {
<ide> if nspid > 0 {
<ide> exitCode, err = nsinit.ExecIn(container, nspid, flag.Args()[1:])
<ide> } else {
<del> exitCode, err = nsinit.Exec(container, logFile, flag.Args()[1:])
<add> exitCode, err = nsinit.Exec(container,
<add> os.Stdin, os.Stdout, os.Stderr,
<add> logFile, flag.Args()[1:])
<ide> }
<ide> if err != nil {
<ide> log.Fatal(err) | 2 |
Mixed | Ruby | fix documents for create_join_table | 56ddb8917d62681c7e056f5386305d32c2484ba5 | <ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
<ide> def create_table(table_name, options = {})
<ide> # its block form to do so yourself:
<ide> #
<ide> # create_join_table :products, :categories do |t|
<del> # t.index :products
<del> # t.index :categories
<add> # t.index :product_id
<add> # t.index :category_id
<ide> # end
<ide> #
<ide> # ====== Add a backend specific option to the generated SQL (MySQL)
<ide><path>guides/source/migrations.md
<ide> will create a `categorization` table.
<ide>
<ide> ```ruby
<ide> create_join_table :products, :categories do |t|
<del> t.index :products
<del> t.index :categories
<add> t.index :product_id
<add> t.index :category_id
<ide> end
<ide> ```
<ide> | 2 |
Python | Python | fix unicode error in new test | 9e413449f6f85e0cf9465762e31e8f251e14c23e | <ide><path>spacy/tests/regression/test_issue1537.py
<ide> '''Test Span.as_doc() doesn't segfault'''
<add>from __future__ import unicode_literals
<ide> from ...tokens import Doc
<ide> from ...vocab import Vocab
<ide> from ... import load as load_spacy | 1 |
Javascript | Javascript | fix component name for react.lazy | 973496b40ce6fcb84f3df20aa1c73af5bc4db0d4 | <ide><path>packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
<ide> describe('ReactSuspense', () => {
<ide> span('C'),
<ide> ]);
<ide> });
<add>
<add> it('includes lazy-loaded component in warning stack', async () => {
<add> const LazyFoo = lazy(() => {
<add> ReactNoop.yield('Started loading');
<add> const Foo = props => (
<add> <div>{[<Text text="A" />, <Text text="B" />]}</div>
<add> );
<add> return Promise.resolve(Foo);
<add> });
<add>
<add> ReactNoop.render(
<add> <Placeholder fallback={<Text text="Loading..." />}>
<add> <LazyFoo />
<add> </Placeholder>,
<add> );
<add> expect(ReactNoop.flush()).toEqual(['Started loading', 'Loading...']);
<add> expect(ReactNoop.getChildren()).toEqual([]);
<add>
<add> await LazyFoo;
<add> expect(() => {
<add> expect(ReactNoop.flush()).toEqual(['A', 'B']);
<add> }).toWarnDev(' in Text (at **)\n' + ' in Foo (at **)');
<add> expect(ReactNoop.getChildren()).toEqual([div(span('A'), span('B'))]);
<add> });
<ide> });
<ide>
<ide> it('does not call lifecycles of a suspended component', async () => {
<ide><path>packages/shared/getComponentName.js
<ide> import {
<ide> REACT_STRICT_MODE_TYPE,
<ide> REACT_PLACEHOLDER_TYPE,
<ide> } from 'shared/ReactSymbols';
<del>import {
<del> getResultFromResolvedThenable,
<del> refineResolvedThenable,
<del>} from 'shared/ReactLazyComponent';
<add>import {refineResolvedThenable} from 'shared/ReactLazyComponent';
<ide>
<ide> function getComponentName(type: mixed): string | null {
<ide> if (type == null) {
<ide> function getComponentName(type: mixed): string | null {
<ide> const thenable: Thenable<mixed> = (type: any);
<ide> const resolvedThenable = refineResolvedThenable(thenable);
<ide> if (resolvedThenable) {
<del> const Component = getResultFromResolvedThenable(resolvedThenable);
<del> return getComponentName(Component);
<add> return getComponentName(resolvedThenable);
<ide> }
<ide> }
<ide> } | 2 |
Ruby | Ruby | fix the user show page in the verify task | ea83132e0eeb6988f9211d5b5cbe4b99f2b9982e | <ide><path>tasks/release.rb
<ide> description %>\n</p>
<ide>
<ide> <p>
<del> <%= image_tag @user.avatar.representation(resize_to_fit: [500, 500]) %>
<add> <% if @user.avatar.attached? -%>
<add> <%= image_tag @user.avatar.representation(resize_to_fit: [500, 500]) %>
<add> <% end -%>
<ide> </p>
<ide> CODE
<ide> | 1 |
Python | Python | add italian stopwords | 7cb9f51be6d6057c05ba18075796c4cd352811ce | <ide><path>spacy/it/language_data.py
<ide> def strings_to_exc(orths):
<ide> }
<ide>
<ide> STOP_WORDS = set("""
<add>a abbastanza abbia abbiamo abbiano abbiate accidenti ad adesso affinche agl
<add>agli ahime ahimè ai al alcuna alcuni alcuno all alla alle allo allora altri
<add>altrimenti altro altrove altrui anche ancora anni anno ansa anticipo assai
<add>attesa attraverso avanti avemmo avendo avente aver avere averlo avesse
<add>avessero avessi avessimo aveste avesti avete aveva avevamo avevano avevate
<add>avevi avevo avrai avranno avrebbe avrebbero avrei avremmo avremo avreste
<add>avresti avrete avrà avrò avuta avute avuti avuto
<ide>
<add>basta bene benissimo brava bravo
<add>
<add>casa caso cento certa certe certi certo che chi chicchessia chiunque ci
<add>ciascuna ciascuno cima cio cioe circa citta città co codesta codesti codesto
<add>cogli coi col colei coll coloro colui come cominci comunque con concernente
<add>conciliarsi conclusione consiglio contro cortesia cos cosa cosi così cui
<add>
<add>da dagl dagli dai dal dall dalla dalle dallo dappertutto davanti degl degli
<add>dei del dell della delle dello dentro detto deve di dice dietro dire
<add>dirimpetto diventa diventare diventato dopo dov dove dovra dovrà dovunque due
<add>dunque durante
<add>
<add>ebbe ebbero ebbi ecc ecco ed effettivamente egli ella entrambi eppure era
<add>erano eravamo eravate eri ero esempio esse essendo esser essere essi ex
<add>
<add>fa faccia facciamo facciano facciate faccio facemmo facendo facesse facessero
<add>facessi facessimo faceste facesti faceva facevamo facevano facevate facevi
<add>facevo fai fanno farai faranno fare farebbe farebbero farei faremmo faremo
<add>fareste faresti farete farà farò fatto favore fece fecero feci fin finalmente
<add>finche fine fino forse forza fosse fossero fossi fossimo foste fosti fra
<add>frattempo fu fui fummo fuori furono futuro generale
<add>
<add>gia già giacche giorni giorno gli gliela gliele glieli glielo gliene governo
<add>grande grazie gruppo
<add>
<add>ha haha hai hanno ho
<add>
<add>ieri il improvviso in inc infatti inoltre insieme intanto intorno invece io
<add>
<add>la là lasciato lato lavoro le lei li lo lontano loro lui lungo luogo
<add>
<add>ma macche magari maggior mai male malgrado malissimo mancanza marche me
<add>medesimo mediante meglio meno mentre mesi mezzo mi mia mie miei mila miliardi
<add>milioni minimi ministro mio modo molti moltissimo molto momento mondo mosto
<add>
<add>nazionale ne negl negli nei nel nell nella nelle nello nemmeno neppure nessun
<add>nessuna nessuno niente no noi non nondimeno nonostante nonsia nostra nostre
<add>nostri nostro novanta nove nulla nuovo
<add>
<add>od oggi ogni ognuna ognuno oltre oppure ora ore osi ossia ottanta otto
<add>
<add>paese parecchi parecchie parecchio parte partendo peccato peggio per perche
<add>perché percio perciò perfino pero persino persone però piedi pieno piglia piu
<add>piuttosto più po pochissimo poco poi poiche possa possedere posteriore posto
<add>potrebbe preferibilmente presa press prima primo principalmente probabilmente
<add>proprio puo può pure purtroppo
<add>
<add>qualche qualcosa qualcuna qualcuno quale quali qualunque quando quanta quante
<add>quanti quanto quantunque quasi quattro quel quella quelle quelli quello quest
<add>questa queste questi questo qui quindi
<add>
<add>realmente recente recentemente registrazione relativo riecco salvo
<add>
<add>sara sarà sarai saranno sarebbe sarebbero sarei saremmo saremo sareste
<add>saresti sarete saro sarò scola scopo scorso se secondo seguente seguito sei
<add>sembra sembrare sembrato sembri sempre senza sette si sia siamo siano siate
<add>siete sig solito solo soltanto sono sopra sotto spesso srl sta stai stando
<add>stanno starai staranno starebbe starebbero starei staremmo staremo stareste
<add>staresti starete starà starò stata state stati stato stava stavamo stavano
<add>stavate stavi stavo stemmo stessa stesse stessero stessi stessimo stesso
<add>steste stesti stette stettero stetti stia stiamo stiano stiate sto su sua
<add>subito successivamente successivo sue sugl sugli sui sul sull sulla sulle
<add>sullo suo suoi
<add>
<add>tale tali talvolta tanto te tempo ti titolo torino tra tranne tre trenta
<add>troppo trovato tu tua tue tuo tuoi tutta tuttavia tutte tutti tutto
<add>
<add>uguali ulteriore ultimo un una uno uomo
<add>
<add>va vale vari varia varie vario verso vi via vicino visto vita voi volta volte
<add>vostra vostre vostri vostro
<ide> """.split())
<ide>
<ide> | 1 |
Javascript | Javascript | rewrite setinnerhtml tests to use public api. | 366600d0b2b99ece8cd03d60e2a5454a02857502 | <ide><path>packages/react-dom/src/client/__tests__/dangerouslySetInnerHTML-test.js
<add>/**
<add> * Copyright (c) 2016-present, Facebook, Inc.
<add> *
<add> * This source code is licensed under the MIT license found in the
<add> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @emails react-core
<add> */
<add>
<add>'use strict';
<add>
<add>const React = require('react');
<add>const ReactDOM = require('react-dom');
<add>
<add>describe('dangerouslySetInnerHTML', () => {
<add> describe('when the node has innerHTML property', () => {
<add> it('sets innerHTML on it', () => {
<add> const container = document.createElement('div');
<add> const node = ReactDOM.render(
<add> <div dangerouslySetInnerHTML={{__html: '<h1>Hello</h1>'}} />,
<add> container,
<add> );
<add> expect(node.innerHTML).toBe('<h1>Hello</h1>');
<add> });
<add> });
<add>
<add> describe('when the node does not have an innerHTML property', () => {
<add> let innerHTMLDescriptor;
<add>
<add> // In some versions of IE (TODO: which ones?) SVG nodes don't have
<add> // innerHTML. To simulate this, we will take it off the Element prototype
<add> // and put it onto the HTMLDivElement prototype. We expect that the logic
<add> // checks for existence of innerHTML on SVG, and if one doesn't exist, falls
<add> // back to using appendChild and removeChild.
<add>
<add> beforeEach(() => {
<add> innerHTMLDescriptor = Object.getOwnPropertyDescriptor(
<add> Element.prototype,
<add> 'innerHTML',
<add> );
<add> delete Element.prototype.innerHTML;
<add> Object.defineProperty(
<add> HTMLDivElement.prototype,
<add> 'innerHTML',
<add> innerHTMLDescriptor,
<add> );
<add> });
<add>
<add> afterEach(() => {
<add> delete HTMLDivElement.prototype.innerHTML;
<add> Object.defineProperty(
<add> Element.prototype,
<add> 'innerHTML',
<add> innerHTMLDescriptor,
<add> );
<add> });
<add>
<add> it('sets innerHTML on it', () => {
<add> const html = '<circle></circle>';
<add> const container = document.createElementNS(
<add> 'http://www.w3.org/2000/svg',
<add> 'svg',
<add> );
<add> ReactDOM.render(
<add> <g dangerouslySetInnerHTML={{__html: html}} />,
<add> container,
<add> );
<add> const circle = container.firstChild.firstChild;
<add> expect(circle.tagName).toBe('circle');
<add> });
<add>
<add> it('clears previous children', () => {
<add> const firstHtml = '<rect></rect>';
<add> const secondHtml = '<circle></circle>';
<add>
<add> const container = document.createElementNS(
<add> 'http://www.w3.org/2000/svg',
<add> 'svg',
<add> );
<add> ReactDOM.render(
<add> <g dangerouslySetInnerHTML={{__html: firstHtml}} />,
<add> container,
<add> );
<add> const rect = container.firstChild.firstChild;
<add> expect(rect.tagName).toBe('rect');
<add> ReactDOM.render(
<add> <g dangerouslySetInnerHTML={{__html: secondHtml}} />,
<add> container,
<add> );
<add> const circle = container.firstChild.firstChild;
<add> expect(circle.tagName).toBe('circle');
<add> });
<add> });
<add>});
<ide><path>packages/react-dom/src/client/__tests__/setInnerHTML-test.js
<del>/**
<del> * Copyright (c) 2016-present, Facebook, Inc.
<del> *
<del> * This source code is licensed under the MIT license found in the
<del> * LICENSE file in the root directory of this source tree.
<del> *
<del> * @emails react-core
<del> */
<del>
<del>'use strict';
<del>
<del>// TODO: can we express this test with only public API?
<del>var setInnerHTML = require('../setInnerHTML').default;
<del>var Namespaces = require('../../shared/DOMNamespaces').Namespaces;
<del>
<del>describe('setInnerHTML', () => {
<del> describe('when the node has innerHTML property', () => {
<del> it('sets innerHTML on it', () => {
<del> var node = document.createElement('div');
<del> var html = '<h1>hello</h1>';
<del> setInnerHTML(node, html);
<del> expect(node.innerHTML).toBe(html);
<del> });
<del> });
<del>
<del> describe('when the node does not have an innerHTML property', () => {
<del> var node;
<del> var nodeProxy;
<del> beforeEach(() => {
<del> // Create a mock node that looks like an SVG in IE (without innerHTML)
<del> node = document.createElementNS(Namespaces.svg, 'svg');
<del>
<del> nodeProxy = new Proxy(node, {
<del> has: (target, prop) => {
<del> return prop === 'innerHTML' ? false : prop in target;
<del> },
<del> });
<del>
<del> spyOn(node, 'appendChild').and.callThrough();
<del> spyOn(node, 'removeChild').and.callThrough();
<del> });
<del>
<del> it('sets innerHTML on it', () => {
<del> var html = '<circle></circle><rect></rect>';
<del> setInnerHTML(nodeProxy, html);
<del>
<del> expect(node.appendChild.calls.argsFor(0)[0].outerHTML).toBe(
<del> '<circle></circle>',
<del> );
<del> expect(node.appendChild.calls.argsFor(1)[0].outerHTML).toBe(
<del> '<rect></rect>',
<del> );
<del> });
<del>
<del> it('clears previous children', () => {
<del> var firstHtml = '<rect></rect>';
<del> var secondHtml = '<circle></circle>';
<del> setInnerHTML(nodeProxy, firstHtml);
<del>
<del> setInnerHTML(nodeProxy, secondHtml);
<del>
<del> expect(node.removeChild.calls.argsFor(0)[0].outerHTML).toBe(
<del> '<rect></rect>',
<del> );
<del> expect(node.innerHTML).toBe('<circle></circle>');
<del> });
<del> });
<del>}); | 2 |
Javascript | Javascript | add ember.on, function.prototype.on, didinit event | ca04bee6c8c43140d5cad2307ce6fbafeb5d9488 | <ide><path>packages/ember-metal/lib/events.js
<ide> require('ember-metal/utils');
<ide> var o_create = Ember.create,
<ide> metaFor = Ember.meta,
<ide> META_KEY = Ember.META_KEY,
<add> a_slice = [].slice,
<ide> /* listener flags */
<ide> ONCE = 1, SUSPENDED = 2;
<ide>
<ide> function listenersFor(obj, eventName) {
<ide> return ret;
<ide> }
<ide>
<add>/**
<add> Define a property as a function that should be executed when
<add> a specified event or events are triggered.
<add>
<add> var Job = Ember.Object.extend({
<add> logCompleted: Ember.on('completed', function(){
<add> console.log('Job completed!');
<add> })
<add> });
<add> var job = Job.create();
<add> Ember.sendEvent(job, 'completed'); // Logs "Job completed!"
<add>
<add> @method on
<add> @for Ember
<add> @param {String} eventNames*
<add> @param {Function} func
<add> @return func
<add>*/
<add>Ember.on = function(){
<add> var func = a_slice.call(arguments, -1)[0],
<add> events = a_slice.call(arguments, 0, -1);
<add> func.__ember_listens__ = events;
<add> return func;
<add>};
<add>
<ide> Ember.addListener = addListener;
<ide> Ember.removeListener = removeListener;
<ide> Ember._suspendListener = suspendListener;
<ide><path>packages/ember-metal/lib/mixin.js
<ide> function addNormalizedProperty(base, key, value, meta, descs, values, concats, m
<ide> // impl super if needed...
<ide> if (isMethod(value)) {
<ide> value = giveMethodSuper(base, key, value, values, descs);
<del> } else if ((concats && a_indexOf.call(concats, key) >= 0) ||
<add> } else if ((concats && a_indexOf.call(concats, key) >= 0) ||
<ide> key === 'concatenatedProperties' ||
<ide> key === 'mergedProperties') {
<ide> value = applyConcatenatedProperties(base, key, value, values);
<ide> function followAlias(obj, desc, m, descs, values) {
<ide> return { desc: desc, value: value };
<ide> }
<ide>
<del>function updateObservers(obj, key, observer, observerKey, method) {
<del> if ('function' !== typeof observer) { return; }
<del>
<del> var paths = observer[observerKey];
<add>function updateObserversAndListeners(obj, key, observerOrListener, pathsKey, updateMethod) {
<add> var paths = observerOrListener[pathsKey];
<ide>
<ide> if (paths) {
<ide> for (var i=0, l=paths.length; i<l; i++) {
<del> Ember[method](obj, paths[i], null, key);
<add> Ember[updateMethod](obj, paths[i], null, key);
<ide> }
<ide> }
<ide> }
<ide>
<del>function replaceObservers(obj, key, observer) {
<del> var prevObserver = obj[key];
<add>function replaceObserversAndListeners(obj, key, observerOrListener) {
<add> var prev = obj[key];
<ide>
<del> updateObservers(obj, key, prevObserver, '__ember_observesBefore__', 'removeBeforeObserver');
<del> updateObservers(obj, key, prevObserver, '__ember_observes__', 'removeObserver');
<add> if ('function' === typeof prev) {
<add> updateObserversAndListeners(obj, key, prev, '__ember_observesBefore__', 'removeBeforeObserver');
<add> updateObserversAndListeners(obj, key, prev, '__ember_observes__', 'removeObserver');
<add> updateObserversAndListeners(obj, key, prev, '__ember_listens__', 'removeListener');
<add> }
<ide>
<del> updateObservers(obj, key, observer, '__ember_observesBefore__', 'addBeforeObserver');
<del> updateObservers(obj, key, observer, '__ember_observes__', 'addObserver');
<add> if ('function' === typeof observerOrListener) {
<add> updateObserversAndListeners(obj, key, observerOrListener, '__ember_observesBefore__', 'addBeforeObserver');
<add> updateObserversAndListeners(obj, key, observerOrListener, '__ember_observes__', 'addObserver');
<add> updateObserversAndListeners(obj, key, observerOrListener, '__ember_listens__', 'addListener');
<add> }
<ide> }
<ide>
<ide> function applyMixin(obj, mixins, partial) {
<ide> function applyMixin(obj, mixins, partial) {
<ide>
<ide> if (desc === undefined && value === undefined) { continue; }
<ide>
<del> replaceObservers(obj, key, value);
<add> replaceObserversAndListeners(obj, key, value);
<ide> detectBinding(obj, key, value, m);
<ide> defineProperty(obj, key, desc, value, m);
<ide> }
<ide><path>packages/ember-metal/lib/utils.js
<ide> Ember.wrap = function(func, superFunc) {
<ide> superWrapper.wrappedFunction = func;
<ide> superWrapper.__ember_observes__ = func.__ember_observes__;
<ide> superWrapper.__ember_observesBefore__ = func.__ember_observesBefore__;
<add> superWrapper.__ember_listens__ = func.__ember_listens__;
<ide>
<ide> return superWrapper;
<ide> };
<ide><path>packages/ember-metal/tests/events_test.js
<ide> test('while suspended, it should not be possible to add a duplicate listener', f
<ide> equal(target.count, 2, 'should have invoked again');
<ide> equal(Ember.meta(obj).listeners['event!'].length, 1, "a duplicate listener wasn't added");
<ide> });
<add>
<add>test('a listener can be added as part of a mixin', function() {
<add> var triggered = 0;
<add> var MyMixin = Ember.Mixin.create({
<add> foo1: Ember.on('bar', function() {
<add> triggered++;
<add> }),
<add>
<add> foo2: Ember.on('bar', function() {
<add> triggered++;
<add> })
<add> });
<add>
<add> var obj = {};
<add> MyMixin.apply(obj);
<add>
<add> Ember.sendEvent(obj, 'bar');
<add> equal(triggered, 2, 'should invoke listeners');
<add>});
<add>
<add>test('a listener added as part of a mixin may be overridden', function() {
<add>
<add> var triggered = 0;
<add> var FirstMixin = Ember.Mixin.create({
<add> foo: Ember.on('bar', function() {
<add> triggered++;
<add> })
<add> });
<add> var SecondMixin = Ember.Mixin.create({
<add> foo: Ember.on('baz', function() {
<add> triggered++;
<add> })
<add> });
<add>
<add> var obj = {};
<add> FirstMixin.apply(obj);
<add> SecondMixin.apply(obj);
<add>
<add> Ember.sendEvent(obj, 'bar');
<add> equal(triggered, 0, 'should not invoke from overriden property');
<add>
<add> Ember.sendEvent(obj, 'baz');
<add> equal(triggered, 1, 'should invoke from subclass property');
<add>});
<ide><path>packages/ember-runtime/lib/ext/function.js
<ide> if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Function) {
<ide> });
<ide> ```
<ide>
<del> See `Ember.Observable.observes`.
<add> See `Ember.observes`.
<ide>
<ide> @method observes
<ide> @for Function
<ide> if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Function) {
<ide> });
<ide> ```
<ide>
<del> See `Ember.Observable.observesBefore`.
<add> See `Ember.observesBefore`.
<ide>
<ide> @method observesBefore
<ide> @for Function
<ide> if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Function) {
<ide> return this;
<ide> };
<ide>
<add> /**
<add> The `on` extension of Javascript's Function prototype is available
<add> when `Ember.EXTEND_PROTOTYPES` or `Ember.EXTEND_PROTOTYPES.Function` is
<add> true, which is the default.
<add>
<add> You can listen for events simply by adding the `on` call to the end of
<add> your method declarations in classes or mixins that you write. For example:
<add>
<add> ```javascript
<add> Ember.Mixin.create({
<add> doSomethingWithElement: function() {
<add> // Executes whenever the "didInsertElement" event fires
<add> }.on('didInsertElement')
<add> });
<add> ```
<add>
<add> See `Ember.on`.
<add>
<add> @method on
<add> @for Function
<add> */
<add> Function.prototype.on = function() {
<add> var events = a_slice.call(arguments);
<add> this.__ember_listens__ = events;
<add> return this;
<add> };
<ide> }
<ide>
<ide><path>packages/ember-runtime/lib/system/core_object.js
<ide> var set = Ember.set, get = Ember.get,
<ide> meta = Ember.meta,
<ide> rewatch = Ember.rewatch,
<ide> finishChains = Ember.finishChains,
<add> sendEvent = Ember.sendEvent,
<ide> destroy = Ember.destroy,
<ide> schedule = Ember.run.schedule,
<ide> Mixin = Ember.Mixin,
<ide> function makeCtor() {
<ide> delete m.proto;
<ide> finishChains(this);
<ide> this.init.apply(this, arguments);
<add> sendEvent(this, "didInit");
<ide> };
<ide>
<ide> Class.toString = Mixin.prototype.toString;
<ide><path>packages/ember-runtime/tests/ext/function_test.js
<ide> testBoth('global observer helper takes multiple params', function(get, set) {
<ide> equal(get(obj, 'count'), 2, 'should invoke observer after change');
<ide> });
<ide>
<add>module('Function.prototype.on() helper');
<add>
<add>testBoth('sets up an event listener, and can trigger the function on multiple events', function(get, set) {
<add>
<add> if (Ember.EXTEND_PROTOTYPES === false) {
<add> ok('Function.prototype helper disabled');
<add> return ;
<add> }
<add>
<add> var MyMixin = Ember.Mixin.create({
<add>
<add> count: 0,
<add>
<add> foo: function() {
<add> set(this, 'count', get(this, 'count')+1);
<add> }.on('bar', 'baz')
<add>
<add> });
<add>
<add> var obj = Ember.mixin({}, Ember.Evented, MyMixin);
<add> equal(get(obj, 'count'), 0, 'should not invoke listener immediately');
<add>
<add> obj.trigger('bar');
<add> obj.trigger('baz');
<add> equal(get(obj, 'count'), 2, 'should invoke listeners when events trigger');
<add>});
<add>
<add>testBoth('can be chained with observes', function(get, set) {
<add>
<add> if (Ember.EXTEND_PROTOTYPES === false) {
<add> ok('Function.prototype helper disabled');
<add> return ;
<add> }
<add>
<add> var MyMixin = Ember.Mixin.create({
<add>
<add> count: 0,
<add> bay: 'bay',
<add> foo: function() {
<add> set(this, 'count', get(this, 'count')+1);
<add> }.observes('bay').on('bar')
<add> });
<add>
<add> var obj = Ember.mixin({}, Ember.Evented, MyMixin);
<add> equal(get(obj, 'count'), 0, 'should not invoke listener immediately');
<add>
<add> set(obj, 'bay', 'BAY');
<add> obj.trigger('bar');
<add> equal(get(obj, 'count'), 2, 'should invoke observer and listener');
<add>});
<ide><path>packages/ember-runtime/tests/system/object/create_test.js
<ide> test("Calls all mixin inits if defined", function() {
<ide> equal(completed, 2, 'should have called init for both mixins.');
<ide> });
<ide>
<add>test("Triggers didInit", function() {
<add> var completed = false;
<add> var obj = Ember.Object.createWithMixins({
<add> markAsCompleted: Ember.on("didInit", function(){
<add> completed = true;
<add> })
<add> });
<add>
<add> ok(completed, 'should have triggered didInit which should have run markAsCompleted');
<add>});
<add>
<ide> test('creating an object with required properties', function() {
<ide> var ClassA = Ember.Object.extend({
<ide> foo: Ember.required() | 8 |
PHP | PHP | apply suggestions from code review | 6442fd52347759dc696c51ca1fd1bb8e766cbdfb | <ide><path>src/Controller/Component/SecurityComponent.php
<ide> protected function _validToken(Controller $controller): string
<ide> throw new AuthSecurityException(sprintf($message, '_Token.fields'));
<ide> }
<ide> if (!is_string($check['_Token']['fields'])) {
<del> throw new AuthSecurityException("'_Token.fields' was invalid.");
<add> throw new AuthSecurityException("'_Token.fields' is invalid.");
<ide> }
<ide> if (!isset($check['_Token']['unlocked'])) {
<ide> throw new AuthSecurityException(sprintf($message, '_Token.unlocked'));
<ide><path>src/Form/FormProtector.php
<ide> protected function extractToken($formData): ?string
<ide> return null;
<ide> }
<ide> if (!is_string($formData['_Token']['fields'])) {
<del> $this->debugMessage = '`_Token.fields` was invalid.';
<add> $this->debugMessage = '`_Token.fields` is invalid.';
<ide>
<ide> return null;
<ide> }
<ide><path>tests/TestCase/Controller/Component/SecurityComponentTest.php
<ide> public function testValidatePostFailArrayData()
<ide> ],
<ide> ]));
<ide> Configure::write('debug', false);
<del> $result = $this->validatePost('SecurityException', "'_Token.fields' was invalid.");
<add> $result = $this->validatePost('SecurityException', "'_Token.fields' is invalid.");
<ide> $this->assertFalse($result);
<ide> }
<ide>
<ide><path>tests/TestCase/Form/FormProtectorTest.php
<ide> public function testValidateInvalidFields(): void
<ide> 'fields' => [],
<ide> ],
<ide> ];
<del> $this->validate($data, '`_Token.fields` was invalid.');
<add> $this->validate($data, '`_Token.fields` is invalid.');
<ide> }
<ide>
<ide> /** | 4 |
Javascript | Javascript | add more tests for worker.ref()/.unref() | 6a2dde579cd228f7c951f64b5377a9e0ec56b10f | <ide><path>test/parallel/test-worker-ref-onexit.js
<add>'use strict';
<add>const common = require('../common');
<add>const { Worker } = require('worker_threads');
<add>
<add>// Check that worker.unref() makes the 'exit' event not be emitted, if it is
<add>// the only thing we would otherwise be waiting for.
<add>
<add>const w = new Worker('', { eval: true });
<add>w.unref();
<add>w.on('exit', common.mustNotCall());
<ide><path>test/parallel/test-worker-ref.js
<add>'use strict';
<add>const common = require('../common');
<add>const { Worker } = require('worker_threads');
<add>
<add>// Test that calling worker.unref() leads to 'beforeExit' being emitted, and
<add>// that we can resurrect the worker using worker.ref() from there.
<add>
<add>const w = new Worker(`
<add>const { parentPort } = require('worker_threads');
<add>parentPort.once('message', (msg) => {
<add> parentPort.postMessage(msg);
<add>});
<add>`, { eval: true });
<add>
<add>process.once('beforeExit', common.mustCall(() => {
<add> console.log('beforeExit');
<add> w.ref();
<add> w.postMessage({ hello: 'world' });
<add>}));
<add>
<add>w.once('message', common.mustCall((msg) => {
<add> console.log('message', msg);
<add>}));
<add>
<add>w.on('exit', common.mustCall(() => {
<add> console.log('exit');
<add>}));
<add>
<add>w.unref(); | 2 |
Python | Python | fix fab test | c5bc0eadc80fc95c7666826ceffbce09d0467bb9 | <ide><path>fabfile.py
<ide> def clean():
<ide> def test():
<ide> with lcd(path.dirname(__file__)):
<ide> with virtualenv(VENV_DIR) as venv_local:
<del> venv_local('py.test -x spacy/tests')
<add> venv_local('pip install pytest')
<add> venv_local('pytest -x spacy/tests') | 1 |
Javascript | Javascript | fix www redirect to include full path | 32d1a605ff01e2fe6e6292655e2e92a39e05dc0b | <ide><path>app.js
<ide> console.log(process.env.NODE_ENV);
<ide>
<ide> if (process.env.NODE_ENV === 'production') {
<ide> app.all(/.*/, function (req, res, next) {
<del> var host = req.header("host");
<add> var host = req.header('host');
<add> var originalUrl = req['originalUrl'];
<ide> if (host.match(/^www\..*/i)) {
<ide> next();
<ide> } else {
<del> res.redirect(301, "http://www." + host);
<add> res.redirect(301, "http://www." + host + originalUrl);
<ide> }
<ide> });
<ide> } | 1 |
Text | Text | add v1.2.4 changes | c98ef94706f3a1d04831a6f6874893f01c445226 | <ide><path>CHANGELOG.md
<add><a name="1.2.4"></a>
<add># 1.2.4 wormhole-blaster (2013-12-06)
<add>
<add>
<add>## Bug Fixes
<add>
<add>- **$animate:**
<add> - ensure animations work with directives that share a transclusion
<add> ([958d3d56](https://github.com/angular/angular.js/commit/958d3d56b1899a2cfc7b18c0292e5a1d8c64d0a5),
<add> [#4716](https://github.com/angular/angular.js/issues/4716), [#4871](https://github.com/angular/angular.js/issues/4871), [#5021](https://github.com/angular/angular.js/issues/5021), [#5278](https://github.com/angular/angular.js/issues/5278))
<add> - ensure ms durations are properly rounded
<add> ([93901bdd](https://github.com/angular/angular.js/commit/93901bdde4bb9f0ba114ebb33b8885808e1823e1),
<add> [#5113](https://github.com/angular/angular.js/issues/5113), [#5162](https://github.com/angular/angular.js/issues/5162))
<add>- **$compile:**
<add> - update cloned elements if the template arrives after the cloning
<add> ([b0972a2e](https://github.com/angular/angular.js/commit/b0972a2e75909e41dbac6e4413ada7df2d51df3a))
<add> - ensure the isolated local watch `lastValue` is always in sync
<add> ([2d0f6ccb](https://github.com/angular/angular.js/commit/2d0f6ccba896fe34141d6d4f59eef6fba580c5c2),
<add> [#5182](https://github.com/angular/angular.js/issues/5182))
<add>- **$rootScope:**
<add> - ensure that when the $destroy event is broadcast on $rootScope that it does something
<add> ([d802ed1b](https://github.com/angular/angular.js/commit/d802ed1b3680cfc1751777fac465b92ee29944dc),
<add> [#5169](https://github.com/angular/angular.js/issues/5169))
<add> - ensure the phase is cleared within a digest if an exception is raised by a watcher
<add> ([d3c486dd](https://github.com/angular/angular.js/commit/d3c486dd6dfa8d5dca32a3e28aa685fb7260c878))
<add>- **$sanitize:** don't rely on YARR regex engine executing immediately in order to prevent object mutation
<add> ([81b81856](https://github.com/angular/angular.js/commit/81b81856ee43d2876927c4e1f774affa87e99707),
<add> [#5193](https://github.com/angular/angular.js/issues/5193), [#5192](https://github.com/angular/angular.js/issues/5192))
<add>- **closure:** closure compiler shouldn't rename .defaults.transformRequest
<add> ([f01087f8](https://github.com/angular/angular.js/commit/f01087f802839637843115cbcf99702e09d866f6))
<add>- **input:** ensure ngModelWatch() triggers second digest pass when appropriate
<add> ([b6d54393](https://github.com/angular/angular.js/commit/b6d5439343b9801f7f2a009d0de09cba9aa21a1d),
<add> [#5258](https://github.com/angular/angular.js/issues/5258), [#5282](https://github.com/angular/angular.js/issues/5282))
<add>- **isElement:** return boolean value rather than `truthy` value.
<add> ([2dbb6f9a](https://github.com/angular/angular.js/commit/2dbb6f9a54eb5ff5847eed11c85ac4cf119eb41c),
<add> [#4519](https://github.com/angular/angular.js/issues/4519), [#4534](https://github.com/angular/angular.js/issues/4534))
<add>- **jqLite:** ignore incompatible nodes on find()
<add> ([1169b544](https://github.com/angular/angular.js/commit/1169b5445691e1495354d235a3badf05240e3904),
<add> [#4120](https://github.com/angular/angular.js/issues/4120))
<add>- **ngInit:** evaluate ngInit before ngInclude
<add> ([0e50810c](https://github.com/angular/angular.js/commit/0e50810c53428f4c1f5bfdba9599df54cb7a6c6e),
<add> [#5167](https://github.com/angular/angular.js/issues/5167), [#5208](https://github.com/angular/angular.js/issues/5208))
<add>- **ngSanitize:** prefer textContent to innerText to avoid layout trashing
<add> ([bf1972dc](https://github.com/angular/angular.js/commit/bf1972dc1e8ffbeaddfa53df1d49bc5a2177f09c))
<add>
<add>
<add>## Performance Improvements
<add>
<add>- **$parse:** micro-optimization for ensureSafeObject function
<add> ([689dfb16](https://github.com/angular/angular.js/commit/689dfb167924a61aef444ce7587fb987d8080990),
<add> [#5246](https://github.com/angular/angular.js/issues/5246))
<add>- **$resource:** Use shallow copy instead of angular.copy
<add> ([a55c1e79](https://github.com/angular/angular.js/commit/a55c1e79cf8894c2d348d4cf911b28dcc8a6995e),
<add> [#5300](https://github.com/angular/angular.js/issues/5300))
<add>- **Angular.js:** Use call and === instead of apply and == in type check functions
<add> ([785a5fd7](https://github.com/angular/angular.js/commit/785a5fd7c182f39f4ae80d603c0098bc63ce41a4),
<add> [#5295](https://github.com/angular/angular.js/issues/5295))
<add>- **Scope:** short-circuit after dirty-checking last dirty watcher
<add> ([d070450c](https://github.com/angular/angular.js/commit/d070450cd2b3b3a3aa34b69d3fa1f4cc3be025dd),
<add> [#5272](https://github.com/angular/angular.js/issues/5272), [#5287](https://github.com/angular/angular.js/issues/5287))
<add>
<add>
<add>
<ide> <a name="1.2.3"></a>
<ide> # 1.2.3 unicorn-zapper (2013-11-27)
<ide> | 1 |
PHP | PHP | fix some docblocks in ironjob | a257956a80298a0b8f533eb68bfd790ae9c3cecc | <ide><path>src/Illuminate/Queue/Jobs/IronJob.php
<ide> class IronJob extends Job {
<ide> /**
<ide> * The IronMQ message instance.
<ide> *
<del> * @var array
<add> * @var object
<ide> */
<ide> protected $job;
<ide> | 1 |
Text | Text | add tif, replace optimally=>optionally | b3e10cdaae546cef7f029b1a80dfea5e27d589d9 | <ide><path>docs/templates/preprocessing/image.md
<ide> Generate batches of tensor image data with real-time data augmentation. The data
<ide> - __batch_size__: int (default: 32).
<ide> - __shuffle__: boolean (default: True).
<ide> - __seed__: int (default: None).
<del> - __save_to_dir__: None or str (default: None). This allows you to optimally specify a directory to which to save the augmented pictures being generated (useful for visualizing what you are doing).
<add> - __save_to_dir__: None or str (default: None). This allows you to optionally specify a directory to which to save the augmented pictures being generated (useful for visualizing what you are doing).
<ide> - __save_prefix__: str (default: `''`). Prefix to use for filenames of saved pictures (only relevant if `save_to_dir` is set).
<ide> - __save_format__: one of "png", "jpeg" (only relevant if `save_to_dir` is set). Default: "png".
<ide> - __yields__: Tuples of `(x, y)` where `x` is a numpy array of image data and `y` is a numpy array of corresponding labels.
<ide> The generator loops indefinitely.
<ide> - __flow_from_directory(directory)__: Takes the path to a directory, and generates batches of augmented/normalized data. Yields batches indefinitely, in an infinite loop.
<ide> - __Arguments__:
<ide> - __directory__: path to the target directory. It should contain one subdirectory per class.
<del> Any PNG, JPG, BMP or PPM images inside each of the subdirectories directory tree will be included in the generator.
<add> Any PNG, JPG, BMP, PPM or TIF images inside each of the subdirectories directory tree will be included in the generator.
<ide> See [this script](https://gist.github.com/fchollet/0830affa1f7f19fd47b06d4cf89ed44d) for more details.
<ide> - __target_size__: tuple of integers `(height, width)`, default: `(256, 256)`.
<ide> The dimensions to which all images found will be resized.
<ide> Generate batches of tensor image data with real-time data augmentation. The data
<ide> - __batch_size__: size of the batches of data (default: 32).
<ide> - __shuffle__: whether to shuffle the data (default: True)
<ide> - __seed__: optional random seed for shuffling and transformations.
<del> - __save_to_dir__: None or str (default: None). This allows you to optimally specify a directory to which to save the augmented pictures being generated (useful for visualizing what you are doing).
<add> - __save_to_dir__: None or str (default: None). This allows you to optionally specify a directory to which to save the augmented pictures being generated (useful for visualizing what you are doing).
<ide> - __save_prefix__: str. Prefix to use for filenames of saved pictures (only relevant if `save_to_dir` is set).
<ide> - __save_format__: one of "png", "jpeg" (only relevant if `save_to_dir` is set). Default: "png".
<ide> - __follow_links__: whether to follow symlinks inside class subdirectories (default: False). | 1 |
Javascript | Javascript | utilize common.mustcall() on child exit | 95d9a58cbc13761087180c85c042b2e9cf1595e9 | <ide><path>test/parallel/test-child-process-fork-exec-argv.js
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<ide> 'use strict';
<del>require('../common');
<add>const common = require('../common');
<ide> const assert = require('assert');
<ide> const child_process = require('child_process');
<ide> const spawn = child_process.spawn;
<ide> if (process.argv[2] === 'fork') {
<ide> out += chunk;
<ide> });
<ide>
<del> child.on('exit', function() {
<add> child.on('exit', common.mustCall(function() {
<ide> assert.deepStrictEqual(JSON.parse(out), execArgv);
<del> });
<add> }));
<ide> } | 1 |
Ruby | Ruby | use a selectcore rather than a full selectmanager | 8778c82e32690ed7b25664522d0bd0324ebea840 | <ide><path>activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
<ide> def join_to_update(update, select) #:nodoc:
<ide> '__active_record_temp'
<ide> )
<ide>
<del> subselect = Arel::SelectManager.new(select.engine, subsubselect)
<del> subselect.project(Arel::Table.new('__active_record_temp')[update.ast.key.name])
<add> subselect = Arel::Nodes::SelectCore.new
<add> subselect.from = subsubselect
<add> subselect.projections << Arel::Table.new('__active_record_temp')[update.ast.key.name]
<ide>
<ide> update.where update.ast.key.in(subselect)
<ide> else
<ide><path>activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
<ide> def join_to_update(update, select) #:nodoc:
<ide> '__active_record_temp'
<ide> )
<ide>
<del> subselect = Arel::SelectManager.new(select.engine, subsubselect)
<del> subselect.project(Arel::Table.new('__active_record_temp')[update.ast.key.name])
<add> subselect = Arel::Nodes::SelectCore.new
<add> subselect.from = subsubselect
<add> subselect.projections << Arel::Table.new('__active_record_temp')[update.ast.key.name]
<ide>
<ide> update.where update.ast.key.in(subselect)
<ide> else | 2 |
Javascript | Javascript | add descriptions for valid jsdoc | c1766122c0e71f65326b6fc866be6bfa4d5087dc | <ide><path>lib/Parser.js
<ide> Parser.prototype.initializeEvaluating = function() {
<ide> });
<ide>
<ide> /**
<del> * @param {Parser} this
<del> * @param {"cooked" | "raw"} kind
<del> * @param {any[]} quasis
<del> * @param {any[]} expressions
<del> * @return {BasicEvaluatedExpression[]}
<add> * @param {string} kind "cooked" | "raw"
<add> * @param {any[]} quasis quasis
<add> * @param {any[]} expressions expressions
<add> * @return {BasicEvaluatedExpression[]} Simplified template
<ide> */
<ide> function getSimplifiedTemplateResult(kind, quasis, expressions) {
<ide> var i = 0, parts = [];
<ide><path>lib/dependencies/ContextDependencyHelpers.js
<ide> var ContextDependencyHelpers = exports;
<ide>
<ide> /**
<ide> * Escapes regular expression metacharacters
<del> * @param {string} str
<del> * @return string
<add> * @param {string} str String to quote
<add> * @return {string} Escaped string
<ide> */
<ide> function quotemeta(str) {
<ide> return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&") | 2 |
Text | Text | add 1.8.1 changelog | 4ac8fd98b302a2404a9438762d97f65e15f7a015 | <ide><path>CHANGELOG.md
<ide> # Changelog
<ide>
<add>## 1.8.1 (2015-08-12)
<add>
<add>### Distribution
<add>
<add>* Fix a bug where pushing multiple tags would result in invalid images
<add>
<ide> ## 1.8.0 (2015-08-11)
<ide>
<ide> ### Distribution | 1 |
Python | Python | fix italian tag map | 0d4bd6414e011ff16b9987cf914978e91de91085 | <ide><path>spacy/lang/it/tag_map.py
<ide> "V__VerbForm=Ger": {"pos": "VERB"},
<ide> "V__VerbForm=Inf": {"pos": "VERB"},
<ide> "X___": {"pos": "X"},
<del> "_SP": {"pos": "_SP"}
<add> "_SP": {"pos": "SPACE"}
<ide> } | 1 |
Ruby | Ruby | use github webpacker until closer to release | ecddc0468d6cacd06faaa474d11f96f41b17ac78 | <ide><path>railties/lib/rails/generators/app_base.rb
<ide> def assets_gemfile_entry
<ide> def webpacker_gemfile_entry
<ide> if options[:webpack]
<ide> comment = "Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker"
<del> GemfileEntry.new "webpacker", "~> 0.1", comment
<add> GemfileEntry.github "webpacker", "rails/webpacker", nil, comment
<ide> end
<ide> end
<ide> | 1 |
Ruby | Ruby | generate mailer views in rails api | 0146a055c001d0e48eaa5c5df8ccc8a5d15f6708 | <ide><path>railties/lib/rails/generators.rb
<ide> def self.fallbacks
<ide>
<ide> # Configure generators for API only applications. It basically hides
<ide> # everything that is usually browser related, such as assets and session
<del> # migration generators, and completely disable views, helpers and assets
<add> # migration generators, and completely disable helpers and assets
<ide> # so generators such as scaffold won't create them.
<ide> def self.api_only!
<ide> hide_namespaces "assets", "helper", "css", "js"
<ide> def self.api_only!
<ide> helper: false,
<ide> template_engine: nil
<ide> )
<add>
<add> if ARGV.first == 'mailer'
<add> options[:rails].merge!(template_engine: :erb)
<add> end
<ide> end
<ide>
<ide> # Remove the color from output.
<ide><path>railties/lib/rails/generators/rails/app/app_generator.rb
<ide> def delete_app_helpers_if_api_option
<ide> end
<ide> end
<ide>
<del> def delete_app_views_if_api_option
<add> def delete_application_layout_file_if_api_option
<ide> if options[:api]
<del> remove_dir 'app/views'
<add> remove_file 'app/views/layouts/application.html.erb'
<ide> end
<ide> end
<ide>
<ide><path>railties/test/application/generators_test.rb
<ide> def with_bare_config
<ide> assert Rails::Generators.options[:rails][:helper]
<ide> assert_equal :my_template, Rails::Generators.options[:rails][:template_engine]
<ide> end
<add>
<add> test "api only generator generate mailer views" do
<add> add_to_config <<-RUBY
<add> config.api_only = true
<add> RUBY
<add>
<add> FileUtils.cd(rails_root){ `bin/rails generate mailer notifier foo` }
<add> assert File.exist?(File.join(rails_root, "app/views/notifier_mailer/foo.text.erb"))
<add> assert File.exist?(File.join(rails_root, "app/views/notifier_mailer/foo.html.erb"))
<add> end
<ide> end
<ide> end
<ide><path>railties/test/generators/api_app_generator_test.rb
<ide> def default_files
<ide> app/controllers
<ide> app/mailers
<ide> app/models
<add> app/views/layouts/mailer.html.erb
<add> app/views/layouts/mailer.text.erb
<ide> config/environments
<ide> config/initializers
<ide> config/locales
<ide> def default_files
<ide> def skipped_files
<ide> %w(app/assets
<ide> app/helpers
<del> app/views
<add> app/views/layouts/application.html.erb
<ide> config/initializers/assets.rb
<ide> config/initializers/cookies_serializer.rb
<ide> config/initializers/session_store.rb | 4 |
Javascript | Javascript | convert the secondary toolbar to a class | f4ae277355ac20960cbc124263ac312bbc273556 | <ide><path>web/app.js
<ide> var PDFViewerApplication = {
<ide> this.pdfDocumentProperties =
<ide> new PDFDocumentProperties(appConfig.documentProperties);
<ide>
<del> SecondaryToolbar.initialize(appConfig.secondaryToolbar, eventBus);
<del> this.secondaryToolbar = SecondaryToolbar;
<add> this.secondaryToolbar =
<add> new SecondaryToolbar(appConfig.secondaryToolbar, eventBus);
<ide>
<ide> if (this.supportsFullscreen) {
<ide> this.pdfPresentationMode = new PDFPresentationMode({
<ide> function webViewerInitialized() {
<ide>
<ide> if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
<ide> appConfig.toolbar.openFile.setAttribute('hidden', 'true');
<del> appConfig.secondaryToolbar.openFile.setAttribute('hidden', 'true');
<add> appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true');
<ide> } else {
<ide> fileInput.value = null;
<ide> }
<ide>
<ide> //#else
<ide> //appConfig.toolbar.openFile.setAttribute('hidden', 'true');
<del>//appConfig.secondaryToolbar.openFile.setAttribute('hidden', 'true');
<add>//appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true');
<ide> //#endif
<ide>
<ide> var PDFJS = pdfjsLib.PDFJS;
<ide> function webViewerInitialized() {
<ide>
<ide> if (!PDFViewerApplication.supportsPrinting) {
<ide> appConfig.toolbar.print.classList.add('hidden');
<del> appConfig.secondaryToolbar.print.classList.add('hidden');
<add> appConfig.secondaryToolbar.printButton.classList.add('hidden');
<ide> }
<ide>
<ide> if (!PDFViewerApplication.supportsFullscreen) {
<ide> function webViewerUpdateViewarea(e) {
<ide> var href =
<ide> PDFViewerApplication.pdfLinkService.getAnchorUrl(location.pdfOpenParams);
<ide> PDFViewerApplication.appConfig.toolbar.viewBookmark.href = href;
<del> PDFViewerApplication.appConfig.secondaryToolbar.viewBookmark.href = href;
<add> PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href =
<add> href;
<ide>
<ide> // Update the current bookmark in the browsing history.
<ide> PDFViewerApplication.pdfHistory.updateCurrentBookmark(location.pdfOpenParams,
<ide> function webViewerResize() {
<ide> }
<ide>
<ide> // Set the 'max-height' CSS property of the secondary toolbar.
<del> SecondaryToolbar.setMaxHeight(PDFViewerApplication.appConfig.mainContainer);
<add> var mainContainer = PDFViewerApplication.appConfig.mainContainer;
<add> PDFViewerApplication.secondaryToolbar.setMaxHeight(mainContainer);
<ide> }
<ide>
<ide> window.addEventListener('hashchange', function webViewerHashchange(evt) {
<ide> function webViewerFileInputChange(e) {
<ide> // URL does not reflect proper document location - hiding some icons.
<ide> var appConfig = PDFViewerApplication.appConfig;
<ide> appConfig.toolbar.viewBookmark.setAttribute('hidden', 'true');
<del> appConfig.secondaryToolbar.viewBookmark.setAttribute('hidden', 'true');
<add> appConfig.secondaryToolbar.viewBookmarkButton.setAttribute('hidden', 'true');
<ide> appConfig.toolbar.download.setAttribute('hidden', 'true');
<del> appConfig.secondaryToolbar.download.setAttribute('hidden', 'true');
<add> appConfig.secondaryToolbar.downloadButton.setAttribute('hidden', 'true');
<ide> }
<ide> //#endif
<ide>
<ide> function webViewerLocalized() {
<ide> }
<ide>
<ide> // Set the 'max-height' CSS property of the secondary toolbar.
<del> SecondaryToolbar.setMaxHeight(PDFViewerApplication.appConfig.mainContainer);
<add> var mainContainer = PDFViewerApplication.appConfig.mainContainer;
<add> PDFViewerApplication.secondaryToolbar.setMaxHeight(mainContainer);
<ide> });
<ide> }
<ide>
<ide> window.addEventListener('DOMMouseScroll', handleMouseWheel);
<ide> window.addEventListener('mousewheel', handleMouseWheel);
<ide>
<ide> window.addEventListener('click', function click(evt) {
<del> if (!SecondaryToolbar.opened) {
<add> if (!PDFViewerApplication.secondaryToolbar.isOpen) {
<ide> return;
<ide> }
<ide> var appConfig = PDFViewerApplication.appConfig;
<ide> if (PDFViewerApplication.pdfViewer.containsElement(evt.target) ||
<ide> (appConfig.toolbar.container.contains(evt.target) &&
<ide> evt.target !== appConfig.secondaryToolbar.toggleButton)) {
<del> SecondaryToolbar.close();
<add> PDFViewerApplication.secondaryToolbar.close();
<ide> }
<ide> }, true);
<ide>
<ide> window.addEventListener('keydown', function keydown(evt) {
<ide> handled = true;
<ide> break;
<ide> case 27: // esc key
<del> if (SecondaryToolbar.opened) {
<del> SecondaryToolbar.close();
<add> if (PDFViewerApplication.secondaryToolbar.isOpen) {
<add> PDFViewerApplication.secondaryToolbar.close();
<ide> handled = true;
<ide> }
<ide> if (!PDFViewerApplication.supportsIntegratedFind &&
<ide><path>web/secondary_toolbar.js
<ide> var SCROLLBAR_PADDING = uiUtils.SCROLLBAR_PADDING;
<ide> var mozL10n = uiUtils.mozL10n;
<ide>
<del>var SecondaryToolbar = {
<del> opened: false,
<del> previousContainerHeight: null,
<del> newContainerHeight: null,
<add>/**
<add> * @typedef {Object} SecondaryToolbarOptions
<add> * @property {HTMLDivElement} toolbar - Container for the secondary toolbar.
<add> * @property {HTMLButtonElement} toggleButton - Button to toggle the visibility
<add> * of the secondary toolbar.
<add> * @property {HTMLButtonElement} presentationModeButton - Button for entering
<add> * presentation mode.
<add> * @property {HTMLButtonElement} openFileButton - Button to open a file.
<add> * @property {HTMLButtonElement} printButton - Button to print the document.
<add> * @property {HTMLButtonElement} downloadButton - Button to download the
<add> * document.
<add> * @property {HTMLLinkElement} viewBookmarkButton - Button to obtain a bookmark
<add> * link to the current location in the document.
<add> * @property {HTMLButtonElement} firstPageButton - Button to go to the first
<add> * page in the document.
<add> * @property {HTMLButtonElement} lastPageButton - Button to go to the last page
<add> * in the document.
<add> * @property {HTMLButtonElement} pageRotateCwButton - Button to rotate the pages
<add> * clockwise.
<add> * @property {HTMLButtonElement} pageRotateCcwButton - Button to rotate the
<add> * pages counterclockwise.
<add> * @property {HTMLButtonElement} toggleHandToolButton - Button to toggle the
<add> * hand tool.
<add> * @property {HTMLButtonElement} documentPropertiesButton - Button for opening
<add> * the document properties dialog.
<add> */
<ide>
<del> initialize: function secondaryToolbarInitialize(options, eventBus) {
<del> this.eventBus = eventBus;
<add>/**
<add> * @class
<add> */
<add>var SecondaryToolbar = (function SecondaryToolbarClosure() {
<add> /**
<add> * @constructs SecondaryToolbar
<add> * @param {SecondaryToolbarOptions} options
<add> * @param {EventBus} eventBus
<add> */
<add> function SecondaryToolbar(options, eventBus) {
<ide> this.toolbar = options.toolbar;
<del> this.buttonContainer = this.toolbar.firstElementChild;
<del>
<del> // Define the toolbar buttons.
<ide> this.toggleButton = options.toggleButton;
<del> this.presentationModeButton = options.presentationModeButton;
<del> this.openFile = options.openFile;
<del> this.print = options.print;
<del> this.download = options.download;
<del> this.viewBookmark = options.viewBookmark;
<del> this.firstPage = options.firstPage;
<del> this.lastPage = options.lastPage;
<del> this.pageRotateCw = options.pageRotateCw;
<del> this.pageRotateCcw = options.pageRotateCcw;
<del> this.toggleHandTool = options.toggleHandTool;
<del> this.documentPropertiesButton = options.documentPropertiesButton;
<del>
<del> // Attach the event listeners.
<del> var elements = [
<del> // Button to toggle the visibility of the secondary toolbar:
<del> { element: this.toggleButton, handler: this.toggle },
<del> // All items within the secondary toolbar
<del> { element: this.presentationModeButton,
<del> handler: this.presentationModeClick },
<del> { element: this.openFile, handler: this.openFileClick },
<del> { element: this.print, handler: this.printClick },
<del> { element: this.download, handler: this.downloadClick },
<del> { element: this.viewBookmark, handler: this.viewBookmarkClick },
<del> { element: this.firstPage, handler: this.firstPageClick },
<del> { element: this.lastPage, handler: this.lastPageClick },
<del> { element: this.pageRotateCw, handler: this.pageRotateCwClick },
<del> { element: this.pageRotateCcw, handler: this.pageRotateCcwClick },
<del> { element: this.toggleHandTool, handler: this.toggleHandToolClick },
<del> { element: this.documentPropertiesButton,
<del> handler: this.documentPropertiesClick }
<add> this.buttons = [
<add> { element: options.presentationModeButton, eventName: 'presentationmode',
<add> close: true },
<add> { element: options.openFileButton, eventName: 'openfile', close: true },
<add> { element: options.printButton, eventName: 'print', close: true },
<add> { element: options.downloadButton, eventName: 'download', close: true },
<add> { element: options.viewBookmarkButton, eventName: null, close: true },
<add> { element: options.firstPageButton, eventName: 'firstpage', close: true },
<add> { element: options.lastPageButton, eventName: 'lastpage', close: true },
<add> { element: options.pageRotateCwButton, eventName: 'rotatecw',
<add> close: false },
<add> { element: options.pageRotateCcwButton, eventName: 'rotateccw',
<add> close: false },
<add> { element: options.toggleHandToolButton, eventName: 'togglehandtool',
<add> close: true },
<add> { element: options.documentPropertiesButton,
<add> eventName: 'documentproperties', close: true }
<ide> ];
<ide>
<del> for (var item in elements) {
<del> var element = elements[item].element;
<del> if (element) {
<del> element.addEventListener('click', elements[item].handler.bind(this));
<add> this.eventBus = eventBus;
<add>
<add> this.opened = false;
<add> this.previousContainerHeight = null;
<add> this.newContainerHeight = null;
<add> this.buttonContainer = this.toolbar.firstElementChild;
<add>
<add> // Bind the event listeners for click and hand tool actions.
<add> this._bindClickListeners();
<add> this._bindHandToolListener(options.toggleHandToolButton);
<add> }
<add>
<add> SecondaryToolbar.prototype = {
<add> /**
<add> * @return {boolean}
<add> */
<add> get isOpen() {
<add> return this.opened;
<add> },
<add>
<add> _bindClickListeners: function SecondaryToolbar_bindClickListeners() {
<add> // Button to toggle the visibility of the secondary toolbar.
<add> this.toggleButton.addEventListener('click', this.toggle.bind(this));
<add>
<add> // All items within the secondary toolbar.
<add> for (var button in this.buttons) {
<add> var element = this.buttons[button].element;
<add> var eventName = this.buttons[button].eventName;
<add> var close = this.buttons[button].close;
<add>
<add> element.addEventListener('click', function (eventName, close) {
<add> if (eventName !== null) {
<add> this.eventBus.dispatch(eventName);
<add> }
<add> if (close) {
<add> this.close();
<add> }
<add> }.bind(this, eventName, close));
<ide> }
<del> }
<add> },
<add>
<add> _bindHandToolListener:
<add> function SecondaryToolbar_bindHandToolListener(toggleHandToolButton) {
<add> var isHandToolActive = false;
<add> this.eventBus.on('handtoolchanged', function (e) {
<add> if (isHandToolActive === e.isActive) {
<add> return;
<add> }
<add> isHandToolActive = e.isActive;
<add> if (isHandToolActive) {
<add> toggleHandToolButton.title =
<add> mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool');
<add> toggleHandToolButton.firstElementChild.textContent =
<add> mozL10n.get('hand_tool_disable_label', null, 'Disable hand tool');
<add> } else {
<add> toggleHandToolButton.title =
<add> mozL10n.get('hand_tool_enable.title', null, 'Enable hand tool');
<add> toggleHandToolButton.firstElementChild.textContent =
<add> mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool');
<add> }
<add> }.bind(this));
<add> },
<add>
<add> open: function SecondaryToolbar_open() {
<add> if (this.opened) {
<add> return;
<add> }
<add> this.opened = true;
<add> this.toggleButton.classList.add('toggled');
<add> this.toolbar.classList.remove('hidden');
<add> },
<ide>
<del> // Tracking hand tool menu item changes.
<del> var isHandToolActive = false;
<del> this.eventBus.on('handtoolchanged', function (e) {
<del> if (isHandToolActive === e.isActive) {
<add> close: function SecondaryToolbar_close() {
<add> if (!this.opened) {
<ide> return;
<ide> }
<del> isHandToolActive = e.isActive;
<del> if (isHandToolActive) {
<del> this.toggleHandTool.title =
<del> mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool');
<del> this.toggleHandTool.firstElementChild.textContent =
<del> mozL10n.get('hand_tool_disable_label', null, 'Disable hand tool');
<add> this.opened = false;
<add> this.toolbar.classList.add('hidden');
<add> this.toggleButton.classList.remove('toggled');
<add> },
<add>
<add> toggle: function SecondaryToolbar_toggle() {
<add> if (this.opened) {
<add> this.close();
<ide> } else {
<del> this.toggleHandTool.title =
<del> mozL10n.get('hand_tool_enable.title', null, 'Enable hand tool');
<del> this.toggleHandTool.firstElementChild.textContent =
<del> mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool');
<add> this.open();
<ide> }
<del> }.bind(this));
<del> },
<del>
<del> // Event handling functions.
<del> presentationModeClick: function secondaryToolbarPresentationModeClick(evt) {
<del> this.eventBus.dispatch('presentationmode');
<del> this.close();
<del> },
<del>
<del> openFileClick: function secondaryToolbarOpenFileClick(evt) {
<del> this.eventBus.dispatch('openfile');
<del> this.close();
<del> },
<del>
<del> printClick: function secondaryToolbarPrintClick(evt) {
<del> this.eventBus.dispatch('print');
<del> this.close();
<del> },
<del>
<del> downloadClick: function secondaryToolbarDownloadClick(evt) {
<del> this.eventBus.dispatch('download');
<del> this.close();
<del> },
<del>
<del> viewBookmarkClick: function secondaryToolbarViewBookmarkClick(evt) {
<del> this.close();
<del> },
<del>
<del> firstPageClick: function secondaryToolbarFirstPageClick(evt) {
<del> this.eventBus.dispatch('firstpage');
<del> this.close();
<del> },
<del>
<del> lastPageClick: function secondaryToolbarLastPageClick(evt) {
<del> this.eventBus.dispatch('lastpage');
<del> this.close();
<del> },
<del>
<del> pageRotateCwClick: function secondaryToolbarPageRotateCwClick(evt) {
<del> this.eventBus.dispatch('rotatecw');
<del> },
<del>
<del> pageRotateCcwClick: function secondaryToolbarPageRotateCcwClick(evt) {
<del> this.eventBus.dispatch('rotateccw');
<del> },
<del>
<del> toggleHandToolClick: function secondaryToolbarToggleHandToolClick(evt) {
<del> this.eventBus.dispatch('togglehandtool');
<del> this.close();
<del> },
<del>
<del> documentPropertiesClick: function secondaryToolbarDocumentPropsClick(evt) {
<del> this.eventBus.dispatch('documentproperties');
<del> this.close();
<del> },
<del>
<del> // Misc. functions for interacting with the toolbar.
<del> setMaxHeight: function secondaryToolbarSetMaxHeight(container) {
<del> if (!container || !this.buttonContainer) {
<del> return;
<del> }
<del> this.newContainerHeight = container.clientHeight;
<del> if (this.previousContainerHeight === this.newContainerHeight) {
<del> return;
<del> }
<del> this.buttonContainer.setAttribute('style',
<del> 'max-height: ' + (this.newContainerHeight - SCROLLBAR_PADDING) + 'px;');
<del> this.previousContainerHeight = this.newContainerHeight;
<del> },
<del>
<del> open: function secondaryToolbarOpen() {
<del> if (this.opened) {
<del> return;
<del> }
<del> this.opened = true;
<del> this.toggleButton.classList.add('toggled');
<del> this.toolbar.classList.remove('hidden');
<del> },
<del>
<del> close: function secondaryToolbarClose(target) {
<del> if (!this.opened) {
<del> return;
<del> } else if (target && !this.toolbar.contains(target)) {
<del> return;
<del> }
<del> this.opened = false;
<del> this.toolbar.classList.add('hidden');
<del> this.toggleButton.classList.remove('toggled');
<del> },
<del>
<del> toggle: function secondaryToolbarToggle() {
<del> if (this.opened) {
<del> this.close();
<del> } else {
<del> this.open();
<add> },
<add>
<add> setMaxHeight: function SecondaryToolbar_setMaxHeight(container) {
<add> if (!container || !this.buttonContainer) {
<add> return;
<add> }
<add> this.newContainerHeight = container.clientHeight;
<add> if (this.previousContainerHeight === this.newContainerHeight) {
<add> return;
<add> }
<add> var maxHeight = this.newContainerHeight - SCROLLBAR_PADDING;
<add> this.buttonContainer.setAttribute('style',
<add> 'max-height: ' + maxHeight + 'px;');
<add> this.previousContainerHeight = this.newContainerHeight;
<ide> }
<del> }
<del>};
<add> };
<add>
<add> return SecondaryToolbar;
<add>})();
<ide>
<ide> exports.SecondaryToolbar = SecondaryToolbar;
<ide> }));
<ide><path>web/viewer.js
<ide> function getViewerConfiguration() {
<ide> toggleButton: document.getElementById('secondaryToolbarToggle'),
<ide> presentationModeButton:
<ide> document.getElementById('secondaryPresentationMode'),
<del> openFile: document.getElementById('secondaryOpenFile'),
<del> print: document.getElementById('secondaryPrint'),
<del> download: document.getElementById('secondaryDownload'),
<del> viewBookmark: document.getElementById('secondaryViewBookmark'),
<del> firstPage: document.getElementById('firstPage'),
<del> lastPage: document.getElementById('lastPage'),
<del> pageRotateCw: document.getElementById('pageRotateCw'),
<del> pageRotateCcw: document.getElementById('pageRotateCcw'),
<add> openFileButton: document.getElementById('secondaryOpenFile'),
<add> printButton: document.getElementById('secondaryPrint'),
<add> downloadButton: document.getElementById('secondaryDownload'),
<add> viewBookmarkButton: document.getElementById('secondaryViewBookmark'),
<add> firstPageButton: document.getElementById('firstPage'),
<add> lastPageButton: document.getElementById('lastPage'),
<add> pageRotateCwButton: document.getElementById('pageRotateCw'),
<add> pageRotateCcwButton: document.getElementById('pageRotateCcw'),
<add> toggleHandToolButton: document.getElementById('toggleHandTool'),
<ide> documentPropertiesButton: document.getElementById('documentProperties'),
<del> toggleHandTool: document.getElementById('toggleHandTool'),
<ide> },
<ide> fullscreen: {
<ide> contextFirstPage: document.getElementById('contextFirstPage'), | 3 |
Javascript | Javascript | remove jankiness test | 496a67c10ef0554735bee31a2ca83852f81a1048 | <ide><path>test/ng/directive/ngModelSpec.js
<ide> describe('ngModel', function() {
<ide> }));
<ide>
<ide>
<del> it('should minimize janky setting of classes during $validate() and ngModelWatch', inject(function($animate, $compile, $rootScope) {
<del> var addClass = $animate.addClass;
<del> var removeClass = $animate.removeClass;
<del> var addClassCallCount = 0;
<del> var removeClassCallCount = 0;
<del> var input;
<del> $animate.addClass = function(element, className) {
<del> if (input && element[0] === input[0]) ++addClassCallCount;
<del> return addClass.call($animate, element, className);
<del> };
<del>
<del> $animate.removeClass = function(element, className) {
<del> if (input && element[0] === input[0]) ++removeClassCallCount;
<del> return removeClass.call($animate, element, className);
<del> };
<del>
<del> dealoc(element);
<del>
<del> $rootScope.value = "123456789";
<del> element = $compile(
<del> '<form name="form">' +
<del> '<input type="text" ng-model="value" name="alias" ng-maxlength="10">' +
<del> '</form>'
<del> )($rootScope);
<del>
<del> var form = $rootScope.form;
<del> input = element.children().eq(0);
<del>
<del> $rootScope.$digest();
<del>
<del> expect(input).toBeValid();
<del> expect(input).not.toHaveClass('ng-invalid-maxlength');
<del> expect(input).toHaveClass('ng-valid-maxlength');
<del> expect(addClassCallCount).toBe(1);
<del> expect(removeClassCallCount).toBe(0);
<del>
<del> dealoc(element);
<del> }));
<del>
<del>
<ide> it('should always use the most recent $viewValue for validation', function() {
<ide> ctrl.$parsers.push(function(value) {
<ide> if (value && value.substr(-1) === 'b') { | 1 |
Javascript | Javascript | show error 404 without partial failing | e81ae1464dd1d12080c89ed6c7567395ed712f9a | <ide><path>docs/app/e2e/app.scenario.js
<ide> describe('docs.angularjs.org', function () {
<ide> expect(element(by.css('.minerr-errmsg')).getText()).toEqual("Argument 'Missing' is not a function, got undefined");
<ide> });
<ide>
<add> it("should display an error if the page does not exist", function() {
<add> browser.get('index-debug.html#!/api/does/not/exist');
<add> expect(element(by.css('h1')).getText()).toBe('Oops!');
<add> });
<ide>
<ide> });
<ide>
<del>});
<del>
<del>describe('Error Handling', function() {
<del> it("should display an error if the page does not exist", function() {
<del> browser.get('index-debug.html#!/api/does/not/exist');
<del> expect(element(by.css('h1')).getText()).toBe('Oops!');
<del> });
<ide> });
<ide>\ No newline at end of file
<ide><path>docs/app/src/docs.js
<ide> angular.module('DocsController', [])
<ide> $window._gaq.push(['_trackPageview', pagePath]);
<ide> });
<ide>
<del> $scope.$on('$includeContentError', function() {
<del> $scope.partialPath = 'Error404.html';
<del> });
<del>
<del>
<ide> $scope.$watch(function docsPathWatch() {return $location.path(); }, function docsPathWatchAction(path) {
<ide>
<ide> path = path.replace(/^\/?(.+?)(\/index)?\/?$/, '$1');
<ide>
<del> $scope.partialPath = 'partials/' + path + '.html';
<del>
<ide> currentPage = $scope.currentPage = NG_PAGES[path];
<ide>
<ide> if ( currentPage ) {
<add> $scope.partialPath = 'partials/' + path + '.html';
<ide> $scope.currentArea = NG_NAVIGATION[currentPage.area];
<ide> var pathParts = currentPage.path.split('/');
<ide> var breadcrumb = $scope.breadcrumb = [];
<ide> angular.module('DocsController', [])
<ide> } else {
<ide> $scope.currentArea = NG_NAVIGATION['api'];
<ide> $scope.breadcrumb = [];
<add> $scope.partialPath = 'Error404.html';
<ide> }
<ide> });
<ide> | 2 |
Javascript | Javascript | fix documentation for ?^ controller search | 39f6e229c229db9fbd107d98f453b6daeb6c9f9d | <ide><path>src/ng/compile.js
<ide> * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.
<ide> * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
<ide> * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.
<del> * * `?^` - Attempt to locate the required controller by searching the element and its parents parents or pass
<add> * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass
<ide> * `null` to the `link` fn if not found.
<ide> *
<ide> * | 1 |
Go | Go | add put() to graphdriver api and use it | bcaf6c2359d83acd5da54f499e21f4a148f491c5 | <ide><path>container.go
<ide> func (container *Container) Inject(file io.Reader, pth string) error {
<ide> if err := container.EnsureMounted(); err != nil {
<ide> return fmt.Errorf("inject: error mounting container %s: %s", container.ID, err)
<ide> }
<add> defer container.Unmount()
<ide>
<ide> // Return error if path exists
<ide> destPath := path.Join(container.RootfsPath(), pth)
<ide> func (container *Container) ExportRw() (archive.Archive, error) {
<ide> if container.runtime == nil {
<ide> return nil, fmt.Errorf("Can't load storage driver for unregistered container %s", container.ID)
<ide> }
<add> defer container.Unmount()
<ide>
<ide> return container.runtime.Diff(container)
<ide> }
<ide> func (container *Container) Export() (archive.Archive, error) {
<ide> if err := container.EnsureMounted(); err != nil {
<ide> return nil, err
<ide> }
<del> return archive.Tar(container.RootfsPath(), archive.Uncompressed)
<add>
<add> archive, err := archive.Tar(container.RootfsPath(), archive.Uncompressed)
<add> if err != nil {
<add> return nil, err
<add> }
<add> return EofReader(archive, func() { container.Unmount() }), nil
<ide> }
<ide>
<ide> func (container *Container) WaitTimeout(timeout time.Duration) error {
<ide> func (container *Container) GetSize() (int64, int64) {
<ide> utils.Errorf("Warning: failed to compute size of container rootfs %s: %s", container.ID, err)
<ide> return sizeRw, sizeRootfs
<ide> }
<add> defer container.Unmount()
<ide>
<ide> if differ, ok := container.runtime.driver.(graphdriver.Differ); ok {
<ide> sizeRw, err = differ.DiffSize(container.ID)
<ide> func (container *Container) Copy(resource string) (archive.Archive, error) {
<ide> basePath := path.Join(container.RootfsPath(), resource)
<ide> stat, err := os.Stat(basePath)
<ide> if err != nil {
<add> container.Unmount()
<ide> return nil, err
<ide> }
<ide> if !stat.IsDir() {
<ide> func (container *Container) Copy(resource string) (archive.Archive, error) {
<ide> filter = []string{path.Base(basePath)}
<ide> basePath = path.Dir(basePath)
<ide> }
<del> return archive.TarFilter(basePath, &archive.TarOptions{
<add>
<add> archive, err := archive.TarFilter(basePath, &archive.TarOptions{
<ide> Compression: archive.Uncompressed,
<ide> Includes: filter,
<ide> Recursive: true,
<ide> })
<add> if err != nil {
<add> return nil, err
<add> }
<add> return EofReader(archive, func() { container.Unmount() }), nil
<ide> }
<ide>
<ide> // Returns true if the container exposes a certain port
<ide><path>graph.go
<ide> func (graph *Graph) Get(name string) (*Image, error) {
<ide> if err != nil {
<ide> return nil, fmt.Errorf("Driver %s failed to get image rootfs %s: %s", graph.driver, img.ID, err)
<ide> }
<add> defer graph.driver.Put(img.ID)
<ide>
<ide> var size int64
<ide> if img.Parent == "" {
<ide> func (graph *Graph) Register(jsonData []byte, layerData archive.Archive, img *Im
<ide> if err != nil {
<ide> return fmt.Errorf("Driver %s failed to get image rootfs %s: %s", graph.driver, img.ID, err)
<ide> }
<add> defer graph.driver.Put(img.ID)
<ide> img.graph = graph
<ide> if err := StoreImage(img, jsonData, layerData, tmp, rootfs); err != nil {
<ide> return err
<ide><path>graphdriver/aufs/aufs.go
<ide> func (a *Driver) Get(id string) (string, error) {
<ide> return out, nil
<ide> }
<ide>
<add>func (a *Driver) Put(id string) {
<add>}
<add>
<ide> // Returns an archive of the contents for the id
<ide> func (a *Driver) Diff(id string) (archive.Archive, error) {
<ide> return archive.TarFilter(path.Join(a.rootPath(), "diff", id), &archive.TarOptions{
<ide><path>graphdriver/devmapper/driver.go
<ide> func (d *Driver) Get(id string) (string, error) {
<ide> return path.Join(mp, "rootfs"), nil
<ide> }
<ide>
<add>func (d *Driver) Put(id string) {
<add>}
<add>
<ide> func (d *Driver) mount(id, mountPoint string) error {
<ide> // Create the target directories if they don't exist
<ide> if err := osMkdirAll(mountPoint, 0755); err != nil && !osIsExist(err) {
<ide><path>graphdriver/driver.go
<ide> type Driver interface {
<ide> Remove(id string) error
<ide>
<ide> Get(id string) (dir string, err error)
<add> Put(id string)
<ide> Exists(id string) bool
<ide>
<ide> Status() [][2]string
<ide><path>graphdriver/vfs/driver.go
<ide> func (d *Driver) Get(id string) (string, error) {
<ide> return dir, nil
<ide> }
<ide>
<add>func (d *Driver) Put(id string) {
<add> // The vfs driver has no runtime resources (e.g. mounts)
<add> // to clean up, so we don't need anything here
<add>}
<add>
<ide> func (d *Driver) Exists(id string) bool {
<ide> _, err := os.Stat(d.dir(id))
<ide> return err == nil
<ide><path>image.go
<ide> func StoreImage(img *Image, jsonData []byte, layerData archive.Archive, root, la
<ide> if err != nil {
<ide> return err
<ide> }
<add> defer driver.Put(img.Parent)
<ide> changes, err := archive.ChangesDirs(layer, parent)
<ide> if err != nil {
<ide> return err
<ide> func jsonPath(root string) string {
<ide> }
<ide>
<ide> // TarLayer returns a tar archive of the image's filesystem layer.
<del>func (img *Image) TarLayer() (archive.Archive, error) {
<add>func (img *Image) TarLayer() (arch archive.Archive, err error) {
<ide> if img.graph == nil {
<ide> return nil, fmt.Errorf("Can't load storage driver for unregistered image %s", img.ID)
<ide> }
<ide> func (img *Image) TarLayer() (archive.Archive, error) {
<ide> if err != nil {
<ide> return nil, err
<ide> }
<del> if img.Parent == "" {
<del> return archive.Tar(imgFs, archive.Uncompressed)
<del> } else {
<del> parentFs, err := driver.Get(img.Parent)
<del> if err != nil {
<del> return nil, err
<add>
<add> defer func() {
<add> if err == nil {
<add> driver.Put(img.ID)
<ide> }
<del> changes, err := archive.ChangesDirs(imgFs, parentFs)
<add> }()
<add>
<add> if img.Parent == "" {
<add> archive, err := archive.Tar(imgFs, archive.Uncompressed)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<del> return archive.ExportChanges(imgFs, changes)
<add> return EofReader(archive, func() { driver.Put(img.ID) }), nil
<add> }
<add>
<add> parentFs, err := driver.Get(img.Parent)
<add> if err != nil {
<add> return nil, err
<add> }
<add> defer driver.Put(img.Parent)
<add> changes, err := archive.ChangesDirs(imgFs, parentFs)
<add> if err != nil {
<add> return nil, err
<add> }
<add> archive, err := archive.ExportChanges(imgFs, changes)
<add> if err != nil {
<add> return nil, err
<ide> }
<add> return EofReader(archive, func() { driver.Put(img.ID) }), nil
<ide> }
<ide>
<ide> func ValidateID(id string) error {
<ide><path>integration/utils_test.go
<ide> func containerFileExists(eng *engine.Engine, id, dir string, t utils.Fataler) bo
<ide> if err := c.EnsureMounted(); err != nil {
<ide> t.Fatal(err)
<ide> }
<add> defer c.Unmount()
<ide> if _, err := os.Stat(path.Join(c.RootfsPath(), dir)); err != nil {
<ide> if os.IsNotExist(err) {
<ide> return false
<ide><path>runtime.go
<ide> func (runtime *Runtime) Register(container *Container) error {
<ide> if err != nil {
<ide> return fmt.Errorf("Error getting container filesystem %s from driver %s: %s", container.ID, runtime.driver, err)
<ide> }
<add> defer runtime.driver.Put(container.ID)
<ide> container.rootfs = rootfs
<ide>
<ide> container.runtime = runtime
<ide> func (runtime *Runtime) Create(config *Config, name string) (*Container, []strin
<ide> if err != nil {
<ide> return nil, nil, err
<ide> }
<add> defer runtime.driver.Put(initID)
<add>
<ide> if err := setupInitLayer(initPath); err != nil {
<ide> return nil, nil, err
<ide> }
<ide> func (runtime *Runtime) Commit(container *Container, repository, tag, comment, a
<ide> if err := container.EnsureMounted(); err != nil {
<ide> return nil, err
<ide> }
<add> defer container.Unmount()
<ide>
<ide> rwTar, err := container.ExportRw()
<ide> if err != nil {
<ide> func (runtime *Runtime) Mount(container *Container) error {
<ide> }
<ide>
<ide> func (runtime *Runtime) Unmount(container *Container) error {
<del> // FIXME: Unmount is deprecated because drivers are responsible for mounting
<del> // and unmounting when necessary. Use driver.Remove() instead.
<add> runtime.driver.Put(container.ID)
<ide> return nil
<ide> }
<ide>
<ide> func (runtime *Runtime) Changes(container *Container) ([]archive.Change, error)
<ide> if err != nil {
<ide> return nil, fmt.Errorf("Error getting container rootfs %s from driver %s: %s", container.ID, container.runtime.driver, err)
<ide> }
<add> defer runtime.driver.Put(container.ID)
<ide> initDir, err := runtime.driver.Get(container.ID + "-init")
<ide> if err != nil {
<ide> return nil, fmt.Errorf("Error getting container init rootfs %s from driver %s: %s", container.ID, container.runtime.driver, err)
<ide> }
<add> defer runtime.driver.Put(container.ID + "-init")
<ide> return archive.ChangesDirs(cDir, initDir)
<ide> }
<ide>
<ide> func (runtime *Runtime) Diff(container *Container) (archive.Archive, error) {
<ide> return nil, fmt.Errorf("Error getting container rootfs %s from driver %s: %s", container.ID, container.runtime.driver, err)
<ide> }
<ide>
<del> return archive.ExportChanges(cDir, changes)
<add> archive, err := archive.ExportChanges(cDir, changes)
<add> if err != nil {
<add> return nil, err
<add> }
<add> return EofReader(archive, func() { runtime.driver.Put(container.ID) }), nil
<ide> }
<ide>
<ide> func (runtime *Runtime) Run(c *Container, startCallback execdriver.StartCallback) (int, error) {
<ide><path>utils.go
<ide> import (
<ide> "github.com/dotcloud/docker/archive"
<ide> "github.com/dotcloud/docker/pkg/namesgenerator"
<ide> "github.com/dotcloud/docker/utils"
<add> "io"
<ide> "strconv"
<ide> "strings"
<add> "sync/atomic"
<ide> )
<ide>
<ide> type Change struct {
<ide> func (c *checker) Exists(name string) bool {
<ide> func generateRandomName(runtime *Runtime) (string, error) {
<ide> return namesgenerator.GenerateRandomName(&checker{runtime})
<ide> }
<add>
<add>// Read an io.Reader and call a function when it returns EOF
<add>func EofReader(r io.Reader, callback func()) *eofReader {
<add> return &eofReader{
<add> Reader: r,
<add> callback: callback,
<add> }
<add>}
<add>
<add>type eofReader struct {
<add> io.Reader
<add> gotEOF int32
<add> callback func()
<add>}
<add>
<add>func (r *eofReader) Read(p []byte) (n int, err error) {
<add> n, err = r.Reader.Read(p)
<add> if err == io.EOF {
<add> // Use atomics to make the gotEOF check threadsafe
<add> if atomic.CompareAndSwapInt32(&r.gotEOF, 0, 1) {
<add> r.callback()
<add> }
<add> }
<add> return
<add>} | 10 |
Javascript | Javascript | remove console log | 3e8868c907277297c0363c9e79f736a50c48726e | <ide><path>server/boot/challenge.js
<ide> function getSuperBlocks$(challenge$, challengeMap) {
<ide>
<ide> function getChallengeById$(challenge$, challengeId) {
<ide> // return first challenge if no id is given
<del> console.log('id', challengeId);
<ide> if (!challengeId) {
<ide> return challenge$
<ide> .map(challenge => challenge.toJSON()) | 1 |
Python | Python | remove debug message | 5ce6a4064539dc12ff5d41a4c75dae4e378d8044 | <ide><path>glances/amps_list.py
<ide> def update(self):
<ide> amps_list += [p for p in processlist if re.search(v.regex(), p['name']) is not None]
<ide> except (TypeError, KeyError):
<ide> continue
<del> logger.info(amps_list)
<ide> if len(amps_list) > 0:
<ide> # At least one process is matching the regex
<ide> logger.debug("AMPS: {} process detected (PID={})".format(k, amps_list[0]['pid'])) | 1 |
Javascript | Javascript | fix bugs about timezone change | bfc36fa46a5a3b65fcd86e9b748a2eaef263b764 | <ide><path>airflow/www/static/js/main.js
<ide> function displayTime() {
<ide> .html(`${now.format('HH:mm')} <strong>${formatTimezone(now)}</strong>`);
<ide> }
<ide>
<del>function changDisplayedTimezone(tz) {
<add>function changeDisplayedTimezone(tz) {
<ide> localStorage.setItem('selected-timezone', tz);
<ide> setDisplayedTimezone(tz);
<ide> displayTime();
<ide> function initializeUITimezone() {
<ide> setManualTimezone(manualTz);
<ide> }
<ide>
<del> changDisplayedTimezone(selectedTz || Airflow.defaultUITimezone);
<add> changeDisplayedTimezone(selectedTz || Airflow.defaultUITimezone);
<ide>
<ide> if (Airflow.serverTimezone !== 'UTC') {
<ide> $('#timezone-server a').html(`${formatTimezone(Airflow.serverTimezone)} <span class="label label-primary">Server</span>`);
<ide> function initializeUITimezone() {
<ide> }
<ide>
<ide> $('a[data-timezone]').click((evt) => {
<del> changDisplayedTimezone($(evt.target).data('timezone'));
<add> changeDisplayedTimezone($(evt.currentTarget).data('timezone'));
<ide> });
<ide>
<ide> $('#timezone-other').typeahead({
<ide> function initializeUITimezone() {
<ide> this.$element.val('');
<ide>
<ide> setManualTimezone(data.tzName);
<del> changDisplayedTimezone(data.tzName);
<add> changeDisplayedTimezone(data.tzName);
<ide>
<ide> // We need to delay the close event to not be in the form handler,
<ide> // otherwise bootstrap ignores it, thinking it's caused by interaction on | 1 |
Javascript | Javascript | prefer package name from metadata | 53c0f5f4a027d3800e6c6a6d869af6e0210d8011 | <ide><path>src/package.js
<ide> class Package {
<ide> ? params.bundledPackage
<ide> : this.packageManager.isBundledPackagePath(this.path)
<ide> this.name =
<del> params.name ||
<ide> (this.metadata && this.metadata.name) ||
<add> params.name ||
<ide> path.basename(this.path)
<ide> this.reset()
<ide> } | 1 |
Ruby | Ruby | add collectionproxy#destroy documentation | d83173483d397df8cdff913d9a4929684c7bd4ce | <ide><path>activerecord/lib/active_record/associations/collection_proxy.rb
<ide> class CollectionProxy < Relation
<ide> ##
<ide> # :method: destroy_all
<ide> # Deletes the records of the collection directly from the database.
<add> # This will _always_ remove the records ignoring the +:dependent+
<add> # option.
<ide> #
<ide> # class Person < ActiveRecord::Base
<ide> # has_many :pets
<ide> class CollectionProxy < Relation
<ide> #
<ide> # Pet.find(1) # => Couldn't find Pet with id=1
<ide>
<add> ##
<add> # :method: destroy
<add> # Destroy the +records+ supplied and remove them from the collection.
<add> # This method will _always_ remove record from the database ignoring
<add> # the +:dependent+ option. Returns an array with the deleted records.
<add> #
<add> # class Person < ActiveRecord::Base
<add> # has_many :pets
<add> # end
<add> #
<add> # person.pets.size # => 3
<add> # person.pets
<add> # # => [
<add> # # #<Pet id: 1, name: "Fancy-Fancy", person_id: 1>,
<add> # # #<Pet id: 2, name: "Spook", person_id: 1>,
<add> # # #<Pet id: 3, name: "Choo-Choo", person_id: 1>
<add> # # ]
<add> #
<add> # person.pets.destroy(Pet.find(1))
<add> # # => [#<Pet id: 1, name: "Fancy-Fancy", person_id: 1>]
<add> #
<add> # person.pets.size # => 2
<add> # person.pets
<add> # # => [
<add> # # #<Pet id: 2, name: "Spook", person_id: 1>,
<add> # # #<Pet id: 3, name: "Choo-Choo", person_id: 1>
<add> # # ]
<add> #
<add> # person.pets.destroy(Pet.find(2), Pet.find(3))
<add> # # => [
<add> # # #<Pet id: 2, name: "Spook", person_id: 1>,
<add> # # #<Pet id: 3, name: "Choo-Choo", person_id: 1>
<add> # # ]
<add> #
<add> # person.pets.size # => 0
<add> # person.pets # => []
<add> #
<add> # Pet.find([1, 2, 3]) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with IDs (1, 2, 3)
<add>
<ide> ##
<ide> # :method: empty?
<ide> # Returns true if the collection is empty.
<ide> class CollectionProxy < Relation
<ide> #
<ide> # person.pets.count # => 0
<ide> # person.pets.empty? # => true
<del>
<add>
<ide> ##
<ide> # :method: any?
<ide> # Returns true if the collection is not empty. | 1 |
Javascript | Javascript | keep track of root insertion order in the renderer | b1a7007cc5194d769610abf9de796eb152f161b1 | <ide><path>src/backend/renderer.js
<ide> export function attach(
<ide> // When a mount or update is in progress, this value tracks the root that is being operated on.
<ide> let currentRootID: number = -1;
<ide>
<add> // Track the order in which roots were added.
<add> // We will use it to disambiguate roots when restoring selection between reloads.
<add> let nextRootIndex = 0;
<add> const rootInsertionOrder: Map<number, number> = new Map();
<add>
<ide> function getFiberID(primaryFiber: Fiber): number {
<ide> if (!fiberToIDMap.has(primaryFiber)) {
<ide> const id = getUID();
<ide> export function attach(
<ide> const hasOwnerMetadata = fiber.hasOwnProperty('_debugOwner');
<ide>
<ide> if (isRoot) {
<add> rootInsertionOrder.set(id, nextRootIndex++);
<ide> pushOperation(TREE_OPERATION_ADD);
<ide> pushOperation(id);
<ide> pushOperation(ElementTypeRoot);
<ide> export function attach(
<ide> }
<ide> const id = getFiberID(primaryFiber);
<ide> if (isRoot) {
<add> rootInsertionOrder.delete(id);
<ide> // Removing a root needs to happen at the end
<ide> // so we don't batch it with other unmounts.
<ide> pushOperation(TREE_OPERATION_REMOVE); | 1 |
PHP | PHP | move tests around | 274a146b24e56037323f7e9ddc5a67f9fc44989b | <ide><path>lib/Cake/Test/Case/View/Helper/FormHelperTest.php
<ide> public function testDateTime() {
<ide> );
<ide> $this->assertTags($result, $expected);
<ide>
<del> $result = $this->Form->input('published', array('type' => 'time'));
<del> $now = strtotime('now');
<del> $expected = array(
<del> 'div' => array('class' => 'input time'),
<del> 'label' => array('for' => 'ContactPublishedHour'),
<del> 'Published',
<del> '/label',
<del> array('select' => array('name' => 'data[Contact][published][hour]', 'id' => 'ContactPublishedHour')),
<del> 'preg:/(?:<option value="([\d])+">[\d]+<\/option>[\r\n]*)*/',
<del> array('option' => array('value' => date('h', $now), 'selected' => 'selected')),
<del> date('g', $now),
<del> '/option',
<del> '*/select',
<del> ':',
<del> );
<del> $this->assertTags($result, $expected);
<del>
<ide> $result = $this->Form->input('published', array(
<ide> 'timeFormat' => 24,
<ide> 'interval' => 5,
<ide> public function testDateTime() {
<ide> $this->assertRegExp('/<option[^<>]+value="13"[^<>]+selected="selected"[^>]*>13<\/option>/', $result);
<ide> $this->assertRegExp('/<option[^<>]+value="35"[^<>]+selected="selected"[^>]*>35<\/option>/', $result);
<ide>
<del> $this->assertNoErrors();
<add> $result = $this->Form->input('published', array('type' => 'time'));
<add> $now = strtotime('now');
<add> $this->assertContains('<option value="' . date('h', $now) . '" selected="selected">' . date('g', $now) . '</option>', $result);
<add> }
<add>
<add>/**
<add> * Test that empty values don't trigger errors.
<add> *
<add> * @return void
<add> */
<add> public function testDateTimeNoErrorsOnEmptyData() {
<ide> $this->Form->request->data['Contact'] = array(
<ide> 'date' => array(
<ide> 'day' => '',
<ide> public function testDateTime() {
<ide> )
<ide> );
<ide> $result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('empty' => false));
<add> $this->assertNotEmpty($result);
<ide> }
<ide>
<ide> /** | 1 |
Text | Text | fix typo in relations docs | c03c6c6e783b2d7c25c79bdadf2b12433dd88116 | <ide><path>docs/api-guide/relations.md
<ide> For example, given the following model for a tag, which has a generic relationsh
<ide> def __unicode__(self):
<ide> return self.tag_name
<ide>
<del>And the following two models, which may be have associated tags:
<add>And the following two models, which may have associated tags:
<ide>
<ide> class Bookmark(models.Model):
<ide> """ | 1 |
Python | Python | fix bug in input check for lengthgroupsampler | ce9724e1bdf3cd84a3b50f771d35b557629e95fc | <ide><path>src/transformers/trainer_pt_utils.py
<ide> def __init__(
<ide> self.batch_size = batch_size
<ide> self.model_input_name = model_input_name if model_input_name is not None else "input_ids"
<ide> if lengths is None:
<del> if not isinstance(dataset[0], dict) or model_input_name not in dataset[0]:
<add> if not isinstance(dataset[0], dict) or self.model_input_name not in dataset[0]:
<ide> raise ValueError(
<ide> "Can only automatically infer lengths for datasets whose items are dictionaries with an "
<ide> f"'{self.model_input_name}' key." | 1 |
Javascript | Javascript | fix getter of result from image query cache | 9ac219e0773f1b0bd5ed583d94c910c14ea4e2f4 | <ide><path>Libraries/Image/Image.android.js
<ide> function abortPrefetch(requestId: number) {
<ide> */
<ide> async function queryCache(
<ide> urls: Array<string>,
<del>): Promise<Map<string, 'memory' | 'disk'>> {
<add>): Promise<{[string]: 'memory' | 'disk' | 'disk/memory'}> {
<ide> return await ImageLoader.queryCache(urls);
<ide> }
<ide>
<ide><path>Libraries/Image/Image.ios.js
<ide> function prefetch(url: string) {
<ide>
<ide> async function queryCache(
<ide> urls: Array<string>,
<del>): Promise<Map<string, 'memory' | 'disk' | 'disk/memory'>> {
<add>): Promise<{[string]: 'memory' | 'disk' | 'disk/memory'}> {
<ide> return await ImageViewManager.queryCache(urls);
<ide> }
<ide>
<ide><path>RNTester/js/ImageExample.js
<ide> class NetworkImageCallbackExample extends React.Component<
<ide> `✔ Prefetch OK (+${new Date() - mountTime}ms)`,
<ide> );
<ide> Image.queryCache([IMAGE_PREFETCH_URL]).then(map => {
<del> const result = map.get(IMAGE_PREFETCH_URL);
<add> const result = map[IMAGE_PREFETCH_URL];
<ide> if (result) {
<ide> this._loadEventFired(
<ide> `✔ queryCache "${result}" (+${new Date() - | 3 |
Ruby | Ruby | make the first arg either a name or email | 0c7825accd9ad960cc045e503bb4edab3a955b2a | <ide><path>Library/Homebrew/dev-cmd/contributions.rb
<ide> module Homebrew
<ide> sig { returns(CLI::Parser) }
<ide> def contributions_args
<ide> Homebrew::CLI::Parser.new do
<del> usage_banner "`contributions` <email> <repo1,repo2|all>"
<add> usage_banner "`contributions` <email|name> <repo1,repo2|all>"
<ide> description <<~EOS
<ide> Contributions to Homebrew repos for a user.
<ide>
<add> The first argument is a name (e.g. "BrewTestBot") or an email address (e.g. "[email protected]").
<add>
<ide> The second argument is a comma-separated list of repos to search.
<ide> Specify <all> to search all repositories.
<ide> Supported repositories: #{SUPPORTED_REPOS.join(", ")}.
<ide> def contributions_args
<ide> flag "--to=",
<ide> description: "Date (ISO-8601 format) to stop searching contributions."
<ide>
<del> named_args [:email, :repositories], min: 2, max: 2
<add> named_args [:email, :name, :repositories], min: 2, max: 2
<ide> end
<ide> end
<ide> | 1 |
Javascript | Javascript | use version counter for texture updates | 38ad9b560e25db5d5fd596160652884ad5bd1bbd | <ide><path>src/renderers/WebGLRenderer.js
<ide> THREE.WebGLRenderer = function ( parameters ) {
<ide>
<ide> }
<ide>
<del> this.uploadTexture = function ( texture, slot ) {
<del>
<del> var textureProperties = properties.get( texture );
<add> function uploadTexture( textureProperties, texture, slot ) {
<ide>
<ide> if ( textureProperties.__webglInit === undefined ) {
<ide>
<ide> THREE.WebGLRenderer = function ( parameters ) {
<ide>
<ide> if ( texture.generateMipmaps && isImagePowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D );
<ide>
<del> texture.needsUpdate = false;
<add> textureProperties.__version = texture.version;
<ide>
<ide> if ( texture.onUpdate ) texture.onUpdate( texture );
<ide>
<del> };
<add> }
<ide>
<ide> this.setTexture = function ( texture, slot ) {
<ide>
<del> if ( texture.needsUpdate === true ) {
<add> var textureProperties = properties.get( texture );
<add>
<add> if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
<ide>
<ide> var image = texture.image;
<ide>
<ide> THREE.WebGLRenderer = function ( parameters ) {
<ide>
<ide> }
<ide>
<del> _this.uploadTexture( texture, slot );
<add> uploadTexture( textureProperties, texture, slot );
<ide> return;
<ide>
<ide> }
<ide>
<ide> state.activeTexture( _gl.TEXTURE0 + slot );
<del> state.bindTexture( _gl.TEXTURE_2D, properties.get( texture ).__webglTexture );
<add> state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture );
<ide>
<ide> };
<ide>
<ide> THREE.WebGLRenderer = function ( parameters ) {
<ide>
<ide> if ( texture.image.length === 6 ) {
<ide>
<del> if ( texture.needsUpdate ) {
<add> if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
<ide>
<ide> if ( ! textureProperties.__image__webglTextureCube ) {
<ide>
<ide> THREE.WebGLRenderer = function ( parameters ) {
<ide>
<ide> }
<ide>
<del> texture.needsUpdate = false;
<add> textureProperties.__version = texture.version;
<ide>
<ide> if ( texture.onUpdate ) texture.onUpdate( texture );
<ide>
<ide><path>src/renderers/webgl/WebGLTextures.js
<del>/**
<del>* @author mrdoob / http://mrdoob.com/
<del>*/
<del>
<del>THREE.WebGLTextures = function ( gl ) {
<del>
<del> var textures = {};
<del>
<del> this.get = function ( texture ) {
<del>
<del> if ( textures[ texture.id ] !== undefined ) {
<del>
<del> return textures[ texture.id ];
<del>
<del> }
<del>
<del> return this.create( texture );
<del>
<del> };
<del>
<del> this.create = function ( texture ) {
<del>
<del> texture.addEventListener( 'dispose', this.delete );
<del>
<del> textures[ texture.id ] = gl.createTexture();
<del>
<del> return textures[ texture.id ];
<del>
<del> };
<del>
<del> this.delete = function ( texture ) {
<del>
<del> texture.removeEventListener( 'dispose', this.delete );
<del>
<del> gl.deleteTexture( textures[ texture.id ] );
<del>
<del> delete textures[ texture.id ];
<del>
<del> };
<del>
<del>};
<ide><path>src/textures/Texture.js
<ide> THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, f
<ide> this.flipY = true;
<ide> this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
<ide>
<del> this._needsUpdate = false;
<add> this.version = 0;
<ide> this.onUpdate = null;
<ide>
<ide> };
<ide> THREE.Texture.prototype = {
<ide>
<ide> constructor: THREE.Texture,
<ide>
<del> get needsUpdate () {
<del>
<del> return this._needsUpdate;
<del>
<del> },
<del>
<ide> set needsUpdate ( value ) {
<ide>
<ide> if ( value === true ) this.update();
<ide>
<del> this._needsUpdate = value;
<add> this.version ++;
<ide>
<ide> },
<ide> | 3 |
Ruby | Ruby | remove incorrect comment | 26feaf9c3cb09902fec745f8efc1d51baa8d41cd | <ide><path>activerecord/lib/active_record/attribute_set.rb
<ide> def ==(other)
<ide> attributes == other.attributes
<ide> end
<ide>
<del> # TODO Change this to private once we've dropped Ruby 2.2 support.
<del> # Workaround for Ruby 2.2 "private attribute?" warning.
<ide> protected
<ide>
<ide> attr_reader :attributes | 1 |
Javascript | Javascript | add default frustum to orthographiccamera | e4a12e8b61c0af85839a8fb68e7c5720df454f45 | <ide><path>src/cameras/OrthographicCamera.js
<ide> function OrthographicCamera( left, right, top, bottom, near, far ) {
<ide> this.zoom = 1;
<ide> this.view = null;
<ide>
<del> this.left = left;
<del> this.right = right;
<del> this.top = top;
<del> this.bottom = bottom;
<add> this.left = ( left !== undefined ) ? left : -1;
<add> this.right = ( right !== undefined ) ? right : 1;
<add> this.top = ( top !== undefined ) ? ltopeft : 1;
<add> this.bottom = ( bottom !== undefined ) ? bottom : -1;
<ide>
<ide> this.near = ( near !== undefined ) ? near : 0.1;
<ide> this.far = ( far !== undefined ) ? far : 2000; | 1 |
Javascript | Javascript | allow optional 'target' argument | 610927d77b77700c5c61accd503a2af0fa51cfe6 | <ide><path>src/ngSanitize/filter/linky.js
<ide> * plain email address links.
<ide> *
<ide> * @param {string} text Input text.
<add> * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in.
<ide> * @returns {string} Html-linkified text.
<ide> *
<ide> * @usage
<ide> 'mailto:[email protected],\n'+
<ide> '[email protected],\n'+
<ide> 'and one more: ftp://127.0.0.1/.';
<add> $scope.snippetWithTarget = 'http://angularjs.org/';
<ide> }
<ide> </script>
<ide> <div ng-controller="Ctrl">
<ide> <div ng-bind-html="snippet | linky"></div>
<ide> </td>
<ide> </tr>
<add> <tr id="linky-target">
<add> <td>linky target</td>
<add> <td>
<add> <pre><div ng-bind-html="snippetWithTarget | linky:'_blank'"><br></div></pre>
<add> </td>
<add> <td>
<add> <div ng-bind-html="snippetWithTarget | linky:'_blank'"></div>
<add> </td>
<add> </tr>
<ide> <tr id="escaped-html">
<ide> <td>no filter</td>
<ide> <td><pre><div ng-bind="snippet"><br></div></pre></td>
<ide> toBe('new <a href="http://link">http://link</a>.');
<ide> expect(using('#escaped-html').binding('snippet')).toBe('new http://link.');
<ide> });
<add>
<add> it('should work with the target property', function() {
<add> expect(using('#linky-target').binding("snippetWithTarget | linky:'_blank'")).
<add> toBe('<a target="_blank" href="http://angularjs.org/">http://angularjs.org/</a>');
<add> });
<ide> </doc:scenario>
<ide> </doc:example>
<ide> */
<ide> angular.module('ngSanitize').filter('linky', function() {
<ide> var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}\<\>]/,
<ide> MAILTO_REGEXP = /^mailto:/;
<ide>
<del> return function(text) {
<add> return function(text, target) {
<ide> if (!text) return text;
<ide> var match;
<ide> var raw = text;
<ide> angular.module('ngSanitize').filter('linky', function() {
<ide> var writer = htmlSanitizeWriter(html);
<ide> var url;
<ide> var i;
<add> var properties = {};
<add> if (angular.isDefined(target)) {
<add> properties.target = target;
<add> }
<ide> while ((match = raw.match(LINKY_URL_REGEXP))) {
<ide> // We can not end in these as they are sometimes found at the end of the sentence
<ide> url = match[0];
<ide> // if we did not match ftp/http/mailto then assume mailto
<ide> if (match[2] == match[3]) url = 'mailto:' + url;
<ide> i = match.index;
<ide> writer.chars(raw.substr(0, i));
<del> writer.start('a', {href:url});
<add> properties.href = url;
<add> writer.start('a', properties);
<ide> writer.chars(match[0].replace(MAILTO_REGEXP, ''));
<ide> writer.end('a');
<ide> raw = raw.substring(i + match[0].length);
<ide><path>test/ngSanitize/filter/linkySpec.js
<ide> describe('linky', function() {
<ide> expect(linky("send email to [email protected], but")).
<ide> toEqual('send email to <a href="mailto:[email protected]">[email protected]</a>, but');
<ide> });
<add>
<add> it('should handle target:', function() {
<add> expect(linky("http://example.com", "_blank")).
<add> toEqual('<a target="_blank" href="http://example.com">http://example.com</a>')
<add> expect(linky("http://example.com", "someNamedIFrame")).
<add> toEqual('<a target="someNamedIFrame" href="http://example.com">http://example.com</a>')
<add> });
<ide> }); | 2 |
Python | Python | add tests for multiarray.matmul and operator '@' | 0cb4cbd235978ec0925c5c1cdbfe34da669e3379 | <ide><path>numpy/core/tests/test_multiarray.py
<ide> import warnings
<ide> import operator
<ide> import io
<add>import itertools
<ide> if sys.version_info[0] >= 3:
<ide> import builtins
<ide> else:
<ide> def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs):
<ide> assert_raises(TypeError, c.dot, b)
<ide>
<ide> def test_accelerate_framework_sgemv_fix(self):
<del> from itertools import product
<ide> if sys.platform != 'darwin':
<ide> return
<ide>
<ide> def assert_dot_close(A, X, desired):
<ide> s = aligned_array((100, 100), 15, np.float32)
<ide> np.dot(s, m) # this will always segfault if the bug is present
<ide>
<del> testdata = product((15,32), (10000,), (200,89), ('C','F'))
<add> testdata = itertools.product((15,32), (10000,), (200,89), ('C','F'))
<ide> for align, m, n, a_order in testdata:
<ide> # Calculation in double precision
<ide> A_d = np.random.rand(m, n)
<ide> def assert_dot_close(A, X, desired):
<ide> assert_dot_close(A_f_12, X_f_2, desired)
<ide>
<ide>
<add>class MatmulCommon():
<add> """Common tests for '@' operator and numpy.matmul.
<add>
<add> Do not derive from TestCase to avoid nose running it.
<add>
<add> """
<add> # Should work with these types. Will want to add
<add> # "O" at some point
<add> types = "?bhilqBHILQefdgFDG"
<add>
<add> def test_exceptions(self):
<add> dims = [
<add> ((1,), (2,)), # mismatched vector vector
<add> ((2, 1,), (2,)), # mismatched matrix vector
<add> ((2,), (1, 2)), # mismatched vector matrix
<add> ((1, 2), (3, 1)), # mismatched matrix matrix
<add> ((1,), ()), # vector scalar
<add> ((), (1)), # scalar vector
<add> ((1, 1), ()), # matrix scalar
<add> ((), (1, 1)), # scalar matrix
<add> ((2, 2, 1), (3, 1, 2)), # cannot broadcast
<add> ]
<add>
<add> for dt, (dm1, dm2) in itertools.product(self.types, dims):
<add> a = np.ones(dm1, dtype=dt)
<add> b = np.ones(dm2, dtype=dt)
<add> assert_raises(ValueError, self.matmul, a, b)
<add>
<add> def test_shapes(self):
<add> dims = [
<add> ((1, 1), (2, 1, 1)), # broadcast first argument
<add> ((2, 1, 1), (1, 1)), # broadcast second argument
<add> ((2, 1, 1), (2, 1, 1)), # matrix stack sizes match
<add> ]
<add>
<add> for dt, (dm1, dm2) in itertools.product(self.types, dims):
<add> a = np.ones(dm1, dtype=dt)
<add> b = np.ones(dm2, dtype=dt)
<add> res = self.matmul(a, b)
<add> assert_(res.shape == (2, 1, 1))
<add>
<add> # vector vector returns scalars.
<add> for dt in self.types:
<add> a = np.ones((2,), dtype=dt)
<add> b = np.ones((2,), dtype=dt)
<add> c = self.matmul(a, b)
<add> assert_(np.array(c).shape == ())
<add>
<add> def test_result_types(self):
<add> mat = np.ones((1,1))
<add> vec = np.ones((1,))
<add> for dt in self.types:
<add> m = mat.astype(dt)
<add> v = vec.astype(dt)
<add> for arg in [(m, v), (v, m), (m, m)]:
<add> res = matmul(*arg)
<add> assert_(res.dtype == dt)
<add>
<add> # vector vector returns scalars
<add> res = matmul(v, v)
<add> assert_(type(res) is dtype(dt).type)
<add>
<add> def test_vector_vector_values(self):
<add> vec = np.array([1, 2])
<add> tgt = 5
<add> for dt in self.types[1:]:
<add> v1 = vec.astype(dt)
<add> res = matmul(v1, v1)
<add> assert_equal(res, tgt)
<add>
<add> # boolean type
<add> vec = np.array([True, True], dtype='?')
<add> res = matmul(vec, vec)
<add> assert_equal(res, True)
<add>
<add> def test_vector_matrix_values(self):
<add> vec = np.array([1, 2])
<add> mat1 = np.array([[1, 2], [3, 4]])
<add> mat2 = np.stack([mat1]*2, axis=0)
<add> tgt1 = np.array([7, 10])
<add> tgt2 = np.stack([tgt1]*2, axis=0)
<add> for dt in self.types[1:]:
<add> v = vec.astype(dt)
<add> m1 = mat1.astype(dt)
<add> m2 = mat2.astype(dt)
<add> res = matmul(v, m1)
<add> assert_equal(res, tgt1)
<add> res = matmul(v, m2)
<add> assert_equal(res, tgt2)
<add>
<add> # boolean type
<add> vec = np.array([True, False])
<add> mat1 = np.array([[True, False], [False, True]])
<add> mat2 = np.stack([mat1]*2, axis=0)
<add> tgt1 = np.array([True, False])
<add> tgt2 = np.stack([tgt1]*2, axis=0)
<add>
<add> res = matmul(vec, mat1)
<add> assert_equal(res, tgt1)
<add> res = matmul(vec, mat2)
<add> assert_equal(res, tgt2)
<add>
<add> def test_matrix_vector_values(self):
<add> vec = np.array([1, 2])
<add> mat1 = np.array([[1, 2], [3, 4]])
<add> mat2 = np.stack([mat1]*2, axis=0)
<add> tgt1 = np.array([5, 11])
<add> tgt2 = np.stack([tgt1]*2, axis=0)
<add> for dt in self.types[1:]:
<add> v = vec.astype(dt)
<add> m1 = mat1.astype(dt)
<add> m2 = mat2.astype(dt)
<add> res = matmul(m1, v)
<add> assert_equal(res, tgt1)
<add> res = matmul(m2, v)
<add> assert_equal(res, tgt2)
<add>
<add> # boolean type
<add> vec = np.array([True, False])
<add> mat1 = np.array([[True, False], [False, True]])
<add> mat2 = np.stack([mat1]*2, axis=0)
<add> tgt1 = np.array([True, False])
<add> tgt2 = np.stack([tgt1]*2, axis=0)
<add>
<add> res = matmul(vec, mat1)
<add> assert_equal(res, tgt1)
<add> res = matmul(vec, mat2)
<add> assert_equal(res, tgt2)
<add>
<add> def test_matrix_matrix_values(self):
<add> mat1 = np.array([[1, 2], [3, 4]])
<add> mat2 = np.array([[1, 0], [1, 1]])
<add> mat12 = np.stack([mat1, mat2], axis=0)
<add> mat21 = np.stack([mat2, mat1], axis=0)
<add> tgt11 = np.array([[7, 10], [15, 22]])
<add> tgt12 = np.array([[3, 2], [7, 4]])
<add> tgt21 = np.array([[1, 2], [4, 6]])
<add> tgt22 = np.array([[1, 0], [2, 1]])
<add> tgt12_21 = np.stack([tgt12, tgt21], axis=0)
<add> tgt11_12 = np.stack((tgt11, tgt12), axis=0)
<add> tgt11_21 = np.stack((tgt11, tgt21), axis=0)
<add> for dt in self.types[1:]:
<add> m1 = mat1.astype(dt)
<add> m2 = mat2.astype(dt)
<add> m12 = mat12.astype(dt)
<add> m21 = mat21.astype(dt)
<add>
<add> # matrix @ matrix
<add> res = matmul(m1, m2)
<add> assert_equal(res, tgt12)
<add> res = matmul(m2, m1)
<add> assert_equal(res, tgt21)
<add>
<add> # stacked @ matrix
<add> res = self.matmul(m12, m1)
<add> assert_equal(res, tgt11_21)
<add>
<add> # matrix @ stacked
<add> res = self.matmul(m1, m12)
<add> assert_equal(res, tgt11_12)
<add>
<add> # stacked @ stacked
<add> res = self.matmul(m12, m21)
<add> assert_equal(res, tgt12_21)
<add>
<add> # boolean type
<add> m1 = np.array([[1, 1], [0, 0]], dtype=np.bool_)
<add> m2 = np.array([[1, 0], [1, 1]], dtype=np.bool_)
<add> m12 = np.stack([m1, m2], axis=0)
<add> m21 = np.stack([m2, m1], axis=0)
<add> tgt11 = m1
<add> tgt12 = m1
<add> tgt21 = np.array([[1, 1], [1, 1]], dtype=np.bool_)
<add> tgt22 = m2
<add> tgt12_21 = np.stack([tgt12, tgt21], axis=0)
<add> tgt11_12 = np.stack((tgt11, tgt12), axis=0)
<add> tgt11_21 = np.stack((tgt11, tgt21), axis=0)
<add>
<add> # matrix @ matrix
<add> res = matmul(m1, m2)
<add> assert_equal(res, tgt12)
<add> res = matmul(m2, m1)
<add> assert_equal(res, tgt21)
<add>
<add> # stacked @ matrix
<add> res = self.matmul(m12, m1)
<add> assert_equal(res, tgt11_21)
<add>
<add> # matrix @ stacked
<add> res = self.matmul(m1, m12)
<add> assert_equal(res, tgt11_12)
<add>
<add> # stacked @ stacked
<add> res = self.matmul(m12, m21)
<add> assert_equal(res, tgt12_21)
<add>
<add> def test_numpy_ufunc_override(self):
<add>
<add> class A(np.ndarray):
<add> def __new__(cls, *args, **kwargs):
<add> return np.array(*args, **kwargs).view(cls)
<add> def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs):
<add> return "A"
<add>
<add> class B(np.ndarray):
<add> def __new__(cls, *args, **kwargs):
<add> return np.array(*args, **kwargs).view(cls)
<add> def __numpy_ufunc__(self, ufunc, method, pos, inputs, **kwargs):
<add> return NotImplemented
<add>
<add> a = A([1, 2])
<add> b = B([1, 2])
<add> c = ones(2)
<add> assert_equal(self.matmul(a, b), "A")
<add> assert_equal(self.matmul(b, a), "A")
<add> assert_raises(TypeError, self.matmul, b, c)
<add>
<add>
<add>class TestMatmul(MatmulCommon, TestCase):
<add> matmul = np.matmul
<add>
<add> def test_out_arg(self):
<add> a = np.ones((2, 2), dtype=np.float)
<add> b = np.ones((2, 2), dtype=np.float)
<add> tgt = np.full((2,2), 2, dtype=np.float)
<add>
<add> # test as positional argument
<add> msg = "out positional argument"
<add> out = np.zeros((2, 2), dtype=np.float)
<add> self.matmul(a, b, out)
<add> assert_array_equal(out, tgt, err_msg=msg)
<add>
<add> # test as keyword argument
<add> msg = "out keyword argument"
<add> out = np.zeros((2, 2), dtype=np.float)
<add> self.matmul(a, b, out=out)
<add> assert_array_equal(out, tgt, err_msg=msg)
<add>
<add> # test out with not allowed type cast (safe casting)
<add> # einsum and cblas raise different error types, so
<add> # use Exception.
<add> msg = "out argument with illegal cast"
<add> out = np.zeros((2, 2), dtype=np.int32)
<add> assert_raises(Exception, self.matmul, a, b, out=out)
<add>
<add> # skip following tests for now, cblas does not allow non-contiguous
<add> # outputs and consistency with dot would require same type,
<add> # dimensions, subtype, and c_contiguous.
<add>
<add> # test out with allowed type cast
<add> # msg = "out argument with allowed cast"
<add> # out = np.zeros((2, 2), dtype=np.complex128)
<add> # self.matmul(a, b, out=out)
<add> # assert_array_equal(out, tgt, err_msg=msg)
<add>
<add> # test out non-contiguous
<add> # msg = "out argument with non-contiguous layout"
<add> # c = np.zeros((2, 2, 2), dtype=np.float)
<add> # self.matmul(a, b, out=c[..., 0])
<add> # assert_array_equal(c, tgt, err_msg=msg)
<add>
<add>
<add>if sys.version_info[:2] >= (3, 5):
<add> class TestMatmulOperator(MatmulCommon, TestCase):
<add> from operator import matmul
<add>
<add> def test_array_priority_override(self):
<add>
<add> class A(object):
<add> __array_priority__ = 1000
<add> def __matmul__(self, other):
<add> return "A"
<add> def __rmatmul__(self, other):
<add> return "A"
<add>
<add> a = A()
<add> b = ones(2)
<add> assert_equal(self.matmul(a, b), "A")
<add> assert_equal(self.matmul(b, a), "A")
<add>
<add>
<ide> class TestInner(TestCase):
<ide>
<ide> def test_inner_scalar_and_matrix_of_objects(self): | 1 |
Text | Text | change the text "可用->适合" | 155c9b01d00baa3062854d07750fdafbc0297dc3 | <ide><path>guide/chinese/agile/acceptance-testing/index.md
<ide> localeTitle: 验收测试
<ide>
<ide> 验收测试用于测试相对较大的软件功能块,即功能。
<ide>
<del>### 例
<add>### 例子
<ide>
<ide> 您创建了一个页面,要求用户首先在对话框中输入其名称,然后才能看到内容。您有一个受邀用户列表,因此任何其他用户都将返回错误。
<ide>
<ide> localeTitle: 验收测试
<ide>
<ide> ### 笔记
<ide>
<del>验收测试可以用任何语言编写,并使用各种可用的工具运行,这些工具可以处理上面提到的基础结构,例如打开浏览器,加载页面,提供访问页面元素的方法,断言库等等。
<add>验收测试可以用任何语言编写,并使用各种适合的工具运行,这些工具可以处理上面提到的基础结构,例如打开浏览器,加载页面,提供访问页面元素的方法,断言库等等。
<ide>
<ide> 每次你编写一个将再次使用的软件(即使是你自己),它也有助于为它编写测试。当您自己或其他人对此代码进行更改时,运行测试将确保您没有破坏现有功能。
<ide>
<ide> localeTitle: 验收测试
<ide>
<ide> #### 更多信息:
<ide>
<del>* [国际软件测试资格委员会](http://www.istqb.org/)
<ide>\ No newline at end of file
<add>* [国际软件测试资格委员会](http://www.istqb.org/) | 1 |
PHP | PHP | remove optional value | 169fd2b5156650a067aa77a38681875d2a6c5e57 | <ide><path>src/Illuminate/Console/Concerns/InteractsWithIO.php
<ide> public function table($headers, $rows, $tableStyle = 'default', array $columnSty
<ide> * @param \Closure $callback
<ide> * @return mixed|void
<ide> */
<del> public function withProgressBar($totalSteps = 0, Closure $callback)
<add> public function withProgressBar($totalSteps, Closure $callback)
<ide> {
<ide> $bar = $this->output->createProgressBar(
<ide> is_iterable($totalSteps) ? count($totalSteps) : $totalSteps | 1 |
PHP | PHP | fix mistake in error handler docs | a8f9597e1f2e16bb1f9e1e30726e76a48822abd5 | <ide><path>lib/Cake/Error/ErrorHandler.php
<ide> * #### Controlling what errors are logged/displayed
<ide> *
<ide> * You can control which errors are logged / displayed by ErrorHandler by setting `errorLevel`. Setting this
<del> * to one or a combination of a few of the E_* constants will only enable the specified errors.
<add> * to one or a combination of a few of the E_* constants will only enable the specified errors:
<ide> *
<del> * $options['log'] = E_ALL & ~E_NOTICE;
<add> * `$options['errorLevel'] = E_ALL & ~E_NOTICE;`
<ide> *
<ide> * Would enable handling for all non Notice errors.
<ide> * | 1 |
Javascript | Javascript | fix stupid rule errors | 8364cde050c44b47e24d3ebae23a51f6696f656c | <ide><path>packages/ember-metal/lib/index.js
<ide> if (has('ember-debug')) {
<ide> deprecate(
<ide> 'Support for the `ember-legacy-views` addon will end soon, please remove it from your application.',
<ide> !!Ember.ENV._ENABLE_LEGACY_VIEW_SUPPORT,
<del> { id: 'ember-legacy-views', until: '2.6.0', url: 'http://emberjs.com/deprecations/v1.x/#toc_ember-view' }
<del>);
<add> { id: 'ember-legacy-views', until: '2.6.0', url: 'http://emberjs.com/deprecations/v1.x/#toc_ember-view' });
<ide>
<ide> deprecate(
<ide> 'Support for the `ember-legacy-controllers` addon will end soon, please remove it from your application.',
<ide> !!Ember.ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT,
<del> { id: 'ember-legacy-controllers', until: '2.6.0', url: 'http://emberjs.com/deprecations/v1.x/#toc_objectcontroller' }
<del>);
<add> { id: 'ember-legacy-controllers', until: '2.6.0', url: 'http://emberjs.com/deprecations/v1.x/#toc_objectcontroller' });
<ide>
<ide> Ember.create = deprecateFunc('Ember.create is deprecated in favor of Object.create', { id: 'ember-metal.ember-create', until: '3.0.0' }, Object.create);
<ide> Ember.keys = deprecateFunc('Ember.keys is deprecated in favor of Object.keys', { id: 'ember-metal.ember.keys', until: '3.0.0' }, Object.keys); | 1 |
Javascript | Javascript | fix snicallback without .server option | 46510f54bee7cecb565424aeee8beb19b0162079 | <ide><path>lib/_tls_wrap.js
<ide> TLSSocket.prototype._init = function(socket, wrap) {
<ide> if (process.features.tls_sni &&
<ide> options.isServer &&
<ide> options.SNICallback &&
<del> options.server &&
<ide> (options.SNICallback !== SNICallback ||
<del> options.server._contexts.length)) {
<add> (options.server && options.server._contexts.length))) {
<ide> assert(typeof options.SNICallback === 'function');
<ide> this._SNICallback = options.SNICallback;
<ide> ssl.enableCertCb();
<ide><path>test/parallel/test-tls-socket-snicallback-without-server.js
<add>'use strict';
<add>
<add>// This is based on test-tls-securepair-fiftharg.js
<add>// for the deprecated `tls.createSecurePair()` variant.
<add>
<add>const common = require('../common');
<add>if (!common.hasCrypto)
<add> common.skip('missing crypto');
<add>
<add>const assert = require('assert');
<add>const tls = require('tls');
<add>const fixtures = require('../common/fixtures');
<add>const makeDuplexPair = require('../common/duplexpair');
<add>
<add>const { clientSide, serverSide } = makeDuplexPair();
<add>new tls.TLSSocket(serverSide, {
<add> isServer: true,
<add> SNICallback: common.mustCall((servername, cb) => {
<add> assert.strictEqual(servername, 'www.google.com');
<add> })
<add>});
<add>
<add>// captured traffic from browser's request to https://www.google.com
<add>const sslHello = fixtures.readSync('google_ssl_hello.bin');
<add>
<add>clientSide.write(sslHello); | 2 |
Python | Python | fix ticket #203 [for andrew straw] | f9a971eeef6761cedc6e48cb1dcf7af3f7966925 | <ide><path>numpy/matlib.py
<ide>
<ide> __version__ = N.__version__
<ide>
<del>__all__ = N.__all__
<add>__all__ = N.__all__[:] # copy numpy namespace
<ide> __all__ += ['rand', 'randn']
<ide>
<ide> def empty(shape, dtype=None, order='C'): | 1 |
Go | Go | fix content-type for job.stdout.add | 4611a6bdd3270e4a404cae2d23c54dd94521c4ae | <ide><path>api/api.go
<ide> func writeJSON(w http.ResponseWriter, code int, v engine.Env) error {
<ide> return v.Encode(w)
<ide> }
<ide>
<add>func streamJSON(job *engine.Job, w http.ResponseWriter, flush bool) {
<add> w.Header().Set("Content-Type", "application/json")
<add> if flush {
<add> job.Stdout.Add(utils.NewWriteFlusher(w))
<add> } else {
<add> job.Stdout.Add(w)
<add> }
<add>}
<add>
<ide> func getBoolParam(value string) (bool, error) {
<ide> if value == "" {
<ide> return false, nil
<ide> func getImagesJSON(eng *engine.Engine, version float64, w http.ResponseWriter, r
<ide> job.Setenv("all", r.Form.Get("all"))
<ide>
<ide> if version >= 1.7 {
<del> job.Stdout.Add(w)
<add> streamJSON(job, w, false)
<ide> } else if outs, err = job.Stdout.AddListTable(); err != nil {
<ide> return err
<ide> }
<ide> func getEvents(eng *engine.Engine, version float64, w http.ResponseWriter, r *ht
<ide> return err
<ide> }
<ide>
<del> w.Header().Set("Content-Type", "application/json")
<ide> var job = eng.Job("events", r.RemoteAddr)
<del> job.Stdout.Add(utils.NewWriteFlusher(w))
<add> streamJSON(job, w, true)
<ide> job.Setenv("since", r.Form.Get("since"))
<ide> return job.Run()
<ide> }
<ide> func getImagesHistory(eng *engine.Engine, version float64, w http.ResponseWriter
<ide> }
<ide>
<ide> var job = eng.Job("history", vars["name"])
<del> job.Stdout.Add(w)
<add> streamJSON(job, w, false)
<ide>
<ide> if err := job.Run(); err != nil {
<ide> return err
<ide> func getContainersChanges(eng *engine.Engine, version float64, w http.ResponseWr
<ide> return fmt.Errorf("Missing parameter")
<ide> }
<ide> var job = eng.Job("changes", vars["name"])
<del> job.Stdout.Add(w)
<add> streamJSON(job, w, false)
<ide>
<ide> return job.Run()
<ide> }
<ide> func getContainersTop(eng *engine.Engine, version float64, w http.ResponseWriter
<ide> }
<ide>
<ide> job := eng.Job("top", vars["name"], r.Form.Get("ps_args"))
<del> job.Stdout.Add(w)
<add> streamJSON(job, w, false)
<ide> return job.Run()
<ide> }
<ide>
<ide> func getContainersJSON(eng *engine.Engine, version float64, w http.ResponseWrite
<ide> job.Setenv("limit", r.Form.Get("limit"))
<ide>
<ide> if version >= 1.5 {
<del> w.Header().Set("Content-Type", "application/json")
<del> job.Stdout.Add(w)
<add> streamJSON(job, w, false)
<ide> } else if outs, err = job.Stdout.AddTable(); err != nil {
<ide> return err
<ide> }
<ide> func postImagesCreate(eng *engine.Engine, version float64, w http.ResponseWriter
<ide> job.Stdin.Add(r.Body)
<ide> }
<ide>
<del> job.SetenvBool("json", version > 1.0)
<del> job.Stdout.Add(utils.NewWriteFlusher(w))
<add> if version > 1.0 {
<add> job.SetenvBool("json", true)
<add> streamJSON(job, w, true)
<add> } else {
<add> job.Stdout.Add(utils.NewWriteFlusher(w))
<add> }
<ide> if err := job.Run(); err != nil {
<ide> if !job.Stdout.Used() {
<ide> return err
<ide> func getImagesSearch(eng *engine.Engine, version float64, w http.ResponseWriter,
<ide> var job = eng.Job("search", r.Form.Get("term"))
<ide> job.SetenvJson("metaHeaders", metaHeaders)
<ide> job.SetenvJson("authConfig", authConfig)
<del> job.Stdout.Add(w)
<add> streamJSON(job, w, false)
<ide>
<ide> return job.Run()
<ide> }
<ide> func postImagesInsert(eng *engine.Engine, version float64, w http.ResponseWriter
<ide> }
<ide>
<ide> job := eng.Job("insert", vars["name"], r.Form.Get("url"), r.Form.Get("path"))
<del> job.SetenvBool("json", version > 1.0)
<del> job.Stdout.Add(w)
<add> if version > 1.0 {
<add> job.SetenvBool("json", true)
<add> streamJSON(job, w, false)
<add> } else {
<add> job.Stdout.Add(w)
<add> }
<ide> if err := job.Run(); err != nil {
<ide> if !job.Stdout.Used() {
<ide> return err
<ide> func postImagesPush(eng *engine.Engine, version float64, w http.ResponseWriter,
<ide> job := eng.Job("push", vars["name"])
<ide> job.SetenvJson("metaHeaders", metaHeaders)
<ide> job.SetenvJson("authConfig", authConfig)
<del> job.SetenvBool("json", version > 1.0)
<del> job.Stdout.Add(utils.NewWriteFlusher(w))
<add> if version > 1.0 {
<add> job.SetenvBool("json", true)
<add> streamJSON(job, w, true)
<add> } else {
<add> job.Stdout.Add(utils.NewWriteFlusher(w))
<add> }
<ide>
<ide> if err := job.Run(); err != nil {
<ide> if !job.Stdout.Used() {
<ide> func deleteImages(eng *engine.Engine, version float64, w http.ResponseWriter, r
<ide> return fmt.Errorf("Missing parameter")
<ide> }
<ide> var job = eng.Job("image_delete", vars["name"])
<del> job.Stdout.Add(w)
<add> streamJSON(job, w, false)
<ide> job.SetenvBool("autoPrune", version > 1.1)
<ide>
<ide> return job.Run()
<ide> func getContainersByName(eng *engine.Engine, version float64, w http.ResponseWri
<ide> return fmt.Errorf("Missing parameter")
<ide> }
<ide> var job = eng.Job("inspect", vars["name"], "container")
<del> job.Stdout.Add(w)
<add> streamJSON(job, w, false)
<ide> job.SetenvBool("conflict", true) //conflict=true to detect conflict between containers and images in the job
<ide> return job.Run()
<ide> }
<ide> func getImagesByName(eng *engine.Engine, version float64, w http.ResponseWriter,
<ide> return fmt.Errorf("Missing parameter")
<ide> }
<ide> var job = eng.Job("inspect", vars["name"], "image")
<del> job.Stdout.Add(w)
<add> streamJSON(job, w, false)
<ide> job.SetenvBool("conflict", true) //conflict=true to detect conflict between containers and images in the job
<ide> return job.Run()
<ide> }
<ide> func postBuild(eng *engine.Engine, version float64, w http.ResponseWriter, r *ht
<ide> }
<ide>
<ide> if version >= 1.8 {
<del> w.Header().Set("Content-Type", "application/json")
<ide> job.SetenvBool("json", true)
<add> streamJSON(job, w, true)
<add> } else {
<add> job.Stdout.Add(utils.NewWriteFlusher(w))
<ide> }
<del>
<del> job.Stdout.Add(utils.NewWriteFlusher(w))
<ide> job.Stdin.Add(r.Body)
<ide> job.Setenv("remote", r.FormValue("remote"))
<ide> job.Setenv("t", r.FormValue("t"))
<ide> func postContainersCopy(eng *engine.Engine, version float64, w http.ResponseWrit
<ide> }
<ide>
<ide> job := eng.Job("container_copy", vars["name"], copyData.Get("Resource"))
<del> job.Stdout.Add(w)
<add> streamJSON(job, w, false)
<ide> if err := job.Run(); err != nil {
<ide> utils.Errorf("%s", err.Error())
<ide> } | 1 |
Mixed | Javascript | fix autoskip logic | cc65c2bac28c8779b7d96f69470347fbfd6e2e83 | <ide><path>docs/migration/v4-migration.md
<ide> A number of changes were made to the configuration options passed to the `Chart`
<ide> * If the tooltip callback returns `undefined`, then the default callback will be used.
<ide> * `maintainAspectRatio` respects container height.
<ide> * Time and timeseries scales use `ticks.stepSize` instead of `time.stepSize`, which has been removed.
<add>* `maxTickslimit` wont be used for the ticks in `autoSkip` if the determined max ticks is less then the `maxTicksLimit`.
<ide>
<ide> #### Type changes
<ide> * The order of the `ChartMeta` parameters have been changed from `<Element, DatasetElement, Type>` to `<Type, Element, DatasetElement>`.
<ide><path>src/core/core.scale.autoskip.js
<ide> import {_factorize} from '../helpers/helpers.math';
<ide> */
<ide> export function autoSkip(scale, ticks) {
<ide> const tickOpts = scale.options.ticks;
<del> const ticksLimit = tickOpts.maxTicksLimit || determineMaxTicks(scale);
<add> const determinedMaxTicks = determineMaxTicks(scale);
<add> const ticksLimit = Math.min(tickOpts.maxTicksLimit || determinedMaxTicks, determinedMaxTicks);
<ide> const majorIndices = tickOpts.major.enabled ? getMajorIndices(ticks) : [];
<ide> const numMajorIndices = majorIndices.length;
<ide> const first = majorIndices[0];
<ide><path>test/specs/core.scale.tests.js
<ide> describe('Core.scale', function() {
<ide> });
<ide> }
<ide>
<add> function getChartBigData(maxTicksLimit) {
<add> return window.acquireChart({
<add> type: 'line',
<add> data: {
<add> labels: new Array(300).fill('red'),
<add> datasets: [{
<add> data: new Array(300).fill(5),
<add> }]
<add> },
<add> options: {
<add> scales: {
<add> x: {
<add> ticks: {
<add> autoSkip: true,
<add> maxTicksLimit
<add> }
<add> }
<add> }
<add> }
<add> });
<add> }
<add>
<ide> function lastTick(chart) {
<ide> var xAxis = chart.scales.x;
<ide> var ticks = xAxis.getTicks();
<ide> return ticks[ticks.length - 1];
<ide> }
<ide>
<add> it('should use autoSkip amount of ticks when maxTicksLimit is set to a larger number as autoSkip calculation', function() {
<add> var chart = getChartBigData(300);
<add> expect(chart.scales.x.ticks.length).toEqual(20);
<add> });
<add>
<add> it('should use maxTicksLimit amount of ticks when maxTicksLimit is set to a smaller number as autoSkip calculation', function() {
<add> var chart = getChartBigData(3);
<add> expect(chart.scales.x.ticks.length).toEqual(3);
<add> });
<add>
<ide> it('should display the last tick if it fits evenly with other ticks', function() {
<ide> var chart = getChart({
<ide> labels: [ | 3 |
Ruby | Ruby | improve documentation for subscribe block | 5917c6eb285b0327ab340ee2933db88d5f5ba3bd | <ide><path>activesupport/lib/active_support/notifications.rb
<ide> module ActiveSupport
<ide> # == Subscribers
<ide> #
<ide> # You can consume those events and the information they provide by registering
<del> # a subscriber. For instance, let's store all "render" events in an array:
<add> # a subscriber.
<add> #
<add> # ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload|
<add> # name # => String, name of the event (such as 'render' from above)
<add> # start # => Time, when the instrumented block started execution
<add> # finish # => Time, when the instrumented block ended execution
<add> # id # => String, unique ID for this notification
<add> # payload # => Hash, the payload
<add> # end
<add> #
<add> # For instance, let's store all "render" events in an array:
<ide> #
<ide> # events = []
<ide> # | 1 |
Go | Go | create generic backend to cut dependency on daemon | 836df9c4469db89ba2fecfe512ce67003a61cc1e | <ide><path>api/server/router/volume/backend.go
<add>package volume
<add>
<add>import (
<add> // TODO return types need to be refactored into pkg
<add> "github.com/docker/docker/api/types"
<add>)
<add>
<add>// Backend is the methods that need to be implemented to provide
<add>// volume specific functionality
<add>type Backend interface {
<add> Volumes(filter string) ([]*types.Volume, error)
<add> VolumeInspect(name string) (*types.Volume, error)
<add> VolumeCreate(name, driverName string,
<add> opts map[string]string) (*types.Volume, error)
<add> VolumeRm(name string) error
<add>}
<ide><path>api/server/router/volume/volume.go
<ide> package volume
<ide> import (
<ide> "github.com/docker/docker/api/server/router"
<ide> "github.com/docker/docker/api/server/router/local"
<del> "github.com/docker/docker/daemon"
<ide> )
<ide>
<ide> // volumesRouter is a router to talk with the volumes controller
<ide> type volumeRouter struct {
<del> daemon *daemon.Daemon
<del> routes []router.Route
<add> backend Backend
<add> routes []router.Route
<ide> }
<ide>
<ide> // NewRouter initializes a new volumes router
<del>func NewRouter(d *daemon.Daemon) router.Router {
<add>func NewRouter(b Backend) router.Router {
<ide> r := &volumeRouter{
<del> daemon: d,
<add> backend: b,
<ide> }
<ide> r.initRoutes()
<ide> return r
<ide><path>api/server/router/volume/volume_routes.go
<ide> func (v *volumeRouter) getVolumesList(ctx context.Context, w http.ResponseWriter
<ide> return err
<ide> }
<ide>
<del> volumes, err := v.daemon.Volumes(r.Form.Get("filters"))
<add> volumes, err := v.backend.Volumes(r.Form.Get("filters"))
<ide> if err != nil {
<ide> return err
<ide> }
<ide> func (v *volumeRouter) getVolumeByName(ctx context.Context, w http.ResponseWrite
<ide> return err
<ide> }
<ide>
<del> volume, err := v.daemon.VolumeInspect(vars["name"])
<add> volume, err := v.backend.VolumeInspect(vars["name"])
<ide> if err != nil {
<ide> return err
<ide> }
<ide> func (v *volumeRouter) postVolumesCreate(ctx context.Context, w http.ResponseWri
<ide> return err
<ide> }
<ide>
<del> volume, err := v.daemon.VolumeCreate(req.Name, req.Driver, req.DriverOpts)
<add> volume, err := v.backend.VolumeCreate(req.Name, req.Driver, req.DriverOpts)
<ide> if err != nil {
<ide> return err
<ide> }
<ide> func (v *volumeRouter) deleteVolumes(ctx context.Context, w http.ResponseWriter,
<ide> if err := httputils.ParseForm(r); err != nil {
<ide> return err
<ide> }
<del> if err := v.daemon.VolumeRm(vars["name"]); err != nil {
<add> if err := v.backend.VolumeRm(vars["name"]); err != nil {
<ide> return err
<ide> }
<ide> w.WriteHeader(http.StatusNoContent) | 3 |
Python | Python | set default value for cidr | 60580b051909bb53615c8d03de124ad14e0ae2b1 | <ide><path>libcloud/compute/drivers/gce.py
<ide> def ex_create_subnetwork(self, name, cidr=None, network=None, region=None,
<ide>
<ide> return self.ex_get_subnetwork(name, region_name)
<ide>
<del> def ex_create_network(self, name, cidr, description=None, mode="auto"):
<add> def ex_create_network(self, name, cidr=None, description=None, mode="auto"):
<ide> """
<ide> Create a network. In November 2015, Google introduced Subnetworks and
<ide> suggests using networks with 'auto' generated subnetworks. See, the | 1 |
Java | Java | refine solution for 21de09 | 21d069695f301851254ff2d03b44478303f24806 | <ide><path>spring-web/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpConnector.java
<ide> public Mono<ClientHttpResponse> connect(HttpMethod method, URI uri,
<ide> .next()
<ide> .doOnCancel(() -> {
<ide> ReactorClientHttpResponse response = responseRef.get();
<del> if (response != null && response.bodyNotSubscribed()) {
<del> response.getConnection().dispose();
<add> if (response != null) {
<add> response.releaseAfterCancel(method);
<ide> }
<ide> });
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpResponse.java
<ide> import java.util.function.BiFunction;
<ide>
<ide> import io.netty.buffer.ByteBufAllocator;
<add>import org.apache.commons.logging.Log;
<add>import org.apache.commons.logging.LogFactory;
<ide> import reactor.core.publisher.Flux;
<ide> import reactor.netty.Connection;
<ide> import reactor.netty.NettyInbound;
<ide> import org.springframework.core.io.buffer.DataBuffer;
<ide> import org.springframework.core.io.buffer.NettyDataBufferFactory;
<ide> import org.springframework.http.HttpHeaders;
<add>import org.springframework.http.HttpMethod;
<ide> import org.springframework.http.HttpStatus;
<ide> import org.springframework.http.ResponseCookie;
<ide> import org.springframework.lang.Nullable;
<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> */
<ide> class ReactorClientHttpResponse implements ClientHttpResponse {
<ide>
<add> private static final Log logger = LogFactory.getLog(ReactorClientHttpResponse.class);
<add>
<ide> private final NettyDataBufferFactory bufferFactory;
<ide>
<ide> private final HttpClientResponse response;
<ide>
<ide> private final NettyInbound inbound;
<ide>
<ide> @Nullable
<del> private final Connection connection;
<add> private final String logPrefix;
<ide>
<del> // 0 - not subscribed, 1 - subscribed, 2 - cancelled
<add> // 0 - not subscribed, 1 - subscribed, 2 - cancelled, 3 - cancelled via connector (before subscribe)
<ide> private final AtomicInteger state = new AtomicInteger(0);
<ide>
<ide>
<ide> public ReactorClientHttpResponse(HttpClientResponse response, Connection connect
<ide> this.response = response;
<ide> this.inbound = connection.inbound();
<ide> this.bufferFactory = new NettyDataBufferFactory(connection.outbound().alloc());
<del> this.connection = connection;
<add> this.logPrefix = (logger.isDebugEnabled() ? "[" + connection.channel().id().asShortText() + "] " : "");
<ide> }
<ide>
<ide> /**
<ide> public ReactorClientHttpResponse(HttpClientResponse response, NettyInbound inbou
<ide> this.response = response;
<ide> this.inbound = inbound;
<ide> this.bufferFactory = new NettyDataBufferFactory(alloc);
<del> this.connection = null;
<add> this.logPrefix = "";
<ide> }
<ide>
<ide>
<ide> @Override
<ide> public Flux<DataBuffer> getBody() {
<ide> return this.inbound.receive()
<ide> .doOnSubscribe(s -> {
<del> if (!this.state.compareAndSet(0, 1)) {
<del> // https://github.com/reactor/reactor-netty/issues/503
<del> // FluxReceive rejects multiple subscribers, but not after a cancel().
<del> // Subsequent subscribers after cancel() will not be rejected, but will hang instead.
<del> // So we need to reject once in cancelled state.
<del> if (this.state.get() == 2) {
<del> throw new IllegalStateException("The client response body can only be consumed once.");
<del> }
<add> if (this.state.compareAndSet(0, 1)) {
<add> return;
<add> }
<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 reject once in cancelled state.
<add> if (this.state.get() == 2) {
<add> throw new IllegalStateException(
<add> "The client response body can only be consumed once.");
<add> }
<add> else if (this.state.get() == 3) {
<add> throw new IllegalStateException(
<add> "The client response body has been released already due to cancellation.");
<ide> }
<ide> })
<ide> .doOnCancel(() -> this.state.compareAndSet(1, 2))
<ide> public MultiValueMap<String, ResponseCookie> getCookies() {
<ide> MultiValueMap<String, ResponseCookie> result = new LinkedMultiValueMap<>();
<ide> this.response.cookies().values().stream().flatMap(Collection::stream)
<ide> .forEach(c ->
<add>
<ide> result.add(c.name(), ResponseCookie.fromClientResponse(c.name(), c.value())
<ide> .domain(c.domain())
<ide> .path(c.path())
<ide> public MultiValueMap<String, ResponseCookie> getCookies() {
<ide> }
<ide>
<ide> /**
<del> * For use by {@link ReactorClientHttpConnector}.
<add> * Called by {@link ReactorClientHttpConnector} when a cancellation is detected
<add> * but the content has not been subscribed to. If the subscription never
<add> * materializes then the content will remain not drained. Or it could still
<add> * materialize if the cancellation happened very early, or the response
<add> * reading was delayed for some reason.
<ide> */
<del> boolean bodyNotSubscribed() {
<del> return this.state.get() == 0;
<add> void releaseAfterCancel(HttpMethod method) {
<add> if (mayHaveBody(method) && this.state.compareAndSet(0, 3)) {
<add> if (logger.isDebugEnabled()) {
<add> logger.debug(this.logPrefix + "Releasing body, not yet subscribed.");
<add> }
<add> this.inbound.receive().doOnNext(byteBuf -> {}).subscribe(byteBuf -> {}, ex -> {});
<add> }
<ide> }
<ide>
<del> /**
<del> * For use by {@link ReactorClientHttpConnector}.
<del> */
<del> Connection getConnection() {
<del> Assert.notNull(this.connection, "Constructor with connection wasn't used");
<del> return this.connection;
<add> private boolean mayHaveBody(HttpMethod method) {
<add> int code = this.getRawStatusCode();
<add> return !((code >= 100 && code < 200) || code == 204 || code == 205 ||
<add> method.equals(HttpMethod.HEAD) || getHeaders().getContentLength() == 0);
<ide> }
<ide>
<ide> @Override | 2 |
Python | Python | add newline to task failed log message | 97aee1816b89b7f94260afd1e814aca31ae972c3 | <ide><path>celery/worker/job.py
<ide> # says "trailing whitespace" ;)
<ide> EMAIL_SIGNATURE_SEP = "-- "
<ide> TASK_ERROR_EMAIL_BODY = """
<del>Task %%(name)s with id %%(id)s raised exception: %%(exc)s
<add>Task %%(name)s with id %%(id)s raised exception:\n%%(exc)s
<ide>
<ide>
<ide> Task was called with args: %%(args)s kwargs: %%(kwargs)s. | 1 |
Mixed | Javascript | update helper scripts | 17a7a84b48621414214cd41f43d066ba8fb8126c | <ide><path>tools/challenge-helper-scripts/README.md
<ide> A one-off script that automatically adds a new step between two existing consecu
<ide> 1. Change to the directory of the project.
<ide> 2. Run the following npm command:
<ide> ```bash
<del> npm run create-step-between start=X end=Y # where X is the starting step number and Y is the following step number.
<add> npm run create-step-between start=X # where X is the starting step number
<ide> ```
<ide>
<ide> ## [delete-step.js](delete-step.js)
<ide><path>tools/challenge-helper-scripts/create-empty-steps.js
<ide> if (!num) {
<ide> num = parseInt(num, 10);
<ide> const stepStart = parseInt(start, 10);
<ide>
<del>if (num < 1 || num > 20) {
<del> throw `No steps created. arg 'num' must be between 1 and 20 inclusive`;
<add>if (num < 1 || num > 100) {
<add> throw `No steps created. arg 'num' must be between 1 and 100 inclusive`;
<ide> }
<ide>
<ide> const maxStepNum = stepStart + num - 1;
<ide><path>tools/challenge-helper-scripts/create-step-between.js
<ide> const allStepsExist = (steps, stepsToFind) =>
<ide> const projectPath = getProjectPath();
<ide> const args = getArgValues(process.argv);
<ide>
<del>let { start, end } = args;
<del>start = parseInt(start, 10);
<del>end = parseInt(end, 10);
<add>const start = parseInt(args.start, 10);
<ide>
<del>if (
<del> !Number.isInteger(start) ||
<del> !Number.isInteger(end) ||
<del> start < 1 ||
<del> start !== end - 1
<del>) {
<del> throw (
<del> 'Step not created. Steps specified must be' +
<del> ' consecutive numbers and start step must be greater than 0.'
<del> );
<add>if (!Number.isInteger(start) || start < 1) {
<add> throw 'Step not created. Start step must be greater than 0.';
<ide> }
<ide>
<add>const end = start + 1;
<add>
<ide> const existingSteps = getExistingStepNums(projectPath);
<ide> if (!allStepsExist(existingSteps, [start, end])) {
<del> throw 'Step not created. At least one of the steps specified does not exist.';
<add> throw `Step not created. Both start step, ${start}, and end step, ${end}, must exist`;
<ide> }
<ide>
<ide> const challengeSeeds = getChallengeSeeds(
<ide><path>tools/challenge-helper-scripts/utils.js
<ide> ${seedTails}`
<ide> id: ${ObjectID.generate()}
<ide> title: Part ${stepNum}
<ide> challengeType: 0
<add>dashedName: part-${stepNum}
<ide> ---
<ide>
<ide> # --description--
<ide> const reorderSteps = () => {
<ide> const challengeID = frontMatter.data.id || ObjectID.generate();
<ide> const title =
<ide> newFileName === 'final.md' ? 'Final Prototype' : `Part ${newStepNum}`;
<add> const dashedName = `part-${newStepNum}`;
<ide> challengeOrder.push(['' + challengeID, title]);
<ide> const newData = {
<ide> ...frontMatter.data,
<ide> id: challengeID,
<del> title
<add> title,
<add> dashedName
<ide> };
<ide> fs.writeFileSync(filePath, frontMatter.stringify(newData));
<ide> }); | 4 |
Ruby | Ruby | add test case for abstractmysqladapter#execute | 8f5095a7a0127c9f17f28816e90dd82e537727bc | <ide><path>activerecord/test/cases/adapters/abstract_mysql_adapter_test.rb
<add># frozen_string_literal: true
<add>
<add>require "cases/helper"
<add>
<add>class AbstractMysqlAdapterTest < ActiveRecord::Mysql2TestCase
<add> class ExampleMysqlAdapter < ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter; end
<add>
<add> def setup
<add> @conn = ExampleMysqlAdapter.new(
<add> ActiveRecord::ConnectionAdapters::Mysql2Adapter.new_client({}),
<add> ActiveRecord::Base.logger,
<add> nil,
<add> { socket: File::NULL }
<add> )
<add> end
<add>
<add> def test_execute_not_raising_error
<add> assert_nothing_raised do
<add> @conn.execute("SELECT 1")
<add> end
<add> end
<add>end | 1 |
Ruby | Ruby | use gcc 4.2 as the default compiler when installed | 2c9fd850f35d30e99ac72946c3fdb88abf21a940 | <ide><path>Library/Homebrew/os/mac.rb
<ide> def default_cc
<ide>
<ide> def default_compiler
<ide> case default_cc
<del> when /^gcc-4.0/ then :gcc_4_0
<add> # if GCC 4.2 is installed, e.g. via Tigerbrew, prefer it
<add> # over the system's GCC 4.0
<add> when /^gcc-4.0/ then gcc_42_build_version ? :gcc : :gcc_4_0
<ide> when /^gcc/ then :gcc
<ide> when /^llvm/ then :llvm
<ide> when "clang" then :clang | 1 |
Javascript | Javascript | save users into new `user` collection | 28f273e7ee82dc75ebfe0bc8011e7de1f27384b9 | <ide><path>seed/flattenUser.js
<ide> function createConnection(URI) {
<ide> });
<ide> }
<ide>
<del>function createQuery(db, collection, selection, options, batchSize) {
<add>function createQuery(db, collection, options, batchSize) {
<ide> return Rx.Observable.create(function (observer) {
<ide> console.log('Creating cursor...');
<del> var cursor = db.collection(collection).find(selection, options);
<add> var cursor = db.collection(collection).find({}, options);
<ide> cursor.batchSize(batchSize || 20);
<ide> // Cursor.each will yield all doc from a batch in the same tick,
<ide> // or schedule getting next batch on nextTick
<ide> function createQuery(db, collection, selection, options, batchSize) {
<ide> });
<ide> }
<ide>
<del>function saveUser(user) {
<add>function insertMany(db, collection, users, options) {
<ide> return Rx.Observable.create(function(observer) {
<del> user.save(function(err) {
<add> db.collection(collection).insertMany(users, options, function(err) {
<ide> if (err) {
<ide> return observer.onError(err);
<ide> }
<ide> function saveUser(user) {
<ide> }
<ide>
<ide> var count = 0;
<del>createConnection(secrets.db)
<add>// will supply our db object
<add>var dbObservable = createConnection(secrets.db).shareReplay();
<add>dbObservable
<ide> .flatMap(function(db) {
<add> // returns user document, n users per loop where n is the batchsize.
<ide> return createQuery(db, 'users', {});
<ide> })
<ide> .map(function(user) {
<add> // flatten user
<ide> assign(user, user.portfolio, user.profile);
<ide> return user;
<ide> })
<del> .flatMap(function(user) {
<del> return saveUser(user);
<add> // batch them into arrays of twenty documents
<add> .bufferWithCount(20)
<add> // get bd object ready for insert
<add> .withLatestFrom(dbObservable, function(users, db) {
<add> return {
<add> users: users,
<add> db: db
<add> };
<ide> })
<add> .flatMap(function(dats) {
<add> // bulk insert into new collection for loopback
<add> return insertMany(dats.db, 'user', dats.users, { w: 1 });
<add> })
<add> // count how many times insert completes
<ide> .count()
<ide> .subscribe(
<ide> function(_count) {
<del> count = _count;
<add> count = _count * 20;
<ide> },
<ide> function(err) {
<ide> console.log('an error occured', err); | 1 |
Go | Go | use proc/exe for reexec | 59ec65cd8cec942cee6cbf2b8327ec57eb5078f0 | <ide><path>daemon/oci_linux.go
<ide> func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
<ide>
<ide> for _, ns := range s.Linux.Namespaces {
<ide> if ns.Type == "network" && ns.Path == "" && !c.Config.NetworkDisabled {
<del> target, err := os.Readlink(filepath.Join("/proc", strconv.Itoa(os.Getpid()), "exe"))
<del> if err != nil {
<del> return nil, err
<del> }
<del>
<add> target := filepath.Join("/proc", strconv.Itoa(os.Getpid()), "exe")
<ide> s.Hooks = &specs.Hooks{
<ide> Prestart: []specs.Hook{{
<del> Path: target, // FIXME: cross-platform
<add> Path: target,
<ide> Args: []string{"libnetwork-setkey", c.ID, daemon.netController.ID()},
<ide> }},
<ide> } | 1 |
Ruby | Ruby | clarify comment concerning whitespace | a6877c02b02d9479794606bda26778cf4551e536 | <ide><path>Library/Contributions/examples/brew-pull.rb
<ide> # Store current revision
<ide> revision = `git log -n1 --format=%H`.strip()
<ide>
<del> # Makes sense to squash whitespace errors, we don't want them.
<ide> ohai 'Applying patch'
<ide> patch_args = %w[am --signoff]
<add> # Normally we don't want whitespace errors, but squashing them can break
<add> # patches so an option is provided to skip this step.
<ide> patch_args << '--whitespace=fix' unless ARGV.include? '--ignore-whitespace'
<ide> patch_args << patchpath
<ide> | 1 |
Javascript | Javascript | increase coverage for punycode's decode | 3160b0286d030b182f9508b9a9cda79a74a98186 | <ide><path>test/parallel/test-punycode.js
<ide> assert.strictEqual(
<ide> 'Willst du die Blüthe des frühen, die Früchte des späteren Jahres'
<ide> );
<ide> assert.strictEqual(punycode.decode('wgv71a119e'), '日本語');
<add>assert.throws(() => {
<add> punycode.decode(' ');
<add>}, /^RangeError: Invalid input$/);
<add>assert.throws(() => {
<add> punycode.decode('α-');
<add>}, /^RangeError: Illegal input >= 0x80 \(not a basic code point\)$/);
<add>assert.throws(() => {
<add> punycode.decode('あ');
<add>}, /^RangeError: Overflow: input needs wider integers to process$/);
<ide>
<ide> // http://tools.ietf.org/html/rfc3492#section-7.1
<ide> const tests = [ | 1 |
Javascript | Javascript | expose handlebars as a global | dfdec1f9a1f3ba3b403d5e0849707f1f8f9f8321 | <ide><path>packages/handlebars/lib/main.js
<ide> if (typeof module !== 'undefined' && require.main === module) {
<ide> };
<ide> ;
<ide> // lib/handlebars/base.js
<del>var Handlebars = {};
<add>Handlebars = {};
<ide>
<ide> Handlebars.VERSION = "1.0.beta.2";
<ide> | 1 |
Mixed | Go | make http usage for registry explicit | 380c8320a78dc16da65d9d13004422ac5a0cca53 | <ide><path>daemon/config.go
<ide> type Config struct {
<ide> BridgeIface string
<ide> BridgeIP string
<ide> FixedCIDR string
<add> InsecureRegistries []string
<ide> InterContainerCommunication bool
<ide> GraphDriver string
<ide> GraphOptions []string
<ide> func (config *Config) InstallFlags() {
<ide> flag.StringVar(&config.BridgeIP, []string{"#bip", "-bip"}, "", "Use this CIDR notation address for the network bridge's IP, not compatible with -b")
<ide> flag.StringVar(&config.BridgeIface, []string{"b", "-bridge"}, "", "Attach containers to a pre-existing network bridge\nuse 'none' to disable container networking")
<ide> flag.StringVar(&config.FixedCIDR, []string{"-fixed-cidr"}, "", "IPv4 subnet for fixed IPs (ex: 10.20.0.0/16)\nthis subnet must be nested in the bridge subnet (which is defined by -b or --bip)")
<add> opts.ListVar(&config.InsecureRegistries, []string{"-insecure-registry"}, "Make these registries use http")
<ide> flag.BoolVar(&config.InterContainerCommunication, []string{"#icc", "-icc"}, true, "Enable inter-container communication")
<ide> flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Force the Docker runtime to use a specific storage driver")
<ide> flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, "native", "Force the Docker runtime to use a specific exec driver")
<ide><path>daemon/daemon.go
<ide> func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
<ide> }
<ide>
<ide> log.Debugf("Creating repository list")
<del> repositories, err := graph.NewTagStore(path.Join(config.Root, "repositories-"+driver.String()), g, config.Mirrors)
<add> repositories, err := graph.NewTagStore(path.Join(config.Root, "repositories-"+driver.String()), g, config.Mirrors, config.InsecureRegistries)
<ide> if err != nil {
<ide> return nil, fmt.Errorf("Couldn't create Tag store: %s", err)
<ide> }
<ide><path>docs/sources/reference/commandline/cli.md
<ide> expect an integer, and they can only be specified once.
<ide> -g, --graph="/var/lib/docker" Path to use as the root of the Docker runtime
<ide> -H, --host=[] The socket(s) to bind to in daemon mode or connect to in client mode, specified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.
<ide> --icc=true Enable inter-container communication
<del> --ip=0.0.0.0 Default IP address to use when binding container ports
<add> --insecure-registry=[] Make these registries use http
<add> --ip=0.0.0.0 Default IP address to use when binding container ports
<ide> --ip-forward=true Enable net.ipv4.ip_forward
<ide> --ip-masq=true Enable IP masquerading for bridge's IP range
<ide> --iptables=true Enable Docker's addition of iptables rules
<ide><path>graph/pull.go
<ide> func (s *TagStore) CmdPull(job *engine.Job) engine.Status {
<ide> return job.Error(err)
<ide> }
<ide>
<del> endpoint, err := registry.NewEndpoint(hostname)
<add> secure := registry.IsSecure(hostname, s.InsecureRegistries)
<add>
<add> endpoint, err := registry.NewEndpoint(hostname, secure)
<ide> if err != nil {
<ide> return job.Error(err)
<ide> }
<ide><path>graph/push.go
<ide> func (s *TagStore) CmdPush(job *engine.Job) engine.Status {
<ide> return job.Error(err)
<ide> }
<ide>
<del> endpoint, err := registry.NewEndpoint(hostname)
<add> secure := registry.IsSecure(hostname, s.InsecureRegistries)
<add>
<add> endpoint, err := registry.NewEndpoint(hostname, secure)
<ide> if err != nil {
<ide> return job.Error(err)
<ide> }
<ide><path>graph/tags.go
<ide> var (
<ide> )
<ide>
<ide> type TagStore struct {
<del> path string
<del> graph *Graph
<del> mirrors []string
<del> Repositories map[string]Repository
<add> path string
<add> graph *Graph
<add> mirrors []string
<add> InsecureRegistries []string
<add> Repositories map[string]Repository
<ide> sync.Mutex
<ide> // FIXME: move push/pull-related fields
<ide> // to a helper type
<ide> func (r Repository) Contains(u Repository) bool {
<ide> return true
<ide> }
<ide>
<del>func NewTagStore(path string, graph *Graph, mirrors []string) (*TagStore, error) {
<add>func NewTagStore(path string, graph *Graph, mirrors []string, insecureRegistries []string) (*TagStore, error) {
<ide> abspath, err := filepath.Abs(path)
<ide> if err != nil {
<ide> return nil, err
<ide> }
<ide> store := &TagStore{
<del> path: abspath,
<del> graph: graph,
<del> mirrors: mirrors,
<del> Repositories: make(map[string]Repository),
<del> pullingPool: make(map[string]chan struct{}),
<del> pushingPool: make(map[string]chan struct{}),
<add> path: abspath,
<add> graph: graph,
<add> mirrors: mirrors,
<add> InsecureRegistries: insecureRegistries,
<add> Repositories: make(map[string]Repository),
<add> pullingPool: make(map[string]chan struct{}),
<add> pushingPool: make(map[string]chan struct{}),
<ide> }
<ide> // Load the json file if it exists, otherwise create it.
<ide> if err := store.reload(); os.IsNotExist(err) {
<ide><path>registry/registry.go
<ide> func ResolveRepositoryName(reposName string) (string, string, error) {
<ide> return hostname, reposName, nil
<ide> }
<ide>
<add>// this method expands the registry name as used in the prefix of a repo
<add>// to a full url. if it already is a url, there will be no change.
<add>func ExpandAndVerifyRegistryUrl(hostname string, secure bool) (endpoint string, err error) {
<add> if strings.HasPrefix(hostname, "http:") || strings.HasPrefix(hostname, "https:") {
<add> // if there is no slash after https:// (8 characters) then we have no path in the url
<add> if strings.LastIndex(hostname, "/") < 9 {
<add> // there is no path given. Expand with default path
<add> hostname = hostname + "/v1/"
<add> }
<add> if _, err := pingRegistryEndpoint(hostname); err != nil {
<add> return "", errors.New("Invalid Registry endpoint: " + err.Error())
<add> }
<add> return hostname, nil
<add> }
<add>
<add> // use HTTPS if secure, otherwise use HTTP
<add> if secure {
<add> endpoint = fmt.Sprintf("https://%s/v1/", hostname)
<add> } else {
<add> endpoint = fmt.Sprintf("http://%s/v1/", hostname)
<add> }
<add> _, err = pingRegistryEndpoint(endpoint)
<add> if err != nil {
<add> //TODO: triggering highland build can be done there without "failing"
<add> err = fmt.Errorf("Invalid registry endpoint '%s': %s ", endpoint, err)
<add> if secure {
<add> err = fmt.Errorf("%s. If this private registry supports only HTTP, please add `--insecure-registry %s` to the daemon's arguments.", err, hostname)
<add> }
<add> return "", err
<add> }
<add> return endpoint, nil
<add>}
<add>
<add>// this method verifies if the provided hostname is part of the list of
<add>// insecure registries and returns false if HTTP should be used
<add>func IsSecure(hostname string, insecureRegistries []string) (secure bool) {
<add> secure = true
<add> for _, h := range insecureRegistries {
<add> if hostname == h {
<add> secure = false
<add> break
<add> }
<add> }
<add> if hostname == IndexServerAddress() {
<add> secure = true
<add> }
<add> return
<add>}
<add>
<ide> func trustedLocation(req *http.Request) bool {
<ide> var (
<ide> trusteds = []string{"docker.com", "docker.io"}
<ide><path>registry/service.go
<ide> func (s *Service) Auth(job *engine.Job) engine.Status {
<ide> job.GetenvJson("authConfig", authConfig)
<ide> // TODO: this is only done here because auth and registry need to be merged into one pkg
<ide> if addr := authConfig.ServerAddress; addr != "" && addr != IndexServerAddress() {
<del> endpoint, err := NewEndpoint(addr)
<add> endpoint, err := NewEndpoint(addr, true)
<ide> if err != nil {
<ide> return job.Error(err)
<ide> } | 8 |
PHP | PHP | add name() to table class | d5ceb6303f87fb0a70af7963845d413a09540859 | <ide><path>lib/Cake/Database/Schema/Table.php
<ide> public function __construct($table, $columns = array()) {
<ide> }
<ide> }
<ide>
<add>/**
<add> * Get the name of the table.
<add> *
<add> * @return string
<add> */
<add> public function name() {
<add> return $this->_table;
<add> }
<add>
<ide> /**
<ide> * Add a column to the table.
<ide> * | 1 |
PHP | PHP | reset plugincollection state better | 7745d0c1808ac6554f6d03d9eecbd10dcd672797 | <ide><path>src/Core/PluginCollection.php
<ide> public function remove($name)
<ide> public function clear()
<ide> {
<ide> $this->plugins = [];
<add> $this->names = [];
<add> $this->positions = [];
<add> $this->loopDepth = -1;
<ide>
<ide> return $this;
<ide> } | 1 |
PHP | PHP | remove duplicated tests | 605668517da68b4d58e94d966a41dc044271639c | <ide><path>tests/Support/SupportCollectionTest.php
<ide> public function testFlatten()
<ide> // Nested arrays containing collections containing arrays are flattened
<ide> $c = new Collection([['#foo', new Collection(['#bar', ['#zap']])], ['#baz']]);
<ide> $this->assertEquals(['#foo', '#bar', '#zap', '#baz'], $c->flatten()->all());
<del>
<del> // Can specify depth to flatten to
<del> $c = new Collection([['#foo', ['#bar']], '#baz']);
<del> $this->assertEquals(['#foo', ['#bar'], '#baz'], $c->flatten(1)->all());
<del>
<del> // Can specify depth to flatten to
<del> $c = new Collection([['#foo', ['#bar']], '#baz']);
<del> $this->assertEquals(['#foo', '#bar', '#baz'], $c->flatten(2)->all());
<ide> }
<ide>
<ide> public function testFlattenWithDepth() | 1 |
Python | Python | add debug option to scons command | 13bcd67d4dc01ddc9788fc252d1d8752c30c2ed8 | <ide><path>numpy/distutils/command/scons.py
<ide> class scons(old_build_ext):
<ide> ('compiler=', None, "specify the C compiler type"),
<ide> ('cxxcompiler=', None,
<ide> "specify the C++ compiler type (same as C by default)"),
<add> ('debug', 'g',
<add> "compile/link with debugging information"),
<ide> ] + library_options
<ide>
<ide> def initialize_options(self):
<ide> old_build_ext.initialize_options(self)
<ide> self.build_clib = None
<ide>
<add> self.debug = 0
<add>
<ide> self.compiler = None
<ide> self.cxxcompiler = None
<ide> self.fcompiler = None
<ide> def _call_scons(self, scons_exec, sconscript, pkg_name, bootstrapping):
<ide> else:
<ide> cmd.append('cc_opt=%s' % self.scons_compiler)
<ide>
<add> cmd.append('debug=%s' % self.debug)
<add>
<ide> if self.scons_fcompiler:
<ide> cmd.append('f77_opt=%s' % self.scons_fcompiler)
<ide> if self.scons_fcompiler_path: | 1 |
Javascript | Javascript | use npm sandbox in test-npm-install | 1847670c88da5a10cdae6380b21af696b329471d | <ide><path>test/parallel/test-npm-install.js
<ide> const assert = require('assert');
<ide> const fs = require('fs');
<ide>
<ide> common.refreshTmpDir();
<add>const npmSandbox = path.join(common.tmpDir, 'npm-sandbox');
<add>fs.mkdirSync(npmSandbox);
<add>const installDir = path.join(common.tmpDir, 'install-dir');
<add>fs.mkdirSync(installDir);
<ide>
<ide> const npmPath = path.join(
<ide> common.testDir,
<ide> const pkgContent = JSON.stringify({
<ide> }
<ide> });
<ide>
<del>const pkgPath = path.join(common.tmpDir, 'package.json');
<add>const pkgPath = path.join(installDir, 'package.json');
<ide>
<ide> fs.writeFileSync(pkgPath, pkgContent);
<ide>
<ide> const env = Object.create(process.env);
<ide> env['PATH'] = path.dirname(process.execPath);
<add>env['NPM_CONFIG_PREFIX'] = path.join(npmSandbox, 'npm-prefix');
<add>env['NPM_CONFIG_TMP'] = path.join(npmSandbox, 'npm-tmp');
<add>env['HOME'] = path.join(npmSandbox, 'home');
<ide>
<ide> const proc = spawn(process.execPath, args, {
<del> cwd: common.tmpDir,
<add> cwd: installDir,
<ide> env: env
<ide> });
<ide>
<ide> function handleExit(code, signalCode) {
<ide> assert.equal(code, 0, 'npm install should run without an error');
<ide> assert.ok(signalCode === null, 'signalCode should be null');
<ide> assert.doesNotThrow(function() {
<del> fs.accessSync(common.tmpDir + '/node_modules/package-name');
<add> fs.accessSync(installDir + '/node_modules/package-name');
<ide> });
<ide> }
<ide> | 1 |
PHP | PHP | add optionparser options for fixtures command | eaaaef6ea4fd6cdd62f125271bfab71fc7355de2 | <ide><path>lib/Cake/Console/Command/UpgradeShell.php
<ide> public function getOptionParser() {
<ide> 'help' => __d('cake_console', 'Comma separated list of top level diretories to exclude.'),
<ide> 'default' => '',
<ide> ];
<add> $path = [
<add> 'help' => __d('cake_console', 'The path to update fixtures on.'),
<add> 'default' => APP . 'Test' . DS . 'Fixture' . DS,
<add> ];
<ide>
<ide> return parent::getOptionParser()
<ide> ->description(__d('cake_console', "A shell to help automate upgrading from CakePHP 3.0 to 2.x. \n" .
<ide> "Be sure to have a backup of your application before running these commands."))
<del> ->addSubcommand('all', array(
<add> ->addSubcommand('all', [
<ide> 'help' => __d('cake_console', 'Run all upgrade commands.'),
<ide> 'parser' => ['options' => compact('plugin', 'dryRun')]
<del> ))
<del> ->addSubcommand('locations', array(
<add> ])
<add> ->addSubcommand('locations', [
<ide> 'help' => __d('cake_console', 'Move files/directories around. Run this *before* adding namespaces with the namespaces command.'),
<ide> 'parser' => ['options' => compact('plugin', 'dryRun', 'git')]
<del> ))
<del> ->addSubcommand('namespaces', array(
<add> ])
<add> ->addSubcommand('namespaces', [
<ide> 'help' => __d('cake_console', 'Add namespaces to files based on their file path. Only run this *after* you have moved files.'),
<ide> 'parser' => ['options' => compact('plugin', 'dryRun', 'namespace', 'exclude')]
<del> ))
<del> ->addSubcommand('app_uses', array(
<add> ])
<add> ->addSubcommand('app_uses', [
<ide> 'help' => __d('cake_console', 'Replace App::uses() with use statements'),
<ide> 'parser' => ['options' => compact('plugin', 'dryRun')]
<del> ))
<del> ->addSubcommand('cache', array(
<add> ])
<add> ->addSubcommand('fixtures', [
<add> 'help' => __d('cake_console', 'Update fixtures to use new index/constraint features. This is necessary before running tests.'),
<add> 'parser' => ['options' => compact('plugin', 'dryRun', 'path')],
<add> ])
<add> ->addSubcommand('cache', [
<ide> 'help' => __d('cake_console', "Replace Cache::config() with Configure."),
<ide> 'parser' => ['options' => compact('plugin', 'dryRun')]
<del> ))
<del> ->addSubcommand('log', array(
<add> ])
<add> ->addSubcommand('log', [
<ide> 'help' => __d('cake_console', "Replace CakeLog::config() with Configure."),
<ide> 'parser' => ['options' => compact('plugin', 'dryRun')]
<del> ));
<add> ]);
<ide> }
<ide>
<ide> } | 1 |
Python | Python | fix the search dir of dispatchable sources | 7a4da65dff2466e5ae91e029743c075526977f60 | <ide><path>numpy/distutils/ccompiler_opt.py
<ide> def try_dispatch(self, sources, src_dir=None, **kwargs):
<ide>
<ide> for src in sources:
<ide> output_dir = os.path.dirname(src)
<del> if src_dir and not output_dir.startswith(src_dir):
<del> output_dir = os.path.join(src_dir, output_dir)
<add> if src_dir:
<add> if not output_dir.startswith(src_dir):
<add> output_dir = os.path.join(src_dir, output_dir)
<ide> if output_dir not in include_dirs:
<add> # To allow including the generated config header(*.dispatch.h)
<add> # by the dispatch-able sources
<ide> include_dirs.append(output_dir)
<ide>
<ide> has_baseline, targets, extra_flags = self.parse_targets(src) | 1 |
Javascript | Javascript | fix hmr when parent directory starts with '.' | 885eee802116b3ac9aa3ba0bf92aa0ad114c107b | <ide><path>server/hot-reloader.js
<ide> export default class HotReloader {
<ide> this.prevChunkHashes = chunkHashes
<ide> })
<ide>
<add> // We don’t watch .git .next/ and node_modules for changes
<ide> const ignored = [
<del> /(^|[/\\])\../, // .dotfiles
<add> /\.git/,
<add> /\.next\//,
<ide> /node_modules/
<ide> ]
<ide> | 1 |
Javascript | Javascript | update example to use a module | 7ccab812fde33f40f7fa30a48d4d6082257fd1d4 | <ide><path>src/ng/document.js
<ide> * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
<ide> *
<ide> * @example
<del> <example>
<add> <example module="documentExample">
<ide> <file name="index.html">
<del> <div ng-controller="MainCtrl">
<add> <div ng-controller="ExampleController">
<ide> <p>$document title: <b ng-bind="title"></b></p>
<ide> <p>window.document title: <b ng-bind="windowTitle"></b></p>
<ide> </div>
<ide> </file>
<ide> <file name="script.js">
<del> function MainCtrl($scope, $document) {
<del> $scope.title = $document[0].title;
<del> $scope.windowTitle = angular.element(window.document)[0].title;
<del> }
<add> angular.module('documentExample', [])
<add> .controller('ExampleController', ['$scope', '$document', function($scope, $document) {
<add> $scope.title = $document[0].title;
<add> $scope.windowTitle = angular.element(window.document)[0].title;
<add> }]);
<ide> </file>
<ide> </example>
<ide> */ | 1 |
Text | Text | fix typo on `getinitialprops` | 7be6359aff34e0e8c27fe4e16ccd32d6cd0ca5e4 | <ide><path>docs/advanced-features/custom-document.md
<ide> Or add a `className` to the `body` tag:
<ide>
<ide> > **Note:** This is advanced and only needed for libraries like CSS-in-JS to support server-side rendering. This is not needed for built-in `styled-jsx` support.
<ide>
<del>To prepare for [React 18](/docs/advanced-features/react-18.md), we recommend avoiding customizing `getInitiaProps` and `renderPage`, if possible.
<add>To prepare for [React 18](/docs/advanced-features/react-18.md), we recommend avoiding customizing `getInitialProps` and `renderPage`, if possible.
<ide>
<ide> The `ctx` object shown below is equivalent to the one received in [`getInitialProps`](/docs/api-reference/data-fetching/get-initial-props.md#context-object), with the addition of `renderPage`.
<ide> | 1 |
Go | Go | remove unused pkg/system.isiotcore() | 763454e1e440549ec9fe47d278f64101d0e668f4 | <ide><path>pkg/system/syscall_windows.go
<ide> var (
<ide> ntuserApiset = windows.NewLazyDLL("ext-ms-win-ntuser-window-l1-1-0")
<ide> modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
<ide> procGetVersionExW = modkernel32.NewProc("GetVersionExW")
<del> procGetProductInfo = modkernel32.NewProc("GetProductInfo")
<ide> procSetNamedSecurityInfo = modadvapi32.NewProc("SetNamedSecurityInfoW")
<ide> procGetSecurityDescriptorDacl = modadvapi32.NewProc("GetSecurityDescriptorDacl")
<ide> )
<ide> func IsWindowsClient() bool {
<ide> return osviex.ProductType == verNTWorkstation
<ide> }
<ide>
<del>// IsIoTCore returns true if the currently running image is based off of
<del>// Windows 10 IoT Core.
<del>func IsIoTCore() bool {
<del> var returnedProductType uint32
<del> r1, _, err := procGetProductInfo.Call(6, 1, 0, 0, uintptr(unsafe.Pointer(&returnedProductType)))
<del> if r1 == 0 {
<del> logrus.Warnf("GetProductInfo failed - assuming this is not IoT: %v", err)
<del> return false
<del> }
<del> const productIoTUAP = 0x0000007B
<del> const productIoTUAPCommercial = 0x00000083
<del> return returnedProductType == productIoTUAP || returnedProductType == productIoTUAPCommercial
<del>}
<del>
<ide> // Unmount is a platform-specific helper function to call
<ide> // the unmount syscall. Not supported on Windows
<ide> func Unmount(dest string) error { | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.