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
Go
Go
make use of builder/command
72a070c5da8b6fe832794a6de37aace7f9b93306
<ide><path>builder/parser/parser.go <ide> import ( <ide> "regexp" <ide> "strings" <ide> "unicode" <add> <add> "github.com/docker/docker/builder/command" <ide> ) <ide> <ide> // Node is a structure used to represent a parse tree. <ide> func init() { <ide> // functions. Errors are propagated up by Parse() and the resulting AST can <ide> // be incorporated directly into the existing AST as a next. <ide> dispatch = map[string]func(string) (*Node, map[string]bool, error){ <del> "user": parseString, <del> "onbuild": parseSubCommand, <del> "workdir": parseString, <del> "env": parseEnv, <del> "maintainer": parseString, <del> "from": parseString, <del> "add": parseMaybeJSONToList, <del> "copy": parseMaybeJSONToList, <del> "run": parseMaybeJSON, <del> "cmd": parseMaybeJSON, <del> "entrypoint": parseMaybeJSON, <del> "expose": parseStringsWhitespaceDelimited, <del> "volume": parseMaybeJSONToList, <del> "insert": parseIgnore, <add> command.User: parseString, <add> command.Onbuild: parseSubCommand, <add> command.Workdir: parseString, <add> command.Env: parseEnv, <add> command.Maintainer: parseString, <add> command.From: parseString, <add> command.Add: parseMaybeJSONToList, <add> command.Copy: parseMaybeJSONToList, <add> command.Run: parseMaybeJSON, <add> command.Cmd: parseMaybeJSON, <add> command.Entrypoint: parseMaybeJSON, <add> command.Expose: parseStringsWhitespaceDelimited, <add> command.Volume: parseMaybeJSONToList, <add> command.Insert: parseIgnore, <ide> } <ide> } <ide>
1
PHP
PHP
apply fixes from styleci
97833b3105f71567867c6360878b568b0c063afa
<ide><path>src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php <ide> protected function shouldSelect(array $columns = ['*']) <ide> */ <ide> public function chunk($count, callable $callback) <ide> { <del> return $this->prepareQueryBuilder()->chunk($count,$callback); <add> return $this->prepareQueryBuilder()->chunk($count, $callback); <ide> } <ide> <ide> /** <ide><path>tests/Database/DatabaseEloquentHasManyThroughIntegrationTest.php <ide> public function testOnlyProperColumnsAreSelectedIfProvided() <ide> ], array_keys($post->getAttributes())); <ide> } <ide> <del> public function testChunkReturnsCorrectModels(){ <add> public function testChunkReturnsCorrectModels() <add> { <ide> $this->seedData(); <ide> $this->seedDataExtended(); <ide> $country = HasManyThroughTestCountry::find(2); <ide> <del> $country->posts()->chunk(10,function($postsChunk){ <add> $country->posts()->chunk(10, function ($postsChunk) { <ide> $post = $postsChunk->first(); <ide> $this->assertEquals([ <ide> 'id', <ide> public function testChunkReturnsCorrectModels(){ <ide> 'email', <ide> 'created_at', <ide> 'updated_at', <del> 'country_id'],array_keys($post->getAttributes())); <del> <add> 'country_id', ], array_keys($post->getAttributes())); <ide> }); <ide> } <del> public function testEachReturnsCorrectModels(){ <add> <add> public function testEachReturnsCorrectModels() <add> { <ide> $this->seedData(); <ide> $this->seedDataExtended(); <ide> $country = HasManyThroughTestCountry::find(2); <ide> <del> $country->posts()->each(function($post){ <add> $country->posts()->each(function ($post) { <ide> $this->assertEquals([ <ide> 'id', <ide> 'user_id', <ide> public function testEachReturnsCorrectModels(){ <ide> 'email', <ide> 'created_at', <ide> 'updated_at', <del> 'country_id'],array_keys($post->getAttributes())); <del> <add> 'country_id', ], array_keys($post->getAttributes())); <ide> }); <ide> } <add> <ide> public function testIntermediateSoftDeletesAreIgnored() <ide> { <ide> $this->seedData(); <ide> protected function seedData() <ide> ['title' => 'Another title', 'body' => 'Another body', 'email' => '[email protected]'], <ide> ]); <ide> } <del> protected function seedDataExtended(){ <add> <add> protected function seedDataExtended() <add> { <ide> $country = HasManyThroughTestCountry::create(['id' => 2, 'name' => 'United Kingdom', 'shortname' => 'uk']); <ide> $country->users()->create(['id' => 2, 'email' => '[email protected]', 'country_short' => 'uk']) <ide> ->posts()->createMany([ <ide> ['title' => 'Example1 title1', 'body' => 'Example1 body1', 'email' => '[email protected]'], <del> ['title' => 'Example1 title2', 'body' => 'Example1 body2', 'email' => '[email protected]'] <add> ['title' => 'Example1 title2', 'body' => 'Example1 body2', 'email' => '[email protected]'], <ide> ]); <ide> $country->users()->create(['id' => 3, 'email' => '[email protected]', 'country_short' => 'uk']) <ide> ->posts()->createMany([ <ide> ['title' => 'Example2 title1', 'body' => 'Example2 body1', 'email' => '[email protected]'], <del> ['title' => 'Example2 title2', 'body' => 'Example2 body2', 'email' => '[email protected]'] <add> ['title' => 'Example2 title2', 'body' => 'Example2 body2', 'email' => '[email protected]'], <ide> ]); <ide> $country->users()->create(['id' => 4, 'email' => '[email protected]', 'country_short' => 'uk']) <ide> ->posts()->createMany([ <ide> ['title' => 'Example3 title1', 'body' => 'Example3 body1', 'email' => '[email protected]'], <del> ['title' => 'Example3 title2', 'body' => 'Example3 body2', 'email' => '[email protected]'] <add> ['title' => 'Example3 title2', 'body' => 'Example3 body2', 'email' => '[email protected]'], <ide> ]); <del> <del> <ide> } <ide> <ide> /**
2
Text
Text
remove double reference
be001a3b6492255ee35c8c40d1ecd6398db8a88c
<ide><path>threejs/lessons/threejs-textures.md <ide> It works! <ide> {{{example url="../threejs-textured-cube-6-textures.html" }}} <ide> <ide> It should be noted though that not all geometry types supports multiple <del>materials. `BoxGeometry` and `BoxGeometry` can use 6 materials one for each face. <del>`ConeGeometry` and `ConeGeometry` can use 2 materials, one for the bottom and one for the cone. <del>`CylinderGeometry` and `CylinderGeometry` can use 3 materials, bottom, top, and side. <add>materials. `BoxGeometry` can use 6 materials one for each face. <add>`ConeGeometry` can use 2 materials, one for the bottom and one for the cone. <add>`CylinderGeometry` can use 3 materials, bottom, top, and side. <ide> For other cases you will need to build or load custom geometry and/or modify texture coordinates. <ide> <ide> It's far more common in other 3D engines and far more performant to use a <ide> Now, when the cube is drawn so small that it's only 1 or 2 pixels large the GPU <ide> to use just the smallest or next to smallest mip level to decide what color to make the <ide> tiny cube. <ide> <del>In three you can choose what happens both when the texture is drawn <add>In three.js you can choose what happens both when the texture is drawn <ide> larger than its original size and what happens when it's drawn smaller than its <ide> original size. <ide>
1
Javascript
Javascript
add unit-tests for `stringtopdfstring`
c5c8b239e920ede477f989c097224d05ed43bf9f
<ide><path>test/unit/util_spec.js <ide> /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ <ide> /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ <del>/* globals expect, it, describe, combineUrl, Dict, isDict, Name */ <add>/* globals expect, it, describe, combineUrl, Dict, isDict, Name, <add> stringToPDFString */ <ide> <ide> 'use strict'; <ide> <ide> describe('util', function() { <ide> }); <ide> }); <ide> <add> describe('stringToPDFString', function() { <add> it('handles ISO Latin 1 strings', function() { <add> var str = '\x8Dstring\x8E'; <add> expect(stringToPDFString(str)).toEqual('\u201Cstring\u201D'); <add> }); <add> <add> it('handles UTF-16BE strings', function() { <add> var str = '\xFE\xFF\x00\x73\x00\x74\x00\x72\x00\x69\x00\x6E\x00\x67'; <add> expect(stringToPDFString(str)).toEqual('string'); <add> }); <add> <add> it('handles empty strings', function() { <add> // ISO Latin 1 <add> var str1 = ''; <add> expect(stringToPDFString(str1)).toEqual(''); <add> <add> // UTF-16BE <add> var str2 = '\xFE\xFF'; <add> expect(stringToPDFString(str2)).toEqual(''); <add> }); <add> }); <ide> });
1
Javascript
Javascript
check arg types of renegotiate()
6b7c402518d4b77687584eba2a9284674962f343
<ide><path>lib/_tls_wrap.js <ide> const { owner_symbol } = require('internal/async_hooks').symbols; <ide> const { SecureContext: NativeSecureContext } = internalBinding('crypto'); <ide> const { <ide> ERR_INVALID_ARG_TYPE, <add> ERR_INVALID_CALLBACK, <ide> ERR_MULTIPLE_CALLBACK, <ide> ERR_SOCKET_CLOSED, <ide> ERR_TLS_DH_PARAM_SIZE, <ide> TLSSocket.prototype._init = function(socket, wrap) { <ide> }; <ide> <ide> TLSSocket.prototype.renegotiate = function(options, callback) { <add> if (options === null || typeof options !== 'object') <add> throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); <add> if (callback != null && typeof callback !== 'function') <add> throw new ERR_INVALID_CALLBACK(); <add> <ide> if (this.destroyed) <ide> return; <ide> <ide><path>test/parallel/test-tls-disable-renegotiation.js <ide> server.listen(0, common.mustCall(() => { <ide> }; <ide> const client = tls.connect(options, common.mustCall(() => { <ide> client.write(''); <add> <add> common.expectsError(() => client.renegotiate(), { <add> code: 'ERR_INVALID_ARG_TYPE', <add> type: TypeError, <add> }); <add> <add> common.expectsError(() => client.renegotiate(common.mustNotCall()), { <add> code: 'ERR_INVALID_ARG_TYPE', <add> type: TypeError, <add> }); <add> <add> common.expectsError(() => client.renegotiate({}, false), { <add> code: 'ERR_INVALID_CALLBACK', <add> type: TypeError, <add> }); <add> <ide> // Negotiation is still permitted for this first <ide> // attempt. This should succeed. <ide> let ok = client.renegotiate(options, common.mustCall((err) => {
2
Text
Text
fix typo in rewrites docs
0d401ddcb58b6b602c0ff7098893c91f973b99d2
<ide><path>docs/api-reference/next.config.js/rewrites.md <ide> If you're using `trailingSlash: true`, you also need to insert a trailing slash <ide> <ide> ```js <ide> module.exports = { <del> trailingSlash: 'true', <add> trailingSlash: true, <ide> async rewrites() { <ide> return [ <ide> {
1
Ruby
Ruby
inline versions of upgraded formulae
da5d804bd9fca474eb2a7f484559ad9cd1534d89
<ide><path>Library/Homebrew/cmd/upgrade.rb <ide> def upgrade_formula(f) <ide> end <ide> fi.prelude <ide> <del> oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} #{fi.options.to_a.join " "}" <add> if f.optlinked? <add> oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} #{Keg.new(f.opt_prefix).version} -> #{f.pkg_version} #{fi.options.to_a.join " "}" <add> else <add> oh1 "Upgrading #{Formatter.identifier(f.full_specified_name)} -> #{f.pkg_version} #{fi.options.to_a.join " "}" <add> end <ide> <ide> # first we unlink the currently active keg for this formula otherwise it is <ide> # possible for the existing build to interfere with the build we are about to
1
Ruby
Ruby
fix a typo in date
21b4244d410bf5832b09f9b0bb06a12f8c886072
<ide><path>activesupport/lib/active_support/time_with_zone.rb <ide> module ActiveSupport <ide> # <ide> # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' <ide> # Time.zone.local(2007, 2, 10, 15, 30, 45) # => Sat, 10 Feb 2007 15:30:45 EST -05:00 <del> # Time.zone.parse('2007-02-01 15:30:45') # => Sat, 10 Feb 2007 15:30:45 EST -05:00 <add> # Time.zone.parse('2007-02-10 15:30:45') # => Sat, 10 Feb 2007 15:30:45 EST -05:00 <ide> # Time.zone.at(1170361845) # => Sat, 10 Feb 2007 15:30:45 EST -05:00 <ide> # Time.zone.now # => Sun, 18 May 2008 13:07:55 EDT -04:00 <ide> # Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone # => Sat, 10 Feb 2007 15:30:45 EST -05:00
1
Javascript
Javascript
use regex to compare error message
4eb194a2b10194f3ac1a4c8914d725aa90da265e
<ide><path>lib/util.js <ide> const inspectDefaultOptions = Object.seal({ <ide> breakLength: 60 <ide> }); <ide> <del>const CIRCULAR_ERROR_MESSAGE = 'Converting circular structure to JSON'; <del> <add>var CIRCULAR_ERROR_MESSAGE; <ide> var Debug; <ide> <ide> function tryStringify(arg) { <ide> try { <ide> return JSON.stringify(arg); <ide> } catch (err) { <add> // Populate the circular error message lazily <add> if (!CIRCULAR_ERROR_MESSAGE) { <add> try { <add> const a = {}; a.a = a; JSON.stringify(a); <add> } catch (err) { <add> CIRCULAR_ERROR_MESSAGE = err.message; <add> } <add> } <ide> if (err.name === 'TypeError' && err.message === CIRCULAR_ERROR_MESSAGE) <ide> return '[Circular]'; <ide> throw err;
1
Text
Text
add additional cra info to remaining examples
bb3314fcd2829a1b4a75ca48f54905e3acbcf6d7
<ide><path>examples/async/README.md <ide> # Redux Async Example <ide> <del>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app). <add>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app), which provides a simple way to start React projects with no build configuration needed. <add> <add>Projects built with Create-React-App include support for ES6 syntax, as well as several unofficial / not-yet-final forms of Javascript syntax such as Class Properties and JSX. See the list of [language features and polyfills supported by Create-React-App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#supported-language-features-and-polyfills) for more information. <ide> <ide> ## Available Scripts <ide> <ide><path>examples/counter/README.md <ide> # Redux Counter Example <ide> <del>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app). <add>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app), which provides a simple way to start React projects with no build configuration needed. <add> <add>Projects built with Create-React-App include support for ES6 syntax, as well as several unofficial / not-yet-final forms of Javascript syntax such as Class Properties and JSX. See the list of [language features and polyfills supported by Create-React-App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#supported-language-features-and-polyfills) for more information. <ide> <ide> ## Available Scripts <ide> <ide><path>examples/real-world/README.md <ide> # Redux Real World Example <ide> <del>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app). <add>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app), which provides a simple way to start React projects with no build configuration needed. <add> <add>Projects built with Create-React-App include support for ES6 syntax, as well as several unofficial / not-yet-final forms of Javascript syntax such as Class Properties and JSX. See the list of [language features and polyfills supported by Create-React-App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#supported-language-features-and-polyfills) for more information. <ide> <ide> ## Available Scripts <ide> <ide><path>examples/shopping-cart/README.md <ide> # Redux Shopping Cart Example <ide> <del>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app). <add>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app), which provides a simple way to start React projects with no build configuration needed. <add> <add>Projects built with Create-React-App include support for ES6 syntax, as well as several unofficial / not-yet-final forms of Javascript syntax such as Class Properties and JSX. See the list of [language features and polyfills supported by Create-React-App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#supported-language-features-and-polyfills) for more information. <ide> <ide> ## Available Scripts <ide> <ide><path>examples/todomvc/README.md <ide> # Redux TodoMVC Example <ide> <del>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app). <add>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app), which provides a simple way to start React projects with no build configuration needed. <add> <add>Projects built with Create-React-App include support for ES6 syntax, as well as several unofficial / not-yet-final forms of Javascript syntax such as Class Properties and JSX. See the list of [language features and polyfills supported by Create-React-App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#supported-language-features-and-polyfills) for more information. <ide> <ide> ## Available Scripts <ide> <ide><path>examples/todos-flow/README.md <ide> # Redux Todos Example <ide> <del>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app). <add>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app), which provides a simple way to start React projects with no build configuration needed. <add> <add>Projects built with Create-React-App include support for ES6 syntax, as well as several unofficial / not-yet-final forms of Javascript syntax such as Class Properties and JSX. See the list of [language features and polyfills supported by Create-React-App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#supported-language-features-and-polyfills) for more information. <ide> <ide> ## Available Scripts <ide> <ide><path>examples/todos-with-undo/README.md <ide> # Redux Todos with Undo Example <ide> <del>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app). <add>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app), which provides a simple way to start React projects with no build configuration needed. <add> <add>Projects built with Create-React-App include support for ES6 syntax, as well as several unofficial / not-yet-final forms of Javascript syntax such as Class Properties and JSX. See the list of [language features and polyfills supported by Create-React-App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#supported-language-features-and-polyfills) for more information. <ide> <ide> ## Available Scripts <ide> <ide><path>examples/tree-view/README.md <ide> # Redux Tree View Example <ide> <del>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app). <add>This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app), which provides a simple way to start React projects with no build configuration needed. <add> <add>Projects built with Create-React-App include support for ES6 syntax, as well as several unofficial / not-yet-final forms of Javascript syntax such as Class Properties and JSX. See the list of [language features and polyfills supported by Create-React-App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#supported-language-features-and-polyfills) for more information. <ide> <ide> ## Available Scripts <ide>
8
Text
Text
adjust readme and release notes
8d740a11e409693332d421f203425d968b30e73c
<ide><path>README.md <ide> There is a live example API for testing purposes, [available here][sandbox]. <ide> <ide> # Requirements <ide> <del>* Python (2.6.5+, 2.7, 3.2, 3.3, 3.4) <del>* Django (1.6.3+, 1.7, 1.8) <add>* Python (2.7, 3.2, 3.3, 3.4) <add>* Django (1.7, 1.8) <ide> <ide> # Installation <ide> <ide><path>docs/topics/release-notes.md <ide> You can determine your currently installed version using `pip freeze`: <ide> **Date**: NOT YET RELEASED <ide> <ide> * Removed support for Django Version 1.5 ([#3421][gh3421]) <add>* Removed support for Django Version 1.6 and Python 2.6 ([#3429][gh3429]) <ide> <ide> ## 3.2.x series <ide> <ide> For older release notes, [please see the version 2.x documentation][old-release- <ide> <ide> <!-- 3.0.0 --> <ide> [gh3421]: https://github.com/tomchristie/django-rest-framework/pulls/3421 <del> <add>[gh3429]: https://github.com/tomchristie/django-rest-framework/pull/3429
2
Javascript
Javascript
deprecate reactdom.render and reactdom.hydrate
aecb3b6d114e8fafddf6982133737198e8ea7cb3
<ide><path>fixtures/dom/src/__tests__/wrong-act-test.js <ide> it('warns when using the wrong act version - test + dom: render', () => { <ide> TestRenderer.act(() => { <ide> ReactDOM.render(<App />, document.createElement('div')); <ide> }); <del> }).toWarnDev(["It looks like you're using the wrong act()"], { <del> withoutStack: true, <del> }); <add> }).toWarnDev( <add> [ <add> 'ReactDOM.render is no longer supported in React 18.', <add> "It looks like you're using the wrong act()", <add> ], <add> { <add> withoutStack: true, <add> } <add> ); <ide> }); <ide> <ide> it('warns when using the wrong act version - test + dom: updates', () => { <ide><path>packages/react-devtools-shared/src/__tests__/inspectedElement-test.js <ide> describe('InspectedElement', () => { <ide> }); <ide> <ide> const container = document.createElement('div'); <del> await utils.actAsync(() => <del> ReactDOM.render(<Target a={1} b="abc" />, container), <del> ); <add> const root = ReactDOM.createRoot(container); <add> await utils.actAsync(() => root.render(<Target a={1} b="abc" />)); <ide> <ide> expect(targetRenderCount).toBe(1); <ide> expect(console.error).toHaveBeenCalledTimes(1); <ide><path>packages/react-dom/src/__tests__/ReactDOMFiber-test.js <ide> describe('ReactDOMFiber', () => { <ide> expect(ops).toEqual(['A']); <ide> <ide> if (__DEV__) { <del> // TODO: this warning shouldn't be firing in the first place if user didn't call it. <ide> const errorCalls = console.error.calls.count(); <del> for (let i = 0; i < errorCalls; i++) { <add> expect(console.error.calls.argsFor(0)[0]).toMatch( <add> 'ReactDOM.render is no longer supported in React 18', <add> ); <add> expect(console.error.calls.argsFor(1)[0]).toMatch( <add> 'ReactDOM.render is no longer supported in React 18', <add> ); <add> // TODO: this warning shouldn't be firing in the first place if user didn't call it. <add> for (let i = 2; i < errorCalls; i++) { <ide> expect(console.error.calls.argsFor(i)[0]).toMatch( <ide> 'unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering.', <ide> ); <ide><path>packages/react-dom/src/__tests__/ReactErrorBoundaries-test.internal.js <ide> describe('ReactErrorBoundaries', () => { <ide> <ide> it('logs a single error when using error boundary', () => { <ide> const container = document.createElement('div'); <del> expect(() => <del> ReactDOM.render( <del> <ErrorBoundary> <del> <BrokenRender /> <del> </ErrorBoundary>, <del> container, <del> ), <del> ).toErrorDev('The above error occurred in the <BrokenRender> component:', { <del> logAllErrors: true, <del> }); <add> spyOnDev(console, 'error'); <add> ReactDOM.render( <add> <ErrorBoundary> <add> <BrokenRender /> <add> </ErrorBoundary>, <add> container, <add> ); <add> if (__DEV__) { <add> expect(console.error).toHaveBeenCalledTimes(2); <add> expect(console.error.calls.argsFor(0)[0]).toContain( <add> 'ReactDOM.render is no longer supported', <add> ); <add> expect(console.error.calls.argsFor(1)[0]).toContain( <add> 'The above error occurred in the <BrokenRender> component:', <add> ); <add> } <ide> <ide> expect(container.firstChild.textContent).toBe('Caught an error: Hello.'); <ide> expect(Scheduler).toHaveYielded([ <ide><path>packages/react-dom/src/__tests__/ReactErrorLoggingRecovery-test.js <ide> describe('ReactErrorLoggingRecovery', () => { <ide> <ide> beforeEach(() => { <ide> console.error = error => { <add> if ( <add> typeof error === 'string' && <add> error.includes('ReactDOM.render is no longer supported in React 18') <add> ) { <add> // Ignore legacy root deprecation warning <add> return; <add> } <ide> throw new Error('Buggy console.error'); <ide> }; <ide> }); <ide><path>packages/react-dom/src/__tests__/ReactLegacyErrorBoundaries-test.internal.js <ide> describe('ReactLegacyErrorBoundaries', () => { <ide> <ide> it('logs a single error using both error boundaries', () => { <ide> const container = document.createElement('div'); <del> expect(() => <del> ReactDOM.render( <del> <BothErrorBoundaries> <del> <BrokenRender /> <del> </BothErrorBoundaries>, <del> container, <del> ), <del> ).toErrorDev('The above error occurred in the <BrokenRender> component', { <del> logAllErrors: true, <del> }); <add> spyOnDev(console, 'error'); <add> ReactDOM.render( <add> <BothErrorBoundaries> <add> <BrokenRender /> <add> </BothErrorBoundaries>, <add> container, <add> ); <add> if (__DEV__) { <add> expect(console.error).toHaveBeenCalledTimes(2); <add> expect(console.error.calls.argsFor(0)[0]).toContain( <add> 'ReactDOM.render is no longer supported', <add> ); <add> expect(console.error.calls.argsFor(1)[0]).toContain( <add> 'The above error occurred in the <BrokenRender> component:', <add> ); <add> } <ide> <ide> expect(container.firstChild.textContent).toBe('Caught an error: Hello.'); <ide> expect(log).toEqual([ <ide><path>packages/react-dom/src/__tests__/ReactLegacyRootWarnings-test.js <add>let ReactDOM = require('react-dom'); <add> <add>describe('ReactDOMRoot', () => { <add> let container; <add> <add> beforeEach(() => { <add> jest.resetModules(); <add> container = document.createElement('div'); <add> ReactDOM = require('react-dom'); <add> }); <add> <add> test('deprecation warning for ReactDOM.render', () => { <add> spyOnDev(console, 'error'); <add> <add> ReactDOM.render('Hi', container); <add> expect(container.textContent).toEqual('Hi'); <add> if (__DEV__) { <add> expect(console.error).toHaveBeenCalledTimes(1); <add> expect(console.error.calls.argsFor(0)[0]).toContain( <add> 'ReactDOM.render is no longer supported', <add> ); <add> } <add> }); <add> <add> test('deprecation warning for ReactDOM.hydrate', () => { <add> spyOnDev(console, 'error'); <add> <add> container.innerHTML = 'Hi'; <add> ReactDOM.hydrate('Hi', container); <add> expect(container.textContent).toEqual('Hi'); <add> if (__DEV__) { <add> expect(console.error).toHaveBeenCalledTimes(1); <add> expect(console.error.calls.argsFor(0)[0]).toContain( <add> 'ReactDOM.hydrate is no longer supported', <add> ); <add> } <add> }); <add>}); <ide><path>packages/react-dom/src/__tests__/utils/ReactDOMServerIntegrationTestUtils.js <ide> 'use strict'; <ide> <ide> const stream = require('stream'); <add>const shouldIgnoreConsoleError = require('../../../../../scripts/jest/shouldIgnoreConsoleError'); <ide> <ide> module.exports = function(initModules) { <ide> let ReactDOM; <ide> module.exports = function(initModules) { <ide> } <ide> <ide> const result = await fn(); <del> if ( <del> console.error.calls && <del> console.error.calls.count() !== count && <del> console.error.calls.count() !== 0 <del> ) { <del> console.log( <del> `We expected ${count} warning(s), but saw ${console.error.calls.count()} warning(s).`, <del> ); <del> if (console.error.calls.count() > 0) { <del> console.log(`We saw these warnings:`); <del> for (let i = 0; i < console.error.calls.count(); i++) { <del> console.log(...console.error.calls.argsFor(i)); <add> if (console.error.calls && console.error.calls.count() !== 0) { <add> const filteredWarnings = []; <add> for (let i = 0; i < console.error.calls.count(); i++) { <add> const args = console.error.calls.argsFor(i); <add> const [format, ...rest] = args; <add> if (!shouldIgnoreConsoleError(format, rest)) { <add> filteredWarnings.push(args); <add> } <add> } <add> if (filteredWarnings.length !== count) { <add> console.log( <add> `We expected ${count} warning(s), but saw ${filteredWarnings.length} warning(s).`, <add> ); <add> if (filteredWarnings.count > 0) { <add> console.log(`We saw these warnings:`); <add> for (let i = 0; i < filteredWarnings.length; i++) { <add> console.log(...filteredWarnings[i]); <add> } <add> } <add> if (__DEV__) { <add> expect(console.error).toHaveBeenCalledTimes(count); <ide> } <ide> } <del> } <del> if (__DEV__) { <del> expect(console.error).toHaveBeenCalledTimes(count); <ide> } <ide> return result; <ide> } <ide><path>packages/react-dom/src/client/ReactDOMLegacy.js <ide> export function hydrate( <ide> container: Container, <ide> callback: ?Function, <ide> ) { <add> if (__DEV__) { <add> console.error( <add> 'ReactDOM.hydrate is no longer supported in React 18. Use createRoot ' + <add> 'instead. Until you switch to the new API, your app will behave as ' + <add> "if it's running React 17. Learn " + <add> 'more: https://reactjs.org/link/switch-to-createroot', <add> ); <add> } <add> <ide> invariant( <ide> isValidContainer(container), <ide> 'Target container is not a DOM element.', <ide> export function render( <ide> container: Container, <ide> callback: ?Function, <ide> ) { <add> if (__DEV__) { <add> console.error( <add> 'ReactDOM.render is no longer supported in React 18. Use createRoot ' + <add> 'instead. Until you switch to the new API, your app will behave as ' + <add> "if it's running React 17. Learn " + <add> 'more: https://reactjs.org/link/switch-to-createroot', <add> ); <add> } <add> <ide> invariant( <ide> isValidContainer(container), <ide> 'Target container is not a DOM element.', <ide><path>scripts/jest/shouldIgnoreConsoleError.js <ide> module.exports = function shouldIgnoreConsoleError(format, args) { <ide> // Ignore it too. <ide> return true; <ide> } <add> if ( <add> format.indexOf('ReactDOM.render is no longer supported in React 18') !== <add> -1 || <add> format.indexOf( <add> 'ReactDOM.hydrate is no longer supported in React 18' <add> ) !== -1 <add> ) { <add> // We haven't finished migrating our tests to use createRoot. <add> return true; <add> } <ide> } <ide> } else { <ide> if (
10
Javascript
Javascript
remove babel from tests
99580664af941cf4caf19e2dd5f802689a96d1b8
<ide><path>karma.conf.js <ide> /* eslint-disable import/no-commonjs */ <ide> <del>const babel = require('rollup-plugin-babel'); <ide> const commonjs = require('@rollup/plugin-commonjs'); <ide> const json = require('@rollup/plugin-json'); <ide> const resolve = require('@rollup/plugin-node-resolve').default; <ide> module.exports = function(karma) { <ide> plugins: [ <ide> json(), <ide> resolve(), <del> babel({exclude: 'node_modules/**'}), // use babel since we have ES proposal features <ide> commonjs({exclude: ['src/**', 'test/**']}), <ide> webWorkerLoader() <ide> ],
1
PHP
PHP
add url method to cloud filesystem interface
6199d9f9ab862849cfd80b708b115d0eff38b2fc
<ide><path>src/Illuminate/Contracts/Filesystem/Cloud.php <ide> <ide> interface Cloud extends Filesystem <ide> { <del> // <add> /** <add> * Get the URL for the file at the given path. <add> * <add> * @param string $path <add> * @return string <add> */ <add> public function url($path); <ide> }
1
Java
Java
fix minor issue in mockhttpservletrequest
59d80ec19e7e6333a2af64b98f68d3efecc58a97
<ide><path>spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java <ide> /* <del> * Copyright 2002-2011 the original author or authors. <add> * Copyright 2002-2012 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public class MockHttpServletResponse implements HttpServletResponse { <ide> <ide> private static final String CONTENT_LENGTH_HEADER = "Content-Length"; <ide> <add> private static final String LOCATION_HEADER = "Location"; <add> <ide> //--------------------------------------------------------------------- <ide> // ServletResponse properties <ide> //--------------------------------------------------------------------- <ide> public class MockHttpServletResponse implements HttpServletResponse { <ide> <ide> private String errorMessage; <ide> <del> private String redirectedUrl; <del> <ide> private String forwardedUrl; <ide> <ide> private final List<String> includedUrls = new ArrayList<String>(); <ide> public Set<String> getHeaderNames() { <ide> /** <ide> * Return the primary value for the given header as a String, if any. <ide> * Will return the first value in case of multiple values. <del> * <p>As of Servlet 3.0, this method is also defined HttpServletResponse. <add> * <p>As of Servlet 3.0, this method is also defined in HttpServletResponse. <ide> * As of Spring 3.1, it returns a stringified value for Servlet 3.0 compatibility. <ide> * Consider using {@link #getHeaderValue(String)} for raw Object access. <ide> * @param name the name of the header <ide> public String getHeader(String name) { <ide> <ide> /** <ide> * Return all values for the given header as a List of Strings. <del> * <p>As of Servlet 3.0, this method is also defined HttpServletResponse. <add> * <p>As of Servlet 3.0, this method is also defined in HttpServletResponse. <ide> * As of Spring 3.1, it returns a List of stringified values for Servlet 3.0 compatibility. <ide> * Consider using {@link #getHeaderValues(String)} for raw Object access. <ide> * @param name the name of the header <ide> public String encodeURL(String url) { <ide> * returning the given URL String as-is. <ide> * <p>Can be overridden in subclasses, appending a session id or the like <ide> * in a redirect-specific fashion. For general URL encoding rules, <del> * override the common {@link #encodeURL} method instead, appyling <add> * override the common {@link #encodeURL} method instead, applying <ide> * to redirect URLs as well as to general URLs. <ide> */ <ide> public String encodeRedirectURL(String url) { <ide> public void sendRedirect(String url) throws IOException { <ide> throw new IllegalStateException("Cannot send redirect - response is already committed"); <ide> } <ide> Assert.notNull(url, "Redirect URL must not be null"); <del> this.redirectedUrl = url; <add> setHeader(LOCATION_HEADER, url); <add> setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); <ide> setCommitted(true); <ide> } <ide> <ide> public String getRedirectedUrl() { <del> return this.redirectedUrl; <add> return getHeader(LOCATION_HEADER); <ide> } <ide> <ide> public void setDateHeader(String name, long value) { <ide><path>spring-test/src/test/java/org/springframework/mock/web/MockHttpServletResponseTests.java <ide> /* <del> * Copyright 2002-2011 the original author or authors. <add> * Copyright 2002-2012 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.mock.web; <ide> <add>import static org.junit.Assert.*; <add> <ide> import java.io.IOException; <ide> import java.util.Arrays; <ide> import java.util.Set; <ide> <del>import junit.framework.TestCase; <add>import javax.servlet.http.HttpServletResponse; <add> <add>import org.junit.Test; <ide> <ide> import org.springframework.web.util.WebUtils; <ide> <ide> /** <add> * Unit tests for {@link MockHttpServletResponse}. <add> * <ide> * @author Juergen Hoeller <ide> * @author Rick Evans <ide> * @author Rossen Stoyanchev <add> * @author Rob Winch <add> * @author Sam Brannen <ide> * @since 19.02.2006 <ide> */ <del>public class MockHttpServletResponseTests extends TestCase { <add>public class MockHttpServletResponseTests { <add> <add> private MockHttpServletResponse response = new MockHttpServletResponse(); <ide> <del> public void testSetContentType() { <add> <add> @Test <add> public void setContentType() { <ide> String contentType = "test/plain"; <del> MockHttpServletResponse response = new MockHttpServletResponse(); <ide> response.setContentType(contentType); <ide> assertEquals(contentType, response.getContentType()); <ide> assertEquals(contentType, response.getHeader("Content-Type")); <ide> assertEquals(WebUtils.DEFAULT_CHARACTER_ENCODING, response.getCharacterEncoding()); <ide> } <ide> <del> public void testSetContentTypeUTF8() { <add> @Test <add> public void setContentTypeUTF8() { <ide> String contentType = "test/plain;charset=UTF-8"; <del> MockHttpServletResponse response = new MockHttpServletResponse(); <ide> response.setContentType(contentType); <ide> assertEquals("UTF-8", response.getCharacterEncoding()); <ide> assertEquals(contentType, response.getContentType()); <ide> assertEquals(contentType, response.getHeader("Content-Type")); <ide> } <del> <del> public void testContentTypeHeader() { <add> <add> @Test <add> public void contentTypeHeader() { <ide> String contentType = "test/plain"; <del> MockHttpServletResponse response = new MockHttpServletResponse(); <ide> response.addHeader("Content-Type", contentType); <ide> assertEquals(contentType, response.getContentType()); <ide> assertEquals(contentType, response.getHeader("Content-Type")); <ide> public void testContentTypeHeader() { <ide> assertEquals(WebUtils.DEFAULT_CHARACTER_ENCODING, response.getCharacterEncoding()); <ide> } <ide> <del> public void testContentTypeHeaderUTF8() { <add> @Test <add> public void contentTypeHeaderUTF8() { <ide> String contentType = "test/plain;charset=UTF-8"; <del> MockHttpServletResponse response = new MockHttpServletResponse(); <ide> response.setHeader("Content-Type", contentType); <ide> assertEquals(contentType, response.getContentType()); <ide> assertEquals(contentType, response.getHeader("Content-Type")); <ide> public void testContentTypeHeaderUTF8() { <ide> assertEquals("UTF-8", response.getCharacterEncoding()); <ide> } <ide> <del> public void testSetContentTypeThenCharacterEncoding() { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void setContentTypeThenCharacterEncoding() { <ide> response.setContentType("test/plain"); <ide> response.setCharacterEncoding("UTF-8"); <ide> assertEquals("test/plain", response.getContentType()); <ide> assertEquals("test/plain;charset=UTF-8", response.getHeader("Content-Type")); <ide> assertEquals("UTF-8", response.getCharacterEncoding()); <ide> } <ide> <del> public void testSetCharacterEncodingThenContentType() { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void setCharacterEncodingThenContentType() { <ide> response.setCharacterEncoding("UTF-8"); <ide> response.setContentType("test/plain"); <ide> assertEquals("test/plain", response.getContentType()); <ide> assertEquals("test/plain;charset=UTF-8", response.getHeader("Content-Type")); <ide> assertEquals("UTF-8", response.getCharacterEncoding()); <ide> } <ide> <del> public void testContentLength() { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void contentLength() { <ide> response.setContentLength(66); <ide> assertEquals(66, response.getContentLength()); <ide> assertEquals("66", response.getHeader("Content-Length")); <ide> } <del> <del> public void testContentLengthHeader() { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> <add> @Test <add> public void contentLengthHeader() { <ide> response.addHeader("Content-Length", "66"); <del> assertEquals(66,response.getContentLength()); <add> assertEquals(66, response.getContentLength()); <ide> assertEquals("66", response.getHeader("Content-Length")); <ide> } <del> <del> public void testHttpHeaderNameCasingIsPreserved() throws Exception { <del> final String headerName = "Header1"; <ide> <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void httpHeaderNameCasingIsPreserved() throws Exception { <add> final String headerName = "Header1"; <ide> response.addHeader(headerName, "value1"); <ide> Set<String> responseHeaders = response.getHeaderNames(); <ide> assertNotNull(responseHeaders); <ide> assertEquals(1, responseHeaders.size()); <ide> assertEquals("HTTP header casing not being preserved", headerName, responseHeaders.iterator().next()); <ide> } <ide> <del> public void testServletOutputStreamCommittedWhenBufferSizeExceeded() throws IOException { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void servletOutputStreamCommittedWhenBufferSizeExceeded() throws IOException { <ide> assertFalse(response.isCommitted()); <ide> response.getOutputStream().write('X'); <ide> assertFalse(response.isCommitted()); <ide> public void testServletOutputStreamCommittedWhenBufferSizeExceeded() throws IOEx <ide> assertEquals(size + 1, response.getContentAsByteArray().length); <ide> } <ide> <del> public void testServletOutputStreamCommittedOnFlushBuffer() throws IOException { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void servletOutputStreamCommittedOnFlushBuffer() throws IOException { <ide> assertFalse(response.isCommitted()); <ide> response.getOutputStream().write('X'); <ide> assertFalse(response.isCommitted()); <ide> public void testServletOutputStreamCommittedOnFlushBuffer() throws IOException { <ide> assertEquals(1, response.getContentAsByteArray().length); <ide> } <ide> <del> public void testServletWriterCommittedWhenBufferSizeExceeded() throws IOException { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void servletWriterCommittedWhenBufferSizeExceeded() throws IOException { <ide> assertFalse(response.isCommitted()); <ide> response.getWriter().write("X"); <ide> assertFalse(response.isCommitted()); <ide> public void testServletWriterCommittedWhenBufferSizeExceeded() throws IOExceptio <ide> assertEquals(size + 1, response.getContentAsByteArray().length); <ide> } <ide> <del> public void testServletOutputStreamCommittedOnOutputStreamFlush() throws IOException { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void servletOutputStreamCommittedOnOutputStreamFlush() throws IOException { <ide> assertFalse(response.isCommitted()); <ide> response.getOutputStream().write('X'); <ide> assertFalse(response.isCommitted()); <ide> public void testServletOutputStreamCommittedOnOutputStreamFlush() throws IOExcep <ide> assertEquals(1, response.getContentAsByteArray().length); <ide> } <ide> <del> public void testServletWriterCommittedOnWriterFlush() throws IOException { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void servletWriterCommittedOnWriterFlush() throws IOException { <ide> assertFalse(response.isCommitted()); <ide> response.getWriter().write("X"); <ide> assertFalse(response.isCommitted()); <ide> public void testServletWriterCommittedOnWriterFlush() throws IOException { <ide> assertEquals(1, response.getContentAsByteArray().length); <ide> } <ide> <del> public void testServletWriterAutoFlushedForString() throws IOException { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void servletWriterAutoFlushedForString() throws IOException { <ide> response.getWriter().write("X"); <ide> assertEquals("X", response.getContentAsString()); <ide> } <ide> <del> public void testServletWriterAutoFlushedForChar() throws IOException { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void servletWriterAutoFlushedForChar() throws IOException { <ide> response.getWriter().write('X'); <ide> assertEquals("X", response.getContentAsString()); <ide> } <ide> <del> public void testServletWriterAutoFlushedForCharArray() throws IOException { <del> MockHttpServletResponse response = new MockHttpServletResponse(); <add> @Test <add> public void servletWriterAutoFlushedForCharArray() throws IOException { <ide> response.getWriter().write("XY".toCharArray()); <ide> assertEquals("XY", response.getContentAsString()); <ide> } <ide> <add> @Test <add> public void sendRedirect() throws IOException { <add> String redirectUrl = "/redirect"; <add> response.sendRedirect(redirectUrl); <add> assertEquals(HttpServletResponse.SC_MOVED_TEMPORARILY, response.getStatus()); <add> assertEquals(redirectUrl, response.getHeader("Location")); <add> assertEquals(redirectUrl, response.getRedirectedUrl()); <add> assertTrue(response.isCommitted()); <add> } <add> <add> @Test <add> public void locationHeaderUpdatesGetRedirectedUrl() { <add> String redirectUrl = "/redirect"; <add> response.setHeader("Location", redirectUrl); <add> assertEquals(redirectUrl, response.getRedirectedUrl()); <add> } <add> <ide> }
2
Text
Text
simplify navigation copy
3acc64051f830097c06a593bebbca36e64fc5cce
<ide><path>laravel/documentation/contents.md <ide> - [Installation & Setup](/docs/install) <ide> - [Requirements](/docs/install#requirements) <ide> - [Installation](/docs/install#installation) <del> - [Server Configuration: Why Public?](/docs/install#server-configuration) <add> - [Server Configuration](/docs/install#server-configuration) <ide> - [Basic Configuration](/docs/install#basic-configuration) <ide> - [Environments](/docs/install#environments) <ide> - [Cleaner URLs](/docs/install#cleaner-urls)
1
Text
Text
add translation kr/threejs-billboards.md
2a76908bcf50c966146e593ea6efd174382adf6a
<ide><path>threejs/lessons/kr/threejs-billboards.md <add>Title: Three.js 빌보드(Billboards) <add>Description: 물체가 항상 카메라를 바라보도록 하는 법을 알아봅니다 <add>TOC: 빌보드와 파사드 <add> <add>[이전 글](threejs-canvas-textures.html)에서는 `CanvasTexture`를 이용해 캐릭터에 이름표/명찰을 붙이는 법을 알아봤습니다. 때로는 이 이름표가 항상 카메라를 향하게 해야 할 경우도 있겠죠. Three.js의 `Sprite`와 `SpriteMaterial`을 사용하면 이걸 쉽게 구현할 수 있습니다. <add> <add>[캔버스 텍스처에 관한 글](threejs-canvas-textures.html)의 명찰 예제를 가져와 여기에 `Sprite`와 `SpriteMaterial`을 사용해봅시다. <add> <add>```js <add>function makePerson(x, labelWidth, size, name, color) { <add> const canvas = makeLabelCanvas(labelWidth, size, name); <add> const texture = new THREE.CanvasTexture(canvas); <add> // 텍스처용 캔버스는 2D이므로 픽셀이 모자랑 경우 대략적으로 <add> // 필터링하게끔 설정합니다. <add> texture.minFilter = THREE.LinearFilter; <add> texture.wrapS = THREE.ClampToEdgeWrapping; <add> texture.wrapT = THREE.ClampToEdgeWrapping; <add> <add>- const labelMaterial = new THREE.MeshBasicMaterial({ <add>+ const labelMaterial = new THREE.SpriteMaterial({ <add> map: texture, <add>- side: THREE.DoubleSide, <add> transparent: true, <add> }); <add> <add> const root = new THREE.Object3D(); <add> root.position.x = x; <add> <add> const body = new THREE.Mesh(bodyGeometry, bodyMaterial); <add> root.add(body); <add> body.position.y = bodyHeight / 2; <add> <add> const head = new THREE.Mesh(headGeometry, bodyMaterial); <add> root.add(head); <add> head.position.y = bodyHeight + headRadius * 1.1; <add> <add>- const label = new THREE.Mesh(labelGeometry, labelMaterial); <add>+ const label = new THREE.Sprite(labelMaterial); <add> root.add(label); <add> label.position.y = bodyHeight * 4 / 5; <add> label.position.z = bodyRadiusTop * 1.01; <add> <add>``` <add> <add>이제 명찰이 항상 카메라를 바라봅니다. <add> <add>{{{example url="../threejs-billboard-labels-w-sprites.html" }}} <add> <add>하지만 특정 각도에서 보니 명찰이 사람과 겹쳐 보입니다. <add> <add><div class="threejs_center"><img src="resources/images/billboard-label-z-issue.png" style="width: 455px;"></div> <add> <add>간단히 명찰의 위치를 옮겨버리면 문제를 해결할 수 있겠죠. <add> <add>```js <add>+// 명찰의 크기를 조정합니다. <add>+const labelBaseScale = 0.01; <add>const label = new THREE.Sprite(labelMaterial); <add>root.add(label); <add>-label.position.y = bodyHeight * 4 / 5; <add>-label.position.z = bodyRadiusTop * 1.01; <add>+label.position.y = head.position.y + headRadius + size * labelBaseScale; <add> <add>-// 명찰의 크기를 조정합니다. <add>-const labelBaseScale = 0.01; <add>label.scale.x = canvas.width * labelBaseScale; <add>label.scale.y = canvas.height * labelBaseScale; <add>``` <add> <add>{{{example url="../threejs-billboard-labels-w-sprites-adjust-height.html" }}} <add> <add>추가로 이 빌보드(billboard, 광고판)*에 파사드를 적용할 수 있습니다. <add> <add>> ※ 맥락상 명찰이 갑자기 빌보드가 되는 게 이상하지만, 원문의 흐름 자체를 수정할 수 없어 그대로 번역합니다. 또한 광고판으로 번역할 수도 있으나, 우리나라 사람들에게 광고판이라는 게 잘 와닿지 않을 것이기에 그냥 영문을 그대로 옮겨 표기하였습니다. 역주. <add> <add>3D 물체를 그리는 대신 3D 물체의 이미지로 2D 평면을 렌더링하는 기법입니다. 꽤 많은 경우 3D 물체를 그냥 렌더링하는 것보다 빠르죠. <add> <add>예제로 나무가 그리드 형태로 배치된 장면(scene)을 만들어봅시다. 각 나무의 줄기는 원통, 윗부분은 원뿔로 만들겠습니다. <add> <add>먼저 모든 나무가 공통으로 사용할 원뿔, 원통의 geometry와 재질(material)을 만듭니다. <add> <add>```js <add>const trunkRadius = .2; <add>const trunkHeight = 1; <add>const trunkRadialSegments = 12; <add>const trunkGeometry = new THREE.CylinderBufferGeometry( <add> trunkRadius, trunkRadius, trunkHeight, trunkRadialSegments); <add> <add>const topRadius = trunkRadius * 4; <add>const topHeight = trunkHeight * 2; <add>const topSegments = 12; <add>const topGeometry = new THREE.ConeBufferGeometry( <add> topRadius, topHeight, topSegments); <add> <add>const trunkMaterial = new THREE.MeshPhongMaterial({ color: 'brown' }); <add>const topMaterial = new THREE.MeshPhongMaterial({ color: 'green' }); <add>``` <add> <add>다음으로 함수를 하나 만듭니다. 이 함수는 나무 줄기 `Mesh`와 윗부분 `Mesh`를 만들고 이 둘을 `Object3D`의 자식으로 넣는 역할입니다. <add> <add>```js <add>function makeTree(x, z) { <add> const root = new THREE.Object3D(); <add> const trunk = new THREE.Mesh(trunkGeometry, trunkMaterial); <add> trunk.position.y = trunkHeight / 2; <add> root.add(trunk); <add> <add> const top = new THREE.Mesh(topGeometry, topMaterial); <add> top.position.y = trunkHeight + topHeight / 2; <add> root.add(top); <add> <add> root.position.set(x, 0, z); <add> scene.add(root); <add> <add> return root; <add>} <add>``` <add> <add>그리고 반복문을 돌려 나무를 그리드 형태로 배치합니다. <add> <add>```js <add>for (let z = -50; z <= 50; z += 10) { <add> for (let x = -50; x <= 50; x += 10) { <add> makeTree(x, z); <add> } <add>} <add>``` <add> <add>땅 역할을 할 평면도 배치합니다. <add> <add>```js <add>// 땅을 추가합니다. <add>{ <add> const size = 400; <add> const geometry = new THREE.PlaneBufferGeometry(size, size); <add> const material = new THREE.MeshPhongMaterial({ color: 'gray' }); <add> const mesh = new THREE.Mesh(geometry, material); <add> mesh.rotation.x = Math.PI * -0.5; <add> scene.add(mesh); <add>} <add>``` <add> <add>배경은 하늘색으로 바꿔줍니다. <add> <add>```js <add>const scene = new THREE.Scene(); <add>-scene.background = new THREE.Color('white'); <add>+scene.background = new THREE.Color('lightblue'); <add>``` <add> <add>{{{example url="../threejs-billboard-trees-no-billboards.html" }}} <add> <add>나무는 11x11, 총 121그루입니다. 각 나무는 12각형 원뿔과 48각형 원통으로 이루어졌으니, 나무 하나 당 삼각형이 60개인 셈입니다. 121 * 60이면 총 삼각형 7260개네요. 물론 그다지 많은 수는 아니지만 더 세밀한 3차원 나무는 하나당 1000-3000개의 삼각형이 필요할 겁니다. 나무 하나당 3000개면 총 36300개의 삼각형을 그려야 하는 셈이죠. <add> <add>파사드(facade)를 이용하면 삼각형의 양을 줄일 수 있습니다. <add> <add>그래픽 프로그램으로 파사드를 만들 수도 있지만, 코드를 작성해 직접 하나를 만들어봅시다. <add> <add>`RenderTarget`을 이용해 3D 물체를 텍스처로 바꾸는 코드를 작성합니다. `RenderTarget`에 렌더링하는 법은 [이전 글](threejs-rendertargets.html)에서 다루었으니 참고 바랍니다. <add> <add>```js <add>function frameArea(sizeToFitOnScreen, boxSize, boxCenter, camera) { <add> const halfSizeToFitOnScreen = sizeToFitOnScreen * 0.5; <add> const halfFovY = THREE.MathUtils.degToRad(camera.fov * .5); <add> const distance = halfSizeToFitOnScreen / Math.tan(halfFovY); <add> <add> camera.position.copy(boxCenter); <add> camera.position.z += distance; <add> <add> // 절두체가 육면체를 포함하도록 near와 far 값을 조정합니다. <add> camera.near = boxSize / 100; <add> camera.far = boxSize * 100; <add> <add> camera.updateProjectionMatrix(); <add>} <add> <add>function makeSpriteTexture(textureSize, obj) { <add> const rt = new THREE.WebGLRenderTarget(textureSize, textureSize); <add> <add> const aspect = 1; // 렌더 타겟이 정사각형이므로 <add> const camera = new THREE.PerspectiveCamera(fov, aspect, near, far); <add> <add> scene.add(obj); <add> <add> // 물체를 감싼 육면체를 계산합니다. <add> const box = new THREE.Box3().setFromObject(obj); <add> <add> const boxSize = box.getSize(new THREE.Vector3()); <add> const boxCenter = box.getCenter(new THREE.Vector3()); <add> <add> // 카메라가 육면체를 감싸도록 설정합니다. <add> const fudge = 1.1; <add> const size = Math.max(...boxSize.toArray()) * fudge; <add> frameArea(size, size, boxCenter, camera); <add> <add> renderer.autoClear = false; <add> renderer.setRenderTarget(rt); <add> renderer.render(scene, camera); <add> renderer.setRenderTarget(null); <add> renderer.autoClear = true; <add> <add> scene.remove(obj); <add> <add> return { <add> position: boxCenter.multiplyScalar(fudge), <add> scale: size, <add> texture: rt.texture, <add> }; <add>} <add>``` <add> <add>위 예제에서 주의 깊게 봐야하는 부분: <add> <add>위 예제는 코드 밖에서 선언한 시야각 (field of view, `fov`)을 사용했습니다. <add> <add>[.obj 파일 불러오기](threejs-load-obj.html)에서 썼던 방법을 약간 수정해 나무를 감싼 육면체를 계산했습니다. <add> <add>[.obj 파일 불러오기](threejs-load-obj.html)에서 썼던 `frameArea`도 가져왔습니다. 이번에는 주어진 시아갹에 해당 물체가 포함되게 하려면 얼마나 떨어져야 하는지 계산할 때 사용했죠. 그리고 이 결과값으로 카메라를 물체를 감싼 육면체 중심에서 -z축 방향으로 옮겼습니다. <add> <add>절두체의 크기를 1.1 (`fudge(속임수)`)만큼 키워 나무가 렌더 타겟에 완전히 들어가도록 했습니다. 물체가 절두체 안에 있는지 계산한 결과는 물체의 가장자리를 포함하지 않기에 그대로 뒀다면 물체가 카메라 밖으로 벗어나 보였을 겁니다. 카메라가 완전히 물체를 담는 값을 계산할 수도 있지만, 그건 공간 낭비이기도 하기에 단순히 *속임수*를 사용한 것이죠. <add> <add>그리고 렌더 타겟에 장면을 렌더링한 뒤 나무를 장면에서 제거했습니다. <add> <add>여기서 중요한 건 조명은 따로 넣어야 하나, 다른 요소는 없도록 해야 한다는 겁니다. <add> <add>일단 장면에서 배경색도 제거합니다. <add> <add>```js <add>const scene = new THREE.Scene(); <add>-scene.background = new THREE.Color('lightblue'); <add>``` <add> <add>마지막으로 함수에서 받은 텍스처의 위치와 스케일을 조정해 파사드가 같은 위치에 나타나도록 해야 합니다. <add> <add>먼저 나무를 만들어 위에서 만든 함수에 넘겨줍니다. <add> <add>```js <add>// 빌보드 텍스처를 만듭니다. <add>const tree = makeTree(0, 0); <add>const facadeSize = 64; <add>const treeSpriteInfo = makeSpriteTexture(facadeSize, tree); <add>``` <add> <add>다음으로 나무 대신 파사드를 그리드 형태로 배치합니다. <add> <add>```js <add>+function makeSprite(spriteInfo, x, z) { <add>+ const { texture, offset, scale } = spriteInfo; <add>+ const mat = new THREE.SpriteMaterial({ <add>+ map: texture, <add>+ transparent: true, <add>+ }); <add>+ const sprite = new THREE.Sprite(mat); <add>+ scene.add(sprite); <add>+ sprite.position.set( <add>+ offset.x + x, <add>+ offset.y, <add>+ offset.z + z); <add>+ sprite.scale.set(scale, scale, scale); <add>+} <add> <add>for (let z = -50; z <= 50; z += 10) { <add> for (let x = -50; x <= 50; x += 10) { <add>- makeTree(x, z); <add>+ makeSprite(treeSpriteInfo, x, z); <add> } <add>} <add>``` <add> <add>위 코드에서는 파사드에 위치값과 스케일값을 지정해 원래 나무가 있어야할 위치에 파사드가 나타나도록 했습니다. <add> <add>이제 파사드가 제자리에 위치했으니 배경색을 다시 지정합니다. <add> <add>```js <add>scene.background = new THREE.Color('lightblue'); <add>``` <add> <add>나무 파사드로 이루어진 장면을 완성했습니다. <add> <add>{{{example url="../threejs-billboard-trees-static-billboards.html" }}} <add> <add>아까 만들었던 예제와 비교해보면 꽤 비슷할 겁니다. 예제에서는 저-해상도 텍스처, 64x64 픽셀 텍스처를 사용했기에 파사드가 각져 보입니다. 해상도를 높일 수도 있지만, 파사드는 대게 먼 거리에서 작게 보이는 물체에 사용하기에 저-해상도로 사용해도 그다지 문제가 없습니다. 게다가 몇 픽셀되지도 않는 나무를 렌더링하는 데 낭비되는 자원을 절약할 수 있죠. <add> <add>다른 문제는 나무를 한 각도에서 밖에 볼 수 없다는 겁니다. 이 문제는 대게 더 많은 파사드를 렌더링해 해결할 수 있죠. 예를 들어 8개의 파사드를 만들어 카메라가 물체를 바라보는 각도에 따라 다른 파사드를 보여줄 수 있을 겁니다. <add> <add>파사드를 쓸 지는 전적으로 선택이지만, 이 글이 파사드의 활용에 도움이 되었으면 합니다.
1
Text
Text
change todo to todoindex in app.js
2246250699c540537bdd7272893618943cf92896
<ide><path>docs/basics/UsageWithReact.md <ide> export default class App extends Component { <ide> text: 'Learn to connect it to React', <ide> completed: false <ide> }]} <del> onTodoClick={todo => <del> console.log('todo clicked', todo) <add> onTodoClick={todoIndex => <add> console.log('todo clicked', todoIndex) <ide> } /> <ide> <Footer <ide> filter='SHOW_ALL'
1
Javascript
Javascript
prevent multiple connection errors
b94ce575f57fa883b93ce8948730577a9bde8603
<ide><path>lib/_tls_wrap.js <ide> function onocspresponse(resp) { <ide> function onerror(err) { <ide> const owner = this[owner_symbol]; <ide> <del> if (owner._writableState.errorEmitted) <add> if (owner._hadError) <ide> return; <ide> <add> owner._hadError = true; <add> <ide> // Destroy socket if error happened before handshake's finish <ide> if (!owner._secureEstablished) { <ide> // When handshake fails control is not yet released, <ide> function onerror(err) { <ide> // Throw error <ide> owner._emitTLSError(err); <ide> } <del> <del> owner._writableState.errorEmitted = true; <ide> } <ide> <ide> function initRead(tls, wrapped) {
1
Javascript
Javascript
fix crash with skipnull and uneven datasets
e3b2b5279081b9040fdc493030e2c70ca8f71cc7
<ide><path>src/controllers/controller.bar.js <ide> export default class BarController extends DatasetController { <ide> * @private <ide> */ <ide> _getStacks(last, dataIndex) { <del> const meta = this._cachedMeta; <del> const iScale = meta.iScale; <del> const metasets = iScale.getMatchingVisibleMetas(this._type); <add> const {iScale} = this._cachedMeta; <add> const metasets = iScale.getMatchingVisibleMetas(this._type) <add> .filter(meta => meta.controller.options.grouped); <ide> const stacked = iScale.options.stacked; <del> const ilen = metasets.length; <ide> const stacks = []; <del> let i, item; <ide> <del> for (i = 0; i < ilen; ++i) { <del> item = metasets[i]; <add> const skipNull = (meta) => { <add> const parsed = meta.controller.getParsed(dataIndex); <add> const val = parsed && parsed[meta.vScale.axis]; <ide> <del> if (!item.controller.options.grouped) { <del> continue; <add> if (isNullOrUndef(val) || isNaN(val)) { <add> return true; <ide> } <add> }; <ide> <del> if (typeof dataIndex !== 'undefined') { <del> const val = item.controller.getParsed(dataIndex)[ <del> item.controller._cachedMeta.vScale.axis <del> ]; <del> <del> if (isNullOrUndef(val) || isNaN(val)) { <del> continue; <del> } <add> for (const meta of metasets) { <add> if (dataIndex !== undefined && skipNull(meta)) { <add> continue; <ide> } <ide> <ide> // stacked | meta.stack <ide> // | found | not found | undefined <ide> // false | x | x | x <ide> // true | | x | <ide> // undefined | | x | x <del> if (stacked === false || stacks.indexOf(item.stack) === -1 || <del> (stacked === undefined && item.stack === undefined)) { <del> stacks.push(item.stack); <add> if (stacked === false || stacks.indexOf(meta.stack) === -1 || <add> (stacked === undefined && meta.stack === undefined)) { <add> stacks.push(meta.stack); <ide> } <del> if (item.index === last) { <add> if (meta.index === last) { <ide> break; <ide> } <ide> } <ide><path>test/specs/controller.bar.tests.js <ide> describe('Chart.controllers.bar', function() { <ide> expect(ctx.getCalls().filter(x => x.name === 'clip').length).toEqual(0); <ide> }); <ide> }); <add> <add> it('should not crash with skipNull and uneven datasets', function() { <add> function unevenChart() { <add> window.acquireChart({ <add> type: 'bar', <add> data: { <add> labels: [1, 2], <add> datasets: [ <add> {data: [1, 2]}, <add> {data: [1, 2, 3]}, <add> ] <add> }, <add> options: { <add> skipNull: true, <add> } <add> }); <add> } <add> <add> expect(unevenChart).not.toThrow(); <add> }); <ide> });
2
Ruby
Ruby
fix missing link in deprecation
b8b1c9eba9ade21fd1e48c7d4b8f3b1d46b843fc
<ide><path>activerecord/lib/active_record/core.rb <ide> def self.connection_handlers=(handlers) <ide> The new connection handling does not support `connection_handlers` <ide> getter and setter. <ide> <del> Read more about how to migrate at: <add> Read more about how to migrate at: https://guides.rubyonrails.org/active_record_multiple_databases.html#migrate-to-the-new-connection-handling <ide> MSG <ide> else <ide> raise NotImplementedError, "The new connection handling does not setting support multiple connection handlers."
1
Javascript
Javascript
remove unused url-utils
0c771b7000f05cae900d9158c6964ba84189bd04
<ide><path>api-server/server/utils/url-utils.js <del>const isDev = process.env.FREECODECAMP_NODE_ENV !== 'production'; <del>const isBeta = !!process.env.BETA; <del> <ide> export function getEmailSender() { <ide> return process.env.SES_MAIL_FROM || '[email protected]'; <ide> } <del> <del>export function getPort() { <del> if (!isDev) { <del> return '443'; <del> } <del> return process.env.SYNC_PORT || '3000'; <del>} <del> <del>export function getProtocol() { <del> return isDev ? 'http' : 'https'; <del>} <del> <del>export function getHost() { <del> if (isDev) { <del> return process.env.HOST || 'localhost'; <del> } <del> return isBeta ? 'beta.freecodecamp.org' : 'www.freecodecamp.org'; <del>} <del> <del>export function getServerFullURL() { <del> if (!isDev) { <del> return getProtocol() + '://' + getHost(); <del> } <del> return getProtocol() + '://' + getHost() + ':' + getPort(); <del>}
1
Ruby
Ruby
update usage info and move to --help function
a4355c9f67529b8f9568d1981826837a184a6584
<ide><path>Library/Contributions/cmd/brew-bundle.rb <ide> # brew-bundle.rb <del># <del># Usage: brew bundle [path] <del># <del># Looks for a Brewfile and runs each line as a brew command. <del># <del># brew bundle # Looks for "./Brewfile" <del># brew bundle path/to/dir # Looks for "path/to/dir/Brewfile" <del># brew bundle path/to/file # Looks for "path/to/file" <del># <del># For example, given a Brewfile with the following contents: <del># tap foo/bar <del># install spark <del># <del># Running `brew bundle` will run the commands `brew tap foo/bar` <del># and `brew install spark`. <add> <add>def usage <add> puts <<-EOS.undent <add> Usage: brew bundle [path] <add> <add> Looks for a Brewfile and runs each line as a brew command. <add> <add> brew bundle # Looks for "./Brewfile" <add> brew bundle path/to/dir # Looks for "path/to/dir/Brewfile" <add> brew bundle path/to/file # Looks for "path/to/file" <add> <add> For example, given a Brewfile with the following content: <add> install formula <add> <add> Running `brew bundle` will run the command `brew install formula`. <add> <add> NOTE: Not all brew commands will work consistently in a Brewfile. <add> Some commands will raise errors which will stop execution of the Brewfile. <add> <add> Example that outputs an error: <add> tap my/tap # fails when my/tap has already been tapped <add> <add> In this case use the full formula path in the Brewfile instead: <add> install my/tap/formula # succeeds even when my/tap has already been tapped <add> EOS <add> exit <add>end <add> <add>usage if ARGV.include?('--help') || ARGV.include?('-h') <ide> <ide> path = 'Brewfile' <ide> error = ' in current directory'
1
Javascript
Javascript
fix memory leak with rendercomponenttostring()
526be1570e1c08c381d88e7c54703b9f8356cb1e
<ide><path>src/core/ReactDOMComponent.js <ide> function assertValidProps(props) { <ide> ); <ide> } <ide> <del>function putListener(id, registrationName, listener) { <add>function putListener(id, registrationName, listener, transaction) { <ide> var container = ReactMount.findReactContainerForID(id); <ide> if (container) { <ide> var doc = container.nodeType === ELEMENT_NODE_TYPE ? <ide> container.ownerDocument : <ide> container; <ide> listenTo(registrationName, doc); <ide> } <del> <del> ReactEventEmitter.putListener(id, registrationName, listener); <add> transaction.getPutListenerQueue().enqueuePutListener( <add> id, <add> registrationName, <add> listener <add> ); <ide> } <ide> <ide> <ide> ReactDOMComponent.Mixin = { <ide> ); <ide> assertValidProps(this.props); <ide> return ( <del> this._createOpenTagMarkup() + <add> this._createOpenTagMarkupAndPutListeners(transaction) + <ide> this._createContentMarkup(transaction) + <ide> this._tagClose <ide> ); <ide> ReactDOMComponent.Mixin = { <ide> * @see http://jsperf.com/obj-vs-arr-iteration <ide> * <ide> * @private <add> * @param {ReactReconcileTransaction} transaction <ide> * @return {string} Markup of opening tag. <ide> */ <del> _createOpenTagMarkup: function() { <add> _createOpenTagMarkupAndPutListeners: function(transaction) { <ide> var props = this.props; <ide> var ret = this._tagOpen; <ide> <ide> ReactDOMComponent.Mixin = { <ide> continue; <ide> } <ide> if (registrationNameModules[propKey]) { <del> putListener(this._rootNodeID, propKey, propValue); <add> putListener(this._rootNodeID, propKey, propValue, transaction); <ide> } else { <ide> if (propKey === STYLE) { <ide> if (propValue) { <ide> ReactDOMComponent.Mixin = { <ide> prevProps, <ide> prevOwner <ide> ); <del> this._updateDOMProperties(prevProps); <add> this._updateDOMProperties(prevProps, transaction); <ide> this._updateDOMChildren(prevProps, transaction); <ide> } <ide> ), <ide> ReactDOMComponent.Mixin = { <ide> * <ide> * @private <ide> * @param {object} lastProps <add> * @param {ReactReconcileTransaction} transaction <ide> */ <del> _updateDOMProperties: function(lastProps) { <add> _updateDOMProperties: function(lastProps, transaction) { <ide> var nextProps = this.props; <ide> var propKey; <ide> var styleName; <ide> ReactDOMComponent.Mixin = { <ide> styleUpdates = nextProp; <ide> } <ide> } else if (registrationNameModules[propKey]) { <del> putListener(this._rootNodeID, propKey, nextProp); <add> putListener(this._rootNodeID, propKey, nextProp, transaction); <ide> } else if ( <ide> DOMProperty.isStandardName[propKey] || <ide> DOMProperty.isCustomAttribute(propKey)) { <ide><path>src/core/ReactPutListenerQueue.js <add>/** <add> * Copyright 2013 Facebook, Inc. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> * <add> * @providesModule ReactPutListenerQueue <add> */ <add> <add>"use strict"; <add> <add>var PooledClass = require('PooledClass'); <add>var ReactEventEmitter = require('ReactEventEmitter'); <add> <add>var mixInto = require('mixInto'); <add> <add>function ReactPutListenerQueue() { <add> this.listenersToPut = []; <add>} <add> <add>mixInto(ReactPutListenerQueue, { <add> enqueuePutListener: function(rootNodeID, propKey, propValue) { <add> this.listenersToPut.push({ <add> rootNodeID: rootNodeID, <add> propKey: propKey, <add> propValue: propValue <add> }); <add> }, <add> <add> putListeners: function() { <add> for (var i = 0; i < this.listenersToPut.length; i++) { <add> var listenerToPut = this.listenersToPut[i]; <add> ReactEventEmitter.putListener( <add> listenerToPut.rootNodeID, <add> listenerToPut.propKey, <add> listenerToPut.propValue <add> ); <add> } <add> }, <add> <add> reset: function() { <add> this.listenersToPut.length = 0; <add> }, <add> <add> destructor: function() { <add> this.reset(); <add> } <add>}); <add> <add>PooledClass.addPoolingTo(ReactPutListenerQueue); <add> <add>module.exports = ReactPutListenerQueue; <ide><path>src/core/ReactReconcileTransaction.js <ide> var PooledClass = require('PooledClass'); <ide> var ReactEventEmitter = require('ReactEventEmitter'); <ide> var ReactInputSelection = require('ReactInputSelection'); <ide> var ReactMountReady = require('ReactMountReady'); <add>var ReactPutListenerQueue = require('ReactPutListenerQueue'); <ide> var Transaction = require('Transaction'); <ide> <ide> var mixInto = require('mixInto'); <ide> var ON_DOM_READY_QUEUEING = { <ide> } <ide> }; <ide> <add>var PUT_LISTENER_QUEUEING = { <add> initialize: function() { <add> this.putListenerQueue.reset(); <add> }, <add> <add> close: function() { <add> this.putListenerQueue.putListeners(); <add> } <add>}; <add> <ide> /** <ide> * Executed within the scope of the `Transaction` instance. Consider these as <ide> * being member methods, but with an implied ordering while being isolated from <ide> * each other. <ide> */ <ide> var TRANSACTION_WRAPPERS = [ <add> PUT_LISTENER_QUEUEING, <ide> SELECTION_RESTORATION, <ide> EVENT_SUPPRESSION, <ide> ON_DOM_READY_QUEUEING <ide> var TRANSACTION_WRAPPERS = [ <ide> function ReactReconcileTransaction() { <ide> this.reinitializeTransaction(); <ide> this.reactMountReady = ReactMountReady.getPooled(null); <add> this.putListenerQueue = ReactPutListenerQueue.getPooled(); <ide> } <ide> <ide> var Mixin = { <ide> var Mixin = { <ide> return this.reactMountReady; <ide> }, <ide> <add> getPutListenerQueue: function() { <add> return this.putListenerQueue; <add> }, <add> <ide> /** <ide> * `PooledClass` looks for this, and will invoke this before allowing this <ide> * instance to be resused. <ide> */ <ide> destructor: function() { <ide> ReactMountReady.release(this.reactMountReady); <ide> this.reactMountReady = null; <add> <add> ReactPutListenerQueue.release(this.putListenerQueue); <add> this.putListenerQueue = null; <ide> } <ide> }; <ide> <ide><path>src/core/__tests__/ReactDOMComponent-test.js <ide> describe('ReactDOMComponent', function() { <ide> mixInto(NodeStub, ReactDOMComponent.Mixin); <ide> <ide> genMarkup = function(props) { <del> return (new NodeStub(props))._createOpenTagMarkup(); <add> return (new NodeStub(props))._createOpenTagMarkupAndPutListeners(); <ide> }; <ide> <ide> this.addMatchers({ <ide><path>src/core/putDOMComponentListener.js <add>/** <add> * Copyright 2013 Facebook, Inc. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> * <add> * @providesModule putDOMComponentListener <add> */ <add> <add>"use strict"; <add> <add>var ReactEventEmitter = require('ReactEventEmitter'); <add>var ReactMount = require('ReactMount'); <add> <add>var listenTo = ReactEventEmitter.listenTo; <add> <add>var ELEMENT_NODE_TYPE = 1; <add> <add>function putDOMComponentListener(id, registrationName, listener) { <add> var container = ReactMount.findReactContainerForID(id); <add> if (container) { <add> var doc = container.nodeType === ELEMENT_NODE_TYPE ? <add> container.ownerDocument : <add> container; <add> listenTo(registrationName, doc); <add> } <add> <add> ReactEventEmitter.putListener(id, registrationName, listener); <add>} <add> <add>module.exports = putDOMComponentListener; <ide><path>src/environment/__tests__/ReactServerRendering-test.js <ide> describe('ReactServerRendering', function() { <ide> ); <ide> }); <ide> <add> it('should not register event listeners', function() { <add> var EventPluginHub = require('EventPluginHub'); <add> var cb = mocks.getMockFunction(); <add> <add> ReactServerRendering.renderComponentToString( <add> <span onClick={cb}>hello world</span>, <add> function() { <add> expect(EventPluginHub.__getListenerBank()).toEqual({}); <add> } <add> ); <add> }); <add> <ide> it('should render composite components', function() { <ide> var Parent = React.createClass({ <ide> render: function() { <ide><path>src/event/EventPluginHub.js <ide> <ide> var EventPluginRegistry = require('EventPluginRegistry'); <ide> var EventPluginUtils = require('EventPluginUtils'); <add>var ExecutionEnvironment = require('ExecutionEnvironment'); <ide> <ide> var accumulate = require('accumulate'); <ide> var forEachAccumulated = require('forEachAccumulated'); <ide> var EventPluginHub = { <ide> * @param {?function} listener The callback to store. <ide> */ <ide> putListener: function(id, registrationName, listener) { <add> invariant( <add> ExecutionEnvironment.canUseDOM, <add> 'Cannot call putListener() in a non-DOM environment.' <add> ); <add> <ide> if (__DEV__) { <ide> // IE8 has no API for event capturing and the `onScroll` event doesn't <ide> // bubble. <ide> var EventPluginHub = { <ide> }, <ide> <ide> /** <del> * This is needed for tests only. Do not use! <add> * These are needed for tests only. Do not use! <ide> */ <ide> __purge: function() { <ide> listenerBank = {}; <add> }, <add> <add> __getListenerBank: function() { <add> return listenerBank; <ide> } <ide> <ide> };
7
PHP
PHP
fix bad merge and failing test
ab5bfdccfd1cf4dc5ff115a09a83fd40ff48cc74
<ide><path>lib/Cake/Test/Case/Utility/ClassRegistryTest.php <ide> class RegisterCategory extends ClassRegisterModel { <ide> */ <ide> public $name = 'RegisterCategory'; <ide> } <add> /** <add> * RegisterPrefixedDs class <add> * <add> * @package Cake.Test.Case.Utility <add> */ <add>class RegisterPrefixedDs extends ClassRegisterModel { <add> <add>/** <add> * useDbConfig property <add> * <add> * @var string 'doesnotexist' <add> */ <add> public $useDbConfig = 'doesnotexist'; <add>} <ide> <ide> /** <ide> * Abstract class for testing ClassRegistry. <ide> public function testPluginAppModel() { <ide> * <ide> */ <ide> public function testPrefixedTestDatasource() { <add> ClassRegistry::config(array('testing' => true)); <ide> $Model = ClassRegistry::init('RegisterPrefixedDs'); <del> $this->assertEqual($Model->useDbConfig, 'test'); <add> $this->assertEquals('test', $Model->useDbConfig); <ide> ClassRegistry::removeObject('RegisterPrefixedDs'); <ide> <ide> $testConfig = ConnectionManager::getDataSource('test')->config; <ide> ConnectionManager::create('test_doesnotexist', $testConfig); <ide> <ide> $Model = ClassRegistry::init('RegisterArticle'); <del> $this->assertEqual($Model->useDbConfig, 'test'); <add> $this->assertEquals('test', $Model->useDbConfig); <ide> $Model = ClassRegistry::init('RegisterPrefixedDs'); <del> $this->assertEqual($Model->useDbConfig, 'test_doesnotexist'); <add> $this->assertEquals('test_doesnotexist', $Model->useDbConfig); <ide> } <ide> <ide> /**
1
Ruby
Ruby
install task works within engine
c5b900da7323d33ae10e00c45ca7aaebc0e9c75c
<ide><path>railties/test/railties/engine_test.rb <ide> def index <ide> assert_equal "/fruits/2/bukkits/posts", last_response.body <ide> end <ide> <add> test "active_storage:install task works within engine" do <add> @plugin.write "Rakefile", <<-RUBY <add> APP_RAKEFILE = '#{app_path}/Rakefile' <add> load 'rails/tasks/engine.rake' <add> RUBY <add> <add> Dir.chdir(@plugin.path) do <add> output = `bundle exec rake app:active_storage:install` <add> assert $?.success?, output <add> <add> active_storage_migration = migrations.detect { |migration| migration.name == "CreateActiveStorageTables" } <add> assert active_storage_migration <add> end <add> end <add> <ide> private <ide> def app <ide> Rails.application
1
Ruby
Ruby
add relation#merge to merge two relations
a8b10a2a8d6f8d861453803264b9ef1b0cadbc6b
<ide><path>activerecord/lib/active_record/relation.rb <ide> def initialize(klass, relation, readonly = false, preload = [], eager_load = []) <ide> @loaded = false <ide> end <ide> <add> def merge(r) <add> joins(r.relation.joins(r.relation)). <add> group(r.send(:group_clauses).join(', ')). <add> order(r.send(:order_clauses).join(', ')). <add> where(r.send(:where_clause)). <add> limit(r.taken). <add> offset(r.skipped). <add> select(r.send(:select_clauses).join(', ')) <add> end <add> <add> alias :& :merge <add> <ide> def preload(*associations) <ide> create_new_relation(@relation, @readonly, @associations_to_preload + Array.wrap(associations)) <ide> end <ide> def readonly <ide> end <ide> <ide> def select(selects) <del> create_new_relation(@relation.project(selects)) <add> selects.present? ? create_new_relation(@relation.project(selects)) : create_new_relation <ide> end <ide> <ide> # TODO : This is temporary. We need .from in Arel. <ide> def from(from) <ide> end <ide> <ide> def group(groups) <del> create_new_relation(@relation.group(groups)) <add> groups.present? ? create_new_relation(@relation.group(groups)) : create_new_relation <ide> end <ide> <ide> def order(orders) <del> create_new_relation(@relation.order(orders)) <add> orders.present? ? create_new_relation(@relation.order(orders)) : create_new_relation <ide> end <ide> <ide> def reverse_order <ide> def reverse_order <ide> end <ide> <ide> def limit(limits) <del> create_new_relation(@relation.take(limits)) <add> limits.present? ? create_new_relation(@relation.take(limits)) : create_new_relation <ide> end <ide> <ide> def offset(offsets) <del> create_new_relation(@relation.skip(offsets)) <add> offsets.present? ? create_new_relation(@relation.skip(offsets)) : create_new_relation <ide> end <ide> <ide> def on(join) <ide><path>activerecord/test/cases/relations_test.rb <ide> def test_destroy_all <ide> assert davids.loaded? <ide> end <ide> <add> def test_relation_merging <add> devs = Developer.where("salary >= 80000") & Developer.limit(2) & Developer.order('id ASC').where("id < 3") <add> assert_equal [developers(:david), developers(:jamis)], devs.to_a <add> <add> dev_with_count = Developer.limit(1) & Developer.order('id DESC') & Developer.select('developers.*, count(id) id_count').group('id') <add> assert_equal [developers(:poor_jamis)], dev_with_count.to_a <add> assert_equal 1, dev_with_count.first.id_count.to_i <add> end <ide> end
2
Text
Text
add advantages and disadvantages of an array
7a976c5b0d72e49a9522e8d99f2542b24373da21
<ide><path>client/src/pages/guide/english/csharp/array/index.md <ide> title: Arrays <ide> <ide> An array is used to store a collection of data of the same type. This can be used as a single variable that holds multiple values, or a collection of variables. <ide> <del># Rules of Arrays <add>## Rules of Arrays <ide> <ide> Arrays start from zero. The first element of an array is 0, the second element is 1, the third element 2, and so on. <ide> <ide> Arrays must be of the same data type. You can use any data type in an array (e.g. int, double, float, string, enum) <ide> <ide> A new Array must first be declared and initialised before it can be called and accessed. <ide> <del># Declaring an Array <add>## Declaring an Array <ide> <ide> Use the following format for declaring arrays: <ide> `dataType [] nameOfArray;` <ide> <del># Initialising an array <add>## Initializing an array <ide> <ide> Use the following format for initialising an array. This method also declares the array and states how many values are to be stored into the array. <ide> <ide> `dataType [] nameOfArray = new nameOfArray[numberOfElements];` <ide> <del># Assigning values to an array <add>## Assigning values to an array <ide> <ide> You can assign a value into an element directly by using the format below: <ide> <ide> You can store an array directly into another array by using the format below: <ide> `int [] nameOfArray = new nameOfArray[4] {2,9,56,1280};` <ide> `int [] nameOfSecondArray = nameOfArray;` <ide> <add>## Advantages <add> <add>* Can be easily accessed in a random manner <add>* Can be easily manipulated <add> <add>## Disadvantages <add> <add>* The only disadvantage is that the size of an array is fixed. (Hence, a list can be used in case of a dynamic sizing.)
1
PHP
PHP
move transport registration to separate class
30001aa8f5ac79dfdb27270f8bc82e8c37d7e0b1
<ide><path>src/Illuminate/Mail/MailServiceProvider.php <ide> <ide> use Swift_Mailer; <ide> use Illuminate\Support\ServiceProvider; <del>use Swift_SmtpTransport as SmtpTransport; <del>use Swift_MailTransport as MailTransport; <del>use Illuminate\Mail\Transport\LogTransport; <del>use Illuminate\Mail\Transport\MailgunTransport; <del>use Illuminate\Mail\Transport\MandrillTransport; <del>use Swift_SendmailTransport as SendmailTransport; <ide> <ide> class MailServiceProvider extends ServiceProvider { <ide> <ide> protected function setMailerDependencies($mailer, $app) <ide> */ <ide> public function registerSwiftMailer() <ide> { <del> $config = $this->app['config']['mail']; <del> <del> $this->registerSwiftTransport($config); <add> $this->registerSwiftTransport(); <ide> <ide> // Once we have the transporter registered, we will register the actual Swift <ide> // mailer instance, passing in the transport instances, which allows us to <ide> // override this transporter instances during app start-up if necessary. <ide> $this->app['swift.mailer'] = $this->app->share(function($app) <ide> { <del> return new Swift_Mailer($app['swift.transport']); <add> return new Swift_Mailer($app['swift.transport']->driver()); <ide> }); <ide> } <ide> <ide> /** <ide> * Register the Swift Transport instance. <ide> * <del> * @param array $config <del> * @return void <del> * <del> * @throws \InvalidArgumentException <del> */ <del> protected function registerSwiftTransport($config) <del> { <del> switch ($config['driver']) <del> { <del> case 'smtp': <del> return $this->registerSmtpTransport($config); <del> <del> case 'sendmail': <del> return $this->registerSendmailTransport($config); <del> <del> case 'mail': <del> return $this->registerMailTransport($config); <del> <del> case 'mailgun': <del> return $this->registerMailgunTransport($config); <del> <del> case 'mandrill': <del> return $this->registerMandrillTransport($config); <del> <del> case 'log': <del> return $this->registerLogTransport($config); <del> <del> default: <del> throw new \InvalidArgumentException('Invalid mail driver.'); <del> } <del> } <del> <del> /** <del> * Register the SMTP Swift Transport instance. <del> * <del> * @param array $config <del> * @return void <del> */ <del> protected function registerSmtpTransport($config) <del> { <del> $this->app['swift.transport'] = $this->app->share(function() use ($config) <del> { <del> extract($config); <del> <del> // The Swift SMTP transport instance will allow us to use any SMTP backend <del> // for delivering mail such as Sendgrid, Amazon SES, or a custom server <del> // a developer has available. We will just pass this configured host. <del> $transport = SmtpTransport::newInstance($host, $port); <del> <del> if (isset($encryption)) <del> { <del> $transport->setEncryption($encryption); <del> } <del> <del> // Once we have the transport we will check for the presence of a username <del> // and password. If we have it we will set the credentials on the Swift <del> // transporter instance so that we'll properly authenticate delivery. <del> if (isset($username)) <del> { <del> $transport->setUsername($username); <del> <del> $transport->setPassword($password); <del> } <del> <del> return $transport; <del> }); <del> } <del> <del> /** <del> * Register the Sendmail Swift Transport instance. <del> * <del> * @param array $config <del> * @return void <del> */ <del> protected function registerSendmailTransport($config) <del> { <del> $this->app['swift.transport'] = $this->app->share(function() use ($config) <del> { <del> return SendmailTransport::newInstance($config['sendmail']); <del> }); <del> } <del> <del> /** <del> * Register the Mail Swift Transport instance. <del> * <del> * @param array $config <del> * @return void <del> */ <del> protected function registerMailTransport($config) <del> { <del> $this->app['swift.transport'] = $this->app->share(function() <del> { <del> return MailTransport::newInstance(); <del> }); <del> } <del> <del> /** <del> * Register the Mailgun Swift Transport instance. <del> * <del> * @param array $config <del> * @return void <del> */ <del> protected function registerMailgunTransport($config) <del> { <del> $mailgun = $this->app['config']->get('services.mailgun', array()); <del> <del> $this->app->bindShared('swift.transport', function() use ($mailgun) <del> { <del> return new MailgunTransport($mailgun['secret'], $mailgun['domain']); <del> }); <del> } <del> <del> /** <del> * Register the Mandrill Swift Transport instance. <del> * <del> * @param array $config <del> * @return void <del> */ <del> protected function registerMandrillTransport($config) <del> { <del> $mandrill = $this->app['config']->get('services.mandrill', array()); <del> <del> $this->app->bindShared('swift.transport', function() use ($mandrill) <del> { <del> return new MandrillTransport($mandrill['secret']); <del> }); <del> } <del> <del> /** <del> * Register the "Log" Swift Transport instance. <del> * <del> * @param array $config <ide> * @return void <ide> */ <del> protected function registerLogTransport($config) <add> protected function registerSwiftTransport() <ide> { <del> $this->app->bindShared('swift.transport', function($app) <add> $this->app['swift.transport'] = $this->app->share(function($app) <ide> { <del> return new LogTransport($app['log']->getMonolog()); <add> return new TransportManager($app); <ide> }); <ide> } <ide> <ide><path>src/Illuminate/Mail/TransportManager.php <add><?php namespace Illuminate\Mail; <add> <add>use Illuminate\Support\Manager; <add>use Swift_SmtpTransport as SmtpTransport; <add>use Swift_MailTransport as MailTransport; <add>use Illuminate\Mail\Transport\LogTransport; <add>use Illuminate\Mail\Transport\MailgunTransport; <add>use Illuminate\Mail\Transport\MandrillTransport; <add>use Swift_SendmailTransport as SendmailTransport; <add> <add>class TransportManager extends Manager { <add> <add> /** <add> * Create an instance of the SMTP Swift Transport driver. <add> * <add> * @return \Swift_SmtpTransport <add> */ <add> protected function createSmtpDriver() <add> { <add> $config = $this->app['config']['mail']; <add> <add> // The Swift SMTP transport instance will allow us to use any SMTP backend <add> // for delivering mail such as Sendgrid, Amazon SES, or a custom server <add> // a developer has available. We will just pass this configured host. <add> $transport = SmtpTransport::newInstance($config['host'], $config['port']); <add> <add> if (isset($config['encryption'])) <add> { <add> $transport->setEncryption($config['encryption']); <add> } <add> <add> // Once we have the transport we will check for the presence of a username <add> // and password. If we have it we will set the credentials on the Swift <add> // transporter instance so that we'll properly authenticate delivery. <add> if (isset($config['username'])) <add> { <add> $transport->setUsername($config['username']); <add> <add> $transport->setPassword($config['password']); <add> } <add> <add> return $transport; <add> } <add> <add> /** <add> * Create an instance of the Sendmail Swift Transport driver. <add> * <add> * @return \Swift_SendmailTransport <add> */ <add> protected function createSendmailDriver() <add> { <add> $command = $this->app['config']['mail']['sendmail']; <add> <add> return SendmailTransport::newInstance($command); <add> } <add> <add> /** <add> * Create an instance of the Mail Swift Transport driver. <add> * <add> * @return \Swift_MailTransport <add> */ <add> protected function createMailDriver() <add> { <add> return MailTransport::newInstance(); <add> } <add> <add> /** <add> * Create an instance of the Mailgun Swift Transport driver. <add> * <add> * @return \Illuminate\Mail\Transport\MailgunTransport <add> */ <add> protected function createMailgunDriver() <add> { <add> $config = $this->app['config']->get('services.mailgun', array()); <add> <add> return new MailgunTransport($config['secret'], $config['domain']); <add> } <add> <add> /** <add> * Create an instance of the Mandrill Swift Transport driver. <add> * <add> * @return \Illuminate\Mail\Transport\MandrillTransport <add> */ <add> protected function createMandrillDriver() <add> { <add> $config = $this->app['config']->get('services.mandrill', array()); <add> <add> return new MandrillTransport($config['secret']); <add> } <add> <add> /** <add> * Create an instance of the Log Swift Transport driver. <add> * <add> * @return \Illuminate\Mail\Transport\LogTransport <add> */ <add> protected function createLogDriver() <add> { <add> return new LogTransport($this->app['log']->getMonolog()); <add> } <add> <add> /** <add> * Get the default cache driver name. <add> * <add> * @return string <add> */ <add> public function getDefaultDriver() <add> { <add> return $this->app['config']['mail.driver']; <add> } <add> <add> /** <add> * Set the default cache driver name. <add> * <add> * @param string $name <add> * @return void <add> */ <add> public function setDefaultDriver($name) <add> { <add> $this->app['config']['mail.driver'] = $name; <add> } <add> <add>}
2
Python
Python
add spaces around '-'
860c8b82939d1535351f7b651c284a55efe21b10
<ide><path>numpy/linalg/linalg.py <ide> def lstsq(a, b, rcond="warn"): <ide> equal to, or greater than its number of linearly independent columns). <ide> If `a` is square and of full rank, then `x` (but for round-off error) <ide> is the "exact" solution of the equation. Else, `x` minimizes the <del> Euclidean 2-norm :math:`||b-ax||`. If there are multiple minimizing <add> Euclidean 2-norm :math:`||b - ax||`. If there are multiple minimizing <ide> solutions, the one with the smallest 2-norm :math:`||x||` is returned. <ide> <ide> Parameters
1
Text
Text
fix typo in 0.12 rc blog post
32630cd8cf65f53cd683ec962994b508644b4f66
<ide><path>docs/_posts/2014-10-16-react-v0.12-rc1.md <ide> You do NOT need to change the way to define `key` and `ref`, only if you need to <ide> <ide> ## Breaking Change: Default Props Resolution <ide> <del>This is a subtle difference but `defaultProps` are now resolved at `ReactElement` creation time instead of when it's mounted. This is means that we can avoid allocating an extra object for the resolve props. <add>This is a subtle difference but `defaultProps` are now resolved at `ReactElement` creation time instead of when it's mounted. This is means that we can avoid allocating an extra object for the resolved props. <ide> <ide> You will primarily see this breaking if you're also using `transferPropsTo`. <ide>
1
Text
Text
use code markup/markdown in headers
79f6412f47adcefcc03d39f8c0037781c4ec566e
<ide><path>doc/api/url.md <ide> const myURL = <ide> <ide> ## The WHATWG URL API <ide> <del>### Class: URL <add>### Class: `URL` <ide> <!-- YAML <ide> added: <ide> - v7.0.0 <ide> using the `delete` keyword on any properties of `URL` objects (e.g. `delete <ide> myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still <ide> return `true`. <ide> <del>#### Constructor: new URL(input\[, base\]) <add>#### Constructor: `new URL(input[, base])` <ide> <ide> * `input` {string} The absolute or relative input URL to parse. If `input` <ide> is relative, then `base` is required. If `input` is absolute, the `base` <ide> myURL = new URL('foo:Example.com/', 'https://example.org/'); <ide> // foo:Example.com/ <ide> ``` <ide> <del>#### url.hash <add>#### `url.hash` <ide> <ide> * {string} <ide> <ide> are [percent-encoded][]. The selection of which characters to <ide> percent-encode may vary somewhat from what the [`url.parse()`][] and <ide> [`url.format()`][] methods would produce. <ide> <del>#### url.host <add>#### `url.host` <ide> <ide> * {string} <ide> <ide> console.log(myURL.href); <ide> <ide> Invalid host values assigned to the `host` property are ignored. <ide> <del>#### url.hostname <add>#### `url.hostname` <ide> <ide> * {string} <ide> <ide> console.log(myURL.href); <ide> <ide> Invalid hostname values assigned to the `hostname` property are ignored. <ide> <del>#### url.href <add>#### `url.href` <ide> <ide> * {string} <ide> <ide> object's properties will be modified. <ide> If the value assigned to the `href` property is not a valid URL, a `TypeError` <ide> will be thrown. <ide> <del>#### url.origin <add>#### `url.origin` <ide> <ide> * {string} <ide> <ide> console.log(idnURL.hostname); <ide> // Prints xn--g6w251d <ide> ``` <ide> <del>#### url.password <add>#### `url.password` <ide> <ide> * {string} <ide> <ide> are [percent-encoded][]. The selection of which characters to <ide> percent-encode may vary somewhat from what the [`url.parse()`][] and <ide> [`url.format()`][] methods would produce. <ide> <del>#### url.pathname <add>#### `url.pathname` <ide> <ide> * {string} <ide> <ide> property are [percent-encoded][]. The selection of which characters <ide> to percent-encode may vary somewhat from what the [`url.parse()`][] and <ide> [`url.format()`][] methods would produce. <ide> <del>#### url.port <add>#### `url.port` <ide> <ide> * {string} <ide> <ide> console.log(myURL.port); <ide> // Prints 4 (because it is the leading number in the string '4.567e21') <ide> ``` <ide> <del>#### url.protocol <add>#### `url.protocol` <ide> <ide> * {string} <ide> <ide> console.log(u.href); <ide> According to the WHATWG URL Standard, special protocol schemes are `ftp`, <ide> `file`, `gopher`, `http`, `https`, `ws`, and `wss`. <ide> <del>#### url.search <add>#### `url.search` <ide> <ide> * {string} <ide> <ide> property will be [percent-encoded][]. The selection of which <ide> characters to percent-encode may vary somewhat from what the [`url.parse()`][] <ide> and [`url.format()`][] methods would produce. <ide> <del>#### url.searchParams <add>#### `url.searchParams` <ide> <ide> * {URLSearchParams} <ide> <ide> URL. This property is read-only; to replace the entirety of query parameters of <ide> the URL, use the [`url.search`][] setter. See [`URLSearchParams`][] <ide> documentation for details. <ide> <del>#### url.username <add>#### `url.username` <ide> <ide> * {string} <ide> <ide> property will be [percent-encoded][]. The selection of which <ide> characters to percent-encode may vary somewhat from what the [`url.parse()`][] <ide> and [`url.format()`][] methods would produce. <ide> <del>#### url.toString() <add>#### `url.toString()` <ide> <ide> * Returns: {string} <ide> <ide> Because of the need for standard compliance, this method does not allow users <ide> to customize the serialization process of the URL. For more flexibility, <ide> [`require('url').format()`][] method might be of interest. <ide> <del>#### url.toJSON() <add>#### `url.toJSON()` <ide> <ide> * Returns: {string} <ide> <ide> console.log(JSON.stringify(myURLs)); <ide> // Prints ["https://www.example.com/","https://test.example.org/"] <ide> ``` <ide> <del>### Class: URLSearchParams <add>### Class: `URLSearchParams` <ide> <!-- YAML <ide> added: <ide> - v7.5.0 <ide> console.log(myURL.href); <ide> // Prints https://example.org/?a=b&a=c <ide> ``` <ide> <del>#### Constructor: new URLSearchParams() <add>#### Constructor: `new URLSearchParams()` <ide> <ide> Instantiate a new empty `URLSearchParams` object. <ide> <del>#### Constructor: new URLSearchParams(string) <add>#### Constructor: `new URLSearchParams(string)` <ide> <ide> * `string` {string} A query string <ide> <ide> console.log(params.toString()); <ide> // Prints 'user=abc&query=xyz' <ide> ``` <ide> <del>#### Constructor: new URLSearchParams(obj) <add>#### Constructor: `new URLSearchParams(obj)` <ide> <!-- YAML <ide> added: <ide> - v7.10.0 <ide> console.log(params.toString()); <ide> // Prints 'user=abc&query=first%2Csecond' <ide> ``` <ide> <del>#### Constructor: new URLSearchParams(iterable) <add>#### Constructor: `new URLSearchParams(iterable)` <ide> <!-- YAML <ide> added: <ide> - v7.10.0 <ide> new URLSearchParams([ <ide> // Each query pair must be an iterable [name, value] tuple <ide> ``` <ide> <del>#### urlSearchParams.append(name, value) <add>#### `urlSearchParams.append(name, value)` <ide> <ide> * `name` {string} <ide> * `value` {string} <ide> <ide> Append a new name-value pair to the query string. <ide> <del>#### urlSearchParams.delete(name) <add>#### `urlSearchParams.delete(name)` <ide> <ide> * `name` {string} <ide> <ide> Remove all name-value pairs whose name is `name`. <ide> <del>#### urlSearchParams.entries() <add>#### `urlSearchParams.entries()` <ide> <ide> * Returns: {Iterator} <ide> <ide> is the `name`, the second item of the `Array` is the `value`. <ide> <ide> Alias for [`urlSearchParams[iterator()`]. <ide> <del>#### urlSearchParams.forEach(fn\[, thisArg\]) <add>#### `urlSearchParams.forEach(fn[, thisArg])` <ide> <ide> * `fn` {Function} Invoked for each name-value pair in the query <ide> * `thisArg` {Object} To be used as `this` value for when `fn` is called <ide> myURL.searchParams.forEach((value, name, searchParams) => { <ide> // c d true <ide> ``` <ide> <del>#### urlSearchParams.get(name) <add>#### `urlSearchParams.get(name)` <ide> <ide> * `name` {string} <ide> * Returns: {string} or `null` if there is no name-value pair with the given <ide> myURL.searchParams.forEach((value, name, searchParams) => { <ide> Returns the value of the first name-value pair whose name is `name`. If there <ide> are no such pairs, `null` is returned. <ide> <del>#### urlSearchParams.getAll(name) <add>#### `urlSearchParams.getAll(name)` <ide> <ide> * `name` {string} <ide> * Returns: {string[]} <ide> <ide> Returns the values of all name-value pairs whose name is `name`. If there are <ide> no such pairs, an empty array is returned. <ide> <del>#### urlSearchParams.has(name) <add>#### `urlSearchParams.has(name)` <ide> <ide> * `name` {string} <ide> * Returns: {boolean} <ide> <ide> Returns `true` if there is at least one name-value pair whose name is `name`. <ide> <del>#### urlSearchParams.keys() <add>#### `urlSearchParams.keys()` <ide> <ide> * Returns: {Iterator} <ide> <ide> for (const name of params.keys()) { <ide> // foo <ide> ``` <ide> <del>#### urlSearchParams.set(name, value) <add>#### `urlSearchParams.set(name, value)` <ide> <ide> * `name` {string} <ide> * `value` {string} <ide> console.log(params.toString()); <ide> // Prints foo=def&abc=def&xyz=opq <ide> ``` <ide> <del>#### urlSearchParams.sort() <add>#### `urlSearchParams.sort()` <ide> <!-- YAML <ide> added: <ide> - v7.7.0 <ide> console.log(params.toString()); <ide> // Prints query%5B%5D=abc&query%5B%5D=123&type=search <ide> ``` <ide> <del>#### urlSearchParams.toString() <add>#### `urlSearchParams.toString()` <ide> <ide> * Returns: {string} <ide> <ide> Returns the search parameters serialized as a string, with characters <ide> percent-encoded where necessary. <ide> <del>#### urlSearchParams.values() <add>#### `urlSearchParams.values()` <ide> <ide> * Returns: {Iterator} <ide> <ide> Returns an ES6 `Iterator` over the values of each name-value pair. <ide> <del>#### urlSearchParams\[Symbol.iterator\]() <add>#### `urlSearchParams[Symbol.iterator]()` <ide> <ide> * Returns: {Iterator} <ide> <ide> for (const [name, value] of params) { <ide> // xyz baz <ide> ``` <ide> <del>### url.domainToASCII(domain) <add>### `url.domainToASCII(domain)` <ide> <!-- YAML <ide> added: <ide> - v7.4.0 <ide> console.log(url.domainToASCII('xn--iñvalid.com')); <ide> // Prints an empty string <ide> ``` <ide> <del>### url.domainToUnicode(domain) <add>### `url.domainToUnicode(domain)` <ide> <!-- YAML <ide> added: <ide> - v7.4.0 <ide> console.log(url.domainToUnicode('xn--iñvalid.com')); <ide> // Prints an empty string <ide> ``` <ide> <del>### url.fileURLToPath(url) <add>### `url.fileURLToPath(url)` <ide> <!-- YAML <ide> added: v10.12.0 <ide> --> <ide> new URL('file:///hello world').pathname; // Incorrect: /hello%20world <ide> fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX) <ide> ``` <ide> <del>### url.format(URL\[, options\]) <add>### `url.format(URL[, options])` <ide> <!-- YAML <ide> added: v7.6.0 <ide> --> <ide> console.log(url.format(myURL, { fragment: false, unicode: true, auth: false })); <ide> // Prints 'https://測試/?abc' <ide> ``` <ide> <del>### url.pathToFileURL(path) <add>### `url.pathToFileURL(path)` <ide> <!-- YAML <ide> added: v10.12.0 <ide> --> <ide> changes: <ide> The legacy `urlObject` (`require('url').Url`) is created and returned by the <ide> `url.parse()` function. <ide> <del>#### urlObject.auth <add>#### `urlObject.auth` <ide> <ide> The `auth` property is the username and password portion of the URL, also <ide> referred to as _userinfo_. This string subset follows the `protocol` and <ide> by `:`. <ide> <ide> For example: `'user:pass'`. <ide> <del>#### urlObject.hash <add>#### `urlObject.hash` <ide> <ide> The `hash` property is the fragment identifier portion of the URL including the <ide> leading `#` character. <ide> <ide> For example: `'#hash'`. <ide> <del>#### urlObject.host <add>#### `urlObject.host` <ide> <ide> The `host` property is the full lower-cased host portion of the URL, including <ide> the `port` if specified. <ide> <ide> For example: `'sub.example.com:8080'`. <ide> <del>#### urlObject.hostname <add>#### `urlObject.hostname` <ide> <ide> The `hostname` property is the lower-cased host name portion of the `host` <ide> component *without* the `port` included. <ide> <ide> For example: `'sub.example.com'`. <ide> <del>#### urlObject.href <add>#### `urlObject.href` <ide> <ide> The `href` property is the full URL string that was parsed with both the <ide> `protocol` and `host` components converted to lower-case. <ide> <ide> For example: `'http://user:[email protected]:8080/p/a/t/h?query=string#hash'`. <ide> <del>#### urlObject.path <add>#### `urlObject.path` <ide> <ide> The `path` property is a concatenation of the `pathname` and `search` <ide> components. <ide> For example: `'/p/a/t/h?query=string'`. <ide> <ide> No decoding of the `path` is performed. <ide> <del>#### urlObject.pathname <add>#### `urlObject.pathname` <ide> <ide> The `pathname` property consists of the entire path section of the URL. This <ide> is everything following the `host` (including the `port`) and before the start <ide> For example: `'/p/a/t/h'`. <ide> <ide> No decoding of the path string is performed. <ide> <del>#### urlObject.port <add>#### `urlObject.port` <ide> <ide> The `port` property is the numeric port portion of the `host` component. <ide> <ide> For example: `'8080'`. <ide> <del>#### urlObject.protocol <add>#### `urlObject.protocol` <ide> <ide> The `protocol` property identifies the URL's lower-cased protocol scheme. <ide> <ide> For example: `'http:'`. <ide> <del>#### urlObject.query <add>#### `urlObject.query` <ide> <ide> The `query` property is either the query string without the leading ASCII <ide> question mark (`?`), or an object returned by the [`querystring`][] module's <ide> For example: `'query=string'` or `{'query': 'string'}`. <ide> If returned as a string, no decoding of the query string is performed. If <ide> returned as an object, both keys and values are decoded. <ide> <del>#### urlObject.search <add>#### `urlObject.search` <ide> <ide> The `search` property consists of the entire "query string" portion of the <ide> URL, including the leading ASCII question mark (`?`) character. <ide> For example: `'?query=string'`. <ide> <ide> No decoding of the query string is performed. <ide> <del>#### urlObject.slashes <add>#### `urlObject.slashes` <ide> <ide> The `slashes` property is a `boolean` with a value of `true` if two ASCII <ide> forward-slash characters (`/`) are required following the colon in the <ide> `protocol`. <ide> <del>### url.format(urlObject) <add>### `url.format(urlObject)` <ide> <!-- YAML <ide> added: v0.1.25 <ide> changes: <ide> The formatting process operates as follows: <ide> string, an [`Error`][] is thrown. <ide> * `result` is returned. <ide> <del>### url.parse(urlString\[, parseQueryString\[, slashesDenoteHost\]\]) <add>### `url.parse(urlString[, parseQueryString[, slashesDenoteHost]])` <ide> <!-- YAML <ide> added: v0.1.25 <ide> changes: <ide> A `TypeError` is thrown if `urlString` is not a string. <ide> <ide> A `URIError` is thrown if the `auth` property is present but cannot be decoded. <ide> <del>### url.resolve(from, to) <add>### `url.resolve(from, to)` <ide> <!-- YAML <ide> added: v0.1.25 <ide> changes:
1
PHP
PHP
fix invalid tags
2a217b485c5054847e6e4a733329e0756b153968
<ide><path>src/Validation/Validation.php <ide> public static function time($check): bool <ide> * @param string|int|null $format any format accepted by IntlDateFormatter <ide> * @return bool Success <ide> * @throws \InvalidArgumentException when unsupported $type given <del> * @see \Cake\I18n\Time::parseDate(), \Cake\I18n\Time::parseTime(), \Cake\I18n\Time::parseDateTime() <add> * @see \Cake\I18n\Time::parseDate() <add> * @see \Cake\I18n\Time::parseTime() <add> * @see \Cake\I18n\Time::parseDateTime() <ide> */ <ide> public static function localizedTime($check, string $type = 'datetime', $format = null): bool <ide> { <ide><path>src/View/SerializedView.php <ide> abstract class SerializedView extends View <ide> * names. If true all view variables will be serialized. If null or false <ide> * normal view template will be rendered. <ide> * <del> * @var array{serialize:string|bool|null} <add> * @var array <add> * @psalm-var array{serialize:string|bool|null} <ide> */ <ide> protected $_defaultConfig = [ <ide> 'serialize' => null,
2
Javascript
Javascript
use lanes instead of priority event constants
35f7441d374bfa7be8e3e9576fd1388333df49cb
<ide><path>packages/react-dom/src/events/ReactDOMEventListener.js <ide> import type {AnyNativeEvent} from '../events/PluginModuleType'; <ide> import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes'; <ide> import type {Container, SuspenseInstance} from '../client/ReactDOMHostConfig'; <ide> import type {DOMEventName} from '../events/DOMEventNames'; <del>import type {EventPriority} from 'shared/ReactTypes'; <ide> <ide> // Intentionally not named imports because Rollup would use dynamic dispatch for <ide> // CommonJS interop named imports. <ide> import { <ide> decoupleUpdatePriorityFromScheduler, <ide> enableNewReconciler, <ide> } from 'shared/ReactFeatureFlags'; <del>import {ContinuousEvent, DefaultEvent, DiscreteEvent} from 'shared/ReactTypes'; <ide> import {dispatchEventForPluginEventSystem} from './DOMPluginEventSystem'; <ide> import { <ide> flushDiscreteUpdatesIfNeeded, <ide> discreteUpdates, <ide> } from './ReactDOMUpdateBatching'; <ide> <ide> import { <add> InputDiscreteLanePriority as InputDiscreteLanePriority_old, <ide> InputContinuousLanePriority as InputContinuousLanePriority_old, <add> DefaultLanePriority as DefaultLanePriority_old, <ide> getCurrentUpdateLanePriority as getCurrentUpdateLanePriority_old, <ide> setCurrentUpdateLanePriority as setCurrentUpdateLanePriority_old, <ide> } from 'react-reconciler/src/ReactFiberLane.old'; <ide> import { <add> InputDiscreteLanePriority as InputDiscreteLanePriority_new, <ide> InputContinuousLanePriority as InputContinuousLanePriority_new, <add> DefaultLanePriority as DefaultLanePriority_new, <ide> getCurrentUpdateLanePriority as getCurrentUpdateLanePriority_new, <ide> setCurrentUpdateLanePriority as setCurrentUpdateLanePriority_new, <ide> } from 'react-reconciler/src/ReactFiberLane.new'; <ide> <add>const InputDiscreteLanePriority = enableNewReconciler <add> ? InputDiscreteLanePriority_new <add> : InputDiscreteLanePriority_old; <ide> const InputContinuousLanePriority = enableNewReconciler <ide> ? InputContinuousLanePriority_new <ide> : InputContinuousLanePriority_old; <add>const DefaultLanePriority = enableNewReconciler <add> ? DefaultLanePriority_new <add> : DefaultLanePriority_old; <ide> const getCurrentUpdateLanePriority = enableNewReconciler <ide> ? getCurrentUpdateLanePriority_new <ide> : getCurrentUpdateLanePriority_old; <ide> export function createEventListenerWrapperWithPriority( <ide> domEventName: DOMEventName, <ide> eventSystemFlags: EventSystemFlags, <ide> ): Function { <del> const eventPriority = getEventPriorityForPluginSystem(domEventName); <add> const eventPriority = getEventPriority(domEventName); <ide> let listenerWrapper; <ide> switch (eventPriority) { <del> case DiscreteEvent: <add> case InputDiscreteLanePriority: <ide> listenerWrapper = dispatchDiscreteEvent; <ide> break; <del> case ContinuousEvent: <add> case InputContinuousLanePriority: <ide> listenerWrapper = dispatchContinuousEvent; <ide> break; <del> case DefaultEvent: <add> case DefaultLanePriority: <ide> default: <ide> listenerWrapper = dispatchEvent; <ide> break; <ide> export function attemptToDispatchEvent( <ide> return null; <ide> } <ide> <del>function getEventPriorityForPluginSystem( <del> domEventName: DOMEventName, <del>): EventPriority { <add>function getEventPriority(domEventName: DOMEventName) { <ide> switch (domEventName) { <ide> // Used by SimpleEventPlugin: <ide> case 'cancel': <ide> function getEventPriorityForPluginSystem( <ide> // eslint-disable-next-line no-fallthrough <ide> case 'beforeblur': <ide> case 'afterblur': <del> return DiscreteEvent; <add> return InputDiscreteLanePriority; <ide> case 'drag': <ide> case 'dragenter': <ide> case 'dragexit': <ide> function getEventPriorityForPluginSystem( <ide> case 'toggle': <ide> case 'touchmove': <ide> case 'wheel': <del> return ContinuousEvent; <add> return InputContinuousLanePriority; <ide> default: <del> return DefaultEvent; <add> return DefaultLanePriority; <ide> } <ide> } <ide><path>packages/shared/ReactTypes.js <ide> export type RefObject = {| <ide> current: any, <ide> |}; <ide> <del>export type EventPriority = 0 | 1 | 2; <del> <del>export const DiscreteEvent: EventPriority = 0; <del>export const ContinuousEvent: EventPriority = 1; <del>export const DefaultEvent: EventPriority = 2; <del> <ide> export type ReactScope = {| <ide> $$typeof: Symbol | number, <ide> |};
2
Text
Text
add rezerotransformer to readme
f499e880b6cb5b0b47f3ddc0af8ed085ca8e278d
<ide><path>official/nlp/modeling/layers/README.md <ide> for auto-agressive decoding. <ide> * [Transformer](transformer.py) implements an optionally masked transformer as <ide> described in ["Attention Is All You Need"](https://arxiv.org/abs/1706.03762). <ide> <add>* [ReZeroTransformer](rezero_transformer.py) implements Transformer with ReZero <add>described in ["ReZero is All You Need: Fast Convergence at Large Depth"](https://arxiv.org/abs/2003.04887). <add> <ide> * [OnDeviceEmbedding](on_device_embedding.py) implements efficient embedding lookups designed for TPU-based models. <ide> <ide> * [PositionalEmbedding](position_embedding.py) creates a positional embedding
1
Ruby
Ruby
fix the interlock middleware
48a735aff7032afaf5534613b10c635acead042a
<ide><path>actionpack/lib/action_dispatch/middleware/load_interlock.rb <ide> require 'active_support/dependencies' <del>require 'rack/lock' <add>require 'rack/body_proxy' <ide> <ide> module ActionDispatch <del> class LoadInterlock < ::Rack::Lock <del> FLAG = 'activesupport.dependency_race'.freeze <add> class LoadInterlock <add> def initialize(app) <add> @app = app <add> end <ide> <del> def initialize(app, mutex = ::ActiveSupport::Dependencies.interlock) <del> super <add> def call(env) <add> interlock = ActiveSupport::Dependencies.interlock <add> interlock.start_running <add> response = @app.call(env) <add> body = Rack::BodyProxy.new(response[2]) { interlock.done_running } <add> response[2] = body <add> response <add> ensure <add> interlock.done_running unless body <ide> end <ide> end <ide> end
1
Go
Go
use same signature on windows
6e5a304675648a9f3d9b0ae95e7610337c8bd6c3
<ide><path>container/container_windows.go <ide> func (container *Container) ConfigsDirPath() string { <ide> } <ide> <ide> // ConfigFilePath returns the path to the on-disk location of a config. <del>func (container *Container) ConfigFilePath(configRef swarmtypes.ConfigReference) string { <del> return filepath.Join(container.ConfigsDirPath(), configRef.ConfigID) <add>func (container *Container) ConfigFilePath(configRef swarmtypes.ConfigReference) (string, error) { <add> return filepath.Join(container.ConfigsDirPath(), configRef.ConfigID), nil <ide> } <ide><path>daemon/container_operations_windows.go <ide> func (daemon *Daemon) setupConfigDir(c *container.Container) (setupErr error) { <ide> continue <ide> } <ide> <del> fPath := c.ConfigFilePath(*configRef) <add> fPath, err := c.ConfigFilePath(*configRef) <add> if err != nil { <add> return errors.Wrap(err, "error getting config file path for container") <add> } <ide> log := logrus.WithFields(logrus.Fields{"name": configRef.File.Name, "path": fPath}) <ide> <ide> log.Debug("injecting config")
2
Ruby
Ruby
invert the conditionals to make easier to read
baf62e531686ee157746d239037be121f8191275
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb <ide> def column_exists?(table_name, column_name, type = nil, options = {}) <ide> def create_table(table_name, options = {}) <ide> td = create_table_definition table_name, options[:temporary], options[:options], options[:as] <ide> <del> unless options[:id] == false || options[:as] <del> pk = options.fetch(:primary_key) { <add> if options[:id] != false && !options[:as] <add> pk = options.fetch(:primary_key) do <ide> Base.get_primary_key table_name.to_s.singularize <del> } <add> end <ide> <ide> td.primary_key pk, options.fetch(:id, :primary_key), options <ide> end <ide> def create_table(table_name, options = {}) <ide> end <ide> <ide> result = execute schema_creation.accept td <del> td.indexes.each_pair { |c,o| add_index table_name, c, o } unless supports_indexes_in_create? <add> td.indexes.each_pair { |c, o| add_index(table_name, c, o) } unless supports_indexes_in_create? <ide> result <ide> end <ide>
1
Text
Text
add missing space
b5b7c3b432cf60ff5b5e11ee4bc7df85a4185d1e
<ide><path>doc/api/errors.md <ide> urlSearchParams.has.call(buf, 'foo'); <ide> ### ERR_INVALID_TUPLE <ide> <ide> Used when an element in the `iterable` provided to the [WHATWG][WHATWG URL <del>API] [`URLSearchParams`constructor][`new URLSearchParams(iterable)`] does not <add>API] [`URLSearchParams` constructor][`new URLSearchParams(iterable)`] does not <ide> represent a `[name, value]` tuple – that is, if an element is not iterable, or <ide> does not consist of exactly two elements. <ide>
1
Ruby
Ruby
fix typo on the variable name
d4df7ce7b356835208141e6ac8e5ffb09ece8401
<ide><path>actionview/lib/action_view/renderer/partial_renderer.rb <ide> def collection_with_template <ide> layout = find_template(layout, @template_keys) <ide> end <ide> <del> partial_interation = PartialIteration.new(@collection.size) <del> locals[iteration] = partial_interation <add> partial_iteration = PartialIteration.new(@collection.size) <add> locals[iteration] = partial_iteration <ide> <ide> @collection.map do |object| <ide> locals[as] = object <del> locals[counter] = partial_interation.index <add> locals[counter] = partial_iteration.index <ide> <ide> content = template.render(view, locals) <ide> content = layout.render(view, locals) { content } if layout <del> partial_interation.iterate! <add> partial_iteration.iterate! <ide> content <ide> end <ide> end <ide> def collection_without_template <ide> cache = {} <ide> keys = @locals.keys <ide> <del> partial_interation = PartialIteration.new(@collection.size) <add> partial_iteration = PartialIteration.new(@collection.size) <ide> <ide> @collection.map do |object| <del> index = partial_interation.index <add> index = partial_iteration.index <ide> path, as, counter, iteration = collection_data[index] <ide> <ide> locals[as] = object <ide> locals[counter] = index <del> locals[iteration] = partial_interation <add> locals[iteration] = partial_iteration <ide> <ide> template = (cache[path] ||= find_template(path, keys + [as, counter])) <ide> content = template.render(view, locals) <del> partial_interation.iterate! <add> partial_iteration.iterate! <ide> content <ide> end <ide> end
1
Python
Python
pass a `context` when chaining fail results
5c47c1ff1aebd04b8e6b47255414e6f121b5c59f
<ide><path>celery/backends/base.py <ide> def mark_as_failure(self, task_id, exc, <ide> except (AttributeError, TypeError): <ide> chain_data = tuple() <ide> for chain_elem in chain_data: <del> chain_elem_opts = chain_elem['options'] <add> # Reconstruct a `Context` object for the chained task which has <add> # enough information to for backends to work with <add> chain_elem_ctx = Context(chain_elem) <add> chain_elem_ctx.update(chain_elem_ctx.options) <add> chain_elem_ctx.id = chain_elem_ctx.options.get('task_id') <add> chain_elem_ctx.group = chain_elem_ctx.options.get('group_id') <ide> # If the state should be propagated, we'll do so for all <ide> # elements of the chain. This is only truly important so <ide> # that the last chain element which controls completion of <ide> # the chain itself is marked as completed to avoid stalls. <del> if store_result and state in states.PROPAGATE_STATES: <del> try: <del> chained_task_id = chain_elem_opts['task_id'] <del> except KeyError: <del> pass <del> else: <del> self.store_result( <del> chained_task_id, exc, state, <del> traceback=traceback, request=chain_elem <del> ) <add> # <add> # Some chained elements may be complex signatures and have no <add> # task ID of their own, so we skip them hoping that not <add> # descending through them is OK. If the last chain element is <add> # complex, we assume it must have been uplifted to a chord by <add> # the canvas code and therefore the condition below will ensure <add> # that we mark something as being complete as avoid stalling. <add> if ( <add> store_result and state in states.PROPAGATE_STATES and <add> chain_elem_ctx.task_id is not None <add> ): <add> self.store_result( <add> chain_elem_ctx.task_id, exc, state, <add> traceback=traceback, request=chain_elem_ctx, <add> ) <ide> # If the chain element is a member of a chord, we also need <ide> # to call `on_chord_part_return()` as well to avoid stalls. <del> if 'chord' in chain_elem_opts: <del> failed_ctx = Context(chain_elem) <del> failed_ctx.update(failed_ctx.options) <del> failed_ctx.id = failed_ctx.options['task_id'] <del> failed_ctx.group = failed_ctx.options['group_id'] <del> self.on_chord_part_return(failed_ctx, state, exc) <add> if 'chord' in chain_elem_ctx.options: <add> self.on_chord_part_return(chain_elem_ctx, state, exc) <ide> # And finally we'll fire any errbacks <ide> if call_errbacks and request.errbacks: <ide> self._call_task_errbacks(request, exc, traceback)
1
Java
Java
add a base activity for react native apps. fixes
935cbb76c02cffd378a8f391c6e7443a3da13adc
<ide><path>ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java <add>package com.facebook.react; <add> <add>import android.app.Activity; <add>import android.content.Intent; <add>import android.os.Build; <add>import android.os.Bundle; <add>import android.os.Handler; <add>import android.provider.Settings; <add>import android.view.KeyEvent; <add>import android.widget.EditText; <add>import android.widget.Toast; <add> <add>import com.facebook.common.logging.FLog; <add>import com.facebook.react.common.ReactConstants; <add>import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; <add> <add>import java.util.List; <add> <add>import javax.annotation.Nullable; <add> <add>/** <add> * Base Activity for React Native applications. <add> */ <add>public abstract class ReactActivity extends Activity implements DefaultHardwareBackBtnHandler { <add> <add> private static final String REDBOX_PERMISSION_MESSAGE = <add> "Overlay permissions needs to be granted in order for react native apps to run in dev mode"; <add> <add> private @Nullable ReactInstanceManager mReactInstanceManager; <add> private LifecycleState mLifecycleState = LifecycleState.BEFORE_RESUME; <add> private boolean mDoRefresh = false; <add> <add> /** <add> * Returns the name of the bundle in assets. If this is null, and no file path is specified for <add> * the bundle, the app will only work with {@code getUseDeveloperSupport} enabled and will <add> * always try to load the JS bundle from the packager server. <add> * e.g. "index.android.bundle" <add> */ <add> protected @Nullable String getBundleAssetName() { <add> return "index.android.bundle"; <add> }; <add> <add> /** <add> * Returns a custom path of the bundle file. This is used in cases the bundle should be loaded <add> * from a custom path. By default it is loaded from Android assets, from a path specified <add> * by {@link getBundleAssetName}. <add> * e.g. "file://sdcard/myapp_cache/index.android.bundle" <add> */ <add> protected @Nullable String getJSBundleFile() { <add> return null; <add> } <add> <add> /** <add> * Returns the name of the main module. Determines the URL used to fetch the JS bundle <add> * from the packager server. It is only used when dev support is enabled. <add> * This is the first file to be executed once the {@link ReactInstanceManager} is created. <add> * e.g. "index.android" <add> */ <add> protected String getJSMainModuleName() { <add> return "index.android"; <add> } <add> <add> /** <add> * Returns the name of the main component registered from JavaScript. <add> * This is used to schedule rendering of the component. <add> * e.g. "MoviesApp" <add> */ <add> protected abstract String getMainComponentName(); <add> <add> /** <add> * Returns whether dev mode should be enabled. This enables e.g. the dev menu. <add> */ <add> protected abstract boolean getUseDeveloperSupport(); <add> <add> /** <add> * Returns a list of {@link ReactPackage} used by the app. <add> * You'll most likely want to return at least the {@code MainReactPackage}. <add> * If your app uses additional views or modules besides the default ones, <add> * you'll want to include more packages here. <add> */ <add> protected abstract List<ReactPackage> getPackages(); <add> <add> /** <add> * A subclass may override this method if it needs to use a custom instance. <add> */ <add> protected ReactInstanceManager createReactInstanceManager() { <add> ReactInstanceManager.Builder builder = ReactInstanceManager.builder() <add> .setApplication(getApplication()) <add> .setJSMainModuleName(getJSMainModuleName()) <add> .setUseDeveloperSupport(getUseDeveloperSupport()) <add> .setInitialLifecycleState(mLifecycleState); <add> <add> for (ReactPackage reactPackage : getPackages()) { <add> builder.addPackage(reactPackage); <add> } <add> <add> String jsBundleFile = getJSBundleFile(); <add> <add> if (jsBundleFile != null) { <add> builder.setJSBundleFile(jsBundleFile); <add> } else { <add> builder.setBundleAssetName(getBundleAssetName()); <add> } <add> <add> return builder.build(); <add> } <add> <add> /** <add> * A subclass may override this method if it needs to use a custom {@link ReactRootView}. <add> */ <add> protected ReactRootView createRootView() { <add> return new ReactRootView(this); <add> } <add> <add> @Override <add> protected void onCreate(Bundle savedInstanceState) { <add> super.onCreate(savedInstanceState); <add> <add> if (getUseDeveloperSupport() && Build.VERSION.SDK_INT >= 23) { <add> // Get permission to show redbox in dev builds. <add> if (!Settings.canDrawOverlays(this)) { <add> Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); <add> startActivity(serviceIntent); <add> FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE); <add> Toast.makeText(this, REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show(); <add> } <add> } <add> <add> mReactInstanceManager = createReactInstanceManager(); <add> ReactRootView mReactRootView = createRootView(); <add> mReactRootView.startReactApplication(mReactInstanceManager, getMainComponentName()); <add> setContentView(mReactRootView); <add> } <add> <add> @Override <add> protected void onPause() { <add> super.onPause(); <add> <add> mLifecycleState = LifecycleState.BEFORE_RESUME; <add> <add> if (mReactInstanceManager != null) { <add> mReactInstanceManager.onPause(); <add> } <add> } <add> <add> @Override <add> protected void onResume() { <add> super.onResume(); <add> <add> mLifecycleState = LifecycleState.RESUMED; <add> <add> if (mReactInstanceManager != null) { <add> mReactInstanceManager.onResume(this, this); <add> } <add> } <add> <add> @Override <add> protected void onDestroy() { <add> super.onDestroy(); <add> <add> if (mReactInstanceManager != null) { <add> mReactInstanceManager.onDestroy(); <add> } <add> } <add> <add> @Override <add> public void onActivityResult(int requestCode, int resultCode, Intent data) { <add> if (mReactInstanceManager != null) { <add> mReactInstanceManager.onActivityResult(requestCode, resultCode, data); <add> } <add> } <add> <add> @Override <add> public boolean onKeyUp(int keyCode, KeyEvent event) { <add> if (mReactInstanceManager != null && <add> mReactInstanceManager.getDevSupportManager().getDevSupportEnabled()) { <add> if (keyCode == KeyEvent.KEYCODE_MENU) { <add> mReactInstanceManager.showDevOptionsDialog(); <add> return true; <add> } <add> if (keyCode == KeyEvent.KEYCODE_R && !(getCurrentFocus() instanceof EditText)) { <add> // Enable double-tap-R-to-reload <add> if (mDoRefresh) { <add> mReactInstanceManager.getDevSupportManager().handleReloadJS(); <add> mDoRefresh = false; <add> } else { <add> mDoRefresh = true; <add> new Handler().postDelayed( <add> new Runnable() { <add> @Override <add> public void run() { <add> mDoRefresh = false; <add> } <add> }, <add> 200); <add> } <add> } <add> } <add> return super.onKeyUp(keyCode, event); <add> } <add> <add> @Override <add> public void onBackPressed() { <add> if (mReactInstanceManager != null) { <add> mReactInstanceManager.onBackPressed(); <add> } else { <add> super.onBackPressed(); <add> } <add> } <add> <add> @Override <add> public void invokeDefaultOnBackPressed() { <add> super.onBackPressed(); <add> } <add>} <ide><path>local-cli/generator-android/templates/package/MainActivity.java <ide> package <%= package %>; <ide> <del>import android.app.Activity; <del>import android.os.Bundle; <del>import android.view.KeyEvent; <del> <del>import com.facebook.react.LifecycleState; <del>import com.facebook.react.ReactInstanceManager; <del>import com.facebook.react.ReactRootView; <del>import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; <add>import com.facebook.react.ReactActivity; <ide> import com.facebook.react.shell.MainReactPackage; <del>import com.facebook.soloader.SoLoader; <del> <del>public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { <del> <del> private ReactInstanceManager mReactInstanceManager; <del> private ReactRootView mReactRootView; <del> <del> @Override <del> protected void onCreate(Bundle savedInstanceState) { <del> super.onCreate(savedInstanceState); <del> mReactRootView = new ReactRootView(this); <del> <del> mReactInstanceManager = ReactInstanceManager.builder() <del> .setApplication(getApplication()) <del> .setBundleAssetName("index.android.bundle") <del> .setJSMainModuleName("index.android") <del> .addPackage(new MainReactPackage()) <del> .setUseDeveloperSupport(BuildConfig.DEBUG) <del> .setInitialLifecycleState(LifecycleState.RESUMED) <del> .build(); <del> <del> mReactRootView.startReactApplication(mReactInstanceManager, "<%= name %>", null); <del> <del> setContentView(mReactRootView); <del> } <del> <del> @Override <del> public boolean onKeyUp(int keyCode, KeyEvent event) { <del> if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) { <del> mReactInstanceManager.showDevOptionsDialog(); <del> return true; <del> } <del> return super.onKeyUp(keyCode, event); <del> } <ide> <del> @Override <del> public void onBackPressed() { <del> if (mReactInstanceManager != null) { <del> mReactInstanceManager.onBackPressed(); <del> } else { <del> super.onBackPressed(); <del> } <del> } <add>public class MainActivity extends ReactActivity { <ide> <add> /** <add> * Returns the name of the main component registered from JavaScript. <add> * This is used to schedule rendering of the component. <add> */ <ide> @Override <del> public void invokeDefaultOnBackPressed() { <del> super.onBackPressed(); <add> protected String getMainComponentName() { <add> return "<%= name %>"; <ide> } <ide> <add> /** <add> * Returns whether dev mode should be enabled. <add> * This enables e.g. the dev menu. <add> */ <ide> @Override <del> protected void onPause() { <del> super.onPause(); <del> <del> if (mReactInstanceManager != null) { <del> mReactInstanceManager.onPause(); <del> } <add> protected boolean getUseDeveloperSupport() { <add> return BuildConfig.DEBUG; <ide> } <ide> <add> /** <add> * A list of packages used by the app. If the app uses additional views <add> * or modules besides the default ones, add more packages here. <add> */ <ide> @Override <del> protected void onResume() { <del> super.onResume(); <del> <del> if (mReactInstanceManager != null) { <del> mReactInstanceManager.onResume(this, this); <del> } <add> protected abstract List<ReactPackage> getPackages() { <add> return Arrays.<ReactPackage>asList( <add> new MainReactPackage()); <ide> } <ide> }
2
Text
Text
replace inline code blocks
b5ed2619eb09cd9c0f18fc6ab59f46e5fd1cc79e
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md <ide> You can add new properties to existing JavaScript objects the same way you would <ide> <ide> Here's how we would add a `bark` property to `ourDog`: <ide> <del>`ourDog.bark = "bow-wow";` <add>```js <add>ourDog.bark = "bow-wow"; <add>``` <ide> <ide> or <ide> <del>`ourDog["bark"] = "bow-wow";` <add>```js <add>ourDog["bark"] = "bow-wow"; <add>``` <ide> <ide> Now when we evaluate `ourDog.bark`, we'll get his bark, `bow-wow`. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md <ide> If you'll recall from our discussion of [Storing Values with the Assignment Oper <ide> <ide> Assume we have pre-defined a function `sum` which adds two numbers together, then: <ide> <del>`ourSum = sum(5, 12);` <add>```js <add>ourSum = sum(5, 12); <add>``` <ide> <ide> will call `sum` function, which returns a value of `17` and assigns it to `ourSum` variable. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md <ide> dashedName: compound-assignment-with-augmented-addition <ide> <ide> In programming, it is common to use assignments to modify the contents of a variable. Remember that everything to the right of the equals sign is evaluated first, so we can say: <ide> <del>`myVar = myVar + 5;` <add>```js <add>myVar = myVar + 5; <add>``` <ide> <ide> to add `5` to `myVar`. Since this is such a common pattern, there are operators which do both a mathematical operation and assignment in one step. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md <ide> dashedName: compound-assignment-with-augmented-division <ide> <ide> The `/=` operator divides a variable by another number. <ide> <del>`myVar = myVar / 5;` <add>```js <add>myVar = myVar / 5; <add>``` <ide> <ide> Will divide `myVar` by `5`. This can be rewritten as: <ide> <del>`myVar /= 5;` <add>```js <add>myVar /= 5; <add>``` <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md <ide> dashedName: compound-assignment-with-augmented-multiplication <ide> <ide> The `*=` operator multiplies a variable by a number. <ide> <del>`myVar = myVar * 5;` <add>```js <add>myVar = myVar * 5; <add>``` <ide> <ide> will multiply `myVar` by `5`. This can be rewritten as: <ide> <del>`myVar *= 5;` <add>```js <add>myVar *= 5; <add>``` <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md <ide> dashedName: compound-assignment-with-augmented-subtraction <ide> <ide> Like the `+=` operator, `-=` subtracts a number from a variable. <ide> <del>`myVar = myVar - 5;` <add>```js <add>myVar = myVar - 5; <add>``` <ide> <ide> will subtract `5` from `myVar`. This can be rewritten as: <ide> <del>`myVar -= 5;` <add>```js <add>myVar -= 5; <add>``` <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md <ide> Having more high cards remaining in the deck favors the player. Each card is ass <ide> <ide> You will write a card counting function. It will receive a `card` parameter, which can be a number or a string, and increment or decrement the global `count` variable according to the card's value (see table). The function will then return a string with the current count and the string `Bet` if the count is positive, or `Hold` if the count is zero or negative. The current count and the player's decision (`Bet` or `Hold`) should be separated by a single space. <ide> <del>**Example Output** <del>`-3 Hold` <del>`5 Bet` <add>**Example Outputs:** `-3 Hold` or `5 Bet` <ide> <ide> **Hint** <ide> Do NOT reset `count` to 0 when value is 7, 8, or 9. <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md <ide> dashedName: declare-string-variables <ide> <ide> Previously we have used the code <ide> <del>`var myName = "your name";` <add>```js <add>var myName = "your name"; <add>``` <ide> <ide> `"your name"` is called a <dfn>string</dfn> <dfn>literal</dfn>. It is a string because it is a series of zero or more characters enclosed in single or double quotes. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md <ide> dashedName: decrement-a-number-with-javascript <ide> <ide> You can easily <dfn>decrement</dfn> or decrease a variable by one with the `--` operator. <ide> <del>`i--;` <add>```js <add>i--; <add>``` <ide> <ide> is the equivalent of <ide> <del>`i = i - 1;` <add>```js <add>i = i - 1; <add>``` <ide> <ide> **Note:** The entire line becomes `i--;`, eliminating the need for the equal sign. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md <ide> dashedName: delete-properties-from-a-javascript-object <ide> <ide> We can also delete properties from objects like this: <ide> <del>`delete ourDog.bark;` <add>```js <add>delete ourDog.bark; <add>``` <ide> <ide> Example: <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md <ide> When you are defining a string you must start and end with a single or double qu <ide> <ide> In JavaScript, you can <dfn>escape</dfn> a quote from considering it as an end of string quote by placing a <dfn>backslash</dfn> (`\`) in front of the quote. <ide> <del>`var sampleStr = "Alan said, \"Peter is learning JavaScript\".";` <add>```js <add>var sampleStr = "Alan said, \"Peter is learning JavaScript\"."; <add>``` <ide> <ide> This signals to JavaScript that the following quote is not the end of the string, but should instead appear inside the string. So if you were to print this to the console, you would get: <ide> <del>`Alan said, "Peter is learning JavaScript".` <add>```js <add>Alan said, "Peter is learning JavaScript". <add>``` <ide> <ide> # --instructions-- <ide> <ide> Use <dfn>backslashes</dfn> to assign a string to the `myStr` variable so that if you were to print it to the console, you would see: <ide> <del>`I am a "double quoted" string inside "double quotes".` <add>```js <add>I am a "double quoted" string inside "double quotes". <add>``` <ide> <ide> # --hints-- <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md <ide> Remember that `Math.random()` can never quite return a `1` and, because we're ro <ide> <ide> Putting everything together, this is what our code looks like: <ide> <del>`Math.floor(Math.random() * 20);` <add>```js <add>Math.floor(Math.random() * 20); <add>``` <ide> <ide> We are calling `Math.random()`, multiplying the result by 20, then passing the value to `Math.floor()` function to round the value down to the nearest whole number. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md <ide> To do this, we'll define a minimum number `min` and a maximum number `max`. <ide> <ide> Here's the formula we'll use. Take a moment to read it and try to understand what this code is doing: <ide> <del>`Math.floor(Math.random() * (max - min + 1)) + min` <add>```js <add>Math.floor(Math.random() * (max - min + 1)) + min <add>``` <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md <ide> dashedName: increment-a-number-with-javascript <ide> <ide> You can easily <dfn>increment</dfn> or add one to a variable with the `++` operator. <ide> <del>`i++;` <add>```js <add>i++; <add>``` <ide> <ide> is the equivalent of <ide> <del>`i = i + 1;` <add>```js <add>i = i + 1; <add>``` <ide> <ide> **Note:** The entire line becomes `i++;`, eliminating the need for the equal sign. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md <ide> dashedName: initializing-variables-with-the-assignment-operator <ide> <ide> It is common to <dfn>initialize</dfn> a variable to an initial value in the same line as it is declared. <ide> <del>`var myVar = 0;` <add>```js <add>var myVar = 0; <add>``` <ide> <ide> Creates a new variable called `myVar` and assigns it an initial value of `0`. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md <ide> Create a shopping list in the variable `myList`. The list should be a multi-dime <ide> <ide> The first element in each sub-array should contain a string with the name of the item. The second element should be a number representing the quantity i.e. <ide> <del>`["Chocolate Bar", 15]` <add>```js <add>["Chocolate Bar", 15] <add>``` <ide> <ide> There should be at least 5 sub-arrays in the list. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md <ide> With JavaScript `array` variables, we can store several pieces of data in one pl <ide> <ide> You start an array declaration with an opening square bracket, end it with a closing square bracket, and put a comma between each entry, like this: <ide> <del>`var sandwich = ["peanut butter", "jelly", "bread"]` <add>```js <add>var sandwich = ["peanut butter", "jelly", "bread"] <add>``` <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md <ide> dashedName: storing-values-with-the-assignment-operator <ide> <ide> In JavaScript, you can store a value in a variable with the <dfn>assignment</dfn> operator (`=`). <ide> <del>`myVariable = 5;` <add>```js <add>myVariable = 5; <add>``` <ide> <ide> This assigns the `Number` value `5` to `myVariable`. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md <ide> The `parseInt()` function parses a string and returns an integer. It takes a sec <ide> <ide> The function call looks like: <ide> <del>`parseInt(string, radix);` <add>```js <add>parseInt(string, radix); <add>``` <ide> <ide> And here's an example: <ide> <del>`var a = parseInt("11", 2);` <add>```js <add>var a = parseInt("11", 2); <add>``` <ide> <ide> The radix variable says that `11` is in the binary system, or base 2. This example converts the string `11` to an integer `3`. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md <ide> dashedName: use-the-parseint-function <ide> <ide> The `parseInt()` function parses a string and returns an integer. Here's an example: <ide> <del>`var a = parseInt("007");` <add>```js <add>var a = parseInt("007"); <add>``` <ide> <ide> The above function converts the string `007` to the integer `7`. If the first character in the string can't be converted into a number, then it returns `NaN`. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md <ide> The `console.log()` method, which "prints" the output of what's within its paren <ide> <ide> Here's an example to print the string `Hello world!` to the console: <ide> <del>`console.log('Hello world!');` <add>```js <add>console.log('Hello world!'); <add>``` <ide> <ide> # --instructions-- <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.md <ide> dashedName: learn-about-functional-programming <ide> <ide> Functional programming is a style of programming where solutions are simple, isolated functions, without any side effects outside of the function scope. <ide> <del>`INPUT -> PROCESS -> OUTPUT` <add>```js <add>INPUT -> PROCESS -> OUTPUT <add>``` <ide> <ide> Functional programming is about: <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/arguments-optional.md <ide> For example, `addTogether(2, 3)` should return `5`, and `addTogether(2)` should <ide> <ide> Calling this returned function with a single argument will then return the sum: <ide> <del>`var sumTwoAnd = addTogether(2);` <add>```js <add>var sumTwoAnd = addTogether(2); <add>``` <ide> <ide> `sumTwoAnd(3)` returns `5`. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-018.md <ide> dashedName: part-18 <ide> <ide> The `reduce()` method takes a callback function with at least two arguments, an accumulator and a current value: <ide> <del>`function(accumulator, currentValue) { /* code to run */ }` <add>```js <add>function(accumulator, currentValue) { /* code to run */ } <add>``` <ide> <ide> or using arrow functions: <ide> <del>`(accumulator, currentValue) => { /* code to run */ }` <add>```js <add>(accumulator, currentValue) => { /* code to run */ } <add>``` <ide> <ide> Insert the above callback function as an argument in the `.reduce()` method. <ide> <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md <ide> dashedName: make-code-more-reusable-with-the-this-keyword <ide> <ide> The last challenge introduced a method to the `duck` object. It used `duck.name` dot notation to access the value for the `name` property within the return statement: <ide> <del>`sayName: function() {return "The name of this duck is " + duck.name + ".";}` <add>```js <add>sayName: function() {return "The name of this duck is " + duck.name + ".";} <add>``` <ide> <ide> While this is a valid way to access the object's property, there is a pitfall here. If the variable name changes, any code referencing the original name would need to be updated as well. In a short object definition, it isn't a problem, but if an object has many references to its properties there is a greater chance for error. <ide>
25
Ruby
Ruby
create empty zshrc when zsh is shell
4625fd335c62e0bc6bcad2d4de482174bc353ee3
<ide><path>Library/Homebrew/formula.rb <ide> def stage <ide> @buildpath = Pathname.pwd <ide> env_home = buildpath/".brew_home" <ide> mkdir_p env_home <add> touch env_home/".zshrc" if ENV["SHELL"].include? "zsh" <ide> <ide> old_home, ENV["HOME"] = ENV["HOME"], env_home <ide>
1
Java
Java
release databuffers in freemarkerview
78434c8e2043e18040ea8a57868b2cee46fbd8a5
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/view/freemarker/FreeMarkerView.java <ide> import org.springframework.context.ApplicationContextException; <ide> import org.springframework.context.i18n.LocaleContextHolder; <ide> import org.springframework.core.io.buffer.DataBuffer; <add>import org.springframework.core.io.buffer.DataBufferUtils; <ide> import org.springframework.http.MediaType; <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.util.Assert; <ide> protected Mono<Void> renderInternal(Map<String, Object> renderAttributes, <ide> getTemplate(locale).process(freeMarkerModel, writer); <ide> } <ide> catch (IOException ex) { <add> DataBufferUtils.release(dataBuffer); <ide> String message = "Could not load FreeMarker template for URL [" + getUrl() + "]"; <ide> return Mono.error(new IllegalStateException(message, ex)); <ide> } <ide> catch (Throwable ex) { <add> DataBufferUtils.release(dataBuffer); <ide> return Mono.error(ex); <ide> } <ide> return exchange.getResponse().writeWith(Flux.just(dataBuffer));
1
Javascript
Javascript
add rfc232 variants
afa52d11bcebe84976d0402a189440d7a92bf84e
<ide><path>blueprints/util-test/qunit-rfc-232-files/tests/unit/utils/__name__-test.js <add>import <%= camelizedModuleName %> from '<%= dasherizedModulePrefix %>/utils/<%= dasherizedModuleName %>'; <add>import { module, test } from 'qunit'; <add>import { setupTest } from 'ember-qunit'; <add> <add>module('<%= friendlyTestName %>', function(hooks) { <add> setupTest(hooks); <add> <add> // Replace this with your real tests. <add> test('it works', function(assert) { <add> let result = <%= camelizedModuleName %>(); <add> assert.ok(result); <add> }); <add>}); <ide><path>node-tests/blueprints/util-test-test.js <ide> const modifyPackages = blueprintHelpers.modifyPackages; <ide> const chai = require('ember-cli-blueprint-test-helpers/chai'); <ide> const expect = chai.expect; <ide> <add>const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest'); <ide> const fixture = require('../helpers/fixture'); <ide> <ide> describe('Blueprint: util-test', function() { <ide> describe('Blueprint: util-test', function() { <ide> }); <ide> }); <ide> <add> describe('with [email protected]', function() { <add> beforeEach(function() { <add> generateFakePackageManifest('ember-cli-qunit', '4.1.1'); <add> }); <add> <add> it('util-test foo-bar', function() { <add> return emberGenerateDestroy(['util-test', 'foo-bar'], _file => { <add> expect(_file('tests/unit/utils/foo-bar-test.js')) <add> .to.equal(fixture('util-test/rfc232.js')); <add> }); <add> }); <add> }); <add> <ide> describe('with ember-cli-mocha', function() { <ide> beforeEach(function() { <ide> modifyPackages([ <ide><path>node-tests/fixtures/util-test/rfc232.js <add>import fooBar from 'my-app/utils/foo-bar'; <add>import { module, test } from 'qunit'; <add>import { setupTest } from 'ember-qunit'; <add> <add>module('Unit | Utility | foo bar', function(hooks) { <add> setupTest(hooks); <add> <add> // Replace this with your real tests. <add> test('it works', function(assert) { <add> let result = fooBar(); <add> assert.ok(result); <add> }); <add>});
3
Text
Text
move "fixes" to a new line
82aa2c124f4c2091ca4924735af466c22f0eebb4
<ide><path>railties/CHANGELOG.md <ide> * Avoid running system tests by default with the `bin/rails test` <ide> and `bin/rake test` commands since they may be expensive. <ide> <del> *Robin Dupret* (#28286) <add> Fixes #28286. <add> <add> *Robin Dupret* <ide> <ide> * Improve encryption for encrypted secrets. <ide>
1
Javascript
Javascript
add regression tests for http parser crash
18667ac6f54a4a2a781f1cf6380ac0660196e5e5
<ide><path>test/parallel/test-http-sync-write-error-during-continue.js <add>'use strict'; <add>const common = require('../common'); <add>const assert = require('assert'); <add>const http = require('http'); <add>const MakeDuplexPair = require('../common/duplexpair'); <add> <add>// Regression test for the crash reported in <add>// https://github.com/nodejs/node/issues/15102 (httpParser.finish() is called <add>// during httpParser.execute()): <add> <add>{ <add> const { clientSide, serverSide } = MakeDuplexPair(); <add> <add> serverSide.on('data', common.mustCall((data) => { <add> assert.strictEqual(data.toString('utf8'), `\ <add>GET / HTTP/1.1 <add>Expect: 100-continue <add>Host: localhost:80 <add>Connection: close <add> <add>`.replace(/\n/g, '\r\n')); <add> <add> setImmediate(() => { <add> serverSide.write('HTTP/1.1 100 Continue\r\n\r\n'); <add> }); <add> })); <add> <add> const req = http.request({ <add> createConnection: common.mustCall(() => clientSide), <add> headers: { <add> 'Expect': '100-continue' <add> } <add> }); <add> req.on('continue', common.mustCall((res) => { <add> let sync = true; <add> <add> clientSide._writev = null; <add> clientSide._write = common.mustCall((chunk, enc, cb) => { <add> assert(sync); <add> // On affected versions of Node.js, the error would be emitted on `req` <add> // synchronously (i.e. before commit f663b31cc2aec), which would cause <add> // parser.finish() to be called while we are here in the 'continue' <add> // callback, which is inside a parser.execute() call. <add> <add> assert.strictEqual(chunk.length, 0); <add> clientSide.destroy(new Error('sometimes the code just doesn’t work'), cb); <add> }); <add> req.on('error', common.mustCall()); <add> req.end(); <add> <add> sync = false; <add> })); <add>}
1
Text
Text
fix header depth of util.issymbol
267556762dee3daf723c2ea617d413d42ba6d59a
<ide><path>doc/api/util.md <ide> util.isString(5); <ide> // false <ide> ``` <ide> <del>## util.isSymbol(object) <add>### util.isSymbol(object) <ide> <ide> Stability: 0 - Deprecated <ide>
1
Javascript
Javascript
allow 1px margin to getrelativeposition test
bc59038772b74bff64127098115604520fbf769f
<ide><path>test/specs/helpers.dom.tests.js <ide> describe('DOM helpers tests', function() { <ide> }; <ide> <ide> const rect = chart.canvas.getBoundingClientRect(); <del> expect(helpers.getRelativePosition(event, chart)).toEqual({ <del> x: Math.round(event.clientX - rect.x), <del> y: Math.round(event.clientY - rect.y) <del> }); <add> const pos = helpers.getRelativePosition(event, chart); <add> expect(Math.abs(pos.x - Math.round(event.clientX - rect.x))).toBeLessThanOrEqual(1); <add> expect(Math.abs(pos.y - Math.round(event.clientY - rect.y))).toBeLessThanOrEqual(1); <ide> <ide> const chart2 = window.acquireChart({}, { <ide> canvas: { <ide> describe('DOM helpers tests', function() { <ide> } <ide> }); <ide> const rect2 = chart2.canvas.getBoundingClientRect(); <del> expect(helpers.getRelativePosition(event, chart2)).toEqual({ <del> x: Math.round((event.clientX - rect2.x - 10) / 180 * 200), <del> y: Math.round((event.clientY - rect2.y - 10) / 180 * 200) <del> }); <add> const pos2 = helpers.getRelativePosition(event, chart2); <add> expect(Math.abs(pos2.x - Math.round((event.clientX - rect2.x - 10) / 180 * 200))).toBeLessThanOrEqual(1); <add> expect(Math.abs(pos2.y - Math.round((event.clientY - rect2.y - 10) / 180 * 200))).toBeLessThanOrEqual(1); <ide> <ide> const chart3 = window.acquireChart({}, { <ide> canvas: { <ide> describe('DOM helpers tests', function() { <ide> } <ide> }); <ide> const rect3 = chart3.canvas.getBoundingClientRect(); <del> expect(helpers.getRelativePosition(event, chart3)).toEqual({ <del> x: Math.round((event.clientX - rect3.x - 10) / 360 * 400), <del> y: Math.round((event.clientY - rect3.y - 10) / 360 * 400) <del> }); <add> const pos3 = helpers.getRelativePosition(event, chart3); <add> expect(Math.abs(pos3.x - Math.round((event.clientX - rect3.x - 10) / 360 * 400))).toBeLessThanOrEqual(1); <add> expect(Math.abs(pos3.y - Math.round((event.clientY - rect3.y - 10) / 360 * 400))).toBeLessThanOrEqual(1); <ide> }); <ide> }); <ide> });
1
Javascript
Javascript
remove accidental global vars
07f5351fdc237dfd16188b2640e4135971aa89a3
<ide><path>src/geom/hull.js <ide> d3.geom.hull = function(vertices) { <ide> <ide> var fx = d3_functor(x), <ide> fy = d3_functor(y), <del> n = data.length; <add> n = data.length, <add> points = [], // of the form [[x0, y0, 0], ..., [xn, yn, n]] <add> flipped_points = []; <ide> <del> for (i = 0, points = []; i < n; i++) { <del> points.push([+fx.call(this, d = data[i], i), +fy.call(this, d, i), i]); <add> for (var i = 0 ; i < n; i++) { <add> points.push([+fx.call(this, data[i], i), +fy.call(this, data[i], i), i]); <ide> } <ide> <ide> // sort ascending by x-coord first, y-coord second <ide> points.sort(function(a, b) { return (a[0] - b[0]|| a[1] - b[1]); }); <ide> <ide> // we flip bottommost points across y axis so we can use the upper hull routine on both <del> var flipped_points = []; <ide> for (var i = 0; i < n; i++) flipped_points.push([points[i][0], -points[i][1]]); <ide> <ide> var uhull = d3_geom_hull_find_upper_hull(points);
1
Javascript
Javascript
remove extraneous helper
596ee9c19b076239dd281dfb7739b428c22b425d
<ide><path>test/integration/create-next-app/index.test.js <ide> const run = (cwd, args, input) => { <ide> const options = input ? { cwd, input } : { cwd } <ide> return execa('node', [cli].concat(args), options) <ide> } <del>const runStarter = (cwd, ...args) => { <del> const res = run(cwd, args) <del> <del> res.stdout.on('data', (data) => { <del> const stdout = data.toString() <del> <del> if (/Pick a template/.test(stdout)) { <del> res.stdin.write('\n') <del> } <del> }) <del> <del> return res <del>} <ide> <ide> async function usingTempDir(fn, options) { <ide> const folder = path.join(os.tmpdir(), Math.random().toString(36).substring(2)) <ide> describe('create next app', () => { <ide> <ide> expect.assertions(1) <ide> try { <del> await runStarter(cwd, projectName) <add> await run(cwd, [projectName]) <ide> } catch (e) { <ide> // eslint-disable-next-line jest/no-try-expect <ide> expect(e.stdout).toMatch(/contains files that could conflict/) <ide> describe('create next app', () => { <ide> it('empty directory', async () => { <ide> await usingTempDir(async (cwd) => { <ide> const projectName = 'empty-directory' <del> const res = await runStarter(cwd, projectName) <add> const res = await run(cwd, [projectName]) <ide> <ide> expect(res.exitCode).toBe(0) <ide> expect( <ide> describe('create next app', () => { <ide> const projectName = 'not-writable' <ide> expect.assertions(2) <ide> try { <del> const res = await runStarter(cwd, projectName) <add> const res = await run(cwd, [projectName]) <ide> <ide> if (process.platform === 'win32') { <ide> expect(res.exitCode).toBe(0)
1
PHP
PHP
use progresshelper in i18n task
e738c9cc3f69f9815a27937ef444639c6c5fd273
<ide><path>src/Shell/Helper/ProgressHelper.php <ide> public function increment($num = 1) <ide> public function draw() <ide> { <ide> $numberLen = strlen(' 100%'); <del> $complete = ($this->_progress / $this->_total); <del> $barLen = floor(($this->_width - $numberLen) * ($this->_progress / $this->_total)); <add> $complete = round($this->_progress / $this->_total, 2); <add> $barLen = ($this->_width - $numberLen) * ($this->_progress / $this->_total); <ide> $bar = ''; <ide> if ($barLen > 1) { <ide> $bar = str_repeat('=', $barLen - 1) . '>'; <ide><path>src/Shell/Task/ExtractTask.php <ide> public function getOptionParser() <ide> */ <ide> protected function _extractTokens() <ide> { <add> $progress = $this->_io->helper('progress'); <add> $progress->init(['total' => count($this->_files)]); <add> $isVerbose = $this->param('verbose'); <add> <ide> foreach ($this->_files as $file) { <ide> $this->_file = $file; <del> $this->out(sprintf('Processing %s...', $file), 1, Shell::VERBOSE); <add> if ($isVerbose) { <add> $this->out(sprintf('Processing %s...', $file), 1, Shell::VERBOSE); <add> } <ide> <ide> $code = file_get_contents($file); <ide> $allTokens = token_get_all($code); <ide> protected function _extractTokens() <ide> $this->_parse('__dx', ['domain', 'context', 'singular']); <ide> $this->_parse('__dxn', ['domain', 'context', 'singular', 'plural']); <ide> <add> if (!$isVerbose) { <add> $progress->increment(1); <add> $progress->draw(); <add> } <ide> } <ide> } <ide> <ide><path>tests/TestCase/Shell/Task/ExtractTaskTest.php <ide> public function setUp() <ide> { <ide> parent::setUp(); <ide> $this->io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false); <add> $progress = $this->getMock('Cake\Shell\Helper\ProgressHelper', [], [$this->io]); <add> $this->io->method('helper') <add> ->will($this->returnValue($progress)); <ide> <ide> $this->Task = $this->getMock( <ide> 'Cake\Shell\Task\ExtractTask',
3
Javascript
Javascript
remove common.port from http tests
abce60cec050f85f372b102a50220445e128bdfb
<ide><path>test/parallel/test-http-client-keep-alive-release-before-finish.js <ide> const http = require('http'); <ide> <ide> const server = http.createServer((req, res) => { <ide> res.end(); <del>}).listen(common.PORT, common.mustCall(() => { <add>}).listen(0, common.mustCall(() => { <ide> const agent = new http.Agent({ <ide> maxSockets: 1, <ide> keepAlive: true <ide> }); <ide> <add> const port = server.address().port; <add> <ide> const post = http.request({ <del> agent: agent, <add> agent, <ide> method: 'POST', <del> port: common.PORT, <add> port, <ide> }, common.mustCall((res) => { <ide> res.resume(); <ide> })); <ide> const server = http.createServer((req, res) => { <ide> }, 100); <ide> <ide> http.request({ <del> agent: agent, <add> agent, <ide> method: 'GET', <del> port: common.PORT, <add> port, <ide> }, common.mustCall((res) => { <ide> server.close(); <ide> res.connection.end(); <ide><path>test/parallel/test-http-no-read-no-dump.js <ide> const server = http.createServer((req, res) => { <ide> res.end(); <ide> onPause(); <ide> }); <del>}).listen(common.PORT, common.mustCall(() => { <add>}).listen(0, common.mustCall(() => { <ide> const agent = new http.Agent({ <ide> maxSockets: 1, <ide> keepAlive: true <ide> }); <ide> <add> const port = server.address().port; <add> <ide> const post = http.request({ <del> agent: agent, <add> agent, <ide> method: 'POST', <del> port: common.PORT, <add> port, <ide> }, common.mustCall((res) => { <ide> res.resume(); <ide> <ide> const server = http.createServer((req, res) => { <ide> post.write('initial'); <ide> <ide> http.request({ <del> agent: agent, <add> agent, <ide> method: 'GET', <del> port: common.PORT, <add> port, <ide> }, common.mustCall((res) => { <ide> server.close(); <ide> res.connection.end();
2
Ruby
Ruby
remove deprecation silencing in debug exceptions
99b6e23d1c6c3a77e3a45392220370fb230cc9a9
<ide><path>actionpack/lib/action_dispatch/middleware/debug_exceptions.rb <ide> def log_error(request, wrapper) <ide> exception = wrapper.exception <ide> trace = wrapper.exception_trace <ide> <del> ActiveSupport::Deprecation.silence do <del> message = [] <del> message << " " <del> message << "#{exception.class} (#{exception.message}):" <del> message.concat(exception.annotated_source_code) if exception.respond_to?(:annotated_source_code) <del> message << " " <del> message.concat(trace) <del> <del> log_array(logger, message) <del> end <add> message = [] <add> message << " " <add> message << "#{exception.class} (#{exception.message}):" <add> message.concat(exception.annotated_source_code) if exception.respond_to?(:annotated_source_code) <add> message << " " <add> message.concat(trace) <add> <add> log_array(logger, message) <ide> end <ide> <ide> def log_array(logger, array)
1
Ruby
Ruby
fix typo in assertion message
e8458d37c56a94fae5f4c762b1767f67e10ddb43
<ide><path>activemodel/lib/active_model/lint.rb <ide> def test_to_param <ide> assert model.respond_to?(:to_param), "The model should respond to to_param" <ide> def model.to_key() [1] end <ide> def model.persisted?() false end <del> assert model.to_param.nil?, "to_param should return nil when `persited?` returns false" <add> assert model.to_param.nil?, "to_param should return nil when `persisted?` returns false" <ide> end <ide> <ide> # == Responds to <tt>valid?</tt>
1
Python
Python
update links to diveintomark.org
9a25d8618a6a3fa91605b17b55f9f89fddee9b8f
<ide><path>django/utils/feedgenerator.py <ide> ... feed.write(fp, 'utf-8') <ide> <ide> For definitions of the different versions of RSS, see: <del>http://diveintomark.org/archives/2004/02/04/incompatible-rss <add>http://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004/02/04/incompatible-rss <ide> """ <ide> from __future__ import unicode_literals <ide> <ide> def get_tag_uri(url, date): <ide> """ <ide> Creates a TagURI. <ide> <del> See http://diveintomark.org/archives/2004/05/28/howto-atom-id <add> See http://web.archive.org/web/20110514113830/http://diveintomark.org/archives/2004/05/28/howto-atom-id <ide> """ <ide> bits = urlparse.urlparse(url) <ide> d = ''
1
Mixed
Python
unify command names in cli
ab5235ee1232bb60b180dfd5f10c980d66cb75d7
<ide><path>UPDATING.md <ide> you have to run the help command: ``airflow celery --help``. <ide> | ``airflow list_dag_runs`` | ``airflow dags list-runs`` | ``dags`` | <ide> | ``airflow pause`` | ``airflow dags pause`` | ``dags`` | <ide> | ``airflow unpause`` | ``airflow dags unpause`` | ``dags`` | <add>| ``airflow next_execution`` | ``airflow dags next-execution`` | ``dags`` | <ide> | ``airflow test`` | ``airflow tasks test`` | ``tasks`` | <ide> | ``airflow clear`` | ``airflow tasks clear`` | ``tasks`` | <ide> | ``airflow list_tasks`` | ``airflow tasks list`` | ``tasks`` | <ide><path>airflow/cli/cli_parser.py <ide> class GroupCommand(NamedTuple): <ide> args=(ARG_DAG_ID, ARG_EXECUTION_DATE, ARG_SUBDIR), <ide> ), <ide> ActionCommand( <del> name='next_execution', <add> name='next-execution', <ide> help="Get the next execution datetimes of a DAG", <ide> description=( <ide> "Get the next execution datetimes of a DAG. It returns one execution unless the " <ide><path>airflow/cli/commands/dag_command.py <ide> def dag_state(args): <ide> def dag_next_execution(args): <ide> """ <ide> Returns the next execution datetime of a DAG at the command line. <del> >>> airflow dags next_execution tutorial <add> >>> airflow dags next-execution tutorial <ide> 2018-08-31 10:38:00 <ide> """ <ide> dag = get_dag(args.subdir, args.dag_id) <ide><path>tests/cli/commands/test_dag_command.py <ide> def test_next_execution(self): <ide> <ide> # Test None output <ide> args = self.parser.parse_args(['dags', <del> 'next_execution', <add> 'next-execution', <ide> dag_ids[0]]) <ide> with contextlib.redirect_stdout(io.StringIO()) as temp_stdout: <ide> dag_command.dag_next_execution(args) <ide> def test_next_execution(self): <ide> <ide> # Test num-executions = 1 (default) <ide> args = self.parser.parse_args(['dags', <del> 'next_execution', <add> 'next-execution', <ide> dag_id]) <ide> with contextlib.redirect_stdout(io.StringIO()) as temp_stdout: <ide> dag_command.dag_next_execution(args) <ide> def test_next_execution(self): <ide> <ide> # Test num-executions = 2 <ide> args = self.parser.parse_args(['dags', <del> 'next_execution', <add> 'next-execution', <ide> dag_id, <ide> '--num-executions', <ide> '2'])
4
Python
Python
add dataproc sparkr example
efcffa323ddb5aa9f5907aa86808f3f3b4f5bd87
<ide><path>airflow/providers/google/cloud/example_dags/example_dataproc.py <ide> OUTPUT_PATH = "gs://{}/{}/".format(BUCKET, OUTPUT_FOLDER) <ide> PYSPARK_MAIN = os.environ.get("PYSPARK_MAIN", "hello_world.py") <ide> PYSPARK_URI = "gs://{}/{}".format(BUCKET, PYSPARK_MAIN) <del> <add>SPARKR_MAIN = os.environ.get("SPARKR_MAIN", "hello_world.R") <add>SPARKR_URI = "gs://{}/{}".format(BUCKET, SPARKR_MAIN) <ide> <ide> # Cluster definition <ide> CLUSTER = { <ide> "pyspark_job": {"main_python_file_uri": PYSPARK_URI}, <ide> } <ide> <add>SPARKR_JOB = { <add> "reference": {"project_id": PROJECT_ID}, <add> "placement": {"cluster_name": CLUSTER_NAME}, <add> "spark_r_job": {"main_r_file_uri": SPARKR_URI}, <add>} <add> <ide> HIVE_JOB = { <ide> "reference": {"project_id": PROJECT_ID}, <ide> "placement": {"cluster_name": CLUSTER_NAME}, <ide> task_id="pyspark_task", job=PYSPARK_JOB, location=REGION, project_id=PROJECT_ID <ide> ) <ide> <add> sparkr_task = DataprocSubmitJobOperator( <add> task_id="sparkr_task", job=SPARKR_JOB, location=REGION, project_id=PROJECT_ID <add> ) <add> <ide> hive_task = DataprocSubmitJobOperator( <ide> task_id="hive_task", job=HIVE_JOB, location=REGION, project_id=PROJECT_ID <ide> ) <ide> scale_cluster >> spark_sql_task >> delete_cluster <ide> scale_cluster >> spark_task >> delete_cluster <ide> scale_cluster >> pyspark_task >> delete_cluster <add> scale_cluster >> sparkr_task >> delete_cluster <ide> scale_cluster >> hadoop_task >> delete_cluster <ide><path>tests/providers/google/cloud/operators/test_dataproc_system.py <ide> BUCKET = os.environ.get("GCP_DATAPROC_BUCKET", "dataproc-system-tests") <ide> PYSPARK_MAIN = os.environ.get("PYSPARK_MAIN", "hello_world.py") <ide> PYSPARK_URI = "gs://{}/{}".format(BUCKET, PYSPARK_MAIN) <add>SPARKR_MAIN = os.environ.get("SPARKR_MAIN", "hello_world.R") <add>SPARKR_URI = "gs://{}/{}".format(BUCKET, SPARKR_MAIN) <ide> <ide> pyspark_file = """ <ide> #!/usr/bin/python <ide> print(words) <ide> """ <ide> <add>sparkr_file = """ <add>#!/usr/bin/r <add>if (nchar(Sys.getenv("SPARK_HOME")) < 1) { <add>Sys.setenv(SPARK_HOME = "/home/spark") <add>} <add>library(SparkR, lib.loc = c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib"))) <add>sparkR.session() <add># Create the SparkDataFrame <add>df <- as.DataFrame(faithful) <add>head(summarize(groupBy(df, df$waiting), count = n(df$waiting))) <add>""" <add> <ide> <ide> @pytest.mark.backend("mysql", "postgres") <ide> @pytest.mark.credential_file(GCP_DATAPROC_KEY) <ide> class DataprocExampleDagsTest(GoogleSystemTest): <del> <ide> @provide_gcp_context(GCP_DATAPROC_KEY) <ide> def setUp(self): <ide> super().setUp() <ide> self.create_gcs_bucket(BUCKET) <del> self.upload_content_to_gcs(lines=pyspark_file, bucket=PYSPARK_URI, filename=PYSPARK_MAIN) <add> self.upload_content_to_gcs( <add> lines=pyspark_file, bucket=PYSPARK_URI, filename=PYSPARK_MAIN <add> ) <add> self.upload_content_to_gcs( <add> lines=sparkr_file, bucket=SPARKR_URI, filename=SPARKR_MAIN <add> ) <ide> <ide> @provide_gcp_context(GCP_DATAPROC_KEY) <ide> def tearDown(self):
2
Ruby
Ruby
fix rubocop warnings
6a81782753d660eb3a9b6b2f303015205177c518
<ide><path>Library/Homebrew/extend/os/mac/development_tools.rb <ide> def installed? <ide> <ide> def installation_instructions <ide> if MacOS.version >= "10.9" <del> <<-EOS.undent <del> Install the Command Line Tools: <del> xcode-select --install <del> EOS <add> <<-EOS.undent <add> Install the Command Line Tools: <add> xcode-select --install <add> EOS <ide> elsif MacOS.version == "10.8" || MacOS.version == "10.7" <ide> <<-EOS.undent <ide> Install the Command Line Tools from
1
Ruby
Ruby
remove libiconv duplicate
c59be1a930fa1237e3ea84dca9c484037f1ba5a1
<ide><path>Library/Homebrew/blacklist.rb <ide> def blacklisted? name <ide> when 'libarchive', 'libpcap' then <<-EOS.undent <ide> Apple distributes #{name} with OS X, you can find it in /usr/lib. <ide> EOS <add> when 'libiconv' then <<-EOS.undent <add> Apple distributes #{name} with OS X, you can find it in /usr/lib. <add> Some build scripts fail to detect it correctly, please check existing <add> formulae for solutions. <add> EOS <ide> when 'libxml', 'libxlst' then <<-EOS.undent <ide> Apple distributes #{name} with OS X, you can find it in /usr/lib. <ide> However not all build scripts look for these hard enough, so you may need <ide><path>Library/Homebrew/cmd/doctor.rb <ide> def check_xcode_prefix <ide> if prefix.to_s.match(' ') <ide> <<-EOS.undent <ide> Xcode is installed to a directory with a space in the name. <del> This will cause some formulae, such as libiconv, to fail to build. <add> This will cause some formulae to fail to build. <ide> EOS <ide> end <ide> end
2
Javascript
Javascript
upgrade requestshortner to es6
ded39c11691f354b4595e38bdb69c52f46a178a0
<ide><path>lib/RequestShortener.js <ide> MIT License http://www.opensource.org/licenses/mit-license.php <ide> Author Tobias Koppers @sokra <ide> */ <del>var path = require("path"); <del> <del>function RequestShortener(directory) { <del> directory = directory.replace(/\\/g, "/"); <del> var parentDirectory = path.dirname(directory); <del> if(/[\/\\]$/.test(directory)) directory = directory.substr(0, directory.length - 1); <del> if(directory) { <del> var currentDirectoryRegExp = directory.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); <del> currentDirectoryRegExp = new RegExp("^" + currentDirectoryRegExp + "|(!)" + currentDirectoryRegExp, "g"); <del> <del> this.currentDirectoryRegExp = currentDirectoryRegExp; <add>"use strict"; <add> <add>const path = require("path"); <add> <add>class RequestShortener { <add> constructor(directory) { <add> directory = directory.replace(/\\/g, "/"); <add> let parentDirectory = path.dirname(directory); <add> if(/[\/\\]$/.test(directory)) directory = directory.substr(0, directory.length - 1); <add> <add> if(directory) { <add> let currentDirectoryRegExp = directory.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); <add> currentDirectoryRegExp = new RegExp("^" + currentDirectoryRegExp + "|(!)" + currentDirectoryRegExp, "g"); <add> this.currentDirectoryRegExp = currentDirectoryRegExp; <add> } <add> <add> if(/[\/\\]$/.test(parentDirectory)) parentDirectory = parentDirectory.substr(0, parentDirectory.length - 1); <add> if(parentDirectory && parentDirectory !== directory) { <add> let parentDirectoryRegExp = parentDirectory.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); <add> parentDirectoryRegExp = new RegExp("^" + parentDirectoryRegExp + "|(!)" + parentDirectoryRegExp, "g"); <add> this.parentDirectoryRegExp = parentDirectoryRegExp; <add> } <add> <add> if(__dirname.length >= 2) { <add> let buildins = path.join(__dirname, "..").replace(/\\/g, "/"); <add> let buildinsAsModule = this.currentDirectoryRegExp && this.currentDirectoryRegExp.test(buildins); <add> let buildinsRegExp = buildins.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); <add> buildinsRegExp = new RegExp("^" + buildinsRegExp + "|(!)" + buildinsRegExp, "g"); <add> this.buildinsAsModule = buildinsAsModule; <add> this.buildinsRegExp = buildinsRegExp; <add> } <add> <add> this.nodeModulesRegExp = /\/node_modules\//g; <add> this.indexJsRegExp = /\/index.js(!|\?|\(query\))/g; <ide> } <ide> <del> if(/[\/\\]$/.test(parentDirectory)) parentDirectory = parentDirectory.substr(0, parentDirectory.length - 1); <del> if(parentDirectory && parentDirectory !== directory) { <del> var parentDirectoryRegExp = parentDirectory.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); <del> parentDirectoryRegExp = new RegExp("^" + parentDirectoryRegExp + "|(!)" + parentDirectoryRegExp, "g"); <del> <del> this.parentDirectoryRegExp = parentDirectoryRegExp; <add> shorten(request) { <add> if(!request) return request; <add> request = request.replace(/\\/g, "/"); <add> if(this.buildinsAsModule && this.buildinsRegExp) <add> request = request.replace(this.buildinsRegExp, "!(webpack)"); <add> if(this.currentDirectoryRegExp) <add> request = request.replace(this.currentDirectoryRegExp, "!."); <add> if(this.parentDirectoryRegExp) <add> request = request.replace(this.parentDirectoryRegExp, "!.."); <add> if(!this.buildinsAsModule && this.buildinsRegExp) <add> request = request.replace(this.buildinsRegExp, "!(webpack)"); <add> request = request.replace(this.nodeModulesRegExp, "/~/"); <add> request = request.replace(this.indexJsRegExp, "$1"); <add> return request.replace(/^!|!$/, ""); <ide> } <del> <del> if(__dirname.length >= 2) { <del> var buildins = path.join(__dirname, "..").replace(/\\/g, "/"); <del> var buildinsAsModule = currentDirectoryRegExp && currentDirectoryRegExp.test(buildins); <del> var buildinsRegExp = buildins.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); <del> buildinsRegExp = new RegExp("^" + buildinsRegExp + "|(!)" + buildinsRegExp, "g"); <del> <del> this.buildinsAsModule = buildinsAsModule; <del> this.buildinsRegExp = buildinsRegExp; <del> } <del> <del> this.nodeModulesRegExp = /\/node_modules\//g; <del> this.indexJsRegExp = /\/index.js(!|\?|\(query\))/g; <ide> } <del>module.exports = RequestShortener; <ide> <del>RequestShortener.prototype.shorten = function(request) { <del> if(!request) <del> return request; <del> request = request.replace(/\\/g, "/"); <del> if(this.buildinsAsModule && this.buildinsRegExp) <del> request = request.replace(this.buildinsRegExp, "!(webpack)"); <del> if(this.currentDirectoryRegExp) <del> request = request.replace(this.currentDirectoryRegExp, "!."); <del> if(this.parentDirectoryRegExp) <del> request = request.replace(this.parentDirectoryRegExp, "!.."); <del> if(!this.buildinsAsModule && this.buildinsRegExp) <del> request = request.replace(this.buildinsRegExp, "!(webpack)"); <del> request = request.replace(this.nodeModulesRegExp, "/~/"); <del> request = request.replace(this.indexJsRegExp, "$1"); <del> return request.replace(/^!|!$/, ""); <del>}; <add>module.exports = RequestShortener;
1
Javascript
Javascript
clean undefined check
1ec2e33c65403abbe258c51db13475ab1c3a1277
<ide><path>packages/ember-routing/lib/system/router.js <ide> const EmberRouter = EmberObject.extend(Evented, { <ide> let initialURL = get(this, 'initialURL'); <ide> <ide> if (this.setupRouter()) { <del> if (typeof initialURL === 'undefined') { <add> if (initialURL === undefined) { <ide> initialURL = get(this, 'location').getURL(); <ide> } <ide> let initialTransition = this.handleURL(initialURL); <ide> const EmberRouter = EmberObject.extend(Evented, { <ide> if ('string' === typeof location && owner) { <ide> let resolvedLocation = owner.lookup(`location:${location}`); <ide> <del> if ('undefined' !== typeof resolvedLocation) { <add> if (resolvedLocation !== undefined) { <ide> location = set(this, 'location', resolvedLocation); <ide> } else { <ide> // Allow for deprecated registration of custom location API's
1
Text
Text
add 16.6.0 changelog
eac092ecacf737bd7b3ded933510ff421350acc1
<ide><path>CHANGELOG.md <ide> <ide> </details> <ide> <add> <add>## 16.6.0 (October 23, 2018) <add> <add>### React <add> <add>* Add `React.memo()` as an alternative to `PureComponent` for functions. ([@acdlite](https://github.com/acdlite) in [#13748](https://github.com/facebook/react/pull/13748)) <add>* Add `React.lazy()` for code splitting components. ([@acdlite](https://github.com/acdlite) in [#13885](https://github.com/facebook/react/pull/13885)) <add>* `React.StrictMode` now warns about legacy context API. ([@bvaughn](https://github.com/bvaughn) in [#13760](https://github.com/facebook/react/pull/13760)) <add>* `React.StrictMode` now warns about `findDOMNode`. ([@sebmarkbage](https://github.com/sebmarkbage) in [#13841](https://github.com/facebook/react/pull/13841)) <add>* Rename `unstable_AsyncMode` to `unstable_ConcurrentMode`. ([@trueadm](https://github.com/trueadm) in [#13732](https://github.com/facebook/react/pull/13732)) <add>* Rename `unstable_Placeholder` to `Suspense`, and `delayMs` to `maxDuration`. ([@gaearon](https://github.com/gaearon) in [#13799](https://github.com/facebook/react/pull/13799) and [@sebmarkbage](https://github.com/sebmarkbage) in [#13922](https://github.com/facebook/react/pull/13922)) <add> <add>### React DOM <add> <add>* Add `contextType` as a more ergonomic way to subscribe to context from a class. ([@bvaughn](https://github.com/bvaughn) in [#13728](https://github.com/facebook/react/pull/13728)) <add>* Add `getDerivedStateFromError` lifecycle method for catching errors in a future asynchronous server-side renderer. ([@bvaughn](https://github.com/bvaughn) in [#13746](https://github.com/facebook/react/pull/13746)) <add>* Warn when `<Context>` is used instead of `<Context.Consumer>`. ([@trueadm](https://github.com/trueadm) in [#13829](https://github.com/facebook/react/pull/13829)) <add>* Fix gray overlay on iOS Safari. ([@philipp-spiess](https://github.com/philipp-spiess) in [#13778](https://github.com/facebook/react/pull/13778)) <add>* Fix a bug caused by overwriting `window.event` in development. ([@sergei-startsev](https://github.com/sergei-startsev) in [#13697](https://github.com/facebook/react/pull/13697)) <add> <add>### React DOM Server <add> <add>* Add support for `React.memo()`. ([@alexmckenley](https://github.com/alexmckenley) in [#13855](https://github.com/facebook/react/pull/13855)) <add>* Add support for `contextType`. ([@sebmarkbage](https://github.com/sebmarkbage) in [#13889](https://github.com/facebook/react/pull/13889)) <add> <add>### Scheduler (Experimental) <add> <add>* Rename the package to `scheduler`. ([@gaearon](https://github.com/gaearon) in [#13683](https://github.com/facebook/react/pull/13683)) <add>* Support priority levels, continuations, and wrapped callbacks. ([@acdlite](https://github.com/acdlite) in [#13720](https://github.com/facebook/react/pull/13720) and [#13842](https://github.com/facebook/react/pull/13842)) <add>* Improve the fallback mechanism in non-DOM environments. ([@acdlite](https://github.com/acdlite) in [#13740](https://github.com/facebook/react/pull/13740)) <add>* Schedule `requestAnimationFrame` earlier. ([@acdlite](https://github.com/acdlite) in [#13785](https://github.com/facebook/react/pull/13785)) <add>* Fix the DOM detection to be more thorough. ([@trueadm](https://github.com/trueadm) in [#13731](https://github.com/facebook/react/pull/13731)) <add>* Fix bugs with interaction tracing. ([@bvaughn](https://github.com/bvaughn) in [#13590](https://github.com/facebook/react/pull/13590)) <add>* Add the `envify` transform to the package. ([@mridgway](https://github.com/mridgway) in [#13766](https://github.com/facebook/react/pull/13766)) <add> <add> <ide> ## 16.5.2 (September 18, 2018) <ide> <ide> ### React DOM
1
PHP
PHP
apply fixes from styleci
730daa7dce9e069fed832e19cbdb1c23d6864b80
<ide><path>src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php <ide> <ide> use Illuminate\Config\Repository; <ide> use Symfony\Component\Finder\Finder; <del>use Symfony\Component\Finder\SplFileInfo; <ide> use Illuminate\Contracts\Foundation\Application; <ide> use Illuminate\Contracts\Config\Repository as RepositoryContract; <ide>
1
Javascript
Javascript
move img[srcset] sanitizing to helper method
88a12f8623d53579f8a21ac48d02ae1834fa7acb
<ide><path>src/ng/compile.js <ide> function $CompileProvider($provide, $$sanitizeUriProvider) { <ide> } <ide> <ide> <add> function sanitizeSrcset(value) { <add> if (!value) { <add> return value; <add> } <add> if (!isString(value)) { <add> throw $compileMinErr('srcset', 'Can\'t pass trusted values to `$set(\'srcset\', value)`: "{0}"', value.toString()); <add> } <add> <add> // Such values are a bit too complex to handle automatically inside $sce. <add> // Instead, we sanitize each of the URIs individually, which works, even dynamically. <add> <add> // It's not possible to work around this using `$sce.trustAsMediaUrl`. <add> // If you want to programmatically set explicitly trusted unsafe URLs, you should use <add> // `$sce.trustAsHtml` on the whole `img` tag and inject it into the DOM using the <add> // `ng-bind-html` directive. <add> <add> var result = ''; <add> <add> // first check if there are spaces because it's not the same pattern <add> var trimmedSrcset = trim(value); <add> // ( 999x ,| 999w ,| ,|, ) <add> var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/; <add> var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/; <add> <add> // split srcset into tuple of uri and descriptor except for the last item <add> var rawUris = trimmedSrcset.split(pattern); <add> <add> // for each tuples <add> var nbrUrisWith2parts = Math.floor(rawUris.length / 2); <add> for (var i = 0; i < nbrUrisWith2parts; i++) { <add> var innerIdx = i * 2; <add> // sanitize the uri <add> result += $sce.getTrustedMediaUrl(trim(rawUris[innerIdx])); <add> // add the descriptor <add> result += ' ' + trim(rawUris[innerIdx + 1]); <add> } <add> <add> // split the last item into uri and descriptor <add> var lastTuple = trim(rawUris[i * 2]).split(/\s/); <add> <add> // sanitize the last uri <add> result += $sce.getTrustedMediaUrl(trim(lastTuple[0])); <add> <add> // and add the last descriptor if any <add> if (lastTuple.length === 2) { <add> result += (' ' + trim(lastTuple[1])); <add> } <add> return result; <add> } <add> <add> <ide> function Attributes(element, attributesToCopy) { <ide> if (attributesToCopy) { <ide> var keys = Object.keys(attributesToCopy); <ide> function $CompileProvider($provide, $$sanitizeUriProvider) { <ide> nodeName = nodeName_(this.$$element); <ide> <ide> // Sanitize img[srcset] values. <del> if (nodeName === 'img' && key === 'srcset' && value) { <del> if (!isString(value)) { <del> throw $compileMinErr('srcset', 'Can\'t pass trusted values to `$set(\'srcset\', value)`: "{0}"', value.toString()); <del> } <del> <del> // Such values are a bit too complex to handle automatically inside $sce. <del> // Instead, we sanitize each of the URIs individually, which works, even dynamically. <del> <del> // It's not possible to work around this using `$sce.trustAsMediaUrl`. <del> // If you want to programmatically set explicitly trusted unsafe URLs, you should use <del> // `$sce.trustAsHtml` on the whole `img` tag and inject it into the DOM using the <del> // `ng-bind-html` directive. <del> <del> var result = ''; <del> <del> // first check if there are spaces because it's not the same pattern <del> var trimmedSrcset = trim(value); <del> // ( 999x ,| 999w ,| ,|, ) <del> var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/; <del> var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/; <del> <del> // split srcset into tuple of uri and descriptor except for the last item <del> var rawUris = trimmedSrcset.split(pattern); <del> <del> // for each tuples <del> var nbrUrisWith2parts = Math.floor(rawUris.length / 2); <del> for (var i = 0; i < nbrUrisWith2parts; i++) { <del> var innerIdx = i * 2; <del> // sanitize the uri <del> result += $sce.getTrustedMediaUrl(trim(rawUris[innerIdx])); <del> // add the descriptor <del> result += ' ' + trim(rawUris[innerIdx + 1]); <del> } <del> <del> // split the last item into uri and descriptor <del> var lastTuple = trim(rawUris[i * 2]).split(/\s/); <del> <del> // sanitize the last uri <del> result += $sce.getTrustedMediaUrl(trim(lastTuple[0])); <del> <del> // and add the last descriptor if any <del> if (lastTuple.length === 2) { <del> result += (' ' + trim(lastTuple[1])); <del> } <del> this[key] = value = result; <add> if (nodeName === 'img' && key === 'srcset') { <add> this[key] = value = sanitizeSrcset(value, '$set(\'srcset\', value)'); <ide> } <ide> <ide> if (writeAttr !== false) {
1
PHP
PHP
fix return type to match documentation
40a6201413266289ff303788b9615aa07f8bc6b6
<ide><path>src/Cache/Engine/ArrayEngine.php <ide> public function increment($key, $offset = 1) <ide> $key = $this->_key($key); <ide> $this->data[$key][1] += $offset; <ide> <del> return true; <add> return $this->data[$key][1]; <ide> } <ide> <ide> /** <ide> public function decrement($key, $offset = 1) <ide> $key = $this->_key($key); <ide> $this->data[$key][1] -= $offset; <ide> <del> return true; <add> return $this->data[$key][1]; <ide> } <ide> <ide> /** <ide><path>tests/TestCase/Cache/Engine/ArrayEngineTest.php <ide> public function testIncrement() <ide> $this->assertTrue($result); <ide> <ide> $result = Cache::increment('test_increment', 1, 'array'); <del> $this->assertEquals(6, $result); <add> $this->assertSame(6, $result); <ide> <ide> $result = Cache::read('test_increment', 'array'); <del> $this->assertEquals(6, $result); <add> $this->assertSame(6, $result); <ide> <ide> $result = Cache::increment('test_increment', 2, 'array'); <del> $this->assertEquals(8, $result); <add> $this->assertSame(8, $result); <ide> <ide> $result = Cache::read('test_increment', 'array'); <del> $this->assertEquals(8, $result); <add> $this->assertSame(8, $result); <ide> } <ide> <ide> /**
2
Python
Python
fix displacy test
a6f33ac27dc35acaf34c495d0aa39fd716c76055
<ide><path>spacy/tests/test_misc.py <ide> def test_displacy_parse_deps(en_vocab): <ide> """Test that deps and tags on a Doc are converted into displaCy's format.""" <ide> words = ["This", "is", "a", "sentence"] <ide> heads = [1, 0, 1, -2] <del> tags = ['DT', 'VBZ', 'DT', 'NN'] <add> pos = ['DET', 'VERB', 'DET', 'NOUN'] <ide> deps = ['nsubj', 'ROOT', 'det', 'attr'] <del> doc = get_doc(en_vocab, words=words, heads=heads, tags=tags, deps=deps) <add> doc = get_doc(en_vocab, words=words, heads=heads, pos=pos, deps=deps) <ide> deps = parse_deps(doc) <ide> assert isinstance(deps, dict) <del> assert deps['words'] == [{'text': 'This', 'tag': 'DT'}, <del> {'text': 'is', 'tag': 'VBZ'}, <del> {'text': 'a', 'tag': 'DT'}, <del> {'text': 'sentence', 'tag': 'NN'}] <add> assert deps['words'] == [{'text': 'This', 'tag': 'DET'}, <add> {'text': 'is', 'tag': 'VERB'}, <add> {'text': 'a', 'tag': 'DET'}, <add> {'text': 'sentence', 'tag': 'NOUN'}] <ide> assert deps['arcs'] == [{'start': 0, 'end': 1, 'label': 'nsubj', 'dir': 'left'}, <ide> {'start': 2, 'end': 3, 'label': 'det', 'dir': 'left'}, <ide> {'start': 1, 'end': 3, 'label': 'attr', 'dir': 'right'}]
1
Text
Text
improve reading / style of hashes in ar guide
20d3484f32f22b6775f3ff6e8983c5bc021855eb
<ide><path>guides/source/active_record_querying.md <ide> In the case of a belongs_to relationship, an association key can be used to spec <ide> <ide> ```ruby <ide> Post.where(author: author) <del>Author.joins(:posts).where(posts: {author: author}) <add>Author.joins(:posts).where(posts: { author: author }) <ide> ``` <ide> <ide> NOTE: The values cannot be symbols. For example, you cannot do `Client.where(status: :active)`. <ide> Or, in English: "return all posts that have a comment made by a guest." <ide> #### Joining Nested Associations (Multiple Level) <ide> <ide> ```ruby <del>Category.joins(posts: [{comments: :guest}, :tags]) <add>Category.joins(posts: [{ comments: :guest }, :tags]) <ide> ``` <ide> <ide> This produces: <ide> An alternative and cleaner syntax is to nest the hash conditions: <ide> <ide> ```ruby <ide> time_range = (Time.now.midnight - 1.day)..Time.now.midnight <del>Client.joins(:orders).where(orders: {created_at: time_range}) <add>Client.joins(:orders).where(orders: { created_at: time_range }) <ide> ``` <ide> <ide> This will find all clients who have orders that were created yesterday, again using a `BETWEEN` SQL expression. <ide> This loads all the posts and the associated category and comments for each post. <ide> #### Nested Associations Hash <ide> <ide> ```ruby <del>Category.includes(posts: [{comments: :guest}, :tags]).find(1) <add>Category.includes(posts: [{ comments: :guest }, :tags]).find(1) <ide> ``` <ide> <ide> This will find the category with id 1 and eager load all of the associated posts, the associated posts' tags and comments, and every comment's guest association. <ide> Client.where(first_name: 'Ryan').count <ide> You can also use various finder methods on a relation for performing complex calculations: <ide> <ide> ```ruby <del>Client.includes("orders").where(first_name: 'Ryan', orders: {status: 'received'}).count <add>Client.includes("orders").where(first_name: 'Ryan', orders: { status: 'received' }).count <ide> ``` <ide> <ide> Which will execute:
1
Text
Text
simplify collaborator pre-nomination text
859421188b0f350d0a17270a54a67f6554713d71
<ide><path>GOVERNANCE.md <ide> the nomination. <ide> The nomination passes if no Collaborators oppose it after one week. Otherwise, <ide> the nomination fails. <ide> <del>Prior to the public nomination, the Collaborator initiating it can seek <del>feedback from other Collaborators in private using <del>[the GitHub discussion page][collaborators-discussions] of the <del>Collaborators team, and work with the nominee to improve the nominee's <del>contribution profile, in order to make the nomination as frictionless <del>as possible. <add>There are steps a nominator can take in advance to make a nomination as <add>frictionless as possible. Use the [Collaborators discussion page][] to request <add>feedback from other Collaborators in private. A nominator may also work with the <add>nominee to improve their contribution profile. <ide> <ide> If individuals making valuable contributions do not believe they have been <ide> considered for a nomination, they may log an issue or contact a Collaborator <ide> completed within a month after the nomination is accepted. <ide> The TSC follows a [Consensus Seeking][] decision-making model as described by <ide> the [TSC Charter][]. <ide> <del>[collaborators-discussions]: https://github.com/orgs/nodejs/teams/collaborators/discussions <add>[Collaborators discussion page]: https://github.com/orgs/nodejs/teams/collaborators/discussions <ide> [Consensus Seeking]: https://en.wikipedia.org/wiki/Consensus-seeking_decision-making <ide> [TSC Charter]: https://github.com/nodejs/TSC/blob/master/TSC-Charter.md <ide> [nodejs/node]: https://github.com/nodejs/node
1
Text
Text
add missing toc entries
5f6438f62537779eff6402688cbe7ef30b63202e
<ide><path>test/common/README.md <ide> This directory contains modules used to test the Node.js implementation. <ide> <ide> ## Table of Contents <ide> <add>* [ArrayStream module](#arraystream-module) <ide> * [Benchmark module](#benchmark-module) <ide> * [Common module API](#common-module-api) <ide> * [Countdown module](#countdown-module) <ide> This directory contains modules used to test the Node.js implementation. <ide> * [Environment variables](#environment-variables) <ide> * [Fixtures module](#fixtures-module) <ide> * [Heap dump checker module](#heap-dump-checker-module) <add>* [hijackstdio module](#hijackstdio-module) <ide> * [HTTP2 module](#http2-module) <ide> * [Internet module](#internet-module) <add>* [ongc module](#ongc-module) <ide> * [Report module](#report-module) <ide> * [tick module](#tick-module) <ide> * [tmpdir module](#tmpdir-module)
1
Text
Text
add paragraph about online women in tech groups
26f4e58410f6a786101970185e0283e13832d8d4
<ide><path>guide/english/working-in-tech/women-in-tech/index.md <ide> The worst thing you can do is to sell yourself short. If you want something, tak <ide> <ide> Encouraging girls in elementary, middle, and high school can also help to increase the number of women going to work in the tech industry as they get older. We must actively fight against gender stereotypes in careers beginning at a young age so that children fully understand what career options are available to them. If girls are able to get more familiar with computer science concepts at a young age, this will help to make entering a college classroom full of men a less intimidating experience. Over time we will hopefully start to see a gender balance in tech careers. <ide> <add>Additionally, there are a variety tech of women in groups that you can join no matter where you are in the world. Facebook groups such as [Ladies Storm Hackathons](https://www.facebook.com/groups/LadiesStormHackathons/) and [Women Who Reign: Advancing Women in STEM](https://www.facebook.com/groups/ReigningIt/) offer incredible support for women in tech from women in tech. Members offer advice, post useful links, and opportunities all the time! These groups are definitely great communities to join. <ide> <ide> ## More Information: <ide> - [Why are there so few women in tech? The truth behind the Google memo](https://www.theguardian.com/lifeandstyle/2017/aug/08/why-are-there-so-few-women-in-tech-the-truth-behind-the-google-memo)
1
Javascript
Javascript
fix a typo
3b714740fdc2b97c2375324ee46b222c23c06bf5
<ide><path>src/ngMock/angular-mocks.js <ide> angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { <ide> * phones.push(phone); <ide> * return [200, phone, {}]; <ide> * }); <del> * $httpBackend.whenGET(/^\/templates\//).passThrough(); // Requests for templare are handled by the real server <add> * $httpBackend.whenGET(/^\/templates\//).passThrough(); // Requests for templates are handled by the real server <ide> * //... <ide> * }); <ide> * ```
1
Ruby
Ruby
fix eager loading with dynamic finders
e94e53f9cd70bee69759661e9771da3fe0ee9554
<ide><path>activerecord/lib/active_record/associations.rb <ide> def conditions_tables(options) <ide> end <ide> <ide> def order_tables(options) <del> order = options[:order] <add> order = [options[:order], scope(:find, :order) ].join(", ") <ide> return [] unless order && order.is_a?(String) <ide> order.scan(/([\.\w]+).?\./).flatten <ide> end <ide><path>activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb <ide> def construct_scope <ide> :joins => @join_sql, <ide> :readonly => false, <ide> :order => @reflection.options[:order], <add> :include => @reflection.options[:include], <ide> :limit => @reflection.options[:limit] } } <ide> end <ide> <ide><path>activerecord/lib/active_record/associations/has_many_association.rb <ide> def construct_scope <ide> create_scoping = {} <ide> set_belongs_to_association_for(create_scoping) <ide> { <del> :find => { :conditions => @finder_sql, :readonly => false, :order => @reflection.options[:order], :limit => @reflection.options[:limit] }, <add> :find => { :conditions => @finder_sql, :readonly => false, :order => @reflection.options[:order], :limit => @reflection.options[:limit], :include => @reflection.options[:include]}, <ide> :create => create_scoping <ide> } <ide> end <ide><path>activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb <ide> def test_symbols_as_keys <ide> assert_equal developer, project.developers.find(:first) <ide> assert_equal project, developer.projects.find(:first) <ide> end <add> <add> def test_dynamic_find_should_respect_association_include <add> # SQL error in sort clause if :include is not included <add> # due to Unknown column 'authors.id' <add> assert Category.find(1).posts_with_authors_sorted_by_author_id.find_by_title('Welcome to the weblog') <add> end <ide> end <ide><path>activerecord/test/cases/associations/has_many_through_associations_test.rb <ide> def test_association_callback_ordering <ide> post.people_with_callbacks.clear <ide> assert_equal (%w(Michael David Julian Roger) * 2).sort, log.last(8).collect(&:last).sort <ide> end <add> <add> def test_dynamic_find_should_respect_association_include <add> # SQL error in sort clause if :include is not included <add> # due to Unknown column 'comments.id' <add> assert Person.find(1).posts_with_comments_sorted_by_comment_id.find_by_title('Welcome to the weblog') <add> end <ide> end <ide><path>activerecord/test/models/author.rb <ide> class Author < ActiveRecord::Base <ide> has_many :posts <ide> has_many :posts_with_comments, :include => :comments, :class_name => "Post" <add> has_many :posts_with_comments_sorted_by_comment_id, :include => :comments, :class_name => "Post", :order => 'comments.id' <ide> has_many :posts_with_categories, :include => :categories, :class_name => "Post" <ide> has_many :posts_with_comments_and_categories, :include => [ :comments, :categories ], :order => "posts.id", :class_name => "Post" <ide> has_many :posts_containing_the_letter_a, :class_name => "Post" <ide><path>activerecord/test/models/category.rb <ide> class Category < ActiveRecord::Base <ide> has_and_belongs_to_many :posts <ide> has_and_belongs_to_many :special_posts, :class_name => "Post" <ide> has_and_belongs_to_many :other_posts, :class_name => "Post" <add> has_and_belongs_to_many :posts_with_authors_sorted_by_author_id, :class_name => "Post", :include => :authors, :order => "authors.id" <ide> <ide> has_and_belongs_to_many(:select_testing_posts, <ide> :class_name => 'Post', <ide><path>activerecord/test/models/person.rb <ide> class Person < ActiveRecord::Base <ide> has_many :references <ide> has_many :jobs, :through => :references <ide> has_one :favourite_reference, :class_name => 'Reference', :conditions => ['favourite=?', true] <del> <add> has_many :posts_with_comments_sorted_by_comment_id, :through => :readers, :source => :post, :include => :comments, :order => 'comments.id' <ide> end
8
Javascript
Javascript
add isenabled function to autoupdatemanager
c19296efb753167619a66532ecb6481339415b9d
<ide><path>spec/auto-update-manager-spec.js <ide> describe('AutoUpdateManager (renderer)', () => { <ide> }) <ide> }) <ide> <add> describe('::isEnabled', () => { <add> let platform, releaseChannel <add> it('returns true on OS X and Windows, when in stable', () => { <add> spyOn(autoUpdateManager, 'getPlatform').andCallFake(() => platform) <add> spyOn(autoUpdateManager, 'getReleaseChannel').andCallFake(() => releaseChannel) <add> <add> platform = 'win32' <add> releaseChannel = 'stable' <add> expect(autoUpdateManager.isEnabled()).toBe(true) <add> <add> platform = 'win32' <add> releaseChannel = 'dev' <add> expect(autoUpdateManager.isEnabled()).toBe(false) <add> <add> platform = 'darwin' <add> releaseChannel = 'stable' <add> expect(autoUpdateManager.isEnabled()).toBe(true) <add> <add> platform = 'darwin' <add> releaseChannel = 'dev' <add> expect(autoUpdateManager.isEnabled()).toBe(false) <add> <add> platform = 'linux' <add> releaseChannel = 'stable' <add> expect(autoUpdateManager.isEnabled()).toBe(false) <add> <add> platform = 'linux' <add> releaseChannel = 'dev' <add> expect(autoUpdateManager.isEnabled()).toBe(false) <add> }) <add> }) <add> <ide> describe('::dispose', () => { <ide> it('subscribes to "update-not-available" event', () => { <ide> const spy = jasmine.createSpy('spy') <ide><path>src/auto-update-manager.js <ide> export default class AutoUpdateManager { <ide> this.emitter.dispose() <ide> } <ide> <add> checkForUpdate () { <add> ipcRenderer.send('check-for-update') <add> } <add> <add> quitAndInstallUpdate () { <add> ipcRenderer.send('install-update') <add> } <add> <add> isEnabled () { <add> return this.getReleaseChannel() == 'stable' && (this.getPlatform() === 'darwin' || this.getPlatform() === 'win32') <add> } <add> <ide> onDidBeginCheckingForUpdate (callback) { <ide> return this.emitter.on('did-begin-checking-for-update', callback) <ide> } <ide> export default class AutoUpdateManager { <ide> return this.emitter.on('update-not-available', callback) <ide> } <ide> <del> checkForUpdate () { <del> ipcRenderer.send('check-for-update') <add> getPlatform () { <add> return process.platform <add> } <add> <add> // TODO: We should move this into atom env or something. <add> getReleaseChannel () { <add> let version = atom.getVersion() <add> if (version.indexOf('beta') > -1) { <add> return 'beta' <add> } else if (version.indexOf('dev') > -1) { <add> return 'dev' <add> } <add> return 'stable' <ide> } <ide> }
2
PHP
PHP
add missing skip if pdo_sqlsrv is not installed
eb9918ff29e4bb3eecfd3c11c82619e3ccf6a7f9
<ide><path>tests/TestCase/Database/Driver/SqlserverTest.php <ide> public function dnsStringDataProvider() <ide> */ <ide> public function testDnsString($constructorArgs, $dnsString) <ide> { <add> $this->skipIf($this->missingExtension, 'pdo_sqlsrv is not installed.'); <ide> $driver = $this->getMockBuilder('Cake\Database\Driver\Sqlserver') <ide> ->setMethods(['_connect']) <ide> ->setConstructorArgs([$constructorArgs])
1
Ruby
Ruby
fix some typos
b1ee5e8e7f98b32196423a144e7a87ae284c7a5c
<ide><path>actionpack/lib/action_controller/metal/redirecting.rb <ide> def redirect_to(options = {}, response_status = {}) <ide> # <ide> # ==== Options <ide> # * <tt>:fallback_location</tt> - The default fallback location that will be used on missing `Referer` header. <del> # * <tt>:allow_other_host</tt> - Allows or dissallow redirection to the host that is different to the current host <add> # * <tt>:allow_other_host</tt> - Allows or disallow redirection to the host that is different to the current host <ide> # <ide> # All other options that can be passed to <tt>redirect_to</tt> are accepted as <ide> # options and the behavior is identical. <ide><path>actionview/lib/action_view/helpers/tag_helper.rb <ide> def method_missing(called, *args, &block) <ide> # This may come in handy when using jQuery's HTML5-aware <tt>.data()</tt> <ide> # from 1.4.3. <ide> # <del> # tag.div data: { city_state: %w( Chigaco IL ) } <add> # tag.div data: { city_state: %w( Chicago IL ) } <ide> # # => <div data-city-state="[&quot;Chicago&quot;,&quot;IL&quot;]"></div> <ide> # <ide> # The generated attributes are escaped by default. This can be disabled using <ide><path>actionview/lib/action_view/test_case.rb <ide> def method_missing(selector, *args) <ide> begin <ide> routes = @controller.respond_to?(:_routes) && @controller._routes <ide> rescue <del> # Dont call routes, if there is an error on _routes call <add> # Don't call routes, if there is an error on _routes call <ide> end <ide> <ide> if routes && <ide> def respond_to_missing?(name, include_private = false) <ide> begin <ide> routes = @controller.respond_to?(:_routes) && @controller._routes <ide> rescue <del> # Dont call routes, if there is an error on _routes call <add> # Don't call routes, if there is an error on _routes call <ide> end <ide> <ide> routes && <ide><path>activerecord/lib/active_record/callbacks.rb <ide> module ActiveRecord <ide> # <ide> # private <ide> # <del> # def log_chidren <add> # def log_children <ide> # # Child processing <ide> # end <ide> # <ide> module ActiveRecord <ide> # <ide> # private <ide> # <del> # def log_chidren <add> # def log_children <ide> # # Child processing <ide> # end <ide> #
4
Javascript
Javascript
remove an unnecessary condition
080f21e64f28552bd63590db0b470d15d1990c96
<ide><path>src/renderers/native/ReactNativeFiber.js <ide> const NativeRenderer = ReactFiberReconciler({ <ide> }, <ide> <ide> appendInitialChild(parentInstance : Instance, child : Instance | TextInstance) : void { <del> if (typeof child === 'number') { <del> parentInstance._children.push(child); <del> } else { <del> parentInstance._children.push(child); <del> } <add> parentInstance._children.push(child); <ide> }, <ide> <ide> commitTextUpdate(
1
Python
Python
add clarification of weights to documentation
35c2d9c9bb597be696005e325742fb8ae3e8f117
<ide><path>numpy/lib/polynomial.py <ide> def polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False): <ide> default) just the coefficients are returned, when True diagnostic <ide> information from the singular value decomposition is also returned. <ide> w : array_like, shape (M,), optional <del> weights to apply to the y-coordinates of the sample points. <add> Weights to apply to the y-coordinates of the sample points. For <add> gaussian uncertainties, use 1/sigma (not 1/sigma**2). <ide> cov : bool, optional <ide> Return the estimate and the covariance matrix of the estimate <ide> If full is True, then cov is not returned.
1
Javascript
Javascript
update amp example
3b6aeaae8270588cd1b6d48cc72beb0b3bc0643a
<ide><path>examples/amp/pages/dog.js <ide> import Head from 'next/head' <ide> import { useAmp, withAmp } from 'next/amp' <ide> import Byline from '../components/Byline' <ide> <del>export default withAmp(() => { <del> const isAmp = useAmp() <add>export default withAmp( <add> () => { <add> const isAmp = useAmp() <ide> <del> return ( <del> <div> <del> <Head> <del> <title>The Dog</title> <del> </Head> <del> <h1>The Dog</h1> <del> <Byline author='Meow Meow Fuzzyface' /> <del> <p> <del> <a href={isAmp ? '/dog' : '/dog?amp=1'}> <del> {isAmp ? 'View Non-AMP' : 'View AMP'} Version <del> </a> <del> </p> <del> <p className='caption'>Woooooooooooof</p> <del> <p> <del> Wafer donut candy soufflé{' '} <del> <a href={isAmp ? '/?amp=1' : '/'}>lemon drops</a> icing. Marzipan gummi <del> bears pie danish lollipop pudding powder gummi bears sweet. Pie sweet <del> roll sweet roll topping chocolate bar dragée pudding chocolate cake. <del> Croissant sweet chocolate bar cheesecake candy canes. Tootsie roll icing <del> macaroon bonbon cupcake apple pie candy canes biscuit candy canes. <del> Jujubes jelly liquorice toffee gingerbread. Candy tootsie roll macaroon <del> chocolate bar icing sugar plum pie. Icing gummies chocolate bar <del> chocolate marzipan bonbon cookie chocolate tart. Caramels danish halvah <del> croissant. Cheesecake cookie tootsie roll ice cream. Powder dessert <del> carrot cake muffin tiramisu lemon drops liquorice topping brownie. <del> Soufflé chocolate cake croissant cupcake jelly. <del> </p> <del> <p> <del> Muffin gummies dessert cheesecake candy canes. Candy canes danish cotton <del> candy tart dessert powder bear claw marshmallow. Muffin chocolate <del> marshmallow danish. Chocolate bar biscuit cake tiramisu. Topping sweet <del> brownie jujubes powder marzipan. Croissant wafer bonbon chupa chups cake <del> cake marzipan caramels jujubes. Cupcake cheesecake sweet roll <del> marshmallow lollipop danish jujubes jelly icing. Apple pie chupa chups <del> lollipop jelly-o cheesecake jelly beans cake dessert. Tootsie roll <del> tootsie roll bonbon pastry croissant gummi bears cake cake. Fruitcake <del> sugar plum halvah gingerbread cookie pastry chupa chups wafer lemon <del> drops. Marshmallow liquorice oat cake lollipop. Lemon drops oat cake <del> halvah liquorice danish powder cupcake soufflé. Cake tart topping <del> jelly-o tart sugar plum. Chocolate bar cookie wafer tootsie roll candy <del> cotton candy toffee pie donut. <del> </p> <del> <p> <del> Ice cream lollipop marshmallow tiramisu jujubes croissant. Bear claw <del> lemon drops marzipan candy bonbon cupcake powder. Candy canes cheesecake <del> bear claw pastry cake donut jujubes. Icing tart jelly-o soufflé bonbon <del> apple pie. Cheesecake pie chupa chups toffee powder. Bonbon lemon drops <del> carrot cake pudding candy halvah cheesecake lollipop cupcake. Pudding <del> marshmallow fruitcake. Gummi bears bonbon chupa chups lemon drops. Wafer <del> dessert gummies gummi bears biscuit donut tiramisu gummi bears brownie. <del> Tootsie roll liquorice bonbon cookie. Sesame snaps chocolate bar cake <del> croissant chupa chups cheesecake gingerbread tiramisu jelly. Cheesecake <del> ice cream muffin lollipop gummies. Sesame snaps jelly beans sweet bear <del> claw tart. <del> </p> <del> <p> <del> Sweet topping chupa chups chocolate cake jelly-o liquorice danish. <del> Pastry jelly beans apple pie dessert pastry lemon drops marzipan <del> gummies. Jelly beans macaroon bear claw cotton candy. Toffee sweet <del> lollipop toffee oat cake. Jelly-o oat cake fruitcake chocolate bar <del> sweet. Lemon drops gummies chocolate cake lollipop bear claw croissant <del> danish icing. Chocolate bar donut brownie chocolate cake lemon drops <del> chocolate bar. Cake fruitcake pudding chocolate apple pie. Brownie <del> tiramisu chocolate macaroon lemon drops wafer soufflé jujubes icing. <del> Cheesecake tiramisu cake macaroon tart lollipop donut. Gummi bears <del> dragée pudding bear claw. Muffin cake cupcake candy canes. Soufflé candy <del> canes biscuit. Macaroon gummies danish. <del> </p> <del> <p> <del> Cupcake cupcake tart. Cotton candy danish candy canes oat cake ice cream <del> candy canes powder wafer. Chocolate sesame snaps oat cake dragée <del> cheesecake. Sesame snaps marshmallow topping liquorice cookie <del> marshmallow. Liquorice pudding chocolate bar. Cake powder brownie <del> fruitcake. Carrot cake dessert marzipan sugar plum cupcake cheesecake <del> pastry. Apple pie macaroon ice cream fruitcake apple pie cookie. Tootsie <del> roll ice cream oat cake cheesecake donut cheesecake bear claw. Sesame <del> snaps marzipan jelly beans chocolate tootsie roll. Chocolate bar donut <del> dragée ice cream biscuit. Pie candy canes muffin candy canes ice cream <del> tiramisu. <del> </p> <del> </div> <del> ) <del>}, { hybrid: true }) <add> return ( <add> <div> <add> <Head> <add> <title>The Dog (Hybrid AMP Page)</title> <add> </Head> <add> <h1>The Dog</h1> <add> <Byline author='Meow Meow Fuzzyface' /> <add> <p> <add> <a href={isAmp ? '/dog' : '/dog?amp=1'}> <add> {isAmp ? 'View Non-AMP' : 'View AMP'} Version <add> </a> <add> </p> <add> <p className='caption'>Woooooooooooof</p> <add> <p> <add> Wafer donut candy soufflé{' '} <add> <a href={isAmp ? '/?amp=1' : '/'}>lemon drops</a> icing. Marzipan <add> gummi bears pie danish lollipop pudding powder gummi bears sweet. Pie <add> sweet roll sweet roll topping chocolate bar dragée pudding chocolate <add> cake. Croissant sweet chocolate bar cheesecake candy canes. Tootsie <add> roll icing macaroon bonbon cupcake apple pie candy canes biscuit candy <add> canes. Jujubes jelly liquorice toffee gingerbread. Candy tootsie roll <add> macaroon chocolate bar icing sugar plum pie. Icing gummies chocolate <add> bar chocolate marzipan bonbon cookie chocolate tart. Caramels danish <add> halvah croissant. Cheesecake cookie tootsie roll ice cream. Powder <add> dessert carrot cake muffin tiramisu lemon drops liquorice topping <add> brownie. Soufflé chocolate cake croissant cupcake jelly. <add> </p> <add> <p> <add> Muffin gummies dessert cheesecake candy canes. Candy canes danish <add> cotton candy tart dessert powder bear claw marshmallow. Muffin <add> chocolate marshmallow danish. Chocolate bar biscuit cake tiramisu. <add> Topping sweet brownie jujubes powder marzipan. Croissant wafer bonbon <add> chupa chups cake cake marzipan caramels jujubes. Cupcake cheesecake <add> sweet roll marshmallow lollipop danish jujubes jelly icing. Apple pie <add> chupa chups lollipop jelly-o cheesecake jelly beans cake dessert. <add> Tootsie roll tootsie roll bonbon pastry croissant gummi bears cake <add> cake. Fruitcake sugar plum halvah gingerbread cookie pastry chupa <add> chups wafer lemon drops. Marshmallow liquorice oat cake lollipop. <add> Lemon drops oat cake halvah liquorice danish powder cupcake soufflé. <add> Cake tart topping jelly-o tart sugar plum. Chocolate bar cookie wafer <add> tootsie roll candy cotton candy toffee pie donut. <add> </p> <add> <p> <add> Ice cream lollipop marshmallow tiramisu jujubes croissant. Bear claw <add> lemon drops marzipan candy bonbon cupcake powder. Candy canes <add> cheesecake bear claw pastry cake donut jujubes. Icing tart jelly-o <add> soufflé bonbon apple pie. Cheesecake pie chupa chups toffee powder. <add> Bonbon lemon drops carrot cake pudding candy halvah cheesecake <add> lollipop cupcake. Pudding marshmallow fruitcake. Gummi bears bonbon <add> chupa chups lemon drops. Wafer dessert gummies gummi bears biscuit <add> donut tiramisu gummi bears brownie. Tootsie roll liquorice bonbon <add> cookie. Sesame snaps chocolate bar cake croissant chupa chups <add> cheesecake gingerbread tiramisu jelly. Cheesecake ice cream muffin <add> lollipop gummies. Sesame snaps jelly beans sweet bear claw tart. <add> </p> <add> <p> <add> Sweet topping chupa chups chocolate cake jelly-o liquorice danish. <add> Pastry jelly beans apple pie dessert pastry lemon drops marzipan <add> gummies. Jelly beans macaroon bear claw cotton candy. Toffee sweet <add> lollipop toffee oat cake. Jelly-o oat cake fruitcake chocolate bar <add> sweet. Lemon drops gummies chocolate cake lollipop bear claw croissant <add> danish icing. Chocolate bar donut brownie chocolate cake lemon drops <add> chocolate bar. Cake fruitcake pudding chocolate apple pie. Brownie <add> tiramisu chocolate macaroon lemon drops wafer soufflé jujubes icing. <add> Cheesecake tiramisu cake macaroon tart lollipop donut. Gummi bears <add> dragée pudding bear claw. Muffin cake cupcake candy canes. Soufflé <add> candy canes biscuit. Macaroon gummies danish. <add> </p> <add> <p> <add> Cupcake cupcake tart. Cotton candy danish candy canes oat cake ice <add> cream candy canes powder wafer. Chocolate sesame snaps oat cake dragée <add> cheesecake. Sesame snaps marshmallow topping liquorice cookie <add> marshmallow. Liquorice pudding chocolate bar. Cake powder brownie <add> fruitcake. Carrot cake dessert marzipan sugar plum cupcake cheesecake <add> pastry. Apple pie macaroon ice cream fruitcake apple pie cookie. <add> Tootsie roll ice cream oat cake cheesecake donut cheesecake bear claw. <add> Sesame snaps marzipan jelly beans chocolate tootsie roll. Chocolate <add> bar donut dragée ice cream biscuit. Pie candy canes muffin candy canes <add> ice cream tiramisu. <add> </p> <add> </div> <add> ) <add> }, <add> { hybrid: true } <add>) <ide><path>examples/amp/pages/index.js <ide> export default withAmp(() => { <ide> return ( <ide> <Layout> <ide> <Head> <del> <title>The Cat</title> <add> <title>The Cat (AMP-only Page)</title> <ide> </Head> <ide> <h1>The Cat</h1> <ide> <Byline author='Dan Zajdband' /> <del> <p> <del> <a href={isAmp ? '/' : '/?amp=1'}> <del> {isAmp ? 'View Non-AMP' : 'View AMP'} Version <del> </a> <del> </p> <ide> <p className='caption'>Meowwwwwwww</p> <ide> <p> <ide> Cat ipsum dolor <a href={isAmp ? '/dog?amp=1' : '/dog'}>sit amet</a>, <ide><path>examples/amp/pages/normal.js <del>export default () => ( <del> <p>I'm just a normal old page, no AMP for me</p> <del>) <add>export default () => <p>I'm just a normal old page, no AMP for me</p>
3
Javascript
Javascript
fix eventdispatcher test
5f0621c9381c3e3c67aca4ae3bc430f8d9ab2492
<ide><path>packages/@ember/-internals/glimmer/tests/integration/event-dispatcher-test.js <ide> import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers'; <ide> <ide> import { Component } from '../utils/helpers'; <del>import { getCurrentRunLoop, run } from '@ember/runloop'; <add>import { getCurrentRunLoop } from '@ember/runloop'; <ide> import { <ide> subscribe as instrumentationSubscribe, <ide> reset as instrumentationReset, <ide> moduleFor( <ide> constructor() { <ide> super(...arguments); <ide> <del> let dispatcher = this.owner.lookup('event_dispatcher:main'); <del> run(dispatcher, 'destroy'); <del> this.owner.__container__.reset('event_dispatcher:main'); <ide> this.dispatcher = this.owner.lookup('event_dispatcher:main'); <ide> } <ide> <add> getBootOptions() { <add> return { <add> skipEventDispatcher: true, <add> }; <add> } <add> <ide> ['@test additional events can be specified'](assert) { <ide> this.dispatcher.setup({ myevent: 'myEvent' }); <ide> <ide><path>packages/internal-test-helpers/lib/test-cases/rendering.js <ide> export default class RenderingTestCase extends AbstractTestCase { <ide> this.element = document.querySelector('#qunit-fixture'); <ide> this.component = null; <ide> <del> if (!bootOptions || bootOptions.isInteractive !== false) { <add> if ( <add> !bootOptions || <add> (bootOptions.isInteractive !== false && bootOptions.skipEventDispatcher !== true) <add> ) { <ide> owner.lookup('event_dispatcher:main').setup(this.getCustomDispatcherEvents(), this.element); <ide> } <ide> }
2
PHP
PHP
add missing option
a439d75d42efba42411589fa3288cbd595822802
<ide><path>src/ORM/Marshaller.php <ide> protected function _marshalAssociation($assoc, $value, $options) <ide> * * associated: Associations listed here will be marshalled as well. <ide> * * fieldList: A whitelist of fields to be assigned to the entity. If not present, <ide> * the accessible fields list in the entity will be used. <add> * * accessibleFields: A list of fields to allow or deny in entity accessible fields. <ide> * <ide> * @param array $data The data to hydrate. <ide> * @param array $options List of options
1
Python
Python
add job labels to bigquery check operators.
943baff6701f9f8591090bf76219571d7f5e2cc5
<ide><path>airflow/providers/google/cloud/hooks/bigquery.py <ide> def __init__( <ide> bigquery_conn_id: Optional[str] = None, <ide> api_resource_configs: Optional[Dict] = None, <ide> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> labels: Optional[Dict] = None, <ide> ) -> None: <ide> # To preserve backward compatibility <ide> # TODO: remove one day <ide> def __init__( <ide> self.location = location <ide> self.running_job_id = None # type: Optional[str] <ide> self.api_resource_configs = api_resource_configs if api_resource_configs else {} # type Dict <add> self.labels = labels <ide> <ide> def get_conn(self) -> "BigQueryConnection": <ide> """Returns a BigQuery PEP 249 connection object.""" <ide> def run_query( <ide> if not self.project_id: <ide> raise ValueError("The project_id should be set") <ide> <add> labels = labels or self.labels <ide> schema_update_options = list(schema_update_options or []) <ide> <ide> if time_partitioning is None: <ide> def __init__( <ide> api_resource_configs: Optional[Dict] = None, <ide> location: Optional[str] = None, <ide> num_retries: int = 5, <add> labels: Optional[Dict] = None, <ide> ) -> None: <ide> <ide> super().__init__() <ide> def __init__( <ide> self.running_job_id = None # type: Optional[str] <ide> self.location = location <ide> self.num_retries = num_retries <add> self.labels = labels <ide> self.hook = hook <ide> <ide> def create_empty_table(self, *args, **kwargs) -> None: <ide><path>airflow/providers/google/cloud/operators/bigquery.py <ide> def get_db_hook(self) -> BigQueryHook: <ide> use_legacy_sql=self.use_legacy_sql, <ide> location=self.location, <ide> impersonation_chain=self.impersonation_chain, <add> labels=self.labels, <ide> ) <ide> <ide> <ide> class BigQueryCheckOperator(_BigQueryDbHookMixin, SQLCheckOperator): <ide> Service Account Token Creator IAM role to the directly preceding identity, with first <ide> account from the list granting this role to the originating account (templated). <ide> :type impersonation_chain: Union[str, Sequence[str]] <add> :param labels: a dictionary containing labels for the table, passed to BigQuery <add> :type labels: dict <ide> """ <ide> <ide> template_fields = ( <ide> 'sql', <ide> 'gcp_conn_id', <ide> 'impersonation_chain', <add> 'labels', <ide> ) <ide> template_ext = ('.sql',) <ide> ui_color = BigQueryUIColors.CHECK.value <ide> def __init__( <ide> use_legacy_sql: bool = True, <ide> location: Optional[str] = None, <ide> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> labels: Optional[dict] = None, <ide> **kwargs, <ide> ) -> None: <ide> super().__init__(sql=sql, **kwargs) <ide> def __init__( <ide> self.use_legacy_sql = use_legacy_sql <ide> self.location = location <ide> self.impersonation_chain = impersonation_chain <add> self.labels = labels <ide> <ide> <ide> class BigQueryValueCheckOperator(_BigQueryDbHookMixin, SQLValueCheckOperator): <ide> class BigQueryValueCheckOperator(_BigQueryDbHookMixin, SQLValueCheckOperator): <ide> Service Account Token Creator IAM role to the directly preceding identity, with first <ide> account from the list granting this role to the originating account (templated). <ide> :type impersonation_chain: Union[str, Sequence[str]] <add> :param labels: a dictionary containing labels for the table, passed to BigQuery <add> :type labels: dict <ide> """ <ide> <ide> template_fields = ( <ide> 'sql', <ide> 'gcp_conn_id', <ide> 'pass_value', <ide> 'impersonation_chain', <add> 'labels', <ide> ) <ide> template_ext = ('.sql',) <ide> ui_color = BigQueryUIColors.CHECK.value <ide> def __init__( <ide> use_legacy_sql: bool = True, <ide> location: Optional[str] = None, <ide> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> labels: Optional[dict] = None, <ide> **kwargs, <ide> ) -> None: <ide> super().__init__(sql=sql, pass_value=pass_value, tolerance=tolerance, **kwargs) <ide> def __init__( <ide> self.gcp_conn_id = gcp_conn_id <ide> self.use_legacy_sql = use_legacy_sql <ide> self.impersonation_chain = impersonation_chain <add> self.labels = labels <ide> <ide> <ide> class BigQueryIntervalCheckOperator(_BigQueryDbHookMixin, SQLIntervalCheckOperator): <ide> class BigQueryIntervalCheckOperator(_BigQueryDbHookMixin, SQLIntervalCheckOperat <ide> Service Account Token Creator IAM role to the directly preceding identity, with first <ide> account from the list granting this role to the originating account (templated). <ide> :type impersonation_chain: Union[str, Sequence[str]] <add> :param labels: a dictionary containing labels for the table, passed to BigQuery <add> :type labels: dict <ide> """ <ide> <ide> template_fields = ( <ide> class BigQueryIntervalCheckOperator(_BigQueryDbHookMixin, SQLIntervalCheckOperat <ide> 'sql1', <ide> 'sql2', <ide> 'impersonation_chain', <add> 'labels', <ide> ) <ide> ui_color = BigQueryUIColors.CHECK.value <ide> <ide> def __init__( <ide> use_legacy_sql: bool = True, <ide> location: Optional[str] = None, <ide> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> labels: Optional[Dict] = None, <ide> **kwargs, <ide> ) -> None: <ide> super().__init__( <ide> def __init__( <ide> self.use_legacy_sql = use_legacy_sql <ide> self.location = location <ide> self.impersonation_chain = impersonation_chain <add> self.labels = labels <ide> <ide> <ide> class BigQueryGetDataOperator(BaseOperator):
2
PHP
PHP
add missing consoleio method
eef11456b51cd140c0cb47f33cdf58d7f966edf4
<ide><path>src/Console/ConsoleIo.php <ide> public function ask($prompt, $default = null) { <ide> * <ide> * @param int $mode <ide> * @return void <add> * @see \Cake\Console\ConsoleOutput::outputAs() <ide> */ <ide> public function outputAs($mode) { <ide> $this->_out->outputAs($mode); <ide> } <ide> <add>/** <add> * Add a new output style or get defined styles. <add> * <add> * @param string $style The style to get or create. <add> * @param array $definition The array definition of the style to change or create a style <add> * or false to remove a style. <add> * @return mixed If you are getting styles, the style or null will be returned. If you are creating/modifying <add> * styles true will be returned. <add> * @see \Cake\Console\ConsoleOutput::styles() <add> */ <add> public function styles($style = null, $definition = null) { <add> $this->_out->styles($style, $definition); <add> } <add> <ide> /** <ide> * Prompts the user for input based on a list of options, and returns it. <ide> * <ide><path>src/Console/ConsoleOutput.php <ide> protected function _write($message) { <ide> * <ide> * ### Get a style definition <ide> * <del> * `$this->output->styles('error');` <add> * `$output->styles('error');` <ide> * <ide> * ### Get all the style definitions <ide> * <del> * `$this->output->styles();` <add> * `$output->styles();` <ide> * <ide> * ### Create or modify an existing style <ide> * <del> * `$this->output->styles('annoy', ['text' => 'purple', 'background' => 'yellow', 'blink' => true]);` <add> * `$output->styles('annoy', ['text' => 'purple', 'background' => 'yellow', 'blink' => true]);` <ide> * <ide> * ### Remove a style <ide> * <ide><path>tests/TestCase/Console/ConsoleIoTest.php <ide> public function testSetLoggers() { <ide> $this->assertFalse(Log::engine('stderr')); <ide> } <ide> <add>/** <add> * Ensure that styles() just proxies to stdout. <add> * <add> * @return void <add> */ <add> public function testStyles() { <add> $this->out->expects($this->once()) <add> ->method('styles') <add> ->with('name', 'props'); <add> $this->io->styles('name', 'props'); <add> } <add> <ide> }
3
Ruby
Ruby
make uniq in lookupcontext#formats=
ffc842a09927986819cf7a66ae6a15f97bfeed76
<ide><path>actionview/lib/action_view/lookup_context.rb <ide> def formats=(values) <ide> if values <ide> values = values.compact <ide> values.concat(default_formats) if values.delete "*/*" <add> values.uniq! <add> <ide> if values == [:js] <ide> values << :html <ide> @html_fallback_for_js = true <ide><path>actionview/test/template/lookup_context_test.rb <ide> def teardown <ide> <ide> test "handles explicitly defined */* formats fallback to :js" do <ide> @lookup_context.formats = [:js, Mime::ALL] <del> assert_equal [:js, *Mime::SET.symbols], @lookup_context.formats <add> assert_equal [:js, *Mime::SET.symbols].uniq, @lookup_context.formats <ide> end <ide> <ide> test "adds :html fallback to :js formats" do
2
Python
Python
fix testawsdatasyncoperatorupdate.__init__ method
0e0aefb8f00ec0cc7844abe6753a6b654d5039d9
<ide><path>tests/providers/amazon/aws/operators/test_datasync.py <ide> def test_xcom_push(self, mock_get_conn): <ide> mock_datasync == no_datasync, "moto datasync package missing" <ide> ) # pylint: disable=W0143 <ide> class TestAWSDataSyncOperatorUpdate(AWSDataSyncTestCaseBase): <del> def __init(self, *args, **kwargs): <add> def __init__(self, *args, **kwargs): <ide> super().__init__(*args, **kwargs) <ide> self.datasync = None <ide>
1
Python
Python
update variable names
75111a446e8323df607c17703bfb4303eb966dde
<ide><path>libcloud/common/dimensiondata.py <ide> class DimensionDataConnection(ConnectionUserAndKey): <ide> <ide> api_path_version_1 = '/oec' <ide> api_path_version_2 = '/caas' <del> api_version_1 = '0.9' <del> api_version_2 = '2.3' <add> api_version_1 = 0.9 <add> <add> # Earliest version supported <add> oldest_api_version = 2.2 <add> <add> # Latest version supported <add> latest_api_version = 2.3 <add> <add> # Default api version <add> active_api_version = 2.3 <ide> <ide> _orgId = None <ide> responseCls = DimensionDataResponse <ide> def __init__(self, user_id, key, secure=True, host=None, port=None, <ide> self.host = conn_kwargs['region']['host'] <ide> <ide> if api_version: <del> if api_version.startswith('2'): <del> self.api_version_2 = api_version <add> if float(api_version) < self.oldest_api_version: <add> msg = 'API Version specified is too old. No longer ' \ <add> 'supported. Please upgrade to the latest version {}' \ <add> .format(self.active_api_version) <add> <add> raise DimensionDataAPIException(code=None, <add> msg=msg, <add> driver=self.driver) <add> elif float(api_version) > self.latest_api_version: <add> msg = 'Unsupported API Version. The version specified is ' \ <add> 'not release yet. Please use the latest supported ' \ <add> 'version {}' \ <add> .format(self.active_api_version) <add> <add> raise DimensionDataAPIException(code=None, <add> msg=msg, <add> driver=self.driver) <add> <add> else: <add> # Overwrite default version using the version user specified <add> self.active_api_version = api_version <ide> <ide> def add_default_headers(self, headers): <ide> headers['Authorization'] = \ <ide> def request_api_1(self, action, params=None, data='', <ide> def request_api_2(self, path, action, params=None, data='', <ide> headers=None, method='GET'): <ide> action = "%s/%s/%s/%s" % (self.api_path_version_2, <del> self.api_version_2, path, action) <add> self.active_api_version, path, action) <ide> <ide> return super(DimensionDataConnection, self).request( <ide> action=action, <ide> def get_resource_path_api_2(self): <ide> resources that require a full path instead of just an ID, such as <ide> networks, and customer snapshots. <ide> """ <del> return ("%s/%s/%s" % (self.api_path_version_2, self.api_version_2, <add> return ("%s/%s/%s" % (self.api_path_version_2, self.active_api_version, <ide> self._get_orgId())) <ide> <ide> def wait_for_state(self, state, func, poll_interval=2, timeout=60, *args,
1
Ruby
Ruby
fix tests on 1.8
309001fd9f510879693828c340654f44ccc82406
<ide><path>Library/Homebrew/test/test_dependency_collector.rb <ide> def test_add_returns_created_dep <ide> def test_dependency_tags <ide> assert_predicate Dependency.new('foo', [:build]), :build? <ide> assert_predicate Dependency.new('foo', [:build, :optional]), :optional? <del> assert_includes Dependency.new('foo', [:universal]).options, "--universal" <add> assert_includes Dependency.new('foo', ["universal"]).options, "--universal" <ide> assert_empty Dependency.new('foo').tags <ide> end <ide>
1
Python
Python
use new sphinx autodoc mock import path
517ffe9a3d2ca3608b8044e88d74d16fe5e65db1
<ide><path>docs/exts/docroles.py <ide> from functools import partial <ide> <ide> from docutils import nodes, utils <del>from sphinx.ext.autodoc.importer import import_module, mock <add>from sphinx.ext.autodoc.importer import import_module <add>from sphinx.ext.autodoc.mock import mock <ide> <ide> <ide> class RoleException(Exception):
1
Go
Go
get process list after pid 1 dead
ac8bd12b39d39a9361adc174bdff7837e771460d
<ide><path>daemon/execdriver/native/driver.go <ide> func notifyOnOOM(container libcontainer.Container) <-chan struct{} { <ide> return oom <ide> } <ide> <add>func killCgroupProcs(c libcontainer.Container) { <add> var procs []*os.Process <add> if err := c.Pause(); err != nil { <add> logrus.Warn(err) <add> } <add> pids, err := c.Processes() <add> if err != nil { <add> // don't care about childs if we can't get them, this is mostly because cgroup already deleted <add> logrus.Warnf("Failed to get processes from container %s: %v", c.ID(), err) <add> } <add> for _, pid := range pids { <add> if p, err := os.FindProcess(pid); err == nil { <add> procs = append(procs, p) <add> if err := p.Kill(); err != nil { <add> logrus.Warn(err) <add> } <add> } <add> } <add> if err := c.Resume(); err != nil { <add> logrus.Warn(err) <add> } <add> for _, p := range procs { <add> if _, err := p.Wait(); err != nil { <add> logrus.Warn(err) <add> } <add> } <add>} <add> <ide> func waitInPIDHost(p *libcontainer.Process, c libcontainer.Container) func() (*os.ProcessState, error) { <ide> return func() (*os.ProcessState, error) { <ide> pid, err := p.Pid() <ide> if err != nil { <ide> return nil, err <ide> } <ide> <del> processes, err := c.Processes() <del> <ide> process, err := os.FindProcess(pid) <ide> s, err := process.Wait() <ide> if err != nil { <ide> func waitInPIDHost(p *libcontainer.Process, c libcontainer.Container) func() (*o <ide> } <ide> s = execErr.ProcessState <ide> } <del> if err != nil { <del> return s, err <del> } <del> <del> for _, pid := range processes { <del> process, err := os.FindProcess(pid) <del> if err != nil { <del> logrus.Errorf("Failed to kill process: %d", pid) <del> continue <del> } <del> process.Kill() <del> } <del> <add> killCgroupProcs(c) <ide> p.Wait() <ide> return s, err <ide> } <ide><path>integration-cli/docker_cli_run_test.go <ide> func TestRunContainerWithRmFlagCannotStartContainer(t *testing.T) { <ide> <ide> logDone("run - container is removed if run with --rm and cannot start") <ide> } <add> <add>func TestRunPidHostWithChildIsKillable(t *testing.T) { <add> defer deleteAllContainers() <add> name := "ibuildthecloud" <add> if out, err := exec.Command(dockerBinary, "run", "-d", "--pid=host", "--name", name, "busybox", "sh", "-c", "sleep 30; echo hi").CombinedOutput(); err != nil { <add> t.Fatal(err, out) <add> } <add> time.Sleep(1 * time.Second) <add> errchan := make(chan error) <add> go func() { <add> if out, err := exec.Command(dockerBinary, "kill", name).CombinedOutput(); err != nil { <add> errchan <- fmt.Errorf("%v:\n%s", err, out) <add> } <add> close(errchan) <add> }() <add> select { <add> case err := <-errchan: <add> if err != nil { <add> t.Fatal(err) <add> } <add> case <-time.After(5 * time.Second): <add> t.Fatal("Kill container timed out") <add> } <add> logDone("run - can kill container with pid-host and some childs of pid 1") <add>}
2
PHP
PHP
fix bad merge
4235ab8d3768b1467ec6273c7503f519b6c886dc
<ide><path>src/Validation/Validation.php <ide> public static function date($check, $format = 'ymd', ?string $regex = null): boo <ide> $regex['Mdy'] = '/^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|Oct(ober)?|Dec(ember)?)\\ 31)|((Jan(uary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep)(tember)?|(Nov|Dec)(ember)?)\\ (0?[1-9]|([12]\\d)|30))|(Feb(ruary)?\\ (0?[1-9]|1\\d|2[0-8]|(29(?=,?\\ ' . $fourDigitLeapYear . ')))))\\,?\\ ' . $fourDigitYear . ')$/'; <ide> <ide> $regex['My'] = '%^(Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)' . <del> $separator . '((1[6-9]|[2-9]\\d)\\d{2})$%'; <ide> $separator . $fourDigitYear . '$%'; <ide> // phpcs:enable Generic.Files.LineLength <ide>
1
Ruby
Ruby
show correct return types for examples [ci skip]
0a96195119b38b18ee5bd68bc6d4c5feb75d2f65
<ide><path>activesupport/lib/active_support/core_ext/numeric/conversions.rb <ide> module ActiveSupport::NumericWithFormat <ide> # ==== Examples <ide> # <ide> # Phone Numbers: <del> # 5551234.to_s(:phone) # => 555-1234 <del> # 1235551234.to_s(:phone) # => 123-555-1234 <del> # 1235551234.to_s(:phone, area_code: true) # => (123) 555-1234 <del> # 1235551234.to_s(:phone, delimiter: ' ') # => 123 555 1234 <del> # 1235551234.to_s(:phone, area_code: true, extension: 555) # => (123) 555-1234 x 555 <del> # 1235551234.to_s(:phone, country_code: 1) # => +1-123-555-1234 <add> # 5551234.to_s(:phone) # => "555-1234" <add> # 1235551234.to_s(:phone) # => "123-555-1234" <add> # 1235551234.to_s(:phone, area_code: true) # => "(123) 555-1234" <add> # 1235551234.to_s(:phone, delimiter: ' ') # => "123 555 1234" <add> # 1235551234.to_s(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555" <add> # 1235551234.to_s(:phone, country_code: 1) # => "+1-123-555-1234" <ide> # 1235551234.to_s(:phone, country_code: 1, extension: 1343, delimiter: '.') <del> # # => +1.123.555.1234 x 1343 <add> # # => "+1.123.555.1234 x 1343" <ide> # <ide> # Currency: <del> # 1234567890.50.to_s(:currency) # => $1,234,567,890.50 <del> # 1234567890.506.to_s(:currency) # => $1,234,567,890.51 <del> # 1234567890.506.to_s(:currency, precision: 3) # => $1,234,567,890.506 <del> # 1234567890.506.to_s(:currency, locale: :fr) # => 1 234 567 890,51 € <add> # 1234567890.50.to_s(:currency) # => "$1,234,567,890.50" <add> # 1234567890.506.to_s(:currency) # => "$1,234,567,890.51" <add> # 1234567890.506.to_s(:currency, precision: 3) # => "$1,234,567,890.506" <add> # 1234567890.506.to_s(:currency, locale: :fr) # => "1 234 567 890,51 €" <ide> # -1234567890.50.to_s(:currency, negative_format: '(%u%n)') <del> # # => ($1,234,567,890.50) <add> # # => "($1,234,567,890.50)" <ide> # 1234567890.50.to_s(:currency, unit: '&pound;', separator: ',', delimiter: '') <del> # # => &pound;1234567890,50 <add> # # => "&pound;1234567890,50" <ide> # 1234567890.50.to_s(:currency, unit: '&pound;', separator: ',', delimiter: '', format: '%n %u') <del> # # => 1234567890,50 &pound; <add> # # => "1234567890,50 &pound;" <ide> # <ide> # Percentage: <del> # 100.to_s(:percentage) # => 100.000% <del> # 100.to_s(:percentage, precision: 0) # => 100% <del> # 1000.to_s(:percentage, delimiter: '.', separator: ',') # => 1.000,000% <del> # 302.24398923423.to_s(:percentage, precision: 5) # => 302.24399% <del> # 1000.to_s(:percentage, locale: :fr) # => 1 000,000% <del> # 100.to_s(:percentage, format: '%n %') # => 100.000 % <add> # 100.to_s(:percentage) # => "100.000%" <add> # 100.to_s(:percentage, precision: 0) # => "100%" <add> # 1000.to_s(:percentage, delimiter: '.', separator: ',') # => "1.000,000%" <add> # 302.24398923423.to_s(:percentage, precision: 5) # => "302.24399%" <add> # 1000.to_s(:percentage, locale: :fr) # => "1 000,000%" <add> # 100.to_s(:percentage, format: '%n %') # => "100.000 %" <ide> # <ide> # Delimited: <del> # 12345678.to_s(:delimited) # => 12,345,678 <del> # 12345678.05.to_s(:delimited) # => 12,345,678.05 <del> # 12345678.to_s(:delimited, delimiter: '.') # => 12.345.678 <del> # 12345678.to_s(:delimited, delimiter: ',') # => 12,345,678 <del> # 12345678.05.to_s(:delimited, separator: ' ') # => 12,345,678 05 <del> # 12345678.05.to_s(:delimited, locale: :fr) # => 12 345 678,05 <add> # 12345678.to_s(:delimited) # => "12,345,678" <add> # 12345678.05.to_s(:delimited) # => "12,345,678.05" <add> # 12345678.to_s(:delimited, delimiter: '.') # => "12.345.678" <add> # 12345678.to_s(:delimited, delimiter: ',') # => "12,345,678" <add> # 12345678.05.to_s(:delimited, separator: ' ') # => "12,345,678 05" <add> # 12345678.05.to_s(:delimited, locale: :fr) # => "12 345 678,05" <ide> # 98765432.98.to_s(:delimited, delimiter: ' ', separator: ',') <del> # # => 98 765 432,98 <add> # # => "98 765 432,98" <ide> # <ide> # Rounded: <del> # 111.2345.to_s(:rounded) # => 111.235 <del> # 111.2345.to_s(:rounded, precision: 2) # => 111.23 <del> # 13.to_s(:rounded, precision: 5) # => 13.00000 <del> # 389.32314.to_s(:rounded, precision: 0) # => 389 <del> # 111.2345.to_s(:rounded, significant: true) # => 111 <del> # 111.2345.to_s(:rounded, precision: 1, significant: true) # => 100 <del> # 13.to_s(:rounded, precision: 5, significant: true) # => 13.000 <del> # 111.234.to_s(:rounded, locale: :fr) # => 111,234 <add> # 111.2345.to_s(:rounded) # => "111.235" <add> # 111.2345.to_s(:rounded, precision: 2) # => "111.23" <add> # 13.to_s(:rounded, precision: 5) # => "13.00000" <add> # 389.32314.to_s(:rounded, precision: 0) # => "389" <add> # 111.2345.to_s(:rounded, significant: true) # => "111" <add> # 111.2345.to_s(:rounded, precision: 1, significant: true) # => "100" <add> # 13.to_s(:rounded, precision: 5, significant: true) # => "13.000" <add> # 111.234.to_s(:rounded, locale: :fr) # => "111,234" <ide> # 13.to_s(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true) <del> # # => 13 <del> # 389.32314.to_s(:rounded, precision: 4, significant: true) # => 389.3 <add> # # => "13" <add> # 389.32314.to_s(:rounded, precision: 4, significant: true) # => "389.3" <ide> # 1111.2345.to_s(:rounded, precision: 2, separator: ',', delimiter: '.') <del> # # => 1.111,23 <add> # # => "1.111,23" <ide> # <ide> # Human-friendly size in Bytes: <del> # 123.to_s(:human_size) # => 123 Bytes <del> # 1234.to_s(:human_size) # => 1.21 KB <del> # 12345.to_s(:human_size) # => 12.1 KB <del> # 1234567.to_s(:human_size) # => 1.18 MB <del> # 1234567890.to_s(:human_size) # => 1.15 GB <del> # 1234567890123.to_s(:human_size) # => 1.12 TB <del> # 1234567890123456.to_s(:human_size) # => 1.1 PB <del> # 1234567890123456789.to_s(:human_size) # => 1.07 EB <del> # 1234567.to_s(:human_size, precision: 2) # => 1.2 MB <del> # 483989.to_s(:human_size, precision: 2) # => 470 KB <del> # 1234567.to_s(:human_size, precision: 2, separator: ',') # => 1,2 MB <add> # 123.to_s(:human_size) # => "123 Bytes" <add> # 1234.to_s(:human_size) # => "1.21 KB" <add> # 12345.to_s(:human_size) # => "12.1 KB" <add> # 1234567.to_s(:human_size) # => "1.18 MB" <add> # 1234567890.to_s(:human_size) # => "1.15 GB" <add> # 1234567890123.to_s(:human_size) # => "1.12 TB" <add> # 1234567890123456.to_s(:human_size) # => "1.1 PB" <add> # 1234567890123456789.to_s(:human_size) # => "1.07 EB" <add> # 1234567.to_s(:human_size, precision: 2) # => "1.2 MB" <add> # 483989.to_s(:human_size, precision: 2) # => "470 KB" <add> # 1234567.to_s(:human_size, precision: 2, separator: ',') # => "1,2 MB" <ide> # 1234567890123.to_s(:human_size, precision: 5) # => "1.1228 TB" <ide> # 524288000.to_s(:human_size, precision: 5) # => "500 MB" <ide> # <ide><path>activesupport/lib/active_support/number_helper.rb <ide> module NumberHelper <ide> # number. <ide> # ==== Examples <ide> # <del> # number_to_phone(5551234) # => 555-1234 <del> # number_to_phone('5551234') # => 555-1234 <del> # number_to_phone(1235551234) # => 123-555-1234 <del> # number_to_phone(1235551234, area_code: true) # => (123) 555-1234 <del> # number_to_phone(1235551234, delimiter: ' ') # => 123 555 1234 <del> # number_to_phone(1235551234, area_code: true, extension: 555) # => (123) 555-1234 x 555 <del> # number_to_phone(1235551234, country_code: 1) # => +1-123-555-1234 <del> # number_to_phone('123a456') # => 123a456 <add> # number_to_phone(5551234) # => "555-1234" <add> # number_to_phone('5551234') # => "555-1234" <add> # number_to_phone(1235551234) # => "123-555-1234" <add> # number_to_phone(1235551234, area_code: true) # => "(123) 555-1234" <add> # number_to_phone(1235551234, delimiter: ' ') # => "123 555 1234" <add> # number_to_phone(1235551234, area_code: true, extension: 555) # => "(123) 555-1234 x 555" <add> # number_to_phone(1235551234, country_code: 1) # => "+1-123-555-1234" <add> # number_to_phone('123a456') # => "123a456" <ide> # <ide> # number_to_phone(1235551234, country_code: 1, extension: 1343, delimiter: '.') <del> # # => +1.123.555.1234 x 1343 <add> # # => "+1.123.555.1234 x 1343" <ide> def number_to_phone(number, options = {}) <ide> NumberToPhoneConverter.convert(number, options) <ide> end <ide> def number_to_phone(number, options = {}) <ide> # <ide> # ==== Examples <ide> # <del> # number_to_currency(1234567890.50) # => $1,234,567,890.50 <del> # number_to_currency(1234567890.506) # => $1,234,567,890.51 <del> # number_to_currency(1234567890.506, precision: 3) # => $1,234,567,890.506 <del> # number_to_currency(1234567890.506, locale: :fr) # => 1 234 567 890,51 € <del> # number_to_currency('123a456') # => $123a456 <add> # number_to_currency(1234567890.50) # => "$1,234,567,890.50" <add> # number_to_currency(1234567890.506) # => "$1,234,567,890.51" <add> # number_to_currency(1234567890.506, precision: 3) # => "$1,234,567,890.506" <add> # number_to_currency(1234567890.506, locale: :fr) # => "1 234 567 890,51 €" <add> # number_to_currency('123a456') # => "$123a456" <ide> # <ide> # number_to_currency(-1234567890.50, negative_format: '(%u%n)') <del> # # => ($1,234,567,890.50) <add> # # => "($1,234,567,890.50)" <ide> # number_to_currency(1234567890.50, unit: '&pound;', separator: ',', delimiter: '') <del> # # => &pound;1234567890,50 <add> # # => "&pound;1234567890,50" <ide> # number_to_currency(1234567890.50, unit: '&pound;', separator: ',', delimiter: '', format: '%n %u') <del> # # => 1234567890,50 &pound; <add> # # => "1234567890,50 &pound;" <ide> def number_to_currency(number, options = {}) <ide> NumberToCurrencyConverter.convert(number, options) <ide> end <ide> def number_to_currency(number, options = {}) <ide> # <ide> # ==== Examples <ide> # <del> # number_to_percentage(100) # => 100.000% <del> # number_to_percentage('98') # => 98.000% <del> # number_to_percentage(100, precision: 0) # => 100% <del> # number_to_percentage(1000, delimiter: '.', separator: ',') # => 1.000,000% <del> # number_to_percentage(302.24398923423, precision: 5) # => 302.24399% <del> # number_to_percentage(1000, locale: :fr) # => 1000,000% <del> # number_to_percentage(1000, precision: nil) # => 1000% <del> # number_to_percentage('98a') # => 98a% <del> # number_to_percentage(100, format: '%n %') # => 100.000 % <add> # number_to_percentage(100) # => "100.000%" <add> # number_to_percentage('98') # => "98.000%" <add> # number_to_percentage(100, precision: 0) # => "100%" <add> # number_to_percentage(1000, delimiter: '.', separator: ',') # => "1.000,000%" <add> # number_to_percentage(302.24398923423, precision: 5) # => "302.24399%" <add> # number_to_percentage(1000, locale: :fr) # => "1000,000%" <add> # number_to_percentage(1000, precision: nil) # => "1000%" <add> # number_to_percentage('98a') # => "98a%" <add> # number_to_percentage(100, format: '%n %') # => "100.000 %" <ide> def number_to_percentage(number, options = {}) <ide> NumberToPercentageConverter.convert(number, options) <ide> end <ide> def number_to_percentage(number, options = {}) <ide> # <ide> # ==== Examples <ide> # <del> # number_to_delimited(12345678) # => 12,345,678 <del> # number_to_delimited('123456') # => 123,456 <del> # number_to_delimited(12345678.05) # => 12,345,678.05 <del> # number_to_delimited(12345678, delimiter: '.') # => 12.345.678 <del> # number_to_delimited(12345678, delimiter: ',') # => 12,345,678 <del> # number_to_delimited(12345678.05, separator: ' ') # => 12,345,678 05 <del> # number_to_delimited(12345678.05, locale: :fr) # => 12 345 678,05 <del> # number_to_delimited('112a') # => 112a <add> # number_to_delimited(12345678) # => "12,345,678" <add> # number_to_delimited('123456') # => "123,456" <add> # number_to_delimited(12345678.05) # => "12,345,678.05" <add> # number_to_delimited(12345678, delimiter: '.') # => "12.345.678" <add> # number_to_delimited(12345678, delimiter: ',') # => "12,345,678" <add> # number_to_delimited(12345678.05, separator: ' ') # => "12,345,678 05" <add> # number_to_delimited(12345678.05, locale: :fr) # => "12 345 678,05" <add> # number_to_delimited('112a') # => "112a" <ide> # number_to_delimited(98765432.98, delimiter: ' ', separator: ',') <del> # # => 98 765 432,98 <add> # # => "98 765 432,98" <ide> # number_to_delimited("123456.78", <ide> # delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/) <del> # # => 1,23,456.78 <add> # # => "1,23,456.78" <ide> def number_to_delimited(number, options = {}) <ide> NumberToDelimitedConverter.convert(number, options) <ide> end <ide> def number_to_delimited(number, options = {}) <ide> # <ide> # ==== Examples <ide> # <del> # number_to_rounded(111.2345) # => 111.235 <del> # number_to_rounded(111.2345, precision: 2) # => 111.23 <del> # number_to_rounded(13, precision: 5) # => 13.00000 <del> # number_to_rounded(389.32314, precision: 0) # => 389 <del> # number_to_rounded(111.2345, significant: true) # => 111 <del> # number_to_rounded(111.2345, precision: 1, significant: true) # => 100 <del> # number_to_rounded(13, precision: 5, significant: true) # => 13.000 <del> # number_to_rounded(13, precision: nil) # => 13 <del> # number_to_rounded(111.234, locale: :fr) # => 111,234 <add> # number_to_rounded(111.2345) # => "111.235" <add> # number_to_rounded(111.2345, precision: 2) # => "111.23" <add> # number_to_rounded(13, precision: 5) # => "13.00000" <add> # number_to_rounded(389.32314, precision: 0) # => "389" <add> # number_to_rounded(111.2345, significant: true) # => "111" <add> # number_to_rounded(111.2345, precision: 1, significant: true) # => "100" <add> # number_to_rounded(13, precision: 5, significant: true) # => "13.000" <add> # number_to_rounded(13, precision: nil) # => "13" <add> # number_to_rounded(111.234, locale: :fr) # => "111,234" <ide> # <ide> # number_to_rounded(13, precision: 5, significant: true, strip_insignificant_zeros: true) <del> # # => 13 <add> # # => "13" <ide> # <del> # number_to_rounded(389.32314, precision: 4, significant: true) # => 389.3 <add> # number_to_rounded(389.32314, precision: 4, significant: true) # => "389.3" <ide> # number_to_rounded(1111.2345, precision: 2, separator: ',', delimiter: '.') <del> # # => 1.111,23 <add> # # => "1.111,23" <ide> def number_to_rounded(number, options = {}) <ide> NumberToRoundedConverter.convert(number, options) <ide> end <ide> def number_to_rounded(number, options = {}) <ide> # <ide> # ==== Examples <ide> # <del> # number_to_human_size(123) # => 123 Bytes <del> # number_to_human_size(1234) # => 1.21 KB <del> # number_to_human_size(12345) # => 12.1 KB <del> # number_to_human_size(1234567) # => 1.18 MB <del> # number_to_human_size(1234567890) # => 1.15 GB <del> # number_to_human_size(1234567890123) # => 1.12 TB <del> # number_to_human_size(1234567890123456) # => 1.1 PB <del> # number_to_human_size(1234567890123456789) # => 1.07 EB <del> # number_to_human_size(1234567, precision: 2) # => 1.2 MB <del> # number_to_human_size(483989, precision: 2) # => 470 KB <del> # number_to_human_size(1234567, precision: 2, separator: ',') # => 1,2 MB <add> # number_to_human_size(123) # => "123 Bytes" <add> # number_to_human_size(1234) # => "1.21 KB" <add> # number_to_human_size(12345) # => "12.1 KB" <add> # number_to_human_size(1234567) # => "1.18 MB" <add> # number_to_human_size(1234567890) # => "1.15 GB" <add> # number_to_human_size(1234567890123) # => "1.12 TB" <add> # number_to_human_size(1234567890123456) # => "1.1 PB" <add> # number_to_human_size(1234567890123456789) # => "1.07 EB" <add> # number_to_human_size(1234567, precision: 2) # => "1.2 MB" <add> # number_to_human_size(483989, precision: 2) # => "470 KB" <add> # number_to_human_size(1234567, precision: 2, separator: ',') # => "1,2 MB" <ide> # number_to_human_size(1234567890123, precision: 5) # => "1.1228 TB" <ide> # number_to_human_size(524288000, precision: 5) # => "500 MB" <ide> def number_to_human_size(number, options = {})
2
Python
Python
remove exec_command from build_ext
2f1dcd0c178a08ed30ceaf6dbf85edec94e8c3a0
<ide><path>numpy/distutils/command/build_ext.py <ide> import os <ide> import sys <ide> import shutil <add>import subprocess <ide> from glob import glob <ide> <ide> from distutils.dep_util import newer_group <ide> from distutils.file_util import copy_file <ide> <ide> from numpy.distutils import log <del>from numpy.distutils.exec_command import exec_command <add>from numpy.distutils.exec_command import filepath_from_subprocess_output <ide> from numpy.distutils.system_info import combine_paths, system_info <ide> from numpy.distutils.misc_util import filter_sources, has_f_sources, \ <ide> has_cxx_sources, get_ext_source_files, \ <ide> def _libs_with_msvc_and_fortran(self, fcompiler, c_libraries, <ide> # correct path when compiling in Cygwin but with normal Win <ide> # Python <ide> if dir.startswith('/usr/lib'): <del> s, o = exec_command(['cygpath', '-w', dir], use_tee=False) <del> if not s: <del> dir = o <add> try: <add> dir = subprocess.check_output(['cygpath', '-w', dir]) <add> except (OSError, subprocess.CalledProcessError): <add> pass <add> else: <add> dir = filepath_from_subprocess_output(dir) <ide> f_lib_dirs.append(dir) <ide> c_library_dirs.extend(f_lib_dirs) <ide>
1
Ruby
Ruby
fix install --force-bottle for non-standard prefix
33483e9478bf8b48f69b1c517e634f499a47094b
<ide><path>Library/Homebrew/formula_installer.rb <ide> def install <ide> <ide> # Warn if a more recent version of this formula is available in the tap. <ide> begin <del> if formula.pkg_version < (v = Formulary.factory(formula.full_name).pkg_version) <add> if formula.pkg_version < (v = Formulary.factory(formula.full_name, force_bottle: force_bottle?).pkg_version) <ide> opoo "#{formula.full_name} #{v} is available and more recent than version #{formula.pkg_version}." <ide> end <ide> rescue FormulaUnavailableError
1
Python
Python
fix exception in mini task scheduler.
c23b31cd786760da8a8e39ecbcf2c0d31e50e594
<ide><path>airflow/models/baseoperator.py <ide> def on_kill(self) -> None: <ide> """ <ide> <ide> def __deepcopy__(self, memo): <del> """ <del> Hack sorting double chained task lists by task_id to avoid hitting <del> max_depth on deepcopy operations. <del> """ <add> # Hack sorting double chained task lists by task_id to avoid hitting <add> # max_depth on deepcopy operations. <ide> sys.setrecursionlimit(5000) # TODO fix this in a better way <add> <ide> cls = self.__class__ <ide> result = cls.__new__(cls) <ide> memo[id(self)] = result <ide> <ide> shallow_copy = cls.shallow_copy_attrs + cls._base_operator_shallow_copy_attrs <ide> <ide> for k, v in self.__dict__.items(): <add> if k == "_BaseOperator__instantiated": <add> # Don't set this until the _end_, as it changes behaviour of __setattr__ <add> continue <ide> if k not in shallow_copy: <ide> setattr(result, k, copy.deepcopy(v, memo)) <ide> else: <ide> setattr(result, k, copy.copy(v)) <add> result.__instantiated = self.__instantiated <ide> return result <ide> <ide> def __getstate__(self): <ide><path>tests/models/test_baseoperator.py <ide> # KIND, either express or implied. See the License for the <ide> # specific language governing permissions and limitations <ide> # under the License. <add>import copy <ide> import logging <ide> import uuid <ide> from datetime import date, datetime, timedelta <ide> def test_task_level_retry_delay(dag_maker): <ide> task1 = BaseOperator(task_id='test_no_explicit_retry_delay', retry_delay=timedelta(seconds=200)) <ide> <ide> assert task1.retry_delay == timedelta(seconds=200) <add> <add> <add>def test_deepcopy(): <add> # Test bug when copying an operator attached to a DAG <add> with DAG("dag0", start_date=DEFAULT_DATE) as dag: <add> <add> @dag.task <add> def task0(): <add> pass <add> <add> MockOperator(task_id="task1", arg1=task0()) <add> copy.deepcopy(dag)
2
Go
Go
use spf13/cobra for docker update
9765593c5f7cdd3ef16dbd0cae35bb68cf5542ef
<ide><path>api/client/commands.go <ide> func (cli *DockerCli) Command(name string) func(...string) error { <ide> return map[string]func(...string) error{ <ide> "exec": cli.CmdExec, <ide> "inspect": cli.CmdInspect, <del> "update": cli.CmdUpdate, <ide> }[name] <ide> } <ide><path>api/client/container/update.go <add>package container <add> <add>import ( <add> "fmt" <add> "strings" <add> <add> "golang.org/x/net/context" <add> <add> "github.com/docker/docker/api/client" <add> "github.com/docker/docker/cli" <add> runconfigopts "github.com/docker/docker/runconfig/opts" <add> containertypes "github.com/docker/engine-api/types/container" <add> "github.com/docker/go-units" <add> "github.com/spf13/cobra" <add>) <add> <add>type updateOptions struct { <add> blkioWeight uint16 <add> cpuPeriod int64 <add> cpuQuota int64 <add> cpusetCpus string <add> cpusetMems string <add> cpuShares int64 <add> memoryString string <add> memoryReservation string <add> memorySwap string <add> kernelMemory string <add> restartPolicy string <add> <add> nFlag int <add> <add> containers []string <add>} <add> <add>// NewUpdateCommand creats a new cobra.Command for `docker update` <add>func NewUpdateCommand(dockerCli *client.DockerCli) *cobra.Command { <add> var opts updateOptions <add> <add> cmd := &cobra.Command{ <add> Use: "update [OPTIONS] CONTAINER [CONTAINER...]", <add> Short: "Update configuration of one or more containers", <add> Args: cli.RequiresMinArgs(1), <add> RunE: func(cmd *cobra.Command, args []string) error { <add> opts.containers = args <add> opts.nFlag = cmd.Flags().NFlag() <add> return runUpdate(dockerCli, &opts) <add> }, <add> } <add> cmd.SetFlagErrorFunc(flagErrorFunc) <add> <add> flags := cmd.Flags() <add> flags.Uint16Var(&opts.blkioWeight, "blkio-weight", 0, "Block IO (relative weight), between 10 and 1000") <add> flags.Int64Var(&opts.cpuPeriod, "cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period") <add> flags.Int64Var(&opts.cpuQuota, "cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota") <add> flags.StringVar(&opts.cpusetCpus, "cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)") <add> flags.StringVar(&opts.cpusetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)") <add> flags.Int64VarP(&opts.cpuShares, "cpu-shares", "c", 0, "CPU shares (relative weight)") <add> flags.StringVarP(&opts.memoryString, "memory", "m", "", "Memory limit") <add> flags.StringVar(&opts.memoryReservation, "memory-reservation", "", "Memory soft limit") <add> flags.StringVar(&opts.memorySwap, "memory-swap", "", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap") <add> flags.StringVar(&opts.kernelMemory, "kernel-memory", "", "Kernel memory limit") <add> flags.StringVar(&opts.restartPolicy, "restart", "", "Restart policy to apply when a container exits") <add> <add> return cmd <add>} <add> <add>func runUpdate(dockerCli *client.DockerCli, opts *updateOptions) error { <add> var err error <add> <add> if opts.nFlag == 0 { <add> return fmt.Errorf("You must provide one or more flags when using this command.") <add> } <add> <add> var memory int64 <add> if opts.memoryString != "" { <add> memory, err = units.RAMInBytes(opts.memoryString) <add> if err != nil { <add> return err <add> } <add> } <add> <add> var memoryReservation int64 <add> if opts.memoryReservation != "" { <add> memoryReservation, err = units.RAMInBytes(opts.memoryReservation) <add> if err != nil { <add> return err <add> } <add> } <add> <add> var memorySwap int64 <add> if opts.memorySwap != "" { <add> if opts.memorySwap == "-1" { <add> memorySwap = -1 <add> } else { <add> memorySwap, err = units.RAMInBytes(opts.memorySwap) <add> if err != nil { <add> return err <add> } <add> } <add> } <add> <add> var kernelMemory int64 <add> if opts.kernelMemory != "" { <add> kernelMemory, err = units.RAMInBytes(opts.kernelMemory) <add> if err != nil { <add> return err <add> } <add> } <add> <add> var restartPolicy containertypes.RestartPolicy <add> if opts.restartPolicy != "" { <add> restartPolicy, err = runconfigopts.ParseRestartPolicy(opts.restartPolicy) <add> if err != nil { <add> return err <add> } <add> } <add> <add> resources := containertypes.Resources{ <add> BlkioWeight: opts.blkioWeight, <add> CpusetCpus: opts.cpusetCpus, <add> CpusetMems: opts.cpusetMems, <add> CPUShares: opts.cpuShares, <add> Memory: memory, <add> MemoryReservation: memoryReservation, <add> MemorySwap: memorySwap, <add> KernelMemory: kernelMemory, <add> CPUPeriod: opts.cpuPeriod, <add> CPUQuota: opts.cpuQuota, <add> } <add> <add> updateConfig := containertypes.UpdateConfig{ <add> Resources: resources, <add> RestartPolicy: restartPolicy, <add> } <add> <add> ctx := context.Background() <add> <add> var errs []string <add> for _, container := range opts.containers { <add> if err := dockerCli.Client().ContainerUpdate(ctx, container, updateConfig); err != nil { <add> errs = append(errs, err.Error()) <add> } else { <add> fmt.Fprintf(dockerCli.Out(), "%s\n", container) <add> } <add> } <add> if len(errs) > 0 { <add> return fmt.Errorf("%s", strings.Join(errs, "\n")) <add> } <add> return nil <add>} <ide><path>api/client/update.go <del>package client <del> <del>import ( <del> "fmt" <del> "strings" <del> <del> "golang.org/x/net/context" <del> <del> Cli "github.com/docker/docker/cli" <del> flag "github.com/docker/docker/pkg/mflag" <del> "github.com/docker/docker/runconfig/opts" <del> "github.com/docker/engine-api/types/container" <del> "github.com/docker/go-units" <del>) <del> <del>// CmdUpdate updates resources of one or more containers. <del>// <del>// Usage: docker update [OPTIONS] CONTAINER [CONTAINER...] <del>func (cli *DockerCli) CmdUpdate(args ...string) error { <del> cmd := Cli.Subcmd("update", []string{"CONTAINER [CONTAINER...]"}, Cli.DockerCommands["update"].Description, true) <del> flBlkioWeight := cmd.Uint16([]string{"-blkio-weight"}, 0, "Block IO (relative weight), between 10 and 1000") <del> flCPUPeriod := cmd.Int64([]string{"-cpu-period"}, 0, "Limit CPU CFS (Completely Fair Scheduler) period") <del> flCPUQuota := cmd.Int64([]string{"-cpu-quota"}, 0, "Limit CPU CFS (Completely Fair Scheduler) quota") <del> flCpusetCpus := cmd.String([]string{"-cpuset-cpus"}, "", "CPUs in which to allow execution (0-3, 0,1)") <del> flCpusetMems := cmd.String([]string{"-cpuset-mems"}, "", "MEMs in which to allow execution (0-3, 0,1)") <del> flCPUShares := cmd.Int64([]string{"c", "-cpu-shares"}, 0, "CPU shares (relative weight)") <del> flMemoryString := cmd.String([]string{"m", "-memory"}, "", "Memory limit") <del> flMemoryReservation := cmd.String([]string{"-memory-reservation"}, "", "Memory soft limit") <del> flMemorySwap := cmd.String([]string{"-memory-swap"}, "", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap") <del> flKernelMemory := cmd.String([]string{"-kernel-memory"}, "", "Kernel memory limit") <del> flRestartPolicy := cmd.String([]string{"-restart"}, "", "Restart policy to apply when a container exits") <del> <del> cmd.Require(flag.Min, 1) <del> cmd.ParseFlags(args, true) <del> if cmd.NFlag() == 0 { <del> return fmt.Errorf("You must provide one or more flags when using this command.") <del> } <del> <del> var err error <del> var flMemory int64 <del> if *flMemoryString != "" { <del> flMemory, err = units.RAMInBytes(*flMemoryString) <del> if err != nil { <del> return err <del> } <del> } <del> <del> var memoryReservation int64 <del> if *flMemoryReservation != "" { <del> memoryReservation, err = units.RAMInBytes(*flMemoryReservation) <del> if err != nil { <del> return err <del> } <del> } <del> <del> var memorySwap int64 <del> if *flMemorySwap != "" { <del> if *flMemorySwap == "-1" { <del> memorySwap = -1 <del> } else { <del> memorySwap, err = units.RAMInBytes(*flMemorySwap) <del> if err != nil { <del> return err <del> } <del> } <del> } <del> <del> var kernelMemory int64 <del> if *flKernelMemory != "" { <del> kernelMemory, err = units.RAMInBytes(*flKernelMemory) <del> if err != nil { <del> return err <del> } <del> } <del> <del> var restartPolicy container.RestartPolicy <del> if *flRestartPolicy != "" { <del> restartPolicy, err = opts.ParseRestartPolicy(*flRestartPolicy) <del> if err != nil { <del> return err <del> } <del> } <del> <del> resources := container.Resources{ <del> BlkioWeight: *flBlkioWeight, <del> CpusetCpus: *flCpusetCpus, <del> CpusetMems: *flCpusetMems, <del> CPUShares: *flCPUShares, <del> Memory: flMemory, <del> MemoryReservation: memoryReservation, <del> MemorySwap: memorySwap, <del> KernelMemory: kernelMemory, <del> CPUPeriod: *flCPUPeriod, <del> CPUQuota: *flCPUQuota, <del> } <del> <del> updateConfig := container.UpdateConfig{ <del> Resources: resources, <del> RestartPolicy: restartPolicy, <del> } <del> <del> ctx := context.Background() <del> <del> names := cmd.Args() <del> var errs []string <del> <del> for _, name := range names { <del> if err := cli.client.ContainerUpdate(ctx, name, updateConfig); err != nil { <del> errs = append(errs, err.Error()) <del> } else { <del> fmt.Fprintf(cli.out, "%s\n", name) <del> } <del> } <del> <del> if len(errs) > 0 { <del> return fmt.Errorf("%s", strings.Join(errs, "\n")) <del> } <del> <del> return nil <del>} <ide><path>cli/cobraadaptor/adaptor.go <ide> func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor { <ide> container.NewStopCommand(dockerCli), <ide> container.NewTopCommand(dockerCli), <ide> container.NewUnpauseCommand(dockerCli), <add> container.NewUpdateCommand(dockerCli), <ide> container.NewWaitCommand(dockerCli), <ide> image.NewBuildCommand(dockerCli), <ide> image.NewHistoryCommand(dockerCli), <ide><path>cli/usage.go <ide> type Command struct { <ide> var DockerCommandUsage = []Command{ <ide> {"exec", "Run a command in a running container"}, <ide> {"inspect", "Return low-level information on a container, image or task"}, <del> {"update", "Update configuration of one or more containers"}, <ide> } <ide> <ide> // DockerCommands stores all the docker command
5
Javascript
Javascript
introduce ember._cache still private api
fde1505b1720c940239c5f29ccc40d5fe2279530
<ide><path>packages/ember-metal/lib/cache.js <add>import dictionary from 'ember-metal/dictionary'; <add>export default Cache; <add> <add>function Cache(limit, func) { <add> this.store = dictionary(null); <add> this.size = 0; <add> this.misses = 0; <add> this.hits = 0; <add> this.limit = limit; <add> this.func = func; <add>} <add> <add>var FALSE = function() { }; <add>var ZERO = function() { }; <add>var UNDEFINED = function() { }; <add>var NULL = function() { }; <add> <add>Cache.prototype = { <add> set: function(key, value) { <add> if (this.limit > this.size) { <add> this.size ++; <add> if (value === undefined) { <add> this.store[key] = UNDEFINED; <add> } else { <add> this.store[key] = value; <add> } <add> } <add> <add> return value; <add> }, <add> <add> get: function(key) { <add> var value = this.store[key]; <add> <add> if (value === undefined) { <add> this.misses ++; <add> value = this.set(key, this.func(key)); <add> } else if (value === UNDEFINED) { <add> this.hits ++; <add> value = UNDEFINED; <add> } else { <add> this.hits ++; <add> // nothing to translate <add> } <add> <add> return value; <add> }, <add> <add> purge: function() { <add> this.store = dictionary(null); <add> this.size = 0; <add> this.hits = 0; <add> this.misses = 0; <add> } <add>};
1
Text
Text
remove article for cloning objects in javascript
af1922a971216674c90b6a3034661128ef8fb2ad
<ide><path>docs/faq/Performance.md <ide> However, you _do_ need to create a copied and updated object for each level of n <ide> - [#758: Why can't state be mutated?](https://github.com/reduxjs/redux/issues/758) <ide> - [#994: How to cut the boilerplate when updating nested entities?](https://github.com/reduxjs/redux/issues/994) <ide> - [Twitter: common misconception - deep cloning](https://twitter.com/dan_abramov/status/688087202312491008) <del>- [Cloning Objects in JavaScript](https://www.zsoltnagy.eu/cloning-objects-in-javascript/) <ide> <ide> ### How can I reduce the number of store update events? <ide>
1
Text
Text
add async_hooks, n-api to _toc.md and all.md
38cec08ff74f2a02850bd036c17d375f8f38a58b
<ide><path>doc/api/_toc.md <ide> <div class="line"></div> <ide> <ide> * [Assertion Testing](assert.html) <add>* [Async Hooks](async_hooks.html) <ide> * [Buffer](buffer.html) <ide> * [C++ Addons](addons.html) <ide> * [C/C++ Addons - N-API](n-api.html) <ide><path>doc/api/all.md <ide> @include documentation <ide> @include synopsis <ide> @include assert <add>@include async_hooks <ide> @include buffer <ide> @include addons <add>@include n-api <ide> @include child_process <ide> @include cluster <ide> @include cli
2
Python
Python
add test for tensorinv()
e9b1fb1c8f0abb6aa27b223d969b2f0797f77235
<ide><path>numpy/linalg/tests/test_linalg.py <ide> def test_dynamic_programming_logic(self): <ide> def test_too_few_input_arrays(self): <ide> assert_raises(ValueError, multi_dot, []) <ide> assert_raises(ValueError, multi_dot, [np.random.random((3, 3))]) <add> <add> <add>class TestTensorinv(object): <add> <add> @pytest.mark.parametrize("arr, ind", [ <add> (np.ones((4, 6, 8, 2)), 2), <add> (np.ones((3, 3, 2)), 1), <add> ]) <add> def test_non_square_handling(self, arr, ind): <add> with assert_raises(LinAlgError): <add> linalg.tensorinv(arr, ind=ind) <add> <add> @pytest.mark.parametrize("shape, ind", [ <add> # examples from docstring <add> ((4, 6, 8, 3), 2), <add> ((24, 8, 3), 1), <add> ]) <add> def test_tensorinv_shape(self, shape, ind): <add> a = np.eye(24) <add> a.shape = shape <add> ainv = linalg.tensorinv(a=a, ind=ind) <add> expected = a.shape[ind:] + a.shape[:ind] <add> actual = ainv.shape <add> assert_equal(actual, expected) <add> <add> @pytest.mark.parametrize("ind", [ <add> 0, -2, <add> ]) <add> def test_tensorinv_ind_limit(self, ind): <add> a = np.eye(24) <add> a.shape = (4, 6, 8, 3) <add> with assert_raises(ValueError): <add> linalg.tensorinv(a=a, ind=ind) <add> <add> def test_tensorinv_result(self): <add> # mimic a docstring example <add> a = np.eye(24) <add> a.shape = (24, 8, 3) <add> ainv = linalg.tensorinv(a, ind=1) <add> b = np.ones(24) <add> assert_allclose(np.tensordot(ainv, b, 1), np.linalg.tensorsolve(a, b))
1