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
remove un-necessary imports
4e515b4ab0e5938256edf4eeab88767a42a9f73f
<ide><path>src/Http/Client/CookieCollection.php <ide> */ <ide> namespace Cake\Http\Client; <ide> <del>use Cake\Http\Client\Response; <del> <ide> /** <ide> * Container class for cookies used in Http\Client. <ide> * <ide><path>src/Http/Client/FormData.php <ide> */ <ide> namespace Cake\Http\Client; <ide> <del>use Cake\Http\Client\FormDataPart; <ide> use Countable; <ide> use finfo; <ide>
2
Text
Text
add benchmark/readme.md and fix guide
8926f1110dec9a9d16e54cc25b8bcf707c7f656e
<ide><path>benchmark/README.md <add># Node.js Core Benchmarks <add> <add>This folder contains code and data used to measure performance <add>of different Node.js implementations and different ways of <add>writing JavaScript run by the built-in JavaScript engine. <add> <add>For a detailed guide on how to write and run benchmarks in this <add>directory, see [the guide on benchmarks](../doc/guides/writing-and-running-benchmarks.md). <add> <add>## Table of Contents <add> <add>* [Benchmark directories](#benchmark-directories) <add>* [Common API](#common-api) <add> <add>## Benchmark Directories <add> <add><table> <add> <thead> <add> <tr> <add> <th>Directory</th> <add> <th>Purpose</th> <add> </tr> <add> </thead> <add> <tbody> <add> <tr> <add> <td>arrays</td> <add> <td> <add> Benchmarks for various operations on array-like objects, <add> including <code>Array</code>, <code>Buffer</code>, and typed arrays. <add> </td> <add> </tr> <add> <tr> <add> <td>assert</td> <add> <td> <add> Benchmarks for the <code>assert</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>buffers</td> <add> <td> <add> Benchmarks for the <code>buffer</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>child_process</td> <add> <td> <add> Benchmarks for the <code>child_process</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>crypto</td> <add> <td> <add> Benchmarks for the <code>crypto</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>dgram</td> <add> <td> <add> Benchmarks for the <code>dgram</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>domain</td> <add> <td> <add> Benchmarks for the <code>domain</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>es</td> <add> <td> <add> Benchmarks for various new ECMAScript features and their <add> pre-ES2015 counterparts. <add> </td> <add> </tr> <add> <tr> <add> <td>events</td> <add> <td> <add> Benchmarks for the <code>events</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>fixtures</td> <add> <td> <add> Benchmarks fixtures used in various benchmarks throughout <add> the benchmark suite. <add> </td> <add> </tr> <add> <tr> <add> <td>fs</td> <add> <td> <add> Benchmarks for the <code>fs</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>http</td> <add> <td> <add> Benchmarks for the <code>http</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>misc</td> <add> <td> <add> Miscellaneous benchmarks and benchmarks for shared <add> internal modules. <add> </td> <add> </tr> <add> <tr> <add> <td>module</td> <add> <td> <add> Benchmarks for the <code>module</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>net</td> <add> <td> <add> Benchmarks for the <code>net</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>path</td> <add> <td> <add> Benchmarks for the <code>path</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>process</td> <add> <td> <add> Benchmarks for the <code>process</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>querystring</td> <add> <td> <add> Benchmarks for the <code>querystring</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>streams</td> <add> <td> <add> Benchmarks for the <code>streams</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>string_decoder</td> <add> <td> <add> Benchmarks for the <code>string_decoder</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>timers</td> <add> <td> <add> Benchmarks for the <code>timers</code> subsystem, including <add> <code>setTimeout</code>, <code>setInterval</code>, .etc. <add> </td> <add> </tr> <add> <tr> <add> <td>tls</td> <add> <td> <add> Benchmarks for the <code>tls</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>url</td> <add> <td> <add> Benchmarks for the <code>url</code> subsystem, including the legacy <add> <code>url</code> implementation and the WHATWG URL implementation. <add> </td> <add> </tr> <add> <tr> <add> <td>util</td> <add> <td> <add> Benchmarks for the <code>util</code> subsystem. <add> </td> <add> </tr> <add> <tr> <add> <td>vm</td> <add> <td> <add> Benchmarks for the <code>vm</code> subsystem. <add> </td> <add> </tr> <add> </tbody> <add></table> <add> <add>### Other Top-level files <add> <add>The top-level files include common dependencies of the benchmarks <add>and the tools for launching benchmarks and visualizing their output. <add>The actual benchmark scripts should be placed in their corresponding <add>directories. <add> <add>* `_benchmark_progress.js`: implements the progress bar displayed <add> when running `compare.js` <add>* `_cli.js`: parses the command line arguments passed to `compare.js`, <add> `run.js` and `scatter.js` <add>* `_cli.R`: parses the command line arguments passed to `compare.R` <add>* `_http-benchmarkers.js`: selects and runs external tools for benchmarking <add> the `http` subsystem. <add>* `common.js`: see [Common API](#common-api). <add>* `compare.js`: command line tool for comparing performance between different <add> Node.js binaries. <add>* `compare.R`: R script for statistically analyzing the output of <add> `compare.js` <add>* `run.js`: command line tool for running individual benchmark suite(s). <add>* `scatter.js`: command line tool for comparing the performance <add> between different parameters in benchmark configurations, <add> for example to analyze the time complexity. <add>* `scatter.R`: R script for visualizing the output of `scatter.js` with <add> scatter plots. <add> <add>## Common API <add> <add>The common.js module is used by benchmarks for consistency across repeated <add>tasks. It has a number of helpful functions and properties to help with <add>writing benchmarks. <add> <add>### createBenchmark(fn, configs[, options]) <add> <add>See [the guide on writing benchmarks](../doc/guides/writing-and-running-benchmarks.md#basics-of-a-benchmark). <add> <add>### default\_http\_benchmarker <add> <add>The default benchmarker used to run HTTP benchmarks. <add>See [the guide on writing HTTP benchmarks](../doc/guides/writing-and-running-benchmarks.md#creating-an-http-benchmark). <add> <add> <add>### PORT <add> <add>The default port used to run HTTP benchmarks. <add>See [the guide on writing HTTP benchmarks](../doc/guides/writing-and-running-benchmarks.md#creating-an-http-benchmark). <add> <add>### sendResult(data) <add> <add>Used in special benchmarks that can't use `createBenchmark` and the object <add>it returns to accomplish what they need. This function reports timing <add>data to the parent process (usually created by running `compare.js`, `run.js` or <add>`scatter.js`). <add> <add>### v8ForceOptimization(method[, ...args]) <add> <add>Force V8 to mark the `method` for optimization with the native function <add>`%OptimizeFunctionOnNextCall()` and return the optimization status <add>after that. <add> <add>It can be used to prevent the benchmark from getting disrupted by the optimizer <add>kicking in halfway through. However, this could result in a less effective <add>optimization. In general, only use it if you know what it actually does. <ide><path>doc/guides/writing-and-running-benchmarks.md <del># Node.js core benchmark <add># How to Write and Run Benchmarks in Node.js Core <ide> <del>This folder contains benchmarks to measure the performance of the Node.js APIs. <del> <del>## Table of Content <add>## Table of Contents <ide> <ide> * [Prerequisites](#prerequisites) <add> * [HTTP Benchmark Requirements](#http-benchmark-requirements) <add> * [Benchmark Analysis Requirements](#benchmark-analysis-requirements) <ide> * [Running benchmarks](#running-benchmarks) <del> * [Running individual benchmarks](#running-individual-benchmarks) <del> * [Running all benchmarks](#running-all-benchmarks) <del> * [Comparing node versions](#comparing-node-versions) <del> * [Comparing parameters](#comparing-parameters) <add> * [Running individual benchmarks](#running-individual-benchmarks) <add> * [Running all benchmarks](#running-all-benchmarks) <add> * [Comparing Node.js versions](#comparing-nodejs-versions) <add> * [Comparing parameters](#comparing-parameters) <ide> * [Creating a benchmark](#creating-a-benchmark) <add> * [Basics of a benchmark](#basics-of-a-benchmark) <add> * [Creating an HTTP benchmark](#creating-an-http-benchmark) <ide> <ide> ## Prerequisites <ide> <add>Basic Unix tools are required for some benchmarks. <add>[Git for Windows][git-for-windows] includes Git Bash and the necessary tools, <add>which need to be included in the global Windows `PATH`. <add> <add>### HTTP Benchmark Requirements <add> <ide> Most of the HTTP benchmarks require a benchmarker to be installed, this can be <ide> either [`wrk`][wrk] or [`autocannon`][autocannon]. <ide> <del>`Autocannon` is a Node script that can be installed using <del>`npm install -g autocannon`. It will use the Node executable that is in the <add>`Autocannon` is a Node.js script that can be installed using <add>`npm install -g autocannon`. It will use the Node.js executable that is in the <ide> path, hence if you want to compare two HTTP benchmark runs make sure that the <del>Node version in the path is not altered. <add>Node.js version in the path is not altered. <ide> <ide> `wrk` may be available through your preferred package manager. If not, you can <ide> easily build it [from source][wrk] via `make`. <ide> benchmarker to be used by providing it as an argument, e. g.: <ide> <ide> `node benchmark/http/simple.js benchmarker=autocannon` <ide> <del>Basic Unix tools are required for some benchmarks. <del>[Git for Windows][git-for-windows] includes Git Bash and the necessary tools, <del>which need to be included in the global Windows `PATH`. <add>### Benchmark Analysis Requirements <ide> <ide> To analyze the results `R` should be installed. Check you package manager or <ide> download it from https://www.r-project.org/. <ide> install.packages("ggplot2") <ide> install.packages("plyr") <ide> ``` <ide> <del>### CRAN Mirror Issues <ide> In the event you get a message that you need to select a CRAN mirror first. <ide> <ide> You can specify a mirror by adding in the repo parameter. <ide> buffers/buffer-tostring.js n=10000000 len=1024 arg=false: 3783071.1678948295 <ide> ### Running all benchmarks <ide> <ide> Similar to running individual benchmarks, a group of benchmarks can be executed <del>by using the `run.js` tool. Again this does not provide the statistical <add>by using the `run.js` tool. To see how to use this script, <add>run `node benchmark/run.js`. Again this does not provide the statistical <ide> information to make any conclusions. <ide> <ide> ```console <ide> It is possible to execute more groups by adding extra process arguments. <ide> $ node benchmark/run.js arrays buffers <ide> ``` <ide> <del>### Comparing node versions <add>### Comparing Node.js versions <ide> <del>To compare the effect of a new node version use the `compare.js` tool. This <add>To compare the effect of a new Node.js version use the `compare.js` tool. This <ide> will run each benchmark multiple times, making it possible to calculate <del>statistics on the performance measures. <add>statistics on the performance measures. To see how to use this script, <add>run `node benchmark/compare.js`. <ide> <ide> As an example on how to check for a possible performance improvement, the <ide> [#5134](https://github.com/nodejs/node/pull/5134) pull request will be used as <ide> an example. This pull request _claims_ to improve the performance of the <ide> `string_decoder` module. <ide> <del>First build two versions of node, one from the master branch (here called <add>First build two versions of Node.js, one from the master branch (here called <ide> `./node-master`) and another with the pull request applied (here called <ide> `./node-pr-5135`). <ide> <ide> It can be useful to compare the performance for different parameters, for <ide> example to analyze the time complexity. <ide> <ide> To do this use the `scatter.js` tool, this will run a benchmark multiple times <del>and generate a csv with the results. <add>and generate a csv with the results. To see how to use this script, <add>run `node benchmark/scatter.js`. <ide> <ide> ```console <ide> $ node benchmark/scatter.js benchmark/string_decoder/string-decoder.js > scatter.csv <ide> chunk encoding mean confidence.interval <ide> <ide> ## Creating a benchmark <ide> <add>### Basics of a benchmark <add> <ide> All benchmarks use the `require('../common.js')` module. This contains the <ide> `createBenchmark(main, configs[, options])` method which will setup your <ide> benchmark. <ide> function main(conf) { <ide> } <ide> ``` <ide> <del>## Creating HTTP benchmark <add>### Creating an HTTP benchmark <ide> <ide> The `bench` object returned by `createBenchmark` implements <ide> `http(options, callback)` method. It can be used to run external tool to
2
Javascript
Javascript
improve readability of some exceptions caught b
2c9d53c1678ca0a024731265cba34a27ca1ad29b
<ide><path>packages/ember-testing/lib/adapters.js <ide> Test.QUnitAdapter = Test.Adapter.extend({ <ide> start(); <ide> }, <ide> exception: function(error) { <del> ok(false, error); <add> ok(false, Ember.inspect(error)); <ide> } <ide> });
1
PHP
PHP
provide a fqcn in docblock
ffeafa83e1bce96a0b19c46978cdbae09878dd6b
<ide><path>src/Collection/CollectionTrait.php <ide> trait CollectionTrait <ide> * type of returned collection interface <ide> * <ide> * @param mixed $args,.. Constructor arguments. <del> * @return CollectionInterface <add> * @return \Cake\Collection\CollectionInterface <ide> */ <ide> protected function newCollection(...$args) <ide> {
1
Ruby
Ruby
remove dead code
3908a6d8675605f570f07d8be2f9224c1c47f0e3
<ide><path>actionpack/lib/action_dispatch/middleware/cookies.rb <ide> def write(headers) <ide> @delete_cookies.each { |k, v| ::Rack::Utils.delete_cookie_header!(headers, k, v) } <ide> end <ide> <del> def recycle! #:nodoc: <del> @set_cookies = {} <del> @delete_cookies = {} <del> end <del> <ide> mattr_accessor :always_write_cookie <ide> self.always_write_cookie = false <ide>
1
Python
Python
add an input validation case in concatenate
a4c1d44192690a8f677b7c17bf798324883e3f75
<ide><path>keras/layers/merge.py <ide> def __init__(self, axis=-1, **kwargs): <ide> <ide> def build(self, input_shape): <ide> # Used purely for shape validation. <del> if not isinstance(input_shape, list): <add> if not isinstance(input_shape, list) or len(input_shape) < 2: <ide> raise ValueError('`Concatenate` layer should be called ' <del> 'on a list of inputs') <add> 'on a list of of at least 2 inputs') <ide> if all([shape is None for shape in input_shape]): <ide> return <ide> reduced_inputs_shapes = [list(shape) for shape in input_shape]
1
PHP
PHP
adjust method location
a8a171128a889a33ddd8c8c8fafab1930de00255
<ide><path>src/Illuminate/Database/Eloquent/Builder.php <ide> public function scopes(array $scopes) <ide> return $builder; <ide> } <ide> <del> /** <del> * Apply the given scope on the current builder instance. <del> * <del> * @param callable $scope <del> * @param array $parameters <del> * @return mixed <del> */ <del> protected function callScope(callable $scope, $parameters = []) <del> { <del> array_unshift($parameters, $this); <del> <del> $query = $this->getQuery(); <del> <del> // We will keep track of how many wheres are on the query before running the <del> // scope so that we can properly group the added scope constraints in the <del> // query as their own isolated nested where statement and avoid issues. <del> $originalWhereCount = count($query->wheres); <del> <del> $result = $scope(...array_values($parameters)) ?: $this; <del> <del> if ($this->shouldNestWheresForScope($query, $originalWhereCount)) { <del> $this->nestWheresForScope($query, $originalWhereCount); <del> } <del> <del> return $result; <del> } <del> <ide> /** <ide> * Apply the scopes to the Eloquent builder instance and return it. <ide> * <ide> public function applyScopes() <ide> } <ide> <ide> /** <del> * Determine if the scope added after the given offset should be nested. <add> * Apply the given scope on the current builder instance. <ide> * <del> * @param \Illuminate\Database\Query\Builder $query <del> * @param int $originalWhereCount <del> * @return bool <add> * @param callable $scope <add> * @param array $parameters <add> * @return mixed <ide> */ <del> protected function shouldNestWheresForScope(QueryBuilder $query, $originalWhereCount) <add> protected function callScope(callable $scope, $parameters = []) <ide> { <del> return count($query->wheres) > $originalWhereCount; <add> array_unshift($parameters, $this); <add> <add> $query = $this->getQuery(); <add> <add> // We will keep track of how many wheres are on the query before running the <add> // scope so that we can properly group the added scope constraints in the <add> // query as their own isolated nested where statement and avoid issues. <add> $originalWhereCount = count($query->wheres); <add> <add> $result = $scope(...array_values($parameters)) ?: $this; <add> <add> if (count($query->wheres) > $originalWhereCount) { <add> $this->nestWheresForScope($query, $originalWhereCount); <add> } <add> <add> return $result; <ide> } <ide> <ide> /**
1
PHP
PHP
fix typo in comments
64cf746c54417707854106df52a4f41d4ed437de
<ide><path>src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php <ide> protected function hydratePivotRelation(array $models) <ide> { <ide> // To hydrate the pivot relationship, we will just gather the pivot attributes <ide> // and create a new Pivot model, which is basically a dynamic model that we <del> // will set the attributes, table, and connections on so it they be used. <add> // will set the attributes, table, and connections on so they can be used. <ide> foreach ($models as $model) { <ide> $model->setRelation('pivot', $this->newExistingPivot( <ide> $this->migratePivotAttributes($model)
1
PHP
PHP
enforce stricter assertions.
4c95784ed7de0ec8809072f3c8e16d8b9847fc28
<ide><path>tests/Cache/CacheManagerTest.php <ide> public function testCustomDriverOverridesInternalDrivers() <ide> <ide> $driver = $cacheManager->store('my_store'); <ide> <del> $this->assertEquals('mm(u_u)mm', $driver->flag); <add> $this->assertSame('mm(u_u)mm', $driver->flag); <ide> } <ide> <ide> public function testItMakesRepositoryWhenContainerHasNoDispatcher() <ide><path>tests/Cache/CacheRateLimiterTest.php <ide> public function testAttemptsCallbackReturnsCallbackReturn() <ide> <ide> $rateLimiter = new RateLimiter($cache); <ide> <del> $this->assertEquals('foo', $rateLimiter->attempt('key', 1, function () { <add> $this->assertSame('foo', $rateLimiter->attempt('key', 1, function () { <ide> return 'foo'; <ide> }, 1)); <ide> } <ide><path>tests/Console/ConsoleEventSchedulerTest.php <ide> public function testItUsesCommandDescriptionAsEventDescription() <ide> { <ide> $schedule = $this->schedule; <ide> $event = $schedule->command(ConsoleCommandStub::class); <del> $this->assertEquals('This is a description about the command', $event->description); <add> $this->assertSame('This is a description about the command', $event->description); <ide> } <ide> <ide> public function testItShouldBePossibleToOverwriteTheDescription() <ide> { <ide> $schedule = $this->schedule; <ide> $event = $schedule->command(ConsoleCommandStub::class) <ide> ->description('This is an alternative description'); <del> $this->assertEquals('This is an alternative description', $event->description); <add> $this->assertSame('This is an alternative description', $event->description); <ide> } <ide> <ide> public function testCallCreatesNewJobWithTimezone() <ide><path>tests/Cookie/CookieTest.php <ide> public function testExpire() <ide> $cookieJar->expire('foobar', '/path', '/domain'); <ide> <ide> $cookie = $cookieJar->queued('foobar'); <del> $this->assertEquals('foobar', $cookie->getName()); <add> $this->assertSame('foobar', $cookie->getName()); <ide> $this->assertEquals(null, $cookie->getValue()); <del> $this->assertEquals('/path', $cookie->getPath()); <del> $this->assertEquals('/domain', $cookie->getDomain()); <add> $this->assertSame('/path', $cookie->getPath()); <add> $this->assertSame('/domain', $cookie->getDomain()); <ide> $this->assertTrue($cookie->getExpiresTime() < time()); <ide> $this->assertCount(1, $cookieJar->getQueuedCookies()); <ide> } <ide><path>tests/Database/DatabaseEloquentBelongsToManySyncReturnValueTypeTest.php <ide> public function testSyncReturnValueType() <ide> }); <ide> <ide> $user->articles->each(function (BelongsToManySyncTestTestArticle $article) { <del> $this->assertEquals('0', $article->pivot->visible); <add> $this->assertSame('0', (string) $article->pivot->visible); <ide> }); <ide> } <ide> <ide> public function testSyncWithPivotDefaultsReturnValueType() <ide> }); <ide> <ide> $user->articles->each(function (BelongsToManySyncTestTestArticle $article) { <del> $this->assertEquals('1', $article->pivot->visible); <add> $this->assertSame('1', (string) $article->pivot->visible); <ide> }); <ide> } <ide> <ide><path>tests/Database/DatabaseEloquentBelongsToManySyncTouchesParentTest.php <ide> public function testSyncWithDetachedValuesShouldTouch() <ide> Carbon::setTestNow('2021-07-20 19:13:14'); <ide> $result = $article->users()->sync([1, 2]); <ide> $this->assertCount(1, collect($result['detached'])); <del> $this->assertSame('3', collect($result['detached'])->first()); <add> $this->assertSame('3', (string) collect($result['detached'])->first()); <ide> <ide> $article->refresh(); <ide> $this->assertSame('2021-07-20 19:13:14', $article->updated_at->format('Y-m-d H:i:s')); <ide><path>tests/Database/DatabaseEloquentBelongsToTest.php <ide> public function __toString() <ide> <ide> $this->assertEquals(1, $models[0]->foo->getAttribute('id')); <ide> $this->assertEquals(2, $models[1]->foo->getAttribute('id')); <del> $this->assertEquals('3', $models[2]->foo->getAttribute('id')); <add> $this->assertSame('3', (string) $models[2]->foo->getAttribute('id')); <ide> } <ide> <ide> public function testAssociateMethodSetsForeignKeyOnModel() <ide><path>tests/Database/DatabaseEloquentHasOneTest.php <ide> public function __toString() <ide> $this->assertEquals(1, $models[0]->foo->foreign_key); <ide> $this->assertEquals(2, $models[1]->foo->foreign_key); <ide> $this->assertNull($models[2]->foo); <del> $this->assertEquals('4', $models[3]->foo->foreign_key); <add> $this->assertSame('4', (string) $models[3]->foo->foreign_key); <ide> } <ide> <ide> public function testRelationCountQueryCanBeBuilt() <ide><path>tests/Database/DatabaseEloquentStrictMorphsTest.php <ide> public function testStrictModeDoesNotThrowExceptionWhenMorphMap() <ide> ]); <ide> <ide> $morphName = $model->getMorphClass(); <del> $this->assertEquals('test', $morphName); <add> $this->assertSame('test', $morphName); <ide> } <ide> <ide> public function testMapsCanBeEnforcedInOneMethod() <ide> public function testMapsCanBeEnforcedInOneMethod() <ide> ]); <ide> <ide> $morphName = $model->getMorphClass(); <del> $this->assertEquals('test', $morphName); <add> $this->assertSame('test', $morphName); <ide> } <ide> <ide> protected function tearDown(): void <ide><path>tests/Foundation/FoundationFormRequestTest.php <ide> public function testValidatedMethodReturnsOnlyRequestedValidatedData() <ide> <ide> $request->validateResolved(); <ide> <del> $this->assertEquals('specified', $request->validated('name')); <add> $this->assertSame('specified', $request->validated('name')); <ide> } <ide> <ide> public function testValidatedMethodReturnsOnlyRequestedNestedValidatedData() <ide> public function testValidatedMethodReturnsOnlyRequestedNestedValidatedData() <ide> <ide> $request->validateResolved(); <ide> <del> $this->assertEquals('bar', $request->validated('nested.foo')); <add> $this->assertSame('bar', $request->validated('nested.foo')); <ide> } <ide> <ide> /** <ide><path>tests/Foundation/Testing/Concerns/InteractsWithViewsTest.php <ide> public function testBladeCorrectlyRendersString() <ide> { <ide> $string = (string) $this->blade('@if(true)test @endif'); <ide> <del> $this->assertEquals('test ', $string); <add> $this->assertSame('test ', $string); <ide> } <ide> <ide> public function testComponentCanAccessPublicProperties() <ide> public function render() <ide> <ide> $component = $this->component(get_class($exampleComponent)); <ide> <del> $this->assertEquals('bar', $component->foo); <del> $this->assertEquals('hello', $component->speak()); <add> $this->assertSame('bar', $component->foo); <add> $this->assertSame('hello', $component->speak()); <ide> $component->assertSee('content'); <ide> } <ide> } <ide><path>tests/Http/Middleware/TrustProxiesTest.php <ide> public function test_request_does_not_trust() <ide> { <ide> $req = $this->createProxiedRequest(); <ide> <del> $this->assertEquals('192.168.10.10', $req->getClientIp(), 'Assert untrusted proxy x-forwarded-for header not used'); <del> $this->assertEquals('http', $req->getScheme(), 'Assert untrusted proxy x-forwarded-proto header not used'); <del> $this->assertEquals('localhost', $req->getHost(), 'Assert untrusted proxy x-forwarded-host header not used'); <add> $this->assertSame('192.168.10.10', $req->getClientIp(), 'Assert untrusted proxy x-forwarded-for header not used'); <add> $this->assertSame('http', $req->getScheme(), 'Assert untrusted proxy x-forwarded-proto header not used'); <add> $this->assertSame('localhost', $req->getHost(), 'Assert untrusted proxy x-forwarded-host header not used'); <ide> $this->assertEquals(8888, $req->getPort(), 'Assert untrusted proxy x-forwarded-port header not used'); <ide> $this->assertSame('', $req->getBaseUrl(), 'Assert untrusted proxy x-forwarded-prefix header not used'); <ide> } <ide> public function test_does_trust_trusted_proxy() <ide> $req = $this->createProxiedRequest(); <ide> $req->setTrustedProxies(['192.168.10.10'], $this->headerAll); <ide> <del> $this->assertEquals('173.174.200.38', $req->getClientIp(), 'Assert trusted proxy x-forwarded-for header used'); <del> $this->assertEquals('https', $req->getScheme(), 'Assert trusted proxy x-forwarded-proto header used'); <del> $this->assertEquals('serversforhackers.com', $req->getHost(), 'Assert trusted proxy x-forwarded-host header used'); <add> $this->assertSame('173.174.200.38', $req->getClientIp(), 'Assert trusted proxy x-forwarded-for header used'); <add> $this->assertSame('https', $req->getScheme(), 'Assert trusted proxy x-forwarded-proto header used'); <add> $this->assertSame('serversforhackers.com', $req->getHost(), 'Assert trusted proxy x-forwarded-host header used'); <ide> $this->assertEquals(443, $req->getPort(), 'Assert trusted proxy x-forwarded-port header used'); <del> $this->assertEquals('/prefix', $req->getBaseUrl(), 'Assert trusted proxy x-forwarded-prefix header used'); <add> $this->assertSame('/prefix', $req->getBaseUrl(), 'Assert trusted proxy x-forwarded-prefix header used'); <ide> } <ide> <ide> /** <ide> public function test_trusted_proxy_sets_trusted_proxies_with_wildcard() <ide> $request = $this->createProxiedRequest(); <ide> <ide> $trustedProxy->handle($request, function ($request) { <del> $this->assertEquals('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used with wildcard proxy setting'); <add> $this->assertSame('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used with wildcard proxy setting'); <ide> }); <ide> } <ide> <ide> public function test_trusted_proxy_sets_trusted_proxies_with_double_wildcard_for <ide> $request = $this->createProxiedRequest(); <ide> <ide> $trustedProxy->handle($request, function ($request) { <del> $this->assertEquals('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used with wildcard proxy setting'); <add> $this->assertSame('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used with wildcard proxy setting'); <ide> }); <ide> } <ide> <ide> public function test_trusted_proxy_sets_trusted_proxies() <ide> $request = $this->createProxiedRequest(); <ide> <ide> $trustedProxy->handle($request, function ($request) { <del> $this->assertEquals('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used'); <add> $this->assertSame('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used'); <ide> }); <ide> } <ide> <ide> public function test_get_client_ips() <ide> <ide> $trustedProxy->handle($request, function ($request) use ($forwardedForHeader) { <ide> $ips = $request->getClientIps(); <del> $this->assertEquals('192.0.2.2', end($ips), 'Assert sets the '.$forwardedForHeader); <add> $this->assertSame('192.0.2.2', end($ips), 'Assert sets the '.$forwardedForHeader); <ide> }); <ide> } <ide> } <ide> public function test_get_client_ip_with_muliple_ip_addresses_some_of_which_are_t <ide> $request = $this->createProxiedRequest(['HTTP_X_FORWARDED_FOR' => $forwardedForHeader]); <ide> <ide> $trustedProxy->handle($request, function ($request) use ($forwardedForHeader) { <del> $this->assertEquals('192.0.2.2', $request->getClientIp(), 'Assert sets the '.$forwardedForHeader); <add> $this->assertSame('192.0.2.2', $request->getClientIp(), 'Assert sets the '.$forwardedForHeader); <ide> }); <ide> } <ide> } <ide> public function test_get_client_ip_with_muliple_ip_addresses_all_proxies_are_tru <ide> $request = $this->createProxiedRequest(['HTTP_X_FORWARDED_FOR' => $forwardedForHeader]); <ide> <ide> $trustedProxy->handle($request, function ($request) use ($forwardedForHeader) { <del> $this->assertEquals('192.0.2.2', $request->getClientIp(), 'Assert sets the '.$forwardedForHeader); <add> $this->assertSame('192.0.2.2', $request->getClientIp(), 'Assert sets the '.$forwardedForHeader); <ide> }); <ide> } <ide> } <ide> public function test_can_distrust_headers() <ide> ]); <ide> <ide> $trustedProxy->handle($request, function ($request) { <del> $this->assertEquals('173.174.200.40', $request->getClientIp(), <add> $this->assertSame('173.174.200.40', $request->getClientIp(), <ide> 'Assert trusted proxy used forwarded header for IP'); <del> $this->assertEquals('https', $request->getScheme(), <add> $this->assertSame('https', $request->getScheme(), <ide> 'Assert trusted proxy used forwarded header for scheme'); <del> $this->assertEquals('serversforhackers.com', $request->getHost(), <add> $this->assertSame('serversforhackers.com', $request->getHost(), <ide> 'Assert trusted proxy used forwarded header for host'); <ide> $this->assertEquals(443, $request->getPort(), 'Assert trusted proxy used forwarded header for port'); <ide> }); <ide> public function test_x_forwarded_for_header_only_trusted() <ide> $request = $this->createProxiedRequest(); <ide> <ide> $trustedProxy->handle($request, function ($request) { <del> $this->assertEquals('173.174.200.38', $request->getClientIp(), <add> $this->assertSame('173.174.200.38', $request->getClientIp(), <ide> 'Assert trusted proxy used forwarded header for IP'); <del> $this->assertEquals('http', $request->getScheme(), <add> $this->assertSame('http', $request->getScheme(), <ide> 'Assert trusted proxy did not use forwarded header for scheme'); <del> $this->assertEquals('localhost', $request->getHost(), <add> $this->assertSame('localhost', $request->getHost(), <ide> 'Assert trusted proxy did not use forwarded header for host'); <ide> $this->assertEquals(8888, $request->getPort(), 'Assert trusted proxy did not use forwarded header for port'); <ide> $this->assertSame('', $request->getBaseUrl(), 'Assert trusted proxy did not use forwarded header for prefix'); <ide> public function test_x_forwarded_host_header_only_trusted() <ide> $request = $this->createProxiedRequest(['HTTP_X_FORWARDED_HOST' => 'serversforhackers.com:8888']); <ide> <ide> $trustedProxy->handle($request, function ($request) { <del> $this->assertEquals('192.168.10.10', $request->getClientIp(), <add> $this->assertSame('192.168.10.10', $request->getClientIp(), <ide> 'Assert trusted proxy did not use forwarded header for IP'); <del> $this->assertEquals('http', $request->getScheme(), <add> $this->assertSame('http', $request->getScheme(), <ide> 'Assert trusted proxy did not use forwarded header for scheme'); <del> $this->assertEquals('serversforhackers.com', $request->getHost(), <add> $this->assertSame('serversforhackers.com', $request->getHost(), <ide> 'Assert trusted proxy used forwarded header for host'); <ide> $this->assertEquals(8888, $request->getPort(), 'Assert trusted proxy did not use forwarded header for port'); <ide> $this->assertSame('', $request->getBaseUrl(), 'Assert trusted proxy did not use forwarded header for prefix'); <ide> public function test_x_forwarded_port_header_only_trusted() <ide> $request = $this->createProxiedRequest(); <ide> <ide> $trustedProxy->handle($request, function ($request) { <del> $this->assertEquals('192.168.10.10', $request->getClientIp(), <add> $this->assertSame('192.168.10.10', $request->getClientIp(), <ide> 'Assert trusted proxy did not use forwarded header for IP'); <del> $this->assertEquals('http', $request->getScheme(), <add> $this->assertSame('http', $request->getScheme(), <ide> 'Assert trusted proxy did not use forwarded header for scheme'); <del> $this->assertEquals('localhost', $request->getHost(), <add> $this->assertSame('localhost', $request->getHost(), <ide> 'Assert trusted proxy did not use forwarded header for host'); <ide> $this->assertEquals(443, $request->getPort(), 'Assert trusted proxy used forwarded header for port'); <ide> $this->assertSame('', $request->getBaseUrl(), 'Assert trusted proxy did not use forwarded header for prefix'); <ide> public function test_x_forwarded_prefix_header_only_trusted() <ide> $request = $this->createProxiedRequest(); <ide> <ide> $trustedProxy->handle($request, function ($request) { <del> $this->assertEquals('192.168.10.10', $request->getClientIp(), <add> $this->assertSame('192.168.10.10', $request->getClientIp(), <ide> 'Assert trusted proxy did not use forwarded header for IP'); <del> $this->assertEquals('http', $request->getScheme(), <add> $this->assertSame('http', $request->getScheme(), <ide> 'Assert trusted proxy did not use forwarded header for scheme'); <del> $this->assertEquals('localhost', $request->getHost(), <add> $this->assertSame('localhost', $request->getHost(), <ide> 'Assert trusted proxy did not use forwarded header for host'); <ide> $this->assertEquals(8888, $request->getPort(), 'Assert trusted proxy did not use forwarded header for port'); <del> $this->assertEquals('/prefix', $request->getBaseUrl(), 'Assert trusted proxy used forwarded header for prefix'); <add> $this->assertSame('/prefix', $request->getBaseUrl(), 'Assert trusted proxy used forwarded header for prefix'); <ide> }); <ide> } <ide> <ide> public function test_x_forwarded_proto_header_only_trusted() <ide> $request = $this->createProxiedRequest(); <ide> <ide> $trustedProxy->handle($request, function ($request) { <del> $this->assertEquals('192.168.10.10', $request->getClientIp(), <add> $this->assertSame('192.168.10.10', $request->getClientIp(), <ide> 'Assert trusted proxy did not use forwarded header for IP'); <del> $this->assertEquals('https', $request->getScheme(), <add> $this->assertSame('https', $request->getScheme(), <ide> 'Assert trusted proxy used forwarded header for scheme'); <del> $this->assertEquals('localhost', $request->getHost(), <add> $this->assertSame('localhost', $request->getHost(), <ide> 'Assert trusted proxy did not use forwarded header for host'); <ide> $this->assertEquals(8888, $request->getPort(), 'Assert trusted proxy did not use forwarded header for port'); <ide> $this->assertSame('', $request->getBaseUrl(), 'Assert trusted proxy did not use forwarded header for prefix'); <ide> public function test_x_forwarded_multiple_individual_headers_trusted() <ide> $request = $this->createProxiedRequest(); <ide> <ide> $trustedProxy->handle($request, function ($request) { <del> $this->assertEquals('173.174.200.38', $request->getClientIp(), <add> $this->assertSame('173.174.200.38', $request->getClientIp(), <ide> 'Assert trusted proxy used forwarded header for IP'); <del> $this->assertEquals('https', $request->getScheme(), <add> $this->assertSame('https', $request->getScheme(), <ide> 'Assert trusted proxy used forwarded header for scheme'); <del> $this->assertEquals('serversforhackers.com', $request->getHost(), <add> $this->assertSame('serversforhackers.com', $request->getHost(), <ide> 'Assert trusted proxy used forwarded header for host'); <ide> $this->assertEquals(443, $request->getPort(), 'Assert trusted proxy used forwarded header for port'); <del> $this->assertEquals('/prefix', $request->getBaseUrl(), 'Assert trusted proxy used forwarded header for prefix'); <add> $this->assertSame('/prefix', $request->getBaseUrl(), 'Assert trusted proxy used forwarded header for prefix'); <ide> }); <ide> } <ide> <ide><path>tests/Integration/Database/DatabaseCustomCastsTest.php <ide> public function test_custom_casting() <ide> <ide> $this->assertEquals(['name' => 'Taylor'], $model->array_object->toArray()); <ide> $this->assertEquals(['name' => 'Taylor'], $model->collection->toArray()); <del> $this->assertEquals('Taylor', (string) $model->stringable); <add> $this->assertSame('Taylor', (string) $model->stringable); <ide> <ide> $model->array_object['age'] = 34; <ide> $model->array_object['meta']['title'] = 'Developer'; <ide><path>tests/Integration/Database/DatabaseEloquentBroadcastingTest.php <ide> public function testChannelRouteFormatting() <ide> { <ide> $model = new TestEloquentBroadcastUser; <ide> <del> $this->assertEquals('Illuminate.Tests.Integration.Database.TestEloquentBroadcastUser.{testEloquentBroadcastUser}', $model->broadcastChannelRoute()); <add> $this->assertSame('Illuminate.Tests.Integration.Database.TestEloquentBroadcastUser.{testEloquentBroadcastUser}', $model->broadcastChannelRoute()); <ide> } <ide> <ide> public function testBroadcastingOnModelTrashing() <ide><path>tests/Integration/Database/EloquentBelongsToManyTest.php <ide> public function testCustomPivotClass() <ide> $post->tagsWithCustomPivot()->attach($tag->id); <ide> <ide> $this->assertInstanceOf(PostTagPivot::class, $post->tagsWithCustomPivot[0]->pivot); <del> $this->assertEquals('1507630210', $post->tagsWithCustomPivot[0]->pivot->created_at); <add> $this->assertSame('1507630210', $post->tagsWithCustomPivot[0]->pivot->created_at); <ide> <ide> $this->assertInstanceOf(PostTagPivot::class, $post->tagsWithCustomPivotClass[0]->pivot); <ide> $this->assertSame('posts_tags', $post->tagsWithCustomPivotClass()->getTable()); <ide> public function testCustomPivotClassUpdatesTimestamps() <ide> ); <ide> foreach ($post->tagsWithCustomExtraPivot as $tag) { <ide> $this->assertSame('exclude', $tag->pivot->flag); <del> $this->assertEquals('2017-10-10 10:10:10', $tag->pivot->getAttributes()['created_at']); <del> $this->assertEquals('2017-10-10 10:10:20', $tag->pivot->getAttributes()['updated_at']); // +10 seconds <add> $this->assertSame('2017-10-10 10:10:10', $tag->pivot->getAttributes()['created_at']); <add> $this->assertSame('2017-10-10 10:10:20', $tag->pivot->getAttributes()['updated_at']); // +10 seconds <ide> } <ide> } <ide> <ide><path>tests/Integration/Database/EloquentCollectionLoadCountTest.php <ide> public function testLoadCount() <ide> $posts->loadCount('comments'); <ide> <ide> $this->assertCount(1, DB::getQueryLog()); <del> $this->assertEquals('2', $posts[0]->comments_count); <del> $this->assertEquals('0', $posts[1]->comments_count); <del> $this->assertEquals('2', $posts[0]->getOriginal('comments_count')); <add> $this->assertSame('2', (string) $posts[0]->comments_count); <add> $this->assertSame('0', (string) $posts[1]->comments_count); <add> $this->assertSame('2', (string) $posts[0]->getOriginal('comments_count')); <ide> } <ide> <ide> public function testLoadCountWithSameModels() <ide> public function testLoadCountWithSameModels() <ide> $posts->loadCount('comments'); <ide> <ide> $this->assertCount(1, DB::getQueryLog()); <del> $this->assertEquals('2', $posts[0]->comments_count); <del> $this->assertEquals('0', $posts[1]->comments_count); <del> $this->assertEquals('2', $posts[2]->comments_count); <add> $this->assertSame('2', (string) $posts[0]->comments_count); <add> $this->assertSame('0', (string) $posts[1]->comments_count); <add> $this->assertSame('2', (string) $posts[2]->comments_count); <ide> } <ide> <ide> public function testLoadCountOnDeletedModels() <ide> public function testLoadCountOnDeletedModels() <ide> $posts->loadCount('comments'); <ide> <ide> $this->assertCount(1, DB::getQueryLog()); <del> $this->assertEquals('2', $posts[0]->comments_count); <del> $this->assertEquals('0', $posts[1]->comments_count); <add> $this->assertSame('2', (string) $posts[0]->comments_count); <add> $this->assertSame('0', (string) $posts[1]->comments_count); <ide> } <ide> <ide> public function testLoadCountWithArrayOfRelations() <ide> public function testLoadCountWithArrayOfRelations() <ide> $posts->loadCount(['comments', 'likes']); <ide> <ide> $this->assertCount(1, DB::getQueryLog()); <del> $this->assertEquals('2', $posts[0]->comments_count); <del> $this->assertEquals('1', $posts[0]->likes_count); <del> $this->assertEquals('0', $posts[1]->comments_count); <del> $this->assertEquals('0', $posts[1]->likes_count); <add> $this->assertSame('2', (string) $posts[0]->comments_count); <add> $this->assertSame('1', (string) $posts[0]->likes_count); <add> $this->assertSame('0', (string) $posts[1]->comments_count); <add> $this->assertSame('0', (string) $posts[1]->likes_count); <ide> } <ide> <ide> public function testLoadCountDoesNotOverrideAttributesWithDefaultValue() <ide> public function testLoadCountDoesNotOverrideAttributesWithDefaultValue() <ide> Collection::make([$post])->loadCount('comments'); <ide> <ide> $this->assertSame(200, $post->some_default_value); <del> $this->assertEquals('2', $post->comments_count); <add> $this->assertSame('2', (string) $post->comments_count); <ide> } <ide> } <ide> <ide><path>tests/Integration/Database/QueryingWithEnumsTest.php <ide> public function testCanQueryWithEnums() <ide> $this->assertNotNull($record); <ide> $this->assertNotNull($record2); <ide> $this->assertNotNull($record3); <del> $this->assertEquals('pending', $record->string_status); <add> $this->assertSame('pending', $record->string_status); <ide> $this->assertEquals(1, $record2->integer_status); <ide> } <ide> <ide> public function testCanInsertWithEnums() <ide> $record = DB::table('enum_casts')->where('string_status', StringStatus::pending)->first(); <ide> <ide> $this->assertNotNull($record); <del> $this->assertEquals('pending', $record->string_status); <add> $this->assertSame('pending', $record->string_status); <ide> $this->assertEquals(1, $record->integer_status); <ide> } <ide> } <ide><path>tests/Integration/Http/Middleware/HandleCorsTest.php <ide> public function testShouldReturnHeaderAssessControlAllowOriginWhenDontHaveHttpOr <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> ]); <ide> <del> $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <add> $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <ide> $this->assertEquals(204, $crawler->getStatusCode()); <ide> } <ide> <ide> public function testOptionsAllowOriginAllowed() <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> ]); <ide> <del> $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <add> $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <ide> $this->assertEquals(204, $crawler->getStatusCode()); <ide> } <ide> <ide> public function testAllowAllOrigins() <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> ]); <ide> <del> $this->assertEquals('*', $crawler->headers->get('Access-Control-Allow-Origin')); <add> $this->assertSame('*', $crawler->headers->get('Access-Control-Allow-Origin')); <ide> $this->assertEquals(204, $crawler->getStatusCode()); <ide> } <ide> <ide> public function testAllowAllOriginsWildcard() <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> ]); <ide> <del> $this->assertEquals('http://test.laravel.com', $crawler->headers->get('Access-Control-Allow-Origin')); <add> $this->assertSame('http://test.laravel.com', $crawler->headers->get('Access-Control-Allow-Origin')); <ide> $this->assertEquals(204, $crawler->getStatusCode()); <ide> } <ide> <ide> public function testOriginsWildcardIncludesNestedSubdomains() <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> ]); <ide> <del> $this->assertEquals('http://api.service.test.laravel.com', $crawler->headers->get('Access-Control-Allow-Origin')); <add> $this->assertSame('http://api.service.test.laravel.com', $crawler->headers->get('Access-Control-Allow-Origin')); <ide> $this->assertEquals(204, $crawler->getStatusCode()); <ide> } <ide> <ide> public function testOptionsAllowOriginAllowedNonExistingRoute() <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> ]); <ide> <del> $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <add> $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <ide> $this->assertEquals(204, $crawler->getStatusCode()); <ide> } <ide> <ide> public function testOptionsAllowOriginNotAllowed() <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> ]); <ide> <del> $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <add> $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <ide> } <ide> <ide> public function testAllowMethodAllowed() <ide> public function testAllowMethodAllowed() <ide> $this->assertEquals(null, $crawler->headers->get('Access-Control-Allow-Methods')); <ide> $this->assertEquals(200, $crawler->getStatusCode()); <ide> <del> $this->assertEquals('PONG', $crawler->getContent()); <add> $this->assertSame('PONG', $crawler->getContent()); <ide> } <ide> <ide> public function testAllowMethodNotAllowed() <ide> public function testAllowHeaderAllowedOptions() <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'x-custom-1, x-custom-2', <ide> ]); <del> $this->assertEquals('x-custom-1, x-custom-2', $crawler->headers->get('Access-Control-Allow-Headers')); <add> $this->assertSame('x-custom-1, x-custom-2', $crawler->headers->get('Access-Control-Allow-Headers')); <ide> $this->assertEquals(204, $crawler->getStatusCode()); <ide> <del> $this->assertEquals('', $crawler->getContent()); <add> $this->assertSame('', $crawler->getContent()); <ide> } <ide> <ide> public function testAllowHeaderAllowedWildcardOptions() <ide> public function testAllowHeaderAllowedWildcardOptions() <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'x-custom-3', <ide> ]); <del> $this->assertEquals('x-custom-3', $crawler->headers->get('Access-Control-Allow-Headers')); <add> $this->assertSame('x-custom-3', $crawler->headers->get('Access-Control-Allow-Headers')); <ide> $this->assertEquals(204, $crawler->getStatusCode()); <ide> <del> $this->assertEquals('', $crawler->getContent()); <add> $this->assertSame('', $crawler->getContent()); <ide> } <ide> <ide> public function testAllowHeaderNotAllowedOptions() <ide> public function testAllowHeaderNotAllowedOptions() <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'x-custom-3', <ide> ]); <del> $this->assertEquals('x-custom-1, x-custom-2', $crawler->headers->get('Access-Control-Allow-Headers')); <add> $this->assertSame('x-custom-1, x-custom-2', $crawler->headers->get('Access-Control-Allow-Headers')); <ide> } <ide> <ide> public function testAllowHeaderAllowed() <ide> public function testAllowHeaderAllowed() <ide> $this->assertEquals(null, $crawler->headers->get('Access-Control-Allow-Headers')); <ide> $this->assertEquals(200, $crawler->getStatusCode()); <ide> <del> $this->assertEquals('PONG', $crawler->getContent()); <add> $this->assertSame('PONG', $crawler->getContent()); <ide> } <ide> <ide> public function testAllowHeaderAllowedWildcard() <ide> public function testAllowHeaderAllowedWildcard() <ide> $this->assertEquals(null, $crawler->headers->get('Access-Control-Allow-Headers')); <ide> $this->assertEquals(200, $crawler->getStatusCode()); <ide> <del> $this->assertEquals('PONG', $crawler->getContent()); <add> $this->assertSame('PONG', $crawler->getContent()); <ide> } <ide> <ide> public function testAllowHeaderNotAllowed() <ide> public function testError() <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> ]); <ide> <del> $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <add> $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <ide> $this->assertEquals(500, $crawler->getStatusCode()); <ide> } <ide> <ide> public function testValidationException() <ide> 'HTTP_ORIGIN' => 'http://localhost', <ide> 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', <ide> ]); <del> $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <add> $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); <ide> $this->assertEquals(302, $crawler->getStatusCode()); <ide> } <ide> <ide><path>tests/Integration/Support/MultipleInstanceManagerTest.php <ide> public function test_configurable_instances_can_be_resolved() <ide> $manager = new MultipleInstanceManager($this->app); <ide> <ide> $fooInstance = $manager->instance('foo'); <del> $this->assertEquals('option-value', $fooInstance->config['foo-option']); <add> $this->assertSame('option-value', $fooInstance->config['foo-option']); <ide> <ide> $barInstance = $manager->instance('bar'); <del> $this->assertEquals('option-value', $barInstance->config['bar-option']); <add> $this->assertSame('option-value', $barInstance->config['bar-option']); <ide> <ide> $duplicateFooInstance = $manager->instance('foo'); <ide> $duplicateBarInstance = $manager->instance('bar'); <ide><path>tests/Mail/MailMessageTest.php <ide> public function testReplyToMethod() <ide> public function testSubjectMethod() <ide> { <ide> $this->assertInstanceOf(Message::class, $message = $this->message->subject('foo')); <del> $this->assertEquals('foo', $message->getSymfonyMessage()->getSubject()); <add> $this->assertSame('foo', $message->getSymfonyMessage()->getSubject()); <ide> } <ide> <ide> public function testPriorityMethod() <ide> public function testDataAttachment() <ide> $message = new Message(new Email()); <ide> $message->attachData('foo', 'foo.jpg', ['mime' => 'image/jpeg']); <ide> <del> $this->assertEquals('foo', $message->getSymfonyMessage()->getAttachments()[0]->getBody()); <add> $this->assertSame('foo', $message->getSymfonyMessage()->getAttachments()[0]->getBody()); <ide> } <ide> } <ide><path>tests/Queue/QueueSyncQueueTest.php <ide> public function testCreatesPayloadObject() <ide> try { <ide> $sync->push(new SyncQueueJob()); <ide> } catch (LogicException $e) { <del> $this->assertEquals('extraValue', $e->getMessage()); <add> $this->assertSame('extraValue', $e->getMessage()); <ide> } <ide> } <ide> } <ide><path>tests/Routing/RoutingRouteTest.php <ide> public function testNonGreedyMatches() <ide> $route->bind($request1); <ide> $this->assertTrue($route->hasParameter('id')); <ide> $this->assertFalse($route->hasParameter('foo')); <del> $this->assertSame('1', $route->parameter('id')); <add> $this->assertSame('1', (string) $route->parameter('id')); <ide> $this->assertSame('png', $route->parameter('ext')); <ide> <ide> $request2 = Request::create('images/12.png', 'GET'); <ide> public function testDotDoesNotMatchEverything() <ide> $request1 = Request::create('images/1.png', 'GET'); <ide> $this->assertTrue($route->matches($request1)); <ide> $route->bind($request1); <del> $this->assertSame('1', $route->parameter('id')); <add> $this->assertSame('1', (string) $route->parameter('id')); <ide> $this->assertSame('png', $route->parameter('ext')); <ide> <ide> $request2 = Request::create('images/12.png', 'GET'); <ide><path>tests/Support/SupportArrTest.php <ide> public function testToCssClasses() <ide> 'mt-4', <ide> ]); <ide> <del> $this->assertEquals('font-bold mt-4', $classes); <add> $this->assertSame('font-bold mt-4', $classes); <ide> <ide> $classes = Arr::toCssClasses([ <ide> 'font-bold', <ide> public function testToCssClasses() <ide> 'mr-2' => false, <ide> ]); <ide> <del> $this->assertEquals('font-bold mt-4 ml-2', $classes); <add> $this->assertSame('font-bold mt-4 ml-2', $classes); <ide> } <ide> <ide> public function testWhere() <ide><path>tests/Support/SupportCollectionTest.php <ide> public function testGetOrPut() <ide> { <ide> $data = new Collection(['name' => 'taylor', 'email' => 'foo']); <ide> <del> $this->assertEquals('taylor', $data->getOrPut('name', null)); <del> $this->assertEquals('foo', $data->getOrPut('email', null)); <del> $this->assertEquals('male', $data->getOrPut('gender', 'male')); <add> $this->assertSame('taylor', $data->getOrPut('name', null)); <add> $this->assertSame('foo', $data->getOrPut('email', null)); <add> $this->assertSame('male', $data->getOrPut('gender', 'male')); <ide> <del> $this->assertEquals('taylor', $data->get('name')); <del> $this->assertEquals('foo', $data->get('email')); <del> $this->assertEquals('male', $data->get('gender')); <add> $this->assertSame('taylor', $data->get('name')); <add> $this->assertSame('foo', $data->get('email')); <add> $this->assertSame('male', $data->get('gender')); <ide> <ide> $data = new Collection(['name' => 'taylor', 'email' => 'foo']); <ide> <del> $this->assertEquals('taylor', $data->getOrPut('name', function () { <add> $this->assertSame('taylor', $data->getOrPut('name', function () { <ide> return null; <ide> })); <ide> <del> $this->assertEquals('foo', $data->getOrPut('email', function () { <add> $this->assertSame('foo', $data->getOrPut('email', function () { <ide> return null; <ide> })); <ide> <del> $this->assertEquals('male', $data->getOrPut('gender', function () { <add> $this->assertSame('male', $data->getOrPut('gender', function () { <ide> return 'male'; <ide> })); <ide> <del> $this->assertEquals('taylor', $data->get('name')); <del> $this->assertEquals('foo', $data->get('email')); <del> $this->assertEquals('male', $data->get('gender')); <add> $this->assertSame('taylor', $data->get('name')); <add> $this->assertSame('foo', $data->get('email')); <add> $this->assertSame('male', $data->get('gender')); <ide> } <ide> <ide> public function testPut() <ide><path>tests/Support/SupportJsTest.php <ide> class SupportJsTest extends TestCase <ide> { <ide> public function testScalars() <ide> { <del> $this->assertEquals('false', (string) Js::from(false)); <del> $this->assertEquals('true', (string) Js::from(true)); <del> $this->assertEquals('1', (string) Js::from(1)); <del> $this->assertEquals('1.1', (string) Js::from(1.1)); <add> $this->assertSame('false', (string) Js::from(false)); <add> $this->assertSame('true', (string) Js::from(true)); <add> $this->assertSame('1', (string) Js::from(1)); <add> $this->assertSame('1.1', (string) Js::from(1.1)); <ide> $this->assertEquals( <ide> "'\\u003Cdiv class=\\u0022foo\\u0022\\u003E\\u0027quoted html\\u0027\\u003C\\/div\\u003E'", <ide> (string) Js::from('<div class="foo">\'quoted html\'</div>') <ide><path>tests/Support/SupportStringableTest.php <ide> public function testMarkdown() <ide> <ide> public function testMask() <ide> { <del> $this->assertEquals('tay*************', $this->stringable('taylor@email.com')->mask('*', 3)); <del> $this->assertEquals('******@email.com', $this->stringable('taylor@email.com')->mask('*', 0, 6)); <del> $this->assertEquals('tay*************', $this->stringable('taylor@email.com')->mask('*', -13)); <del> $this->assertEquals('tay***@email.com', $this->stringable('taylor@email.com')->mask('*', -13, 3)); <add> $this->assertSame('tay*************', (string) $this->stringable('taylor@email.com')->mask('*', 3)); <add> $this->assertSame('******@email.com', (string) $this->stringable('taylor@email.com')->mask('*', 0, 6)); <add> $this->assertSame('tay*************', (string) $this->stringable('taylor@email.com')->mask('*', -13)); <add> $this->assertSame('tay***@email.com', (string) $this->stringable('taylor@email.com')->mask('*', -13, 3)); <ide> <del> $this->assertEquals('****************', $this->stringable('taylor@email.com')->mask('*', -17)); <del> $this->assertEquals('*****r@email.com', $this->stringable('taylor@email.com')->mask('*', -99, 5)); <add> $this->assertSame('****************', (string) $this->stringable('taylor@email.com')->mask('*', -17)); <add> $this->assertSame('*****r@email.com', (string) $this->stringable('taylor@email.com')->mask('*', -99, 5)); <ide> <del> $this->assertEquals('taylor@email.com', $this->stringable('taylor@email.com')->mask('*', 16)); <del> $this->assertEquals('taylor@email.com', $this->stringable('taylor@email.com')->mask('*', 16, 99)); <add> $this->assertSame('taylor@email.com', (string) $this->stringable('taylor@email.com')->mask('*', 16)); <add> $this->assertSame('taylor@email.com', (string) $this->stringable('taylor@email.com')->mask('*', 16, 99)); <ide> <del> $this->assertEquals('taylor@email.com', $this->stringable('taylor@email.com')->mask('', 3)); <add> $this->assertSame('taylor@email.com', (string) $this->stringable('taylor@email.com')->mask('', 3)); <ide> <del> $this->assertEquals('taysssssssssssss', $this->stringable('taylor@email.com')->mask('something', 3)); <add> $this->assertSame('taysssssssssssss', (string) $this->stringable('taylor@email.com')->mask('something', 3)); <ide> <del> $this->assertEquals('这是一***', $this->stringable('这是一段中文')->mask('*', 3)); <del> $this->assertEquals('**一段中文', $this->stringable('这是一段中文')->mask('*', 0, 2)); <add> $this->assertSame('这是一***', (string) $this->stringable('这是一段中文')->mask('*', 3)); <add> $this->assertSame('**一段中文', (string) $this->stringable('这是一段中文')->mask('*', 0, 2)); <ide> } <ide> <ide> public function testRepeat() <ide><path>tests/Support/ValidatedInputTest.php <ide> public function test_can_access_input() <ide> { <ide> $input = new ValidatedInput(['name' => 'Taylor', 'votes' => 100]); <ide> <del> $this->assertEquals('Taylor', $input->name); <del> $this->assertEquals('Taylor', $input['name']); <add> $this->assertSame('Taylor', $input->name); <add> $this->assertSame('Taylor', $input['name']); <ide> $this->assertEquals(['name' => 'Taylor'], $input->only(['name'])); <ide> $this->assertEquals(['name' => 'Taylor'], $input->except(['votes'])); <ide> $this->assertEquals(['name' => 'Taylor', 'votes' => 100], $input->all()); <ide> public function test_can_merge_items() <ide> <ide> $input = $input->merge(['votes' => 100]); <ide> <del> $this->assertEquals('Taylor', $input->name); <del> $this->assertEquals('Taylor', $input['name']); <add> $this->assertSame('Taylor', $input->name); <add> $this->assertSame('Taylor', $input['name']); <ide> $this->assertEquals(['name' => 'Taylor'], $input->only(['name'])); <ide> $this->assertEquals(['name' => 'Taylor'], $input->except(['votes'])); <ide> $this->assertEquals(['name' => 'Taylor', 'votes' => 100], $input->all()); <ide><path>tests/Testing/ParallelTestingTest.php <ide> public function testCallbacks($callback) <ide> $this->assertNull($testCase); <ide> } <ide> <del> $this->assertSame('1', $token); <add> $this->assertSame('1', (string) $token); <ide> $state = true; <ide> }); <ide> <ide> public function testToken() <ide> return '1'; <ide> }); <ide> <del> $this->assertSame('1', $parallelTesting->token()); <add> $this->assertSame('1', (string) $parallelTesting->token()); <ide> } <ide> <ide> public function callbacks() <ide><path>tests/Testing/TestResponseTest.php <ide> public function testGetDecryptedCookie() <ide> $cookie = $response->getCookie('cookie-name', false); <ide> <ide> $this->assertInstanceOf(Cookie::class, $cookie); <del> $this->assertEquals('cookie-name', $cookie->getName()); <del> $this->assertEquals('cookie-value', $cookie->getValue()); <add> $this->assertSame('cookie-name', $cookie->getName()); <add> $this->assertSame('cookie-value', $cookie->getValue()); <ide> } <ide> <ide> public function testGetEncryptedCookie() <ide><path>tests/Validation/ValidationExceptionTest.php <ide> public function testExceptionSummarizesZeroErrors() <ide> { <ide> $exception = $this->getException([], []); <ide> <del> $this->assertEquals('The given data was invalid.', $exception->getMessage()); <add> $this->assertSame('The given data was invalid.', $exception->getMessage()); <ide> } <ide> <ide> public function testExceptionSummarizesOneError() <ide> { <ide> $exception = $this->getException([], ['foo' => 'required']); <ide> <del> $this->assertEquals('validation.required', $exception->getMessage()); <add> $this->assertSame('validation.required', $exception->getMessage()); <ide> } <ide> <ide> public function testExceptionSummarizesTwoErrors() <ide> { <ide> $exception = $this->getException([], ['foo' => 'required', 'bar' => 'required']); <ide> <del> $this->assertEquals('validation.required (and 1 more error)', $exception->getMessage()); <add> $this->assertSame('validation.required (and 1 more error)', $exception->getMessage()); <ide> } <ide> <ide> public function testExceptionSummarizesThreeOrMoreErrors() <ide> public function testExceptionSummarizesThreeOrMoreErrors() <ide> 'baz' => 'required', <ide> ]); <ide> <del> $this->assertEquals('validation.required (and 2 more errors)', $exception->getMessage()); <add> $this->assertSame('validation.required (and 2 more errors)', $exception->getMessage()); <ide> } <ide> <ide> protected function getException($data = [], $rules = []) <ide><path>tests/Validation/ValidationRuleParserTest.php <ide> public function testExplodeProperlyParsesSingleRegexRule() <ide> ['items.*.type' => 'regex:/^(foo|bar)$/i'] <ide> ); <ide> <del> $this->assertEquals('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][0]); <add> $this->assertSame('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][0]); <ide> } <ide> <ide> public function testExplodeProperlyParsesRegexWithArrayOfRules() <ide> public function testExplodeProperlyParsesRegexWithArrayOfRules() <ide> ['items.*.type' => ['in:foo', 'regex:/^(foo|bar)$/i']] <ide> ); <ide> <del> $this->assertEquals('in:foo', $exploded->rules['items.0.type'][0]); <del> $this->assertEquals('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][1]); <add> $this->assertSame('in:foo', $exploded->rules['items.0.type'][0]); <add> $this->assertSame('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][1]); <ide> } <ide> <ide> public function testExplodeProperlyParsesRegexThatDoesNotContainPipe() <ide> public function testExplodeProperlyParsesRegexThatDoesNotContainPipe() <ide> ['items.*.type' => 'in:foo|regex:/^(bar)$/i'] <ide> ); <ide> <del> $this->assertEquals('in:foo', $exploded->rules['items.0.type'][0]); <del> $this->assertEquals('regex:/^(bar)$/i', $exploded->rules['items.0.type'][1]); <add> $this->assertSame('in:foo', $exploded->rules['items.0.type'][0]); <add> $this->assertSame('regex:/^(bar)$/i', $exploded->rules['items.0.type'][1]); <ide> } <ide> <ide> public function testExplodeFailsParsingRegexWithOtherRulesInSingleString() <ide> public function testExplodeFailsParsingRegexWithOtherRulesInSingleString() <ide> ['items.*.type' => 'in:foo|regex:/^(foo|bar)$/i'] <ide> ); <ide> <del> $this->assertEquals('in:foo', $exploded->rules['items.0.type'][0]); <del> $this->assertEquals('regex:/^(foo', $exploded->rules['items.0.type'][1]); <del> $this->assertEquals('bar)$/i', $exploded->rules['items.0.type'][2]); <add> $this->assertSame('in:foo', $exploded->rules['items.0.type'][0]); <add> $this->assertSame('regex:/^(foo', $exploded->rules['items.0.type'][1]); <add> $this->assertSame('bar)$/i', $exploded->rules['items.0.type'][2]); <ide> } <ide> <ide> public function testExplodeProperlyFlattensRuleArraysOfArrays() <ide> public function testExplodeProperlyFlattensRuleArraysOfArrays() <ide> ['items.*.type' => ['in:foo', [[['regex:/^(foo|bar)$/i']]]]] <ide> ); <ide> <del> $this->assertEquals('in:foo', $exploded->rules['items.0.type'][0]); <del> $this->assertEquals('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][1]); <add> $this->assertSame('in:foo', $exploded->rules['items.0.type'][0]); <add> $this->assertSame('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][1]); <ide> } <ide> <ide> public function testExplodeGeneratesNestedRules() <ide> public function testExplodeGeneratesNestedRules() <ide> <ide> $results = $parser->explode([ <ide> 'users.*.name' => Rule::forEach(function ($value, $attribute, $data) { <del> $this->assertEquals('Taylor Otwell', $value); <del> $this->assertEquals('users.0.name', $attribute); <add> $this->assertSame('Taylor Otwell', $value); <add> $this->assertSame('users.0.name', $attribute); <ide> $this->assertEquals($data['users.0.name'], 'Taylor Otwell'); <ide> <ide> return [Rule::requiredIf(true)]; <ide> public function testExplodeGeneratesNestedRulesForNonNestedData() <ide> <ide> $results = $parser->explode([ <ide> 'name' => Rule::forEach(function ($value, $attribute, $data = null) { <del> $this->assertEquals('Taylor Otwell', $value); <del> $this->assertEquals('name', $attribute); <add> $this->assertSame('Taylor Otwell', $value); <add> $this->assertSame('name', $attribute); <ide> $this->assertEquals(['name' => 'Taylor Otwell'], $data); <ide> <ide> return 'required'; <ide> public function testExplodeHandlesRecursivelyNestedRules() <ide> $results = $parser->explode([ <ide> 'users.*.name' => [ <ide> Rule::forEach(function ($value, $attribute, $data) { <del> $this->assertEquals('Taylor Otwell', $value); <del> $this->assertEquals('users.0.name', $attribute); <add> $this->assertSame('Taylor Otwell', $value); <add> $this->assertSame('users.0.name', $attribute); <ide> $this->assertEquals(['users.0.name' => 'Taylor Otwell'], $data); <ide> <ide> return Rule::forEach(function ($value, $attribute, $data) { <ide> $this->assertNull($value); <del> $this->assertEquals('users.0.name', $attribute); <add> $this->assertSame('users.0.name', $attribute); <ide> $this->assertEquals(['users.0.name' => 'Taylor Otwell'], $data); <ide> <ide> return Rule::forEach(function ($value, $attribute, $data) { <ide> $this->assertNull($value); <del> $this->assertEquals('users.0.name', $attribute); <add> $this->assertSame('users.0.name', $attribute); <ide> $this->assertEquals(['users.0.name' => 'Taylor Otwell'], $data); <ide> <ide> return [Rule::requiredIf(true)];
31
Python
Python
fix bugs in deep_learning_keras example
4c27958990d186f8ad3ffe595a784e5fe4fc64cf
<ide><path>examples/deep_learning_keras.py <add>import plac <add>import collections <add>import random <add> <add>import cytoolz <ide> import numpy <del>from collections import defaultdict <add>from keras.layers import Sequential, LSTM, Dense, Embedding, Dropout <add>from keras.wrappers import Bidirectional <add>from keras import model_from_json <add>import cPickle as pickle <ide> <ide> import spacy <ide> <ide> <ide> class SentimentAnalyser(object): <ide> @classmethod <ide> def load(cls, path, nlp): <del> pass <add> with (path / 'config.json').open() as file_: <add> <add> model = model_from_json(file_.read()) <add> with (path / 'model').open('rb') as file_: <add> lstm_weights = pickle.load(file_) <add> embeddings = get_embeddings(nlp.vocab) <add> model.set_weights([embeddings] + lstm_weights) <add> return cls(model) <ide> <ide> def __init__(self, model): <ide> self._model = model <del> <add> <ide> def __call__(self, doc): <ide> X = get_features([doc], self.max_length) <ide> y = self._model.predict(X) <ide> self.set_sentiment(doc, y) <ide> <ide> def pipe(self, docs, batch_size=1000, n_threads=2): <del> for minibatch in partition_all(batch_size, docs): <del> Xs = _get_features(minibatch) <del> ys = self._model.predict(X) <add> for minibatch in cytoolz.partition_all(batch_size, docs): <add> Xs = get_features(minibatch, self.max_length) <add> ys = self._model.predict(Xs) <ide> for i, doc in enumerate(minibatch): <ide> doc.user_data['sentiment'] = ys[i] <ide> <ide> def set_sentiment(self, doc, y): <del> doc.user_data['sentiment'] = y <add> doc.sentiment = float(y[0]) <add> # Sentiment has a native slot for a single float. <add> # For arbitrary data storage, there's: <add> # doc.user_data['my_data'] = y <ide> <ide> <ide> def get_features(docs, max_length): <ide> Xs = numpy.zeros(len(docs), max_length, dtype='int32') <del> for i, doc in enumerate(minibatch): <add> for i, doc in enumerate(docs): <ide> for j, token in enumerate(doc[:max_length]): <ide> Xs[i, j] = token.rank if token.has_vector else 0 <ide> return Xs <del> <del>def compile_lstm(embeddings, shape, settings, optimizer): <add> <add> <add>def train(train_texts, train_labels, dev_texts, dev_labels, <add> lstm_shape, lstm_settings, lstm_optimizer, batch_size=100, nb_epoch=5): <add> nlp = spacy.load('en', parser=False, tagger=False, entity=False) <add> embeddings = get_embeddings(nlp.vocab) <add> model = compile_lstm(embeddings, lstm_shape, lstm_settings) <add> train_X = get_features(nlp.pipe(train_texts), lstm_shape['max_length']) <add> dev_X = get_features(nlp.pipe(dev_texts), lstm_shape['max_length']) <add> model.fit(train_X, train_labels, dev_X, dev_labels, <add> nb_epoch=nb_epoch, batch_size=batch_size) <add> return model <add> <add> <add>def compile_lstm(embeddings, shape, settings): <ide> model = Sequential() <ide> model.add( <ide> Embedding( <ide> def compile_lstm(embeddings, shape, settings, optimizer): <ide> <ide> <ide> def get_embeddings(vocab): <del> ''' <del> Get a numpy vector of the word embeddings. The Lexeme.rank attribute will <del> be the index into the table. We're going to be "decadent" here and use <del> 1m vectors, because we're not going to fine-tune them. <del> ''' <del> max_rank = max(lex.rank for lex in nlp.vocab if lex.has_vector) <del> vectors = numpy.ndarray((max_rank+1, nlp.vocab.vectors_length), dtype='float32') <add> max_rank = max(lex.rank for lex in vocab if lex.has_vector) <add> vectors = numpy.ndarray((max_rank+1, vocab.vectors_length), dtype='float32') <ide> for lex in vocab: <ide> if lex.has_vector: <ide> vectors[lex.rank] = lex.vector <ide> return vectors <ide> <ide> <del>def train(train_texts, train_labels, dev_texts, dev_labels, <del> lstm_shape, lstm_settings, lstm_optimizer, batch_size=100, nb_epoch=5): <del> nlp = spacy.load('en', parser=False, tagger=False, entity=False) <del> model = _compile_model( <del> _get_embeddings( <del> nlp.vocab), <del> lstm_shape, <del> lstm_settings, <del> lstm_optimizer) <del> model.fit( <del> _get_features( <del> nlp.pipe( <del> train_texts)), <del> train_ys, <del> _get_features( <del> nlp.pipe( <del> dev_texts)), <del> dev_ys, <del> nb_epoch=nb_epoch, <del> batch_size=batch_size) <del> model.save(model_dir) <del> <del> <ide> def demonstrate_runtime(model_dir, texts): <ide> '''Demonstrate runtime usage of the custom sentiment model with spaCy. <ide> <ide> def create_pipeline(nlp): <ide> return [nlp.tagger, nlp.entity, SentimentAnalyser.load(model_dir, nlp)] <ide> <ide> nlp = spacy.load('en', create_pipeline=create_pipeline) <del> entity_sentiments = defaultdict(float) <del> entity_freqs = defaultdict(int) <add> <add> entity_sentiments = collections.Counter(float) <ide> for doc in nlp.pipe(texts, batch_size=1000, n_threads=4): <del> sentiment = doc.user_data['sentiment'] <ide> for ent in doc.ents: <del> entity_sentiments[ent.text] += sentiment <del> entity_freqs[ent.text] += 1 <del> # Compute estimate of P(sentiment | entity) <del> for entity, sentiment in entity_freqs.items(): <del> entity_sentiments[entity] /= entity_freqs[entity] <add> entity_sentiments[ent.text] += doc.sentiment <ide> return entity_sentiments <ide> <ide> <ide> def read_data(data_dir, limit=0): <ide> for subdir, label in (('pos', 1), ('neg', 0)): <ide> for filename in (data_dir / subdir).iterdir(): <ide> with filename.open() as file_: <del> text = filename.read() <add> text = file_.read() <ide> examples.append((text, label)) <ide> random.shuffle(examples) <ide> if limit >= 1: <ide> def main(model_dir, train_dir, dev_dir, <ide> dropout=0.5, # General NN config <ide> nb_epoch=5, batch_size=100, nr_examples=-1): # Training params <ide> if is_runtime: <del> dev_texts, dev_labels = read_dev(dev_dir) <add> dev_texts, dev_labels = read_data(dev_dir) <ide> demonstrate_runtime(model_dir, dev_texts) <ide> else: <ide> train_texts, train_labels = read_data(train_dir, limit=nr_examples) <del> dev_texts, dev_labels = read_dev(dev_dir) <add> dev_texts, dev_labels = read_data(dev_dir) <ide> lstm = train(train_texts, train_labels, dev_texts, dev_labels, <ide> {'nr_hidden': nr_hidden, 'max_length': max_length}, <ide> {'dropout': 0.5}, <ide> {}, <ide> nb_epoch=nb_epoch, batch_size=batch_size) <add> weights = lstm.get_weights() <add> with (model_dir / 'model').open('wb') as file_: <add> pickle.dump(file_, weights[1:]) <ide> <ide> <ide> if __name__ == '__main__':
1
Python
Python
fix typo in language.from_disk
f08c871adf6f126c2ea7112804c813b977bcb167
<ide><path>spacy/language.py <ide> def from_disk(self, path, disable=tuple()): <ide> for name, proc in self.pipeline: <ide> if name in disable: <ide> continue <del> if not hasattr(proc, 'to_disk'): <add> if not hasattr(proc, 'from_disk'): <ide> continue <ide> deserializers[name] = lambda p, proc=proc: proc.from_disk(p, vocab=False) <ide> exclude = {p: False for p in disable}
1
Javascript
Javascript
remove unused imageprops
fbd09b179759cd90f2be5c24caa11bdb483ad8cd
<ide><path>Libraries/Image/ImageProps.js <ide> export type ImageProps = {| <ide> */ <ide> style?: ?ImageStyleProp, <ide> <del> // Can be set via props or style, for now <del> height?: ?DimensionValue, <del> width?: ?DimensionValue, <del> <ide> /** <ide> * Determines how to resize the image when the frame doesn't match the raw <ide> * image dimensions.
1
Ruby
Ruby
fix rubocop warnings
ecda1c9c54bce43803236fdf1d92ce452905e9be
<ide><path>Library/Homebrew/os/mac/linkage_checker.rb <ide> def check_dylibs <ide> end <ide> <ide> def check_undeclared_deps <del> filter_out = proc do |dep| <del> next true if dep.build? <del> next false unless dep.optional? || dep.recommended? <del> formula.build.without?(dep) <del> end <del> declared_deps = formula.deps.reject { |dep| filter_out.call(dep) }.map(&:name) <del> declared_requirement_deps = formula.requirements.reject { |req| filter_out.call(req) }.map(&:default_formula).compact <del> declared_dep_names = (declared_deps + declared_requirement_deps).map { |dep| dep.split("/").last } <del> undeclared_deps = @brewed_dylibs.keys.select do |full_name| <del> name = full_name.split("/").last <del> next false if name == formula.name <del> !declared_dep_names.include?(name) <del> end <del> undeclared_deps.sort do |a,b| <del> if a.include?("/") && !b.include?("/") <del> 1 <del> elsif !a.include?("/") && b.include?("/") <del> -1 <del> else <del> a <=> b <del> end <add> filter_out = proc do |dep| <add> next true if dep.build? <add> next false unless dep.optional? || dep.recommended? <add> formula.build.without?(dep) <add> end <add> declared_deps = formula.deps.reject { |dep| filter_out.call(dep) }.map(&:name) <add> declared_requirement_deps = formula.requirements.reject { |req| filter_out.call(req) }.map(&:default_formula).compact <add> declared_dep_names = (declared_deps + declared_requirement_deps).map { |dep| dep.split("/").last } <add> undeclared_deps = @brewed_dylibs.keys.select do |full_name| <add> name = full_name.split("/").last <add> next false if name == formula.name <add> !declared_dep_names.include?(name) <add> end <add> undeclared_deps.sort do |a, b| <add> if a.include?("/") && !b.include?("/") <add> 1 <add> elsif !a.include?("/") && b.include?("/") <add> -1 <add> else <add> a <=> b <ide> end <add> end <ide> end <ide> <ide> def display_normal_output
1
Go
Go
use a symlink instead of a copy
f9901ead069671c04a2f99c83c1e4d8a13597e7b
<ide><path>runtime.go <ide> func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) { <ide> return nil, err <ide> } <ide> <del> if err := copyLxcStart(config.Root); err != nil { <add> if err := linkLxcStart(config.Root); err != nil { <ide> return nil, err <ide> } <ide> g, err := NewGraph(path.Join(config.Root, "graph")) <ide> func (runtime *Runtime) Close() error { <ide> return runtime.containerGraph.Close() <ide> } <ide> <del>func copyLxcStart(root string) error { <add>func linkLxcStart(root string) error { <ide> sourcePath, err := exec.LookPath("lxc-start") <ide> if err != nil { <ide> return err <ide> } <ide> targetPath := path.Join(root, "lxc-start-unconfined") <del> sourceFile, err := os.Open(sourcePath) <del> if err != nil { <del> return err <del> } <del> defer sourceFile.Close() <del> targetFile, err := os.Create(targetPath) <del> if err != nil { <add> <add> if _, err := os.Stat(targetPath); err != nil && !os.IsNotExist(err) { <ide> return err <add> } else if err == nil { <add> if err := os.Remove(targetPath); err != nil { <add> return err <add> } <ide> } <del> defer targetFile.Close() <del> os.Chmod(targetPath, 0755) <del> _, err = io.Copy(targetFile, sourceFile) <del> return err <add> return os.Symlink(sourcePath, targetPath) <ide> } <ide> <ide> // History is a convenience type for storing a list of containers,
1
Python
Python
remove support for doctests
84f775803994ccd82671dd4a6f9b4d87aa36dc31
<ide><path>rest_framework/renderers.py <ide> by serializing the output along with documentation regarding the View, output status and headers, <ide> and providing forms and links depending on the allowed methods, renderers and parsers on the View. <ide> """ <del>import copy <ide> import string <ide> from django import forms <ide> from django.template import RequestContext, loader <ide> from django.utils import simplejson as json <ide> from rest_framework.compat import yaml <ide> from rest_framework.settings import api_settings <add>from rest_framework.request import clone_request <ide> from rest_framework.utils import dict2xml <ide> from rest_framework.utils import encoders <ide> from rest_framework.utils.breadcrumbs import get_breadcrumbs <ide> def get_form(self, view, method, request): <ide> if not api_settings.FORM_METHOD_OVERRIDE: <ide> return # Cannot use form overloading <ide> <del> temp = request._method <del> request._method = method.upper() <add> request = clone_request(request, method) <ide> if not view.has_permission(request): <del> request._method = temp <ide> return # Don't have permission <del> request._method = temp <ide> <ide> if method == 'DELETE' or method == 'OPTIONS': <ide> return True # Don't actually need to return a form <ide><path>rest_framework/request.py <ide> def _hasattr(obj, name): <ide> return not getattr(obj, name) is Empty <ide> <ide> <add>def clone_request(request, method): <add> """ <add> Internal helper method to clone a request, replacing with a different <add> HTTP method. Used for checking permissions against other methods. <add> """ <add> ret = Request(request._request, <add> request.parser_classes, <add> request.authentication_classes) <add> ret._data = request._data <add> ret._files = request._files <add> ret._content_type = request._content_type <add> ret._stream = request._stream <add> ret._method = method <add> return ret <add> <add> <ide> class Request(object): <ide> """ <ide> Wrapper allowing to enhance a standard `HttpRequest` instance. <ide><path>rest_framework/tests/__init__.py <ide> __test__ = dict() <ide> <ide> for module in modules: <del> exec("from rest_framework.tests.%s import __doc__ as module_doc" % module) <ide> exec("from rest_framework.tests.%s import *" % module) <del> __test__[module] = module_doc or ""
3
Javascript
Javascript
remove node_unique_id from env on startup
81a4edcf6afc1180b80a516db894db400ce04b1a
<ide><path>lib/cluster.js <ide> var debug; <ide> if (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) { <ide> debug = function(x) { <ide> var prefix = process.pid + ',' + <del> (process.env.NODE_WORKER_ID ? 'Worker' : 'Master'); <add> (process.env.NODE_UNIQUE_ID ? 'Worker' : 'Master'); <ide> console.error(prefix, x); <ide> }; <ide> } else { <ide><path>lib/net.js <ide> var stream = require('stream'); <ide> var timers = require('timers'); <ide> var util = require('util'); <ide> var assert = require('assert'); <add>var cluster; <ide> <ide> function noop() {} <ide> <ide> Server.prototype._listen2 = function(address, port, addressType, backlog) { <ide> <ide> <ide> function listen(self, address, port, addressType, backlog) { <del> if (process.env.NODE_UNIQUE_ID) { <del> var cluster = require('cluster'); <add> if (!cluster) cluster = require('cluster'); <add> <add> if (cluster.isWorker) { <ide> cluster._getServer(self, address, port, addressType, function(handle) { <ide> self._handle = handle; <ide> self._listen2(address, port, addressType, backlog); <ide><path>src/node.js <ide> if (process.env.NODE_UNIQUE_ID) { <ide> var cluster = NativeModule.require('cluster'); <ide> cluster._setupWorker(); <add> <add> // Make sure it's not accidentally inherited by child processes. <add> delete process.env.NODE_UNIQUE_ID; <ide> } <ide> <ide> var Module = NativeModule.require('module'); <ide><path>test/simple/test-cluster-basic.js <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var cluster = require('cluster'); <ide> <add>assert.equal('NODE_UNIQUE_ID' in process.env, false, <add> 'NODE_UNIQUE_ID should be removed on startup'); <add> <ide> function forEach(obj, fn) { <ide> Object.keys(obj).forEach(function(name, index) { <ide> fn(obj[name], name, index); <ide> if (cluster.isWorker) { <ide> <ide> else if (cluster.isMaster) { <ide> <del> assert.equal('NODE_UNIQUE_ID' in process.env, false, <del> 'cluster.isMaster should not be true when NODE_UNIQUE_ID is set'); <del> <ide> var checks = { <ide> cluster: { <ide> events: {
4
PHP
PHP
add test for decimal cast
437060a048d722c544f71637cd920a2ad20d19fd
<ide><path>tests/Integration/Database/EloquentModelDecimalCastingTest.php <add><?php <add> <add>namespace Illuminate\Tests\Integration\Database\EloquentModelDecimalCastingTest; <add> <add>use Illuminate\Support\Facades\Schema; <add>use Illuminate\Database\Eloquent\Model; <add>use Illuminate\Tests\Integration\Database\DatabaseTestCase; <add> <add>/** <add> * @group integration <add> */ <add>class EloquentModelDecimalCastingTest extends DatabaseTestCase <add>{ <add> public function setUp() <add> { <add> parent::setUp(); <add> <add> Schema::create('test_model1', function ($table) { <add> $table->increments('id'); <add> $table->decimal('decimal_field_2', 8, 2)->nullable(); <add> $table->decimal('decimal_field_4', 8, 4)->nullable(); <add> }); <add> } <add> <add> public function test_decimals_are_castable() <add> { <add> $user = TestModel1::create([ <add> 'decimal_field_2' => '12', <add> 'decimal_field_4' => '1234', <add> ]); <add> <add> $this->assertEquals('12.00', $user->toArray()['decimal_field_2']); <add> $this->assertEquals('1234.0000', $user->toArray()['decimal_field_4']); <add> <add> $user->decimal_field_2 = 12; <add> $user->decimal_field_4 = '1234'; <add> <add> $this->assertEquals('12.00', $user->toArray()['decimal_field_2']); <add> $this->assertEquals('1234.0000', $user->toArray()['decimal_field_4']); <add> <add> $this->assertFalse($user->isDirty()); <add> <add> $user->decimal_field_4 = '1234.1234'; <add> $this->assertTrue($user->isDirty()); <add> } <add>} <add> <add>class TestModel1 extends Model <add>{ <add> public $table = 'test_model1'; <add> public $timestamps = false; <add> protected $guarded = ['id']; <add> <add> public $casts = [ <add> 'decimal_field_2' => 'decimal:2', <add> 'decimal_field_4' => 'decimal:4', <add> ]; <add>}
1
Text
Text
move zfs options to correct place in man page
df6def3c0c1e2a566f3af3499865f8e9bf9da568
<ide><path>man/docker-daemon.8.md <ide> this topic, see <ide> Otherwise, set this flag for migrating existing Docker daemons to a <ide> daemon with a supported environment. <ide> <del>## ZFS options <del> <del>#### zfs.fsname <del> <del>Set zfs filesystem under which docker will create its own datasets. <del>By default docker will pick up the zfs filesystem where docker graph <del>(`/var/lib/docker`) is located. <del> <del>Example use: `docker daemon -s zfs --storage-opt zfs.fsname=zroot/docker` <del> <ide> #### dm.min_free_space <ide> <ide> Specifies the min free space percent in thin pool require for new device <ide> that should resolve the issue. <ide> <ide> Example use: `docker daemon --storage-opt dm.min_free_space_percent=10%` <ide> <add>## ZFS options <add> <add>#### zfs.fsname <add> <add>Set zfs filesystem under which docker will create its own datasets. <add>By default docker will pick up the zfs filesystem where docker graph <add>(`/var/lib/docker`) is located. <add> <add>Example use: `docker daemon -s zfs --storage-opt zfs.fsname=zroot/docker` <add> <ide> # CLUSTER STORE OPTIONS <ide> <ide> The daemon uses libkv to advertise
1
PHP
PHP
fix issue with $uses merging
7fe7ce78a76051cb320fb421ac5ac511fccb9a02
<ide><path>lib/Cake/Controller/Controller.php <ide> protected function _mergeControllerVars() { <ide> if ($this->uses === true) { <ide> $this->uses = [$pluginDot . $this->modelClass]; <ide> } <del> $oldUses = $this->uses; <ide> $this->_mergeVars( <ide> ['components', 'helpers', 'uses'], <ide> [ <ide> 'associative' => ['components', 'helpers'], <ide> 'reverse' => ['uses'] <ide> ] <ide> ); <del> if ($this->uses === $oldUses && $this->modelClass) { <add> $usesProperty = new \ReflectionProperty($this, 'uses'); <add> if ($this->uses && $usesProperty->getDeclaringClass()->getName() !== get_class($this)) { <ide> array_unshift($this->uses, $pluginDot . $this->modelClass); <ide> } <ide> $this->uses = array_unique($this->uses); <ide><path>lib/Cake/Test/TestApp/Controller/RequestActionController.php <ide> * <ide> * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests <del> * @package Cake.Test.TestApp.Controller <ide> * @since CakePHP(tm) v 3.0.0 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide> */ <ide> /** <ide> * RequestActionController class <ide> * <add> * @package Cake.Test.TestApp.Controller <ide> */ <ide> class RequestActionController extends AppController { <ide> <ide> class RequestActionController extends AppController { <ide> * @var array <ide> * @access public <ide> */ <del> public $uses = array('RequestActionPost'); <add> public $uses = ['Post']; <ide> <ide> /** <ide> * test_request_action method <ide><path>lib/Cake/Test/TestApp/Model/Post.php <ide> class Post extends AppModel { <ide> <ide> public $name = 'Post'; <ide> <add>/** <add> * find method <add> * <add> * @param string $type <add> * @param array $options <add> * @return void <add> */ <add> public function find($type = 'first', $options = array()) { <add> if ($type == 'popular') { <add> $conditions = array($this->name . '.' . $this->primaryKey . ' > ' => '1'); <add> $options = Hash::merge($options, compact('conditions')); <add> return parent::find('all', $options); <add> } <add> return parent::find($type, $options); <add> } <ide> } <ide><path>lib/Cake/Test/TestCase/Controller/ControllerTest.php <ide> class ControllerTestAppController extends Controller { <ide> * <ide> * @var array <ide> */ <del> public $uses = array('ControllerPost'); <add> public $uses = ['Post']; <ide> <ide> /** <ide> * components property <ide> class ControllerTestAppController extends Controller { <ide> } <ide> <ide> <del>/** <del> * ControllerPost class <del> * <del> * @package Cake.Test.Case.Controller <del> */ <del>class ControllerPost extends TestModel { <del> <del>/** <del> * name property <del> * <del> * @var string 'ControllerPost' <del> */ <del> public $name = 'ControllerPost'; <del> <del>/** <del> * useTable property <del> * <del> * @var string 'posts' <del> */ <del> public $useTable = 'posts'; <del> <del>/** <del> * invalidFields property <del> * <del> * @var array <del> */ <del> public $invalidFields = array('name' => 'error_msg'); <del> <del>/** <del> * lastQuery property <del> * <del> * @var mixed null <del> */ <del> public $lastQuery = null; <del> <del>/** <del> * beforeFind method <del> * <del> * @param mixed $query <del> * @return void <del> */ <del> public function beforeFind($query) { <del> $this->lastQuery = $query; <del> } <del> <del>/** <del> * find method <del> * <del> * @param string $type <del> * @param array $options <del> * @return void <del> */ <del> public function find($type = 'first', $options = array()) { <del> if ($type == 'popular') { <del> $conditions = array($this->name . '.' . $this->primaryKey . ' > ' => '1'); <del> $options = Hash::merge($options, compact('conditions')); <del> return parent::find('all', $options); <del> } <del> return parent::find($type, $options); <del> } <del> <del>} <del> <ide> /** <ide> * TestController class <ide> * <ide> class AnotherTestController extends ControllerTestAppController { <ide> */ <ide> public $name = 'AnotherTest'; <ide> <del>/** <del> * uses property <del> * <del> * @var array <del> */ <del> public $uses = false; <del> <ide> } <ide> <ide> /** <ide> public function testMergeVars() { <ide> ]; <ide> $this->assertEquals($expected, $TestController->components); <ide> <del> $expected = array('Comment', 'ControllerPost'); <add> $expected = array('Comment', 'Post'); <ide> $this->assertEquals( <ide> $expected, <ide> $TestController->uses, <ide> public function testMergeVars() { <ide> $TestController = new AnotherTestController($request); <ide> $TestController->constructClasses(); <ide> <del> $appVars = get_class_vars(__NAMESPACE__ . '\ControllerTestAppController'); <del> $testVars = get_class_vars(__NAMESPACE__ . '\AnotherTestController'); <del> <del> $this->assertTrue(in_array('ControllerPost', $appVars['uses'])); <del> $this->assertFalse($testVars['uses']); <del> <del> $this->assertFalse(property_exists($TestController, 'ControllerPost')); <add> $this->assertEquals('AnotherTest', $TestController->modelClass); <add> $this->assertEquals( <add> ['AnotherTest', 'Post'], <add> $TestController->uses, <add> 'Incorrect uses when controller does not define $uses.' <add> ); <ide> } <ide> <ide> /** <ide> public function testValidateErrors() { <ide> public function testValidateErrorsOnArbitraryModels() { <ide> $TestController = new TestController(); <ide> <del> $Post = new ControllerPost(); <add> $Post = new \TestApp\Model\Post(); <ide> $Post->validate = array('title' => 'notEmpty'); <ide> $Post->set('title', ''); <ide> $result = $TestController->validateErrors($Post);
4
Text
Text
use more tables in run reference and minor fixups
37d856db14280a35bcc4b53009db5a286f1ef9b6
<ide><path>docs/sources/reference/run.md <ide> page_title: Docker run reference <ide> page_description: Configure containers at runtime <ide> page_keywords: docker, run, configure, runtime <ide> <add><!-- TODO (@thaJeztah) define more flexible table/td classes --> <add><style> <add>.content-body table .no-wrap { <add> white-space: nowrap; <add>} <add></style> <ide> # Docker run reference <ide> <ide> **Docker runs processes in isolated containers**. When an operator <ide> following options. <ide> - [Container Identification](#container-identification) <ide> - [Name (--name)](#name-name) <ide> - [PID Equivalent](#pid-equivalent) <del> - [IPC Settings](#ipc-settings) <add> - [IPC Settings (--ipc)](#ipc-settings-ipc) <ide> - [Network Settings](#network-settings) <del> - [Restart Policies<br />(--restart)](#restart-policies-restart) <add> - [Restart Policies (--restart)](#restart-policies-restart) <ide> - [Clean Up (--rm)](#clean-up-rm) <ide> - [Runtime Constraints on CPU and Memory](#runtime-constraints-on-cpu-and-memory) <ide> - [Runtime Privilege, Linux Capabilities, and LXC Configuration](#runtime-privilege-linux-capabilities-and-lxc-configuration) <ide> programs might write out their process ID to a file (you've seen them as <ide> PID files): <ide> <ide> --cidfile="": Write the container ID to the file <del> <add> <ide> ### Image[:tag] <ide> <ide> While not strictly a means of identifying a container, you can specify a version of an <ide> image you'd like to run the container with by adding `image[:tag]` to the command. For <ide> example, `docker run ubuntu:14.04`. <ide> <del>## PID Settings <add>## PID Settings (--pid) <ide> --pid="" : Set the PID (Process) Namespace mode for the container, <ide> 'host': use the host's PID namespace inside the container <add> <ide> By default, all containers have the PID namespace enabled. <ide> <ide> PID namespace provides separation of processes. The PID Namespace removes the <ide> within the container. <ide> This command would allow you to use `strace` inside the container on pid 1234 on <ide> the host. <ide> <del>## IPC Settings <add>## IPC Settings (--ipc) <add> <ide> --ipc="" : Set the IPC mode for the container, <del> 'container:<name|id>': reuses another container's IPC namespace <del> 'host': use the host's IPC namespace inside the container <add> 'container:<name|id>': reuses another container's IPC namespace <add> 'host': use the host's IPC namespace inside the container <add> <ide> By default, all containers have the IPC namespace enabled. <ide> <del>IPC (POSIX/SysV IPC) namespace provides separation of named shared memory segments, semaphores and message queues. <add>IPC (POSIX/SysV IPC) namespace provides separation of named shared memory <add>segments, semaphores and message queues. <ide> <ide> Shared memory segments are used to accelerate inter-process communication at <ide> memory speed, rather than through pipes or through the network stack. Shared <ide> of the containers. <ide> <ide> --dns=[] : Set custom dns servers for the container <ide> --net="bridge" : Set the Network mode for the container <del> 'bridge': creates a new network stack for the container on the docker bridge <del> 'none': no networking for this container <del> 'container:<name|id>': reuses another container network stack <del> 'host': use the host network stack inside the container <add> 'bridge': creates a new network stack for the container on the docker bridge <add> 'none': no networking for this container <add> 'container:<name|id>': reuses another container network stack <add> 'host': use the host network stack inside the container <ide> --add-host="" : Add a line to /etc/hosts (host:IP) <ide> --mac-address="" : Sets the container's Ethernet device's MAC address <ide> <ide> explicitly by providing a MAC via the `--mac-address` parameter (format: <ide> <ide> Supported networking modes are: <ide> <del>* none - no networking in the container <del>* bridge - (default) connect the container to the bridge via veth interfaces <del>* host - use the host's network stack inside the container. Note: This gives the container full access to local system services such as D-bus and is therefore considered insecure. <del>* container - use another container's network stack <add><table> <add> <thead> <add> <tr> <add> <th class="no-wrap">Mode</th> <add> <th>Description</th> <add> </tr> <add> </thead> <add> <tbody> <add> <tr> <add> <td class="no-wrap"><strong>none</strong></td> <add> <td> <add> No networking in the container. <add> </td> <add> </tr> <add> <tr> <add> <td class="no-wrap"><strong>bridge</strong> (default)</td> <add> <td> <add> Connect the container to the bridge via veth interfaces. <add> </td> <add> </tr> <add> <tr> <add> <td class="no-wrap"><strong>host</strong></td> <add> <td> <add> Use the host's network stack inside the container. <add> </td> <add> </tr> <add> <tr> <add> <td class="no-wrap"><strong>container</strong>:&lt;name|id&gt;</td> <add> <td> <add> Use the network stack of another container, specified via <add> its *name* or *id*. <add> </td> <add> </tr> <add> </tbody> <add></table> <ide> <ide> #### Mode: none <ide> <ide> container. The container's hostname will match the hostname on the host <ide> system. Publishing ports and linking to other containers will not work <ide> when sharing the host's network stack. <ide> <add>> **Note**: `--net="host"` gives the container full access to local system <add>> services such as D-bus and is therefore considered insecure. <add> <ide> #### Mode: container <ide> <ide> With the networking mode set to `container` a container will share the <ide> container: <ide> ### Memory constraints <ide> <ide> We have four ways to set memory usage: <del> - memory=inf, memory-swap=inf (not specify any of them) <del> There is no memory limit, you can use as much as you want. <del> <del> - memory=L&lt;inf, memory-swap=inf (specify memory and set memory-swap as `-1`) <del> It is not allowed to use more than L bytes of memory, but use as much swap <del> as you want (only if the host supports swap memory). <ide> <del> - memory=L&lt;inf, memory-swap=2*L (specify memory without memory-swap) <del> It is not allowed to use more than L bytes of memory, swap *plus* memory <del> usage is double of that. <del> <del> - memory=L&lt;inf, memory-swap=S&lt;inf, L&lt;=S (specify both memory and memory-swap) <del> It is not allowed to use more than L bytes of memory, swap *plus* memory <del> usage is limited by S. <add><table> <add> <thead> <add> <tr> <add> <th>Option</th> <add> <th>Result</th> <add> </tr> <add> </thead> <add> <tbody> <add> <tr> <add> <td class="no-wrap"> <add> <strong>memory=inf, memory-swap=inf</strong> (default) <add> </td> <add> <td> <add> There is no memory limit for the container. The container can use <add> as much memory as needed. <add> </td> <add> </tr> <add> <tr> <add> <td class="no-wrap"><strong>memory=L&lt;inf, memory-swap=inf</strong></td> <add> <td> <add> (specify memory and set memory-swap as <code>-1</code>) The container is <add> not allowed to use more than L bytes of memory, but can use as much swap <add> as is needed (if the host supports swap memory). <add> </td> <add> </tr> <add> <tr> <add> <td class="no-wrap"><strong>memory=L&lt;inf, memory-swap=2*L</strong></td> <add> <td> <add> (specify memory without memory-swap) The container is not allowed to <add> use more than L bytes of memory, swap *plus* memory usage is double <add> of that. <add> </td> <add> </tr> <add> <tr> <add> <td class="no-wrap"> <add> <strong>memory=L&lt;inf, memory-swap=S&lt;inf, L&lt;=S</strong> <add> </td> <add> <td> <add> (specify both memory and memory-swap) The container is not allowed to <add> use more than L bytes of memory, swap *plus* memory usage is limited <add> by S. <add> </td> <add> </tr> <add> </tbody> <add></table> <ide> <ide> ### CPU share constraint <ide> <ide> will be accessible within the container. <ide> By default, the container will be able to `read`, `write`, and `mknod` these devices. <ide> This can be overridden using a third `:rwm` set of options to each `--device` flag: <ide> <add> $ sudo docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk /dev/xvdc <ide> <del> $ sudo docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk /dev/xvdc <del> <del> Command (m for help): q <del> $ sudo docker run --device=/dev/sda:/dev/xvdc:r --rm -it ubuntu fdisk /dev/xvdc <del> You will not be able to write the partition table. <add> Command (m for help): q <add> $ sudo docker run --device=/dev/sda:/dev/xvdc:r --rm -it ubuntu fdisk /dev/xvdc <add> You will not be able to write the partition table. <ide> <del> Command (m for help): q <add> Command (m for help): q <ide> <del> $ sudo docker run --device=/dev/sda:/dev/xvdc:w --rm -it ubuntu fdisk /dev/xvdc <add> $ sudo docker run --device=/dev/sda:/dev/xvdc:w --rm -it ubuntu fdisk /dev/xvdc <ide> crash.... <ide> <del> $ sudo docker run --device=/dev/sda:/dev/xvdc:m --rm -it ubuntu fdisk /dev/xvdc <del> fdisk: unable to open /dev/xvdc: Operation not permitted <add> $ sudo docker run --device=/dev/sda:/dev/xvdc:m --rm -it ubuntu fdisk /dev/xvdc <add> fdisk: unable to open /dev/xvdc: Operation not permitted <ide> <ide> In addition to `--privileged`, the operator can have fine grain control over the <ide> capabilities using `--cap-add` and `--cap-drop`. By default, Docker has a default <ide> If you restart the source container (`servicename` in this case), the recipient <ide> container's `/etc/hosts` entry will be automatically updated. <ide> <ide> > **Note**: <del>> Unlike host entries in the `/ets/hosts` file, IP addresses stored in the <add>> Unlike host entries in the `/etc/hosts` file, IP addresses stored in the <ide> > environment variables are not automatically updated if the source container is <ide> > restarted. We recommend using the host entries in `/etc/hosts` to resolve the <ide> > IP address of linked containers.
1
Javascript
Javascript
fix integration test in the windows bot
451091b89babd933f03fb1d02d7069a7b14ed677
<ide><path>test/integration/scripting_spec.js <ide> describe("Interaction", () => { <ide> pages = await loadAndWait("js-authors.pdf", "#\\32 5R"); <ide> }); <ide> <add> afterAll(async () => { <add> await closePages(pages); <add> }); <add> <ide> it("must print authors in a text field", async () => { <ide> await Promise.all( <ide> pages.map(async ([browserName, page]) => { <ide> describe("Interaction", () => { <ide> pages = await loadAndWait("js-colors.pdf", "#\\33 4R"); <ide> }); <ide> <add> afterAll(async () => { <add> await closePages(pages); <add> }); <add> <ide> it("must change colors", async () => { <ide> await Promise.all( <ide> pages.map(async ([browserName, page]) => {
1
Text
Text
fix conv2d mode in doc examples
d00140862e1b118bb85039e9fbb49dd8ee849534
<ide><path>docs/templates/examples.md <ide> from keras.optimizers import SGD <ide> model = Sequential() <ide> # input: 100x100 images with 3 channels -> (3, 100, 100) tensors. <ide> # this applies 32 convolution filters of size 3x3 each. <del>model.add(Convolution2D(32, 3, 3, border_mode='full', input_shape=(3, 100, 100))) <add>model.add(Convolution2D(32, 3, 3, border_mode='valid', input_shape=(3, 100, 100))) <ide> model.add(Activation('relu')) <ide> model.add(Convolution2D(32, 3, 3)) <ide> model.add(Activation('relu')) <ide> vocab_size = 10000 <ide> # will encode pictures into 128-dimensional vectors. <ide> # it should be initialized with pre-trained weights. <ide> image_model = Sequential() <del>image_model.add(Convolution2D(32, 3, 3, border_mode='full', input_shape=(3, 100, 100))) <add>image_model.add(Convolution2D(32, 3, 3, border_mode='valid', input_shape=(3, 100, 100))) <ide> image_model.add(Activation('relu')) <ide> image_model.add(Convolution2D(32, 3, 3)) <ide> image_model.add(Activation('relu')) <ide> image_model.add(MaxPooling2D(pool_size=(2, 2))) <ide> <del>image_model.add(Convolution2D(64, 3, 3, border_mode='full')) <add>image_model.add(Convolution2D(64, 3, 3, border_mode='valid')) <ide> image_model.add(Activation('relu')) <ide> image_model.add(Convolution2D(64, 3, 3)) <ide> image_model.add(Activation('relu'))
1
Ruby
Ruby
convert formulalock test to spec
22042797d3111316e977eeee6f70439ae41448f6
<ide><path>Library/Homebrew/test/formula_lock_spec.rb <add>require "formula_lock" <add> <add>describe FormulaLock do <add> subject { described_class.new("foo") } <add> <add> describe "#lock" do <add> it "does not raise an error when already locked" do <add> subject.lock <add> <add> expect { subject.lock }.not_to raise_error <add> end <add> <add> it "raises an error if a lock already exists" do <add> subject.lock <add> <add> expect { <add> described_class.new("foo").lock <add> }.to raise_error(OperationInProgressError) <add> end <add> end <add> <add> describe "#unlock" do <add> it "does not raise an error when already unlocked" do <add> expect { subject.unlock }.not_to raise_error <add> end <add> <add> it "unlocks a locked Formula" do <add> subject.lock <add> subject.unlock <add> <add> expect { described_class.new("foo").lock }.not_to raise_error <add> end <add> end <add>end <ide><path>Library/Homebrew/test/formula_lock_test.rb <del>require "testing_env" <del>require "formula_lock" <del> <del>class FormulaLockTests < Homebrew::TestCase <del> def setup <del> super <del> @lock = FormulaLock.new("foo") <del> @lock.lock <del> end <del> <del> def teardown <del> @lock.unlock <del> super <del> end <del> <del> def test_locking_file_with_existing_lock_raises_error <del> assert_raises(OperationInProgressError) { FormulaLock.new("foo").lock } <del> end <del> <del> def test_locking_existing_lock_suceeds <del> assert_nothing_raised { @lock.lock } <del> end <del>end
2
Javascript
Javascript
add publicpath to stats
d9509e8e8d0f3bf0335c2214d45aa523caa5b7a3
<ide><path>lib/MainTemplate.js <ide> function MainTemplate(outputOptions) { <ide> buf.push("// expose the module cache"); <ide> buf.push(this.requireFn + ".c = installedModules;"); <ide> <del> var publicPath = this.outputOptions.publicPath || ""; <del> publicPath = this.applyPluginsWaterfall("asset-path", publicPath, { <add> var publicPath = this.getPublicPath({ <ide> hash: hash <ide> }); <ide> buf.push(""); <ide> MainTemplate.prototype.entryPointInChildren = function(chunk) { <ide> }(chunk, [])); <ide> }; <ide> <add>MainTemplate.prototype.getPublicPath = function(options) { <add> return this.applyPluginsWaterfall("asset-path", this.outputOptions.publicPath || "", options); <add>}; <add> <ide> MainTemplate.prototype.updateHash = function(hash) { <ide> hash.update("maintemplate"); <ide> hash.update("3"); <ide><path>lib/Stats.js <ide> Stats.prototype.toJson = function toJson(options, forToString) { <ide> var showChildren = d(options.children, true); <ide> var showSource = d(options.source, !forToString); <ide> var showErrorDetails = d(options.errorDetails, !forToString); <add> var showPublicPath = d(options.publicPath, !forToString); <ide> var excludeModules = [].concat(d(options.exclude, [])).map(function(str) { <ide> if(typeof str !== "string") return str; <ide> return new RegExp("[\\\\/]" + str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "([\\\\/]|$|!|\\?)"); <ide> Stats.prototype.toJson = function toJson(options, forToString) { <ide> if(showTimings && this.startTime && this.endTime) { <ide> obj.time = this.endTime - this.startTime; <ide> } <add> if(showPublicPath) { <add> obj.publicPath = this.compilation.mainTemplate.getPublicPath({ <add> hash: this.compilation.renderedHash <add> }); <add> } <ide> if(showAssets) { <ide> var assetsByFile = {}; <ide> obj.assetsByChunkName = {}; <ide> Stats.jsonToString = function jsonToString(obj, useColors) { <ide> normal("ms"); <ide> newline(); <ide> } <add> if(obj.publicPath) { <add> normal("PublicPath: ") <add> bold(obj.publicPath); <add> newline(); <add> } <ide> if(obj.assets && obj.assets.length > 0) { <ide> var t = [["Asset", "Size", "Chunks", "", "Chunk Names"]] <ide> obj.assets.forEach(function(asset) {
2
Ruby
Ruby
remove unused require
c2b5c057fa5195a40b3d760ac234c7de384757c5
<ide><path>activejob/lib/active_job/queue_adapter.rb <del>require "active_job/queue_adapters/inline_adapter" <ide> require "active_support/core_ext/string/inflections" <ide> <ide> module ActiveJob
1
Javascript
Javascript
improve installation section
2ce74e547a3912736910f1b654e383f112a9bae0
<ide><path>src/ngResource/resource.js <ide> * <ide> * # Installation <ide> * To use $resource make sure you have included the `angular-resource.js` that comes in Angular <del> * package. You also can find this stuff in {@link http://code.angularjs.org/ code.angularjs.org}. <add> * package. You can also find this file on Google CDN, bower as well as at <add> * {@link http://code.angularjs.org/ code.angularjs.org}. <add> * <ide> * Finally load the module in your application: <ide> * <ide> * angular.module('app', ['ngResource']); <ide> * <del> * and you ready to get started! <add> * and you are ready to get started! <ide> * <ide> * @param {string} url A parametrized URL template with parameters prefixed by `:` as in <ide> * `/user/:username`. If you are using a URL with a port number (e.g.
1
Javascript
Javascript
add test for selection.insert
e7ad8bb185ce2a57ced42f1705e9d52c3f480825
<ide><path>test/core/selection-insert-test.js <add>require("../env"); <add>require("../../d3"); <add> <add>var vows = require("vows"), <add> assert = require("assert"); <add> <add>var suite = vows.describe("selection.insert"); <add> <add>suite.addBatch({ <add> "select(body)": { <add> topic: function() { <add> return d3.select("body").html(""); <add> }, <add> "inserts before the specified selector": function(body) { <add> var span = body.html("").append("span"); <add> var div = body.insert("div", "span"); <add> assert.equal(div[0][0].tagName, "DIV"); <add> assert.isNull(div[0][0].namespaceURI); <add> assert.domEqual(div[0][0], document.body.firstChild); <add> assert.domEqual(div[0][0].nextSibling, span[0][0]); <add> }, <add> "appends an HTML element": function(body) { <add> var div = body.insert("div"); <add> assert.equal(div[0][0].tagName, "DIV"); <add> assert.isNull(div[0][0].namespaceURI); <add> assert.domEqual(div[0][0], document.body.lastChild); <add> }, <add> "appends an SVG element": function(body) { <add> var svg = body.insert("svg:svg"); <add> assert.equal(svg[0][0].tagName, "SVG"); <add> assert.equal(svg[0][0].namespaceURI, "http://www.w3.org/2000/svg"); <add> assert.domEqual(svg[0][0].parentNode, document.body); <add> assert.domEqual(svg[0][0], document.body.lastChild); <add> }, <add> "propagates data to new element": function(body) { <add> var data = new Object(), div = body.data([data]).insert("div"); <add> assert.strictEqual(div[0][0].__data__, data); <add> } <add> } <add>}); <add> <add>suite.addBatch({ <add> "selectAll(div)": { <add> topic: function() { <add> return d3.select("body").html("").selectAll("div").data(d3.range(2)).enter().insert("div"); <add> }, <add> "appends an HTML element": function(div) { <add> var span = div.insert("span"); <add> assert.equal(span[0].length, 2); <add> assert.equal(span[0][0].tagName, "SPAN"); <add> assert.equal(span[0][1].tagName, "SPAN"); <add> assert.isNull(span[0][0].namespaceURI); <add> assert.isNull(span[0][1].namespaceURI); <add> assert.domEqual(span[0][0].parentNode, div[0][0]); <add> assert.domEqual(span[0][1].parentNode, div[0][1]); <add> assert.domEqual(div[0][0].lastChild, span[0][0]); <add> assert.domEqual(div[0][1].lastChild, span[0][1]); <add> }, <add> "appends an SVG element": function(div) { <add> var svg = div.insert("svg:svg"); <add> assert.equal(svg[0].length, 2); <add> assert.equal(svg[0][0].tagName, "SVG"); <add> assert.equal(svg[0][1].tagName, "SVG"); <add> assert.equal(svg[0][0].namespaceURI, "http://www.w3.org/2000/svg"); <add> assert.equal(svg[0][1].namespaceURI, "http://www.w3.org/2000/svg"); <add> assert.domEqual(svg[0][0].parentNode, div[0][0]); <add> assert.domEqual(svg[0][1].parentNode, div[0][1]); <add> assert.domEqual(div[0][0].lastChild, svg[0][0]); <add> assert.domEqual(div[0][1].lastChild, svg[0][1]); <add> }, <add> "ignores null nodes": function(div) { <add> div.html(""); <add> var some = d3.selectAll("div"); <add> some[0][1] = null; <add> var span = some.insert("span"); <add> assert.equal(span[0].length, 2); <add> assert.equal(span[0][0].tagName, "SPAN"); <add> assert.domNull(span[0][1]); <add> assert.domEqual(span[0][0].parentNode, div[0][0]); <add> assert.domEqual(div[0][0].lastChild, span[0][0]); <add> assert.domNull(div[0][1].lastChild); <add> }, <add> "propagates data to new elements": function(div) { <add> var a = new Object(), b = new Object(), span = div.data([a, b]).insert("span"); <add> assert.strictEqual(span[0][0].__data__, a); <add> assert.strictEqual(span[0][1].__data__, b); <add> } <add> } <add>}); <add> <add>suite.addBatch({ <add> "selectAll(div).data(…).enter()": { <add> topic: function() { <add> return d3.select("body"); <add> }, <add> "inserts before the specified selector": function(body) { <add> var span = body.html("").append("span"); <add> var div = body.selectAll("div").data(d3.range(2)).enter().insert("div", "span"); <add> assert.equal(div.length, 1); <add> assert.equal(div[0].length, 2); <add> assert.domEqual(div[0][0], document.body.firstChild); <add> assert.domEqual(div[0][1].previousSibling, div[0][0]); <add> assert.domEqual(div[0][1].nextSibling, span[0][0]); <add> }, <add> "propagates data to new elements": function(body) { <add> var a = new Object(), b = new Object(), div = body.html("").selectAll("div").data([a, b]).enter().insert("div"); <add> assert.strictEqual(div[0][0].__data__, a); <add> assert.strictEqual(div[0][1].__data__, b); <add> }, <add> "ignores null nodes": function(body) { <add> body.html("").insert("div"); <add> var div = body.selectAll("div").data(d3.range(3)).enter().insert("div"); <add> assert.equal(div.length, 1); <add> assert.equal(div[0].length, 3); <add> assert.domNull(div[0][0]); <add> assert.domEqual(div[0][1].parentNode, document.body); <add> assert.domEqual(div[0][2].parentNode, document.body); <add> } <add> } <add>}); <add> <add>suite.export(module);
1
Python
Python
fix input embeddings
f2f329408db66285fd59e6628ca394381bb7f94e
<ide><path>transformers/tests/modeling_albert_test.py <ide> def __init__(self, <ide> use_token_type_ids=True, <ide> use_labels=True, <ide> vocab_size=99, <add> embedding_size=16, <ide> hidden_size=36, <ide> num_hidden_layers=6, <ide> num_hidden_groups=6, <ide> def __init__(self, <ide> self.use_token_type_ids = use_token_type_ids <ide> self.use_labels = use_labels <ide> self.vocab_size = vocab_size <add> self.embedding_size = embedding_size <ide> self.hidden_size = hidden_size <ide> self.num_hidden_layers = num_hidden_layers <ide> self.num_attention_heads = num_attention_heads <ide><path>transformers/tests/modeling_tf_albert_test.py <ide> def __init__(self, <ide> use_token_type_ids=True, <ide> use_labels=True, <ide> vocab_size=99, <add> embedding_size=16, <ide> hidden_size=32, <ide> num_hidden_layers=5, <ide> num_attention_heads=4, <ide> def __init__(self, <ide> self.use_token_type_ids = use_token_type_ids <ide> self.use_labels = use_labels <ide> self.vocab_size = vocab_size <add> self.embedding_size = embedding_size <ide> self.hidden_size = hidden_size <ide> self.num_hidden_layers = num_hidden_layers <ide> self.num_attention_heads = num_attention_heads <ide><path>transformers/tests/modeling_tf_common_test.py <ide> def test_inputs_embeds(self): <ide> try: <ide> x = wte([input_ids], mode="embedding") <ide> except: <del> x = tf.ones(input_ids.shape + [self.model_tester.hidden_size], dtype=tf.dtypes.float32) <del> # ^^ In our TF models, the input_embeddings can take slightly different forms, <del> # so we try two of them and fall back to just synthetically creating a dummy tensor of ones. <add> if hasattr(self.model_tester, "embedding_size"): <add> x = tf.ones(input_ids.shape + [model.config.embedding_size], dtype=tf.dtypes.float32) <add> else: <add> x = tf.ones(input_ids.shape + [self.model_tester.hidden_size], dtype=tf.dtypes.float32) <ide> inputs_dict["inputs_embeds"] = x <ide> outputs = model(inputs_dict) <ide>
3
Text
Text
add v4.9.1 to changelog
8dd9622e7f70c4e70096987389908f44661edba5
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>## v4.9.1 (November 30, 2022) <add> <add>- [#20284](https://github.com/emberjs/ember.js/pull/20284) [BUGFIX] remove incorrect types for deprecation functions <add> <ide> ## v4.10.0-beta.2 <ide> <ide> - [#20283](https://github.com/emberjs/ember.js/pull/20283) [BUGFIX] revert TS `compilerOptions.target` to ES2017
1
Text
Text
simplify docs on generating android release apk
41789e7929e027f320a705ddc6d129e612a39dee
<ide><path>docs/SignedAPKAndroid.md <ide> android { <ide> <ide> ### Generating the release APK <ide> <del>#### If you have a `react.gradle` file in `android/app` <del> <ide> Simply run the following in a terminal: <ide> <ide> ```sh <ide> $ cd android && ./gradlew assembleRelease <ide> ``` <ide> <del>If you need to change the way the JavaScript bundle and/or drawable resources are bundled (e.g. if you changed the default file/folder names or the general structure of the project), have a look at `android/app/build.gradle` to see how you can update it to reflect these changes. <del> <del>#### If you *don't* have a `react.gradle` file: <add>Gradle's `assembleRelease` will bundle all the JavaScript needed to run your app into the APK. If you need to change the way the JavaScript bundle and/or drawable resources are bundled (e.g. if you changed the default file/folder names or the general structure of the project), have a look at `android/app/build.gradle` to see how you can update it to reflect these changes. <ide> <del>You can [upgrade](docs/upgrading.html) to the latest version of React Native to get this file. Alternatively, you can bundle the JavaScript package and drawable resources manually by doing the following in a terminal: <del> <del>```sh <del>$ mkdir -p android/app/src/main/assets <del>$ react-native bundle --platform android --dev false --entry-file index.android.js \ <del> --bundle-output android/app/src/main/assets/index.android.bundle \ <del> --assets-dest android/app/src/main/res/ <del>$ cd android && ./gradlew assembleRelease <del>``` <del> <del>In both cases the generated APK can be found under `android/app/build/outputs/apk/app-release.apk`, and is ready to be distributed. <add>The generated APK can be found under `android/app/build/outputs/apk/app-release.apk`, and is ready to be distributed. <ide> <ide> ### Testing the release build of your app <ide> <ide> Proguard is a tool that can slightly reduce the size of the APK. It does this by <ide> <ide> _**IMPORTANT**: Make sure to thoroughly test your app if you've enabled Proguard. Proguard often requires configuration specific to each native library you're using. See `app/proguard-rules.pro`._ <ide> <del>To enable Proguard, set `minifyEnabled` to `true`: <add>To enable Proguard, edit `android/app/build.gradle`: <ide> <ide> ```gradle <del>... <del>android { <del> ... <del> buildTypes { <del> release { <del> ... <del> minifyEnabled true <del> } <del> } <del>} <del>... <add>/** <add> * Run Proguard to shrink the Java bytecode in release builds. <add> */ <add>def enableProguardInReleaseBuilds = true <ide> ```
1
Javascript
Javascript
update this -> me with master
148c66fe957e1211d65f975b72945a66118a514e
<ide><path>src/core/core.controller.js <ide> module.exports = function(Chart) { <ide> var newWidth = helpers.getMaximumWidth(canvas); <ide> var aspectRatio = chart.aspectRatio; <ide> var newHeight = (me.options.maintainAspectRatio && isNaN(aspectRatio) === false && isFinite(aspectRatio) && aspectRatio !== 0) ? newWidth / aspectRatio : helpers.getMaximumHeight(canvas); <del> <add> <ide> var sizeChanged = chart.width !== newWidth || chart.height !== newHeight; <ide> <ide> if (!sizeChanged) {
1
PHP
PHP
fix failing test
6ca77349428cba0aac69aa8777b106ad106037ea
<ide><path>lib/Cake/Test/TestCase/Console/Command/BakeShellTest.php <ide> public function tearDown() { <ide> * @return void <ide> */ <ide> public function testAllWithModelName() { <add> $dispatcher =& $this->Dispatcher; <add> <ide> $this->Shell->Model = $this->getMock( <ide> 'Cake\Console\Command\Task\ModelTask', <ide> [], <del> [$this->Dispatcher] <add> [$dispatcher] <ide> ); <ide> $this->Shell->Controller = $this->getMock( <ide> 'Cake\Console\Command\Task\ControllerTask', <ide> [], <del> [$this->Dispatcher] <add> [$dispatcher] <ide> ); <ide> $this->Shell->View = $this->getMock( <ide> 'Cake\Console\Command\Task\ModelTask', <ide> [], <del> [$this->Dispatcher] <add> [$dispatcher] <ide> ); <ide> $this->Shell->DbConfig = $this->getMock( <ide> 'Cake\Console\Command\Task\DbConfigTask', <ide> [], <del> [$this->Dispatcher] <add> [$dispatcher] <ide> ); <ide> <ide> $this->Shell->DbConfig->expects($this->once())
1
Text
Text
fix typos in documentation guidelines
471e6f5396c3ab661ab9459b4e0ff6f935b50194
<ide><path>CONTRIBUTING.md <ide> Syntax: <ide> * a = b and not a=b. <ide> * Follow the conventions you see used in the source already. <ide> <del>Inline Documenation Guidelines: <add>Inline Documentation Guidelines: <ide> <ide> All inline documentation is written using YUIDoc. Follow these rules when <del>updating or writing new documenation: <add>updating or writing new documentation: <ide> <ide> 1. All code blocks must be fenced <ide> 2. All code blocks must have a language declared
1
Mixed
Javascript
implement textinput.selecttextonfocus for android
b5106a8fca4516bc6247492c29217a3d2f5df2bd
<ide><path>Libraries/Components/TextInput/TextInput.js <ide> var TextInput = React.createClass({ <ide> clearTextOnFocus: PropTypes.bool, <ide> /** <ide> * If true, all text will automatically be selected on focus <del> * @platform ios <ide> */ <ide> selectTextOnFocus: PropTypes.bool, <ide> /** <ide> var TextInput = React.createClass({ <ide> underlineColorAndroid={this.props.underlineColorAndroid} <ide> children={children} <ide> editable={this.props.editable} <add> selectTextOnFocus={this.props.selectTextOnFocus} <ide> />; <ide> <ide> return ( <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java <ide> public void setSelectionColor(ReactEditText view, @Nullable Integer color) { <ide> } <ide> } <ide> <add> @ReactProp(name = "selectTextOnFocus", defaultBoolean = false) <add> public void setSelectTextOnFocus(ReactEditText view, boolean selectTextOnFocus) { <add> view.setSelectAllOnFocus(selectTextOnFocus); <add> } <add> <ide> @ReactProp(name = ViewProps.COLOR, customType = "Color") <ide> public void setColor(ReactEditText view, @Nullable Integer color) { <ide> if (color == null) {
2
Ruby
Ruby
fix nulltoken equality
03b309cc76f24f503e50fc4a830147242fdb84e8
<ide><path>Library/Homebrew/version.rb <ide> def initialize(value=nil) <ide> <ide> def <=>(other) <ide> case other <add> when NullToken <add> 0 <ide> when NumericToken <ide> other.value == 0 ? 0 : -1 <ide> when AlphaToken, BetaToken, RCToken
1
Python
Python
update version of `packaging` package
75858ca156b96f47f0b624d0141bcd92debade9d
<ide><path>setup.py <ide> "onnxruntime>=1.4.0", <ide> "optuna", <ide> "optax>=0.0.8", <del> "packaging", <add> "packaging>=20.0", <ide> "parameterized", <ide> "protobuf", <ide> "psutil", <ide><path>src/transformers/dependency_versions_table.py <ide> "onnxruntime": "onnxruntime>=1.4.0", <ide> "optuna": "optuna", <ide> "optax": "optax>=0.0.8", <del> "packaging": "packaging", <add> "packaging": "packaging>=20.0", <ide> "parameterized": "parameterized", <ide> "protobuf": "protobuf", <ide> "psutil": "psutil",
2
Go
Go
add support for encrypting gossip traffic
b2b87577d40ff647345d978dfc74fdd446dbb261
<ide><path>libnetwork/agent.go <ide> import ( <ide> "fmt" <ide> "net" <ide> "os" <add> "sort" <ide> <ide> "github.com/Sirupsen/logrus" <ide> "github.com/docker/go-events" <ide> "github.com/docker/libnetwork/datastore" <ide> "github.com/docker/libnetwork/discoverapi" <ide> "github.com/docker/libnetwork/driverapi" <ide> "github.com/docker/libnetwork/networkdb" <add> "github.com/docker/libnetwork/types" <ide> "github.com/gogo/protobuf/proto" <ide> ) <ide> <add>// ByTime implements sort.Interface for []*types.EncryptionKey based on <add>// the LamportTime field. <add>type ByTime []*types.EncryptionKey <add> <add>func (b ByTime) Len() int { return len(b) } <add>func (b ByTime) Swap(i, j int) { b[i], b[j] = b[j], b[i] } <add>func (b ByTime) Less(i, j int) bool { return b[i].LamportTime < b[j].LamportTime } <add> <ide> type agent struct { <ide> networkDB *networkdb.NetworkDB <ide> bindAddr string <ide> epTblCancel func() <ide> driverCancelFuncs map[string][]func() <add> keys []*types.EncryptionKey <ide> } <ide> <ide> func getBindAddr(ifaceName string) (string, error) { <ide> func resolveAddr(addrOrInterface string) (string, error) { <ide> return getBindAddr(addrOrInterface) <ide> } <ide> <del>func (c *controller) agentInit(bindAddrOrInterface string) error { <add>func (c *controller) agentHandleKeys(keys []*types.EncryptionKey) error { <add> // Find the new key and add it to the key ring <add> a := c.agent <add> for _, key := range keys { <add> same := false <add> for _, aKey := range a.keys { <add> if same = aKey.LamportTime == key.LamportTime; same { <add> break <add> } <add> } <add> if !same { <add> a.keys = append(a.keys, key) <add> if key.Subsystem == "networking:gossip" { <add> a.networkDB.SetKey(key.Key) <add> } <add> break <add> } <add> } <add> // Find the deleted key. If the deleted key was the primary key, <add> // a new primary key should be set before removing if from keyring. <add> deleted := []byte{} <add> for i, aKey := range a.keys { <add> same := false <add> for _, key := range keys { <add> if same = key.LamportTime == aKey.LamportTime; same { <add> break <add> } <add> } <add> if !same { <add> if aKey.Subsystem == "networking:gossip" { <add> deleted = aKey.Key <add> } <add> a.keys = append(a.keys[:i], a.keys[i+1:]...) <add> break <add> } <add> } <add> <add> sort.Sort(ByTime(a.keys)) <add> for _, key := range a.keys { <add> if key.Subsystem == "networking:gossip" { <add> a.networkDB.SetPrimaryKey(key.Key) <add> break <add> } <add> } <add> if len(deleted) > 0 { <add> a.networkDB.RemoveKey(deleted) <add> } <add> return nil <add>} <add> <add>func (c *controller) agentInit(bindAddrOrInterface string, keys []*types.EncryptionKey) error { <ide> if !c.isAgent() { <ide> return nil <ide> } <ide> <add> // sort the keys by lamport time <add> sort.Sort(ByTime(keys)) <add> <add> gossipkey := [][]byte{} <add> for _, key := range keys { <add> if key.Subsystem == "networking:gossip" { <add> gossipkey = append(gossipkey, key.Key) <add> } <add> } <add> <ide> bindAddr, err := resolveAddr(bindAddrOrInterface) <ide> if err != nil { <ide> return err <ide> func (c *controller) agentInit(bindAddrOrInterface string) error { <ide> nDB, err := networkdb.New(&networkdb.Config{ <ide> BindAddr: bindAddr, <ide> NodeName: hostname, <add> Keys: gossipkey, <ide> }) <ide> <ide> if err != nil { <ide> func (c *controller) agentInit(bindAddrOrInterface string) error { <ide> bindAddr: bindAddr, <ide> epTblCancel: cancel, <ide> driverCancelFuncs: make(map[string][]func()), <add> keys: keys, <ide> } <ide> <ide> go c.handleTableEvents(ch, c.handleEpTableEvent) <ide><path>libnetwork/cluster/provider.go <ide> package cluster <ide> <add>import "github.com/docker/libnetwork/types" <add> <ide> // Provider provides clustering config details <ide> type Provider interface { <ide> IsManager() bool <ide> IsAgent() bool <ide> GetListenAddress() string <ide> GetRemoteAddress() string <ide> ListenClusterEvents() <-chan struct{} <add> GetNetworkKeys() []*types.EncryptionKey <add> SetNetworkKeys([]*types.EncryptionKey) <ide> } <ide><path>libnetwork/cmd/dnet/dnet.go <ide> func (d *dnetConnection) GetRemoteAddress() string { <ide> return d.Orchestration.Peer <ide> } <ide> <add>func (d *dnetConnection) GetNetworkKeys() []*types.EncryptionKey { <add> return nil <add>} <add> <add>func (d *dnetConnection) SetNetworkKeys([]*types.EncryptionKey) { <add>} <add> <ide> func (d *dnetConnection) ListenClusterEvents() <-chan struct{} { <ide> return d.configEvent <ide> } <ide><path>libnetwork/controller.go <ide> func (c *controller) clusterAgentInit() { <ide> select { <ide> case <-clusterProvider.ListenClusterEvents(): <ide> if !c.isDistributedControl() { <add> keys := clusterProvider.GetNetworkKeys() <add> // If the agent is already setup this could be a key change notificaiton <add> if c.agent != nil { <add> c.agentHandleKeys(keys) <add> } <add> <ide> bindAddr, _, _ := net.SplitHostPort(clusterProvider.GetListenAddress()) <ide> remote := clusterProvider.GetRemoteAddress() <ide> remoteAddr, _, _ := net.SplitHostPort(remote) <ide> func (c *controller) clusterAgentInit() { <ide> } <ide> } <ide> <del> if bindAddr != "" && c.agent == nil { <del> if err := c.agentInit(bindAddr); err != nil { <add> if bindAddr != "" && len(keys) > 0 && c.agent == nil { <add> if err := c.agentInit(bindAddr, keys); err != nil { <ide> log.Errorf("Error in agentInit : %v", err) <ide> } else { <ide> c.drvRegistry.WalkDrivers(func(name string, driver driverapi.Driver, capability driverapi.Capability) bool { <ide><path>libnetwork/networkdb/cluster.go <ide> package networkdb <ide> <ide> import ( <add> "bytes" <ide> "crypto/rand" <ide> "fmt" <ide> "math/big" <ide> func (l *logWriter) Write(p []byte) (int, error) { <ide> return len(p), nil <ide> } <ide> <add>// SetKey adds a new key to the key ring <add>func (nDB *NetworkDB) SetKey(key []byte) { <add> for _, dbKey := range nDB.config.Keys { <add> if bytes.Equal(key, dbKey) { <add> return <add> } <add> } <add> nDB.config.Keys = append(nDB.config.Keys, key) <add> if nDB.keyring != nil { <add> nDB.keyring.AddKey(key) <add> } <add>} <add> <add>// SetPrimaryKey sets the given key as the primary key. This should have <add>// been added apriori through SetKey <add>func (nDB *NetworkDB) SetPrimaryKey(key []byte) { <add> for _, dbKey := range nDB.config.Keys { <add> if bytes.Equal(key, dbKey) { <add> if nDB.keyring != nil { <add> nDB.keyring.UseKey(dbKey) <add> } <add> break <add> } <add> } <add>} <add> <add>// RemoveKey removes a key from the key ring. The key being removed <add>// can't be the primary key <add>func (nDB *NetworkDB) RemoveKey(key []byte) { <add> for i, dbKey := range nDB.config.Keys { <add> if bytes.Equal(key, dbKey) { <add> nDB.config.Keys = append(nDB.config.Keys[:i], nDB.config.Keys[i+1:]...) <add> if nDB.keyring != nil { <add> nDB.keyring.RemoveKey(dbKey) <add> } <add> break <add> } <add> } <add>} <add> <ide> func (nDB *NetworkDB) clusterInit() error { <ide> config := memberlist.DefaultLANConfig() <ide> config.Name = nDB.config.NodeName <ide> func (nDB *NetworkDB) clusterInit() error { <ide> config.Events = &eventDelegate{nDB: nDB} <ide> config.LogOutput = &logWriter{} <ide> <add> var err error <add> if len(nDB.config.Keys) > 0 { <add> nDB.keyring, err = memberlist.NewKeyring(nDB.config.Keys, nDB.config.Keys[0]) <add> if err != nil { <add> return err <add> } <add> config.Keyring = nDB.keyring <add> } <add> <ide> nDB.networkBroadcasts = &memberlist.TransmitLimitedQueue{ <ide> NumNodes: func() int { <ide> return len(nDB.nodes) <ide><path>libnetwork/networkdb/networkdb.go <ide> type NetworkDB struct { <ide> // List of all tickers which needed to be stopped when <ide> // cleaning up. <ide> tickers []*time.Ticker <add> <add> // Reference to the memberlist's keyring to add & remove keys <add> keyring *memberlist.Keyring <ide> } <ide> <ide> // network describes the node/network attachment. <ide> type Config struct { <ide> // BindPort is the local node's port to which we bind to for <ide> // cluster communication. <ide> BindPort int <add> <add> // Keys to be added to the Keyring of the memberlist. Key at index <add> // 0 is the primary key <add> Keys [][]byte <ide> } <ide> <ide> // entry defines a table entry <ide><path>libnetwork/types/types.go <ide> const ( <ide> IPv6 <ide> ) <ide> <add>// EncryptionKey is the libnetwork representation of the key distributed by the lead <add>// manager. <add>type EncryptionKey struct { <add> Subsystem string <add> Algorithm int32 <add> Key []byte <add> LamportTime uint64 <add>} <add> <ide> // UUID represents a globally unique ID of various resources like network and endpoint <ide> type UUID string <ide>
7
Text
Text
add note about browsers and http/2
cb69a7d22e33d26ddc0facc1717f0d8b309e0815
<ide><path>doc/api/http2.md <ide> be emitted either by client-side code or server-side code. <ide> <ide> ### Server-side example <ide> <del>The following illustrates a simple, plain-text HTTP/2 server using the <del>Core API: <add>The following illustrates a simple HTTP/2 server using the Core API. <add>Since there are no browsers known that support <add>[unencrypted HTTP/2][HTTP/2 Unencrypted], the use of <add>[`http2.createSecureServer()`][] is necessary when communicating <add>with browser clients. <ide> <ide> ```js <ide> const http2 = require('http2'); <ide> and would instead register a handler for the `'stream'` event emitted by the <ide> ```js <ide> const http2 = require('http2'); <ide> <del>// Create a plain-text HTTP/2 server <add>// Create an unencrypted HTTP/2 server <ide> const server = http2.createServer(); <ide> <ide> server.on('stream', (stream, headers) => { <ide> changes: <ide> Returns a `net.Server` instance that creates and manages `Http2Session` <ide> instances. <ide> <add>Since there are no browsers known that support <add>[unencrypted HTTP/2][HTTP/2 Unencrypted], the use of <add>[`http2.createSecureServer()`][] is necessary when communicating <add>with browser clients. <add> <ide> ```js <ide> const http2 = require('http2'); <ide> <del>// Create a plain-text HTTP/2 server <add>// Create an unencrypted HTTP/2 server. <add>// Since there are no browsers known that support <add>// unencrypted HTTP/2, the use of `http2.createSecureServer()` <add>// is necessary when communicating with browser clients. <ide> const server = http2.createServer(); <ide> <ide> server.on('stream', (stream, headers) => { <ide> following additional properties: <ide> [Compatibility API]: #http2_compatibility_api <ide> [HTTP/1]: http.html <ide> [HTTP/2]: https://tools.ietf.org/html/rfc7540 <add>[HTTP/2 Unencrypted]: https://http2.github.io/faq/#does-http2-require-encryption <ide> [HTTP2 Headers Object]: #http2_headers_object <ide> [HTTP2 Settings Object]: #http2_settings_object <ide> [HTTPS]: https.html
1
Python
Python
fix typo in dataset.
7c5c01482f48f9f2532586e679686d821d516ae6
<ide><path>official/datasets/movielens.py <ide> def _transform_csv(input_path, output_path, names, skip_first, separator=","): <ide> separator: Character used to separate fields in the raw csv. <ide> """ <ide> if six.PY2: <del> names = [n.decode("utf-u") for n in names] <add> names = [n.decode("utf-8") for n in names] <ide> <ide> with tf.gfile.Open(output_path, "wb") as f_out, \ <ide> tf.gfile.Open(input_path, "rb") as f_in:
1
Javascript
Javascript
fix unsupported method errors in older browsers
6155d7898eed50cc7bc88fe9b6d06d73c5981411
<ide><path>packages/ember-application/lib/system/hash_location.js <ide> Ember.HashLocation = Ember.Object.extend({ <ide> }; <ide> <ide> get(this, 'callbacks').pushObject(hashchange); <del> window.addEventListener('hashchange', hashchange); <add> <add> // This won't work on old browsers anyway, but this check prevents errors <add> if (window.addEventListener) { <add> window.addEventListener('hashchange', hashchange); <add> } <ide> }, <ide> <ide> /** <ide><path>packages/ember-application/lib/system/history_location.js <ide> Ember.HistoryLocation = Ember.Object.extend({ <ide> }; <ide> <ide> get(this, 'callbacks').pushObject(popstate); <del> window.addEventListener('popstate', popstate); <add> <add> // This won't work on old browsers anyway, but this check prevents errors <add> if (window.addEventListener) { <add> window.addEventListener('popstate', popstate); <add> } <ide> }, <ide> <ide> /** <ide><path>packages/ember-runtime/lib/mixins/sortable.js <ide> Ember.SortableMixin = Ember.Mixin.create(Ember.MutableEnumerable, { <ide> var removedObjects = array.slice(idx, idx+removedCount); <ide> var sortProperties = get(this, 'sortProperties'); <ide> <del> removedObjects.forEach(function(item) { <add> forEach(removedObjects, function(item) { <ide> arrangedContent.removeObject(item); <ide> <ide> forEach(sortProperties, function(sortProperty) { <ide> Ember.SortableMixin = Ember.Mixin.create(Ember.MutableEnumerable, { <ide> var addedObjects = array.slice(idx, idx+addedCount); <ide> var arrangedContent = get(this, 'arrangedContent'); <ide> <del> addedObjects.forEach(function(item) { <add> forEach(addedObjects, function(item) { <ide> this.insertItemSorted(item); <ide> <ide> forEach(sortProperties, function(sortProperty) { <ide><path>packages/ember-states/lib/state_manager.js <ide> var get = Ember.get, set = Ember.set, getPath = Ember.getPath, fmt = Ember.String.fmt; <add>var arrayForEach = Ember.ArrayUtils.forEach; <ide> <ide> require('ember-states/state'); <ide> <ide> Ember.StateManager = Ember.State.extend( <ide> triggerSetupContext: function(root, segments) { <ide> var state = root; <ide> <del> Ember.ArrayUtils.forEach(segments, function(tuple) { <add> arrayForEach(segments, function(tuple) { <ide> var path = tuple[0], <ide> context = tuple[1]; <ide> <ide> Ember.StateManager = Ember.State.extend( <ide> stateManager = this; <ide> <ide> exitStates = exitStates.slice(0).reverse(); <del> exitStates.forEach(function(state) { <add> arrayForEach(exitStates, function(state) { <ide> state.fire('exit', stateManager); <ide> }); <ide> <del> enterStates.forEach(function(state) { <add> arrayForEach(enterStates, function(state) { <ide> if (log) { Ember.Logger.log("STATEMANAGER: Entering " + get(state, 'path')); } <ide> state.fire('enter', stateManager); <ide> });
4
PHP
PHP
apply fixes from styleci
89b0c2b53ebd16f0db930701d31c365dd5b176d9
<ide><path>src/Illuminate/Database/Console/Migrations/MigrateCommand.php <ide> <ide> use Illuminate\Console\ConfirmableTrait; <ide> use Illuminate\Database\Migrations\Migrator; <del>use Symfony\Component\Console\Input\InputOption; <ide> <ide> class MigrateCommand extends BaseCommand <ide> { <ide><path>src/Illuminate/Database/Console/Migrations/RollbackCommand.php <ide> public function fire() <ide> $this->migrator->rollback( <ide> $this->getMigrationPaths(), [ <ide> 'pretend' => $this->option('pretend'), <del> 'step' => (int) $this->option('step') <add> 'step' => (int) $this->option('step'), <ide> ] <ide> ); <ide>
2
Ruby
Ruby
update blacklist warnings
b4e246e75d1f2a380ca107301a5b30e941de1d9c
<ide><path>Library/Homebrew/blacklist.rb <ide> def blacklisted? name <ide> when 'macruby' then <<-EOS.undent <ide> MacRuby works better when you install their package: <ide> http://www.macruby.org/ <del> <del> Although if you prefer, there is a formula in homebrew-alt. <del> EOS <del> when 'npm' then <<-EOS.undent <del> Homebrew does not provide npm because it is self-updating. To install it, first <del> `brew install nodejs' and then: <del> <del> curl https://npmjs.org/install.sh | sh <ide> EOS <ide> when /(lib)?lzma/ <ide> "lzma is now part of the xz formula."
1
Go
Go
fix syscall name
78d995bbd6dc8022faef251835ae6001c4c3da49
<ide><path>term/termios_linux.go <ide> func MakeRaw(fd uintptr) (*State, error) { <ide> <ide> newState.Iflag &^= (syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK | syscall.ISTRIP | syscall.INLCR | syscall.IGNCR | syscall.ICRNL | syscall.IXON) <ide> newState.Oflag &^= syscall.OPOST <del> newState.Lflag &^= (syscall.ECHO | syscall.ECHONL | syscall.ICANON | syscall.ISIG | syscall.EXTEN) <add> newState.Lflag &^= (syscall.ECHO | syscall.ECHONL | syscall.ICANON | syscall.ISIG | syscall.IEXTEN) <ide> newState.Cflag &^= (syscall.CSIZE | syscall.PARENB) <ide> newState.Cflag |= syscall.CS8 <ide>
1
PHP
PHP
allow column aliases in query builder pluck
4fd6db18d1586eeb8f12424394f143e465015bbc
<ide><path>src/Illuminate/Database/Query/Builder.php <ide> public function lists($column, $key = null) <ide> } <ide> <ide> /** <del> * Strip off the table name from a column identifier. <add> * Strip off the table name or alias from a column identifier. <ide> * <ide> * @param string $column <ide> * @return string <ide> */ <ide> protected function stripTable($column) <ide> { <del> return is_null($column) ? $column : last(explode('.', $column)); <add> return is_null($column) ? $column : last(preg_split('~\.| ~', $column)); <ide> } <ide> <ide> /** <ide><path>tests/Database/DatabaseEloquentIntegrationTest.php <ide> public function setUp() <ide> { <ide> $this->schema()->create('users', function ($table) { <ide> $table->increments('id'); <add> $table->string('name')->nullable(); <ide> $table->string('email')->unique(); <ide> $table->string('role')->default('standard'); <ide> $table->timestamps(); <ide> public function testPluck() <ide> <ide> public function testPluckWithJoin() <ide> { <del> $user1 = EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']); <del> $user2 = EloquentTestUser::create(['id' => 2, 'email' => 'abigailotwell@gmail.com']); <add> $user1 = EloquentTestUser::create(['id' => 1, 'name' => 'Taylor', 'email' => 'taylorotwell@gmail.com']); <add> $user2 = EloquentTestUser::create(['id' => 2, 'name' => 'Abigail', 'email' => 'abigailotwell@gmail.com']); <ide> <ide> $user2->posts()->create(['id' => 1, 'name' => 'First post']); <ide> $user1->posts()->create(['id' => 2, 'name' => 'Second post']); <ide> <ide> $query = EloquentTestUser::join('posts', 'users.id', '=', 'posts.user_id'); <ide> <del> $this->assertEquals([1 => 'First post', 2 => 'Second post'], $query->pluck('name', 'posts.id')->all()); <del> $this->assertEquals([2 => 'First post', 1 => 'Second post'], $query->pluck('name', 'users.id')->all()); <add> $this->assertEquals([1 => 'First post', 2 => 'Second post'], $query->pluck('posts.name', 'posts.id')->all()); <add> $this->assertEquals([2 => 'First post', 1 => 'Second post'], $query->pluck('posts.name', 'users.id')->all()); <add> $this->assertEquals(['Abigail' => 'First post', 'Taylor' => 'Second post'], $query->pluck('posts.name', 'users.name as user_name')->all()); <ide> } <ide> <ide> public function testFindOrFail()
2
Text
Text
remove extra whitespace in module docs
1fa59b4c7e575ca70fee802e4cbb599fdb59df04
<ide><path>doc/api/modules.md <ide> added: v9.3.0 <ide> <ide> * {string[]} <ide> <del>A list of the names of all modules provided by Node.js. Can be used to verify <add>A list of the names of all modules provided by Node.js. Can be used to verify <ide> if a module is maintained by a third-party module or not. <ide> <ide> [`__dirname`]: #modules_dirname
1
Javascript
Javascript
move the specific else if clause up
f27e3aa7505e7c33be81d669beec31dcec029c06
<ide><path>src/renderers/dom/shared/ReactDOMComponent.js <ide> ReactDOMComponent.Mixin = { <ide> // listener (e.g., onClick={null}) <ide> deleteListener(this, propKey); <ide> } <del> } else if ( <del> DOMProperty.properties[propKey] || <del> DOMProperty.isCustomAttribute(propKey)) { <del> DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey); <ide> } else if (this._namespaceURI === DOMNamespaces.svg) { <ide> DOMPropertyOperations.deleteValueForSVGAttribute( <ide> getNode(this), <ide> propKey <ide> ); <add> } else if ( <add> DOMProperty.properties[propKey] || <add> DOMProperty.isCustomAttribute(propKey)) { <add> DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey); <ide> } <ide> } <ide> for (propKey in nextProps) {
1
Ruby
Ruby
avoid an inject in favor of dup
c0c8a04efc16d3737b3a153b1ee4f75065c3193a
<ide><path>activerecord/lib/active_record/base.rb <ide> def with_scope(method_scoping = {}, action = :merge, &block) <ide> <ide> if method_scoping.is_a?(Hash) <ide> # Dup first and second level of hash (method and params). <del> method_scoping = method_scoping.inject({}) do |hash, (method, params)| <del> hash[method] = (params == true) ? params : params.dup <del> hash <add> method_scoping = method_scoping.dup <add> method_scoping.each do |method, params| <add> method_scoping[method] = params.dup unless params == true <ide> end <ide> <ide> method_scoping.assert_valid_keys([ :find, :create ])
1
Text
Text
use code markup/markdown in headers
8b89c89e94694bbf7f8308f2d9017aa9d144c935
<ide><path>doc/api/readline.md <ide> Once this code is invoked, the Node.js application will not terminate until the <ide> `readline.Interface` is closed because the interface waits for data to be <ide> received on the `input` stream. <ide> <del>## Class: Interface <add>## Class: `Interface` <ide> <!-- YAML <ide> added: v0.1.104 <ide> --> <ide> single `input` [Readable][] stream and a single `output` [Writable][] stream. <ide> The `output` stream is used to print prompts for user input that arrives on, <ide> and is read from, the `input` stream. <ide> <del>### Event: 'close' <add>### Event: `'close'` <ide> <!-- YAML <ide> added: v0.1.98 <ide> --> <ide> The listener function is called without passing any arguments. <ide> The `readline.Interface` instance is finished once the `'close'` event is <ide> emitted. <ide> <del>### Event: 'line' <add>### Event: `'line'` <ide> <!-- YAML <ide> added: v0.1.98 <ide> --> <ide> rl.on('line', (input) => { <ide> }); <ide> ``` <ide> <del>### Event: 'pause' <add>### Event: `'pause'` <ide> <!-- YAML <ide> added: v0.7.5 <ide> --> <ide> rl.on('pause', () => { <ide> }); <ide> ``` <ide> <del>### Event: 'resume' <add>### Event: `'resume'` <ide> <!-- YAML <ide> added: v0.7.5 <ide> --> <ide> rl.on('resume', () => { <ide> }); <ide> ``` <ide> <del>### Event: 'SIGCONT' <add>### Event: `'SIGCONT'` <ide> <!-- YAML <ide> added: v0.7.5 <ide> --> <ide> rl.on('SIGCONT', () => { <ide> <ide> The `'SIGCONT'` event is _not_ supported on Windows. <ide> <del>### Event: 'SIGINT' <add>### Event: `'SIGINT'` <ide> <!-- YAML <ide> added: v0.3.0 <ide> --> <ide> rl.on('SIGINT', () => { <ide> }); <ide> ``` <ide> <del>### Event: 'SIGTSTP' <add>### Event: `'SIGTSTP'` <ide> <!-- YAML <ide> added: v0.7.5 <ide> --> <ide> rl.on('SIGTSTP', () => { <ide> <ide> The `'SIGTSTP'` event is _not_ supported on Windows. <ide> <del>### rl.close() <add>### `rl.close()` <ide> <!-- YAML <ide> added: v0.1.98 <ide> --> <ide> the `'close'` event will be emitted. <ide> Calling `rl.close()` does not immediately stop other events (including `'line'`) <ide> from being emitted by the `readline.Interface` instance. <ide> <del>### rl.pause() <add>### `rl.pause()` <ide> <!-- YAML <ide> added: v0.3.4 <ide> --> <ide> later if necessary. <ide> Calling `rl.pause()` does not immediately pause other events (including <ide> `'line'`) from being emitted by the `readline.Interface` instance. <ide> <del>### rl.prompt(\[preserveCursor\]) <add>### `rl.prompt([preserveCursor])` <ide> <!-- YAML <ide> added: v0.1.98 <ide> --> <ide> paused. <ide> If the `readline.Interface` was created with `output` set to `null` or <ide> `undefined` the prompt is not written. <ide> <del>### rl.question(query, callback) <add>### `rl.question(query, callback)` <ide> <!-- YAML <ide> added: v0.3.3 <ide> --> <ide> The `callback` function passed to `rl.question()` does not follow the typical <ide> pattern of accepting an `Error` object or `null` as the first argument. <ide> The `callback` is called with the provided answer as the only argument. <ide> <del>### rl.resume() <add>### `rl.resume()` <ide> <!-- YAML <ide> added: v0.3.4 <ide> --> <ide> <ide> The `rl.resume()` method resumes the `input` stream if it has been paused. <ide> <del>### rl.setPrompt(prompt) <add>### `rl.setPrompt(prompt)` <ide> <!-- YAML <ide> added: v0.1.98 <ide> --> <ide> added: v0.1.98 <ide> The `rl.setPrompt()` method sets the prompt that will be written to `output` <ide> whenever `rl.prompt()` is called. <ide> <del>### rl.write(data\[, key\]) <add>### `rl.write(data[, key])` <ide> <!-- YAML <ide> added: v0.1.98 <ide> --> <ide> rl.write(null, { ctrl: true, name: 'u' }); <ide> The `rl.write()` method will write the data to the `readline` `Interface`'s <ide> `input` *as if it were provided by the user*. <ide> <del>### rl\[Symbol.asyncIterator\]() <add>### `rl[Symbol.asyncIterator]()` <ide> <!-- YAML <ide> added: v11.4.0 <ide> changes: <ide> async function processLineByLine() { <ide> } <ide> ``` <ide> <del>### rl.line <add>### `rl.line` <ide> <!-- YAML <ide> added: 0.1.98 <ide> --> <ide> process.stdin.on('keypress', (c, k) => { <ide> }); <ide> ``` <ide> <del>### rl.cursor <add>### `rl.cursor` <ide> <!-- YAML <ide> added: 0.1.98 <ide> --> <ide> reading input from a TTY stream. The position of cursor determines the <ide> portion of the input string that will be modified as input is processed, <ide> as well as the column where the terminal caret will be rendered. <ide> <del>### rl.getCursorPos() <add>### `rl.getCursorPos()` <ide> <!-- YAML <ide> added: v13.5.0 <ide> --> <ide> Returns the real position of the cursor in relation to the input <ide> prompt + string. Long input (wrapping) strings, as well as multiple <ide> line prompts are included in the calculations. <ide> <del>## readline.clearLine(stream, dir\[, callback\]) <add>## `readline.clearLine(stream, dir[, callback])` <ide> <!-- YAML <ide> added: v0.7.7 <ide> changes: <ide> changes: <ide> The `readline.clearLine()` method clears current line of given [TTY][] stream <ide> in a specified direction identified by `dir`. <ide> <del>## readline.clearScreenDown(stream\[, callback\]) <add>## `readline.clearScreenDown(stream[, callback])` <ide> <!-- YAML <ide> added: v0.7.7 <ide> changes: <ide> changes: <ide> The `readline.clearScreenDown()` method clears the given [TTY][] stream from <ide> the current position of the cursor down. <ide> <del>## readline.createInterface(options) <add>## `readline.createInterface(options)` <ide> <!-- YAML <ide> added: v0.1.98 <ide> changes: <ide> function completer(linePartial, callback) { <ide> } <ide> ``` <ide> <del>## readline.cursorTo(stream, x\[, y\]\[, callback\]) <add>## `readline.cursorTo(stream, x[, y][, callback])` <ide> <!-- YAML <ide> added: v0.7.7 <ide> changes: <ide> changes: <ide> The `readline.cursorTo()` method moves cursor to the specified position in a <ide> given [TTY][] `stream`. <ide> <del>## readline.emitKeypressEvents(stream\[, interface\]) <add>## `readline.emitKeypressEvents(stream[, interface])` <ide> <!-- YAML <ide> added: v0.7.7 <ide> --> <ide> if (process.stdin.isTTY) <ide> process.stdin.setRawMode(true); <ide> ``` <ide> <del>## readline.moveCursor(stream, dx, dy\[, callback\]) <add>## `readline.moveCursor(stream, dx, dy[, callback])` <ide> <!-- YAML <ide> added: v0.7.7 <ide> changes:
1
Javascript
Javascript
add comment for texture transparency detection
a1f61d30070ea13ff7b4446765ad0f46b2069b9a
<ide><path>examples/js/loaders/MMDLoader.js <ide> THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress <ide> <ide> if ( m.map !== null ) { <ide> <add> // Check if this part of the texture image the material uses requires transparency <ide> function checkTextureTransparency ( m ) { <ide> <ide> m.map.readyCallbacks.push( function ( t ) {
1
PHP
PHP
remove breaking change
366495bf6b54cc9fe359ee093f25b7797956ddd8
<ide><path>src/Illuminate/Foundation/Console/OptimizeCommand.php <ide> public function handle() <ide> { <ide> $this->call('config:cache'); <ide> $this->call('route:cache'); <del> $this->call('view:cache'); <ide> <ide> $this->info('Files cached successfully!'); <ide> }
1
Python
Python
add side inputs
c88b9fb043770eb11dab142a17d645c999a7e4fd
<ide><path>research/object_detection/model_lib_v2.py <ide> def eval_continuously( <ide> <ide> for eval_name, eval_input in eval_inputs: <ide> summary_writer = tf.compat.v2.summary.create_file_writer( <del> model_dir + '/eval' + eval_name) <add> os.path.join(model_dir, 'eval', eval_name)) <ide> with summary_writer.as_default(): <ide> eager_eval_loop( <ide> detection_model,
1
Javascript
Javascript
add spanish (mexico)
471d67fe197d34486af93045d14453df901dc74e
<ide><path>src/locale/es-mx.js <add>//! moment.js locale configuration <add>//! locale : Spanish (Mexico) [es-mx] <add>//! author : JC Franco : https://github.com/jcfranco <add> <add>import moment from '../moment'; <add> <add>var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split( <add> '_' <add> ), <add> monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'), <add> monthsParse = [ <add> /^ene/i, <add> /^feb/i, <add> /^mar/i, <add> /^abr/i, <add> /^may/i, <add> /^jun/i, <add> /^jul/i, <add> /^ago/i, <add> /^sep/i, <add> /^oct/i, <add> /^nov/i, <add> /^dic/i, <add> ], <add> monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; <add> <add>export default moment.defineLocale('es-mx', { <add> months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split( <add> '_' <add> ), <add> monthsShort: function (m, format) { <add> if (!m) { <add> return monthsShortDot; <add> } else if (/-MMM-/.test(format)) { <add> return monthsShort[m.month()]; <add> } else { <add> return monthsShortDot[m.month()]; <add> } <add> }, <add> monthsRegex: monthsRegex, <add> monthsShortRegex: monthsRegex, <add> monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, <add> monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, <add> monthsParse: monthsParse, <add> longMonthsParse: monthsParse, <add> shortMonthsParse: monthsParse, <add> weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), <add> weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), <add> weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'), <add> weekdaysParseExact: true, <add> longDateFormat: { <add> LT: 'H:mm', <add> LTS: 'H:mm:ss', <add> L: 'DD/MM/YYYY', <add> LL: 'D [de] MMMM [de] YYYY', <add> LLL: 'D [de] MMMM [de] YYYY H:mm', <add> LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm', <add> }, <add> calendar: { <add> sameDay: function () { <add> return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; <add> }, <add> nextDay: function () { <add> return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; <add> }, <add> nextWeek: function () { <add> return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; <add> }, <add> lastDay: function () { <add> return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; <add> }, <add> lastWeek: function () { <add> return ( <add> '[el] dddd [pasado a la' + <add> (this.hours() !== 1 ? 's' : '') + <add> '] LT' <add> ); <add> }, <add> sameElse: 'L', <add> }, <add> relativeTime: { <add> future: 'en %s', <add> past: 'hace %s', <add> s: 'unos segundos', <add> ss: '%d segundos', <add> m: 'un minuto', <add> mm: '%d minutos', <add> h: 'una hora', <add> hh: '%d horas', <add> d: 'un día', <add> dd: '%d días', <add> M: 'un mes', <add> MM: '%d meses', <add> y: 'un año', <add> yy: '%d años', <add> }, <add> dayOfMonthOrdinalParse: /\d{1,2}º/, <add> ordinal: '%dº', <add> week: { <add> dow: 0, // Sunday is the first day of the week. <add> doy: 4, // The week that contains Jan 4th is the first week of the year. <add> }, <add> invalidDate: 'Fecha inválida', <add>}); <ide><path>src/test/locale/es-mx.js <add>import { test } from '../qunit'; <add>import { localeModule } from '../qunit-locale'; <add>import moment from '../../moment'; <add>localeModule('es-mx'); <add> <add>test('parse', function (assert) { <add> var tests = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split( <add> '_' <add> ), <add> i; <add> function equalTest(input, mmm, i) { <add> assert.equal( <add> moment(input, mmm).month(), <add> i, <add> input + ' should be month ' + (i + 1) <add> ); <add> } <add> <add> function equalTestStrict(input, mmm, monthIndex) { <add> assert.equal( <add> moment(input, mmm, true).month(), <add> monthIndex, <add> input + ' ' + mmm + ' should be strict month ' + (monthIndex + 1) <add> ); <add> } <add> <add> for (i = 0; i < 12; i++) { <add> tests[i] = tests[i].split(' '); <add> equalTest(tests[i][0], 'MMM', i); <add> equalTest(tests[i][1], 'MMM', i); <add> equalTest(tests[i][0], 'MMMM', i); <add> equalTest(tests[i][1], 'MMMM', i); <add> equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); <add> equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); <add> equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); <add> equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); <add> <add> equalTestStrict(tests[i][1], 'MMM', i); <add> equalTestStrict(tests[i][0], 'MMMM', i); <add> equalTestStrict(tests[i][1].toLocaleLowerCase(), 'MMM', i); <add> equalTestStrict(tests[i][1].toLocaleUpperCase(), 'MMM', i); <add> equalTestStrict(tests[i][0].toLocaleLowerCase(), 'MMMM', i); <add> equalTestStrict(tests[i][0].toLocaleUpperCase(), 'MMMM', i); <add> } <add>}); <add> <add>test('format', function (assert) { <add> var a = [ <add> [ <add> 'dddd, MMMM Do YYYY, h:mm:ss a', <add> 'domingo, febrero 14º 2010, 3:25:50 pm', <add> ], <add> ['ddd, hA', 'dom., 3PM'], <add> ['M Mo MM MMMM MMM', '2 2º 02 febrero feb.'], <add> ['YYYY YY', '2010 10'], <add> ['D Do DD', '14 14º 14'], <add> ['d do dddd ddd dd', '0 0º domingo dom. do'], <add> ['DDD DDDo DDDD', '45 45º 045'], <add> ['w wo ww', '7 7º 07'], <add> ['YYYY-MMM-DD', '2010-feb-14'], <add> ['h hh', '3 03'], <add> ['H HH', '15 15'], <add> ['m mm', '25 25'], <add> ['s ss', '50 50'], <add> ['a A', 'pm PM'], <add> ['[the] DDDo [day of the year]', 'the 45º day of the year'], <add> ['LTS', '15:25:50'], <add> ['L', '14/02/2010'], <add> ['LL', '14 de febrero de 2010'], <add> ['LLL', '14 de febrero de 2010 15:25'], <add> ['LLLL', 'domingo, 14 de febrero de 2010 15:25'], <add> ['l', '14/2/2010'], <add> ['ll', '14 de feb. de 2010'], <add> ['lll', '14 de feb. de 2010 15:25'], <add> ['llll', 'dom., 14 de feb. de 2010 15:25'], <add> ], <add> b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), <add> i; <add> for (i = 0; i < a.length; i++) { <add> assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); <add> } <add>}); <add> <add>test('format ordinal', function (assert) { <add> assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); <add> assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); <add> assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); <add> assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); <add> assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); <add> assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); <add> assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); <add> assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); <add> assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); <add> assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); <add> <add> assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); <add> assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); <add> assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); <add> assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); <add> assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); <add> assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); <add> assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); <add> assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); <add> assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); <add> assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); <add> <add> assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); <add> assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); <add> assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); <add> assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); <add> assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); <add> assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); <add> assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); <add> assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); <add> assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); <add> assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); <add> <add> assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); <add>}); <add> <add>test('format month', function (assert) { <add> var expected = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split( <add> '_' <add> ), <add> i; <add> for (i = 0; i < expected.length; i++) { <add> assert.equal( <add> moment([2011, i, 1]).format('MMMM MMM'), <add> expected[i], <add> expected[i] <add> ); <add> } <add>}); <add> <add>test('format week', function (assert) { <add> var expected = 'domingo dom. do_lunes lun. lu_martes mar. ma_miércoles mié. mi_jueves jue. ju_viernes vie. vi_sábado sáb. sá'.split( <add> '_' <add> ), <add> i; <add> for (i = 0; i < expected.length; i++) { <add> assert.equal( <add> moment([2011, 0, 2 + i]).format('dddd ddd dd'), <add> expected[i], <add> expected[i] <add> ); <add> } <add>}); <add> <add>test('from', function (assert) { <add> var start = moment([2007, 1, 28]); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ s: 44 }), true), <add> 'unos segundos', <add> '44 seconds = a few seconds' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ s: 45 }), true), <add> 'un minuto', <add> '45 seconds = a minute' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ s: 89 }), true), <add> 'un minuto', <add> '89 seconds = a minute' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ s: 90 }), true), <add> '2 minutos', <add> '90 seconds = 2 minutes' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ m: 44 }), true), <add> '44 minutos', <add> '44 minutes = 44 minutes' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ m: 45 }), true), <add> 'una hora', <add> '45 minutes = an hour' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ m: 89 }), true), <add> 'una hora', <add> '89 minutes = an hour' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ m: 90 }), true), <add> '2 horas', <add> '90 minutes = 2 hours' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ h: 5 }), true), <add> '5 horas', <add> '5 hours = 5 hours' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ h: 21 }), true), <add> '21 horas', <add> '21 hours = 21 hours' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ h: 22 }), true), <add> 'un día', <add> '22 hours = a day' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ h: 35 }), true), <add> 'un día', <add> '35 hours = a day' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ h: 36 }), true), <add> '2 días', <add> '36 hours = 2 days' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 1 }), true), <add> 'un día', <add> '1 day = a day' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 5 }), true), <add> '5 días', <add> '5 days = 5 days' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 25 }), true), <add> '25 días', <add> '25 days = 25 days' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 26 }), true), <add> 'un mes', <add> '26 days = a month' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 30 }), true), <add> 'un mes', <add> '30 days = a month' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 43 }), true), <add> 'un mes', <add> '43 days = a month' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 46 }), true), <add> '2 meses', <add> '46 days = 2 months' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 74 }), true), <add> '2 meses', <add> '75 days = 2 months' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 76 }), true), <add> '3 meses', <add> '76 days = 3 months' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ M: 1 }), true), <add> 'un mes', <add> '1 month = a month' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ M: 5 }), true), <add> '5 meses', <add> '5 months = 5 months' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 345 }), true), <add> 'un año', <add> '345 days = a year' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ d: 548 }), true), <add> '2 años', <add> '548 days = 2 years' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ y: 1 }), true), <add> 'un año', <add> '1 year = a year' <add> ); <add> assert.equal( <add> start.from(moment([2007, 1, 28]).add({ y: 5 }), true), <add> '5 años', <add> '5 years = 5 years' <add> ); <add>}); <add> <add>test('suffix', function (assert) { <add> assert.equal(moment(30000).from(0), 'en unos segundos', 'prefix'); <add> assert.equal(moment(0).from(30000), 'hace unos segundos', 'suffix'); <add>}); <add> <add>test('now from now', function (assert) { <add> assert.equal( <add> moment().fromNow(), <add> 'hace unos segundos', <add> 'now from now should display as in the past' <add> ); <add>}); <add> <add>test('fromNow', function (assert) { <add> assert.equal( <add> moment().add({ s: 30 }).fromNow(), <add> 'en unos segundos', <add> 'en unos segundos' <add> ); <add> assert.equal(moment().add({ d: 5 }).fromNow(), 'en 5 días', 'en 5 días'); <add>}); <add> <add>test('calendar day', function (assert) { <add> var a = moment().hours(12).minutes(0).seconds(0); <add> <add> assert.equal( <add> moment(a).calendar(), <add> 'hoy a las 12:00', <add> 'today at the same time' <add> ); <add> assert.equal( <add> moment(a).add({ m: 25 }).calendar(), <add> 'hoy a las 12:25', <add> 'Now plus 25 min' <add> ); <add> assert.equal( <add> moment(a).add({ h: 1 }).calendar(), <add> 'hoy a las 13:00', <add> 'Now plus 1 hour' <add> ); <add> assert.equal( <add> moment(a).add({ d: 1 }).calendar(), <add> 'mañana a las 12:00', <add> 'tomorrow at the same time' <add> ); <add> assert.equal( <add> moment(a).add({ d: 1, h: -1 }).calendar(), <add> 'mañana a las 11:00', <add> 'tomorrow minus 1 hour' <add> ); <add> assert.equal( <add> moment(a).subtract({ h: 1 }).calendar(), <add> 'hoy a las 11:00', <add> 'Now minus 1 hour' <add> ); <add> assert.equal( <add> moment(a).subtract({ d: 1 }).calendar(), <add> 'ayer a las 12:00', <add> 'yesterday at the same time' <add> ); <add>}); <add> <add>test('calendar next week', function (assert) { <add> var i, m; <add> <add> for (i = 2; i < 7; i++) { <add> m = moment().add({ d: i }); <add> assert.equal( <add> m.calendar(), <add> m.format('dddd [a la' + (m.hours() !== 1 ? 's' : '') + '] LT'), <add> 'Today + ' + i + ' days current time' <add> ); <add> m.hours(0).minutes(0).seconds(0).milliseconds(0); <add> assert.equal( <add> m.calendar(), <add> m.format('dddd [a la' + (m.hours() !== 1 ? 's' : '') + '] LT'), <add> 'Today + ' + i + ' days beginning of day' <add> ); <add> m.hours(23).minutes(59).seconds(59).milliseconds(999); <add> assert.equal( <add> m.calendar(), <add> m.format('dddd [a la' + (m.hours() !== 1 ? 's' : '') + '] LT'), <add> 'Today + ' + i + ' days end of day' <add> ); <add> } <add>}); <add> <add>test('calendar last week', function (assert) { <add> var i, m; <add> <add> for (i = 2; i < 7; i++) { <add> m = moment().subtract({ d: i }); <add> assert.equal( <add> m.calendar(), <add> m.format( <add> '[el] dddd [pasado a la' + (m.hours() !== 1 ? 's' : '') + '] LT' <add> ), <add> 'Today - ' + i + ' days current time' <add> ); <add> m.hours(0).minutes(0).seconds(0).milliseconds(0); <add> assert.equal( <add> m.calendar(), <add> m.format( <add> '[el] dddd [pasado a la' + (m.hours() !== 1 ? 's' : '') + '] LT' <add> ), <add> 'Today - ' + i + ' days beginning of day' <add> ); <add> m.hours(23).minutes(59).seconds(59).milliseconds(999); <add> assert.equal( <add> m.calendar(), <add> m.format( <add> '[el] dddd [pasado a la' + (m.hours() !== 1 ? 's' : '') + '] LT' <add> ), <add> 'Today - ' + i + ' days end of day' <add> ); <add> } <add>}); <add> <add>test('calendar all else', function (assert) { <add> var weeksAgo = moment().subtract({ w: 1 }), <add> weeksFromNow = moment().add({ w: 1 }); <add> <add> assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); <add> assert.equal( <add> weeksFromNow.calendar(), <add> weeksFromNow.format('L'), <add> 'in 1 week' <add> ); <add> <add> weeksAgo = moment().subtract({ w: 2 }); <add> weeksFromNow = moment().add({ w: 2 }); <add> <add> assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); <add> assert.equal( <add> weeksFromNow.calendar(), <add> weeksFromNow.format('L'), <add> 'in 2 weeks' <add> ); <add>}); <add> <add>test('weeks year starting sunday formatted', function (assert) { <add> assert.equal( <add> moment([2012, 0, 1]).format('w ww wo'), <add> '1 01 1º', <add> 'Jan 1 2012 should be week 1' <add> ); <add> assert.equal( <add> moment([2012, 0, 2]).format('w ww wo'), <add> '1 01 1º', <add> 'Jan 2 2012 should be week 1' <add> ); <add> assert.equal( <add> moment([2012, 0, 8]).format('w ww wo'), <add> '2 02 2º', <add> 'Jan 8 2012 should be week 2' <add> ); <add> assert.equal( <add> moment([2012, 0, 9]).format('w ww wo'), <add> '2 02 2º', <add> 'Jan 9 2012 should be week 2' <add> ); <add> assert.equal( <add> moment([2012, 0, 15]).format('w ww wo'), <add> '3 03 3º', <add> 'Jan 15 2012 should be week 3' <add> ); <add>}); <add> <add>// Concrete test for Locale#weekdaysMin <add>test('Weekdays sort by locale', function (assert) { <add> const weekdays = 'domingo_lunes_martes_miércoles_jueves_viernes_sábado', <add> weekdaysShort = 'dom._lun._mar._mié._jue._vie._sáb.', <add> weekdaysMin = 'do_lu_ma_mi_ju_vi_sá'; <add> <add> assert.deepEqual( <add> moment().localeData().weekdays(), <add> weekdays.split('_'), <add> 'weekdays start on Sunday' <add> ); <add> assert.deepEqual( <add> moment().localeData().weekdays(true), <add> weekdays.split('_'), <add> 'locale-sorted weekdays start on Sunday' <add> ); <add> assert.deepEqual( <add> moment().localeData().weekdaysShort(), <add> weekdaysShort.split('_'), <add> 'weekdaysShort start on Sunday' <add> ); <add> assert.deepEqual( <add> moment().localeData().weekdaysShort(true), <add> weekdaysShort.split('_'), <add> 'locale-sorted weekdaysShort start on Sunday' <add> ); <add> assert.deepEqual( <add> moment().localeData().weekdaysMin(), <add> weekdaysMin.split('_'), <add> 'weekdaysMin start on Sunday' <add> ); <add> assert.deepEqual( <add> moment().localeData().weekdaysMin(true), <add> weekdaysMin.split('_'), <add> 'locale-sorted weekdaysMin start on Sunday' <add> ); <add>}); <add> <add>test('test short months proper', function (assert) { <add> var str = '02-ago-2016'; <add> assert.equal( <add> moment(str, 'DD-MMM-YYYY').month(), <add> '7', <add> '02-ago-2016 month should be 7' <add> ); <add>}); <add> <add>test('translated invalid date', function (assert) { <add> assert.equal( <add> moment('nonsense', 'DD-MMM-YYYY').format(), <add> 'Fecha inválida', <add> 'Invalid date should translate' <add> ); <add>});
2
Javascript
Javascript
make setmulticastttl() conform to v0.4 api
ed111975a096cb44a7d737e46c6e0c73025e0670
<ide><path>lib/dgram.js <ide> Socket.prototype.setTTL = function(arg) { <ide> <ide> <ide> Socket.prototype.setMulticastTTL = function(arg) { <del> if (this._handle.setMulticastTTL(arg) == -1) { <add> if (typeof arg !== 'number') { <add> throw new TypeError('Argument must be a number'); <add> } <add> <add> if (this._handle.setMulticastTTL(arg)) { <ide> throw errnoException(errno, 'setMulticastTTL'); <ide> } <ide> <del> return true; <add> return arg; <ide> }; <ide> <ide>
1
Text
Text
fix typos in async_hooks
6a56a0a3f831a28376e73eab809e66fb639628b9
<ide><path>doc/api/async_hooks.md <ide> RANDOMBYTESREQUEST, TLSWRAP, Timeout, Immediate, TickObject <ide> There is also the `PROMISE` resource type, which is used to track `Promise` <ide> instances and asynchronous work scheduled by them. <ide> <del>Users are be able to define their own `type` when using the public embedder API. <add>Users are able to define their own `type` when using the public embedder API. <ide> <ide> *Note:* It is possible to have type name collisions. Embedders are encouraged <del>to use a unique prefixes, such as the npm package name, to prevent collisions <add>to use unique prefixes, such as the npm package name, to prevent collisions <ide> when listening to the hooks. <ide> <ide> ###### `triggerId`
1
Go
Go
delete the interface on endpoint delete in overlay
83f1107e59f728d2a240471548d6558f59cbd065
<ide><path>libnetwork/drivers/overlay/joinleave.go <ide> func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, <ide> <ide> sbox := n.sandbox() <ide> <del> name1, name2, err := createVethPair() <add> overlayIfName, containerIfName, err := createVethPair() <ide> if err != nil { <ide> return err <ide> } <ide> <del> ep.ifName = name2 <add> ep.ifName = overlayIfName <ide> <ide> // Set the container interface and its peer MTU to 1450 to allow <ide> // for 50 bytes vxlan encap (inner eth header(14) + outer IP(20) + <ide> // outer UDP(8) + vxlan header(8)) <del> veth, err := netlink.LinkByName(name1) <add> veth, err := netlink.LinkByName(overlayIfName) <ide> if err != nil { <del> return fmt.Errorf("cound not find link by name %s: %v", name1, err) <add> return fmt.Errorf("cound not find link by name %s: %v", overlayIfName, err) <ide> } <ide> err = netlink.LinkSetMTU(veth, vxlanVethMTU) <ide> if err != nil { <ide> return err <ide> } <ide> <del> if err := sbox.AddInterface(name1, "veth", <add> if err := sbox.AddInterface(overlayIfName, "veth", <ide> sbox.InterfaceOptions().Master(s.brName)); err != nil { <ide> return fmt.Errorf("could not add veth pair inside the network sandbox: %v", err) <ide> } <ide> <del> veth, err = netlink.LinkByName(name2) <add> veth, err = netlink.LinkByName(containerIfName) <ide> if err != nil { <del> return fmt.Errorf("could not find link by name %s: %v", name2, err) <add> return fmt.Errorf("could not find link by name %s: %v", containerIfName, err) <ide> } <ide> err = netlink.LinkSetMTU(veth, vxlanVethMTU) <ide> if err != nil { <ide> func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, <ide> } <ide> <ide> if iNames := jinfo.InterfaceName(); iNames != nil { <del> err = iNames.SetNames(name2, "eth") <add> err = iNames.SetNames(containerIfName, "eth") <ide> if err != nil { <ide> return err <ide> } <ide> func (d *driver) Leave(nid, eid string) error { <ide> <ide> n.leaveSandbox() <ide> <del> link, err := netlink.LinkByName(ep.ifName) <del> if err != nil { <del> log.Warnf("Failed to retrieve interface link for interface removal on endpoint leave: %v", err) <del> return nil <del> } <del> if err := netlink.LinkDel(link); err != nil { <del> log.Warnf("Failed to delete interface link on endpoint leave: %v", err) <del> } <del> <ide> return nil <ide> } <ide><path>libnetwork/drivers/overlay/ov_endpoint.go <ide> import ( <ide> "fmt" <ide> "net" <ide> <add> log "github.com/Sirupsen/logrus" <ide> "github.com/docker/libnetwork/driverapi" <ide> "github.com/docker/libnetwork/netutils" <add> "github.com/vishvananda/netlink" <ide> ) <ide> <ide> type endpointTable map[string]*endpoint <ide> func (d *driver) DeleteEndpoint(nid, eid string) error { <ide> } <ide> <ide> n.deleteEndpoint(eid) <add> <add> if ep.ifName == "" { <add> return nil <add> } <add> <add> link, err := netlink.LinkByName(ep.ifName) <add> if err != nil { <add> log.Debugf("Failed to retrieve interface (%s)'s link on endpoint (%s) delete: %v", ep.ifName, ep.id, err) <add> return nil <add> } <add> if err := netlink.LinkDel(link); err != nil { <add> log.Debugf("Failed to delete interface (%s)'s link on endpoint (%s) delete: %v", ep.ifName, ep.id, err) <add> } <add> <ide> return nil <ide> } <ide> <ide><path>libnetwork/drivers/overlay/ov_network.go <ide> func (n *network) destroySandbox() { <ide> sbox := n.sandbox() <ide> if sbox != nil { <ide> for _, iface := range sbox.Info().Interfaces() { <del> iface.Remove() <add> if err := iface.Remove(); err != nil { <add> logrus.Debugf("Remove interface %s failed: %v", iface.SrcName(), err) <add> } <ide> } <ide> <ide> for _, s := range n.subnets { <ide><path>libnetwork/osl/interface_linux.go <ide> import ( <ide> "sync" <ide> "syscall" <ide> <add> log "github.com/Sirupsen/logrus" <ide> "github.com/docker/libnetwork/types" <ide> "github.com/vishvananda/netlink" <ide> ) <ide> func (i *nwIface) Remove() error { <ide> <ide> err = netlink.LinkSetName(iface, i.SrcName()) <ide> if err != nil { <del> fmt.Println("LinkSetName failed: ", err) <add> log.Debugf("LinkSetName failed for interface %s: %v", i.SrcName(), err) <ide> return err <ide> } <ide> <ide> func (i *nwIface) Remove() error { <ide> } else if !isDefault { <ide> // Move the network interface to caller namespace. <ide> if err := netlink.LinkSetNsFd(iface, callerFD); err != nil { <del> fmt.Println("LinkSetNsPid failed: ", err) <add> log.Debugf("LinkSetNsPid failed for interface %s: %v", i.SrcName(), err) <ide> return err <ide> } <ide> } <ide><path>libnetwork/sandbox.go <ide> func releaseOSSboxResources(osSbox osl.Sandbox, ep *endpoint) { <ide> // Only remove the interfaces owned by this endpoint from the sandbox. <ide> if ep.hasInterface(i.SrcName()) { <ide> if err := i.Remove(); err != nil { <del> log.Debugf("Remove interface failed: %v", err) <add> log.Debugf("Remove interface %s failed: %v", i.SrcName(), err) <ide> } <ide> } <ide> }
5
Text
Text
add flarna to collaborators
98007329ef144106e5297f9efcf1a1a26c74124f
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> **Franziska Hinkelmann** &lt;franziska.hinkelmann@gmail.com&gt; (she/her) <ide> * [Fishrock123](https://github.com/Fishrock123) - <ide> **Jeremiah Senkpiel** &lt;fishrock123@rocketmail.com&gt; (he/they) <add>* [Flarna](https://github.com/Flarna) - <add>**Gerhard Stöbich** &lt;deb2001-github@yahoo.de&gt; (he/they) <ide> * [gabrielschulhof](https://github.com/gabrielschulhof) - <ide> **Gabriel Schulhof** &lt;gabriel.schulhof@intel.com&gt; <ide> * [gdams](https://github.com/gdams) -
1
Text
Text
add basic issue and pr templates
6b1232aa86415f0573153888a46c4c5cb38974d8
<ide><path>.github/ISSUE_TEMPLATE.md <add>**Do you want to request a *feature* or report a *bug*?** <add> <add>**What is the current behavior?** <add> <add>**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/reactjs/69z2wepo/).** <add> <add>**What is the expected behavior?** <add> <add>**Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?** <ide><path>.github/PULL_REQUEST_TEMPLATE.md <add>*Before* submitting a pull request, please make sure the following is done... <add> <add>1. Fork the repo and create your branch from `master`. <add>2. If you've added code that should be tested, add tests! <add>3. If you've changed APIs, update the documentation. <add>4. Ensure the test suite passes (`grunt test`). <add>5. Make sure your code lints (`grunt lint`) - we've done our best to make sure these rules match our internal linting guidelines. <add>6. If you haven't already, complete the [CLA](https://code.facebook.com/cla).
2
Javascript
Javascript
fix breakpoint prefixing in list()
292e2ea5add821645540d12fde57a2546ed77463
<ide><path>lib/_debugger.js <ide> function intChars(n) { <ide> <ide> // Adds spaces and prefix to number <ide> function leftPad(n, prefix) { <del> var s = n.toString(); <del> var nchars = intChars(n); <del> var nspaces = nchars - s.length; <add> var s = n.toString(), <add> nchars = intChars(n), <add> nspaces = nchars - s.length - 1; <add> <add> prefix || (prefix = ' '); <add> <ide> for (var i = 0; i < nspaces; i++) { <del> s = (prefix || ' ') + s; <add> prefix += ' '; <ide> } <del> return s; <add> <add> return prefix + s; <ide> } <ide> <ide>
1
Javascript
Javascript
remove calls to `range.detach`
8c9a24983e8b9dd452f5e378e845104e81333b74
<ide><path>src/browser/ui/ReactDOMSelection.js <ide> function getModernOffsets(node) { <ide> detectionRange.setStart(anchorNode, anchorOffset); <ide> detectionRange.setEnd(focusNode, focusOffset); <ide> var isBackward = detectionRange.collapsed; <del> detectionRange.detach(); <ide> <ide> return { <ide> start: isBackward ? end : start, <ide> function setModernOffsets(node, offsets) { <ide> range.setEnd(endMarker.node, endMarker.offset); <ide> selection.addRange(range); <ide> } <del> <del> range.detach(); <ide> } <ide> } <ide>
1
Ruby
Ruby
remove incorrect comment from example formula
a6a4cd4c917259910a79f712a142fd75b5764379
<ide><path>Library/Contributions/example-formula.rb <ide> def install <ide> # Further possibilities with the pathnames: <ide> # http://www.ruby-doc.org/stdlib-1.8.7/libdoc/pathname/rdoc/Pathname.html <ide> <del> # Sometime you will see that instead of `+` we build up a path with `/` <del> # because it looks nicer (but you can't nest more than two `/`): <del> (var/"foo").mkpath <ide> # Copy `./example_code/simple/ones` to share/demos <ide> (share/"demos").install "example_code/simple/ones" <ide> # Copy `./example_code/simple/ones` to share/demos/examples
1
Javascript
Javascript
implement uri imports
19609937c750c170d26bf169cdbe4040931c8d47
<ide><path>lib/NormalModule.js <ide> const ModuleParseError = require("./ModuleParseError"); <ide> const ModuleWarning = require("./ModuleWarning"); <ide> const RuntimeGlobals = require("./RuntimeGlobals"); <ide> const WebpackError = require("./WebpackError"); <add>const { decodeDataURI } = require("./util/DataURI"); <ide> const { <ide> compareLocations, <ide> concatComparators, <ide> const asBuffer = input => { <ide> return input; <ide> }; <ide> <add>const readResourceFn = fs => { <add> return (resource, callback) => { <add> const decodedData = decodeDataURI(resource); <add> <add> if (decodedData) { <add> process.nextTick(() => { <add> callback(null, decodedData); <add> }); <add> return; <add> } <add> <add> fs.readFile(resource, callback); <add> }; <add>}; <add> <ide> class NonErrorEmittedError extends WebpackError { <ide> constructor(error) { <ide> super(); <ide> class NormalModule extends Module { <ide> resource: this.resource, <ide> loaders: this.loaders, <ide> context: loaderContext, <del> readResource: fs.readFile.bind(fs) <add> readResource: readResourceFn(fs) <ide> }, <ide> (err, result) => { <ide> if (!result) { <ide><path>lib/NormalModuleFactory.js <ide> const BasicEffectRulePlugin = require("./rules/BasicEffectRulePlugin"); <ide> const BasicMatcherRulePlugin = require("./rules/BasicMatcherRulePlugin"); <ide> const RuleSetCompiler = require("./rules/RuleSetCompiler"); <ide> const UseEffectRulePlugin = require("./rules/UseEffectRulePlugin"); <add>const { isDataURI } = require("./util/DataURI"); <ide> const LazySet = require("./util/LazySet"); <ide> const { cachedCleverMerge } = require("./util/cleverMerge"); <ide> const { join } = require("./util/fs"); <ide> class NormalModuleFactory extends ModuleFactory { <ide> unresolvedResource, <ide> resolveContext, <ide> (err, resolvedResource, resolvedResourceResolveData) => { <del> if (err) return continueCallback(err); <add> if (err) { <add> if (!isDataURI(unresolvedResource)) return continueCallback(err); <add> <add> resolvedResource = unresolvedResource; <add> } <ide> resource = resolvedResource; <ide> resourceResolveData = resolvedResourceResolveData; <ide> continueCallback(); <ide><path>lib/util/DataURI.js <add>/* <add> MIT License http://www.opensource.org/licenses/mit-license.php <add>*/ <add> <add>"use strict"; <add> <add>// data URL scheme: "data:text/javascript;charset=utf-8;base64,some-string" <add>// http://www.ietf.org/rfc/rfc2397.txt <add>const URIRegEx = /^data:([^;,]+)?((?:;(?:[^;,]+))*?)(;base64)?,(.*)$/; <add> <add>const isDataURI = uri => { <add> return !!URIRegEx.exec(uri); <add>}; <add> <add>const decodeDataURI = uri => { <add> const match = URIRegEx.exec(uri); <add> if (!match) return null; <add> <add> const isBase64 = match[3]; <add> const body = match[4]; <add> return isBase64 <add> ? Buffer.from(body, "base64") <add> : Buffer.from(decodeURIComponent(body), "ascii"); <add>}; <add> <add>module.exports = { <add> isDataURI, <add> decodeDataURI <add>};
3
Text
Text
remove reference to slack
ba2a55f1521cfebb4c9931eec50cf92530df8190
<ide><path>README.md <ide> You can ask questions and join the development discussion: <ide> <ide> - In the [TensorFlow forum](https://discuss.tensorflow.org/). <ide> - On the [Keras Google group](https://groups.google.com/forum/#!forum/keras-users). <del>- On the [Keras Slack channel](https://kerasteam.slack.com). Use [this link](https://keras-slack-autojoin.herokuapp.com/) to request an invitation to the channel. <ide> <ide> --- <ide>
1
Python
Python
remove unused mlib_pkg_content function
f56c11a7ba8e60fd5e4873be6469022eb5384da9
<ide><path>numpy/core/setup.py <ide> def visibility_define(config): <ide> else: <ide> return '' <ide> <del>def mlib_pkg_content(mathlibs): <del> posix_mlib = ' '.join(['-l%s' % l for l in mathlibs]) <del> msvc_mlib = ' '.join(['%s.lib' % l for l in mathlibs]) <del> ret = """ <del>[meta] <del>Name = mlib <del>Description = Math library used with this version of numpy <del>Version = 1.0 <del> <del>[default] <del>Libs=%s <del> <del>[msvc] <del>Libs=%s <del> """ % (posix_mlib, msvc_mlib) <del> return ret <del> <ide> def configuration(parent_package='',top_path=None): <ide> from numpy.distutils.misc_util import Configuration,dot_join <ide> from numpy.distutils.system_info import get_info, default_lib_dirs
1
Text
Text
remove extra spaces and concats in examples
6ea8c669df5373e0f3b4dc0092063aafda87c9b7
<ide><path>doc/api/addons.md <ide> const addon = require('./build/Release/addon'); <ide> <ide> var obj1 = addon('hello'); <ide> var obj2 = addon('world'); <del>console.log(obj1.msg + ' ' + obj2.msg); // 'hello world' <add>console.log(obj1.msg, obj2.msg); // 'hello world' <ide> ``` <ide> <ide> <ide><path>doc/api/child_process.md <ide> const spawn = require('child_process').spawn; <ide> <ide> let child = spawn('sh', ['-c', <ide> `node -e "setInterval(() => { <del> console.log(process.pid + 'is alive') <add> console.log(process.pid, 'is alive') <ide> }, 500);"` <ide> ], { <ide> stdio: ['inherit', 'inherit', 'inherit'] <ide><path>doc/api/console.md <ide> values similar to `printf(3)` (the arguments are all passed to <ide> var count = 5; <ide> console.log('count: %d', count); <ide> // Prints: count: 5, to stdout <del>console.log('count: ', count); <add>console.log('count:', count); <ide> // Prints: count: 5, to stdout <ide> ``` <ide> <ide><path>doc/api/https.md <ide> Example: <ide> const https = require('https'); <ide> <ide> https.get('https://encrypted.google.com/', (res) => { <del> console.log('statusCode: ', res.statusCode); <del> console.log('headers: ', res.headers); <add> console.log('statusCode:', res.statusCode); <add> console.log('headers:', res.headers); <ide> <ide> res.on('data', (d) => { <ide> process.stdout.write(d); <ide> var options = { <ide> }; <ide> <ide> var req = https.request(options, (res) => { <del> console.log('statusCode: ', res.statusCode); <del> console.log('headers: ', res.headers); <add> console.log('statusCode:', res.statusCode); <add> console.log('headers:', res.headers); <ide> <ide> res.on('data', (d) => { <ide> process.stdout.write(d); <ide><path>doc/api/modules.md <ide> The contents of `foo.js`: <ide> <ide> ```js <ide> const circle = require('./circle.js'); <del>console.log( `The area of a circle of radius 4 is ${circle.area(4)}`); <add>console.log(`The area of a circle of radius 4 is ${circle.area(4)}`); <ide> ``` <ide> <ide> The contents of `circle.js`: <ide><path>doc/api/process.md <ide> For example: <ide> <ide> ```js <ide> process.on('unhandledRejection', (reason, p) => { <del> console.log("Unhandled Rejection at: Promise ", p, " reason: ", reason); <del> // application specific logging, throwing an error, or other logic here <add> console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); <add> // application specific logging, throwing an error, or other logic here <ide> }); <ide> <ide> somePromise.then((res) => { <ide><path>doc/api/vm.md <ide> const vm = require('vm'); <ide> var localVar = 'initial value'; <ide> <ide> const vmResult = vm.runInThisContext('localVar = "vm";'); <del>console.log('vmResult: ', vmResult); <del>console.log('localVar: ', localVar); <add>console.log('vmResult:', vmResult); <add>console.log('localVar:', localVar); <ide> <ide> const evalResult = eval('localVar = "eval";'); <del>console.log('evalResult: ', evalResult); <del>console.log('localVar: ', localVar); <add>console.log('evalResult:', evalResult); <add>console.log('localVar:', localVar); <ide> <ide> // vmResult: 'vm', localVar: 'initial value' <ide> // evalResult: 'eval', localVar: 'eval'
7
Go
Go
add a filter chain to allow persistent rules
c348cebe999c76be7eb6643ba742a284dd0ab071
<ide><path>libnetwork/controller.go <ide> addToStore: <ide> c.Unlock() <ide> } <ide> <add> c.Lock() <add> arrangeUserFilterRule() <add> c.Unlock() <add> <ide> return network, nil <ide> } <ide> <ide><path>libnetwork/drivers/bridge/setup_ip_tables.go <ide> func setupIPChains(config *configuration) (*iptables.ChainInfo, *iptables.ChainI <ide> return nil, nil, nil, fmt.Errorf("failed to create FILTER isolation chain: %v", err) <ide> } <ide> <del> if err := addReturnRule(IsolationChain); err != nil { <add> if err := iptables.AddReturnRule(IsolationChain); err != nil { <ide> return nil, nil, nil, err <ide> } <ide> <ide> func (n *bridgeNetwork) setupIPTables(config *networkConfiguration, i *bridgeInt <ide> } <ide> <ide> d.Lock() <del> err = ensureJumpRule("FORWARD", IsolationChain) <add> err = iptables.EnsureJumpRule("FORWARD", IsolationChain) <ide> d.Unlock() <ide> if err != nil { <ide> return err <ide> func setINC(iface1, iface2 string, enable bool) error { <ide> return nil <ide> } <ide> <del>func addReturnRule(chain string) error { <del> var ( <del> table = iptables.Filter <del> args = []string{"-j", "RETURN"} <del> ) <del> <del> if iptables.Exists(table, chain, args...) { <del> return nil <del> } <del> <del> err := iptables.RawCombinedOutput(append([]string{"-I", chain}, args...)...) <del> if err != nil { <del> return fmt.Errorf("unable to add return rule in %s chain: %s", chain, err.Error()) <del> } <del> <del> return nil <del>} <del> <del>// Ensure the jump rule is on top <del>func ensureJumpRule(fromChain, toChain string) error { <del> var ( <del> table = iptables.Filter <del> args = []string{"-j", toChain} <del> ) <del> <del> if iptables.Exists(table, fromChain, args...) { <del> err := iptables.RawCombinedOutput(append([]string{"-D", fromChain}, args...)...) <del> if err != nil { <del> return fmt.Errorf("unable to remove jump to %s rule in %s chain: %s", toChain, fromChain, err.Error()) <del> } <del> } <del> <del> err := iptables.RawCombinedOutput(append([]string{"-I", fromChain}, args...)...) <del> if err != nil { <del> return fmt.Errorf("unable to insert jump to %s rule in %s chain: %s", toChain, fromChain, err.Error()) <del> } <del> <del> return nil <del>} <del> <ide> func removeIPChains() { <ide> for _, chainInfo := range []iptables.ChainInfo{ <ide> {Name: DockerChain, Table: iptables.Nat}, <ide><path>libnetwork/firewall_linux.go <add>package libnetwork <add> <add>import ( <add> "github.com/Sirupsen/logrus" <add> "github.com/docker/libnetwork/iptables" <add>) <add> <add>const userChain = "DOCKER-USER" <add> <add>// This chain allow users to configure firewall policies in a way that persists <add>// docker operations/restarts. Docker will not delete or modify any pre-existing <add>// rules from the DOCKER-USER filter chain. <add>func arrangeUserFilterRule() { <add> _, err := iptables.NewChain(userChain, iptables.Filter, false) <add> if err != nil { <add> logrus.Warnf("Failed to create %s chain: %v", userChain, err) <add> return <add> } <add> <add> if err = iptables.AddReturnRule(userChain); err != nil { <add> logrus.Warnf("Failed to add the RETURN rule for %s: %v", userChain, err) <add> return <add> } <add> <add> err = iptables.EnsureJumpRule("FORWARD", userChain) <add> if err != nil { <add> logrus.Warnf("Failed to ensure the jump rule for %s: %v", userChain, err) <add> } <add>} <ide><path>libnetwork/firewall_others.go <add>// +build !linux <add> <add>package libnetwork <add> <add>func arrangeUserFilterRule() { <add>} <ide><path>libnetwork/iptables/iptables.go <ide> func parseVersionNumbers(input string) (major, minor, micro int) { <ide> func supportsCOption(mj, mn, mc int) bool { <ide> return mj > 1 || (mj == 1 && (mn > 4 || (mn == 4 && mc >= 11))) <ide> } <add> <add>// AddReturnRule adds a return rule for the chain in the filter table <add>func AddReturnRule(chain string) error { <add> var ( <add> table = Filter <add> args = []string{"-j", "RETURN"} <add> ) <add> <add> if Exists(table, chain, args...) { <add> return nil <add> } <add> <add> err := RawCombinedOutput(append([]string{"-A", chain}, args...)...) <add> if err != nil { <add> return fmt.Errorf("unable to add return rule in %s chain: %s", chain, err.Error()) <add> } <add> <add> return nil <add>} <add> <add>// EnsureJumpRule ensures the jump rule is on top <add>func EnsureJumpRule(fromChain, toChain string) error { <add> var ( <add> table = Filter <add> args = []string{"-j", toChain} <add> ) <add> <add> if Exists(table, fromChain, args...) { <add> err := RawCombinedOutput(append([]string{"-D", fromChain}, args...)...) <add> if err != nil { <add> return fmt.Errorf("unable to remove jump to %s rule in %s chain: %s", toChain, fromChain, err.Error()) <add> } <add> } <add> <add> err := RawCombinedOutput(append([]string{"-I", fromChain}, args...)...) <add> if err != nil { <add> return fmt.Errorf("unable to insert jump to %s rule in %s chain: %s", toChain, fromChain, err.Error()) <add> } <add> <add> return nil <add>}
5
PHP
PHP
fix cs error
5fb45e664acd891d0c6726431531dae1b2175ce9
<ide><path>src/TestSuite/IntegrationTestCase.php <ide> */ <ide> namespace Cake\TestSuite; <ide> <del> <ide> /** <ide> * A test case class intended to make integration tests of <ide> * your controllers easier.
1
Javascript
Javascript
swap actual&optional params
1b75b81649335a32912c3913b5afb5833c8a1602
<ide><path>test/pummel/test-stream-pipe-multi.js <ide> FakeStream.prototype.close = function() { <ide> <ide> // expect all streams to close properly. <ide> process.on('exit', function() { <del> assert.strictEqual(cnt, wclosed); <del> assert.strictEqual(cnt, rclosed); <add> assert.strictEqual(wclosed, cnt); <add> assert.strictEqual(rclosed, cnt); <ide> }); <ide> <ide> for (let i = 0; i < chunkSize; i++) {
1
Ruby
Ruby
add last_commit method
2f5f352baa95ce9cc6b4e0007ee2fc028ffc2a1a
<ide><path>Library/Homebrew/download_strategy.rb <ide> def head? <ide> version.head? <ide> end <ide> <add> # Return last commit's unique identifier for the repository. <add> # Return most recent modified timestamp unless overridden. <add> def last_commit <add> source_modified_time.to_i.to_s <add> end <add> <ide> private <ide> <ide> def cache_tag <ide> def source_modified_time <ide> Time.parse REXML::XPath.first(xml, "//date/text()").to_s <ide> end <ide> <add> def last_commit <add> Utils.popen_read("svn", "info", "--show-item", "revision", cached_location.to_s).strip <add> end <add> <ide> private <ide> <ide> def repo_url <ide> def source_modified_time <ide> Time.parse Utils.popen_read("git", "--git-dir", git_dir, "show", "-s", "--format=%cD") <ide> end <ide> <add> def last_commit <add> Utils.popen_read("git", "--git-dir", git_dir ,"rev-parse", "HEAD").chomp <add> end <add> <ide> private <ide> <ide> def cache_tag <ide> def source_modified_time <ide> Time.parse Utils.popen_read("hg", "tip", "--template", "{date|isodate}", "-R", cached_location.to_s) <ide> end <ide> <add> def last_commit <add> Utils.popen_read("hg", "parent", "--template", "{node}", "-R", cached_location.to_s) <add> end <add> <ide> private <ide> <ide> def cache_tag <ide> def source_modified_time <ide> Time.parse Utils.popen_read("bzr", "log", "-l", "1", "--timezone=utc", cached_location.to_s)[/^timestamp: (.+)$/, 1] <ide> end <ide> <add> def last_commit <add> Utils.popen_read("bzr", "revno", cached_location.to_s).chomp <add> end <add> <ide> private <ide> <ide> def cache_tag <ide> def source_modified_time <ide> Time.parse Utils.popen_read("fossil", "info", "tip", "-R", cached_location.to_s)[/^uuid: +\h+ (.+)$/, 1] <ide> end <ide> <add> def last_commit <add> Utils.popen_read("fossil", "info", "tip", "-R", cached_location.to_s)[/^uuid: +(\h+) .+$/, 1] <add> end <add> <ide> private <ide> <ide> def cache_tag
1
Javascript
Javascript
pull last chunk on socket close
f153d6da450b6ba5c78381e6e90a7ba243657691
<ide><path>lib/_http_client.js <ide> function socketCloseListener() { <ide> var parser = socket.parser; <ide> var req = socket._httpMessage; <ide> debug('HTTP socket close'); <add> <add> // Pull through final chunk, if anything is buffered. <add> // the ondata function will handle it properly, and this <add> // is a no-op if no final chunk remains. <add> socket.read(); <add> <ide> req.emit('close'); <ide> if (req.res && req.res.readable) { <ide> // Socket closed before we emitted 'end' below. <ide><path>test/simple/test-https-truncate.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <add>var common = require('../common'); <add>var assert = require('assert'); <add> <add>var fs = require('fs'); <add>var https = require('https'); <add>var path = require('path'); <add> <add>var resultFile = path.resolve(common.tmpDir, 'result'); <add> <add>var key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'); <add>var cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'); <add> <add>var PORT = common.PORT; <add> <add>// number of bytes discovered empirically to trigger the bug <add>var data = new Buffer(1024 * 32 + 1); <add> <add>httpsTest(); <add> <add>function httpsTest() { <add> var sopt = { key: key, cert: cert }; <add> <add> var server = https.createServer(sopt, function(req, res) { <add> res.setHeader('content-length', data.length); <add> res.end(data); <add> server.close(); <add> }); <add> <add> server.listen(PORT, function() { <add> var opts = { port: PORT, rejectUnauthorized: false }; <add> https.get(opts).on('response', function(res) { <add> test(res); <add> }); <add> }); <add>} <add> <add> <add>function test(res) { <add> res.on('end', function() { <add> assert.equal(res._readableState.length, 0); <add> assert.equal(bytes, data.length); <add> console.log('ok'); <add> }); <add> <add> // Pause and then resume on each chunk, to ensure that there will be <add> // a lone byte hanging out at the very end. <add> var bytes = 0; <add> res.on('data', function(chunk) { <add> bytes += chunk.length; <add> this.pause(); <add> setTimeout(this.resume.bind(this)); <add> }); <add>}
2
Javascript
Javascript
delay data to elements synchronization to update
d1a243efec9532db630268e0584d766b4ce2c73b
<ide><path>src/core/core.datasetController.js <ide> export default class DatasetController { <ide> this._drawCount = undefined; <ide> this.enableOptionSharing = false; <ide> this.$context = undefined; <add> this._syncList = []; <ide> <ide> this.initialize(); <ide> } <ide> export default class DatasetController { <ide> } <ide> <ide> updateIndex(datasetIndex) { <add> if (this.index !== datasetIndex) { <add> clearStacks(this._cachedMeta); <add> } <ide> this.index = datasetIndex; <ide> } <ide> <ide> export default class DatasetController { <ide> const me = this; <ide> const dataset = me.getDataset(); <ide> const data = dataset.data || (dataset.data = []); <add> const _data = me._data; <ide> <ide> // In order to correctly handle data addition/deletion animation (an thus simulate <ide> // real-time charts), we need to monitor these data modifications and synchronize <ide> // the internal meta data accordingly. <ide> <ide> if (isObject(data)) { <ide> me._data = convertObjectDataToArray(data); <del> } else if (me._data !== data) { <del> if (me._data) { <add> } else if (_data !== data) { <add> if (_data) { <ide> // This case happens when the user replaced the data array instance. <del> unlistenArrayEvents(me._data, me); <del> clearStacks(me._cachedMeta); <add> unlistenArrayEvents(_data, me); <add> // Discard old elements, parsed data and stacks <add> const meta = me._cachedMeta; <add> clearStacks(meta); <add> meta._parsed = []; <add> meta.data = []; <ide> } <ide> if (data && Object.isExtensible(data)) { <ide> listenArrayEvents(data, me); <add> me._syncList = []; <ide> } <ide> me._data = data; <ide> } <ide> export default class DatasetController { <ide> me._dataCheck(); <ide> <ide> // make sure cached _stacked status is current <add> const oldStacked = meta._stacked; <ide> meta._stacked = isStacked(meta.vScale, meta); <ide> <ide> // detect change in stack option <ide> export default class DatasetController { <ide> me._resyncElements(resetNewElements); <ide> <ide> // if stack changed, update stack values for the whole dataset <del> if (stackChanged) { <add> if (stackChanged || oldStacked !== meta._stacked) { <ide> updateStacks(me, meta._parsed); <ide> } <ide> } <ide> export default class DatasetController { <ide> */ <ide> _resyncElements(resetNewElements) { <ide> const me = this; <del> const numMeta = me._cachedMeta.data.length; <del> const numData = me._data.length; <add> const data = me._data; <add> const elements = me._cachedMeta.data; <add> <add> // Apply changes detected through array listeners <add> for (const [method, arg1, arg2] of me._syncList) { <add> me[method](arg1, arg2); <add> } <add> me._syncList = []; <add> <add> const numMeta = elements.length; <add> const numData = data.length; <add> const count = Math.min(numData, numMeta); <ide> <ide> if (numData > numMeta) { <ide> me._insertElements(numMeta, numData - numMeta, resetNewElements); <ide> } else if (numData < numMeta) { <ide> me._removeElements(numData, numMeta - numData); <del> } <del> // Re-parse the old elements (new elements are parsed in _insertElements) <del> const count = Math.min(numData, numMeta); <del> if (count) { <add> } else if (count) { <add> // TODO: It is not optimal to always parse the old data <add> // This is done because we are not detecting direct assignments: <add> // chart.data.datasets[0].data[5] = 10; <add> // chart.data.datasets[0].data[5].y = 10; <ide> me.parse(0, count); <ide> } <ide> } <ide> export default class DatasetController { <ide> */ <ide> _onDataPush() { <ide> const count = arguments.length; <del> this._insertElements(this.getDataset().data.length - count, count); <add> this._syncList.push(['_insertElements', this.getDataset().data.length - count, count]); <ide> } <ide> <ide> /** <ide> * @private <ide> */ <ide> _onDataPop() { <del> this._removeElements(this._cachedMeta.data.length - 1, 1); <add> this._syncList.push(['_removeElements', this._cachedMeta.data.length - 1, 1]); <ide> } <ide> <ide> /** <ide> * @private <ide> */ <ide> _onDataShift() { <del> this._removeElements(0, 1); <add> this._syncList.push(['_removeElements', 0, 1]); <ide> } <ide> <ide> /** <ide> * @private <ide> */ <ide> _onDataSplice(start, count) { <del> this._removeElements(start, count); <del> this._insertElements(start, arguments.length - 2); <add> this._syncList.push(['_removeElements', start, count]); <add> this._syncList.push(['_insertElements', start, arguments.length - 2]); <ide> } <ide> <ide> /** <ide> * @private <ide> */ <ide> _onDataUnshift() { <del> this._insertElements(0, arguments.length); <add> this._syncList.push(['_insertElements', 0, arguments.length]); <ide> } <ide> } <ide> <ide><path>test/specs/core.datasetController.tests.js <ide> describe('Chart.DatasetController', function() { <ide> last = meta.data[5]; <ide> data.push(6, 7, 8); <ide> data.push(9); <add> chart.update(); <ide> expect(meta.data.length).toBe(10); <ide> expect(meta.data[0]).toBe(first); <ide> expect(meta.data[5]).toBe(last); <ide> expect(parsedYValues()).toEqual(data); <ide> <ide> last = meta.data[9]; <ide> data.pop(); <add> chart.update(); <ide> expect(meta.data.length).toBe(9); <ide> expect(meta.data[0]).toBe(first); <ide> expect(meta.data.indexOf(last)).toBe(-1); <ide> describe('Chart.DatasetController', function() { <ide> data.shift(); <ide> data.shift(); <ide> data.shift(); <add> chart.update(); <ide> expect(meta.data.length).toBe(6); <ide> expect(meta.data.indexOf(first)).toBe(-1); <ide> expect(meta.data[5]).toBe(last); <ide> describe('Chart.DatasetController', function() { <ide> second = meta.data[1]; <ide> last = meta.data[5]; <ide> data.splice(1, 4, 10, 11); <add> chart.update(); <ide> expect(meta.data.length).toBe(4); <ide> expect(meta.data[0]).toBe(first); <ide> expect(meta.data[3]).toBe(last); <ide> describe('Chart.DatasetController', function() { <ide> <ide> data.unshift(12, 13, 14, 15); <ide> data.unshift(16, 17); <add> chart.update(); <ide> expect(meta.data.length).toBe(10); <ide> expect(meta.data[6]).toBe(first); <ide> expect(meta.data[9]).toBe(last); <ide> describe('Chart.DatasetController', function() { <ide> last = controller.getParsed(5); <ide> data.push({x: 6, y: 6}, {x: 7, y: 7}, {x: 8, y: 8}); <ide> data.push({x: 9, y: 9}); <add> chart.update(); <ide> expect(meta.data.length).toBe(10); <ide> expect(controller.getParsed(0)).toBe(first); <ide> expect(controller.getParsed(5)).toBe(last); <ide> <ide> last = controller.getParsed(9); <ide> data.pop(); <add> chart.update(); <ide> expect(meta.data.length).toBe(9); <ide> expect(controller.getParsed(0)).toBe(first); <ide> expect(controller.getParsed(9)).toBe(undefined); <ide> describe('Chart.DatasetController', function() { <ide> data.shift(); <ide> data.shift(); <ide> data.shift(); <add> chart.update(); <ide> expect(meta.data.length).toBe(6); <ide> expect(controller.getParsed(5)).toBe(last); <ide> <ide> first = controller.getParsed(0); <ide> last = controller.getParsed(5); <ide> data.splice(1, 4, {x: 10, y: 10}, {x: 11, y: 11}); <add> chart.update(); <ide> expect(meta.data.length).toBe(4); <ide> expect(controller.getParsed(0)).toBe(first); <ide> expect(controller.getParsed(3)).toBe(last); <ide> expect(controller.getParsed(1)).toEqual({x: 10, y: 10}); <ide> <ide> data.unshift({x: 12, y: 12}, {x: 13, y: 13}, {x: 14, y: 14}, {x: 15, y: 15}); <ide> data.unshift({x: 16, y: 16}, {x: 17, y: 17}); <add> chart.update(); <ide> expect(meta.data.length).toBe(10); <ide> expect(controller.getParsed(6)).toBe(first); <ide> expect(controller.getParsed(9)).toBe(last); <ide> describe('Chart.DatasetController', function() { <ide> expect(meta._parsed.map(p => p.y)).toEqual(data1); <ide> <ide> data1.push(9); <add> chart.update(); <ide> expect(meta.data.length).toBe(4); <ide> <ide> chart.data.datasets[0].data = data0;
2
Python
Python
fix typo in doc string
25f9d8cb92d5624409f2f2640ac637aedd7ebb25
<ide><path>numpy/core/numeric.py <ide> def nans(shape, dtype=None, order='C'): <ide> """ <ide> Return a new array of given shape and type, filled with nans. <ide> <del> Note that only floating point numbers can represent non-numers as defined <add> Note that only floating point numbers can represent non-numbers as defined <ide> in IEEE 754-1985. <ide> <ide> Please refer to the documentation for `zeros` for further details. <ide> def nans_like(a, dtype=None, order='K', subok=True): <ide> """ <ide> Return an array of nans with the same shape and type as a given array. <ide> <del> Note that only floating point numbers can represent non-numers as defined <add> Note that only floating point numbers can represent non-numbers as defined <ide> in IEEE 754-1985. <ide> <ide> With default parameters, is equivalent to ``a.copy().fill(np.nan)``. <ide> def infs(shape, dtype=None, order='C'): <ide> """ <ide> Return a new array of given shape and type, filled with infs. <ide> <del> Note that only floating point numbers can represent non-numers as defined <add> Note that only floating point numbers can represent non-numbers as defined <ide> in IEEE 754-1985. <ide> <ide> Please refer to the documentation for `zeros` for further details. <ide> def infs_like(a, dtype=None, order='K', subok=True): <ide> """ <ide> Return an array of infs with the same shape and type as a given array. <ide> <del> Note that only floating point numbers can represent non-numers as defined <add> Note that only floating point numbers can represent non-numbers as defined <ide> in IEEE 754-1985. <ide> <ide> With default parameters, is equivalent to ``a.copy().fill(np.inf)``.
1
PHP
PHP
update php cs
05f4ab9568145b6c6cb3b773c3ad00d5e20c65a4
<ide><path>src/ORM/Rule/ExistsIn.php <ide> class ExistsIn { <ide> */ <ide> protected $_fields; <ide> <add>/** <add> * The repository where the field will be looked for <add> * <add> * @var array <add> */ <add> protected $_repository; <add> <ide> /** <ide> * Constructor. <ide> * <ide> public function __construct($fields, $repository) { <ide> * @param \Cake\Datasource\EntityInterface $entity The entity from where to extract the fields <ide> * @param array $options Options passed to the check, <ide> * where the `repository` key is required. <add> * @return bool <ide> */ <ide> public function __invoke(EntityInterface $entity, array $options) { <ide> if (is_string($this->_repository)) { <ide><path>src/ORM/Rule/IsUnique.php <ide> public function __construct(array $fields) { <ide> * @param \Cake\Datasource\EntityInterface $entity The entity from where to extract the fields <ide> * @param array $options Options passed to the check, <ide> * where the `repository` key is required. <add> * @return bool <ide> */ <ide> public function __invoke(EntityInterface $entity, array $options) { <ide> $conditions = $entity->extract($this->_fields); <ide><path>src/ORM/RulesChecker.php <ide> namespace Cake\ORM; <ide> <ide> use Cake\Datasource\EntityInterface; <del>use Cake\ORM\Rule\IsUnique; <ide> use Cake\ORM\Rule\ExistsIn; <add>use Cake\ORM\Rule\IsUnique; <ide> <ide> /** <ide> * Contains logic for storing and checking rules on entities <ide> public function isUnique(array $fields, $message = 'This value is already in use <ide> * $rules->add($rules->existsIn('site_id', new SitesTable(), 'Invalid Site')); <ide> * }}} <ide> * <del> * @param string|array $fields The field or list of fields to check for existence by <add> * @param string|array $field The field or list of fields to check for existence by <ide> * primary key lookup in the other table. <add> * @param object|string $table The table name where the fields existence will be checked. <ide> * @param string $message The error message to show in case the rule does not pass. <ide> * @return callable <ide> */ <ide> protected function _addError($rule, $options) { <ide> if ($pass || empty($options['errorField'])) { <ide> return $pass; <ide> } <del> <add> <ide> $message = isset($options['message']) ? $options['message'] : 'invalid'; <ide> $entity->errors($options['errorField'], (array)$message); <ide> return $pass; <ide><path>src/ORM/Table.php <ide> class Table implements RepositoryInterface, EventListenerInterface { <ide> */ <ide> protected $_validators = []; <ide> <del> <ide> /** <ide> * The domain rules to be applied to entities saved by this table <ide> * <ide> public function checkRules(EntityInterface $entity) { <ide> if ($event->isStopped()) { <ide> return $event->result; <ide> } <del> <add> <ide> $result = $entity->isNew() ? $rules->checkCreate($entity) : $rules->checkUpdate($entity); <ide> $event = $this->dispatchEvent('Model.afterRules', compact('entity', 'rules', 'result')); <ide> <ide> public function checkRules(EntityInterface $entity) { <ide> * test an entity for validity on rules that may involve complex logic or data that <ide> * needs to be fetched from the database or other sources. <ide> * <del> * @param \Cake\Datasource\EntityInterface $entity The entity to check for validity. <ide> * @return \Cake\ORM\RulesChecker <ide> */ <ide> public function rulesChecker() {
4
PHP
PHP
update usage of deprecated methods
95f37b22141daade9cb25f6bb2b74592ce311944
<ide><path>src/TestSuite/TestEmailTransport.php <ide> <ide> use Cake\Mailer\AbstractTransport; <ide> use Cake\Mailer\Email; <add>use Cake\Mailer\TransportFactory; <ide> <ide> /** <ide> * TestEmailTransport <ide> public function send(Email $email) <ide> */ <ide> public static function replaceAllTransports() <ide> { <del> $configuredTransports = Email::configuredTransport(); <add> $configuredTransports = TransportFactory::configured(); <ide> <ide> foreach ($configuredTransports as $configuredTransport) { <del> $config = Email::getConfigTransport($configuredTransport); <add> $config = TransportFactory::getConfig($configuredTransport); <ide> $config['className'] = self::class; <del> Email::dropTransport($configuredTransport); <del> Email::setConfigTransport($configuredTransport, $config); <add> TransportFactory::drop($configuredTransport); <add> TransportFactory::setConfig($configuredTransport, $config); <ide> } <ide> } <ide> <ide><path>tests/TestCase/TestSuite/EmailAssertTraitTest.php <ide> namespace Cake\Test\TestCase\TestSuite; <ide> <ide> use Cake\Mailer\Email; <add>use Cake\Mailer\TransportFactory; <ide> use Cake\Mailer\Transport\DebugTransport; <ide> use Cake\TestSuite\EmailAssertTrait; <ide> use Cake\TestSuite\TestCase; <ide> class EmailAssertTraitTest extends TestCase <ide> public function setUp() <ide> { <ide> parent::setUp(); <del> Email::setConfigTransport('debug', ['className' => DebugTransport::class]); <add> TransportFactory::setConfig('debug', ['className' => DebugTransport::class]); <ide> } <ide> <ide> public function tearDown() <ide> { <ide> parent::tearDown(); <del> Email::dropTransport('debug'); <add> TransportFactory::drop('debug'); <ide> } <ide> <ide> public function testFunctional() <ide><path>tests/TestCase/TestSuite/EmailTraitTest.php <ide> namespace Cake\Test\TestCase\TestSuite; <ide> <ide> use Cake\Mailer\Email; <add>use Cake\Mailer\TransportFactory; <ide> use Cake\TestSuite\EmailTrait; <ide> use Cake\TestSuite\TestCase; <ide> use Cake\TestSuite\TestEmailTransport; <ide> public function setUp() <ide> 'transport' => 'test_tools', <ide> 'from' => 'alternate@example.com', <ide> ]); <del> Email::setConfigTransport('test_tools', [ <add> TransportFactory::setConfig('test_tools', [ <ide> 'className' => TestEmailTransport::class <ide> ]); <ide> <ide> public function tearDown() <ide> <ide> Email::drop('default'); <ide> Email::drop('alternate'); <del> Email::dropTransport('test_tools'); <add> TransportFactory::drop('test_tools'); <ide> <ide> TestEmailTransport::clearEmails(); <ide> } <ide><path>tests/TestCase/TestSuite/TestEmailTransportTest.php <ide> namespace Cake\Test\TestCase\TestSuite; <ide> <ide> use Cake\Mailer\Email; <add>use Cake\Mailer\TransportFactory; <ide> use Cake\Network\Email\DebugTransport; <ide> use Cake\TestSuite\TestCase; <ide> use Cake\TestSuite\TestEmailTransport; <ide> public function setUp() <ide> <ide> Email::drop('default'); <ide> Email::drop('alternate'); <del> Email::dropTransport('transport_default'); <del> Email::dropTransport('transport_alternate'); <add> TransportFactory::drop('transport_default'); <add> TransportFactory::drop('transport_alternate'); <ide> <del> Email::setConfigTransport('transport_default', [ <add> TransportFactory::setConfig('transport_default', [ <ide> 'className' => DebugTransport::class <ide> ]); <del> Email::setConfigTransport('transport_alternate', [ <add> TransportFactory::setConfig('transport_alternate', [ <ide> 'className' => DebugTransport::class <ide> ]); <ide> <ide> public function tearDown() <ide> <ide> Email::drop('default'); <ide> Email::drop('alternate'); <del> Email::dropTransport('transport_default'); <del> Email::dropTransport('transport_alternate'); <add> TransportFactory::drop('transport_default'); <add> TransportFactory::drop('transport_alternate'); <ide> } <ide> <ide> /** <ide> public function testReplaceAllTransports() <ide> { <ide> TestEmailTransport::replaceAllTransports(); <ide> <del> $config = Email::getConfigTransport('transport_default'); <add> $config = TransportFactory::getConfig('transport_default'); <ide> $this->assertSame(TestEmailTransport::class, $config['className']); <ide> <del> $config = Email::getConfigTransport('transport_alternate'); <add> $config = TransportFactory::getConfig('transport_alternate'); <ide> $this->assertSame(TestEmailTransport::class, $config['className']); <ide> } <ide>
4
Text
Text
move configuration to the right section
6e2e8c0d0f12b707165f3991218fc3cbd7bc37ae
<ide><path>guides/source/configuring.md <ide> The default value depends on the `config.load_defaults` target version: <ide> | (original) | `true` | <ide> | 7.1 | `false` | <ide> <add>#### `config.active_record.yaml_column_permitted_classes` <add> <add>Defaults to `[]`. Allows applications to include additional permitted classes to `safe_load()` on the `ActiveStorage::Coders::YamlColumn`. <add> <add>#### `config.active_record.use_yaml_unsafe_load` <add> <add>Defaults to `false`. Allows applications to opt into using `unsafe_load` on the `ActiveStorage::Coders::YamlColumn`. <add> <ide> #### `ActiveRecord::ConnectionAdapters::Mysql2Adapter.emulate_booleans` <ide> <ide> Controls whether the Active Record MySQL adapter will consider all `tinyint(1)` columns as booleans. Defaults to `true`. <ide> has no effect if Sprockets is not used. The default value is `true`. <ide> <ide> `config.active_storage` provides the following configuration options: <ide> <del>#### `config.active_record.yaml_column_permitted_classes` <del> <del>Defaults to `[]`. Allows applications to include additional permitted classes to `safe_load()` on the `ActiveStorage::Coders::YamlColumn`. <del> <del>#### `config.active_storage.use_yaml_unsafe_load` <del> <del>Defaults to `false`. Allows applications to opt into using `unsafe_load` on the `ActiveStorage::Coders::YamlColumn`. <del> <ide> #### `config.active_storage.variant_processor` <ide> <ide> Accepts a symbol `:mini_magick` or `:vips`, specifying whether variant transformations and blob analysis will be performed with MiniMagick or ruby-vips.
1
Text
Text
add linter emoji
062072ad8737ce9c32d66628a9a0ca25273bd77e
<ide><path>CONTRIBUTING.md <ide> For more information on how to work with Atom's official packages, see <ide> * :lock: `:lock:` when dealing with security <ide> * :arrow_up: `:arrow_up:` when upgrading dependencies <ide> * :arrow_down: `:arrow_down:` when downgrading dependencies <add> * :shirt: `:shirt:` when removing linter warnings <ide> <ide> ## CoffeeScript Styleguide <ide>
1
Javascript
Javascript
fix coding style #2
b2dd2418e298020903fd30c78227aa5ee21abeea
<ide><path>src/math/Quaternion.js <ide> THREE.Quaternion.prototype = { <ide> <ide> slerp: function ( qb, t ) { <ide> <del> if (t === 0) return this; <add> if ( t === 0 ) return this; <ide> <del> if (t === 1) return this.copy( qb ); <add> if ( t === 1 ) return this.copy( qb ); <ide> <ide> var x = this._x, y = this._y, z = this._z, w = this._w; <ide>
1
Javascript
Javascript
put this constant with the others
fcf8581255b50afe9245da468ed1a38d6984c084
<ide><path>src/git-repository-async.js <ide> const modifiedStatusFlags = Git.Status.STATUS.WT_MODIFIED | Git.Status.STATUS.IN <ide> const newStatusFlags = Git.Status.STATUS.WT_NEW | Git.Status.STATUS.INDEX_NEW <ide> const deletedStatusFlags = Git.Status.STATUS.WT_DELETED | Git.Status.STATUS.INDEX_DELETED <ide> const indexStatusFlags = Git.Status.STATUS.INDEX_NEW | Git.Status.STATUS.INDEX_MODIFIED | Git.Status.STATUS.INDEX_DELETED | Git.Status.STATUS.INDEX_RENAMED | Git.Status.STATUS.INDEX_TYPECHANGE <add>const submoduleMode = 57344 // TODO compose this from libgit2 constants <ide> <ide> // Just using this for _.isEqual and _.object, we should impl our own here <ide> import _ from 'underscore-plus' <ide> export default class GitRepositoryAsync { <ide> // TODO: This'll probably be wrong if the submodule doesn't exist in the <ide> // index yet? Is that a thing? <ide> const entry = index.getByPath(_path) <del> const submoduleMode = 57344 // TODO compose this from libgit2 constants <ide> return entry.mode === submoduleMode <ide> }) <ide> }
1
Python
Python
add a missing word to docs
92a23974b5e7d167c12dfdbb4e5129e352e21923
<ide><path>airflow/configuration.py <ide> def run_command(command): <ide> email_backend = airflow.utils.email.send_email_smtp <ide> <ide> [smtp] <del># If you want airflow to send emails on retries, failure, and you want to <add># If you want airflow to send emails on retries, failure, and you want to use <ide> # the airflow.utils.email.send_email_smtp function, you have to configure an smtp <ide> # server here <ide> smtp_host = localhost
1
Python
Python
add xla to transformer
269581dc231192d2a19f5fa54821b3bc6a104292
<ide><path>official/resnet/imagenet_main.py <ide> def imagenet_model_fn(features, labels, mode, params): <ide> ) <ide> <ide> <del>def define_imagenet_flags(dynamic_loss_scale=False, fp16_implementation=False): <add>def define_imagenet_flags(dynamic_loss_scale=False, <add> fp16_implementation=False, <add> enable_xla=False): <ide> resnet_run_loop.define_resnet_flags( <ide> resnet_size_choices=['18', '34', '50', '101', '152', '200'], <ide> dynamic_loss_scale=dynamic_loss_scale, <del> fp16_implementation=fp16_implementation) <add> fp16_implementation=fp16_implementation, <add> enable_xla=enable_xla) <ide> flags.adopt_module_key_flags(resnet_run_loop) <ide> flags_core.set_defaults(train_epochs=90) <ide> <ide><path>official/resnet/keras/keras_cifar_main.py <ide> from official.utils.flags import core as flags_core <ide> from official.utils.logs import logger <ide> from official.utils.misc import distribution_utils <add>from official.utils.misc import keras_utils <ide> <ide> <ide> LR_SCHEDULE = [ # (multiplier, epoch to start) tuples <ide> def run(flags_obj): <ide> Returns: <ide> Dictionary of training and eval stats. <ide> """ <del> # TODO(tobyboyd): Remove eager flag when tf 1.0 testing ends. <del> # Eager is default in tf 2.0 and should not be toggled <del> if keras_common.is_v2_0(): <del> keras_common.set_config_v2() <del> else: <del> config = keras_common.get_config_proto_v1() <del> if flags_obj.enable_eager: <del> tf.compat.v1.enable_eager_execution(config=config) <del> else: <del> sess = tf.Session(config=config) <del> tf.keras.backend.set_session(sess) <add> keras_utils.set_session_config(enable_eager=flags_obj.enable_eager) <ide> <ide> dtype = flags_core.get_tf_dtype(flags_obj) <ide> if dtype == 'fp16': <ide><path>official/resnet/keras/keras_common.py <ide> # limitations under the License. <ide> # ============================================================================== <ide> """Common util functions and classes used by both keras cifar and imagenet.""" <del> <ide> from __future__ import absolute_import <ide> from __future__ import division <ide> from __future__ import print_function <ide> <ide> from official.utils.misc import keras_utils <ide> # pylint: disable=ungrouped-imports <del>from tensorflow.core.protobuf import rewriter_config_pb2 <ide> from tensorflow.python.keras.optimizer_v2 import (gradient_descent as <ide> gradient_descent_v2) <ide> <ide> def get_config(self): <ide> } <ide> <ide> <del>def get_config_proto_v1(): <del> """Return config proto according to flag settings, or None to use default.""" <del> config = None <del> if FLAGS.enable_xla: <del> config = tf.compat.v1.ConfigProto() <del> config.graph_options.optimizer_options.global_jit_level = ( <del> tf.OptimizerOptions.ON_2) <del> # Disable PinToHostOptimizer in grappler when enabling XLA because it causes <del> # OOM and performance regression. <del> config.graph_options.rewrite_options.pin_to_host_optimization = ( <del> rewriter_config_pb2.RewriterConfig.OFF) <del> # TODO(b/76028325): Remove when generic layout optimizer will be ready. <del> if not FLAGS.enable_grappler_layout_optimizer: <del> if config is None: <del> config = tf.compat.v1.ConfigProto() <del> # Disable LayoutOptimizer in grappler, because it might de-optimize fp16 <del> # graphs, and force NCHW data format in all convolutions and batch <del> # normalizations. <del> config.graph_options.rewrite_options.layout_optimizer = ( <del> rewriter_config_pb2.RewriterConfig.OFF) <del> return config <del> <del> <del>def set_config_v2(): <del> """Config eager context according to flag values using TF 2.0 API.""" <del> if FLAGS.enable_xla: <del> tf.config.optimizer.set_jit(True) <del> # Disable PinToHostOptimizer in grappler when enabling XLA because it <del> # causes OOM and performance regression. <del> tf.config.optimizer.set_experimental_options( <del> {'pin_to_host_optimization': False} <del> ) <del> # TODO(b/76028325): Remove when generic layout optimizer will be ready. <del> if not FLAGS.enable_grappler_layout_optimizer: <del> # Disable LayoutOptimizer in grappler, because it might de-optimize fp16 <del> # graphs, and force NCHW data format in all convolutions and batch <del> # normalizations. <del> tf.config.optimizer.set_experimental_options( <del> {'layout_optimizer': False} <del> ) <del> <del> <ide> def set_gpu_thread_mode_and_count(flags_obj): <ide> """Set GPU thread mode and count, and adjust dataset threads count.""" <ide> cpu_count = multiprocessing.cpu_count() <ide> def define_keras_flags(): <ide> help='Report metrics during training and evaluation.') <ide> flags.DEFINE_boolean(name='use_tensor_lr', default=False, <ide> help='Use learning rate tensor instead of a callback.') <del> flags.DEFINE_boolean( <del> name='enable_xla', default=False, <del> help='Whether to enable XLA auto jit compilation. This is still an ' <del> 'experimental feature, and is not yet effective with TF 2.0.') <ide> flags.DEFINE_boolean( <ide> name='enable_tensorboard', default=False, <ide> help='Whether to enable Tensorboard callback.') <ide> def input_fn(is_training, data_dir, batch_size, *args, **kwargs): <ide> return input_fn <ide> <ide> <del>def is_v2_0(): <del> """Returns true if using tf 2.0.""" <del> if hasattr(tf, 'contrib'): <del> return False <del> else: <del> return True <del> <del> <ide> def data_delay_prefetch(): <ide> """Use unstable code for perf tuning purposes.""" <ide> if not FLAGS.use_synthetic_data: <ide> _monkey_patch_org_create_device_dataset() <ide> <ide> <ide> def set_cudnn_batchnorm_mode(): <del> """Set CuDNN batchnorm mode for better performance. Note that the spatial <del> persistent mode may lead to accuracy losses for certain models.""" <add> """Set CuDNN batchnorm mode for better performance. <add> <add> Note: Spatial Persistent mode may lead to accuracy losses for certain <add> models. <add> """ <ide> if FLAGS.batchnorm_spatial_persistent: <ide> os.environ['TF_USE_CUDNN_BATCHNORM_SPATIAL_PERSISTENT'] = '1' <ide> else: <ide><path>official/resnet/keras/keras_imagenet_benchmark.py <ide> from absl import flags <ide> import tensorflow as tf # pylint: disable=g-bad-import-order <ide> <del>from official.resnet import imagenet_main <ide> from official.resnet.keras import keras_benchmark <del>from official.resnet.keras import keras_common <ide> from official.resnet.keras import keras_imagenet_main <ide> <ide> MIN_TOP_1_ACCURACY = 0.76 <ide> def __init__(self, output_dir=None, root_data_dir=None, **kwargs): <ide> named arguments before updating the constructor. <ide> """ <ide> <del> flag_methods = [ <del> keras_common.define_keras_flags, <del> lambda: imagenet_main.define_imagenet_flags(dynamic_loss_scale=True) <del> ] <add> flag_methods = [keras_imagenet_main.define_imagenet_keras_flags] <ide> <ide> self.data_dir = os.path.join(root_data_dir, 'imagenet') <ide> super(Resnet50KerasAccuracy, self).__init__( <ide> class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark): <ide> """Resnet50 benchmarks.""" <ide> <ide> def __init__(self, output_dir=None, default_flags=None): <del> flag_methods = [ <del> keras_common.define_keras_flags, <del> lambda: imagenet_main.define_imagenet_flags(dynamic_loss_scale=True) <del> ] <add> flag_methods = [keras_imagenet_main.define_imagenet_keras_flags] <ide> <ide> super(Resnet50KerasBenchmarkBase, self).__init__( <ide> output_dir=output_dir, <ide> class TrivialKerasBenchmarkReal(keras_benchmark.KerasBenchmark): <ide> """Trivial model with real data benchmark tests.""" <ide> <ide> def __init__(self, output_dir=None, root_data_dir=None, **kwargs): <del> flag_methods = [ <del> keras_common.define_keras_flags, <del> lambda: imagenet_main.define_imagenet_flags(dynamic_loss_scale=True) <del> ] <add> flag_methods = [keras_imagenet_main.define_imagenet_keras_flags] <add> <ide> def_flags = {} <ide> def_flags['use_trivial_model'] = True <ide> def_flags['skip_eval'] = True <ide><path>official/resnet/keras/keras_imagenet_main.py <ide> from official.utils.flags import core as flags_core <ide> from official.utils.logs import logger <ide> from official.utils.misc import distribution_utils <add>from official.utils.misc import keras_utils <ide> from official.utils.misc import model_helpers <ide> <ide> <ide> def run(flags_obj): <ide> Returns: <ide> Dictionary of training and eval stats. <ide> """ <del> # TODO(tobyboyd): Remove eager flag when tf 1.0 testing ends. <del> # Eager is default in tf 2.0 and should not be toggled <del> if keras_common.is_v2_0(): <del> keras_common.set_config_v2() <del> else: <del> config = keras_common.get_config_proto_v1() <del> if flags_obj.enable_eager: <del> tf.compat.v1.enable_eager_execution(config=config) <del> else: <del> sess = tf.Session(config=config) <del> tf.keras.backend.set_session(sess) <add> keras_utils.set_session_config( <add> enable_eager=flags_obj.enable_eager, <add> enable_xla=flags_obj.enable_xla, <add> enable_grappler_layout_optimizer= <add> flags_obj.enable_grappler_layout_optimizer) <ide> <ide> # Execute flag override logic for better model performance <ide> if flags_obj.tf_gpu_thread_mode: <ide> def run(flags_obj): <ide> return stats <ide> <ide> <add>def define_imagenet_keras_flags(): <add> imagenet_main.define_imagenet_flags(dynamic_loss_scale=True, enable_xla=True) <add> keras_common.define_keras_flags() <add> <add> <ide> def main(_): <ide> model_helpers.apply_clean(flags.FLAGS) <ide> with logger.benchmark_context(flags.FLAGS): <ide> def main(_): <ide> <ide> if __name__ == '__main__': <ide> tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.INFO) <del> imagenet_main.define_imagenet_flags(dynamic_loss_scale=True) <del> keras_common.define_keras_flags() <add> define_imagenet_keras_flags() <ide> absl_app.run(main) <ide><path>official/resnet/resnet_run_loop.py <ide> def exclude_batch_norm(name): <ide> <ide> fp16_implementation = getattr(flags.FLAGS, 'fp16_implementation', None) <ide> if fp16_implementation == 'graph_rewrite': <del> optimizer = tf.compat.v1.train.experimental.enable_mixed_precision_graph_rewrite( <del> optimizer, loss_scale=loss_scale) <add> optimizer = ( <add> tf.compat.v1.train.experimental.enable_mixed_precision_graph_rewrite( <add> optimizer, loss_scale=loss_scale)) <ide> <ide> def _dense_grad_filter(gvs): <ide> """Only apply gradient updates to the final layer. <ide> def input_fn_eval(): <ide> <ide> <ide> def define_resnet_flags(resnet_size_choices=None, dynamic_loss_scale=False, <del> fp16_implementation=False): <add> fp16_implementation=False, enable_xla=False): <ide> """Add flags and validators for ResNet.""" <ide> flags_core.define_base() <ide> flags_core.define_performance(num_parallel_calls=False, <ide> def define_resnet_flags(resnet_size_choices=None, dynamic_loss_scale=False, <ide> dynamic_loss_scale=dynamic_loss_scale, <ide> fp16_implementation=fp16_implementation, <ide> loss_scale=True, <del> tf_data_experimental_slack=True) <add> tf_data_experimental_slack=True, <add> enable_xla=enable_xla) <ide> flags_core.define_image() <ide> flags_core.define_benchmark() <ide> flags.adopt_module_key_flags(flags_core) <ide><path>official/transformer/transformer_estimator_benchmark.py <ide> import tensorflow as tf # pylint: disable=g-bad-import-order <ide> <ide> from official.transformer import transformer_main as transformer_main <add>from official.utils.flags import core as flags_core <ide> from official.utils.logs import hooks <ide> <ide> TRANSFORMER_EN2DE_DATA_DIR_NAME = 'wmt32k-en2de-official' <ide> def _report_benchmark(self, <ide> exp_per_sec = sum(exp_per_second_list) / (len(exp_per_second_list)) <ide> metrics.append({'name': 'exp_per_second', <ide> 'value': exp_per_sec}) <del> self.report_benchmark( <del> iters=eval_results['global_step'], <del> wall_time=wall_time_sec, <del> metrics=metrics) <add> <add> flags_str = flags_core.get_nondefault_flags_as_str() <add> self.report_benchmark(iters=eval_results['global_step'], <add> wall_time=wall_time_sec, <add> metrics=metrics, <add> extras={'flags': flags_str}) <ide> <ide> <ide> class TransformerBigEstimatorAccuracy(EstimatorBenchmark): <ide><path>official/transformer/v2/misc.py <ide> def define_transformer_flags(): <ide> synthetic_data=True, <ide> max_train_steps=False, <ide> dtype=False, <del> all_reduce_alg=True <add> all_reduce_alg=True, <add> enable_xla=True <ide> ) <add> <add> # Additional performance flags <add> # TODO(b/76028325): Remove when generic layout optimizer is ready. <add> flags.DEFINE_boolean( <add> name='enable_grappler_layout_optimizer', <add> default=True, <add> help='Enable Grappler layout optimizer. Currently Grappler can ' <add> 'de-optimize fp16 graphs by forcing NCHW layout for all ' <add> 'convolutions and batch normalizations, and this flag allows to ' <add> 'disable it.' <add> ) <add> <ide> flags_core.define_benchmark() <ide> flags_core.define_device(tpu=True) <ide> <ide><path>official/transformer/v2/transformer_main.py <ide> from official.transformer.v2 import translate <ide> from official.utils.flags import core as flags_core <ide> from official.utils.logs import logger <add>from official.utils.misc import keras_utils <ide> from official.utils.misc import distribution_utils <ide> <ide> <ide> def __init__(self, flags_obj): <ide> def train(self): <ide> """Trains the model.""" <ide> params, flags_obj, is_train = self.params, self.flags_obj, True <add> # Sets config options. <add> keras_utils.set_session_config( <add> enable_xla=flags_obj.enable_xla, <add> enable_grappler_layout_optimizer= <add> flags_obj.enable_grappler_layout_optimizer) <add> <ide> _ensure_dir(flags_obj.model_dir) <ide> if self.distribution_strategy: <ide> with self.distribution_strategy.scope(): <ide><path>official/utils/flags/_performance.py <ide> def define_performance(num_parallel_calls=True, inter_op=True, intra_op=True, <ide> datasets_num_parallel_batches=False, <ide> dynamic_loss_scale=False, fp16_implementation=False, <ide> loss_scale=False, <del> tf_data_experimental_slack=False): <add> tf_data_experimental_slack=False, enable_xla=False): <ide> """Register flags for specifying performance tuning arguments. <ide> <ide> Args: <ide> def define_performance(num_parallel_calls=True, inter_op=True, intra_op=True, <ide> training. Can only be turned on if dtype is also True. <ide> tf_data_experimental_slack: Determines whether to enable tf.data's <ide> `experimental_slack` option. <add> enable_xla: Determines if XLA (auto clustering) is turned on. <ide> <ide> Returns: <ide> A list of flags for core.py to marks as key flags. <ide> def _check_fp16_implementation(flags_dict): <ide> "Whether to enable tf.data's `experimental_slack` option.") <ide> ) <ide> <add> if enable_xla: <add> flags.DEFINE_boolean( <add> name="enable_xla", default=False, <add> help="Whether to enable XLA auto jit compilation") <add> <ide> return key_flags <ide><path>official/utils/misc/keras_utils.py <ide> import time <ide> <ide> import tensorflow as tf <add>from tensorflow.core.protobuf import rewriter_config_pb2 <ide> from tensorflow.python.eager import profiler <ide> <ide> <ide> def on_batch_end(self, batch, logs=None): <ide> tf.compat.v1.logging.info( <ide> 'Profiler saved profiles for steps between %s and %s to %s', <ide> self.start_step, self.stop_step, self.log_dir) <add> <add> <add>def set_session_config(enable_eager=False, <add> enable_xla=False, <add> enable_grappler_layout_optimizer=True): <add> """Sets the session config.""" <add> if is_v2_0(): <add> set_config_v2( <add> enable_xla=enable_xla, <add> enable_grappler_layout_optimizer=enable_grappler_layout_optimizer) <add> else: <add> config = get_config_proto_v1( <add> enable_xla=enable_xla, <add> enable_grappler_layout_optimizer=enable_grappler_layout_optimizer) <add> if enable_eager: <add> tf.compat.v1.enable_eager_execution(config=config) <add> else: <add> sess = tf.Session(config=config) <add> tf.keras.backend.set_session(sess) <add> <add> <add>def get_config_proto_v1(enable_xla=False, <add> enable_grappler_layout_optimizer=True): <add> """Return config proto according to flag settings, or None to use default.""" <add> config = None <add> if enable_xla: <add> config = tf.compat.v1.ConfigProto() <add> config.graph_options.optimizer_options.global_jit_level = ( <add> tf.OptimizerOptions.ON_2) <add> # Disable PinToHostOptimizer in grappler when enabling XLA because it causes <add> # OOM and performance regression. <add> config.graph_options.rewrite_options.pin_to_host_optimization = ( <add> rewriter_config_pb2.RewriterConfig.OFF) <add> # TODO(b/76028325): Remove when generic layout optimizer will be ready. <add> if not enable_grappler_layout_optimizer: <add> if config is None: <add> config = tf.compat.v1.ConfigProto() <add> # Disable LayoutOptimizer in grappler, because it might de-optimize fp16 <add> # graphs, and force NCHW data format in all convolutions and batch <add> # normalizations. <add> config.graph_options.rewrite_options.layout_optimizer = ( <add> rewriter_config_pb2.RewriterConfig.OFF) <add> return config <add> <add> <add>def set_config_v2(enable_xla=False, <add> enable_grappler_layout_optimizer=False): <add> """Config eager context according to flag values using TF 2.0 API.""" <add> if enable_xla: <add> tf.config.optimizer.set_jit(True) <add> # Disable PinToHostOptimizer in grappler when enabling XLA because it <add> # causes OOM and performance regression. <add> tf.config.optimizer.set_experimental_options( <add> {'pin_to_host_optimization': False} <add> ) <add> # TODO(b/76028325): Remove when generic layout optimizer will be ready. <add> if not enable_grappler_layout_optimizer: <add> # Disable LayoutOptimizer in grappler, because it might de-optimize fp16 <add> # graphs, and force NCHW data format in all convolutions and batch <add> # normalizations. <add> tf.config.optimizer.set_experimental_options( <add> {'layout_optimizer': False} <add> ) <add> <add>def is_v2_0(): <add> """Returns true if using tf 2.0.""" <add> if hasattr(tf, 'contrib'): <add> return False <add> else: <add> return True
11
Ruby
Ruby
create with_env helper for tests
023d14ecbbc48dcd707b404b8229dd87af5f39a3
<ide><path>activesupport/test/caching_test.rb <ide> def test_expand_cache_key <ide> end <ide> <ide> def test_expand_cache_key_with_rails_cache_id <del> begin <del> ENV['RAILS_CACHE_ID'] = 'c99' <add> with_env('RAILS_CACHE_ID' => 'c99') do <ide> assert_equal 'c99/foo', ActiveSupport::Cache.expand_cache_key(:foo) <ide> assert_equal 'c99/foo', ActiveSupport::Cache.expand_cache_key([:foo]) <ide> assert_equal 'c99/foo/bar', ActiveSupport::Cache.expand_cache_key([:foo, :bar]) <ide> assert_equal 'nm/c99/foo', ActiveSupport::Cache.expand_cache_key(:foo, :nm) <ide> assert_equal 'nm/c99/foo', ActiveSupport::Cache.expand_cache_key([:foo], :nm) <ide> assert_equal 'nm/c99/foo/bar', ActiveSupport::Cache.expand_cache_key([:foo, :bar], :nm) <del> ensure <del> ENV['RAILS_CACHE_ID'] = nil <ide> end <ide> end <ide> <ide> def test_expand_cache_key_with_rails_app_version <del> begin <del> ENV['RAILS_APP_VERSION'] = 'rails3' <add> with_env('RAILS_APP_VERSION' => 'rails3') do <ide> assert_equal 'rails3/foo', ActiveSupport::Cache.expand_cache_key(:foo) <del> ensure <del> ENV['RAILS_APP_VERSION'] = nil <ide> end <ide> end <ide> <ide> def test_expand_cache_key_rails_cache_id_should_win_over_rails_app_version <del> begin <del> ENV['RAILS_CACHE_ID'] = 'c99' <del> ENV['RAILS_APP_VERSION'] = 'rails3' <add> with_env('RAILS_CACHE_ID' => 'c99', 'RAILS_APP_VERSION' => 'rails3') do <ide> assert_equal 'c99/foo', ActiveSupport::Cache.expand_cache_key(:foo) <del> ensure <del> ENV['RAILS_CACHE_ID'] = nil <del> ENV['RAILS_APP_VERSION'] = nil <ide> end <ide> end <ide> <ide> def test_expand_cache_key_of_true <ide> def test_expand_cache_key_of_array_like_object <ide> assert_equal 'foo/bar/baz', ActiveSupport::Cache.expand_cache_key(%w{foo bar baz}.to_enum) <ide> end <add> <add> private <add> <add> def with_env(kv) <add> old_values = {} <add> kv.each { |key, value| old_values[key], ENV[key] = ENV[key], value } <add> yield <add> ensure <add> old_values.each { |key, value| ENV[key] = value} <add> end <ide> end <ide> <ide> class CacheStoreSettingTest < ActiveSupport::TestCase
1
Ruby
Ruby
use relation#except for reversing the order
006519d2c9f142837f3b43882bcd243caa7ccdb9
<ide><path>activerecord/lib/active_record/relation/query_methods.rb <ide> def lock(locks = true) <ide> end <ide> <ide> def reverse_order <del> relation = spawn <del> relation.instance_variable_set(:@orders, nil) <del> <ide> order_clause = arel.send(:order_clauses).join(', ') <add> relation = except(:order) <add> <ide> if order_clause.present? <ide> relation.order(reverse_sql_order(order_clause)) <ide> else
1
Javascript
Javascript
add tests for ember.isglobalpath
f41e667d5cf13b7284cb1cad6f44d568f35ef279
<ide><path>packages/ember-metal/tests/accessors/isGlobalPath_test.js <add>// ========================================================================== <add>// Project: Ember Runtime <add>// Copyright: ©2011 Strobe Inc. and contributors. <add>// License: Licensed under MIT license (see license.js) <add>// ========================================================================== <add> <add>module('Ember.isGlobalPath'); <add> <add>test("global path's are recognized", function(){ <add> ok( Ember.isGlobalPath('App.myProperty') ); <add> ok( Ember.isGlobalPath('App.myProperty.subProperty') ); <add>}); <add> <add>test("if there is a 'this' in the path, it's not a global path", function(){ <add> ok( !Ember.isGlobalPath('this.myProperty') ); <add> ok( !Ember.isGlobalPath('this') ); <add>}); <add> <add>test("if the path starts with a lowercase character, it is not a global path", function(){ <add> ok( !Ember.isGlobalPath('myObj') ); <add> ok( !Ember.isGlobalPath('myObj.SecondProperty') ); <add>}); <ide>\ No newline at end of file
1
Javascript
Javascript
use xcpretty for ios build output if installed
cb8a116d05289048a5da098ae98c86c0b28e66f1
<ide><path>local-cli/runIOS/runIOS.js <ide> const findMatchingSimulator = require('./findMatchingSimulator'); <ide> const getBuildPath = function(configuration = 'Debug', appName, isDevice) { <ide> return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`; <ide> }; <add>const xcprettyAvailable = function() { <add> try { <add> child_process.execSync('xcpretty --version', { <add> stdio: [ 0, 'pipe', 'ignore', ] <add> }); <add> } catch (error) { <add> return false; <add> } <add> return true; <add>}; <ide> <ide> function runIOS(argv, config, args) { <ide> if (!fs.existsSync(args.projectPath)) { <ide> function runIOS(argv, config, args) { <ide> if (args.device) { <ide> const selectedDevice = matchingDevice(devices, args.device); <ide> if (selectedDevice) { <del> return runOnDevice(selectedDevice, scheme, xcodeProject, args.configuration, args.packager); <add> return runOnDevice(selectedDevice, scheme, xcodeProject, args.configuration, args.packager, args.verbose); <ide> } else { <ide> if (devices && devices.length > 0) { <ide> console.log('Could not find device with the name: "' + args.device + '".'); <ide> function runIOS(argv, config, args) { <ide> function runOnDeviceByUdid(args, scheme, xcodeProject, devices) { <ide> const selectedDevice = matchingDeviceByUdid(devices, args.udid); <ide> if (selectedDevice) { <del> return runOnDevice(selectedDevice, scheme, xcodeProject, args.configuration, args.packager); <add> return runOnDevice(selectedDevice, scheme, xcodeProject, args.configuration, args.packager, args.verbose); <ide> } else { <ide> if (devices && devices.length > 0) { <ide> console.log('Could not find device with the udid: "' + args.udid + '".'); <ide> function runOnSimulator(xcodeProject, args, scheme) { <ide> // instruments always fail with 255 because it expects more arguments, <ide> // but we want it to only launch the simulator <ide> } <del> resolve(selectedSimulator.udid) <add> resolve(selectedSimulator.udid); <ide> }) <del> .then((udid) => buildProject(xcodeProject, udid, scheme, args.configuration, args.packager)) <add> .then((udid) => buildProject(xcodeProject, udid, scheme, args.configuration, args.packager, args.verbose)) <ide> .then((appName) => { <ide> if (!appName) { <ide> appName = scheme; <ide> function runOnSimulator(xcodeProject, args, scheme) { <ide> <ide> console.log(`Launching ${bundleID}`); <ide> child_process.spawnSync('xcrun', ['simctl', 'launch', 'booted', bundleID], {stdio: 'inherit'}); <del> }) <add> }); <ide> } <ide> <del>function runOnDevice(selectedDevice, scheme, xcodeProject, configuration, launchPackager) { <del> return buildProject(xcodeProject, selectedDevice.udid, scheme, configuration, launchPackager) <add>function runOnDevice(selectedDevice, scheme, xcodeProject, configuration, launchPackager, verbose) { <add> return buildProject(xcodeProject, selectedDevice.udid, scheme, configuration, launchPackager, verbose) <ide> .then((appName) => { <ide> if (!appName) { <ide> appName = scheme; <ide> function runOnDevice(selectedDevice, scheme, xcodeProject, configuration, launch <ide> }); <ide> } <ide> <del>function buildProject(xcodeProject, udid, scheme, configuration = 'Debug', launchPackager = false) { <add>function buildProject(xcodeProject, udid, scheme, configuration = 'Debug', launchPackager = false, verbose) { <ide> return new Promise((resolve,reject) => <ide> { <ide> var xcodebuildArgs = [ <ide> function buildProject(xcodeProject, udid, scheme, configuration = 'Debug', launc <ide> '-derivedDataPath', 'build', <ide> ]; <ide> console.log(`Building using "xcodebuild ${xcodebuildArgs.join(' ')}"`); <add> let xcpretty; <add> if (!verbose) { <add> xcpretty = xcprettyAvailable() && child_process.spawn('xcpretty', [], { stdio: ['pipe', process.stdout, process.stderr] }); <add> } <ide> const buildProcess = child_process.spawn('xcodebuild', xcodebuildArgs, getProcessOptions(launchPackager)); <del> let buildOutput = ""; <add> let buildOutput = ''; <ide> buildProcess.stdout.on('data', function(data) { <del> console.log(data.toString()); <ide> buildOutput += data.toString(); <add> if (xcpretty) { <add> xcpretty.stdin.write(data); <add> } else { <add> console.log(data.toString()); <add> } <ide> }); <ide> buildProcess.stderr.on('data', function(data) { <ide> console.error(data.toString()); <ide> }); <ide> buildProcess.on('close', function(code) { <add> if (xcpretty) { <add> xcpretty.stdin.end(); <add> } <ide> //FULL_PRODUCT_NAME is the actual file name of the app, which actually comes from the Product Name in the build config, which does not necessary match a scheme name, example output line: export FULL_PRODUCT_NAME="Super App Dev.app" <ide> let productNameMatch = /export FULL_PRODUCT_NAME="?(.+).app"?$/m.exec(buildOutput); <ide> if (productNameMatch && productNameMatch.length && productNameMatch.length > 1) { <ide> return resolve(productNameMatch[1]);//0 is the full match, 1 is the app name <ide> } <del> return buildProcess.error? reject(buildProcess.error) : resolve(); <add> return buildProcess.error ? reject(buildProcess.error) : resolve(); <ide> }); <ide> }); <ide> } <ide> <ide> function matchingDevice(devices, deviceName) { <ide> if (deviceName === true && devices.length === 1) <ide> { <del> console.log(`Using first available device ${devices[0].name} due to lack of name supplied.`) <add> console.log(`Using first available device ${devices[0].name} due to lack of name supplied.`); <ide> return devices[0]; <ide> } <ide> for (let i = devices.length - 1; i >= 0; i--) { <ide> module.exports = { <ide> }, { <ide> command: '--no-packager', <ide> description: 'Do not launch packager while building', <add> }, { <add> command: '--verbose', <add> description: 'Do not use xcpretty even if installed', <ide> }], <ide> };
1
Javascript
Javascript
add hashsalt option
ce76858334c47ec2ae08b6a9036e78fb31559333
<ide><path>lib/Compilation.js <ide> Compilation.prototype.createHash = function createHash() { <ide> var hashDigest = outputOptions.hashDigest; <ide> var hashDigestLength = outputOptions.hashDigestLength; <ide> var hash = require("crypto").createHash(hashFunction); <add> if(outputOptions.hashSalt) <add> hash.update(outputOptions.hashSalt); <ide> this.mainTemplate.updateHash(hash); <ide> this.chunkTemplate.updateHash(hash); <ide> this.moduleTemplate.updateHash(hash); <ide> Compilation.prototype.createHash = function createHash() { <ide> for(i = 0; i < chunks.length; i++) { <ide> chunk = chunks[i]; <ide> var chunkHash = require("crypto").createHash(hashFunction); <add> if(outputOptions.hashSalt) <add> hash.update(outputOptions.hashSalt); <ide> chunk.updateHash(chunkHash); <ide> if(chunk.entry) { <ide> this.mainTemplate.updateHashForChunk(chunkHash, chunk);
1
Javascript
Javascript
force localmoduledependency arity to 3
b7af625659195e35792edce544788d9ce8523742
<ide><path>lib/dependencies/AMDDefineDependencyParserPlugin.js <ide> class AMDDefineDependencyParserPlugin { <ide> )) <ide> ) { <ide> // eslint-disable-line no-cond-assign <del> dep = new LocalModuleDependency(localModule); <add> dep = new LocalModuleDependency(localModule, undefined, false); <ide> dep.loc = expr.loc; <ide> parser.state.current.addDependency(dep); <ide> } else { <ide> class AMDDefineDependencyParserPlugin { <ide> )) <ide> ) { <ide> // eslint-disable-line no-cond-assign <del> dep = new LocalModuleDependency(localModule, param.range); <add> dep = new LocalModuleDependency(localModule, param.range, false); <ide> } else { <ide> dep = this.newRequireItemDependency(param.string, param.range); <ide> } <ide><path>lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js <ide> class AMDRequireDependenciesBlockParserPlugin { <ide> )) <ide> ) { <ide> // eslint-disable-line no-cond-assign <del> dep = new LocalModuleDependency(localModule); <add> dep = new LocalModuleDependency(localModule, undefined, false); <ide> dep.loc = expr.loc; <ide> parser.state.current.addDependency(dep); <ide> } else { <ide> class AMDRequireDependenciesBlockParserPlugin { <ide> )) <ide> ) { <ide> // eslint-disable-line no-cond-assign <del> dep = new LocalModuleDependency(localModule, param.range); <add> dep = new LocalModuleDependency(localModule, param.range, false); <ide> } else { <ide> dep = this.newRequireItemDependency(param.string, param.range); <ide> }
2
Javascript
Javascript
add traditional chinese support
04da17fee79e45ea640f0908f8c3884980c4a300
<ide><path>lang/zh-tw.js <add>(function () { <add> var lang = { <add> months : "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), <add> monthsShort : "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), <add> weekdays : "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), <add> weekdaysShort : "週日_週一_週二_週三_週四_週五_週六".split("_"), <add> longDateFormat : { <add> LT : "h:mm A", <add> L : "DD/MM/YYYY", <add> LL : "D MMMM YYYY", <add> LLL : "D MMMM YYYY LT", <add> LLLL : "dddd, D MMMM YYYY LT" <add> }, <add> meridiem : { <add> AM : '上午', <add> am : '上午', <add> PM : '下午', <add> pm : '下午' <add> }, <add> calendar : { <add> sameDay : '[今天] LT', <add> nextDay : '[明天] LT', <add> nextWeek : '[下]dddd LT', <add> lastDay : '[昨天] LT', <add> lastWeek : '[上]dddd LT', <add> sameElse : 'L' <add> }, <add> relativeTime : { <add> future : "%s後", <add> past : "%s前", <add> s : "幾秒", <add> m : "一分鐘", <add> mm : "%d分鐘", <add> h : "一小時", <add> hh : "%d小時", <add> d : "一天", <add> dd : "%d天", <add> M : "一個月", <add> MM : "%d月", <add> y : "一年", <add> yy : "%d年" <add> }, <add> ordinal : function (number) { <add> return '.'; <add> } <add> }; <add> <add> // Node <add> if (typeof module !== 'undefined') { <add> module.exports = lang; <add> } <add> // Browser <add> if (typeof window !== 'undefined' && this.moment && this.moment.lang) { <add> this.moment.lang('zh-tw', lang); <add> } <add>}()); <ide>\ No newline at end of file
1
Text
Text
update instructions on step 49
dbb7f309a75020b0c12bd951462590317b1e7ca2
<ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804e1.md <ide> dashedName: step-49 <ide> <ide> The `fieldset` element is used to group related inputs and labels together in a web form. `fieldset` elements are <dfn>block-level elements</dfn>, meaning that they appear on a new line. <ide> <del>Nest the `Indoor` and `Outdoor` radio buttons within a `fieldset` element, and don't forget to indent the buttons. <add>Nest the `Indoor` and `Outdoor` radio buttons within a `fieldset` element, and don't forget to indent the radio buttons. <ide> <ide> # --hints-- <ide>
1
Java
Java
fix image loading error when null source is used
9255eeabb3595aeae4bfbdeaface11ee8b30dd81
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java <ide> public class ReactImageView extends GenericDraweeView { <ide> <ide> public static final int REMOTE_IMAGE_FADE_DURATION_MS = 300; <del> public static final String REMOTE_TRANSPARENT_BITMAP_URI = <del> "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="; <ide> <ide> private static float[] sComputedCornerRadii = new float[4]; <ide> <ide> public void setSource(@Nullable ReadableArray sources) { <ide> List<ImageSource> tmpSources = new LinkedList<>(); <ide> <ide> if (sources == null || sources.size() == 0) { <del> ImageSource imageSource = new ImageSource(getContext(), REMOTE_TRANSPARENT_BITMAP_URI); <add> tmpSources.add(ImageSource.getTransparentBitmapImageSource(getContext())); <add> } else if (sources.size() == 1) { <add> // Optimize for the case where we have just one uri, case in which we don't need the sizes <add> ReadableMap source = sources.getMap(0); <add> ImageSource imageSource = new ImageSource(getContext(), source.getString("uri")); <add> if (Uri.EMPTY.equals(imageSource.getUri())) { <add> warnImageSource(source.getString("uri")); <add> imageSource = ImageSource.getTransparentBitmapImageSource(getContext()); <add> } <ide> tmpSources.add(imageSource); <ide> } else { <del> // Optimize for the case where we have just one uri, case in which we don't need the sizes <del> if (sources.size() == 1) { <del> ReadableMap source = sources.getMap(0); <del> String uri = source.getString("uri"); <del> ImageSource imageSource = new ImageSource(getContext(), uri); <del> tmpSources.add(imageSource); <add> for (int idx = 0; idx < sources.size(); idx++) { <add> ReadableMap source = sources.getMap(idx); <add> ImageSource imageSource = <add> new ImageSource( <add> getContext(), <add> source.getString("uri"), <add> source.getDouble("width"), <add> source.getDouble("height")); <ide> if (Uri.EMPTY.equals(imageSource.getUri())) { <del> warnImageSource(uri); <del> } <del> } else { <del> for (int idx = 0; idx < sources.size(); idx++) { <del> ReadableMap source = sources.getMap(idx); <del> String uri = source.getString("uri"); <del> ImageSource imageSource = <del> new ImageSource( <del> getContext(), uri, source.getDouble("width"), source.getDouble("height")); <del> tmpSources.add(imageSource); <del> if (Uri.EMPTY.equals(imageSource.getUri())) { <del> warnImageSource(uri); <del> } <add> warnImageSource(source.getString("uri")); <add> imageSource = ImageSource.getTransparentBitmapImageSource(getContext()); <ide> } <add> tmpSources.add(imageSource); <ide> } <ide> } <ide> <ide> private boolean isTiled() { <ide> private void setSourceImage() { <ide> mImageSource = null; <ide> if (mSources.isEmpty()) { <del> ImageSource imageSource = new ImageSource(getContext(), REMOTE_TRANSPARENT_BITMAP_URI); <del> mSources.add(imageSource); <add> mSources.add(ImageSource.getTransparentBitmapImageSource(getContext())); <ide> } else if (hasMultipleSources()) { <ide> MultiSourceResult multiSource = <ide> MultiSourceHelper.getBestSourceForSize(getWidth(), getHeight(), mSources); <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ImageSource.java <ide> <ide> import android.content.Context; <ide> import android.net.Uri; <del>import androidx.annotation.Nullable; <del>import com.facebook.infer.annotation.Assertions; <ide> import java.util.Objects; <ide> <ide> /** Class describing an image source (network URI or resource) and size. */ <ide> public class ImageSource { <ide> <del> private @Nullable Uri mUri; <add> private static final String TRANSPARENT_BITMAP_URI = <add> "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="; <add> <add> private Uri mUri; <ide> private String mSource; <ide> private double mSize; <ide> private boolean isResource; <ide> public ImageSource(Context context, String source, double width, double height) <ide> mUri = computeUri(context); <ide> } <ide> <add> public static ImageSource getTransparentBitmapImageSource(Context context) { <add> return new ImageSource(context, TRANSPARENT_BITMAP_URI); <add> } <add> <ide> @Override <ide> public boolean equals(Object o) { <ide> if (this == o) return true; <ide> public String getSource() { <ide> <ide> /** Get the URI for this image - can be either a parsed network URI or a resource URI. */ <ide> public Uri getUri() { <del> return Assertions.assertNotNull(mUri); <add> return mUri; <ide> } <ide> <ide> /** Get the area of this image. */
2
Text
Text
remove deprecated attr_accessible mention
107d199c45b15c9e54e5f0a5560fa47ccd3695a6
<ide><path>guides/source/form_helpers.md <ide> Active Record provides model level support via the `accepts_nested_attributes_f <ide> class Person < ActiveRecord::Base <ide> has_many :addresses <ide> accepts_nested_attributes_for :addresses <del> <del> attr_accessible :name, :addresses_attributes <ide> end <ide> <ide> class Address < ActiveRecord::Base <ide> belongs_to :person <del> attr_accessible :kind, :street <ide> end <ide> ``` <ide> <del>This creates an `addresses_attributes=` method on `Person` that allows you to create, update and (optionally) destroy addresses. When using `attr_accessible` or `attr_protected` you must mark `addresses_attributes` as accessible as well as the other attributes of `Person` and `Address` that should be mass assigned. <add>This creates an `addresses_attributes=` method on `Person` that allows you to create, update and (optionally) destroy addresses. <ide> <ide> ### Building the Form <ide>
1
Text
Text
remove inline notes on v2 changes [ci skip]
a4cfe9fc3387516666153054cedf1fb6fafe4457
<ide><path>website/docs/api/cli.md <ide> out to the directory. Accuracy scores and model details will be added to a <ide> [`meta.json`](/usage/training#models-generating) to allow packaging the model <ide> using the [`package`](/api/cli#package) command. <ide> <del><Infobox title="Changed in v2.1" variant="warning"> <del> <del>As of spaCy 2.1, the `--no-tagger`, `--no-parser` and `--no-entities` flags have <del>been replaced by a `--pipeline` option, which lets you define comma-separated <del>names of pipeline components to train. For example, `--pipeline tagger,parser` <del>will only train the tagger and parser. <del> <del></Infobox> <del> <ide> ```bash <ide> $ python -m spacy train [lang] [output_path] [train_path] [dev_path] <ide> [--base-model] [--pipeline] [--vectors] [--n-iter] [--n-early-stopping] <ide><path>website/docs/api/language.md <ide> contain arbitrary whitespace. Alignment into the original string is preserved. <ide> | `disable` | list | Names of pipeline components to [disable](/usage/processing-pipelines#disabling). | <ide> | **RETURNS** | `Doc` | A container for accessing the annotations. | <ide> <del><Infobox title="Changed in v2.0" variant="warning"> <del> <del>Pipeline components to prevent from being loaded can now be added as a list to <del>`disable`, instead of specifying one keyword argument per component. <del> <del>```diff <del>- doc = nlp("I don't want parsed", parse=False) <del>+ doc = nlp("I don't want parsed", disable=["parser"]) <del>``` <del> <del></Infobox> <del> <ide> ## Language.pipe {#pipe tag="method"} <ide> <ide> Process texts as a stream, and yield `Doc` objects in order. This is usually <ide> available to the loaded object. <ide> | `exclude` | list | Names of pipeline components or [serialization fields](#serialization-fields) to exclude. | <ide> | **RETURNS** | `Language` | The `Language` object. | <ide> <del><Infobox title="Changed in v2.0" variant="warning"> <del> <del>Pipeline components to prevent from being loaded can now be added as a list to <del>`disable` (v2.0) or `exclude` (v2.1), instead of specifying one keyword argument <del>per component. <del> <del>```diff <del>- nlp = English().from_bytes(bytes, tagger=False, entity=False) <del>+ nlp = English().from_bytes(bytes, exclude=["tagger", "ner"]) <del>``` <del> <del></Infobox> <del> <ide> ## Attributes {#attributes} <ide> <ide> | Name | Type | Description | <ide><path>website/docs/api/matcher.md <ide> tag: class <ide> source: spacy/matcher/matcher.pyx <ide> --- <ide> <del><Infobox title="Changed in v2.0" variant="warning"> <del> <del>As of spaCy 2.0, `Matcher.add_pattern` and `Matcher.add_entity` are deprecated <del>and have been replaced with a simpler [`Matcher.add`](/api/matcher#add) that <del>lets you add a list of patterns and a callback for a given match ID. <del>`Matcher.get_entity` is now called [`matcher.get`](/api/matcher#get). <del>`Matcher.load` (not useful, as it didn't allow specifying callbacks), and <del>`Matcher.has_entity` (now redundant) have been removed. The concept of "acceptor <del>functions" has also been retired – this logic can now be handled in the callback <del>functions. <del> <del></Infobox> <del> <ide> ## Matcher.\_\_init\_\_ {#init tag="method"} <ide> <ide> Create the rule-based `Matcher`. If `validate=True` is set, all patterns added <ide><path>website/docs/api/phrasematcher.md <ide> be shown. <ide> | Name | Type | Description | <ide> | --------------------------------------- | --------------- | ------------------------------------------------------------------------------------------- | <ide> | `vocab` | `Vocab` | The vocabulary object, which must be shared with the documents the matcher will operate on. | <del>| `max_length` | int | Deprecated argument - the `PhraseMatcher` does not have a phrase length limit anymore. | <ide> | `attr` <Tag variant="new">2.1</Tag> | int / str | The token attribute to match on. Defaults to `ORTH`, i.e. the verbatim token text. | <ide> | `validate` <Tag variant="new">2.1</Tag> | bool | Validate patterns added to the matcher. | <ide> | **RETURNS** | `PhraseMatcher` | The newly constructed object. | <ide> <del><Infobox title="Changed in v2.1" variant="warning"> <del> <del>As of v2.1, the `PhraseMatcher` doesn't have a phrase length limit anymore, so <del>the `max_length` argument is now deprecated. <del> <del></Infobox> <del> <ide> ## PhraseMatcher.\_\_call\_\_ {#call tag="method"} <ide> <ide> Find all token sequences matching the supplied patterns on the `Doc`. <ide><path>website/docs/api/top-level.md <ide> for name in pipeline: component = nlp.create_pipe(name) # create each pipelin <ide> nlp.from_disk(model_data_path) # load in model data <ide> ``` <ide> <del><Infobox title="Changed in v2.0" variant="warning"> <del> <del>As of spaCy 2.0, the `path` keyword argument is deprecated. spaCy will also <del>raise an error if no model could be loaded and never just return an empty <del>`Language` object. If you need a blank language, you can use the new function <del>[`spacy.blank()`](/api/top-level#spacy.blank) or import the class explicitly, <del>e.g. `from spacy.lang.en import English`. <del> <del>```diff <del>- nlp = spacy.load("en", path="/model") <del>+ nlp = spacy.load("/model") <del>``` <del> <del></Infobox> <del> <ide> ### spacy.blank {#spacy.blank tag="function" new="2"} <ide> <ide> Create a blank model of a given language class. This function is the twin of
5
Javascript
Javascript
reactify donation other
baf425f907ba2d3bd47e90a5149dae4a76a3a3bd
<ide><path>client/src/pages/donate-other.js <ide> /* eslint-disable max-len */ <ide> import React, { Component, Fragment } from 'react'; <ide> import Helmet from 'react-helmet'; <add>import { Grid, Col, Row } from '@freecodecamp/react-bootstrap'; <ide> <ide> import Spacer from '../components/helpers/Spacer'; <ide> <ide> class IndexPage extends Component { <ide> <Fragment> <ide> <Helmet title='Other ways to donate | freeCodeCamp.org' /> <ide> <Spacer /> <del> <div className='container'> <del> <div className='row'> <del> <div className='col-xs-12 col-sm-10 col-sm-offset-1 col-md-6 col-md-offset-3'> <add> <Grid className='container'> <add> <Row> <add> <Col md={6} mdOffset={3} sm={10} smOffset={1} xs={12}> <ide> <h2 className='text-center'> <ide> Other ways you can support the freeCodeCamp.org nonprofit <ide> </h2> <ide> class IndexPage extends Component { <ide> <a href='/donate'>Or donate using a Credit or Debit Card.</a> <ide> </div> <ide> <Spacer /> <del> </div> <del> </div> <del> </div> <add> </Col> <add> </Row> <add> </Grid> <ide> </Fragment> <ide> ); <ide> }
1
Javascript
Javascript
simplify output handling in repl tests
950ef82aaf5ff9edab107f06964b24be9cc573d4
<ide><path>test/known_issues/test-repl-require-context.js <ide> outputStream.setEncoding('utf8'); <ide> outputStream.on('data', (data) => output += data); <ide> <ide> r.on('exit', common.mustCall(() => { <del> const results = output.split('\n').map((line) => { <del> return line.replace(/\w*>\w*/, '').trim(); <del> }); <add> const results = output.replace(/^> /mg, '').split('\n'); <ide> <ide> assert.deepStrictEqual(results, ['undefined', 'true', 'true', '']); <ide> })); <ide><path>test/parallel/test-repl-require-context.js <ide> child.stdout.on('data', (data) => { <ide> }); <ide> <ide> child.on('exit', common.mustCall(() => { <del> const results = output.split('\n').map((line) => { <del> return line.replace(/\w*>\w*/, '').trim(); <del> }); <del> <add> const results = output.replace(/^> /mg, '').split('\n'); <ide> assert.deepStrictEqual(results, ['undefined', 'true', 'true', '']); <ide> })); <ide>
2
Javascript
Javascript
fix debug-signal-cluster after da update
d87480beb29b764ba37cd983b594ad25a406a4c7
<ide><path>test/fixtures/clustered-server/app.js <ide> if (cluster.isMaster) { <ide> } <ide> }); <ide> <add> process.on('message', function(msg) { <add> if (msg.type === 'getpids') { <add> var pids = []; <add> pids.push(process.pid); <add> for (var key in cluster.workers) <add> pids.push(cluster.workers[key].process.pid); <add> process.send({ type: 'pids', pids: pids }); <add> } <add> }); <add> <ide> for (var i = 0; i < NUMBER_OF_WORKERS; i++) { <ide> cluster.fork(); <ide> } <ide><path>test/simple/test-debug-signal-cluster.js <ide> var assert = require('assert'); <ide> var spawn = require('child_process').spawn; <ide> <ide> var args = [ common.fixturesDir + '/clustered-server/app.js' ]; <del>var child = spawn(process.execPath, args); <add>var child = spawn(process.execPath, args, { <add> stdio: [ 'pipe', 'pipe', 'pipe', 'ipc' ] <add>}); <ide> var outputLines = []; <ide> var outputTimerId; <ide> var waitingForDebuggers = false; <ide> <add>var pids = null; <add> <ide> child.stderr.on('data', function(data) { <ide> var lines = data.toString().replace(/\r/g, '').trim().split('\n'); <ide> var line = lines[0]; <ide> child.stderr.on('data', function(data) { <ide> outputLines = outputLines.concat(lines); <ide> outputTimerId = setTimeout(onNoMoreLines, 800); <ide> } else if (line === 'all workers are running') { <del> waitingForDebuggers = true; <del> process._debugProcess(child.pid); <add> child.on('message', function(msg) { <add> if (msg.type !== 'pids') <add> return; <add> <add> pids = msg.pids; <add> console.error('got pids %j', pids); <add> <add> waitingForDebuggers = true; <add> process._debugProcess(child.pid); <add> }); <add> <add> child.send({ <add> type: 'getpids' <add> }); <ide> } <ide> }); <ide> <ide> setTimeout(function testTimedOut() { <ide> }, 6000); <ide> <ide> process.on('exit', function onExit() { <del> child.kill(); <add> pids.forEach(function(pid) { <add> process.kill(pid); <add> }); <ide> }); <ide> <ide> function assertOutputLines() {
2
PHP
PHP
implement nullstore in illuminate\cache
8d2f8c7612ccbac71b889ac8b126db1acee24224
<ide><path>src/Illuminate/Cache/CacheManager.php <ide> protected function createMemcachedDriver() <ide> return $this->repository(new MemcachedStore($memcached, $this->getPrefix())); <ide> } <ide> <add> /** <add> * Create an instance of the Null cache driver. <add> * <add> * @return \Illuminate\Cache\NullStore <add> */ <add> protected function createMemcachedDriver() <add> { <add> return $this->repository(new NullStore()); <add> } <add> <ide> /** <ide> * Create an instance of the WinCache cache driver. <ide> * <ide><path>src/Illuminate/Cache/NullStore.php <add><?php namespace Illuminate\Cache; <add> <add>class ArrayStore extends TaggableStore implements StoreInterface { <add> <add> /** <add> * The array of stored values. <add> * <add> * @var array <add> */ <add> protected $storage = array(); <add> <add> /** <add> * Retrieve an item from the cache by key. <add> * <add> * @param string $key <add> * @return mixed <add> */ <add> public function get($key) <add> { <add> } <add> <add> /** <add> * Store an item in the cache for a given number of minutes. <add> * <add> * @param string $key <add> * @param mixed $value <add> * @param int $minutes <add> * @return void <add> */ <add> public function put($key, $value, $minutes) <add> { <add> } <add> <add> /** <add> * Increment the value of an item in the cache. <add> * <add> * @param string $key <add> * @param mixed $value <add> * @return int <add> */ <add> public function increment($key, $value = 1) <add> { <add> } <add> <add> /** <add> * Increment the value of an item in the cache. <add> * <add> * @param string $key <add> * @param mixed $value <add> * @return int <add> */ <add> public function decrement($key, $value = 1) <add> { <add> } <add> <add> /** <add> * Store an item in the cache indefinitely. <add> * <add> * @param string $key <add> * @param mixed $value <add> * @return void <add> */ <add> public function forever($key, $value) <add> { <add> } <add> <add> /** <add> * Remove an item from the cache. <add> * <add> * @param string $key <add> * @return void <add> */ <add> public function forget($key) <add> { <add> } <add> <add> /** <add> * Remove all items from the cache. <add> * <add> * @return void <add> */ <add> public function flush() <add> { <add> } <add> <add> /** <add> * Get the cache key prefix. <add> * <add> * @return string <add> */ <add> public function getPrefix() <add> { <add> return ''; <add> } <add> <add>} <ide><path>tests/Cache/CacheNullStoreTest.php <add><?php <add> <add>use Illuminate\Cache\ArrayStore; <add> <add>class CacheNullStoreTest extends PHPUnit_Framework_TestCase { <add> <add> public function testItemsCanNotBeCached() <add> { <add> $store = new NullStore; <add> $store->put('foo', 'bar', 10); <add> $this->assertNull($store->get('foo')); <add> } <add> <add>}
3
Javascript
Javascript
throw rm() validation errors
adf8f3d1fee3850b2eaa227a74e45a6a27af61ac
<ide><path>lib/internal/fs/utils.js <ide> const defaultRmdirOptions = { <ide> }; <ide> <ide> const validateRmOptions = hideStackFrames((path, options, callback) => { <del> try { <del> options = validateRmdirOptions(options, defaultRmOptions); <del> validateBoolean(options.force, 'options.force'); <del> } catch (err) { <del> return callback(err); <del> } <add> options = validateRmdirOptions(options, defaultRmOptions); <add> validateBoolean(options.force, 'options.force'); <ide> <ide> lazyLoadFs().stat(path, (err, stats) => { <ide> if (err) {
1
Javascript
Javascript
test each block in addon.md contains js & cc
7c9cdb0882058924e9066a8f943109009d8b3bfc
<ide><path>tools/doc/addon-verify.js <ide> function once(fn) { <ide> function verifyFiles(files, onprogress, ondone) { <ide> var dir = path.resolve(verifyDir, 'doc-' + id++); <ide> <add> // must have a .cc and a .js to be a valid test <add> if (!Object.keys(files).some((name) => /\.cc$/.test(name)) || <add> !Object.keys(files).some((name) => /\.js$/.test(name))) { <add> return; <add> } <add> <ide> files = Object.keys(files).map(function(name) { <ide> return { <ide> path: path.resolve(dir, name), <ide> name: name, <ide> content: files[name] <ide> }; <ide> }); <add> <ide> files.push({ <ide> path: path.resolve(dir, 'binding.gyp'), <ide> content: JSON.stringify({
1
Javascript
Javascript
add child entitlements
f7ab15b1cd02ccc7946bb1692dd14a7f8ec6dc58
<ide><path>script/lib/code-sign-on-mac.js <ide> module.exports = async function(packagedAppPath) { <ide> await osxSign.signAsync({ <ide> app: packagedAppPath, <ide> entitlements: macEntitlementsPath, <add> "entitlements-inherit": macEntitlementsPath, <ide> identity: 'Developer ID Application: GitHub', <ide> keychain: process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN, <ide> platform: 'darwin', <del> hardenedRuntime: false <add> hardenedRuntime: true <ide> }); <ide> console.info('Application signing complete'); <ide> } catch (err) {
1
Ruby
Ruby
remove helper methods that were moved to helper.rb
d64a09b443ec4198cbb2ae1dfb68448af149ddb1
<ide><path>activerecord/test/cases/base_test.rb <ide> def test_default_scope_is_reset <ide> ensure <ide> Object.class_eval{ remove_const :UnloadablePost } if defined?(UnloadablePost) <ide> end <del> <del> protected <del> def with_env_tz(new_tz = 'US/Eastern') <del> old_tz, ENV['TZ'] = ENV['TZ'], new_tz <del> yield <del> ensure <del> old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ') <del> end <del> <del> def with_active_record_default_timezone(zone) <del> old_zone, ActiveRecord::Base.default_timezone = ActiveRecord::Base.default_timezone, zone <del> yield <del> ensure <del> ActiveRecord::Base.default_timezone = old_zone <del> end <ide> end
1
Python
Python
explain np.digitize more clearly
268fedb88a1ef4a8bcc843cf7eda50833e9b4ba7
<ide><path>numpy/add_newdocs.py <ide> def luf(lamdaexpr, *args, **kwargs): <ide> <ide> Return the indices of the bins to which each value in input array belongs. <ide> <del> Each index ``i`` returned is such that ``bins[i-1] <= x < bins[i]`` if <del> `bins` is monotonically increasing, or ``bins[i-1] > x >= bins[i]`` if <del> `bins` is monotonically decreasing. If values in `x` are beyond the <del> bounds of `bins`, 0 or ``len(bins)`` is returned as appropriate. If right <del> is True, then the right bin is closed so that the index ``i`` is such <del> that ``bins[i-1] < x <= bins[i]`` or ``bins[i-1] >= x > bins[i]`` if `bins` <del> is monotonically increasing or decreasing, respectively. <add> ========= ============= ============================ <add> `right` order of bins returned index `i` satisfies <add> ========= ============= ============================ <add> ``False`` increasing ``bins[i-1] <= x < bins[i]`` <add> ``True`` increasing ``bins[i-1] < x <= bins[i]`` <add> ``False`` decreasing ``bins[i-1] > x >= bins[i]`` <add> ``True`` decreasing ``bins[i-1] >= x > bins[i]`` <add> ========= ============= ============================ <add> <add> If values in `x` are beyond the bounds of `bins`, 0 or ``len(bins)`` is <add> returned as appropriate. <ide> <ide> Parameters <ide> ---------- <ide> def luf(lamdaexpr, *args, **kwargs): <ide> <ide> Returns <ide> ------- <del> out : ndarray of ints <add> indices : ndarray of ints <ide> Output array of indices, of same shape as `x`. <ide> <ide> Raises <ide> def luf(lamdaexpr, *args, **kwargs): <ide> for larger number of bins than the previous linear search. It also removes <ide> the requirement for the input array to be 1-dimensional. <ide> <add> For monotonically _increasing_ `bins`, the following are equivalent:: <add> <add> np.digitize(x, bins, right=True) <add> np.searchsorted(bins, x, side='left') <add> <add> Note that as the order of the arguments are reversed, the side must be too. <add> The `searchsorted` call is marginally faster, as it does not do any <add> monotonicity checks. Perhaps more importantly, it supports all dtypes. <add> <ide> Examples <ide> -------- <ide> >>> x = np.array([0.2, 6.4, 3.0, 1.6])
1
Python
Python
enable tokenizer exceptions
7aad6718bc461c963dc47aabd9e9b80181e775b5
<ide><path>spacy/lang/id/tokenizer_exceptions.py <ide> # coding: utf8 <ide> from __future__ import unicode_literals <ide> <del>TOKENIZER_EXCEPTIONS = {} <ide>\ No newline at end of file <add>from ._tokenizer_exceptions_list import FR_BASE_EXCEPTIONS <add> <add>_exc = {} <add> <add>for orth in FR_BASE_EXCEPTIONS + ["etc."]: <add> _exc[orth] = [{ORTH: orth}] <add> <add>TOKENIZER_EXCEPTIONS = dict(_exc) <ide>\ No newline at end of file
1