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
Text
Text
remove reference to tokaido
5a7fadf68410638afb229bf51e209f3e1677a6ab
<ide><path>guides/source/getting_started.md <ide> ruby 2.5.0 <ide> Rails requires Ruby version 2.4.1 or later. If the version number returned is <ide> less than that number, you'll need to install a fresh copy of Ruby. <ide> <del>TIP: A number of tools exist to help you quickly install Ruby and Ruby <del>on Rails on your system. Windows users can use [Rails Installer](http://railsinstaller.org), <del>while macOS users can use [Tokaido](https://github.com/tokaido/tokaidoapp). <del>For more installation methods for most Operating Systems take a look at <del>[ruby-lang.org](https://www.ruby-lang.org/en/documentation/installation/). <add>TIP: To quickly install Ruby and Ruby on Rails on your system in Windows, you can use <add>[Rails Installer](http://railsinstaller.org). For more installation methods for most <add>Operating Systems take a look at [ruby-lang.org](https://www.ruby-lang.org/en/documentation/installation/). <ide> <ide> If you are working on Windows, you should also install the <ide> [Ruby Installer Development Kit](https://rubyinstaller.org/downloads/).
1
Go
Go
use filepath.walkdir instead of filepath.walk
402e0b58ca1b1e537b92348e68f5e6bd08709ddb
<ide><path>testutil/daemon/daemon_linux.go <ide> func cleanupNetworkNamespace(t testing.TB, d *Daemon) { <ide> // daemon instance and has no chance of getting <ide> // cleaned up when a new daemon is instantiated with a <ide> // new exec root. <del> netnsPath := filepath.Join(d.execRoot, "netns") <del> filepath.Walk(netnsPath, func(path string, info os.FileInfo, err error) error { <add> filepath.WalkDir(filepath.Join(d.execRoot, "netns"), func(path string, _ os.DirEntry, _ error) error { <ide> if err := unix.Unmount(path, unix.MNT_DETACH); err != nil && err != unix.EINVAL && err != unix.ENOENT { <ide> t.Logf("[%s] unmount of %s failed: %v", d.id, path, err) <ide> }
1
Javascript
Javascript
improve memory consumption of file middleware
eeb6e2db1708471d6d16c322e2d8cd25ecececf0
<ide><path>lib/serialization/FileMiddleware.js <ide> const readSection = (filename, file, offset, size, callback) => { <ide> }); <ide> }; <ide> <add>const writeBuffers = (fileHandle, buffers, callback) => { <add> const stream = fs.createWriteStream(null, { <add> fd: fileHandle, <add> autoClose: false <add> }); <add> let index = 0; <add> <add> const doWrite = function() { <add> let canWriteMore = true; <add> while (canWriteMore && index < buffers.length) { <add> const chunk = buffers[index++]; <add> canWriteMore = stream.write(chunk); <add> } <add> <add> if (index < buffers.length) { <add> stream.once("drain", doWrite); <add> } else { <add> stream.end(); <add> } <add> }; <add> <add> stream.on("error", err => callback(err)); <add> stream.on("finish", () => callback(null)); <add> doWrite(); <add>}; <add> <ide> class FileMiddleware extends SerializerMiddleware { <ide> /** <ide> * @param {any[]} data data items <ide> class FileMiddleware extends SerializerMiddleware { <ide> mkdirp(path.dirname(filename), err => { <ide> if (err) return reject(err); <ide> fileManager.addJob(filename, true, (file, callback) => { <del> fs.writeFile(file, Buffer.concat(buffers), err => { <add> writeBuffers(file, buffers, err => { <ide> if (err) return callback(err); <ide> resolve(true); <ide> callback();
1
Javascript
Javascript
add name to monkey-patched emit function
152de34fb1fbf3803cee8d7dac2c37ad5061e331
<ide><path>lib/domain.js <ide> EventEmitter.init = function() { <ide> }; <ide> <ide> const eventEmit = EventEmitter.prototype.emit; <del>EventEmitter.prototype.emit = function(...args) { <add>EventEmitter.prototype.emit = function emit(...args) { <ide> const domain = this.domain; <ide> <ide> const type = args[0]; <ide><path>test/parallel/test-domain-dep0097.js <ide> const inspector = require('inspector'); <ide> <ide> process.on('warning', common.mustCall((warning) => { <ide> assert.strictEqual(warning.code, 'DEP0097'); <del> assert.match(warning.message, /Triggered by calling <anonymous> on process/); <add> assert.match(warning.message, /Triggered by calling emit on process/); <ide> })); <ide> <ide> domain.create().run(() => {
2
PHP
PHP
apply fixes from styleci
be56c6fc9741783a708a10b1e7e4189ed342f0a2
<ide><path>src/Illuminate/Database/Eloquent/Factories/Factory.php <ide> namespace Illuminate\Database\Eloquent\Factories; <ide> <ide> use Closure; <del>use Throwable; <ide> use Faker\Generator; <ide> use Illuminate\Container\Container; <ide> use Illuminate\Database\Eloquent\Collection as EloquentCollection; <ide> use Illuminate\Support\Collection; <ide> use Illuminate\Support\Str; <ide> use Illuminate\Support\Traits\ForwardsCalls; <add>use Throwable; <ide> <ide> abstract class Factory <ide> {
1
Text
Text
use httpie for tutorials
34b5db62e560e73516fb569eaf9b71ea5562958f
<ide><path>docs/tutorial/1-serialization.md <ide> Quit out of the shell... <ide> <ide> In another terminal window, we can test the server. <ide> <del>We can get a list of all of the snippets. <add>We could use `curl`, but let's use a nicer tool called [httpie][httpie] to test our server. It has much nicer formatting and makes our output easier to read. This is especially useful when testing. <ide> <del> curl http://127.0.0.1:8000/snippets/ <add>You can install httpie on all operating systems using pip: <ide> <del> [{"id": 1, "title": "", "code": "foo = \"bar\"\n", "linenos": false, "language": "python", "style": "friendly"}, {"id": 2, "title": "", "code": "print \"hello, world\"\n", "linenos": false, "language": "python", "style": "friendly"}] <add> pip install httpie <ide> <del>Or we can get a particular snippet by referencing its id. <add>It can also be installed through [Homebrew][brew] on Mac: <ide> <del> curl http://127.0.0.1:8000/snippets/2/ <add> brew install httpie <ide> <del> {"id": 2, "title": "", "code": "print \"hello, world\"\n", "linenos": false, "language": "python", "style": "friendly"} <add>Finally, we can get a list of all of the snippets: <add> <add> http http://127.0.0.1:8000/snippets/ --body <add> <add> [ <add> { <add> "id": 1, <add> "title": "", <add> "code": "foo = \"bar\"\n", <add> "linenos": false, <add> "language": "python", <add> "style": "friendly" <add> }, <add> { <add> "id": 2, <add> "title": "", <add> "code": "print \"hello, world\"\n", <add> "linenos": false, <add> "language": "python", <add> "style": "friendly" <add> } <add> ] <add> <add>Or we can get a particular snippet by referencing its id: <add> <add> http http://127.0.0.1:8000/snippets/2/ --body <add> <add> { <add> "id": 2, <add> "title": "", <add> "code": "print \"hello, world\"\n", <add> "linenos": false, <add> "language": "python", <add> "style": "friendly" <add> } <ide> <ide> Similarly, you can have the same json displayed by visiting these URLs in a web browser. <ide> <ide> We'll see how we can start to improve things in [part 2 of the tutorial][tut-2]. <ide> [sandbox]: http://restframework.herokuapp.com/ <ide> [virtualenv]: http://www.virtualenv.org/en/latest/index.html <ide> [tut-2]: 2-requests-and-responses.md <add>[httpie]: https://github.com/jakubroztocil/httpie#installation <add>[brew]: http://brew.sh <ide><path>docs/tutorial/2-requests-and-responses.md <ide> Go ahead and test the API from the command line, as we did in [tutorial part 1][ <ide> <ide> We can get a list of all of the snippets, as before. <ide> <del> curl http://127.0.0.1:8000/snippets/ <del> <del> [{"id": 1, "title": "", "code": "foo = \"bar\"\n", "linenos": false, "language": "python", "style": "friendly"}, {"id": 2, "title": "", "code": "print \"hello, world\"\n", "linenos": false, "language": "python", "style": "friendly"}] <add> http http://127.0.0.1:8000/snippets/ --body <add> <add> [ <add> { <add> "id": 1, <add> "title": "", <add> "code": "foo = \"bar\"\n", <add> "linenos": false, <add> "language": "python", <add> "style": "friendly" <add> }, <add> { <add> "id": 2, <add> "title": "", <add> "code": "print \"hello, world\"\n", <add> "linenos": false, <add> "language": "python", <add> "style": "friendly" <add> } <add> ] <ide> <ide> We can control the format of the response that we get back, either by using the `Accept` header: <ide> <del> curl http://127.0.0.1:8000/snippets/ -H 'Accept: application/json' # Request JSON <del> curl http://127.0.0.1:8000/snippets/ -H 'Accept: text/html' # Request HTML <add> http http://127.0.0.1:8000/snippets/ Accept:application/json # Request JSON <add> http http://127.0.0.1:8000/snippets/ Accept:text/html # Request HTML <ide> <ide> Or by appending a format suffix: <ide> <del> curl http://127.0.0.1:8000/snippets/.json # JSON suffix <del> curl http://127.0.0.1:8000/snippets/.api # Browsable API suffix <add> http http://127.0.0.1:8000/snippets/.json # JSON suffix <add> http http://127.0.0.1:8000/snippets/.api # Browsable API suffix <ide> <ide> Similarly, we can control the format of the request that we send, using the `Content-Type` header. <ide> <ide> # POST using form data <del> curl -X POST http://127.0.0.1:8000/snippets/ -d "code=print 123" <add> http --form POST http://127.0.0.1:8000/snippets/ code="print 123" <ide> <del> {"id": 3, "title": "", "code": "print 123", "linenos": false, "language": "python", "style": "friendly"} <add> { <add> "id": 3, <add> "title": "", <add> "code": "print 123", <add> "linenos": false, <add> "language": "python", <add> "style": "friendly" <add> } <ide> <ide> # POST using JSON <del> curl -X POST http://127.0.0.1:8000/snippets/ -d '{"code": "print 456"}' -H "Content-Type: application/json" <del> <del> {"id": 4, "title": "", "code": "print 456", "linenos": true, "language": "python", "style": "friendly"} <add> http --json POST http://127.0.0.1:8000/snippets/ code="print 456" <add> <add> { <add> "id": 4, <add> "title": "", <add> "code": "print 456", <add> "linenos": true, <add> "language": "python", <add> "style": "friendly" <add> } <ide> <ide> Now go and open the API in a web browser, by visiting [http://127.0.0.1:8000/snippets/][devserver]. <ide> <ide><path>docs/tutorial/4-authentication-and-permissions.md <ide> If we're interacting with the API programmatically we need to explicitly provide <ide> <ide> If we try to create a snippet without authenticating, we'll get an error: <ide> <del> curl -i -X POST http://127.0.0.1:8000/snippets/ -d "code=print 123" <add> http POST http://127.0.0.1:8000/snippets/ code="print 123" <ide> <del> {"detail": "Authentication credentials were not provided."} <add> { <add> "detail": "Authentication credentials were not provided." <add> } <ide> <ide> We can make a successful request by including the username and password of one of the users we created earlier. <ide> <del> curl -X POST http://127.0.0.1:8000/snippets/ -d "code=print 789" -u tom:password <del> <del> {"id": 5, "owner": "tom", "title": "foo", "code": "print 789", "linenos": false, "language": "python", "style": "friendly"} <add> http POST -a tom:password http://127.0.0.1:8000/snippets/ code="print 789" <add> <add> { <add> "id": 5, <add> "owner": "tom", <add> "title": "foo", <add> "code": "print 789", <add> "linenos": false, <add> "language": "python", <add> "style": "friendly" <add> } <ide> <ide> ## Summary <ide> <ide><path>docs/tutorial/quickstart.md <ide> Create a new Django project named `tutorial`, then start a new app called `quick <ide> django-admin.py startapp quickstart <ide> cd .. <ide> <add>Optionally, install [httpie][httpie] for tastier HTTP requests: <add> <add> pip install httpie <add> <ide> Now sync your database for the first time: <ide> <ide> python manage.py migrate <ide> We can now access our API, both from the command-line, using tools like `curl`.. <ide> ] <ide> } <ide> <add>Or with [httpie][httpie], a tastier version of `curl`... <add> <add> bash: http -a username:password http://127.0.0.1:8000/users/ --body <add> { <add> "count": 2, <add> "next": null, <add> "previous": null, <add> "results": [ <add> { <add> "email": "[email protected]", <add> "groups": [], <add> "url": "http://localhost:8000/users/1/", <add> "username": "paul" <add> }, <add> { <add> "email": "[email protected]", <add> "groups": [ ], <add> "url": "http://127.0.0.1:8000/users/2/", <add> "username": "tom" <add> } <add> ] <add> } <add> <add> <ide> Or directly through the browser... <ide> <ide> ![Quick start image][image] <ide> If you want to get a more in depth understanding of how REST framework fits toge <ide> [image]: ../img/quickstart.png <ide> [tutorial]: 1-serialization.md <ide> [guide]: ../#api-guide <add>[httpie]: https://github.com/jakubroztocil/httpie#installation
4
PHP
PHP
fix cs as per psr-12
071ebbac1caace1d4a7f55907286582e06d18d74
<ide><path>src/Http/ServerRequest.php <ide> protected function _processGet($query, $queryString = '') <ide> */ <ide> protected function _processFiles($post, $files) <ide> { <del> if (empty($files) || <add> if ( <add> empty($files) || <ide> !is_array($files) <ide> ) { <ide> return $post; <ide><path>src/Validation/Validator.php <ide> protected function isEmpty($data, $flags) <ide> } <ide> } <ide> <del> if (($flags & self::EMPTY_FILE) <add> if ( <add> ($flags & self::EMPTY_FILE) <ide> && $data instanceof UploadedFileInterface <ide> && $data->getError() === UPLOAD_ERR_NO_FILE <ide> ) {
2
Javascript
Javascript
add testcase for sourcetextmodule custom inspect
ff66e08bceb25e0d00d8818fc603b9f2bf251b63
<ide><path>test/parallel/test-vm-module-basic.js <ide> const common = require('../common'); <ide> const assert = require('assert'); <ide> const { SourceTextModule, createContext } = require('vm'); <add>const util = require('util'); <ide> <ide> (async function test1() { <ide> const context = createContext({ <ide> const { SourceTextModule, createContext } = require('vm'); <ide> const m3 = new SourceTextModule('3', { context: context2 }); <ide> assert.strictEqual(m3.url, 'vm:module(0)'); <ide> })(); <add> <add>// Check inspection of the instance <add>{ <add> const context = createContext({ foo: 'bar' }); <add> const m = new SourceTextModule('1', { context }); <add> <add> assert.strictEqual( <add> util.inspect(m), <add> "SourceTextModule {\n status: 'uninstantiated',\n linkingStatus:" + <add> " 'unlinked',\n url: 'vm:module(0)',\n context: { foo: 'bar' }\n}" <add> ); <add> assert.strictEqual( <add> m[util.inspect.custom].call(Object.create(null)), <add> 'SourceTextModule {\n status: undefined,\n linkingStatus: undefined,' + <add> '\n url: undefined,\n context: undefined\n}' <add> ); <add> assert.strictEqual(util.inspect(m, { depth: -1 }), '[SourceTextModule]'); <add>}
1
Text
Text
remove link on user request
53c2532c262826353c6dfe6e56d2a35ecc9d2a1c
<ide><path>SUPPORTERS.md <ide> These wonderful people supported our Kickstarter by giving us £10 or more: <ide> * [Gerry Cardinal III](http://gerrycardinal.com/) <ide> * [Andrew Kalek](http://anlek.com) <ide> * [Bryan Coe](http://www.BryanACoe.com) <del>* [360 Virtual Tours](http://www.360virtualtours.co.uk) <add>* 360 Virtual Tours <ide> * [James Turnbull](http://www.kartar.net) <ide> * [Dominic Morgan](http://d3r.com) <ide> * [Mario Witte](http://www.mariowitte.com)
1
Javascript
Javascript
fix some indentations issues
2271f7df7fd31c2f15bfbcc4e24ff1a724995a44
<ide><path>fonts.js <ide> var Font = (function Font() { <ide> var ulUnicodeRange3 = 0; <ide> var ulUnicodeRange4 = 0; <ide> <del> var charset = properties.charset; <add> var charset = properties.charset; <ide> if (charset && charset.length) { <del> var firstCharIndex = null; <del> var lastCharIndex = 0; <add> var firstCharIndex = null; <add> var lastCharIndex = 0; <ide> <del> for (var i = 1; i < charset.length; i++) { <del> var code = GlyphsUnicode[charset[i]]; <del> if (firstCharIndex > code || !firstCharIndex) <add> for (var i = 1; i < charset.length; i++) {var code = GlyphsUnicode[charset[i]]; <add> if (firstCharIndex > code || !firstCharIndex) <ide> firstCharIndex = code; <del> if (lastCharIndex < code) <del> lastCharIndex = code; <add> if (lastCharIndex < code) <add> lastCharIndex = code; <ide> <ide> var position = getUnicodeRangeFor(code); <ide> if (position < 32) {
1
Java
Java
add spel support for float literals
be8f23d75658a8b728912b644c138407d4914f8b
<ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/FloatLiteral.java <add>/* <add> * Copyright 2002-2012 the original author or authors. <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>package org.springframework.expression.spel.ast; <add> <add>import org.springframework.expression.TypedValue; <add> <add>/** <add> * Expression language AST node that represents a float literal. <add> * <add> * @author Satyapal Reddy <add> * @since 3.2 <add> */ <add>public class FloatLiteral extends Literal { <add> private final TypedValue value; <add> <add> FloatLiteral(String payload, int pos, float value) { <add> super(payload, pos); <add> this.value = new TypedValue(value); <add> } <add> <add> @Override <add> public TypedValue getLiteralValue() { <add> return this.value; <add> } <add>} <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/Literal.java <ide> /* <del> * Copyright 2002-2009 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> package org.springframework.expression.spel.ast; <ide> <ide> import org.springframework.expression.TypedValue; <del>import org.springframework.expression.spel.ExpressionState; <del>import org.springframework.expression.spel.SpelEvaluationException; <del>import org.springframework.expression.spel.SpelMessage; <del>import org.springframework.expression.spel.SpelParseException; <del>import org.springframework.expression.spel.InternalParseException; <add>import org.springframework.expression.spel.*; <ide> <ide> /** <ide> * Common superclass for nodes representing literals (boolean, string, number, etc). <ide> public static Literal getLongLiteral(String numberToken, int pos, int radix) { <ide> } <ide> } <ide> <del> // TODO should allow for 'f' for float, not just double <add> <ide> public static Literal getRealLiteral(String numberToken, int pos, boolean isFloat) { <ide> try { <ide> if (isFloat) { <ide> float value = Float.parseFloat(numberToken); <del> return new RealLiteral(numberToken, pos, value); <add> return new FloatLiteral(numberToken, pos, value); <ide> } else { <ide> double value = Double.parseDouble(numberToken); <ide> return new RealLiteral(numberToken, pos, value); <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OpDivide.java <ide> public TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep <ide> Number op2 = (Number) operandTwo; <ide> if (op1 instanceof Double || op2 instanceof Double) { <ide> return new TypedValue(op1.doubleValue() / op2.doubleValue()); <del> } <del> else if (op1 instanceof Long || op2 instanceof Long) { <add> } else if (op1 instanceof Float || op2 instanceof Float) { <add> return new TypedValue(op1.floatValue() / op2.floatValue()); <add> } else if (op1 instanceof Long || op2 instanceof Long) { <ide> return new TypedValue(op1.longValue() / op2.longValue()); <ide> } <ide> else { <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OpEQ.java <ide> /* <del> * Copyright 2002-2009 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 BooleanTypedValue getValueInternal(ExpressionState state) throws Evaluati <ide> Number op2 = (Number) right; <ide> if (op1 instanceof Double || op2 instanceof Double) { <ide> return BooleanTypedValue.forValue(op1.doubleValue() == op2.doubleValue()); <add> } else if (op1 instanceof Float || op2 instanceof Float) { <add> return BooleanTypedValue.forValue(op1.floatValue() == op2.floatValue()); <ide> } else if (op1 instanceof Long || op2 instanceof Long) { <ide> return BooleanTypedValue.forValue(op1.longValue() == op2.longValue()); <ide> } else { <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OpGE.java <ide> /* <del> * Copyright 2002-2009 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 BooleanTypedValue getValueInternal(ExpressionState state) throws Evaluati <ide> Number rightNumber = (Number) right; <ide> if (leftNumber instanceof Double || rightNumber instanceof Double) { <ide> return BooleanTypedValue.forValue(leftNumber.doubleValue() >= rightNumber.doubleValue()); <add> } else if (leftNumber instanceof Float || rightNumber instanceof Float) { <add> return BooleanTypedValue.forValue(leftNumber.floatValue() >= rightNumber.floatValue()); <ide> } else if (leftNumber instanceof Long || rightNumber instanceof Long) { <ide> return BooleanTypedValue.forValue( leftNumber.longValue() >= rightNumber.longValue()); <ide> } else { <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OpLE.java <ide> /* <del> * Copyright 2002-2009 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 BooleanTypedValue getValueInternal(ExpressionState state) throws Evaluati <ide> Number rightNumber = (Number) right; <ide> if (leftNumber instanceof Double || rightNumber instanceof Double) { <ide> return BooleanTypedValue.forValue(leftNumber.doubleValue() <= rightNumber.doubleValue()); <add> } else if (leftNumber instanceof Float || rightNumber instanceof Float) { <add> return BooleanTypedValue.forValue(leftNumber.floatValue() <= rightNumber.floatValue()); <ide> } else if (leftNumber instanceof Long || rightNumber instanceof Long) { <ide> return BooleanTypedValue.forValue(leftNumber.longValue() <= rightNumber.longValue()); <ide> } else { <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OpLT.java <ide> /* <del> * Copyright 2002-2009 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 BooleanTypedValue getValueInternal(ExpressionState state) throws Evaluati <ide> Number rightNumber = (Number) right; <ide> if (leftNumber instanceof Double || rightNumber instanceof Double) { <ide> return BooleanTypedValue.forValue(leftNumber.doubleValue() < rightNumber.doubleValue()); <add> } else if (leftNumber instanceof Float || rightNumber instanceof Float) { <add> return BooleanTypedValue.forValue(leftNumber.floatValue() < rightNumber.floatValue()); <ide> } else if (leftNumber instanceof Long || rightNumber instanceof Long) { <ide> return BooleanTypedValue.forValue(leftNumber.longValue() < rightNumber.longValue()); <ide> } else { <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OpMinus.java <ide> /* <del> * Copyright 2002-2009 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 TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep <ide> Number n = (Number) operand; <ide> if (operand instanceof Double) { <ide> return new TypedValue(0 - n.doubleValue()); <add> } else if (operand instanceof Float) { <add> return new TypedValue(0 - n.floatValue()); <ide> } else if (operand instanceof Long) { <ide> return new TypedValue(0 - n.longValue()); <ide> } else { <ide> public TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep <ide> Number op2 = (Number) right; <ide> if (op1 instanceof Double || op2 instanceof Double) { <ide> return new TypedValue(op1.doubleValue() - op2.doubleValue()); <add> } else if (op1 instanceof Float || op2 instanceof Float) { <add> return new TypedValue(op1.floatValue() - op2.floatValue()); <ide> } else if (op1 instanceof Long || op2 instanceof Long) { <ide> return new TypedValue(op1.longValue() - op2.longValue()); <ide> } else { <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OpModulus.java <ide> /* <del> * Copyright 2002-2009 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 TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep <ide> Number op2 = (Number) operandTwo; <ide> if (op1 instanceof Double || op2 instanceof Double) { <ide> return new TypedValue(op1.doubleValue() % op2.doubleValue()); <add> } else if (op1 instanceof Float || op2 instanceof Float) { <add> return new TypedValue(op1.floatValue() % op2.floatValue()); <ide> } else if (op1 instanceof Long || op2 instanceof Long) { <ide> return new TypedValue(op1.longValue() % op2.longValue()); <ide> } else { <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OpMultiply.java <ide> public TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep <ide> if (leftNumber instanceof Double || rightNumber instanceof Double) { <ide> return new TypedValue(leftNumber.doubleValue() * rightNumber.doubleValue()); <ide> } <add> else if (leftNumber instanceof Float || rightNumber instanceof Float) { <add> return new TypedValue(leftNumber.floatValue() * rightNumber.floatValue()); <add> } <ide> else if (leftNumber instanceof Long || rightNumber instanceof Long) { <ide> return new TypedValue(leftNumber.longValue() * rightNumber.longValue()); <ide> } <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OpNE.java <ide> /* <del> * Copyright 2002-2009 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 BooleanTypedValue getValueInternal(ExpressionState state) throws Evaluati <ide> Number op2 = (Number) right; <ide> if (op1 instanceof Double || op2 instanceof Double) { <ide> return BooleanTypedValue.forValue(op1.doubleValue() != op2.doubleValue()); <add> } else if (op1 instanceof Float || op2 instanceof Float) { <add> return BooleanTypedValue.forValue(op1.floatValue() != op2.floatValue()); <ide> } else if (op1 instanceof Long || op2 instanceof Long) { <ide> return BooleanTypedValue.forValue(op1.longValue() != op2.longValue()); <ide> } else { <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OpPlus.java <ide> public TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep <ide> if (operandOne instanceof Number) { <ide> if (operandOne instanceof Double || operandOne instanceof Long) { <ide> return new TypedValue(operandOne); <add> } else if (operandOne instanceof Float) { <add> return new TypedValue(((Number) operandOne).floatValue()); <ide> } else { <ide> return new TypedValue(((Number) operandOne).intValue()); <ide> } <ide> public TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep <ide> Number op2 = (Number) operandTwo; <ide> if (op1 instanceof Double || op2 instanceof Double) { <ide> return new TypedValue(op1.doubleValue() + op2.doubleValue()); <add> } else if (op1 instanceof Float || op2 instanceof Float) { <add> return new TypedValue(op1.floatValue() + op2.floatValue()); <ide> } else if (op1 instanceof Long || op2 instanceof Long) { <ide> return new TypedValue(op1.longValue() + op2.longValue()); <ide> } else { // TODO what about overflow? <ide><path>spring-expression/src/main/java/org/springframework/expression/spel/ast/OperatorPower.java <ide> /* <del> * Copyright 2002-2009 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 TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep <ide> Number op2 = (Number) operandTwo; <ide> if (op1 instanceof Double || op2 instanceof Double) { <ide> return new TypedValue(Math.pow(op1.doubleValue(),op2.doubleValue())); <add> } else if (op1 instanceof Float || op2 instanceof Float) { <add> return new TypedValue(Math.pow(op1.floatValue(), op2.floatValue())); <ide> } else if (op1 instanceof Long || op2 instanceof Long) { <ide> double d= Math.pow(op1.longValue(), op2.longValue()); <ide> return new TypedValue((long)d); <ide><path>spring-expression/src/test/java/org/springframework/expression/spel/LiteralTests.java <ide> /* <del> * Copyright 2002-2009 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> package org.springframework.expression.spel; <ide> <ide> import junit.framework.Assert; <del> <ide> import org.junit.Test; <del>import org.springframework.expression.spel.support.StandardEvaluationContext; <ide> import org.springframework.expression.spel.standard.SpelExpression; <add>import org.springframework.expression.spel.support.StandardEvaluationContext; <ide> <ide> /** <ide> * Tests the evaluation of basic literals: boolean, integer, hex integer, long, real, null, date <ide> public void testLiteralReal01_CreatingDoubles() { <ide> @Test <ide> public void testLiteralReal02_CreatingFloats() { <ide> // For now, everything becomes a double... <del> evaluate("1.25f", 1.25d, Double.class); <del> evaluate("2.5f", 2.5d, Double.class); <del> evaluate("-3.5f", -3.5d, Double.class); <del> evaluate("1.25F", 1.25d, Double.class); <del> evaluate("2.5F", 2.5d, Double.class); <del> evaluate("-3.5F", -3.5d, Double.class); <add> evaluate("1.25f", 1.25f, Float.class); <add> evaluate("2.5f", 2.5f, Float.class); <add> evaluate("-3.5f", -3.5f, Float.class); <add> evaluate("1.25F", 1.25f, Float.class); <add> evaluate("2.5F", 2.5f, Float.class); <add> evaluate("-3.5F", -3.5f, Float.class); <ide> } <ide> <ide> @Test <ide> public void testLiteralReal03_UsingExponents() { <ide> evaluate("6.0221415e+23", "6.0221415E23", Double.class); <ide> evaluate("6.0221415E+23d", "6.0221415E23", Double.class); <ide> evaluate("6.0221415e+23D", "6.0221415E23", Double.class); <del> evaluate("6E2f", 600.0d, Double.class); <add> evaluate("6E2f", 6E2f, Float.class); <ide> } <ide> <ide> @Test <ide><path>spring-expression/src/test/java/org/springframework/expression/spel/OperatorTests.java <ide> /* <del> * Copyright 2002-2009 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> package org.springframework.expression.spel; <ide> <ide> import junit.framework.Assert; <del> <ide> import org.junit.Test; <ide> import org.springframework.expression.spel.ast.Operator; <ide> import org.springframework.expression.spel.standard.SpelExpression; <ide> public void testIntegerArithmetic() { <ide> evaluate("5 - 4", "1", Integer.class); <ide> evaluate("3 * 5", 15, Integer.class); <ide> evaluate("3.2d * 5", 16.0d, Double.class); <del> evaluate("3 * 5f", 15d, Double.class); <add> evaluate("3 * 5f", 15f, Float.class); <ide> evaluate("3 / 1", 3, Integer.class); <ide> evaluate("3 % 2", 1, Integer.class); <ide> evaluate("3 mod 2", 1, Integer.class); <ide> public void testIntegerArithmetic() { <ide> @Test <ide> public void testPlus() throws Exception { <ide> evaluate("7 + 2", "9", Integer.class); <del> evaluate("3.0f + 5.0f", 8.0d, Double.class); <add> evaluate("3.0f + 5.0f", 8.0f, Float.class); <ide> evaluate("3.0d + 5.0d", 8.0d, Double.class); <ide> <ide> evaluate("'ab' + 2", "ab2", String.class); <ide> public void testPlus() throws Exception { <ide> @Test <ide> public void testMinus() throws Exception { <ide> evaluate("'c' - 2", "a", String.class); <del> evaluate("3.0f - 5.0f", -2.0d, Double.class); <add> evaluate("3.0f - 5.0f", -2.0f, Float.class); <ide> evaluateAndCheckError("'ab' - 2", SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); <ide> evaluateAndCheckError("2-'ab'",SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); <ide> SpelExpression expr = (SpelExpression)parser.parseExpression("-3"); <ide> public void testMinus() throws Exception { <ide> public void testModulus() { <ide> evaluate("3%2",1,Integer.class); <ide> evaluate("3L%2L",1L,Long.class); <del> evaluate("3.0f%2.0f",1d,Double.class); <add> evaluate("3.0f%2.0f",1f,Float.class); <ide> evaluate("5.0d % 3.1d", 1.9d, Double.class); <ide> evaluateAndCheckError("'abc'%'def'",SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); <ide> } <ide> <ide> @Test <ide> public void testDivide() { <del> evaluate("3.0f / 5.0f", 0.6d, Double.class); <add> evaluate("3.0f / 5.0f", 0.6f, Float.class); <ide> evaluate("4L/2L",2L,Long.class); <del> evaluate("3.0f div 5.0f", 0.6d, Double.class); <add> evaluate("3.0f div 5.0f", 0.6f, Float.class); <ide> evaluate("4L DIV 2L",2L,Long.class); <ide> evaluateAndCheckError("'abc'/'def'",SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); <ide> } <ide> public void testMixedOperands_FloatsAndDoubles() { <ide> public void testMixedOperands_DoublesAndInts() { <ide> evaluate("3.0d + 5", 8.0d, Double.class); <ide> evaluate("3.0D - 5", -2.0d, Double.class); <del> evaluate("3.0f * 5", 15.0d, Double.class); <del> evaluate("6.0f / 2", 3.0, Double.class); <del> evaluate("6.0f / 4", 1.5d, Double.class); <add> evaluate("3.0f * 5", 15.0f, Float.class); <add> evaluate("6.0f / 2", 3.0f, Float.class); <add> evaluate("6.0f / 4", 1.5f, Float.class); <ide> evaluate("5.0D % 3", 2.0d, Double.class); <ide> evaluate("5.5D % 3", 2.5, Double.class); <ide> } <ide><path>spring-expression/src/test/java/org/springframework/expression/spel/SpringEL300Tests.java <ide> <ide> package org.springframework.expression.spel; <ide> <del>import static org.junit.Assert.assertEquals; <del>import static org.junit.Assert.fail; <del> <del>import java.lang.reflect.Field; <del>import java.lang.reflect.Method; <del>import java.util.ArrayList; <del>import java.util.HashMap; <del>import java.util.LinkedHashMap; <del>import java.util.List; <del>import java.util.Map; <del>import java.util.Properties; <del> <ide> import junit.framework.Assert; <del> <ide> import org.junit.Ignore; <ide> import org.junit.Test; <ide> import org.springframework.core.convert.TypeDescriptor; <del>import org.springframework.expression.AccessException; <del>import org.springframework.expression.BeanResolver; <del>import org.springframework.expression.EvaluationContext; <del>import org.springframework.expression.EvaluationException; <del>import org.springframework.expression.Expression; <del>import org.springframework.expression.ExpressionParser; <del>import org.springframework.expression.MethodExecutor; <del>import org.springframework.expression.MethodResolver; <del>import org.springframework.expression.ParserContext; <del>import org.springframework.expression.PropertyAccessor; <del>import org.springframework.expression.TypedValue; <add>import org.springframework.expression.*; <ide> import org.springframework.expression.spel.standard.SpelExpression; <ide> import org.springframework.expression.spel.standard.SpelExpressionParser; <ide> import org.springframework.expression.spel.support.ReflectiveMethodResolver; <ide> import org.springframework.expression.spel.support.ReflectivePropertyAccessor; <ide> import org.springframework.expression.spel.support.StandardEvaluationContext; <ide> import org.springframework.expression.spel.support.StandardTypeLocator; <ide> <add>import java.lang.reflect.Field; <add>import java.lang.reflect.Method; <add>import java.util.*; <add> <add>import static org.junit.Assert.assertEquals; <add>import static org.junit.Assert.fail; <add> <ide> /** <ide> * Tests based on Jiras up to the release of Spring 3.0.0 <ide> * <ide> public void testArray() { <ide> assertEquals("Equal assertion failed: ", "class [[I", result.toString()); <ide> } <ide> <add> @Test <add> public void SPR_9486_floatFunctionResolverTest() { <add> try { <add> Number expectedResult = Math.abs(-10.2f); <add> ExpressionParser parser = new SpelExpressionParser(); <add> SPR_9486_FunctionsClass testObject = new SPR_9486_FunctionsClass(); <add> <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("abs(-10.2f)"); <add> Number result = expression.getValue(context, testObject, Number.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatFunctionResolverTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatFunctionResolverTest"); <add> } <add> } <add> <add> class SPR_9486_FunctionsClass { <add> public int abs(int value) { <add> return Math.abs(value); <add> } <add> <add> public float abs(float value) { <add> return Math.abs(value); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_addFloatWithDoubleTest() { <add> try { <add> Number expectedNumber = 10.21f + 10.2; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.21f + 10.2"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_addFloatWithDoubleTest Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_addFloatWithDoubleTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_addFloatWithFloatTest() { <add> try { <add> Number expectedNumber = 10.21f + 10.2f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.21f + 10.2f"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_addFloatWithFloatTest Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_addFloatWithFloatTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_subtractFloatWithDoubleTest() { <add> try { <add> Number expectedNumber = 10.21f - 10.2; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.21f - 10.2"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_subtractFloatWithDoubleTest Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_subtractFloatWithDoubleTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_subtractFloatWithFloatTest() { <add> try { <add> Number expectedNumber = 10.21f - 10.2f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.21f - 10.2f"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_subtractFloatWithFloatTest Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_subtractFloatWithFloatTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_multiplyFloatWithDoubleTest() { <add> try { <add> Number expectedNumber = 10.21f * 10.2; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.21f * 10.2"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for float multiplied by double Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_multiplyFloatWithDoubleTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_multiplyFloatWithFloatTest() { <add> try { <add> Number expectedNumber = 10.21f * 10.2f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.21f * 10.2f"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for float multiply by another float Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_multiplyFloatWithFloatTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatDivideByFloatTest() { <add> try { <add> Number expectedNumber = -10.21f/-10.2f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f / -10.2f"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for float divide Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatDivideByFloatTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatDivideByDoubleTest() { <add> try { <add> Number expectedNumber = -10.21f/-10.2; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f / -10.2"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for float divide Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatDivideByDoubleTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatEqFloatUnaryMinusTest() { <add> try { <add> Boolean expectedResult = -10.21f == -10.2f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f == -10.2f"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatEqFloatUnaryMinusTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatEqFloatUnaryMinusTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatEqDoubleUnaryMinusTest() { <add> try { <add> Boolean expectedResult = -10.21f == -10.2; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f == -10.2"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatEqDoubleUnaryMinusTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatEqDoubleUnaryMinusTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatEqFloatTest() { <add> try { <add> Boolean expectedResult = 10.215f == 10.2109f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.215f == 10.2109f"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatEqFloatTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatEqFloatTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatEqDoubleTest() { <add> try { <add> Boolean expectedResult = 10.215f == 10.2109; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.215f == 10.2109"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatEqDoubleTest() Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatEqDoubleTest()"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatNotEqFloatTest() { <add> try { <add> Boolean expectedResult = 10.215f != 10.2109f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.215f != 10.2109f"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatEqFloatTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatEqFloatTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatNotEqDoubleTest() { <add> try { <add> Boolean expectedResult = 10.215f != 10.2109; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.215f != 10.2109"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatNotEqDoubleTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatNotEqDoubleTest"); <add> } <add> } <add> <add> <add> <add> @Test <add> public void SPR_9486_floatLessThanFloatTest() { <add> try { <add> Boolean expectedNumber = -10.21f < -10.2f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f < -10.2f"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatLessThanFloatTest Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatLessThanFloatTest()"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatLessThanDoubleTest() { <add> try { <add> Boolean expectedNumber = -10.21f < -10.2; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f < -10.2"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatLessThanDoubleTest Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatLessThanDoubleTest()"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatLessThanOrEqualFloatTest() { <add> try { <add> Boolean expectedNumber = -10.21f <= -10.22f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f <= -10.22f"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatLessThanOrEqualFloatTest Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatLessThanOrEqualFloatTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatLessThanOrEqualDoubleTest() { <add> try { <add> Boolean expectedNumber = -10.21f <= -10.2; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f <= -10.2"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatLessThanOrEqualDoubleTest Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatLessThanOrEqualDoubleTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatGreaterThanFloatTest() { <add> try { <add> Boolean expectedNumber = -10.21f > -10.2f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f > -10.2f"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatGreaterThanFloatTest Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatGreaterThanTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatGreaterThanDoubleTest() { <add> try { <add> Boolean expectedResult = -10.21f > -10.2; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f > -10.2"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatGreaterThanDoubleTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatGreaterThanTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatGreaterThanOrEqualFloatTest() { <add> try { <add> Boolean expectedNumber = -10.21f >= -10.2f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f >= -10.2f"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatGreaterThanFloatTest Test: ", expectedNumber, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatGreaterThanTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatGreaterThanEqualDoubleTest() { <add> try { <add> Boolean expectedResult = -10.21f >= -10.2; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("-10.21f >= -10.2"); <add> Boolean result = expression.getValue(context, null, Boolean.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatGreaterThanDoubleTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatGreaterThanTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatModulusFloatTest() { <add> try { <add> Number expectedResult = 10.21f % 10.2f; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.21f % 10.2f"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatModulusFloatTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatModulusFloatTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatModulusDoubleTest() { <add> try { <add> Number expectedResult = 10.21f % 10.2; <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.21f % 10.2"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatModulusDoubleTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatModulusDoubleTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatPowerFloatTest() { <add> try { <add> Number expectedResult = Math.pow(10.21f, -10.2f); <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.21f ^ -10.2f"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatPowerFloatTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatPowerFloatTest"); <add> } <add> } <add> <add> @Test <add> public void SPR_9486_floatPowerDoubleTest() { <add> try { <add> Number expectedResult = Math.pow(10.21f, 10.2); <add> ExpressionParser parser = new SpelExpressionParser(); <add> StandardEvaluationContext context = new StandardEvaluationContext(); <add> org.springframework.expression.Expression expression = parser.parseExpression("10.21f ^ 10.2"); <add> Number result = expression.getValue(context, null, Number.class); <add> Assert.assertEquals("Equal assertion failed for SPR_9486_floatPowerDoubleTest Test: ", expectedResult, result); <add> } catch (Exception e) { <add> e.printStackTrace(); <add> Assert.fail("Test failed - SPR_9486_floatPowerDoubleTest"); <add> } <add> } <add> <ide> } <ide> <ide>
16
Text
Text
update pr and issue guidelines
fe7fcdb2270643fa308c40201b7aaa556fccd7e2
<ide><path>PULL_REQUEST_TEMPLATE.md <ide> Make sure tests pass on both Travis and Circle CI. <ide> <ide> **Code formatting** <ide> <del>See the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide). <add>Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide). <ide><path>docs/IssueGuidelines.md <del>Here are some tips on how to manage GitHub issues efficiently: <add>## Tips on managing GitHub issues efficiently <ide> <ide> ### An issue is a duplicate of another issue <ide> Comment e.g. `@facebook-github-bot duplicate #123`. This will add a comment and close the issue. <ide> Example: [#5977](https://github.com/facebook/react-native/issues/5977) <ide> <ide> ### An issue is a question <del>StackOverflow is really good for Q&A. It has a reputation system and voting. Questions should absolutely be asked on StackOverflow rather than GitHub. However, to make this work we should hang out on StackOverflow every now and then and answer questions. A nice side effect is you'll get reputation for answering questions there rather than on GitHub. <add>Questions should absolutely be asked on StackOverflow rather than GitHub. <ide> Comment `@facebook-github-bot stack-overflow` to close the issue. <ide> Examples: [#6378](https://github.com/facebook/react-native/issues/6378), [#6015](https://github.com/facebook/react-native/issues/6015), [#6059](https://github.com/facebook/react-native/issues/6059), [#6062](https://github.com/facebook/react-native/issues/6062). <add>Feel free to also answer some [SO questions](stackoverflow.com/questions/tagged/react-native), you'll get rep :) <ide> <ide> ### An issue is a question that's been answered <del>Sometimes and issue has been resolved in the comments. Resolved issues should be closed. <add>Sometimes and issue has been resolved in the comments. <ide> Comment `@facebook-github-bot answered` to close it. <ide> Example: [#6045](https://github.com/facebook/react-native/issues/6045) <ide> <ide> Comment mentioning the author asking if they plan to provide the additional info <ide> Example: [#6056](https://github.com/facebook/react-native/issues/6056) <ide> <ide> ### An issue is a valid bug report <del>Valid bug reports with good repro steps are some of the best issues! Thank the author for finding it, explain that React Native is a community project and ask them if they would be up for sending a fix. <add>Valid bug reports with good repro steps are some of the best issues! Thank the author for finding it, explain that React Native is a community project and **ask them if they would be up for sending a fix**. <ide> <del>### An issue is a feature request and you're pretty sure React Native should have that feature <del>Tell the author something like: "Pull requests are welcome. In case you're not up for sending a PR, you should post to [Product Pains](https://productpains.com/product/react-native/?tab=top). It has a voting system and if the feature gets upvoted enough it might get implemented." <del> <del>### An issue is a feature request for a feature we don't want <add>### An issue is a feature request. The feature shouldn't be in the code and don't want to maintain it. <ide> This especially includes **new modules** Facebook doesn't use in production. Explain that those modules should be released to npm separately and that everyone will still be able to use the module super easily that way. <ide> <add>### An issue is a feature request, you're pretty sure we should maintain this feature as part of RN <add>This should be rare - adding a new feature means maintaining it. <add>Tell the author something like: "Pull requests are welcome. In case you're not up for sending a PR, you should post to [Product Pains](https://productpains.com/product/react-native/?tab=top). It has a voting system and if the feature gets upvoted enough it might get implemented." <add> <ide> ### How to add a label <ide> Add any relevant labels, for example 'Android', 'iOS'. <ide> Comment e.g. `@facebook-github-bot label Android` <ide><path>docs/PullRequestGuidelines.md <del>Here are some tips on reviewing pull requests: <add>## Tips on reviewing pull requests <ide> <del>- Does the PR miss info required in the [Pull request template](https://github.com/facebook/react-native/blob/master/PULL_REQUEST_TEMPLATE.md)? Ask for it and link to the template. Add labels 'Needs revision' and 'Needs response from author'. Examples: [#6395](https://github.com/facebook/react-native/pull/6395), [#5637](https://github.com/facebook/react-native/pull/5637). <del>- Does the code style match the [Style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide), especially consistency with the rest of the codebase? If not, link to the style guide and add the label 'Needs revision'. <add>Does the PR miss info required in the [Pull request template](https://github.com/facebook/react-native/blob/master/PULL_REQUEST_TEMPLATE.md)? Ask for it and link to the template. Add labels 'Needs revision' and 'Needs response from author'. Examples: [#6395](https://github.com/facebook/react-native/pull/6395). <add>Example: <add> <add>> Hey @author, thanks for sending the pull request. <add>> Can you please add all the info specified in the [template](https://github.com/facebook/react-native/blob/master/PULL_REQUEST_TEMPLATE.md)? This is necessary for people to be able to understand and review your pull request. <add> <add>Does the code style match the [Style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide), especially consistency with the rest of the codebase? If not, link to the style guide and add the label 'Needs revision'. <add> <add>Does the pull request add a completely new feature we don't want to add to the core and maintain? Ask the author to release it a separate npm module. <add> <add>Does the pull request do several unrelated things at the same time? Ask the author to split it.
3
Text
Text
remove warning against readable/readable.read
0f05173f49ab31aafc48c0046d9b0cb5e38fb6be
<ide><path>doc/api/stream.md <ide> readable.on('readable', () => { <ide> }); <ide> ``` <ide> <del>Avoid the use of the `'readable'` event and the `readable.read()` method in <del>favor of using either `readable.pipe()` or the `'data'` event. <del> <ide> A Readable stream in object mode will always return a single item from <ide> a call to [`readable.read(size)`][stream-read], regardless of the value of the <ide> `size` argument.
1
Javascript
Javascript
add tests for newly added methods
f418e4d5ae3f7c9cc500b78aeb72a6ee0c0daa25
<ide><path>test/Chunk.test.js <add>/* globals describe, it, beforeEach */ <ide> "use strict"; <ide> <ide> const should = require("should"); <del>const path = require("path"); <add>const sinon = require("sinon"); <ide> const Chunk = require("../lib/Chunk"); <ide> <ide> describe("Chunk", () => { <ide> describe("Chunk", () => { <ide> describe("entry", () => { <ide> it("returns an error if get entry", () => <ide> should(() => { <del> const entryTest = ChunkInstance.entry; <add> ChunkInstance.entry; <ide> }).throw("Chunk.entry was removed. Use hasRuntime()")); <ide> <ide> it("returns an error if set an entry", () => <ide> describe("Chunk", () => { <ide> describe("initial", () => { <ide> it("returns an error if get initial", () => <ide> should(() => { <del> const initialTest = ChunkInstance.initial; <add> ChunkInstance.initial; <ide> }).throw("Chunk.initial was removed. Use isInitial()")); <ide> <ide> it("returns an error if set an initial", () => <ide> describe("Chunk", () => { <ide> should(ChunkInstance.canBeIntegrated(other)).be.true(); <ide> }); <ide> }); <add> <add> describe("removeModule", function() { <add> let module; <add> let removeChunkSpy; <add> beforeEach(function() { <add> removeChunkSpy = sinon.spy(); <add> module = { <add> removeChunk: removeChunkSpy <add> }; <add> }); <add> describe("and the chunk does not contain this module", function() { <add> it("returns false", function() { <add> ChunkInstance.removeModule(module).should.eql(false); <add> }); <add> }); <add> describe("and the chunk does contain this module", function() { <add> beforeEach(function() { <add> ChunkInstance.modules = [module]; <add> }); <add> it("calls module.removeChunk with itself and returns true", function() { <add> ChunkInstance.removeModule(module).should.eql(true); <add> removeChunkSpy.callCount.should.eql(1); <add> removeChunkSpy.args[0][0].should.eql(ChunkInstance); <add> }); <add> }); <add> }); <add> <add> describe("removeChunk", function() { <add> let chunk; <add> let removeParentSpy; <add> beforeEach(function() { <add> removeParentSpy = sinon.spy(); <add> chunk = { <add> removeParent: removeParentSpy <add> }; <add> }); <add> describe("and the chunk does not contain this chunk", function() { <add> it("returns false", function() { <add> ChunkInstance.removeChunk(chunk).should.eql(false); <add> }); <add> }); <add> describe("and the chunk does contain this module", function() { <add> beforeEach(function() { <add> ChunkInstance.chunks = [chunk]; <add> }); <add> it("calls module.removeChunk with itself and returns true", function() { <add> ChunkInstance.removeChunk(chunk).should.eql(true); <add> removeParentSpy.callCount.should.eql(1); <add> removeParentSpy.args[0][0].should.eql(ChunkInstance); <add> }); <add> }); <add> }); <add> <add> describe("removeParent", function() { <add> let chunk; <add> let removeChunkSpy; <add> beforeEach(function() { <add> removeChunkSpy = sinon.spy(); <add> chunk = { <add> removeChunk: removeChunkSpy <add> }; <add> }); <add> describe("and the chunk does not contain this chunk", function() { <add> it("returns false", function() { <add> ChunkInstance.removeParent(chunk).should.eql(false); <add> }); <add> }); <add> describe("and the chunk does contain this module", function() { <add> beforeEach(function() { <add> ChunkInstance.parents = [chunk]; <add> }); <add> it("calls module.removeChunk with itself and returns true", function() { <add> ChunkInstance.removeParent(chunk).should.eql(true); <add> removeChunkSpy.callCount.should.eql(1); <add> removeChunkSpy.args[0][0].should.eql(ChunkInstance); <add> }); <add> }); <add> }); <ide> });
1
Javascript
Javascript
implement stricter whitespace rules
c16b5659a0323572b2cd404f6356c7b38e38b038
<ide><path>src/core/__tests__/ReactRenderDocument-test.js <ide> describe('rendering React components at document', function() { <ide> React.renderComponentToString(<Root />, function(markup) { <ide> testDocument = getTestDocument(markup); <ide> var component = React.renderComponent(<Root />, testDocument); <del> expect(testDocument.body.innerHTML).toBe(' Hello world '); <add> expect(testDocument.body.innerHTML).toBe('Hello world'); <ide> <ide> var componentID = ReactMount.getReactRootID(testDocument); <ide> expect(componentID).toBe(component._rootNodeID); <ide> describe('rendering React components at document', function() { <ide> React.renderComponentToString(<Root />, function(markup) { <ide> testDocument = getTestDocument(markup); <ide> React.renderComponent(<Root />, testDocument); <del> expect(testDocument.body.innerHTML).toBe(' Hello world '); <add> expect(testDocument.body.innerHTML).toBe('Hello world'); <ide> <ide> expect(function() { <ide> React.unmountComponentAtNode(testDocument); <ide> }).toThrow(UNMOUNT_INVARIANT_MESSAGE); <ide> <del> expect(testDocument.body.innerHTML).toBe(' Hello world '); <add> expect(testDocument.body.innerHTML).toBe('Hello world'); <ide> }); <ide> }); <ide> <ide> describe('rendering React components at document', function() { <ide> <ide> React.renderComponent(<Component />, testDocument); <ide> <del> expect(testDocument.body.innerHTML).toBe(' Hello world '); <add> expect(testDocument.body.innerHTML).toBe('Hello world'); <ide> <ide> // Reactive update <ide> expect(function() { <ide> React.renderComponent(<Component2 />, testDocument); <ide> }).toThrow(UNMOUNT_INVARIANT_MESSAGE); <ide> <del> expect(testDocument.body.innerHTML).toBe(' Hello world '); <add> expect(testDocument.body.innerHTML).toBe('Hello world'); <ide> }); <ide> }); <ide> <ide><path>vendor/fbtransform/transforms/react.js <ide> function visitReactTag(traverse, object, path, state) { <ide> <ide> utils.move(object.name.range[1], state); <ide> <del> var childrenToRender = object.children.filter(function(child) { <del> return !(child.type === Syntax.Literal && !child.value.match(/\S/)); <del> }); <del> <ide> // if we don't have any attributes, pass in null <ide> if (object.attributes.length === 0) { <ide> utils.append('null', state); <ide> function visitReactTag(traverse, object, path, state) { <ide> } <ide> <ide> // filter out whitespace <add> var childrenToRender = object.children.filter(function(child) { <add> return !(child.type === Syntax.Literal && <add> child.value.match(/^[ \t]*[\r\n][ \t\r\n]*$/)); <add> }); <add> <ide> if (childrenToRender.length > 0) { <ide> utils.append(', ', state); <ide> <del> object.children.forEach(function(child) { <del> if (child.type === Syntax.Literal && !child.value.match(/\S/)) { <del> return; <del> } <add> childrenToRender.forEach(function(child, index) { <ide> utils.catchup(child.range[0], state); <ide> <del> var isLast = child === childrenToRender[childrenToRender.length - 1]; <add> var isLast = index === childrenToRender.length - 1; <ide> <ide> if (child.type === Syntax.Literal) { <ide> renderXJSLiteral(child, isLast, state); <ide><path>vendor/fbtransform/transforms/xjs.js <ide> var knownTags = { <ide> wbr: true <ide> }; <ide> <del>function safeTrim(string) { <del> return string.replace(/^[ \t]+/, '').replace(/[ \t]+$/, ''); <del>} <del> <del>// Replace all trailing whitespace characters with a single space character <del>function trimWithSingleSpace(string) { <del> return string.replace(/^[ \t\xA0]{2,}/, ' '). <del> replace(/[ \t\xA0]{2,}$/, ' ').replace(/^\s+$/, ''); <del>} <del> <del>/** <del> * Special handling for multiline string literals <del> * print lines: <del> * <del> * line <del> * line <del> * <del> * as: <del> * <del> * "line "+ <del> * "line" <del> */ <ide> function renderXJSLiteral(object, isLast, state, start, end) { <del> /** Added blank check filtering and triming*/ <del> var trimmedChildValue = safeTrim(object.value); <del> var hasFinalNewLine = false; <del> <del> if (trimmedChildValue) { <del> // head whitespace <del> utils.append(object.value.match(/^[\t ]*/)[0], state); <del> if (start) { <del> utils.append(start, state); <add> var lines = object.value.split(/\r\n|\n|\r/); <add> <add> if (start) { <add> utils.append(start, state); <add> } <add> <add> var lastNonEmptyLine = 0; <add> <add> lines.forEach(function (line, index) { <add> if (line.match(/[^ \t]/)) { <add> lastNonEmptyLine = index; <ide> } <del> <del> var trimmedChildValueWithSpace = trimWithSingleSpace(object.value); <del> <del> /** <del> */ <del> var initialLines = trimmedChildValue.split(/\r\n|\n|\r/); <del> <del> var lines = initialLines.filter(function(line) { <del> return safeTrim(line).length > 0; <del> }); <del> <del> var hasInitialNewLine = initialLines[0] !== lines[0]; <del> hasFinalNewLine = <del> initialLines[initialLines.length - 1] !== lines[lines.length - 1]; <del> <del> var numLines = lines.length; <del> lines.forEach(function (line, ii) { <del> var lastLine = ii === numLines - 1; <del> var trimmedLine = safeTrim(line); <del> if (trimmedLine === '' && !lastLine) { <del> utils.append(line, state); <del> } else { <del> var preString = ''; <del> var postString = ''; <del> var leading = line.match(/^[ \t]*/)[0]; <del> <del> if (ii === 0) { <del> if (hasInitialNewLine) { <del> preString = ' '; <del> leading = '\n' + leading; <del> } <del> if (trimmedChildValueWithSpace.substring(0, 1) === ' ') { <del> // If this is the first line, and the original content starts with <del> // whitespace, place a single space at the beginning. <del> preString = ' '; <del> } <add> }); <add> <add> lines.forEach(function (line, index) { <add> var isFirstLine = index === 0; <add> var isLastLine = index === lines.length - 1; <add> var isLastNonEmptyLine = index === lastNonEmptyLine; <add> <add> // replace rendered whitespace tabs with spaces <add> var trimmedLine = line.replace(/\t/g, ' '); <add> <add> // trim whitespace touching a newline <add> if (!isFirstLine) { <add> trimmedLine = trimmedLine.replace(/^[ ]+/, ''); <add> } <add> if (!isLastLine) { <add> trimmedLine = trimmedLine.replace(/[ ]+$/, ''); <add> } <add> <add> utils.append(line.match(/^[ \t]*/)[0], state); <add> <add> if (trimmedLine || isLastNonEmptyLine) { <add> utils.append( <add> JSON.stringify(trimmedLine) + <add> (!isLastNonEmptyLine ? "+' '+" : ''), <add> state); <add> <add> if (isLastNonEmptyLine) { <add> if (end) { <add> utils.append(end, state); <ide> } <del> if (!lastLine || trimmedChildValueWithSpace.substr( <del> trimmedChildValueWithSpace.length - 1, 1) === ' ' || <del> hasFinalNewLine <del> ) { <del> // If either not on the last line, or the original content ends with <del> // whitespace, place a single character at the end. <del> postString = ' '; <add> if (!isLast) { <add> utils.append(',', state); <ide> } <del> <del> utils.append( <del> leading + <del> JSON.stringify( <del> preString + trimmedLine + postString <del> ) + <del> (lastLine ? '' : '+') + <del> line.match(/[ \t]*$/)[0], <del> state); <ide> } <del> if (!lastLine) { <del> utils.append('\n', state); <add> <add> // only restore tail whitespace if line had literals <add> if (trimmedLine) { <add> utils.append(line.match(/[ \t]*$/)[0], state); <ide> } <del> }); <del> } else { <del> if (start) { <del> utils.append(start, state); <ide> } <del> utils.append('""', state); <del> } <del> if (end) { <del> utils.append(end, state); <del> } <del> <del> // add comma before trailing whitespace <del> if (!isLast) { <del> utils.append(',', state); <del> } <del> <del> // tail whitespace <del> if (hasFinalNewLine) { <del> utils.append('\n', state); <del> } <del> utils.append(object.value.match(/[ \t]*$/)[0], state); <add> <add> if (!isLastLine) { <add> utils.append('\n', state); <add> } <add> }); <add> <ide> utils.move(object.range[1], state); <ide> } <ide>
3
Python
Python
fix conflict with utils.py
06ad4b3f4d60018c551bbd7ec5415285c6e20f72
<ide><path>airflow/utils.py <ide> def ask_yesno(question): <ide> def send_email(to, subject, html_content): <ide> SMTP_MAIL_FROM = conf.get('smtp', 'SMTP_MAIL_FROM') <ide> <del> if isinstance(to, str) or isinstance(to, str): <add> if isinstance(to, basestring): <ide> if ',' in to: <ide> to = to.split(',') <ide> elif ';' in to:
1
Python
Python
test the change
f98e81459a50716591dc0cfae95531a5d1b03314
<ide><path>integration/storage/test_azure_blobs.py <ide> def setUpClass(cls): <ide> ) <ide> <ide> location = os.getenv('AZURE_LOCATION', DEFAULT_AZURE_LOCATION) <add> name = 'libcloud-itests-' <ide> name = 'libcloud' <ide> name += random_string(MAX_STORAGE_ACCOUNT_NAME_LENGTH - len(name)) <ide> timeout = float(os.getenv('AZURE_TIMEOUT_SECONDS', DEFAULT_TIMEOUT_SECONDS)) <ide> def setUpClass(cls): <ide> resource_create_ts = resource_groups.tags.get('create_ts', now_ts) <ide> <ide> if resource_group.name.startswith(name) and resource_group.location == location and \ <del> 'test' in resource_groups.tags and resource_create_ts <= delete_threshold_ts: <del> #'test' in resource_groups.tags and resource_create_ts <= delete_threshold_ts: <add> 'test' in resource_group.tags: <add> #'test' in resource_group.tags and resource_create_ts <= delete_threshold_ts: <ide> print("Deleting old stray resource group: %s..." % (resource_group.name)) <ide> <ide> try:
1
Python
Python
add tests for tickets #335, #341, #342 and #344
81e481bd272d8685d986030e855fe3a389d68061
<ide><path>numpy/core/tests/test_regression.py <ide> def check_dtype_tuple(self, level=rlevel): <ide> """Ticket #334""" <ide> assert N.dtype('i4') == N.dtype(('i4',())) <ide> <add> def check_dtype_posttuple(self, level=rlevel): <add> """Ticket #335""" <add> N.dtype([('col1', '()i4')]) <add> <add> def check_numeric_carray_compare(self, level=rlevel): <add> """Ticket #341""" <add> assert_equal(N.array([ 'X' ], 'c'),'X') <add> <add> def check_string_array_size(self, level=rlevel): <add> """Ticket #342""" <add> self.failUnlessRaises(ValueError, <add> N.array,[['X'],['X','X','X']],'|S1') <add> <add> def check_dtype_repr(self, level=rlevel): <add> """Ticket #344""" <add> dt1=N.dtype(('uint32', 2)) <add> dt2=N.dtype(('uint32', (2,))) <add> assert_equal(dt1.__repr__(), dt2.__repr__()) <add> <ide> if __name__ == "__main__": <ide> NumpyTest().run()
1
Javascript
Javascript
add tests for attrtween and styletween
e2b112bc81f0f7d16d22c2e5ca1dd5e726657d45
<ide><path>test/core/transition-test-attrTween.js <add>require("../env"); <add>require("../../d3"); <add> <add>var assert = require("assert"); <add> <add>module.exports = { <add> topic: function() { <add> var cb = this.callback, <add> dd = [], <add> ii = [], <add> tt = [], <add> vv = []; <add> <add> var s = d3.select("body").append("div").selectAll("div") <add> .data(["red", "green"]) <add> .enter().append("div") <add> .attr("color", function(d) { return d3.rgb(d)+""; }); <add> <add> var t = s.transition() <add> .attrTween("color", tween); <add> <add> function tween(d, i, v) { <add> dd.push(d); <add> ii.push(i); <add> vv.push(v); <add> if (tt.push(this) >= 2) cb(null, { <add> selection: s, <add> transition: t, <add> data: dd, <add> index: ii, <add> value: vv, <add> context: tt <add> }); <add> return i && d3.interpolateHsl(v, "blue"); <add> } <add> }, <add> <add> // The order here is a bit brittle: because the transition has zero delay, <add> // it's invoking the start event immediately for all nodes, rather than <add> // pushing each node onto the timer queue (which would reverse the order of <add> // callbacks). The order in which tweens are invoked is undefined, so perhaps <add> // we should sort the expected and actual values before comparing. <add> <add> "defines the corresponding attr tween": function(result) { <add> assert.typeOf(result.transition.tween("attr.color"), "function"); <add> }, <add> "invokes the tween function": function(result) { <add> assert.deepEqual(result.data, ["red", "green"], "expected data, got {actual}"); <add> assert.deepEqual(result.index, [0, 1], "expected data, got {actual}"); <add> assert.deepEqual(result.value, ["#ff0000", "#008000"], "expected value, got {actual}"); <add> assert.domEqual(result.context[0], result.selection[0][0], "expected this, got {actual}"); <add> assert.domEqual(result.context[1], result.selection[0][1], "expected this, got {actual}"); <add> }, <add> <add> "end": { <add> topic: function(result) { <add> var cb = this.callback; <add> result.transition.each("end", function(d, i) { if (i >= 1) cb(null, result); }); <add> }, <add> "uses the returned interpolator": function(result) { <add> assert.equal(result.selection[0][1].getAttribute("color"), "#0000ff"); <add> }, <add> "does nothing if the interpolator is falsey": function(result) { <add> assert.equal(result.selection[0][0].getAttribute("color"), "#ff0000"); <add> } <add> } <add>}; <ide><path>test/core/transition-test-style.js <ide> var assert = require("assert"); <ide> <ide> module.exports = { <ide> topic: function() { <del> var callback = this.callback, <del> div = d3.select("body").append("div"); <add> var cb = this.callback; <ide> <del> div <add> var s = d3.select("body").append("div") <ide> .style("background-color", "white") <del> .style("color", "red") <del> .transition() <add> .style("color", "red"); <add> <add> var t = s.transition() <add> .style("background-color", "green") <ide> .style("background-color", "red") <ide> .style("color", "green", "important") <del> .each("end", function() { callback(null, div); }); <add> .each("end", function() { cb(null, {selection: s, transition: t}); }); <add> }, <add> "defines the corresponding style tween": function(result) { <add> assert.typeOf(result.transition.tween("style.background-color"), "function"); <add> assert.typeOf(result.transition.tween("style.color"), "function"); <add> }, <add> "the last style operator takes precedence": function(result) { <add> assert.equal(result.selection.style("background-color"), "rgb(255,0,0)"); <ide> }, <del> "sets a property as a string": function(div) { <del> assert.equal(div.style("background-color"), "rgb(255,0,0)"); <add> "sets a property as a string": function(result) { <add> assert.equal(result.selection.style("color"), "rgb(0,128,0)"); <ide> }, <del> "observes the specified priority": function(div) { <del> var style = div.node().style; <add> "observes the specified priority": function(result) { <add> var style = result.selection.node().style; <ide> assert.equal(style.getPropertyPriority("background-color"), ""); <ide> assert.equal(style.getPropertyPriority("color"), "important"); <ide> } <ide><path>test/core/transition-test-styleTween.js <add>require("../env"); <add>require("../../d3"); <add> <add>var assert = require("assert"); <add> <add>module.exports = { <add> topic: function() { <add> var cb = this.callback, <add> dd = [], <add> ii = [], <add> tt = [], <add> vv = []; <add> <add> var s = d3.select("body").append("div").selectAll("div") <add> .data(["red", "green"]) <add> .enter().append("div") <add> .style("background-color", function(d) { return d3.rgb(d)+""; }); <add> <add> var t = s.transition() <add> .styleTween("background-color", tween); <add> <add> function tween(d, i, v) { <add> dd.push(d); <add> ii.push(i); <add> vv.push(v); <add> if (tt.push(this) >= 2) cb(null, { <add> selection: s, <add> transition: t, <add> data: dd, <add> index: ii, <add> value: vv, <add> context: tt <add> }); <add> return i && d3.interpolateHsl(v, "blue"); <add> } <add> }, <add> <add> // The order here is a bit brittle: because the transition has zero delay, <add> // it's invoking the start event immediately for all nodes, rather than <add> // pushing each node onto the timer queue (which would reverse the order of <add> // callbacks). The order in which tweens are invoked is undefined, so perhaps <add> // we should sort the expected and actual values before comparing. <add> <add> "defines the corresponding style tween": function(result) { <add> assert.typeOf(result.transition.tween("style.background-color"), "function"); <add> }, <add> "invokes the tween function": function(result) { <add> assert.deepEqual(result.data, ["red", "green"], "expected data, got {actual}"); <add> assert.deepEqual(result.index, [0, 1], "expected data, got {actual}"); <add> assert.deepEqual(result.value, ["#ff0000", "#008000"], "expected value, got {actual}"); <add> assert.domEqual(result.context[0], result.selection[0][0], "expected this, got {actual}"); <add> assert.domEqual(result.context[1], result.selection[0][1], "expected this, got {actual}"); <add> }, <add> <add> "end": { <add> topic: function(result) { <add> var cb = this.callback; <add> result.transition.each("end", function(d, i) { if (i >= 1) cb(null, result); }); <add> }, <add> "uses the returned interpolator": function(result) { <add> assert.equal(result.selection[0][1].style.getPropertyValue("background-color"), "#0000ff"); <add> }, <add> "does nothing if the interpolator is falsey": function(result) { <add> assert.equal(result.selection[0][0].style.getPropertyValue("background-color"), "#ff0000"); <add> } <add> } <add>}; <ide><path>test/core/transition-test.js <ide> suite.addBatch({ <ide> <ide> // Content <ide> "attr": require("./transition-test-attr"), <add> "attrTween": require("./transition-test-attrTween"), <ide> "style": require("./transition-test-style"), <add> "styleTween": require("./transition-test-styleTween"), <ide> "text": require("./transition-test-text"), <ide> "remove": require("./transition-test-remove"), <ide>
4
Go
Go
add image id & ref to container commit event
e60ae5380208c9329ef8be38fe3f4bdcd8ef6e83
<ide><path>daemon/commit.go <ide> func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str <ide> } <ide> } <ide> <add> imageRef := "" <ide> if c.Repo != "" { <ide> newTag, err := reference.WithName(c.Repo) // todo: should move this to API layer <ide> if err != nil { <ide> func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str <ide> if err := daemon.TagImageWithReference(id, newTag); err != nil { <ide> return "", err <ide> } <add> imageRef = newTag.String() <ide> } <ide> <ide> attributes := map[string]string{ <ide> "comment": c.Comment, <add> "imageID": id.String(), <add> "imageRef": imageRef, <ide> } <ide> daemon.LogContainerEventWithAttributes(container, "commit", attributes) <ide> containerActions.WithValues("commit").UpdateSince(start)
1
Java
Java
use public assumptionviolatedexception in assume
5aaed147d5627dbea9ebd9ad529a8721e2fc7fca
<ide><path>spring-core/src/test/java/org/springframework/tests/Assume.java <ide> import java.util.Set; <ide> <ide> import org.apache.commons.logging.Log; <del>import org.junit.internal.AssumptionViolatedException; <add>import org.junit.AssumptionViolatedException; <ide> <ide> import org.springframework.util.ClassUtils; <ide>
1
PHP
PHP
fix breaking change
514d7f1e527ebc7ef772f7e2f6c064ceab39ce89
<ide><path>src/View/View.php <ide> class View implements EventDispatcherInterface <ide> * <ide> * @var array <ide> */ <del> public $uuIds = []; <add> public $uuids = []; <ide> <ide> /** <ide> * An instance of a \Cake\Http\ServerRequest object that contains information about the current request. <ide> class View implements EventDispatcherInterface <ide> */ <ide> const TYPE_ELEMENT = 'element'; <ide> <add> /** <add> * Constant for name of view file 'Element' <add> * <add> * @var string <add> */ <add> const NAME_ELEMENT = 'Element'; <add> <ide> /** <ide> * Constant for view file type 'layout' <ide> * <ide> public function element($name, array $data = [], array $options = []) <ide> if (empty($options['ignoreMissing'])) { <ide> list ($plugin, $name) = pluginSplit($name, true); <ide> $name = str_replace('/', DIRECTORY_SEPARATOR, $name); <del> $file = $plugin . ucfirst(static::TYPE_ELEMENT) . DIRECTORY_SEPARATOR . $name . $this->_ext; <add> $file = $plugin . static::NAME_ELEMENT . DIRECTORY_SEPARATOR . $name . $this->_ext; <ide> throw new MissingElementException([$file]); <ide> } <ide> } <ide> public function extend($name) <ide> if (!$parent) { <ide> list($plugin, $name) = $this->pluginSplit($name); <ide> $paths = $this->_paths($plugin); <del> $defaultPath = $paths[0] . ucfirst(static::TYPE_ELEMENT) . DIRECTORY_SEPARATOR; <add> $defaultPath = $paths[0] . static::NAME_ELEMENT . DIRECTORY_SEPARATOR; <ide> throw new LogicException(sprintf( <ide> 'You cannot extend an element which does not exist (%s).', <ide> $defaultPath . $name . $this->_ext <ide> public function uuid($object, $url) <ide> $c = 1; <ide> $url = Router::url($url); <ide> $hash = $object . substr(md5($object . $url), 0, 10); <del> while (in_array($hash, $this->uuIds)) { <add> while (in_array($hash, $this->uuids)) { <ide> $hash = $object . substr(md5($object . $url . $c), 0, 10); <ide> $c++; <ide> } <del> $this->uuIds[] = $hash; <add> $this->uuids[] = $hash; <ide> <ide> return $hash; <ide> } <ide> protected function _getElementFileName($name, $pluginCheck = true) <ide> list($plugin, $name) = $this->pluginSplit($name, $pluginCheck); <ide> <ide> $paths = $this->_paths($plugin); <del> $elementPaths = $this->_getSubPaths(ucfirst(static::TYPE_ELEMENT)); <add> $elementPaths = $this->_getSubPaths(static::NAME_ELEMENT); <ide> <ide> foreach ($paths as $path) { <ide> foreach ($elementPaths as $elementPath) {
1
Text
Text
wrap a piece of code to a code block
d279d3e165de1bcdb51fd673e043f2c68d21501d
<ide><path>guides/source/working_with_javascript.md <ide> You can bind to the same AJAX events as `form_for`. Here's an example. Let's <ide> assume that we have a resource `/fib/:n` that calculates the `n`th Fibonacci <ide> number. We would generate some HTML like this: <ide> <add>``` <ide> <%= link_to "Calculate", "/fib/15", remote: true, data: { fib: 15 } %> <add>``` <ide> <ide> and write some CoffeeScript like this: <ide>
1
PHP
PHP
fix missing use
7172b9d21880427c98ccdb1ca3af8607dc96b468
<ide><path>lib/Cake/Model/Model.php <ide> use Cake\Core\App; <ide> use Cake\Core\Configure; <ide> use Cake\Core\Object; <add>use Cake\Database\ConnectionManager; <ide> use Cake\Error; <ide> use Cake\Event\Event; <ide> use Cake\Event\EventListener;
1
Go
Go
kill the right containers in runtime_test
1fc55c2bb9bce1451d6199e8aaa23ef8baa0e46c
<ide><path>runtime_test.go <ide> func nuke(runtime *Runtime) error { <ide> var wg sync.WaitGroup <ide> for _, container := range runtime.List() { <ide> wg.Add(1) <del> go func() { <del> container.Kill() <add> go func(c *Container) { <add> c.Kill() <ide> wg.Add(-1) <del> }() <add> }(container) <ide> } <ide> wg.Wait() <ide> return os.RemoveAll(runtime.root)
1
Python
Python
change outdated message for knownfail described in
07b7bf30c422f1c3335042691ce269a972b98954
<ide><path>numpy/core/tests/test_regression.py <ide> def test_array_from_sequence_scalar_array(self): <ide> t = ((1,), np.array(1)) <ide> assert_raises(ValueError, lambda: np.array(t)) <ide> <del> @dec.knownfailureif(True, "Fix this for 1.5.0.") <add> @dec.knownfailureif(True, "This is a corner case, see ticket #1081.") <ide> def test_array_from_sequence_scalar_array2(self): <ide> """Ticket #1081: weird array with strange input...""" <ide> t = np.array([np.array([]), np.array(0, object)])
1
Python
Python
remove nose dependence of locale tests
e8389cb15f8d8fd902ea9f7aad0da64bce0f2583
<ide><path>numpy/core/tests/_locales.py <add>"""Provide class for testing in French locale <add> <add>""" <add>from __future__ import division, absolute_import, print_function <add> <add>import sys <add>import locale <add> <add>from numpy.testing import SkipTest <add> <add>__ALL__ = ['CommaDecimalPointLocale'] <add> <add> <add>def find_comma_decimal_point_locale(): <add> """See if platform has a decimal point as comma locale. <add> <add> Find a locale that uses a comma instead of a period as the <add> decimal point. <add> <add> Returns <add> ------- <add> old_locale: str <add> Locale when the function was called. <add> new_locale: {str, None) <add> First French locale found, None if none found. <add> <add> """ <add> if sys.platform == 'win32': <add> locales = ['FRENCH'] <add> else: <add> locales = ['fr_FR', 'fr_FR.UTF-8', 'fi_FI', 'fi_FI.UTF-8'] <add> <add> old_locale = locale.getlocale(locale.LC_NUMERIC) <add> new_locale = None <add> try: <add> for loc in locales: <add> try: <add> locale.setlocale(locale.LC_NUMERIC, loc) <add> new_locale = loc <add> break <add> except locale.Error: <add> pass <add> finally: <add> locale.setlocale(locale.LC_NUMERIC, locale=old_locale) <add> return old_locale, new_locale <add> <add> <add>class CommaDecimalPointLocale(object): <add> """Sets LC_NUMERIC to a locale with comma as decimal point. <add> <add> Classes derived from this class have setup and teardown methods that run <add> tests with locale.LC_NUMERIC set to a locale where commas (',') are used as <add> the decimal point instead of periods ('.'). On exit the locale is restored <add> to the initial locale. It also serves as context manager with the same <add> effect. If no such locale is available, it raises SkipTest in both cases. <add> <add> .. versionadded:: 1.15.0 <add> <add> """ <add> (cur_locale, tst_locale) = find_comma_decimal_point_locale() <add> <add> def setup(self): <add> if self.tst_locale is None: <add> raise SkipTest("No French locale available") <add> locale.setlocale(locale.LC_NUMERIC, locale=self.tst_locale) <add> <add> def teardown(self): <add> locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale) <add> <add> def __enter__(self): <add> if self.tst_locale is None: <add> raise SkipTest("No French locale available") <add> locale.setlocale(locale.LC_NUMERIC, locale=self.tst_locale) <add> <add> def __exit__(self, type, value, traceback): <add> locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale) <ide><path>numpy/core/tests/test_longdouble.py <ide> run_module_suite, assert_, assert_equal, dec, assert_raises, <ide> assert_array_equal, temppath, <ide> ) <del>from .test_print import in_foreign_locale <add>from ._locales import CommaDecimalPointLocale <ide> <ide> LD_INFO = np.finfo(np.longdouble) <ide> longdouble_longer_than_double = (LD_INFO.eps < np.finfo(np.double).eps) <ide> def test_bytes(): <ide> np.longdouble(b"1.2") <ide> <ide> <del>@in_foreign_locale <del>def test_fromstring_foreign_repr(): <del> f = 1.234 <del> a = np.fromstring(repr(f), dtype=float, sep=" ") <del> assert_equal(a[0], f) <del> <del> <ide> @dec.knownfailureif(string_to_longdouble_inaccurate, "Need strtold_l") <ide> def test_repr_roundtrip_bytes(): <ide> o = 1 + LD_INFO.eps <ide> assert_equal(np.longdouble(repr(o).encode("ascii")), o) <ide> <ide> <del>@in_foreign_locale <del>def test_repr_roundtrip_foreign(): <del> o = 1.5 <del> assert_equal(o, np.longdouble(repr(o))) <del> <del> <ide> def test_bogus_string(): <ide> assert_raises(ValueError, np.longdouble, "spam") <ide> assert_raises(ValueError, np.longdouble, "1.0 flub") <ide> def test_fromstring(): <ide> err_msg="reading '%s'" % s) <ide> <ide> <del>@in_foreign_locale <del>def test_fromstring_best_effort_float(): <del> assert_equal(np.fromstring("1,234", dtype=float, sep=" "), <del> np.array([1.])) <del> <del> <del>@in_foreign_locale <del>def test_fromstring_best_effort(): <del> assert_equal(np.fromstring("1,234", dtype=np.longdouble, sep=" "), <del> np.array([1.])) <del> <del> <ide> def test_fromstring_bogus(): <ide> assert_equal(np.fromstring("1. 2. 3. flop 4.", dtype=float, sep=" "), <ide> np.array([1., 2., 3.])) <ide> def test_tofile_roundtrip(self): <ide> assert_equal(res, self.tgt) <ide> <ide> <del>@in_foreign_locale <del>def test_fromstring_foreign(): <del> s = "1.234" <del> a = np.fromstring(s, dtype=np.longdouble, sep=" ") <del> assert_equal(a[0], np.longdouble(s)) <del> <del> <del>@in_foreign_locale <del>def test_fromstring_foreign_sep(): <del> a = np.array([1, 2, 3, 4]) <del> b = np.fromstring("1,2,3,4,", dtype=np.longdouble, sep=",") <del> assert_array_equal(a, b) <del> <del> <del>@in_foreign_locale <del>def test_fromstring_foreign_value(): <del> b = np.fromstring("1,234", dtype=np.longdouble, sep=" ") <del> assert_array_equal(b[0], 1) <del> <del> <ide> # Conversions long double -> string <ide> <ide> <ide> def test_array_repr(): <ide> raise ValueError("precision loss creating arrays") <ide> assert_(repr(a) != repr(b)) <ide> <add># <add># Locale tests: scalar types formatting should be independent of the locale <add># <add> <add>class TestCommaDecimalPointLocale(CommaDecimalPointLocale): <add> <add> def test_repr_roundtrip_foreign(self): <add> o = 1.5 <add> assert_equal(o, np.longdouble(repr(o))) <add> <add> def test_fromstring_foreign_repr(self): <add> f = 1.234 <add> a = np.fromstring(repr(f), dtype=float, sep=" ") <add> assert_equal(a[0], f) <add> <add> def test_fromstring_best_effort_float(self): <add> assert_equal(np.fromstring("1,234", dtype=float, sep=" "), <add> np.array([1.])) <add> <add> def test_fromstring_best_effort(self): <add> assert_equal(np.fromstring("1,234", dtype=np.longdouble, sep=" "), <add> np.array([1.])) <add> <add> def test_fromstring_foreign(self): <add> s = "1.234" <add> a = np.fromstring(s, dtype=np.longdouble, sep=" ") <add> assert_equal(a[0], np.longdouble(s)) <add> <add> def test_fromstring_foreign_sep(self): <add> a = np.array([1, 2, 3, 4]) <add> b = np.fromstring("1,2,3,4,", dtype=np.longdouble, sep=",") <add> assert_array_equal(a, b) <add> <add> def test_fromstring_foreign_value(self): <add> b = np.fromstring("1,234", dtype=np.longdouble, sep=" ") <add> assert_array_equal(b[0], 1) <add> <ide> <ide> if __name__ == "__main__": <ide> run_module_suite() <ide><path>numpy/core/tests/test_multiarray.py <ide> <ide> import numpy as np <ide> from numpy.compat import strchar, unicode <del>from numpy.core.tests.test_print import in_foreign_locale <ide> from numpy.core.multiarray_tests import ( <ide> test_neighborhood_iterator, test_neighborhood_iterator_oob, <ide> test_pydatamem_seteventhook_start, test_pydatamem_seteventhook_end, <ide> assert_array_almost_equal, assert_allclose, IS_PYPY, HAS_REFCOUNT, <ide> assert_array_less, runstring, dec, SkipTest, temppath, suppress_warnings <ide> ) <add>from ._locales import CommaDecimalPointLocale <ide> <ide> # Need to test an object that does not fully implement math interface <ide> from datetime import timedelta, datetime <ide> def test_tofile_format(self): <ide> assert_equal(s, '1.51,2.00,3.51,4.00') <ide> <ide> def test_locale(self): <del> in_foreign_locale(self.test_numbers)() <del> in_foreign_locale(self.test_nan)() <del> in_foreign_locale(self.test_inf)() <del> in_foreign_locale(self.test_counted_string)() <del> in_foreign_locale(self.test_ascii)() <del> in_foreign_locale(self.test_malformed)() <del> in_foreign_locale(self.test_tofile_sep)() <del> in_foreign_locale(self.test_tofile_format)() <add> with CommaDecimalPointLocale(): <add> self.test_numbers() <add> self.test_nan() <add> self.test_inf() <add> self.test_counted_string() <add> self.test_ascii() <add> self.test_malformed() <add> self.test_tofile_sep() <add> self.test_tofile_format() <ide> <ide> <ide> class TestFromBuffer(object): <ide><path>numpy/core/tests/test_print.py <ide> <ide> import sys <ide> import locale <add>import contextlib <ide> import nose <ide> <ide> import numpy as np <ide> from numpy.testing import ( <del> run_module_suite, assert_, assert_equal, SkipTest <add> run_module_suite, assert_, assert_equal, SkipTest, dec <ide> ) <add>from ._locales import CommaDecimalPointLocale <ide> <ide> <ide> if sys.version_info[0] >= 3: <ide> def test_scalar_format(): <ide> (fmat, repr(val), repr(valtype), str(e))) <ide> <ide> <add># <ide> # Locale tests: scalar types formatting should be independent of the locale <del>def in_foreign_locale(func): <del> """ <del> Swap LC_NUMERIC locale to one in which the decimal point is ',' and not '.' <del> If not possible, raise SkipTest <add># <ide> <del> """ <del> if sys.platform == 'win32': <del> locales = ['FRENCH'] <del> else: <del> locales = ['fr_FR', 'fr_FR.UTF-8', 'fi_FI', 'fi_FI.UTF-8'] <add>class TestCommaDecimalPointLocale(CommaDecimalPointLocale): <add> <add> def test_locale_single(self): <add> assert_equal(str(np.float32(1.2)), str(float(1.2))) <add> <add> def test_locale_double(self): <add> assert_equal(str(np.double(1.2)), str(float(1.2))) <add> <add> def test_locale_longdouble(self): <add> assert_equal(str(np.longdouble('1.2')), str(float(1.2))) <ide> <del> def wrapper(*args, **kwargs): <del> curloc = locale.getlocale(locale.LC_NUMERIC) <del> try: <del> for loc in locales: <del> try: <del> locale.setlocale(locale.LC_NUMERIC, loc) <del> break <del> except locale.Error: <del> pass <del> else: <del> raise SkipTest("Skipping locale test, because " <del> "French locale not found") <del> return func(*args, **kwargs) <del> finally: <del> locale.setlocale(locale.LC_NUMERIC, locale=curloc) <del> return nose.tools.make_decorator(func)(wrapper) <del> <del>@in_foreign_locale <del>def test_locale_single(): <del> assert_equal(str(np.float32(1.2)), str(float(1.2))) <del> <del>@in_foreign_locale <del>def test_locale_double(): <del> assert_equal(str(np.double(1.2)), str(float(1.2))) <del> <del>@in_foreign_locale <del>def test_locale_longdouble(): <del> assert_equal(str(np.longdouble('1.2')), str(float(1.2))) <ide> <ide> if __name__ == "__main__": <ide> run_module_suite()
4
Text
Text
remove broken links from hello world example
fcefcb7e7e836b0ecfee8ab28e2dcd250cafedf4
<ide><path>examples/helloworld/README.md <ide> ## "Hello World" overview <ide> <del>This example is a minimalistic application of the pdf.js project. The file <del>`helloworld.pdf` is from the GNUpdf project (see [Introduction to PDF at <del>GNUpdf] (http://gnupdf.org/Introduction_to_PDF)), and contains a simple and <add>This example is a minimalistic application of the PDF.js project. The file <add>`helloworld.pdf` originates from the GNUpdf project and contains a simple and <ide> human-readable PDF. <ide> <del> <ide> ## Getting started <ide> <ide> Point your browser to `index.html`. Voila. Take a peek at `hello.js` to see <ide> how to make basic calls to `pdf.js`. <del> <del> <del>## Additional resources <del> <del>+ [GNUpdf - Introduction to PDF](http://gnupdf.org/Introduction_to_PDF)
1
Go
Go
remove job from wait
db0ffba3b92aeda667501aaa10926943a7738f82
<ide><path>api/server/server.go <ide> func postContainersWait(eng *engine.Engine, version version.Version, w http.Resp <ide> if vars == nil { <ide> return fmt.Errorf("Missing parameter") <ide> } <del> var ( <del> stdoutBuffer = bytes.NewBuffer(nil) <del> job = eng.Job("wait", vars["name"]) <del> ) <del> job.Stdout.Add(stdoutBuffer) <del> if err := job.Run(); err != nil { <del> return err <del> } <del> statusCode, err := strconv.Atoi(engine.Tail(stdoutBuffer, 1)) <add> <add> name := vars["name"] <add> d := getDaemon(eng) <add> cont, err := d.Get(name) <ide> if err != nil { <ide> return err <ide> } <add> <add> status, _ := cont.WaitStop(-1 * time.Second) <add> <ide> return writeJSON(w, http.StatusOK, &types.ContainerWaitResponse{ <del> StatusCode: statusCode, <add> StatusCode: status, <ide> }) <ide> } <ide> <ide><path>daemon/daemon.go <ide> func (daemon *Daemon) Install(eng *engine.Engine) error { <ide> "restart": daemon.ContainerRestart, <ide> "start": daemon.ContainerStart, <ide> "stop": daemon.ContainerStop, <del> "wait": daemon.ContainerWait, <ide> "execCreate": daemon.ContainerExecCreate, <ide> "execStart": daemon.ContainerExecStart, <ide> "execInspect": daemon.ContainerExecInspect, <ide><path>daemon/wait.go <del>package daemon <del> <del>import ( <del> "fmt" <del> "time" <del> <del> "github.com/docker/docker/engine" <del>) <del> <del>func (daemon *Daemon) ContainerWait(job *engine.Job) error { <del> if len(job.Args) != 1 { <del> return fmt.Errorf("Usage: %s", job.Name) <del> } <del> name := job.Args[0] <del> container, err := daemon.Get(name) <del> if err != nil { <del> return fmt.Errorf("%s: %v", job.Name, err) <del> } <del> status, _ := container.WaitStop(-1 * time.Second) <del> job.Printf("%d\n", status) <del> return nil <del>} <ide><path>integration-cli/docker_cli_daemon_test.go <ide> func TestDaemonwithwrongkey(t *testing.T) { <ide> os.Remove("/etc/docker/key.json") <ide> logDone("daemon - it should be failed to start daemon with wrong key") <ide> } <add> <add>func TestDaemonRestartKillWait(t *testing.T) { <add> d := NewDaemon(t) <add> if err := d.StartWithBusybox(); err != nil { <add> t.Fatalf("Could not start daemon with busybox: %v", err) <add> } <add> defer d.Stop() <add> <add> out, err := d.Cmd("run", "-d", "busybox", "/bin/cat") <add> if err != nil { <add> t.Fatalf("Could not run /bin/cat: err=%v\n%s", err, out) <add> } <add> containerID := strings.TrimSpace(out) <add> <add> if out, err := d.Cmd("kill", containerID); err != nil { <add> t.Fatalf("Could not kill %s: err=%v\n%s", containerID, err, out) <add> } <add> <add> if err := d.Restart(); err != nil { <add> t.Fatalf("Could not restart daemon: %v", err) <add> } <add> <add> errchan := make(chan error) <add> go func() { <add> if out, err := d.Cmd("wait", containerID); err != nil { <add> errchan <- fmt.Errorf("%v:\n%s", err, out) <add> } <add> close(errchan) <add> }() <add> <add> select { <add> case <-time.After(5 * time.Second): <add> t.Fatal("Waiting on a stopped (killed) container timed out") <add> case err := <-errchan: <add> if err != nil { <add> t.Fatal(err) <add> } <add> } <add> <add> logDone("wait - wait on a stopped container doesn't timeout") <add>} <ide><path>integration/server_test.go <ide> package docker <ide> import ( <ide> "bytes" <ide> "testing" <del> "time" <ide> <ide> "github.com/docker/docker/builder" <del> "github.com/docker/docker/daemon" <ide> "github.com/docker/docker/engine" <ide> ) <ide> <ide> func TestMergeConfigOnCommit(t *testing.T) { <ide> } <ide> } <ide> <del>func TestRestartKillWait(t *testing.T) { <del> eng := NewTestEngine(t) <del> runtime := mkDaemonFromEngine(eng, t) <del> defer runtime.Nuke() <del> <del> config, hostConfig, _, err := parseRun([]string{"-i", unitTestImageID, "/bin/cat"}) <del> if err != nil { <del> t.Fatal(err) <del> } <del> <del> id := createTestContainer(eng, config, t) <del> <del> containers, err := runtime.Containers(&daemon.ContainersConfig{All: true}) <del> <del> if err != nil { <del> t.Errorf("Error getting containers1: %q", err) <del> } <del> <del> if len(containers) != 1 { <del> t.Errorf("Expected 1 container, %v found", len(containers)) <del> } <del> <del> job := eng.Job("start", id) <del> if err := job.ImportEnv(hostConfig); err != nil { <del> t.Fatal(err) <del> } <del> if err := job.Run(); err != nil { <del> t.Fatal(err) <del> } <del> <del> if err := runtime.ContainerKill(id, 0); err != nil { <del> t.Fatal(err) <del> } <del> <del> eng = newTestEngine(t, false, runtime.Config().Root) <del> runtime = mkDaemonFromEngine(eng, t) <del> <del> containers, err = runtime.Containers(&daemon.ContainersConfig{All: true}) <del> <del> if err != nil { <del> t.Errorf("Error getting containers1: %q", err) <del> } <del> if len(containers) != 1 { <del> t.Errorf("Expected 1 container, %v found", len(containers)) <del> } <del> <del> setTimeout(t, "Waiting on stopped container timedout", 5*time.Second, func() { <del> job = eng.Job("wait", containers[0].ID) <del> if err := job.Run(); err != nil { <del> t.Fatal(err) <del> } <del> }) <del>} <del> <ide> func TestRunWithTooLowMemoryLimit(t *testing.T) { <ide> eng := NewTestEngine(t) <ide> defer mkDaemonFromEngine(eng, t).Nuke()
5
PHP
PHP
remove old lighthouseapp references
315a0ce60c3545c565f253e0506bc60ae7f19c91
<ide><path>src/Network/Request.php <ide> protected static function _url($config) <ide> * the unnecessary part from $base to prevent issue #3318. <ide> * <ide> * @return array Base URL, webroot dir ending in / <del> * @link https://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/3318 <ide> */ <ide> protected static function _base() <ide> { <ide><path>tests/TestCase/Controller/Component/AuthComponentTest.php <ide> public function testRedirectSessionReadEqualToLoginAction() <ide> /** <ide> * test that the returned URL doesn't contain the base URL. <ide> * <del> * @see https://cakephp.lighthouseapp.com/projects/42648/tickets/3922-authcomponentredirecturl-prepends-appbaseurl <del> * <ide> * @return void This test method doesn't return anything. <ide> */ <ide> public function testRedirectUrlWithBaseSet() <ide><path>tests/TestCase/Controller/Component/RequestHandlerComponentTest.php <ide> public function testAjaxRedirectAsRequestActionStillRenderingLayout() <ide> * array URLs into their correct string ones, and adds base => false so <ide> * the correct URLs are generated. <ide> * <del> * @link https://cakephp.lighthouseapp.com/projects/42648-cakephp-1x/tickets/276 <ide> * @return void <ide> * @triggers Controller.beforeRender $this->Controller <ide> */ <ide><path>tests/TestCase/Controller/Component/SecurityComponentTest.php <ide> public function testValidatePostUrlAsHashInput() <ide> * test that blackhole doesn't delete the _Token session key so repeat data submissions <ide> * stay blackholed. <ide> * <del> * @link https://cakephp.lighthouseapp.com/projects/42648/tickets/214 <ide> * @return void <ide> * @triggers Controller.startup $this->Controller <ide> */ <ide><path>tests/TestCase/Network/RequestTest.php <ide> public function testBaseUrlwithModRewriteAlias() <ide> * - index.php/apples/ <ide> * - index.php/bananas/eat/tasty_banana <ide> * <del> * @link https://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/3318 <ide> * @return void <ide> */ <ide> public function testBaseUrlWithModRewriteAndIndexPhp() <ide><path>tests/TestCase/View/ViewTest.php <ide> public function testBlockExist() <ide> * Test setting a block's content to null <ide> * <ide> * @return void <del> * @link https://cakephp.lighthouseapp.com/projects/42648/tickets/3938-this-redirectthis-auth-redirecturl-broken <ide> */ <ide> public function testBlockSetNull() <ide> {
6
Ruby
Ruby
add tests for livecheck_formula utils
183d76d59ed3938cea105fde7351c85e4994617f
<ide><path>Library/Homebrew/test/utils/livecheck_formula_spec.rb <add># frozen_string_literal: true <add> <add>require "utils/livecheck_formula" <add> <add>describe LivecheckFormula do <add> describe "init", :integration_test do <add> it "runs livecheck command for Formula" do <add> install_test_formula "testball" <add> <add> formatted_response = described_class.init("testball") <add> <add> expect(formatted_response).not_to be_nil <add> expect(formatted_response).to be_a(Hash) <add> expect(formatted_response.size).not_to eq(0) <add> <add> # expect(formatted_response[:name]).to eq("testball") <add> # expect(formatted_response[:formula_version]).not_to be_nil <add> # expect(formatted_response[:livecheck_version]).not_to be_nil <add> end <add> end <add> <add> describe "parse_livecheck_response" do <add> it "returns a hash of Formula version data" do <add> example_raw_command_response = "aacgain : 7834 ==> 1.8" <add> formatted_response = described_class.parse_livecheck_response(example_raw_command_response) <add> <add> expect(formatted_response).not_to be_nil <add> expect(formatted_response).to be_a(Hash) <add> <add> expect(formatted_response).to include(:name) <add> expect(formatted_response).to include(:formula_version) <add> expect(formatted_response).to include(:livecheck_version) <add> <add> expect(formatted_response[:name]).to eq("aacgain") <add> expect(formatted_response[:formula_version]).to eq("7834") <add> expect(formatted_response[:livecheck_version]).to eq("1.8") <add> end <add> end <add>end
1
Python
Python
remove debug messages
7c194a1f31918ec63480aa553447e38d4fdce2f3
<ide><path>numpy/distutils/ccompiler.py <ide> def new_compiler (plat=None, <ide> def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries): <ide> library_dirs = quote_args(library_dirs) <ide> runtime_library_dirs = quote_args(runtime_library_dirs) <del> print 'gen_lib_options:',library_dirs, runtime_library_dirs <ide> r = _distutils_gen_lib_options(compiler, library_dirs, <ide> runtime_library_dirs, libraries) <ide> lib_opts = [] <ide><path>numpy/distutils/misc_util.py <ide> <ide> def quote_args(args): <ide> # don't used _nt_quote_args as it does not check if <del> # args items already have quotes. <add> # args items already have quotes or not. <ide> args = list(args) <ide> for i in range(len(args)): <ide> a = args[i] <del> if is_sequence(a): <del> args[i] = quote_args(a) <del> elif ' ' in a and a[0] not in '"\'': <add> if ' ' in a and a[0] not in '"\'': <ide> args[i] = '"%s"' % (a) <ide> return args <ide>
2
Python
Python
add support for impersonation in gcp hooks
5eacc164201a121cd06126aff613cbe0919d35cc
<ide><path>airflow/providers/google/cloud/hooks/automl.py <ide> class CloudAutoMLHook(GoogleBaseHook): <ide> """ <ide> <ide> def __init__( <del> self, gcp_conn_id: str = "google_cloud_default", delegate_to: Optional[str] = None <del> ): <del> super().__init__(gcp_conn_id, delegate_to) <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None # type: Optional[AutoMlClient] <ide> <ide> @staticmethod <ide><path>airflow/providers/google/cloud/hooks/bigquery.py <ide> class BigQueryHook(GoogleBaseHook, DbApiHook): <ide> def __init__(self, <ide> gcp_conn_id: str = 'google_cloud_default', <ide> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> use_legacy_sql: bool = True, <ide> location: Optional[str] = None, <ide> bigquery_conn_id: Optional[str] = None, <ide> def __init__(self, <ide> "the gcp_conn_id parameter.", DeprecationWarning, stacklevel=2) <ide> gcp_conn_id = bigquery_conn_id <ide> super().__init__( <del> gcp_conn_id=gcp_conn_id, delegate_to=delegate_to) <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.use_legacy_sql = use_legacy_sql <ide> self.location = location <ide> self.running_job_id = None # type: Optional[str] <ide><path>airflow/providers/google/cloud/hooks/bigquery_dts.py <ide> class BiqQueryDataTransferServiceHook(GoogleBaseHook): <ide> _conn = None # type: Optional[Resource] <ide> <ide> def __init__( <del> self, gcp_conn_id: str = "google_cloud_default", delegate_to: Optional[str] = None <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id=gcp_conn_id, delegate_to=delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> <ide> @staticmethod <ide> def _disable_auto_scheduling(config: Union[dict, TransferConfig]) -> TransferConfig: <ide><path>airflow/providers/google/cloud/hooks/bigtable.py <ide> """ <ide> This module contains a Google Cloud Bigtable Hook. <ide> """ <del>from typing import Dict, List, Optional <add>from typing import Dict, List, Optional, Sequence, Union <ide> <ide> from google.cloud.bigtable import Client <ide> from google.cloud.bigtable.cluster import Cluster <ide> class BigtableHook(GoogleBaseHook): <ide> """ <ide> <ide> # pylint: disable=too-many-arguments <del> def __init__(self, gcp_conn_id: str = 'google_cloud_default', delegate_to: Optional[str] = None) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None <ide> <ide> def _get_client(self, project_id: str): <ide><path>airflow/providers/google/cloud/hooks/cloud_build.py <ide> """Hook for Google Cloud Build service""" <ide> <ide> import time <del>from typing import Any, Dict, Optional <add>from typing import Any, Dict, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import build <ide> <ide> class CloudBuildHook(GoogleBaseHook): <ide> :type api_version: str <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <ide> _conn = None # type: Optional[Any] <ide> def __init__( <ide> self, <ide> api_version: str = "v1", <ide> gcp_conn_id: str = "google_cloud_default", <del> delegate_to: Optional[str] = None <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <add> <ide> self.api_version = api_version <ide> <ide> def get_conn(self): <ide><path>airflow/providers/google/cloud/hooks/cloud_memorystore.py <ide> class CloudMemorystoreHook(GoogleBaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = "google_cloud_default", delegate_to: Optional[str] = None): <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None # type: Optional[CloudRedisClient] <ide> <ide> def get_conn(self,): <ide><path>airflow/providers/google/cloud/hooks/cloud_sql.py <ide> import time <ide> import uuid <ide> from subprocess import PIPE, Popen <del>from typing import Any, Dict, List, Optional, Union <add>from typing import Any, Dict, List, Optional, Sequence, Union <ide> from urllib.parse import quote_plus <ide> <ide> import requests <ide> class CloudSQLHook(GoogleBaseHook): <ide> def __init__( <ide> self, <ide> api_version: str, <del> gcp_conn_id: str = 'google_cloud_default', <del> delegate_to: Optional[str] = None <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> self._conn = None <ide> <ide><path>airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py <ide> import warnings <ide> from copy import deepcopy <ide> from datetime import timedelta <del>from typing import Dict, List, Optional, Set, Union <add>from typing import Dict, List, Optional, Sequence, Set, Union <ide> <ide> from googleapiclient.discovery import build <ide> from googleapiclient.errors import HttpError <ide> class CloudDataTransferServiceHook(GoogleBaseHook): <ide> def __init__( <ide> self, <ide> api_version: str = 'v1', <del> gcp_conn_id: str = 'google_cloud_default', <del> delegate_to: Optional[str] = None <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> self._conn = None <ide> <ide><path>airflow/providers/google/cloud/hooks/compute.py <ide> """ <ide> <ide> import time <del>from typing import Any, Dict, Optional <add>from typing import Any, Dict, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import build <ide> <ide> def __init__( <ide> self, <ide> api_version: str = 'v1', <ide> gcp_conn_id: str = 'google_cloud_default', <del> delegate_to: Optional[str] = None <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> <ide> def get_conn(self): <ide><path>airflow/providers/google/cloud/hooks/datacatalog.py <ide> class CloudDataCatalogHook(GoogleBaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = "google_cloud_default", delegate_to: Optional[str] = None) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client: Optional[DataCatalogClient] = None <ide> <ide> def get_conn(self) -> DataCatalogClient: <ide><path>airflow/providers/google/cloud/hooks/dataflow.py <ide> import warnings <ide> from copy import deepcopy <ide> from tempfile import TemporaryDirectory <del>from typing import Any, Callable, Dict, List, Optional, TypeVar, cast <add>from typing import Any, Callable, Dict, List, Optional, Sequence, TypeVar, Union, cast <ide> <ide> from googleapiclient.discovery import build <ide> <ide> class DataflowHook(GoogleBaseHook): <ide> <ide> def __init__( <ide> self, <del> gcp_conn_id: str = 'google_cloud_default', <add> gcp_conn_id: str = "google_cloud_default", <ide> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> poll_sleep: int = 10 <ide> ) -> None: <ide> self.poll_sleep = poll_sleep <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> <ide> def get_conn(self): <ide> """ <ide><path>airflow/providers/google/cloud/hooks/datafusion.py <ide> import json <ide> import os <ide> from time import monotonic, sleep <del>from typing import Any, Dict, List, Optional, Union <add>from typing import Any, Dict, List, Optional, Sequence, Union <ide> from urllib.parse import quote, urlencode <ide> <ide> import google.auth <ide> def __init__( <ide> api_version: str = "v1beta1", <ide> gcp_conn_id: str = "google_cloud_default", <ide> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> <ide> def wait_for_operation(self, operation: Dict[str, Any]) -> Dict[str, Any]: <ide><path>airflow/providers/google/cloud/hooks/datastore.py <ide> <ide> import time <ide> import warnings <del>from typing import Any, Dict, List, Optional, Union <add>from typing import Any, Dict, List, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import build <ide> <ide> class DatastoreHook(GoogleBaseHook): <ide> <ide> def __init__( <ide> self, <del> gcp_conn_id: str = 'google_cloud_default', <add> gcp_conn_id: str = "google_cloud_default", <ide> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> api_version: str = 'v1', <ide> datastore_conn_id: Optional[str] = None <ide> ) -> None: <ide> def __init__( <ide> "The datastore_conn_id parameter has been deprecated. You should pass " <ide> "the gcp_conn_id parameter.", DeprecationWarning, stacklevel=2) <ide> gcp_conn_id = datastore_conn_id <del> super().__init__(gcp_conn_id=gcp_conn_id, delegate_to=delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.connection = None <ide> self.api_version = api_version <ide> <ide><path>airflow/providers/google/cloud/hooks/dlp.py <ide> class CloudDLPHook(GoogleBaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = "google_cloud_default", delegate_to: Optional[str] = None) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None <ide> <ide> def get_conn(self) -> DlpServiceClient: <ide><path>airflow/providers/google/cloud/hooks/functions.py <ide> This module contains a Google Cloud Functions Hook. <ide> """ <ide> import time <del>from typing import Any, Dict, List, Optional <add>from typing import Any, Dict, List, Optional, Sequence, Union <ide> <ide> import requests <ide> from googleapiclient.discovery import build <ide> class CloudFunctionsHook(GoogleBaseHook): <ide> def __init__( <ide> self, <ide> api_version: str, <del> gcp_conn_id: str = 'google_cloud_default', <del> delegate_to: Optional[str] = None <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> <ide> @staticmethod <ide><path>airflow/providers/google/cloud/hooks/gcs.py <ide> from io import BytesIO <ide> from os import path <ide> from tempfile import NamedTemporaryFile <del>from typing import Callable, Optional, Set, Tuple, TypeVar, Union, cast <add>from typing import Callable, Optional, Sequence, Set, Tuple, TypeVar, Union, cast <ide> from urllib.parse import urlparse <ide> <ide> from google.api_core.exceptions import NotFound <ide> class GCSHook(GoogleBaseHook): <ide> <ide> def __init__( <ide> self, <del> gcp_conn_id: str = 'google_cloud_default', <del> delegate_to: Optional[str] = None, <del> google_cloud_storage_conn_id: Optional[str] = None <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> google_cloud_storage_conn_id: Optional[str] = None <ide> ) -> None: <ide> # To preserve backward compatibility <ide> # TODO: remove one day <ide> def __init__( <ide> "The google_cloud_storage_conn_id parameter has been deprecated. You should pass " <ide> "the gcp_conn_id parameter.", DeprecationWarning, stacklevel=2) <ide> gcp_conn_id = google_cloud_storage_conn_id <del> super().__init__(gcp_conn_id=gcp_conn_id, delegate_to=delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> <ide> def get_conn(self): <ide> """ <ide><path>airflow/providers/google/cloud/hooks/gdm.py <ide> # under the License. <ide> # <ide> <del>from typing import Any, Dict, List, Optional <add>from typing import Any, Dict, List, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import build <ide> <ide> class GoogleDeploymentManagerHook(GoogleBaseHook): # pylint: disable=abstract-m <ide> This allows for scheduled and programatic inspection and deletion fo resources managed by GDM. <ide> """ <ide> <del> def __init__(self, gcp_conn_id='google_cloud_default', delegate_to=None): <del> super(GoogleDeploymentManagerHook, self).__init__(gcp_conn_id, delegate_to=delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super(GoogleDeploymentManagerHook, self).__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> <ide> def get_conn(self): <ide> """ <ide><path>airflow/providers/google/cloud/hooks/kms.py <ide> <ide> <ide> import base64 <del>from typing import Optional, Sequence, Tuple <add>from typing import Optional, Sequence, Tuple, Union <ide> <ide> from google.api_core.retry import Retry <ide> from google.cloud.kms_v1 import KeyManagementServiceClient <ide> class CloudKMSHook(GoogleBaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <ide> def __init__( <ide> self, <ide> gcp_conn_id: str = "google_cloud_default", <del> delegate_to: Optional[str] = None <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id=gcp_conn_id, delegate_to=delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._conn = None # type: Optional[KeyManagementServiceClient] <ide> <ide> def get_conn(self) -> KeyManagementServiceClient: <ide><path>airflow/providers/google/cloud/hooks/kubernetes_engine.py <ide> <ide> import time <ide> import warnings <del>from typing import Dict, Optional, Union <add>from typing import Dict, Optional, Sequence, Union <ide> <ide> from google.api_core.exceptions import AlreadyExists, NotFound <ide> from google.api_core.gapic_v1.method import DEFAULT <ide> class GKEHook(GoogleBaseHook): <ide> <ide> def __init__( <ide> self, <del> gcp_conn_id: str = 'google_cloud_default', <add> gcp_conn_id: str = "google_cloud_default", <ide> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> location: Optional[str] = None <ide> ) -> None: <ide> super().__init__( <del> gcp_conn_id=gcp_conn_id, delegate_to=delegate_to) <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None <ide> self.location = location <ide> <ide><path>airflow/providers/google/cloud/hooks/life_sciences.py <ide> """Hook for Google Cloud Life Sciences service""" <ide> <ide> import time <del>from typing import Any, Dict, Optional <add>from typing import Any, Dict, Optional, Sequence, Union <ide> <ide> import google.api_core.path_template <ide> from googleapiclient.discovery import build <ide> class LifeSciencesHook(GoogleBaseHook): <ide> :type api_version: str <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <ide> _conn = None # type: Optional[Any] <ide> def __init__( <ide> self, <ide> api_version: str = "v2beta", <ide> gcp_conn_id: str = "google_cloud_default", <del> delegate_to: Optional[str] = None <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> <ide> def get_conn(self): <ide><path>airflow/providers/google/cloud/hooks/natural_language.py <ide> class CloudNaturalLanguageHook(GoogleBaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = "google_cloud_default", delegate_to: Optional[str] = None) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._conn = None <ide> <ide> def get_conn(self) -> LanguageServiceClient: <ide><path>airflow/providers/google/cloud/hooks/pubsub.py <ide> class PubSubHook(GoogleBaseHook): <ide> the project embedded in the Connection referenced by gcp_conn_id. <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = 'google_cloud_default', delegate_to: Optional[str] = None) -> None: <del> super().__init__(gcp_conn_id, delegate_to=delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None <ide> <ide> def get_conn(self) -> PublisherClient: <ide><path>airflow/providers/google/cloud/hooks/secret_manager.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> """Hook for Secrets Manager service""" <del>from typing import Optional <add>from typing import Optional, Sequence, Union <ide> <ide> from airflow.providers.google.cloud._internal_client.secret_manager_client import _SecretManagerClient # noqa <ide> from airflow.providers.google.common.hooks.base_google import GoogleBaseHook <ide> class SecretsManagerHook(GoogleBaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> def __init__( <ide> self, <ide> gcp_conn_id: str = "google_cloud_default", <del> delegate_to: Optional[str] = None <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.client = _SecretManagerClient(credentials=self._get_credentials()) <ide> <ide> def get_conn(self) -> _SecretManagerClient: <ide><path>airflow/providers/google/cloud/hooks/spanner.py <ide> """ <ide> This module contains a Google Cloud Spanner Hook. <ide> """ <del>from typing import Callable, List, Optional <add>from typing import Callable, List, Optional, Sequence, Union <ide> <ide> from google.api_core.exceptions import AlreadyExists, GoogleAPICallError <ide> from google.cloud.spanner_v1.client import Client <ide> class SpannerHook(GoogleBaseHook): <ide> keyword arguments rather than positional. <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = 'google_cloud_default', delegate_to: Optional[str] = None) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None <ide> <ide> def _get_client(self, project_id: str) -> Client: <ide><path>airflow/providers/google/cloud/hooks/speech_to_text.py <ide> """ <ide> This module contains a Google Cloud Speech Hook. <ide> """ <del>from typing import Dict, Optional, Union <add>from typing import Dict, Optional, Sequence, Union <ide> <ide> from google.api_core.retry import Retry <ide> from google.cloud.speech_v1 import SpeechClient <ide> class CloudSpeechToTextHook(GoogleBaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = "google_cloud_default", delegate_to: Optional[str] = None) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None <ide> <ide> def get_conn(self) -> SpeechClient: <ide><path>airflow/providers/google/cloud/hooks/stackdriver.py <ide> """ <ide> <ide> import json <del>from typing import Any, Dict, Optional <add>from typing import Any, Dict, Optional, Sequence, Union <ide> <ide> from google.api_core.exceptions import InvalidArgument <ide> from google.api_core.gapic_v1.method import DEFAULT <ide> class StackdriverHook(GoogleBaseHook): <ide> Stackdriver Hook for connecting with GCP Stackdriver <ide> """ <ide> <del> def __init__(self, gcp_conn_id='google_cloud_default', delegate_to=None): <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._policy_client = None <ide> self._channel_client = None <ide> <ide><path>airflow/providers/google/cloud/hooks/tasks.py <ide> class CloudTasksHook(GoogleBaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <del> def __init__(self, gcp_conn_id="google_cloud_default", delegate_to=None): <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None <ide> <ide> def get_conn(self): <ide><path>airflow/providers/google/cloud/hooks/text_to_speech.py <ide> """ <ide> This module contains a Google Cloud Text to Speech Hook. <ide> """ <del>from typing import Dict, Optional, Union <add>from typing import Dict, Optional, Sequence, Union <ide> <ide> from google.api_core.retry import Retry <ide> from google.cloud.texttospeech_v1 import TextToSpeechClient <ide> class CloudTextToSpeechHook(GoogleBaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = "google_cloud_default", delegate_to: Optional[str] = None) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None # type: Optional[TextToSpeechClient] <ide> <ide> def get_conn(self) -> TextToSpeechClient: <ide><path>airflow/providers/google/cloud/hooks/translate.py <ide> """ <ide> This module contains a Google Cloud Translate Hook. <ide> """ <del>from typing import Dict, List, Optional, Union <add>from typing import Dict, List, Optional, Sequence, Union <ide> <ide> from google.cloud.translate_v2 import Client <ide> <ide> class CloudTranslateHook(GoogleBaseHook): <ide> keyword arguments rather than positional. <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = 'google_cloud_default') -> None: <del> super().__init__(gcp_conn_id) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None # type: Optional[Client] <ide> <ide> def get_conn(self) -> Client: <ide><path>airflow/providers/google/cloud/hooks/video_intelligence.py <ide> class CloudVideoIntelligenceHook(GoogleBaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = "google_cloud_default", delegate_to: Optional[str] = None) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._conn = None <ide> <ide> def get_conn(self) -> VideoIntelligenceServiceClient: <ide><path>airflow/providers/google/cloud/hooks/vision.py <ide> class CloudVisionHook(GoogleBaseHook): <ide> 'ProductSet', 'productset_id', ProductSearchClient.product_set_path <ide> ) <ide> <del> def __init__(self, gcp_conn_id: str = 'google_cloud_default', delegate_to: Optional[str] = None) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> def __init__( <add> self, <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self._client = None <ide> <ide> def get_conn(self) -> ProductSearchClient: <ide><path>airflow/providers/google/cloud/utils/credentials_provider.py <ide> import logging <ide> import tempfile <ide> from contextlib import ExitStack, contextmanager <del>from typing import Collection, Dict, Optional, Sequence, Tuple <add>from typing import Collection, Dict, Optional, Sequence, Tuple, Union <ide> from urllib.parse import urlencode <ide> <ide> import google.auth <ide> import google.auth.credentials <ide> import google.oauth2.service_account <add>from google.auth import impersonated_credentials <ide> from google.auth.environment_vars import CREDENTIALS, LEGACY_PROJECT, PROJECT <ide> <ide> from airflow.exceptions import AirflowException <ide> class _CredentialProvider(LoggingMixin): <ide> :type keyfile_dict: Dict[str, str] <ide> :param scopes: OAuth scopes for the connection <ide> :type scopes: Collection[str] <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <ide> :param disable_logging: If true, disable all log messages, which allows you to use this <ide> class to configure Logger. <add> :param target_principal: The service account to directly impersonate using short-term <add> credentials, if any. For this to work, the target_principal account must grant <add> the originating account the Service Account Token Creator IAM role. <add> :type target_principal: str <add> :param delegates: optional chained list of accounts required to get the access_token of <add> target_principal. If set, the sequence of identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account and target_principal <add> granting the role to the last account from the list. <add> :type delegates: Sequence[str] <ide> """ <ide> def __init__( <ide> self, <ide> def __init__( <ide> # See: https://github.com/PyCQA/pylint/issues/2377 <ide> scopes: Optional[Collection[str]] = None, # pylint: disable=unsubscriptable-object <ide> delegate_to: Optional[str] = None, <del> disable_logging: bool = False <add> disable_logging: bool = False, <add> target_principal: Optional[str] = None, <add> delegates: Optional[Sequence[str]] = None, <ide> ): <ide> super().__init__() <ide> if key_path and keyfile_dict: <ide> def __init__( <ide> self.scopes = scopes <ide> self.delegate_to = delegate_to <ide> self.disable_logging = disable_logging <add> self.target_principal = target_principal <add> self.delegates = delegates <ide> <ide> def get_credentials_and_project(self): <ide> """ <ide> def get_credentials_and_project(self): <ide> "Please use service-account for authorization." <ide> ) <ide> <add> if self.target_principal: <add> credentials = impersonated_credentials.Credentials( <add> source_credentials=credentials, <add> target_principal=self.target_principal, <add> delegates=self.delegates, <add> target_scopes=self.scopes <add> ) <add> <ide> return credentials, project_id <ide> <ide> def _get_credentials_using_keyfile_dict(self): <ide> def _get_scopes(scopes: Optional[str] = None) -> Sequence[str]: <ide> """ <ide> return [s.strip() for s in scopes.split(',')] \ <ide> if scopes else _DEFAULT_SCOPES <add> <add> <add>def _get_target_principal_and_delegates( <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None <add>) -> Tuple[Optional[str], Optional[Sequence[str]]]: <add> """ <add> Analyze contents of impersonation_chain and return target_principal (the service account <add> to directly impersonate using short-term credentials, if any) and optional list of delegates <add> required to get the access_token of target_principal. <add> <add> :param impersonation_chain: the service account to impersonate or a chained list leading to this <add> account <add> :type impersonation_chain: Optional[Union[str, Sequence[str]]] <add> <add> :return: Returns the tuple of target_principal and delegates <add> :rtype: Tuple[Optional[str], Optional[Sequence[str]]] <add> """ <add> if not impersonation_chain: <add> return None, None <add> <add> if isinstance(impersonation_chain, str): <add> return impersonation_chain, None <add> <add> return impersonation_chain[-1], impersonation_chain[:-1] <ide><path>airflow/providers/google/common/hooks/base_google.py <ide> import tempfile <ide> from contextlib import contextmanager <ide> from subprocess import check_output <del>from typing import Any, Callable, Dict, Optional, Sequence, Tuple, TypeVar, cast <add>from typing import Any, Callable, Dict, Optional, Sequence, Tuple, TypeVar, Union, cast <ide> <ide> import google.auth <ide> import google.auth.credentials <ide> from airflow.exceptions import AirflowException <ide> from airflow.hooks.base_hook import BaseHook <ide> from airflow.providers.google.cloud.utils.credentials_provider import ( <del> _get_scopes, get_credentials_and_project_id, <add> _get_scopes, _get_target_principal_and_delegates, get_credentials_and_project_id, <ide> ) <ide> from airflow.utils.process_utils import patch_environ <ide> <ide> class GoogleBaseHook(BaseHook): <ide> <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <del> def __init__(self, gcp_conn_id: str = 'google_cloud_default', delegate_to: Optional[str] = None) -> None: <add> def __init__( <add> self, <add> gcp_conn_id: str = 'google_cloud_default', <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <add> ) -> None: <ide> super().__init__() <ide> self.gcp_conn_id = gcp_conn_id <ide> self.delegate_to = delegate_to <add> self.impersonation_chain = impersonation_chain <ide> self.extras = self.get_connection(self.gcp_conn_id).extra_dejson # type: Dict <ide> self._cached_credentials: Optional[google.auth.credentials.Credentials] = None <ide> self._cached_project_id: Optional[str] = None <ide> def _get_credentials_and_project_id(self) -> Tuple[google.auth.credentials.Crede <ide> except json.decoder.JSONDecodeError: <ide> raise AirflowException('Invalid key JSON.') <ide> <add> target_principal, delegates = _get_target_principal_and_delegates(self.impersonation_chain) <add> <ide> credentials, project_id = get_credentials_and_project_id( <ide> key_path=key_path, <ide> keyfile_dict=keyfile_dict_json, <ide> scopes=self.scopes, <del> delegate_to=self.delegate_to <add> delegate_to=self.delegate_to, <add> target_principal=target_principal, <add> delegates=delegates, <ide> ) <ide> <ide> overridden_project_id = self._get_field('project') <ide><path>airflow/providers/google/common/hooks/discovery_api.py <ide> """ <ide> This module allows you to connect to the Google Discovery API Service and query it. <ide> """ <del>from typing import Dict, Optional <add>from typing import Dict, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import Resource, build <ide> <ide> class GoogleDiscoveryApiHook(GoogleBaseHook): <ide> :type api_version: str <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> _conn = None # type: Optional[Resource] <ide> <ide> def __init__( <ide> self, <ide> api_service_name: str, <ide> api_version: str, <del> gcp_conn_id='google_cloud_default', <del> delegate_to: Optional[str] = None <add> gcp_conn_id: str = "google_cloud_default", <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id=gcp_conn_id, delegate_to=delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_service_name = api_service_name <ide> self.api_version = api_version <ide> <ide><path>airflow/providers/google/firebase/hooks/firestore.py <ide> """Hook for Google Cloud Firestore service""" <ide> <ide> import time <del>from typing import Any, Dict, Optional <add>from typing import Any, Dict, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import build, build_from_document <ide> <ide> class CloudFirestoreHook(GoogleBaseHook): <ide> :type api_version: str <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <ide> _conn = None # type: Optional[Any] <ide> def __init__( <ide> api_version: str = "v1", <ide> gcp_conn_id: str = "google_cloud_default", <ide> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> <ide> def get_conn(self): <ide><path>airflow/providers/google/marketing_platform/hooks/campaign_manager.py <ide> """ <ide> This module contains Google Campaign Manager hook. <ide> """ <del>from typing import Any, Dict, List, Optional <add>from typing import Any, Dict, List, Optional, Sequence, Union <ide> <ide> from googleapiclient import http <ide> from googleapiclient.discovery import Resource, build <ide> def __init__( <ide> api_version: str = "v3.3", <ide> gcp_conn_id: str = "google_cloud_default", <ide> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> <ide> def get_conn(self) -> Resource: <ide><path>airflow/providers/google/marketing_platform/hooks/display_video.py <ide> This module contains Google DisplayVideo hook. <ide> """ <ide> <del>from typing import Any, Dict, List, Optional <add>from typing import Any, Dict, List, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import Resource, build <ide> <ide> def __init__( <ide> api_version: str = "v1", <ide> gcp_conn_id: str = "google_cloud_default", <ide> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> <ide> def get_conn(self) -> Resource: <ide><path>airflow/providers/google/marketing_platform/hooks/search_ads.py <ide> """ <ide> This module contains Google Search Ads 360 hook. <ide> """ <del>from typing import Any, Dict, Optional <add>from typing import Any, Dict, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import build <ide> <ide> def __init__( <ide> api_version: str = "v2", <ide> gcp_conn_id: str = "google_cloud_default", <ide> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> <ide> def get_conn(self): <ide><path>airflow/providers/google/suite/hooks/drive.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> """Hook for Google Drive service""" <del>from typing import Any, Optional <add>from typing import Any, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import Resource, build <ide> from googleapiclient.http import MediaFileUpload <ide> class GoogleDriveHook(GoogleBaseHook): <ide> :type api_version: str <ide> :param gcp_conn_id: The connection ID to use when fetching connection info. <ide> :type gcp_conn_id: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <ide> _conn = None # type: Optional[Resource] <ide> def __init__( <ide> self, <ide> api_version: str = "v3", <ide> gcp_conn_id: str = "google_cloud_default", <del> delegate_to: Optional[str] = None <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.api_version = api_version <ide> <ide> def get_conn(self) -> Any: <ide><path>airflow/providers/google/suite/hooks/sheets.py <ide> This module contains a Google Sheets API hook <ide> """ <ide> <del>from typing import Any, Dict, List, Optional <add>from typing import Any, Dict, List, Optional, Sequence, Union <ide> <ide> from googleapiclient.discovery import build <ide> <ide> class GSheetsHook(GoogleBaseHook): <ide> :type gcp_conn_id: str <ide> :param api_version: API Version <ide> :type api_version: str <del> :param delegate_to: The account to impersonate, if any. <del> For this to work, the service account making the request must have <add> :param delegate_to: The account to impersonate using domain-wide delegation of authority, <add> if any. For this to work, the service account making the request must have <ide> domain-wide delegation enabled. <ide> :type delegate_to: str <add> :param impersonation_chain: Optional service account to impersonate using short-term <add> credentials, or chained list of accounts required to get the access_token <add> of the last account in the list, which will be impersonated in the request. <add> If set as a string, the account must grant the originating account <add> the Service Account Token Creator IAM role. <add> If set as a sequence, the identities from the list must grant <add> Service Account Token Creator IAM role to the directly preceding identity, with first <add> account from the list granting this role to the originating account. <add> :type impersonation_chain: Union[str, Sequence[str]] <ide> """ <ide> <ide> def __init__( <ide> self, <ide> gcp_conn_id: str = 'google_cloud_default', <ide> api_version: str = 'v4', <del> delegate_to: Optional[str] = None <add> delegate_to: Optional[str] = None, <add> impersonation_chain: Optional[Union[str, Sequence[str]]] = None, <ide> ) -> None: <del> super().__init__(gcp_conn_id, delegate_to) <add> super().__init__( <add> gcp_conn_id=gcp_conn_id, <add> delegate_to=delegate_to, <add> impersonation_chain=impersonation_chain, <add> ) <ide> self.gcp_conn_id = gcp_conn_id <ide> self.api_version = api_version <ide> self.delegate_to = delegate_to <ide><path>tests/providers/google/cloud/hooks/test_bigquery.py <ide> def test_bigquery_bigquery_conn_id_deprecation_warning( <ide> "You should pass the gcp_conn_id parameter." <ide> with self.assertWarns(DeprecationWarning) as warn: <ide> BigQueryHook(bigquery_conn_id=bigquery_conn_id) <del> mock_base_hook_init.assert_called_once_with(delegate_to=None, gcp_conn_id='bigquery conn id') <add> mock_base_hook_init.assert_called_once_with( <add> delegate_to=None, <add> gcp_conn_id='bigquery conn id', <add> impersonation_chain=None, <add> ) <ide> self.assertEqual(warning_message, str(warn.warning)) <ide> <ide> @mock.patch("airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_service") <ide><path>tests/providers/google/cloud/hooks/test_dataflow.py <ide> def test_fn(self, *args, **kwargs): <ide> FixutureFallback().test_fn({'project': "TEST"}, "TEST2") <ide> <ide> <del>def mock_init(self, gcp_conn_id, delegate_to=None): # pylint: disable=unused-argument <add>def mock_init( <add> self, <add> gcp_conn_id, <add> delegate_to=None, <add> impersonation_chain=None, <add>): # pylint: disable=unused-argument <ide> pass <ide> <ide> <ide><path>tests/providers/google/cloud/hooks/test_datastore.py <ide> GCP_PROJECT_ID = "test" <ide> <ide> <del>def mock_init(self, gcp_conn_id, delegate_to=None): # pylint: disable=unused-argument <add>def mock_init( <add> self, <add> gcp_conn_id, <add> delegate_to=None, <add> impersonation_chain=None, <add>): # pylint: disable=unused-argument <ide> pass <ide> <ide> <ide><path>tests/providers/google/cloud/hooks/test_gdm.py <ide> from airflow.providers.google.cloud.hooks.gdm import GoogleDeploymentManagerHook <ide> <ide> <del>def mock_init(self, gcp_conn_id, delegate_to=None): # pylint: disable=unused-argument <add>def mock_init( <add> self, <add> gcp_conn_id, <add> delegate_to=None, <add> impersonation_chain=None, <add>): # pylint: disable=unused-argument <ide> pass <ide> <ide> <ide><path>tests/providers/google/cloud/hooks/test_kms.py <ide> RESPONSE = Response(PLAINTEXT, PLAINTEXT) <ide> <ide> <del>def mock_init(self, gcp_conn_id, delegate_to=None): # pylint: disable=unused-argument <add>def mock_init( <add> self, <add> gcp_conn_id, <add> delegate_to=None, <add> impersonation_chain=None, <add>): # pylint: disable=unused-argument <ide> pass <ide> <ide> <ide><path>tests/providers/google/cloud/hooks/test_pubsub.py <ide> LABELS = {'airflow-version': 'v' + version.replace('.', '-').replace('+', '-')} <ide> <ide> <del>def mock_init(self, gcp_conn_id, delegate_to=None): # pylint: disable=unused-argument <add>def mock_init( <add> self, <add> gcp_conn_id, <add> delegate_to=None, <add> impersonation_chain=None, <add>): # pylint: disable=unused-argument <ide> pass <ide> <ide> <ide><path>tests/providers/google/cloud/utils/base_gcp_mock.py <ide> GCP_PROJECT_ID_HOOK_UNIT_TEST = 'example-project' <ide> <ide> <del>def mock_base_gcp_hook_default_project_id(self, gcp_conn_id='google_cloud_default', delegate_to=None): <add>def mock_base_gcp_hook_default_project_id( <add> self, <add> gcp_conn_id='google_cloud_default', <add> delegate_to=None, <add> impersonation_chain=None, <add>): <ide> self.extras = { <ide> 'extra__google_cloud_platform__project': GCP_PROJECT_ID_HOOK_UNIT_TEST <ide> } <ide> self._conn = gcp_conn_id <ide> self.delegate_to = delegate_to <add> self.impersonation_chain = impersonation_chain <ide> self._client = None <ide> self._conn = None <ide> self._cached_credentials = None <ide> self._cached_project_id = None <ide> <ide> <del>def mock_base_gcp_hook_no_default_project_id(self, gcp_conn_id='google_cloud_default', delegate_to=None): <add>def mock_base_gcp_hook_no_default_project_id( <add> self, <add> gcp_conn_id='google_cloud_default', <add> delegate_to=None, <add> impersonation_chain=None, <add>): <ide> self.extras = {} <ide> self._conn = gcp_conn_id <ide> self.delegate_to = delegate_to <add> self.impersonation_chain = impersonation_chain <ide> self._client = None <ide> self._conn = None <ide> self._cached_credentials = None <ide><path>tests/providers/google/cloud/utils/test_credentials_provider.py <ide> <ide> from airflow.exceptions import AirflowException <ide> from airflow.providers.google.cloud.utils.credentials_provider import ( <del> _DEFAULT_SCOPES, AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT, _get_scopes, build_gcp_conn, <del> get_credentials_and_project_id, provide_gcp_conn_and_credentials, provide_gcp_connection, <add> _DEFAULT_SCOPES, AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT, _get_scopes, _get_target_principal_and_delegates, <add> build_gcp_conn, get_credentials_and_project_id, provide_gcp_conn_and_credentials, provide_gcp_connection, <ide> provide_gcp_credentials, <ide> ) <ide> <ide> def test_get_credentials_and_project_id_with_default_auth_and_scopes(self, scope <ide> mock_auth_default.assert_called_once_with(scopes=scopes) <ide> self.assertEqual(mock_auth_default.return_value, result) <ide> <add> @mock.patch('airflow.providers.google.cloud.utils.credentials_provider.' <add> 'impersonated_credentials.Credentials') <add> @mock.patch('google.auth.default') <add> def test_get_credentials_and_project_id_with_default_auth_and_target_principal( <add> self, mock_auth_default, mock_impersonated_credentials <add> ): <add> mock_credentials = mock.MagicMock() <add> mock_auth_default.return_value = (mock_credentials, self.test_project_id) <add> <add> result = get_credentials_and_project_id(target_principal="ACCOUNT_1") <add> mock_auth_default.assert_called_once_with(scopes=None) <add> mock_impersonated_credentials.assert_called_once_with( <add> source_credentials=mock_credentials, <add> target_principal="ACCOUNT_1", <add> delegates=None, <add> target_scopes=None, <add> ) <add> self.assertEqual((mock_impersonated_credentials.return_value, self.test_project_id), result) <add> <add> @mock.patch('airflow.providers.google.cloud.utils.credentials_provider.' <add> 'impersonated_credentials.Credentials') <add> @mock.patch('google.auth.default') <add> def test_get_credentials_and_project_id_with_default_auth_and_scopes_and_target_principal( <add> self, mock_auth_default, mock_impersonated_credentials <add> ): <add> mock_credentials = mock.MagicMock() <add> mock_auth_default.return_value = (mock_credentials, self.test_project_id) <add> <add> result = get_credentials_and_project_id( <add> scopes=['scope1', 'scope2'], <add> target_principal="ACCOUNT_1", <add> ) <add> mock_auth_default.assert_called_once_with(scopes=['scope1', 'scope2']) <add> mock_impersonated_credentials.assert_called_once_with( <add> source_credentials=mock_credentials, <add> target_principal="ACCOUNT_1", <add> delegates=None, <add> target_scopes=['scope1', 'scope2'], <add> ) <add> self.assertEqual((mock_impersonated_credentials.return_value, self.test_project_id), result) <add> <add> @mock.patch('airflow.providers.google.cloud.utils.credentials_provider.' <add> 'impersonated_credentials.Credentials') <add> @mock.patch('google.auth.default') <add> def test_get_credentials_and_project_id_with_default_auth_and_target_principal_and_delegates( <add> self, mock_auth_default, mock_impersonated_credentials <add> ): <add> mock_credentials = mock.MagicMock() <add> mock_auth_default.return_value = (mock_credentials, self.test_project_id) <add> <add> result = get_credentials_and_project_id( <add> target_principal="ACCOUNT_3", <add> delegates=["ACCOUNT_1", "ACCOUNT_2"], <add> ) <add> mock_auth_default.assert_called_once_with(scopes=None) <add> mock_impersonated_credentials.assert_called_once_with( <add> source_credentials=mock_credentials, <add> target_principal="ACCOUNT_3", <add> delegates=["ACCOUNT_1", "ACCOUNT_2"], <add> target_scopes=None, <add> ) <add> self.assertEqual((mock_impersonated_credentials.return_value, self.test_project_id), result) <add> <ide> @mock.patch( <ide> 'google.oauth2.service_account.Credentials.from_service_account_file', <ide> ) <ide> def test_get_scopes_with_default(self): <ide> ]) <ide> def test_get_scopes_with_input(self, _, scopes_str, scopes): <ide> self.assertEqual(_get_scopes(scopes_str), scopes) <add> <add> <add>class TestGetTargetPrincipalAndDelegates(unittest.TestCase): <add> <add> def test_get_target_principal_and_delegates_no_argument(self): <add> self.assertEqual(_get_target_principal_and_delegates(), (None, None)) <add> <add> @parameterized.expand([ <add> ('string', "ACCOUNT_1", ("ACCOUNT_1", None)), <add> ('empty_list', [], (None, None)), <add> ('single_element_list', ["ACCOUNT_1"], ("ACCOUNT_1", [])), <add> ('multiple_elements_list', <add> ["ACCOUNT_1", "ACCOUNT_2", "ACCOUNT_3"], ("ACCOUNT_3", ["ACCOUNT_1", "ACCOUNT_2"])), <add> ]) <add> def test_get_target_principal_and_delegates_with_input( <add> self, _, impersonation_chain, target_principal_and_delegates <add> ): <add> self.assertEqual( <add> _get_target_principal_and_delegates(impersonation_chain), <add> target_principal_and_delegates <add> ) <ide><path>tests/providers/google/common/hooks/test_base_google.py <ide> from google.auth.environment_vars import CREDENTIALS <ide> from google.auth.exceptions import GoogleAuthError <ide> from google.cloud.exceptions import Forbidden <add>from parameterized import parameterized <ide> <ide> from airflow import version <ide> from airflow.exceptions import AirflowException <ide> default_creds_available = False <ide> <ide> MODULE_NAME = "airflow.providers.google.common.hooks.base_google" <add>PROJECT_ID = "PROJECT_ID" <ide> <ide> <ide> class NoForbiddenAfterCount: <ide> def test_get_credentials_and_project_id_with_default_auth(self, mock_get_creds_a <ide> key_path=None, <ide> keyfile_dict=None, <ide> scopes=self.instance.scopes, <del> delegate_to=None) <add> delegate_to=None, <add> target_principal=None, <add> delegates=None, <add> ) <ide> self.assertEqual(('CREDENTIALS', 'PROJECT_ID'), result) <ide> <ide> @mock.patch(MODULE_NAME + '.get_credentials_and_project_id') <ide> def test_get_credentials_and_project_id_with_service_account_file( <ide> key_path='KEY_PATH.json', <ide> keyfile_dict=None, <ide> scopes=self.instance.scopes, <del> delegate_to=None <add> delegate_to=None, <add> target_principal=None, <add> delegates=None, <ide> ) <ide> self.assertEqual((mock_credentials, 'PROJECT_ID'), result) <ide> <ide> def test_get_credentials_and_project_id_with_service_account_info( <ide> key_path=None, <ide> keyfile_dict=service_account, <ide> scopes=self.instance.scopes, <del> delegate_to=None <add> delegate_to=None, <add> target_principal=None, <add> delegates=None, <ide> ) <ide> self.assertEqual((mock_credentials, 'PROJECT_ID'), result) <ide> <ide> def test_get_credentials_and_project_id_with_default_auth_and_delegate( <ide> key_path=None, <ide> keyfile_dict=None, <ide> scopes=self.instance.scopes, <del> delegate_to="USER" <add> delegate_to="USER", <add> target_principal=None, <add> delegates=None, <ide> ) <ide> self.assertEqual((mock_credentials, "PROJECT_ID"), result) <ide> <ide> def test_get_credentials_and_project_id_with_default_auth_and_overridden_project <ide> key_path=None, <ide> keyfile_dict=None, <ide> scopes=self.instance.scopes, <del> delegate_to=None <add> delegate_to=None, <add> target_principal=None, <add> delegates=None, <ide> ) <ide> self.assertEqual(("CREDENTIALS", 'SECOND_PROJECT_ID'), result) <ide> <ide> def test_authorize_assert_http_timeout_is_present(self, mock_get_credentials): <ide> http_authorized = self.instance._authorize().http <ide> self.assertNotEqual(http_authorized.timeout, None) <ide> <add> @parameterized.expand([ <add> ('string', "ACCOUNT_1", "ACCOUNT_1", None), <add> ('single_element_list', ["ACCOUNT_1"], "ACCOUNT_1", []), <add> ('multiple_elements_list', <add> ["ACCOUNT_1", "ACCOUNT_2", "ACCOUNT_3"], "ACCOUNT_3", ["ACCOUNT_1", "ACCOUNT_2"]), <add> ]) <add> @mock.patch(MODULE_NAME + '.get_credentials_and_project_id') <add> def test_get_credentials_and_project_id_with_impersonation_chain( <add> self, <add> _, <add> impersonation_chain, <add> target_principal, <add> delegates, <add> mock_get_creds_and_proj_id, <add> ): <add> mock_credentials = mock.MagicMock() <add> mock_get_creds_and_proj_id.return_value = (mock_credentials, PROJECT_ID) <add> self.instance.impersonation_chain = impersonation_chain <add> result = self.instance._get_credentials_and_project_id() <add> mock_get_creds_and_proj_id.assert_called_once_with( <add> key_path=None, <add> keyfile_dict=None, <add> scopes=self.instance.scopes, <add> delegate_to=None, <add> target_principal=target_principal, <add> delegates=delegates, <add> ) <add> self.assertEqual((mock_credentials, PROJECT_ID), result) <add> <ide> <ide> class TestProvideAuthorizedGcloud(unittest.TestCase): <ide> def setUp(self):
49
PHP
PHP
apply fixes from styleci
5faa5944d9a9f2d2cae0cd7a40f7ec3ef7b58632
<ide><path>tests/Support/SupportPluralizerTest.php <ide> public function testIfEndOfWordPlural() <ide> $this->assertEquals('VertexFields', Str::plural('VertexField')); <ide> } <ide> <del> public function testPluralWithNegativeCount() { <add> public function testPluralWithNegativeCount() <add> { <ide> $this->assertEquals('test', Str::plural('test', 1)); <ide> $this->assertEquals('tests', Str::plural('test', 2)); <ide> $this->assertEquals('test', Str::plural('test', -1));
1
Text
Text
add extends for derived classes
d4a8f99067db47ea9e40c0230d2586db9c8226ba
<ide><path>doc/api/tls.md <ide> are not enabled by default since they offer less security. <ide> added: v0.3.2 <ide> --> <ide> <del>The `tls.Server` class is a subclass of `net.Server` that accepts encrypted <del>connections using TLS or SSL. <add>* Extends: {net.Server} <add> <add>Accepts encrypted connections using TLS or SSL. <ide> <ide> ### Event: 'keylog' <ide> <!-- YAML <ide> See [Session Resumption][] for more information. <ide> added: v0.11.4 <ide> --> <ide> <del>The `tls.TLSSocket` is a subclass of [`net.Socket`][] that performs transparent <del>encryption of written data and all required TLS negotiation. <add>* Extends: {net.Socket} <add> <add>Performs transparent encryption of written data and all required TLS <add>negotiation. <ide> <ide> Instances of `tls.TLSSocket` implement the duplex [Stream][] interface. <ide>
1
Text
Text
add japanese translation of readme.md
41c9ff4cb47759f5f66ba9fcada2b71ae9482a44
<ide><path>docs/japanese/README.md <add>![freeCodeCamp.org Social Banner](https://s3.amazonaws.com/freecodecamp/wide-social-banner.png) <add> <add>[![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com) <add>[![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/) <add>[![Open Source Helpers](https://www.codetriage.com/freecodecamp/freecodecamp/badges/users.svg)](https://www.codetriage.com/freecodecamp/freecodecamp) <add>[![Setup Automated](https://img.shields.io/badge/setup-automated-blue?logo=gitpod)](https://gitpod.io/from-referrer/) <add> <add>## freeCodeCamp.org のオープンソースコードベース、カリキュラムにようこそ! <add> <add>[freeCodeCamp.org](https://www.freecodecamp.org) は無料でプログラミングを学べるフレンドリーなコミュニティです。技術者になろうと忙しい何百万人もの人々を助けることを目的として、 [donor-supported 501(c)(3) nonprofit](https://donate.freecodecamp.org) により運営されています。このコミュニティはすでに10,000以上の人々に対し、初めての開発者の職につくことを助けてきました。 <add> <add>私達のフルスタックのWeb開発のカリキュラムは完全に無料で、自分のペースで進められます。あなたのスキルを広げる何千ものインタラクティブなコーディング問題を用意しています。 <add> <add>## 目次 <add> <add>* [資格](#資格) <add>* [学習プラットフォーム](#学習プラットフォーム) <add>* [バグや問題を報告する](#バグや問題を報告する) <add>* [セキュリティに関する問題を報告する](#セキュリティに関する問題を報告する) <add>* [貢献する](#貢献する) <add>* [ライセンス](#ライセンス) <add> <add> <add>### 資格 <add> <add>freeCodeCamp.org はいくつかの無料の開発に関する資格を提供しています。それぞれの資格は5つのWebアプリのプロジェクトを含んでいて、数百のコーディング問題に沿うことで、そのプロジェクトに対して準備ができるようになっています。それぞれの資格の取得には、初心者のプログラマーであれば300時間程度かかるような想定です。 <add> <add>freeCodeCamp.org のカリキュラムにある30のプロジェクトそれぞれには、アジャイルなユーザーストーリーと自動化されたテストが含まれています。それはあなたがプロジェクトを徐々に開発していくのを助けるとともに、提出前にすべてのユーザーストーリーを満足するものにすることを保証します。 <add> <add>それらのテストケースは [freeCodeCamp CDN](https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js) から取得することができます。つまり CodePen や Glitch を利用して、またはあなたのローカルの開発環境からそれらのプロジェクトをビルドすることが出来るということです。 <add> <add>1度資格を取得したら、いつでもそれを利用できます。あなたはいつでも LinkedIn やレジュメから資格に対してリンクすることができます。将来の雇用主やフリーランスのクライアントがそのリンクをクリックすれば、あなたがその資格をもつと証明されていることを見られるでしょう。 <add> <add>ただし、 [Academic Honesty ポリシー](https://www.freecodecamp.org/academic-honesty) に違反していることを私達が見つけた場合、これは例外となります。明確な盗用(引用なしに他人のコードやプロジェクトを用いて提出すること)行為をする人々を見つけた際には、厳正な学習の機関としてすべき対応、つまりその人々の資格を剥奪しBANを行います。 <add> <add>以下は私達の提供する6つの資格です。 <add> <add>#### 1. レスポンシブWebデザインに関する資格 <add> <add>- [基本的なHTMLとHTML5](https://learn.freecodecamp.org/responsive-web-design/basic-html-and-html5) <add>- [基本的なCSS](https://learn.freecodecamp.org/responsive-web-design/basic-css) <add>- [応用的なビジュアルデザイン](https://learn.freecodecamp.org/responsive-web-design/applied-visual-design) <add>- [応用的なアクセシビリティ](https://learn.freecodecamp.org/responsive-web-design/applied-accessibility) <add>- [レスポンシブWebデザインの原則](https://learn.freecodecamp.org/responsive-web-design/responsive-web-design-principles) <add>- [CSS Flexbox](https://learn.freecodecamp.org/responsive-web-design/css-flexbox) <add>- [CSS Grid](https://learn.freecodecamp.org/responsive-web-design/css-grid) <add> <br /> <add> <br /> <add> **プロジェクト**: トリビュートページ、アンケートフォーム、ランディングページ、記述的なドキュメントページ、個人のポートフォリオページ <add> <add>#### 2. JavaScriptアルゴリズムとデータ構造に関する資格 <add> <add>- [基本的なJavaScript](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript) <add>- [ES6](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6) <add>- [正規表現](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions) <add>- [デバッグ](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/debugging) <add>- [基本的なデータ構造](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures) <add>- [アルゴリズムスクリプティング](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting) <add>- [オブジェクト指向プログラミング](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming) <add>- [関数プログラミング](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming) <add>- [中級アルゴリズムスクリプティング](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting) <add> <br /> <add> <br /> <add> **プロジェクト**: 回文チェッカー、ローマ数字変換器、シーザー暗号、電話番号バリデーター、レジ <add> <add>#### 3. フロントエンドライブラリに関する資格 <add> <add>- [Bootstrap](https://learn.freecodecamp.org/front-end-libraries/bootstrap) <add>- [jQuery](https://learn.freecodecamp.org/front-end-libraries/jquery) <add>- [Sass](https://learn.freecodecamp.org/front-end-libraries/sass) <add>- [React](https://learn.freecodecamp.org/front-end-libraries/react) <add>- [Redux](https://learn.freecodecamp.org/front-end-libraries/redux) <add>- [ReactとRedux](https://learn.freecodecamp.org/front-end-libraries/react-and-redux) <add> <br /> <add> <br /> <add> **プロジェクト**: ランダム引用マシーン、マークダウンプレビュー、ドラムマシーン、JavaScript計算機、ポモドーロタイマー <add> <add>#### 4. データビジュアライゼーションに関する資格 <add> <add>- [D3でのデータビジュアライゼーション](https://learn.freecodecamp.org/data-visualization/data-visualization-with-d3) <add>- [JSON APIとAjax](https://learn.freecodecamp.org/data-visualization/json-apis-and-ajax) <add> <br /> <add> <br /> <add> **プロジェクト**: 棒グラフ、散布図、ヒートマップ、階級区分図、ツリーマップ <add> <add>#### 5. APIとマイクロサービスに関する資格 <add> <add>- [npmでのパッケージ管理](https://learn.freecodecamp.org/apis-and-microservices/managing-packages-with-npm) <add>- [基本的なNodeとExpress](https://learn.freecodecamp.org/apis-and-microservices/basic-node-and-express) <add>- [MongoDBとMongoose](https://learn.freecodecamp.org/apis-and-microservices/mongodb-and-mongoose) <add> <br /> <add> <br /> <add> **プロジェクト**: タイムスタンプマイクロサービス、リクエストヘッダーパーサー、URL短縮器、エクササイズトラッカー、ファイルメタデータマイクロサービス <add> <add>#### 6. 情報セキュリティと品質補償に関する資格 <add> <add>- [HelmetJSでの情報セキュリティ](https://learn.freecodecamp.org/information-security-and-quality-assurance/information-security-with-helmetjs) <add>- [品質保証とChaiでのテスト](https://learn.freecodecamp.org/information-security-and-quality-assurance/quality-assurance-and-testing-with-chai) <add>- [発展的なNodeとExpress](https://learn.freecodecamp.org/information-security-and-quality-assurance/advanced-node-and-express) <add> <br /> <add> <br /> <add> **プロジェクト**: メートル/ヤード変換器、イシュートラッカー、個人ライブラリ、株価チェッカー、匿名掲示板 <add> <add>#### フルスタック開発に関する資格 <add> <add>6つすべての資格を取得したら、freeCodeCamp.orgのフルスタック開発に関する資格を請求することができます。この最後の栄誉は、さまざまなWeb開発ツールを用いて1800時間の開発を完遂したことを証明するものです。 <add> <add>#### レガシーな資格 <add> <add>他にも、2015年からのカリキュラムでまだ有効な3つの資格があります。freeCodeCamp.org では、それぞれのレガシーな資格に必要なすべてのプロジェクトは引き続き有効であるでしょう。 <add> <add>- レガシーなフロントエンド開発に関する資格 <add>- レガシーなデータビジュアライゼーションに関する資格 <add>- レガシーなバックエンド開発に関する資格 <add> <add>### 学習プラットフォーム <add> <add>このコードは [freeCodeCamp.org](https://www.freecodecamp.org) で実行されています。 <add> <add>私達のコミュニティには他にも <add> <add>- [フォーラム](https://www.freecodecamp.org/forum) 通常数時間以内にプログラミングやプロジェクトに関するフィードバックが得られます。 <add>- [YouTube チャンネル](https://youtube.com/freecodecamp) Python、SQL、Android、その他いろいろな技術に関する無料のコース。 <add>- [ポッドキャスト](https://podcast.freecodecamp.org/) 開発者からの気づきや、刺激的なお話。 <add>- [ローカルの勉強会](https://study-group-directory.freecodecamp.org/) 世界中にあるコードを一緒に書ける人々の集まり。 <add>- 広汎的な [何千ものプログラミングトピックに対するガイド](https://guide.freecodecamp.org/) <add>- [開発者ニュース](https://www.freecodecamp.org/news) 無料でオープンソース、かつ広告なしであなたのブログ記事をクロスポストできる場所。 <add>- [Facebook グループ](https://www.facebook.com/groups/freeCodeCampEarth/permalink/428140994253892/) 100,000以上の世界中のメンバー。 <add> <add>> ### [こちらから私達のコミュニティに加わりましょう](https://www.freecodecamp.org/signin)。 <add> <add>### バグや問題を報告する <add> <add>もしバグをを発見したときには、 [How to Report a Bug](https://www.freecodecamp.org/forum/t/how-to-report-a-bug/19543) の記事を閲覧し、その内容に従ってください。もしそのバグが新しいものであって同様の問題を他の誰かが直面していないと革新するのであれば、そのまま GitHub のイシューを作成してください。私達がバグを再現できるよう、必ず必要十分な情報を含めるようにしてください。 <add> <add>### セキュリティに関する問題を報告する <add> <add>もし脆弱性を見つけたときには、責任を持って報告をお願いします。セキュリティの問題に関しては GitHub のイシューを作成しないでください。その代わりに、`[email protected]`へのメールをお願いします。すぐにチェックをします。 <add> <add>### 貢献する <add> <add>> ### [貢献するには、こちらのステップに従ってください。](CONTRIBUTING.md) <add> <add>### プラットフォーム、ビルドとデプロイの状況 <add> <add>ビルドやデプロイの状況に関しては [our DevOps Guide](/docs/devops.md) にて閲覧可能です。 このアプリコーションに関する一般的なプラットフォームの状態は [`status.freecodecamp.org`](https://status.freecodecamp.org) にて閲覧可能です。 <add> <add>### ライセンス <add> <add>Copyright © 2019 freeCodeCamp.org <add> <add>このリポジトリの内容は以下のライセンスにより法的に拘束されてます。 <add> <add>- コンピューターソフトウェアに関して、[BSD-3-Clause](LICENSE.md) ライセンス。 <add>- 教材のリソース([`/curriculum`](/curriculum) とそのサブディレクトリ)は [CC-BY-SA-4.0](/curriculum/LICENSE.md) ライセンスの元に許可されています。
1
PHP
PHP
fix few errors reported by phpstan level 3
2c1d26f8d76f4e10b16f89f6cd889341325ff539
<ide><path>src/Core/PluginApplicationInterface.php <ide> interface PluginApplicationInterface extends EventDispatcherInterface <ide> * <ide> * @param string|\Cake\Core\PluginInterface $name The plugin name or plugin object. <ide> * @param array $config The configuration data for the plugin if using a string for $name <del> * @return $this <add> * @return \Cake\Core\PluginApplicationInterface <ide> */ <ide> public function addPlugin($name, array $config = []): self; <ide> <ide><path>src/Core/PluginInterface.php <ide> public function routes(RouteBuilder $routes): void; <ide> * Disables the named hook <ide> * <ide> * @param string $hook The hook to disable <del> * @return $this <add> * @return \Cake\Core\PluginInterface <ide> */ <ide> public function disable(string $hook): PluginInterface; <ide> <ide> /** <ide> * Enables the named hook <ide> * <ide> * @param string $hook The hook to disable <del> * @return $this <add> * @return \Cake\Core\PluginInterface <ide> */ <ide> public function enable(string $hook): PluginInterface; <ide> <ide><path>src/Database/DriverInterface.php <ide> public function isConnected(): bool; <ide> * in queries. <ide> * <ide> * @param bool $enable Whether to enable auto quoting <del> * @return $this <add> * @return \Cake\Database\DriverInterface <ide> */ <ide> public function enableAutoQuoting(bool $enable = true): self; <ide> <ide><path>src/Database/Log/LoggedQuery.php <ide> class LoggedQuery <ide> /** <ide> * Number of milliseconds this query took to complete <ide> * <del> * @var int <add> * @var float <ide> */ <ide> public $took = 0; <ide> <ide><path>src/Database/Schema/TableSchemaInterface.php <ide> public function hasAutoincrement(): bool; <ide> * Sets whether the table is temporary in the database. <ide> * <ide> * @param bool $temporary Whether or not the table is to be temporary. <del> * @return $this <add> * @return \Cake\Database\Schema\TableSchemaInterface <ide> */ <ide> public function setTemporary(bool $temporary): self; <ide> <ide> public function primaryKey(): array; <ide> * <ide> * @param string $name The name of the index. <ide> * @param array $attrs The attributes for the index. <del> * @return $this <add> * @return \Cake\Database\Schema\TableSchemaInterface <ide> */ <ide> public function addIndex(string $name, array $attrs); <ide> <ide> public function indexes(): array; <ide> * <ide> * @param string $name The name of the constraint. <ide> * @param array $attrs The attributes for the constraint. <del> * @return $this <add> * @return \Cake\Database\Schema\TableSchemaInterface <ide> */ <ide> public function addConstraint(string $name, array $attrs); <ide> <ide> public function getConstraint(string $name): ?array; <ide> * Remove a constraint. <ide> * <ide> * @param string $name Name of the constraint to remove <del> * @return $this <add> * @return \Cake\Database\Schema\TableSchemaInterface <ide> */ <ide> public function dropConstraint(string $name); <ide> <ide><path>src/Datasource/QueryInterface.php <ide> public function all(); <ide> * ``` <ide> * <ide> * @param array $options list of query clauses to apply new parts to. <del> * @return $this <add> * @return \Cake\Datasource\QueryInterface <ide> */ <ide> public function applyOptions(array $options); <ide> <ide><path>src/Datasource/QueryTrait.php <ide> trait QueryTrait <ide> /** <ide> * A query cacher instance if this query has caching enabled. <ide> * <del> * @var \Cake\Datasource\QueryCacher <add> * @var \Cake\Datasource\QueryCacher|null <ide> */ <ide> protected $_cache; <ide> <ide><path>src/Event/EventDispatcherTrait.php <ide> trait EventDispatcherTrait <ide> * Instance of the Cake\Event\EventManager this object is using <ide> * to dispatch inner events. <ide> * <del> * @var \Cake\Event\EventManager <add> * @var \Cake\Event\EventDispatcherInterface <ide> */ <ide> protected $_eventManager; <ide> <ide><path>src/Event/EventList.php <ide> class EventList implements ArrayAccess, Countable <ide> /** <ide> * Events list <ide> * <del> * @var \Cake\Event\Event[] <add> * @var \Cake\Event\EventInterface[] <ide> */ <ide> protected $_events = []; <ide> <ide><path>src/Event/EventManagerInterface.php <ide> interface EventManagerInterface <ide> * <ide> * @param callable|null $callable The callable function you want invoked. <ide> * <del> * @return $this <add> * @return \Cake\Event\EventManagerInterface <ide> * @throws \InvalidArgumentException When event key is missing or callable is not an <ide> * instance of Cake\Event\EventListenerInterface. <ide> */ <ide> public function on($eventKey = null, $options = [], $callable = null): self; <ide> * @param string|\Cake\Event\EventListenerInterface $eventKey The event unique identifier name <ide> * with which the callback has been associated, or the $listener you want to remove. <ide> * @param callable|null $callable The callback you want to detach. <del> * @return $this <add> * @return \Cake\Event\EventManagerInterface <ide> */ <ide> public function off($eventKey, $callable = null): self; <ide> <ide><path>src/Filesystem/File.php <ide> public function mime() <ide> $finfo = new finfo(FILEINFO_MIME); <ide> $type = $finfo->file($this->pwd()); <ide> if (!$type) { <del> return null; <add> return false; <ide> } <ide> list($type) = explode(';', $type); <ide> <ide><path>src/Http/Session.php <ide> public function __construct(array $config = []) <ide> $this->engine($class, $config['handler']); <ide> } <ide> <del> $this->_lifetime = ini_get('session.gc_maxlifetime'); <add> $this->_lifetime = (int)ini_get('session.gc_maxlifetime'); <ide> $this->_isCLI = (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg'); <ide> session_register_shutdown(); <ide> } <ide><path>src/Http/Session/DatabaseSession.php <ide> public function __construct(array $config = []) <ide> $this->_table = $tableLocator->get($config['model']); <ide> } <ide> <del> $this->_timeout = ini_get('session.gc_maxlifetime'); <add> $this->_timeout = (int)ini_get('session.gc_maxlifetime'); <ide> } <ide> <ide> /** <ide><path>src/ORM/Association.php <ide> public function getTarget(): Table <ide> * <ide> * @param array|callable $conditions list of conditions to be used <ide> * @see \Cake\Database\Query::where() for examples on the format of the array <del> * @return $this <add> * @return \Cake\ORM\Association <ide> */ <ide> public function setConditions($conditions) <ide> { <ide><path>src/ORM/Behavior/TimestampBehavior.php <ide> class TimestampBehavior extends Behavior <ide> /** <ide> * Current timestamp <ide> * <del> * @var \DateTimeInterface <add> * @var \Cake\I18n\Time <ide> */ <ide> protected $_ts; <ide> <ide><path>src/Shell/ServerShell.php <ide> public function startup(): void <ide> $this->_host = $this->param('host'); <ide> } <ide> if ($this->param('port')) { <del> $this->_port = $this->param('port'); <add> $this->_port = (int)$this->param('port'); <ide> } <ide> if ($this->param('document_root')) { <ide> $this->_documentRoot = $this->param('document_root');
16
Ruby
Ruby
ignore scope in missing translation input
0fb2d1a0ba3360e928a7ac9d20378d7f5fbf915f
<ide><path>actionview/lib/action_view/helpers/translation_helper.rb <ide> def translate(key, options = {}) <ide> keys = I18n.normalize_keys(e.locale, e.key, e.options[:scope]) <ide> title = "translation missing: #{keys.join('.')}" <ide> <del> interpolations = options.except(:default) <add> interpolations = options.except(:default, :scope) <ide> if interpolations.any? <ide> title << ", " << interpolations.map { |k, v| "#{k}: #{ERB::Util.html_escape(v)}" }.join(', ') <ide> end <ide><path>actionview/test/template/translation_helper_test.rb <ide> def test_returns_missing_translation_message_with_unescaped_interpolation <ide> assert translate(:"translations.missing").html_safe? <ide> end <ide> <add> def test_returns_missing_translation_message_does_filters_out_i18n_options <add> expected = '<span class="translation_missing" title="translation missing: en.translations.missing, year: 2015">Missing</span>' <add> assert_equal expected, translate(:"translations.missing", year: '2015', default: []) <add> <add> expected = '<span class="translation_missing" title="translation missing: en.scoped.translations.missing, year: 2015">Missing</span>' <add> assert_equal expected, translate(:"translations.missing", year: '2015', scope: %i(scoped)) <add> end <add> <ide> def test_raises_missing_translation_message_with_raise_config_option <ide> ActionView::Base.raise_on_missing_translations = true <ide>
2
Ruby
Ruby
use a real lookupcontext in the digest tests
3d7892d4d586d0e128a613855e054625725594e5
<ide><path>actionview/test/template/digestor_test.rb <ide> def initialize(template_path) <ide> end <ide> end <ide> <del>class FixtureFinder <add>class FixtureFinder < ActionView::LookupContext <ide> FIXTURES_DIR = "#{File.dirname(__FILE__)}/../fixtures/digestor" <ide> <del> attr_reader :details, :view_paths <del> attr_accessor :formats <del> attr_accessor :variants <del> <del> def initialize <del> @details = {} <del> @view_paths = ActionView::PathSet.new(['digestor']) <del> @formats = [] <del> @variants = [] <del> end <del> <del> def details_key <del> details.hash <del> end <del> <del> def find(name, prefixes = [], partial = false, keys = [], options = {}) <del> partial_name = partial ? name.gsub(%r|/([^/]+)$|, '/_\1') : name <del> format = @formats.first.to_s <del> format += "+#{@variants.first}" if @variants.any? <del> <del> FixtureTemplate.new("digestor/#{partial_name}.#{format}.erb") <del> end <del> <del> def disable_cache(&block) <del> yield <add> def initialize(details = {}) <add> prefixes = [FixtureFinder::FIXTURES_DIR] <add> super(ActionView::PathSet.new(['digestor']), details, prefixes) <ide> end <ide> end <ide> <ide> def test_collection_derived_from_record_dependency <ide> <ide> def test_details_are_included_in_cache_key <ide> # Cache the template digest. <add> @finder = FixtureFinder.new({:formats => [:html]}) <ide> old_digest = digest("events/_event") <ide> <ide> # Change the template; the cached digest remains unchanged. <ide> change_template("events/_event") <ide> <ide> # The details are changed, so a new cache key is generated. <del> finder.details[:foo] = "bar" <add> @finder = FixtureFinder.new <ide> <ide> # The cache is busted. <ide> assert_not_equal old_digest, digest("events/_event") <ide> def assert_digest_difference(template_name, options = {}) <ide> def digest(template_name, options = {}) <ide> options = options.dup <ide> <del> finder.formats = [:html] <ide> finder.variants = options.delete(:variants) || [] <ide> <ide> ActionView::Digestor.digest({ name: template_name, finder: finder }.merge(options))
1
Javascript
Javascript
expand selections on shift-click
c410309827839f6292f8afb2ed429edbdc1b8d4c
<ide><path>spec/text-editor-component-spec.js <ide> describe('TextEditorComponent', () => { <ide> [[1, 0], [2, 0]] <ide> ]) <ide> }) <add> <add> it('expands the last selection on shift-click', () => { <add> const {component, element, editor} = buildComponent() <add> <add> editor.setCursorScreenPosition([2, 18]) <add> component.didMouseDownOnLines(Object.assign({ <add> detail: 1, <add> shiftKey: true <add> }, clientPositionForCharacter(component, 1, 4))) <add> expect(editor.getSelectedScreenRange()).toEqual([[1, 4], [2, 18]]) <add> <add> component.didMouseDownOnLines(Object.assign({ <add> detail: 1, <add> shiftKey: true <add> }, clientPositionForCharacter(component, 4, 4))) <add> expect(editor.getSelectedScreenRange()).toEqual([[2, 18], [4, 4]]) <add> }) <ide> }) <ide> }) <ide> <ide><path>src/text-editor-component.js <ide> class TextEditorComponent { <ide> <ide> didMouseDownOnLines (event) { <ide> const {model} = this.props <add> const {detail, ctrlKey, shiftKey, metaKey} = event <ide> const screenPosition = this.screenPositionForMouseEvent(event) <ide> <del> const addOrRemoveSelection = event.metaKey || (event.ctrlKey && this.getPlatform() !== 'darwin') <add> const addOrRemoveSelection = metaKey || (ctrlKey && this.getPlatform() !== 'darwin') <ide> <del> switch (event.detail) { <add> switch (detail) { <ide> case 1: <ide> if (addOrRemoveSelection) { <ide> const existingSelection = model.getSelectionAtScreenPosition(screenPosition) <ide> class TextEditorComponent { <ide> model.addCursorAtScreenPosition(screenPosition) <ide> } <ide> } else { <del> model.setCursorScreenPosition(screenPosition) <add> if (shiftKey) { <add> model.selectToScreenPosition(screenPosition) <add> } else { <add> model.setCursorScreenPosition(screenPosition) <add> } <ide> } <ide> break <ide> case 2:
2
Python
Python
make wording changes according to @mattip
5aa6c71774a04494458a354586ef19e6726250e3
<ide><path>numpy/lib/shape_base.py <ide> def expand_dims(a, axis): <ide> Returns <ide> ------- <ide> res : ndarray <del> Output array. The number of dimensions is one greater than that of <del> the input array. This is a view on the original array `a`. <add> View of `a` with the number of dimensions increased by one. <ide> <ide> See Also <ide> --------
1
PHP
PHP
fix builder phpdoc
c88acdf0880a551f3ee2a99900efbb458afef135
<ide><path>src/Illuminate/Database/Query/Builder.php <ide> public function orWhereNotNull($column) <ide> * <ide> * @param string $column <ide> * @param string $operator <del> * @param \DateTimeInterface|string|int $value <add> * @param \DateTimeInterface|string $value <ide> * @param string $boolean <ide> * @return \Illuminate\Database\Query\Builder|static <ide> */ <ide> public function whereDate($column, $operator, $value = null, $boolean = 'and') <ide> * <ide> * @param string $column <ide> * @param string $operator <del> * @param \DateTimeInterface|string|int $value <add> * @param \DateTimeInterface|string $value <ide> * @return \Illuminate\Database\Query\Builder|static <ide> */ <ide> public function orWhereDate($column, $operator, $value = null) <ide> public function orWhereDate($column, $operator, $value = null) <ide> * <ide> * @param string $column <ide> * @param string $operator <del> * @param \DateTimeInterface|string|int $value <add> * @param \DateTimeInterface|string $value <ide> * @param string $boolean <ide> * @return \Illuminate\Database\Query\Builder|static <ide> */ <ide> public function whereTime($column, $operator, $value = null, $boolean = 'and') <ide> * <ide> * @param string $column <ide> * @param string $operator <del> * @param \DateTimeInterface|string|int $value <add> * @param \DateTimeInterface|string $value <ide> * @return \Illuminate\Database\Query\Builder|static <ide> */ <ide> public function orWhereTime($column, $operator, $value = null) <ide> public function orWhereTime($column, $operator, $value = null) <ide> * <ide> * @param string $column <ide> * @param string $operator <del> * @param \DateTimeInterface|string|int $value <add> * @param \DateTimeInterface|string $value <ide> * @param string $boolean <ide> * @return \Illuminate\Database\Query\Builder|static <ide> */ <ide> public function whereDay($column, $operator, $value = null, $boolean = 'and') <ide> * <ide> * @param string $column <ide> * @param string $operator <del> * @param \DateTimeInterface|string|int $value <add> * @param \DateTimeInterface|string $value <ide> * @return \Illuminate\Database\Query\Builder|static <ide> */ <ide> public function orWhereDay($column, $operator, $value = null) <ide> public function orWhereDay($column, $operator, $value = null) <ide> * <ide> * @param string $column <ide> * @param string $operator <del> * @param \DateTimeInterface|string|int $value <add> * @param \DateTimeInterface|string $value <ide> * @param string $boolean <ide> * @return \Illuminate\Database\Query\Builder|static <ide> */ <ide> public function whereMonth($column, $operator, $value = null, $boolean = 'and') <ide> * <ide> * @param string $column <ide> * @param string $operator <del> * @param \DateTimeInterface|string|int $value <add> * @param \DateTimeInterface|string $value <ide> * @return \Illuminate\Database\Query\Builder|static <ide> */ <ide> public function orWhereMonth($column, $operator, $value = null)
1
Python
Python
remove unused imports
108f93c464e0652423ccbbf5f8ea75819f7794fb
<ide><path>glances/core/glances_cpu_percent.py <ide> """CPU percent stats shared between CPU and Quicklook plugins.""" <ide> <ide> from glances.core.glances_timer import Timer <del>from glances.core.glances_logging import logger <ide> <ide> import psutil <ide> <ide><path>glances/plugins/glances_monitor.py <ide> from __future__ import unicode_literals <ide> <ide> # Import Glances lib <del>from glances.core.glances_logging import logger <ide> from glances.core.glances_monitor_list import MonitorList as glancesMonitorList <ide> from glances.plugins.glances_plugin import GlancesPlugin <ide> <ide><path>glances/plugins/glances_percpu.py <ide> <ide> from glances.core.glances_cpu_percent import cpu_percent <ide> from glances.plugins.glances_plugin import GlancesPlugin <del>from glances.core.glances_logging import logger <del> <del> <del>import psutil <ide> <ide> <ide> class Plugin(GlancesPlugin): <ide><path>glances/plugins/glances_quicklook.py <ide> from glances.core.glances_cpu_percent import cpu_percent <ide> from glances.outputs.glances_bars import Bar <ide> from glances.plugins.glances_plugin import GlancesPlugin <del>from glances.core.glances_logging import logger <ide> <ide> import psutil <ide> try:
4
Text
Text
add permissions to quickstart tutorial
62193e037859498bd8c87139ed63ebfd2cf8c324
<ide><path>docs/tutorial/quickstart.md <ide> Right, we'd better write some views then. Open `tutorial/quickstart/views.py` a <ide> <ide> from django.contrib.auth.models import User, Group <ide> from rest_framework import viewsets <add> from rest_framework import permissions <ide> from tutorial.quickstart.serializers import UserSerializer, GroupSerializer <ide> <ide> <ide> Right, we'd better write some views then. Open `tutorial/quickstart/views.py` a <ide> """ <ide> queryset = User.objects.all().order_by('-date_joined') <ide> serializer_class = UserSerializer <add> permission_classes = [permissions.IsAuthenticated] <ide> <ide> <ide> class GroupViewSet(viewsets.ModelViewSet): <ide> Right, we'd better write some views then. Open `tutorial/quickstart/views.py` a <ide> """ <ide> queryset = Group.objects.all() <ide> serializer_class = GroupSerializer <add> permission_classes = [permissions.IsAuthenticated] <ide> <ide> Rather than write multiple views we're grouping together all the common behavior into classes called `ViewSets`. <ide>
1
Python
Python
add draft jieba tokenizer for chinese
5363224395b26528465417ff550d6a2163cbe8e6
<ide><path>spacy/zh/__init__.py <del>from ..language import Language <del>from ..tokenizer import Tokenizer <del>from ..tagger import Tagger <del> <add>import jieba <ide> <del>class CharacterTokenizer(Tokenizer): <del> def __call__(self, text): <del> return self.tokens_from_list(list(text)) <add>from ..language import Language <add>from ..tokens import Doc <ide> <ide> <ide> class Chinese(Language): <ide> lang = u'zh' <ide> <del> def __call__(self, text): <del> doc = self.tokenizer.tokens_from_list(list(text)) <del> self.tagger(doc) <del> self.merge_characters(doc) <del> return doc <del> <del> def merge_characters(self, doc): <del> start = 0 <del> chunks = [] <del> for token in doc: <del> if token.tag_ != 'CHAR': <del> chunk = doc[start : token.i + 1] <del> chunks.append(chunk) <del> start = token.i + 1 <del> text = doc.text <del> for chunk in chunks: <del> chunk.merge(chunk[-1].tag_, chunk.text, u'') <add> def make_doc(self, text): <add> words = list(jieba.cut(text, cut_all=True)) <add> return Doc(self.vocab, words=words, spaces=[False]*len(words))
1
Go
Go
fix typo in test title
3c2b128582bc8ea786b5486578c43d97167805fe
<ide><path>integration-cli/docker_cli_run_test.go <ide> func (s *DockerSuite) TestRunAddingOptionalDevicesNoSrc(c *check.C) { <ide> } <ide> } <ide> <del>func (s *DockerSuite) TestRunAddingOptionalDevicesInvalideMode(c *check.C) { <add>func (s *DockerSuite) TestRunAddingOptionalDevicesInvalidMode(c *check.C) { <ide> _, _, err := dockerCmdWithError("run", "--device", "/dev/zero:ro", "busybox", "sh", "-c", "ls /dev/zero") <ide> if err == nil { <ide> c.Fatalf("run container with device mode ro should fail")
1
Python
Python
resolve tests against django master
ea92d505826aa19c3681884ac5022dcdadf0c20e
<ide><path>tests/test_versioning.py <ide> def test_query_param_versioning(self): <ide> response = view(request) <ide> assert response.data == {'version': None} <ide> <add> @override_settings(ALLOWED_HOSTS=['*']) <ide> def test_host_name_versioning(self): <ide> scheme = versioning.HostNameVersioning <ide> view = RequestVersionView.as_view(versioning_class=scheme) <ide> def test_reverse_query_param_versioning(self): <ide> response = view(request) <ide> assert response.data == {'url': 'http://testserver/another/'} <ide> <add> @override_settings(ALLOWED_HOSTS=['*']) <ide> def test_reverse_host_name_versioning(self): <ide> scheme = versioning.HostNameVersioning <ide> view = ReverseView.as_view(versioning_class=scheme) <ide> def test_invalid_query_param_versioning(self): <ide> response = view(request) <ide> assert response.status_code == status.HTTP_404_NOT_FOUND <ide> <add> @override_settings(ALLOWED_HOSTS=['*']) <ide> def test_invalid_host_name_versioning(self): <ide> scheme = versioning.HostNameVersioning <ide> view = RequestInvalidVersionView.as_view(versioning_class=scheme)
1
Text
Text
update translation red-black-trees
e7eb2ea895079ae0c794a3be7610d0341224959e
<ide><path>guide/portuguese/algorithms/red-black-trees/index.md <ide> Estilo de referência: ![alt text](https://upload.wikimedia.org/wikipedia/common <ide> <ide> A maioria das operações do BST (por exemplo, busca, max, min, insert, delete ... etc) tomam o tempo O (h) onde h é a altura do BST. O custo dessas operações pode se tornar O (n) para uma árvore binária distorcida. Se nos certificarmos de que a altura da árvore permanece O (Logn) após cada inserção e exclusão, então podemos garantir um limite superior de O (Logn) para todas essas operações. A altura de uma árvore Red Black é sempre O (Logn), onde n é o número de nós na árvore. <ide> <add>### Inserindo em árvores vermelhas e pretas <add>Um nó é inicialmente inserido em uma Árvore Vermelho-Preta como qualquer árvore de busca binária. O novo nó recebe uma cor vermelha. Depois que o nó tiver sido inserido, a árvore deve ser validada para garantir que nenhuma das cinco propriedades tenha sido violada. Se uma propriedade foi violada, existem três casos possíveis que exigem uma rotação à esquerda, rotação à direita e / ou uma recoloração dos nós. Os casos são dependentes do "tio" do nó atual. Especificamente, se o nó "tio" é preto ou vermelho. Para mais informações sobre a inserção, os três casos podem ser encontrados [aqui](https://www.geeksforgeeks.org/red-black-tree-set-2-insert/). <add> <ide> ### Comparação com o AVL Tree <ide> <ide> As árvores AVL são mais equilibradas em comparação com as árvores pretas vermelhas, mas podem causar mais rotações durante a inserção e a exclusão. Portanto, se o seu aplicativo envolver muitas inserções e exclusões frequentes, as árvores Red Black devem ser preferidas. E se as inserções e exclusões forem menos frequentes e a pesquisa for uma operação mais freqüente, a árvore do AVL deverá ser preferida em relação à Red Black Tree. <ide> Especificamente, em uma árvore 2-3 vermelho-preto inclinada para a esquerda con <ide> <ide> #### Mais Informações: <ide> <del>* [Vídeo de Algoritmos e Estruturas de Dados](https://www.youtube.com/watch?v=2Ae0D6EXBV4) <ide>\ No newline at end of file <add>* [Vídeo de Algoritmos e Estruturas de Dados](https://www.youtube.com/watch?v=2Ae0D6EXBV4)
1
PHP
PHP
use a regex to find ascii control bytes
ab8daba90adb1abf4c6fe7682b25cdc554186f74
<ide><path>src/Database/Log/LoggedQuery.php <ide> protected function interpolate(): string <ide> } <ide> <ide> if (is_string($p)) { <del> // Likely binary UUID. <del> if (strlen($p) === 16 && !ctype_print($p)) { <add> // Likely binary data like a blob or binary uuid. <add> // pattern matches ascii control chars. <add> if (preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/u', '', $p) !== $p) { <ide> $p = bin2hex($p); <ide> } <ide>
1
Ruby
Ruby
remove unused default_select
99dd107760191b834d0a97e89c5ae991c088a4a8
<ide><path>activerecord/lib/active_record/base.rb <ide> def type_name_with_module(type_name) <ide> end <ide> end <ide> <del> def default_select(qualified) <del> if qualified <del> quoted_table_name + '.*' <del> else <del> '*' <del> end <del> end <del> <ide> def construct_finder_arel(options = {}, scope = nil) <ide> validate_find_options(options) <ide>
1
Text
Text
add princejwesley to collaborators
adc74b42ca94ee26c50b1c1ebfe4ea887e4e202a
<ide><path>README.md <ide> information about the governance of the Node.js project, see <ide> * [petkaantonov](https://github.com/petkaantonov) - **Petka Antonov** &lt;[email protected]&gt; <ide> * [phillipj](https://github.com/phillipj) - **Phillip Johnsen** &lt;[email protected]&gt; <ide> * [pmq20](https://github.com/pmq20) - **Minqi Pan** &lt;[email protected]&gt; <add>* [princejwesley](https://github.com/princejwesley) - **Prince John Wesley** &lt;[email protected]&gt; <ide> * [qard](https://github.com/qard) - **Stephen Belanger** &lt;[email protected]&gt; <ide> * [rlidwka](https://github.com/rlidwka) - **Alex Kocharin** &lt;[email protected]&gt; <ide> * [rmg](https://github.com/rmg) - **Ryan Graham** &lt;[email protected]&gt;
1
Ruby
Ruby
convert query results to a list of lists
60c877c43baa588db277fb4eca317e2f7884be70
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb <ide> def result_as_array(res) #:nodoc: <ide> # Queries the database and returns the results in an Array-like object <ide> def query(sql, name = nil) #:nodoc: <ide> log(sql, name) do <del> @connection.async_exec(sql) <del> return result_as_array(res) <add> result_as_array @connection.async_exec(sql) <ide> end <ide> end <ide>
1
Text
Text
add django oauth toolkit to docs
aa706f581c84209d83acf04ccd8854e205057e50
<ide><path>docs/api-guide/authentication.md <ide> The command line to test the authentication looks like: <ide> <ide> curl -H "Authorization: Bearer <your-access-token>" http://localhost:8000/api/ <ide> <add>### Alternative OAuth 2 implementations <add> <add>Note that [Django OAuth Toolkit][django-oauth-toolkit] is an alternative external package that also includes OAuth 2.0 support for REST framework. <add> <ide> --- <ide> <ide> # Custom authentication <ide> The following third party packages are also available. <ide> <ide> HTTP digest authentication is a widely implemented scheme that was intended to replace HTTP basic authentication, and which provides a simple encrypted authentication mechanism. [Juan Riaza][juanriaza] maintains the [djangorestframework-digestauth][djangorestframework-digestauth] package which provides HTTP digest authentication support for REST framework. <ide> <add>## Django OAuth Toolkit <add> <add>The [Django OAuth Toolkit][django-oauth-toolkit] package provides OAuth 2.0 support, and works with Python 2.7 and Python 3.3+. The package is maintained by [Evonove][evonove] and uses the excelllent [OAuthLib][oauthlib]. The package is well documented, and comes as a recommended alternative for OAuth 2.0 support. <add> <ide> [cite]: http://jacobian.org/writing/rest-worst-practices/ <ide> [http401]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2 <ide> [http403]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4 <ide> HTTP digest authentication is a widely implemented scheme that was intended to r <ide> [django-oauth2-provider]: https://github.com/caffeinehit/django-oauth2-provider <ide> [django-oauth2-provider-docs]: https://django-oauth2-provider.readthedocs.org/en/latest/ <ide> [rfc6749]: http://tools.ietf.org/html/rfc6749 <add>[django-oauth-toolkit]: https://github.com/evonove/django-oauth-toolkit <add>[evonove]: https://github.com/evonove/ <add>[oauthlib]: https://github.com/idan/oauthlib
1
Javascript
Javascript
prevent bubbling of minor units for iso dates
bb5135060a1e6a7d077a6b9d65edbe0e8b3b1a17
<ide><path>src/lib/duration/iso-string.js <add>import absFloor from '../utils/abs-floor'; <ide> var abs = Math.abs; <ide> <ide> export function toISOString() { <add> // for ISO strings we do not use the normal bubbling rules: <add> // * milliseconds bubble up until they become hours <add> // * days do not bubble at all <add> // * months bubble up until they become years <add> // This is because there is no context-free conversion between hours and days <add> // (think of clock changes) <add> // and also not between days and months (28-31 days per month) <add> var seconds = abs(this._milliseconds) / 1000; <add> var days = abs(this._days); <add> var months = abs(this._months); <add> var minutes, hours, years; <add> <add> // 3600 seconds -> 60 minutes -> 1 hour <add> minutes = absFloor(seconds / 60); <add> hours = absFloor(minutes / 60); <add> seconds %= 60; <add> minutes %= 60; <add> <add> // 12 months -> 1 year <add> years = absFloor(months / 12); <add> months %= 12; <add> <add> <ide> // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js <del> var Y = abs(this.years()); <del> var M = abs(this.months()); <del> var D = abs(this.days()); <del> var h = abs(this.hours()); <del> var m = abs(this.minutes()); <del> var s = abs(this.seconds() + this.milliseconds() / 1000); <add> var Y = years; <add> var M = months; <add> var D = days; <add> var h = hours; <add> var m = minutes; <add> var s = seconds; <ide> var total = this.asSeconds(); <ide> <ide> if (!total) {
1
Go
Go
fix race condition with exec and resize
dc56a76bc9f16b2d57b9d64822e305c1e787fcf0
<ide><path>daemon/exec.go <ide> func (d *Daemon) monitorExec(container *container.Container, execConfig *exec.Co <ide> } <ide> <ide> if execConfig.ProcessConfig.Terminal != nil { <add> if err := execConfig.WaitResize(); err != nil { <add> logrus.Errorf("Error waiting for resize: %v", err) <add> } <ide> if err := execConfig.ProcessConfig.Terminal.Close(); err != nil { <ide> logrus.Errorf("Error closing terminal while running in container %s: %s", container.ID, err) <ide> } <ide><path>daemon/exec/exec.go <ide> type Config struct { <ide> <ide> // waitStart will be closed immediately after the exec is really started. <ide> waitStart chan struct{} <add> <add> // waitResize will be closed after Resize is finished. <add> waitResize chan struct{} <ide> } <ide> <ide> // NewConfig initializes the a new exec configuration <ide> func NewConfig() *Config { <ide> ID: stringid.GenerateNonCryptoID(), <ide> StreamConfig: runconfig.NewStreamConfig(), <ide> waitStart: make(chan struct{}), <add> waitResize: make(chan struct{}), <ide> } <ide> } <ide> <ide> func (c *Config) Wait(cErr chan error) error { <ide> return nil <ide> } <ide> <add>// WaitResize waits until terminal resize finishes or time out. <add>func (c *Config) WaitResize() error { <add> select { <add> case <-c.waitResize: <add> case <-time.After(time.Second): <add> return fmt.Errorf("Terminal resize for exec %s time out.", c.ID) <add> } <add> return nil <add>} <add> <ide> // Close closes the wait channel for the progress. <ide> func (c *Config) Close() { <ide> close(c.waitStart) <ide> } <ide> <add>// CloseResize closes the wait channel for resizing terminal. <add>func (c *Config) CloseResize() { <add> close(c.waitResize) <add>} <add> <ide> // Resize changes the size of the terminal for the exec process. <ide> func (c *Config) Resize(h, w int) error { <add> defer c.CloseResize() <ide> select { <ide> case <-c.waitStart: <ide> case <-time.After(time.Second):
2
Javascript
Javascript
make withapollo work with _app.js components
20d88231f4815ed79e3640509f9e11b242762ecb
<ide><path>examples/with-apollo/lib/apollo.js <ide> import React from 'react' <add>import App from 'next/app' <ide> import Head from 'next/head' <ide> import { ApolloProvider } from '@apollo/react-hooks' <ide> import { ApolloClient } from 'apollo-client' <ide> export const withApollo = ({ ssr = true } = {}) => PageComponent => { <ide> const displayName = <ide> PageComponent.displayName || PageComponent.name || 'Component' <ide> <del> if (displayName === 'App') { <del> console.warn('This withApollo HOC only works with PageComponents.') <del> } <del> <ide> WithApollo.displayName = `withApollo(${displayName})` <ide> } <ide> <ide> if (ssr || PageComponent.getInitialProps) { <ide> WithApollo.getInitialProps = async ctx => { <ide> const { AppTree } = ctx <add> const inAppContext = Boolean(ctx.ctx) <add> <add> if (process.env.NODE_ENV === 'development') { <add> if (inAppContext) { <add> console.warn( <add> 'Warning: You have opted-out of Automatic Static Optimization due to `withApollo` in `pages/_app`.\n' + <add> 'Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n' <add> ) <add> } <add> } <ide> <del> // Initialize ApolloClient, add it to the ctx object so <del> // we can use it in `PageComponent.getInitialProp`. <del> const apolloClient = (ctx.apolloClient = initApolloClient()) <add> if (ctx.apolloClient) { <add> throw new Error('Multiple instances of withApollo found.') <add> } <add> <add> // Initialize ApolloClient <add> const apolloClient = initApolloClient() <add> <add> // Add apolloClient to NextPageContext & NextAppContext <add> // This allows us to consume the apolloClient inside our <add> // custom `getInitialProps({ apolloClient })`. <add> ctx.apolloClient = apolloClient <add> if (inAppContext) { <add> ctx.ctx.apolloClient = apolloClient <add> } <ide> <ide> // Run wrapped getInitialProps methods <ide> let pageProps = {} <ide> if (PageComponent.getInitialProps) { <ide> pageProps = await PageComponent.getInitialProps(ctx) <add> } else if (inAppContext) { <add> pageProps = await App.getInitialProps(ctx) <ide> } <ide> <ide> // Only on the server: <ide> export const withApollo = ({ ssr = true } = {}) => PageComponent => { <ide> try { <ide> // Run all GraphQL queries <ide> const { getDataFromTree } = await import('@apollo/react-ssr') <del> await getDataFromTree( <del> <AppTree <del> pageProps={{ <del> ...pageProps, <del> apolloClient, <del> }} <del> /> <del> ) <add> <add> // Since AppComponents and PageComponents have different context types <add> // we need to modify their props a little. <add> let props <add> if (inAppContext) { <add> props = { ...pageProps, apolloClient } <add> } else { <add> props = { pageProps: { ...pageProps, apolloClient } } <add> } <add> <add> // Takes React AppTree, determine which queries are needed to render, <add> // then fetche them all. <add> await getDataFromTree(<AppTree {...props} />) <ide> } catch (error) { <ide> // Prevent Apollo Client GraphQL errors from crashing SSR. <ide> // Handle them in components via the data.error prop:
1
Text
Text
remove unneeded prompt block
b179d9e1216adc5b6e6e07a9fe41a4274831693a
<ide><path>docs/rfcs/001-updateable-bundled-packages.md <ide> The primary use case for this improvement is enabling the GitHub package to ship <ide> <ide> ## Explanation <ide> <del>> Explain the proposal as if it was already implemented in Atom and you were describing it to an Atom user. That generally means: <del>> - Introducing new named concepts. <del>> - Explaining the feature largely in terms of examples. <del>> - Explaining any changes to existing workflows. <del> <ide> Any bundled Atom package can opt in to new updates released via `apm` by adding `"coreUpdateable": true` to its `package.json` file. This causes `apm` to consider it as part of the list of packages it checks for updates. If a community (non-bundled) package sets this field to `true` or `false` it will be ignored as it's only relevant to bundled packages. <ide> <ide> Atom shows update notifications for updateable bundled packages whenever they are available so long as those updates support the engine version of the current Atom build. Bundled package updates can also be found and installed in the Settings view's *Updates* tab.
1
PHP
PHP
remove unnecessary casting
1fe7347e3330fa6dc9d0ecb947f5678d44b40663
<ide><path>src/Http/Client/FormDataPart.php <ide> public function __toString(): string <ide> $out .= 'Content-ID: <' . $this->_contentId . ">\r\n"; <ide> } <ide> $out .= "\r\n"; <del> $out .= (string)$this->_value; <add> $out .= $this->_value; <ide> <ide> return $out; <ide> }
1
Ruby
Ruby
silence minitest for plugin tests
106db0b419ede5bea7b93a9eb76ce6aa578b99b2
<ide><path>railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb <ide> <% end -%> <ide> require "rails/test_help" <ide> <del>Rails.backtrace_cleaner.remove_silencers! <add># Filter out Minitest backtrace while allowing backtrace from other libraries <add># to be shown. <add>Minitest.backtrace_filter = Minitest::BacktraceFilter.new <ide> <ide> # Load support files <ide> Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } <ide><path>railties/test/generators/plugin_generator_test.rb <ide> def test_generating_without_options <ide> assert_file "test/test_helper.rb" do |content| <ide> assert_match(/require.+test\/dummy\/config\/environment/, content) <ide> assert_match(/ActiveRecord::Migrator\.migrations_paths.+test\/dummy\/db\/migrate/, content) <add> assert_match(/Minitest\.backtrace_filter = Minitest::BacktraceFilter\.new/, content) <ide> end <ide> assert_file "test/bukkits_test.rb", /assert_kind_of Module, Bukkits/ <ide> end
2
Javascript
Javascript
remove unused code, add todo comment
3d99168a67d04cecac97e320a922cb14887fd500
<ide><path>lib/CachePlugin.js <ide> class CachePlugin { <ide> } <ide> <ide> apply(compiler) { <del> const cacheMap = new Map(); <del> cacheMap.set(compiler, this.cache); <ide> if(Array.isArray(compiler.compilers)) { <ide> compiler.compilers.forEach((c, idx) => { <ide> c.apply(new CachePlugin(this.cache[idx] = this.cache[idx] || {})); <ide> }); <ide> } else { <ide> const registerCacheToCompiler = (compiler, cache) => { <ide> compiler.plugin("this-compilation", compilation => { <add> // TODO remove notCacheable for webpack 4 <ide> if(!compilation.notCacheable) { <ide> compilation.cache = cache; <ide> compilation.plugin("child-compiler", (childCompiler, compilerName, compilerIndex) => {
1
Ruby
Ruby
remove unused persistent option
7bd70bae142e41f3c21338a8e5aaf52afff40b38
<ide><path>actionview/test/template/digestor_test.rb <ide> def test_old_style_hash_in_render_invocation <ide> end <ide> <ide> def test_variants <del> assert_digest_difference("messages/new", false, variants: [:iphone]) do <add> assert_digest_difference("messages/new", variants: [:iphone]) do <ide> change_template("messages/new", :iphone) <ide> change_template("messages/_header", :iphone) <ide> end <ide> def assert_logged(message) <ide> end <ide> end <ide> <del> def assert_digest_difference(template_name, persistent = false, options = {}) <add> def assert_digest_difference(template_name, options = {}) <ide> previous_digest = digest(template_name, options) <del> ActionView::Digestor.cache.clear unless persistent <add> ActionView::Digestor.cache.clear <ide> <ide> yield <ide>
1
Python
Python
add module with aws utility functions
8a3f2dbf97b89eabd9c769c10c10f90792d59168
<ide><path>libcloud/common/aws.py <add># Licensed to the Apache Software Foundation (ASF) under one or more <add># contributor license agreements. See the NOTICE file distributed with <add># this work for additional information regarding copyright ownership. <add># The ASF licenses this file to You under the Apache License, Version 2.0 <add># (the "License"); you may not use this file except in compliance with <add># the License. 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>from xml.etree import ElementTree as ET <add> <add>from libcloud.common.base import Response <add>from libcloud.common.types import MalformedResponseError <add> <add>class AWSBaseResponse(Response): <add> def parse_body(self): <add> if not self.body: <add> return None <add> try: <add> body = ET.XML(self.body) <add> except: <add> raise MalformedResponseError("Failed to parse XML", body=self.body, <add> driver=self.driver) <add> return body
1
PHP
PHP
apply fixes from styleci
36ca1bea4c217fbc2457844a87f035e28303f8f6
<ide><path>src/Illuminate/Auth/Notifications/ResetPassword.php <ide> public function toMail($notifiable) <ide> <ide> return $this->buildMailMessage($url); <ide> } <del> <add> <ide> /** <ide> * Get the password reset URL for the given notifiable. <ide> *
1
PHP
PHP
parse rules in getfield()
60c611fa47321e2a359ea8e66b8351cb8d07e09d
<ide><path>lib/Cake/Model/ModelValidator.php <ide> public function getMethods() { <ide> * @return CakeValidationSet|array <ide> */ <ide> public function getField($name = null) { <add> $this->_parseRules(); <ide> if ($name !== null && !empty($this->_fields[$name])) { <ide> return $this->_fields[$name]; <ide> } elseif ($name !== null) { <ide><path>lib/Cake/Test/Case/Model/ModelValidationTest.php <ide> public function testAddMultipleRules() { <ide> $this->assertSame($set, $Validator->getField('other')); <ide> } <ide> <add>/** <add> * Test that rules are parsed correctly when calling getField() <add> * <add> * @return void <add> */ <add> public function testValidator() { <add> $TestModel = new Article(); <add> $Validator = $TestModel->validator(); <add> <add> $result = $Validator->getField(); <add> $expected = array('user_id', 'title', 'body'); <add> $this->assertEquals($expected, array_keys($result)); <add> $this->assertTrue($result['user_id'] instanceof CakeValidationSet); <add> <add> $result = $TestModel->validator()->getField('title'); <add> $this->assertTrue($result instanceof CakeValidationSet); <add> } <add> <ide> /** <ide> * Tests that altering data in a beforeValidate callback will lead to saving those <ide> * values in database, this time with belongsTo associations
2
Javascript
Javascript
fix ref behavior for remounting
d889a01cafd749a99ea5b6d67f8913cc21b451d1
<ide><path>src/core/ReactCompositeComponent.js <ide> var ReactCompositeComponentMixin = { <ide> this._renderedComponent = null; <ide> <ide> ReactComponent.Mixin.unmountComponent.call(this); <del> ReactOwner.Mixin.unmountComponent.call(this); <ide> <ide> // Some existing components rely on this.props even after they've been <ide> // destroyed (in event handlers). <ide><path>src/core/ReactOwner.js <ide> var ReactOwner = { <ide> */ <ide> detachRef: function(ref) { <ide> delete this.refs[ref]; <del> }, <del> <del> unmountComponent: function() { <del> this.refs = null; <ide> } <ide> <ide> }
2
Text
Text
fix typo in docs
f4cf25863cdd9d6e6adf9a7c8aba731e3c295ff9
<ide><path>docs/templates/applications.md <ide> Weights are downloaded automatically when instantiating a model. They are stored <ide> - [InceptionV3](#inceptionv3) <ide> - [MobileNet](#mobilenet) <ide> <del>All of these architectures (except Xception and MobileNet) are compatible with both TensorFlow and Theano, and upon instantiation the models will be built according to the image data format set in your Keras configuration file at `~/.keras/keras.json`. For instance, if you have set `image_data_format=channels_last`, then any model loaded from this repository will get built according to the TensorFlow data format convention, "Width-Height-Depth". <add>All of these architectures (except Xception and MobileNet) are compatible with both TensorFlow and Theano, and upon instantiation the models will be built according to the image data format set in your Keras configuration file at `~/.keras/keras.json`. For instance, if you have set `image_data_format=channels_last`, then any model loaded from this repository will get built according to the TensorFlow data format convention, "Height-Width-Depth". <ide> <ide> The Xception model is only available for TensorFlow, due to its reliance on `SeparableConvolution` layers. <ide> The MobileNet model is only available for TensorFlow, due to its reliance on `DepthwiseConvolution` layers.
1
Javascript
Javascript
remove unnecessary test setup
8079b518397dc4dfa07e1aae73899f56b8d3326c
<ide><path>spec/dock-spec.js <ide> describe('Dock', () => { <ide> describe('activating the next pane', () => { <ide> describe('when the dock has more than one pane', () => { <ide> it('activates the next pane', () => { <del> jasmine.attachToDOM(atom.workspace.getElement()) <ide> const dock = atom.workspace.getLeftDock() <ide> const pane1 = dock.getPanes()[0] <ide> const pane2 = pane1.splitRight() <ide> describe('Dock', () => { <ide> <ide> describe('when the dock has only one pane', () => { <ide> it('leaves the current pane active', () => { <del> jasmine.attachToDOM(atom.workspace.getElement()) <ide> const dock = atom.workspace.getLeftDock() <ide> <ide> expect(dock.getPanes().length).toBe(1) <ide> describe('Dock', () => { <ide> describe('activating the previous pane', () => { <ide> describe('when the dock has more than one pane', () => { <ide> it('activates the previous pane', () => { <del> jasmine.attachToDOM(atom.workspace.getElement()) <ide> const dock = atom.workspace.getLeftDock() <ide> const pane1 = dock.getPanes()[0] <ide> const pane2 = pane1.splitRight() <ide> describe('Dock', () => { <ide> <ide> describe('when the dock has only one pane', () => { <ide> it('leaves the current pane active', () => { <del> jasmine.attachToDOM(atom.workspace.getElement()) <ide> const dock = atom.workspace.getLeftDock() <ide> <ide> expect(dock.getPanes().length).toBe(1)
1
Python
Python
get log events after sleep to get all logs
21a90c5b7e2f236229812f9017582d67d3d7c3f0
<ide><path>airflow/providers/amazon/aws/operators/ecs.py <ide> def __init__( <ide> def run(self) -> None: <ide> logs_to_skip = 0 <ide> while not self.is_stopped(): <add> time.sleep(self.fetch_interval.total_seconds()) <ide> log_events = self._get_log_events(logs_to_skip) <ide> for log_event in log_events: <ide> self.logger.info(self._event_to_str(log_event)) <ide> logs_to_skip += 1 <del> time.sleep(self.fetch_interval.total_seconds()) <ide> <ide> def _get_log_events(self, skip: int = 0) -> Generator: <ide> try:
1
Text
Text
fix broken link
8e5ef488220ab0f6242b1478b8ac227eab731e57
<ide><path>examples/with-react-toolbox/README.md <ide> Notice that `yarn toolbox` (or `npm run toolbox`) should be rerun every time the <ide> <ide> This is a simple example of getting react-toolbox up and running, using [react-toolbox-themr](https://github.com/react-toolbox/react-toolbox-themr). <ide> <del>For actual use, you probably also want to add Roboto Font, and Material Design Icons. See <http://react-toolbox.com/#/install> <add>For actual use, you probably also want to add Roboto Font, and Material Design Icons. See <http://react-toolbox.io/#/install>
1
Text
Text
improve async_hooks asynchronous context example
b4fe76d656d51ead949f2a35c13a221616f78c4c
<ide><path>doc/api/async_hooks.md <ide> async_hooks.createHook({ <ide> }, <ide> before(asyncId) { <ide> const indentStr = ' '.repeat(indent); <del> fs.writeFileSync('log.out', <del> `${indentStr}before: ${asyncId}\n`, { flag: 'a' }); <add> fs.writeSync(process.stdout.fd, `${indentStr}before: ${asyncId}\n`); <ide> indent += 2; <ide> }, <ide> after(asyncId) { <ide> indent -= 2; <ide> const indentStr = ' '.repeat(indent); <del> fs.writeFileSync('log.out', <del> `${indentStr}after: ${asyncId}\n`, { flag: 'a' }); <add> fs.writeSync(process.stdout.fd, `${indentStr}after: ${asyncId}\n`); <ide> }, <ide> destroy(asyncId) { <ide> const indentStr = ' '.repeat(indent); <del> fs.writeFileSync('log.out', <del> `${indentStr}destroy: ${asyncId}\n`, { flag: 'a' }); <add> fs.writeSync(process.stdout.fd, `${indentStr}destroy: ${asyncId}\n`); <ide> }, <ide> }).enable(); <ide> <ide> the value of the current execution context; which is delineated by calls to <ide> Only using `execution` to graph resource allocation results in the following: <ide> <ide> ```console <del>Timeout(7) -> TickObject(6) -> root(1) <add> root(1) <add> ^ <add> | <add>TickObject(6) <add> ^ <add> | <add> Timeout(7) <ide> ``` <ide> <ide> The `TCPSERVERWRAP` is not part of this graph, even though it was the reason for <ide> `console.log()` being called. This is because binding to a port without a host <ide> name is a *synchronous* operation, but to maintain a completely asynchronous <del>API the user's callback is placed in a `process.nextTick()`. <add>API the user's callback is placed in a `process.nextTick()`. Which is why <add>`TickObject` is present in the output and is a 'parent' for `.listen()` <add>callback. <ide> <ide> The graph only shows *when* a resource was created, not *why*, so to track <del>the *why* use `triggerAsyncId`. <add>the *why* use `triggerAsyncId`. Which can be represented with the following <add>graph: <add> <add>```console <add> bootstrap(1) <add> | <add> ˅ <add>TCPSERVERWRAP(5) <add> | <add> ˅ <add> TickObject(6) <add> | <add> ˅ <add> Timeout(7) <add>``` <ide> <ide> ##### `before(asyncId)` <ide>
1
PHP
PHP
refactor the generator command
b0370761de74571a793f40b0547b58402b9737d2
<ide><path>src/Illuminate/Console/GeneratorCommand.php <ide> abstract protected function getStub(); <ide> */ <ide> public function fire() <ide> { <del> $name = $this->parseName($this->getNameInput()); <add> $name = $this->qualifyClass($this->getNameInput()); <ide> <ide> $path = $this->getPath($name); <ide> <add> // First we will check to see if the class already exists. If it does, we don't want <add> // to create the class and overwrite the user's code. So, we will bail out so the <add> // code is untouched. Otherwise, we will continue generating this class' files. <ide> if ($this->alreadyExists($this->getNameInput())) { <ide> $this->error($this->type.' already exists!'); <ide> <ide> return false; <ide> } <ide> <add> // Next, we will generate the path to the location where this class' file should get <add> // written. Then, we will build the class and make the proper replacements on the <add> // stub files so that it gets the correctly formatted namespace and class name. <ide> $this->makeDirectory($path); <ide> <ide> $this->files->put($path, $this->buildClass($name)); <ide> public function fire() <ide> } <ide> <ide> /** <del> * Determine if the class already exists. <add> * Parse the class name and format according to the root namespace. <ide> * <del> * @param string $rawName <del> * @return bool <add> * @param string $name <add> * @return string <ide> */ <del> protected function alreadyExists($rawName) <add> protected function qualifyClass($name) <ide> { <del> $name = $this->parseName($rawName); <add> $rootNamespace = $this->rootNamespace(); <ide> <del> return $this->files->exists($this->getPath($name)); <add> if (Str::startsWith($name, $rootNamespace)) { <add> return $name; <add> } <add> <add> $name = str_replace('/', '\\', $name); <add> <add> return $this->qualifyClass( <add> $this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name <add> ); <ide> } <ide> <ide> /** <del> * Get the destination class path. <add> * Get the default namespace for the class. <ide> * <del> * @param string $name <add> * @param string $rootNamespace <ide> * @return string <ide> */ <del> protected function getPath($name) <add> protected function getDefaultNamespace($rootNamespace) <ide> { <del> $name = str_replace_first($this->rootNamespace(), '', $name); <del> <del> return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php'; <add> return $rootNamespace; <ide> } <ide> <ide> /** <del> * Parse the name and format according to the root namespace. <add> * Determine if the class already exists. <ide> * <del> * @param string $name <del> * @return string <add> * @param string $rawName <add> * @return bool <ide> */ <del> protected function parseName($name) <add> protected function alreadyExists($rawName) <ide> { <del> $rootNamespace = $this->rootNamespace(); <del> <del> if (Str::startsWith($name, $rootNamespace)) { <del> return $name; <del> } <del> <del> if (Str::contains($name, '/')) { <del> $name = str_replace('/', '\\', $name); <del> } <del> <del> return $this->parseName($this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name); <add> return $this->files->exists($this->getPath($this->qualifyClass($rawName))); <ide> } <ide> <ide> /** <del> * Get the default namespace for the class. <add> * Get the destination class path. <ide> * <del> * @param string $rootNamespace <add> * @param string $name <ide> * @return string <ide> */ <del> protected function getDefaultNamespace($rootNamespace) <add> protected function getPath($name) <ide> { <del> return $rootNamespace; <add> $name = str_replace_first($this->rootNamespace(), '', $name); <add> <add> return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php'; <ide> } <ide> <ide> /** <ide> protected function makeDirectory($path) <ide> if (! $this->files->isDirectory(dirname($path))) { <ide> $this->files->makeDirectory(dirname($path), 0777, true, true); <ide> } <add> <add> return $path; <ide> } <ide> <ide> /** <ide> protected function buildClass($name) <ide> protected function replaceNamespace(&$stub, $name) <ide> { <ide> $stub = str_replace( <del> 'DummyNamespace', $this->getNamespace($name), $stub <del> ); <del> <del> $stub = str_replace( <del> 'DummyRootNamespace', $this->rootNamespace(), $stub <add> ['DummyNamespace', 'DummyRootNamespace'], <add> [$this->getNamespace($name), $this->rootNamespace()], <add> $stub <ide> ); <ide> <ide> return $this; <ide> } <ide> <ide> /** <del> * Get the full namespace name for a given class. <add> * Get the full namespace for a given class, without the class name. <ide> * <ide> * @param string $name <ide> * @return string <ide><path>src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php <ide> protected function getPath($name) <ide> } <ide> <ide> /** <del> * Parse the name and format according to the root namespace. <add> * Parse the class name and format according to the root namespace. <ide> * <ide> * @param string $name <ide> * @return string <ide> */ <del> protected function parseName($name) <add> protected function qualifyClass($name) <ide> { <ide> return $name; <ide> }
2
Python
Python
remove unused function _move_axis_to_0
0ccdd6fc1b30f767b1148690e1b73fd1b399c4ff
<ide><path>numpy/core/numeric.py <ide> def moveaxis(a, source, destination): <ide> return result <ide> <ide> <del># fix hack in scipy which imports this function <del>def _move_axis_to_0(a, axis): <del> return moveaxis(a, axis, 0) <del> <del> <ide> def _cross_dispatcher(a, b, axisa=None, axisb=None, axisc=None, axis=None): <ide> return (a, b) <ide>
1
Python
Python
bring english tag_map in line with ud treebank
04395ffa49409f669147168c8966ac21335cbb4d
<ide><path>spacy/lang/en/morph_rules.py <ide> # coding: utf8 <ide> from __future__ import unicode_literals <ide> <del>from ...symbols import LEMMA, PRON_LEMMA <add>from ...symbols import LEMMA, PRON_LEMMA, AUX <ide> <add>_subordinating_conjunctions = [ <add> "that", <add> "if", <add> "as", <add> "because", <add> "of", <add> "for", <add> "before", <add> "in", <add> "while", <add> "after", <add> "since", <add> "like", <add> "with", <add> "so", <add> "to", <add> "by", <add> "on", <add> "about", <add> "than", <add> "whether", <add> "although", <add> "from", <add> "though", <add> "until", <add> "unless", <add> "once", <add> "without", <add> "at", <add> "into", <add> "cause", <add> "over", <add> "upon", <add> "till", <add> "whereas", <add> "beyond", <add> "whilst", <add> "except", <add> "despite", <add> "wether", <add> "then", <add> "but", <add> "becuse", <add> "whie", <add> "below", <add> "against", <add> "it", <add> "w/out", <add> "toward", <add> "albeit", <add> "save", <add> "besides", <add> "becouse", <add> "coz", <add> "til", <add> "ask", <add> "i'd", <add> "out", <add> "near", <add> "seince", <add> "towards", <add> "tho", <add> "sice", <add> "will", <add>] <add> <add>_relative_pronouns = ["this", "that", "those", "these"] <ide> <ide> MORPH_RULES = { <add> "DT": {word: {"POS": "PRON"} for word in _relative_pronouns}, <add> "IN": {word: {"POS": "SCONJ"} for word in _subordinating_conjunctions}, <add> "NN": { <add> "something": {"POS": "PRON"}, <add> "anyone": {"POS": "PRON"}, <add> "anything": {"POS": "PRON"}, <add> "nothing": {"POS": "PRON"}, <add> "someone": {"POS": "PRON"}, <add> "everything": {"POS": "PRON"}, <add> "everyone": {"POS": "PRON"}, <add> "everybody": {"POS": "PRON"}, <add> "nobody": {"POS": "PRON"}, <add> "somebody": {"POS": "PRON"}, <add> "anybody": {"POS": "PRON"}, <add> "any1": {"POS": "PRON"}, <add> }, <ide> "PRP": { <ide> "I": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "One", <ide> "Number": "Sing", <ide> "Case": "Nom", <ide> }, <ide> "me": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "One", <ide> "Number": "Sing", <ide> "Case": "Acc", <ide> }, <del> "you": {LEMMA: PRON_LEMMA, "PronType": "Prs", "Person": "Two"}, <add> "you": {LEMMA: PRON_LEMMA, "POS": "PRON", "PronType": "Prs", "Person": "Two"}, <ide> "he": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "him": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "she": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "her": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "it": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> "Gender": "Neut", <ide> }, <ide> "we": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "One", <ide> "Number": "Plur", <ide> "Case": "Nom", <ide> }, <ide> "us": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "One", <ide> "Number": "Plur", <ide> "Case": "Acc", <ide> }, <ide> "they": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Plur", <ide> "Case": "Nom", <ide> }, <ide> "them": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Plur", <ide> "Case": "Acc", <ide> }, <ide> "mine": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "One", <ide> "Number": "Sing", <ide> }, <ide> "his": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "hers": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "its": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "ours": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "One", <ide> "Number": "Plur", <ide> }, <ide> "yours": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Two", <ide> "Number": "Plur", <ide> }, <ide> "theirs": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Plur", <ide> }, <ide> "myself": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "One", <ide> "Number": "Sing", <ide> }, <ide> "yourself": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Two", <ide> "Case": "Acc", <ide> "Reflex": "Yes", <ide> }, <ide> "himself": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "herself": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "itself": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "themself": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Sing", <ide> }, <ide> "ourselves": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "One", <ide> "Number": "Plur", <ide> }, <ide> "yourselves": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Two", <ide> "Case": "Acc", <ide> "Reflex": "Yes", <ide> }, <ide> "themselves": { <ide> LEMMA: PRON_LEMMA, <add> "POS": "PRON", <ide> "PronType": "Prs", <ide> "Person": "Three", <ide> "Number": "Plur", <ide> "Poss": "Yes", <ide> }, <ide> }, <add> "RB": {word: {"POS": "PART"} for word in ["not", "n't", "nt", "n’t"]}, <add> "VB": { <add> word: {"POS": "AUX"} <add> for word in ["be", "have", "do", "get", "of", "am", "are", "'ve"] <add> }, <add> "VBN": {"been": {LEMMA: "be", "POS": "AUX"}}, <add> "VBG": {"being": {LEMMA: "be", "POS": "AUX"}}, <ide> "VBZ": { <ide> "am": { <ide> LEMMA: "be", <add> "POS": "AUX", <ide> "VerbForm": "Fin", <ide> "Person": "One", <ide> "Tense": "Pres", <ide> "Mood": "Ind", <ide> }, <ide> "are": { <ide> LEMMA: "be", <add> "POS": "AUX", <ide> "VerbForm": "Fin", <ide> "Person": "Two", <ide> "Tense": "Pres", <ide> "Mood": "Ind", <ide> }, <ide> "is": { <ide> LEMMA: "be", <add> "POS": "AUX", <ide> "VerbForm": "Fin", <ide> "Person": "Three", <ide> "Tense": "Pres", <ide> "Mood": "Ind", <ide> }, <ide> "'re": { <ide> LEMMA: "be", <add> "POS": "AUX", <ide> "VerbForm": "Fin", <ide> "Person": "Two", <ide> "Tense": "Pres", <ide> "Mood": "Ind", <ide> }, <ide> "'s": { <ide> LEMMA: "be", <add> "POS": "AUX", <ide> "VerbForm": "Fin", <ide> "Person": "Three", <ide> "Tense": "Pres", <ide> "Mood": "Ind", <ide> }, <add> "has": {"POS": "AUX"}, <add> "does": {"POS": "AUX"}, <ide> }, <ide> "VBP": { <del> "are": {LEMMA: "be", "VerbForm": "Fin", "Tense": "Pres", "Mood": "Ind"}, <del> "'re": {LEMMA: "be", "VerbForm": "Fin", "Tense": "Pres", "Mood": "Ind"}, <add> "are": { <add> LEMMA: "be", <add> "POS": "AUX", <add> "VerbForm": "Fin", <add> "Tense": "Pres", <add> "Mood": "Ind", <add> }, <add> "'re": { <add> LEMMA: "be", <add> "POS": "AUX", <add> "VerbForm": "Fin", <add> "Tense": "Pres", <add> "Mood": "Ind", <add> }, <ide> "am": { <ide> LEMMA: "be", <add> "POS": "AUX", <ide> "VerbForm": "Fin", <ide> "Person": "One", <ide> "Tense": "Pres", <ide> "Mood": "Ind", <ide> }, <add> "do": {"POS": "AUX"}, <add> "have": {"POS": "AUX"}, <add> "'m": {"POS": "AUX", LEMMA: "be"}, <add> "'ve": {"POS": "AUX"}, <add> "'re": {"POS": "AUX", LEMMA: "be"}, <add> "'s": {"POS": "AUX"}, <add> "is": {"POS": "AUX"}, <add> "'d": {"POS": "AUX"}, <ide> }, <ide> "VBD": { <del> "was": {LEMMA: "be", "VerbForm": "Fin", "Tense": "Past", "Number": "Sing"}, <del> "were": {LEMMA: "be", "VerbForm": "Fin", "Tense": "Past", "Number": "Plur"}, <add> "was": { <add> LEMMA: "be", <add> "POS": "AUX", <add> "VerbForm": "Fin", <add> "Tense": "Past", <add> "Number": "Sing", <add> }, <add> "were": { <add> LEMMA: "be", <add> "POS": "AUX", <add> "VerbForm": "Fin", <add> "Tense": "Past", <add> "Number": "Plur", <add> }, <add> "did": {"POS": "AUX"}, <add> "had": {"POS": "AUX"}, <add> "'d": {"POS": "AUX"}, <ide> }, <ide> } <ide> <ide><path>spacy/lang/en/tag_map.py <ide> from __future__ import unicode_literals <ide> <ide> from ...symbols import POS, PUNCT, SYM, ADJ, CCONJ, NUM, DET, ADV, ADP, X, VERB <del>from ...symbols import NOUN, PROPN, PART, INTJ, SPACE, PRON <add>from ...symbols import NOUN, PROPN, PART, INTJ, SPACE, PRON, AUX <ide> <ide> <ide> TAG_MAP = { <ide> "CC": {POS: CCONJ, "ConjType": "coor"}, <ide> "CD": {POS: NUM, "NumType": "card"}, <ide> "DT": {POS: DET}, <del> "EX": {POS: ADV, "AdvType": "ex"}, <add> "EX": {POS: PRON, "AdvType": "ex"}, <ide> "FW": {POS: X, "Foreign": "yes"}, <ide> "HYPH": {POS: PUNCT, "PunctType": "dash"}, <ide> "IN": {POS: ADP}, <ide> "JJ": {POS: ADJ, "Degree": "pos"}, <ide> "JJR": {POS: ADJ, "Degree": "comp"}, <ide> "JJS": {POS: ADJ, "Degree": "sup"}, <del> "LS": {POS: PUNCT, "NumType": "ord"}, <del> "MD": {POS: VERB, "VerbType": "mod"}, <add> "LS": {POS: X, "NumType": "ord"}, <add> "MD": {POS: AUX, "VerbType": "mod"}, <ide> "NIL": {POS: ""}, <ide> "NN": {POS: NOUN, "Number": "sing"}, <ide> "NNP": {POS: PROPN, "NounType": "prop", "Number": "sing"}, <ide> "PDT": {POS: DET, "AdjType": "pdt", "PronType": "prn"}, <ide> "POS": {POS: PART, "Poss": "yes"}, <ide> "PRP": {POS: PRON, "PronType": "prs"}, <del> "PRP$": {POS: DET, "PronType": "prs", "Poss": "yes"}, <add> "PRP$": {POS: PRON, "PronType": "prs", "Poss": "yes"}, <ide> "RB": {POS: ADV, "Degree": "pos"}, <ide> "RBR": {POS: ADV, "Degree": "comp"}, <ide> "RBS": {POS: ADV, "Degree": "sup"}, <del> "RP": {POS: PART}, <add> "RP": {POS: ADP}, <ide> "SP": {POS: SPACE}, <ide> "SYM": {POS: SYM}, <ide> "TO": {POS: PART, "PartType": "inf", "VerbForm": "inf"}, <ide> "Number": "sing", <ide> "Person": 3, <ide> }, <del> "WDT": {POS: DET, "PronType": "int|rel"}, <add> "WDT": {POS: PRON, "PronType": "int|rel"}, <ide> "WP": {POS: PRON, "PronType": "int|rel"}, <del> "WP$": {POS: DET, "Poss": "yes", "PronType": "int|rel"}, <add> "WP$": {POS: PRON, "Poss": "yes", "PronType": "int|rel"}, <ide> "WRB": {POS: ADV, "PronType": "int|rel"}, <ide> "ADD": {POS: X}, <ide> "NFP": {POS: PUNCT},
2
PHP
PHP
add computed support to sql server schema grammar
0fc4965f052b19fbd572afa69c0882bbcc0f9dc2
<ide><path>src/Illuminate/Database/Schema/Blueprint.php <ide> public function unsignedDecimal($column, $total = 8, $places = 2) <ide> ]); <ide> } <ide> <add> /** <add> * Create a new generated virtual column on the table. <add> * <add> * @param string $column <add> * @param string $formula <add> * @return \Illuminate\Database\Schema\ColumnDefinition <add> */ <add> public function virtual($column, $formula) <add> { <add> return $this->addColumn('virtual', $column, compact('formula')); <add> } <add> <ide> /** <ide> * Create a new boolean column on the table. <ide> * <ide><path>src/Illuminate/Database/Schema/ColumnDefinition.php <ide> * @method ColumnDefinition unsigned() Set the INTEGER column as UNSIGNED (MySQL) <ide> * @method ColumnDefinition useCurrent() Set the TIMESTAMP column to use CURRENT_TIMESTAMP as default value <ide> * @method ColumnDefinition virtualAs(string $expression) Create a virtual generated column (MySQL) <add> * @method ColumnDefinition persisted() Mark the virtual generated column as persistent (SQL Server) <ide> */ <ide> class ColumnDefinition extends Fluent <ide> { <ide><path>src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php <ide> class SqlServerGrammar extends Grammar <ide> * <ide> * @var array <ide> */ <del> protected $modifiers = ['Increment', 'Collate', 'Nullable', 'Default']; <add> protected $modifiers = ['Increment', 'Collate', 'Nullable', 'Default', 'Persisted']; <ide> <ide> /** <ide> * The columns available as serials. <ide> public function typeMultiPolygon(Fluent $column) <ide> return 'geography'; <ide> } <ide> <add> <add> /** <add> * Create the column definition for a generated virtual column type. <add> * <add> * @param \Illuminate\Support\Fluent $column <add> * @return string|null <add> */ <add> protected function typeVirtual(Fluent $column) <add> { <add> return " as ({$column->formula})"; <add> } <add> <ide> /** <ide> * Get the SQL for a collation column modifier. <ide> * <ide> protected function modifyCollate(Blueprint $blueprint, Fluent $column) <ide> */ <ide> protected function modifyNullable(Blueprint $blueprint, Fluent $column) <ide> { <del> return $column->nullable ? ' null' : ' not null'; <add> if($column->type !== 'virtual') { <add> return $column->nullable ? ' null' : ' not null'; <add> } <ide> } <ide> <ide> /** <ide> protected function modifyIncrement(Blueprint $blueprint, Fluent $column) <ide> } <ide> } <ide> <add> /** <add> * Get the SQL for a generated stored column modifier. <add> * <add> * @param \Illuminate\Database\Schema\Blueprint $blueprint <add> * @param \Illuminate\Support\Fluent $column <add> * @return string|null <add> */ <add> protected function modifyPersisted(Blueprint $blueprint, Fluent $column) <add> { <add> if ($column->persisted) { <add> return ' persisted'; <add> } <add> } <add> <ide> /** <ide> * Wrap a table in keyword identifiers. <ide> *
3
Python
Python
use project_id to get authenticated client
d4eb60712dc7bb34960ae10b9e6dd8624a554dfc
<ide><path>airflow/providers/google/cloud/hooks/bigquery.py <ide> def create_empty_dataset( <ide> dataset_reference["datasetReference"][param] = value <ide> <ide> location = location or self.location <add> project_id = project_id or self.project_id <ide> if location: <ide> dataset_reference["location"] = dataset_reference.get("location", location) <ide> <ide> dataset: Dataset = Dataset.from_api_repr(dataset_reference) <ide> self.log.info('Creating dataset: %s in project: %s ', dataset.dataset_id, dataset.project) <del> dataset_object = self.get_client(location=location).create_dataset( <add> dataset_object = self.get_client(project_id=project_id, location=location).create_dataset( <ide> dataset=dataset, exists_ok=exists_ok <ide> ) <ide> self.log.info('Dataset created successfully.')
1
Javascript
Javascript
handle backtrace errors
9b6acc27aad706505dff937e3b2ae6f8185b0995
<ide><path>lib/_debugger.js <ide> Client.prototype.reqEval = function(expression, cb) { <ide> } <ide> <ide> // Otherwise we need to get the current frame to see which scopes it has. <del> this.reqBacktrace(function(bt) { <del> if (!bt.frames) { <add> this.reqBacktrace(function(err, bt) { <add> if (err || !bt.frames) { <ide> // ?? <ide> cb({}); <ide> return; <ide> Client.prototype.reqFrameEval = function(expression, frame, cb) { <ide> // TODO: from, to, bottom <ide> Client.prototype.reqBacktrace = function(cb) { <ide> this.req({ command: 'backtrace' } , function(res) { <del> if (cb) cb(res.body); <add> if (cb) cb(!res.success && (res.message || true), res.body); <ide> }); <ide> }; <ide> <ide> Client.prototype.mirrorObject = function(handle, depth, cb) { <ide> Client.prototype.fullTrace = function(cb) { <ide> var self = this; <ide> <del> this.reqBacktrace(function(trace) { <add> this.reqBacktrace(function(err, trace) { <add> if (err) return cb(err); <add> <ide> var refs = []; <ide> <ide> for (var i = 0; i < trace.frames.length; i++) { <ide> Client.prototype.fullTrace = function(cb) { <ide> frame.receiver = res.body[frame.receiver.ref]; <ide> } <ide> <del> if (cb) cb(trace); <add> if (cb) cb(null, trace); <ide> }); <ide> }); <ide> }; <ide> Interface.prototype.backtrace = function() { <ide> client = this.client; <ide> <ide> self.pause(); <del> client.fullTrace(function(bt) { <add> client.fullTrace(function(err, bt) { <add> if (err) return self.error(err); <ide> if (bt.totalFrames == 0) { <ide> self.print('(empty stack)'); <ide> } else {
1
Javascript
Javascript
remove one loop from `baseviewer.getpagesoverview`
1de466896d123486bdffd06bfbbd5735f5792d5b
<ide><path>web/base_viewer.js <ide> class BaseViewer { <ide> * @returns {Array} Array of objects with width/height/rotation fields. <ide> */ <ide> getPagesOverview() { <del> const pagesOverview = this._pages.map(function (pageView) { <add> return this._pages.map(pageView => { <ide> const viewport = pageView.pdfPage.getViewport({ scale: 1 }); <del> return { <del> width: viewport.width, <del> height: viewport.height, <del> rotation: viewport.rotation, <del> }; <del> }); <del> if (!this.enablePrintAutoRotate) { <del> return pagesOverview; <del> } <del> return pagesOverview.map(function (size) { <del> if (isPortraitOrientation(size)) { <del> return size; <add> <add> if (!this.enablePrintAutoRotate || isPortraitOrientation(viewport)) { <add> return { <add> width: viewport.width, <add> height: viewport.height, <add> rotation: viewport.rotation, <add> }; <ide> } <add> // Landscape orientation. <ide> return { <del> width: size.height, <del> height: size.width, <del> rotation: (size.rotation - 90) % 360, <add> width: viewport.height, <add> height: viewport.width, <add> rotation: (viewport.rotation - 90) % 360, <ide> }; <ide> }); <ide> }
1
Ruby
Ruby
handle relations with limit in include?
345de17caf82f215b2a9a94e80eabf2473177e3a
<ide><path>activerecord/lib/active_record/relation/finder_methods.rb <ide> def exists?(conditions = :none) <ide> # compared to the records in memory. If the relation is unloaded, an <ide> # efficient existence query is performed, as in #exists?. <ide> def include?(record) <del> if loaded? || offset_value <add> if loaded? || offset_value || limit_value <ide> records.include?(record) <ide> else <ide> record.is_a?(klass) && exists?(record.id) <ide><path>activerecord/test/cases/finder_test.rb <ide> def test_include_on_unloaded_relation_with_mismatched_class <ide> end <ide> end <ide> <add> def test_include_on_unloaded_relation_with_offset <add> assert_sql(/ORDER BY name ASC/) do <add> assert_equal true, Customer.offset(1).order("name ASC").include?(customers(:mary)) <add> end <add> end <add> <add> def test_include_on_unloaded_relation_with_limit <add> mary = customers(:mary) <add> barney = customers(:barney) <add> david = customers(:david) <add> <add> assert_equal false, Customer.order(id: :desc).limit(2).include?(david) <add> assert_equal true, Customer.order(id: :desc).limit(2).include?(barney) <add> assert_equal true, Customer.order(id: :desc).limit(2).include?(mary) <add> end <add> <ide> def test_include_on_loaded_relation_with_match <ide> customers = Customer.where(name: "David").load <ide> david = customers(:david) <ide> def test_include_on_loaded_relation_with_match <ide> end <ide> end <ide> <del> def test_include_on_unloaded_relation_with_offset <del> assert_sql(/ORDER BY name ASC/) do <del> assert_equal true, Customer.offset(1).order("name ASC").include?(customers(:mary)) <del> end <del> end <del> <ide> def test_include_on_loaded_relation_without_match <ide> customers = Customer.where(name: "David").load <ide> mary = customers(:mary) <ide> def test_member_on_unloaded_relation_with_mismatched_class <ide> end <ide> end <ide> <add> def test_member_on_unloaded_relation_with_offset <add> assert_sql(/ORDER BY name ASC/) do <add> assert_equal true, Customer.offset(1).order("name ASC").member?(customers(:mary)) <add> end <add> end <add> <add> def test_member_on_unloaded_relation_with_limit <add> mary = customers(:mary) <add> barney = customers(:barney) <add> david = customers(:david) <add> <add> assert_equal false, Customer.order(id: :desc).limit(2).member?(david) <add> assert_equal true, Customer.order(id: :desc).limit(2).member?(barney) <add> assert_equal true, Customer.order(id: :desc).limit(2).member?(mary) <add> end <add> <ide> def test_member_on_loaded_relation_with_match <ide> customers = Customer.where(name: "David").load <ide> david = customers(:david) <ide> def test_member_on_loaded_relation_without_match <ide> end <ide> end <ide> <del> def test_member_on_unloaded_relation_with_offset <del> assert_sql(/ORDER BY name ASC/) do <del> assert_equal true, Customer.offset(1).order("name ASC").member?(customers(:mary)) <del> end <del> end <del> <ide> def test_find_by_array_of_one_id <ide> assert_kind_of(Array, Topic.find([ 1 ])) <ide> assert_equal(1, Topic.find([ 1 ]).length)
2
PHP
PHP
fix possible problem in provider zip extraction
e89082e3bae8034dc3a3204040edcb4692ed884f
<ide><path>laravel/cli/tasks/bundle/providers/provider.php <ide> protected function zipball($url, $bundle, $path) <ide> // we have a spot to do all of our bundle extration work. <ide> $target = $work.'laravel-bundle.zip'; <ide> <del> File::put($target, file_get_contents($url)); <add> File::put($target, $this->download($url)); <ide> <ide> $zip = new \ZipArchive; <ide> <ide> protected function zipball($url, $bundle, $path) <ide> @unlink($target); <ide> } <ide> <add> /** <add> * Download a remote zip archive from a URL. <add> * <add> * @param string $url <add> * @return string <add> */ <add> protected function download($url) <add> { <add> $remote = file_get_contents($url); <add> <add> // If we were unable to download the zip archive correctly <add> // we'll bomb out since we don't want to extract the last <add> // zip that was put in the storage directory. <add> if ($remote === false) <add> { <add> throw new \Exception("Error downloading bundle [{$bundle}]."); <add> } <add> <add> return $remote; <add> } <add> <ide> } <ide>\ No newline at end of file
1
PHP
PHP
add simplepaginator which skips count query
409389f7100b24774994b4fda76f01d48a3108e9
<ide><path>src/Datasource/Paginator.php <ide> protected function getQuery(RepositoryInterface $object, QueryInterface $query = <ide> * <ide> * @param \Cake\Datasource\QueryInterface $query Query instance. <ide> * @param array $data Pagination data. <del> * @return int <add> * @return int|null <ide> */ <ide> protected function getCount(QueryInterface $query, array $data) <ide> { <ide> protected function buildParams(array $data) <ide> { <ide> $defaults = $data['defaults']; <ide> $count = $data['count']; <del> $page = $data['options']['page']; <add> $numResults = $data['numResults']; <add> $requestedPage = $page = $data['options']['page']; <ide> $limit = $data['options']['limit']; <del> $pageCount = max((int)ceil($count / $limit), 1); <del> $requestedPage = $page; <del> $page = min($page, $pageCount); <ide> <ide> $order = (array)$data['options']['order']; <ide> $sortDefault = $directionDefault = false; <ide> protected function buildParams(array $data) <ide> $directionDefault = current($defaults['order']); <ide> } <ide> <del> $start = 0; <del> if ($count >= 1) { <del> $start = (($page - 1) * $limit) + 1; <add> $pageCount = 0; <add> if ($count !== null) { <add> $pageCount = max((int)ceil($count / $limit), 1); <add> $page = min($page, $pageCount); <add> } elseif ($numResults === 0 && $requestedPage > 1) { <add> $page = 1; <ide> } <del> $end = $start + $limit - 1; <del> if ($count < $end) { <del> $end = $count; <add> <add> $start = $end = 0; <add> if ($numResults > 0) { <add> $start = (($page - 1) * $limit) + 1; <add> $end = $start + $numResults - 1; <ide> } <ide> <ide> $paging = [ <ide> 'finder' => $data['finder'], <ide> 'requestedPage' => $requestedPage, <ide> 'page' => $page, <del> 'current' => $data['numResults'], <add> 'current' => $numResults, <ide> 'count' => $count, <ide> 'perPage' => $limit, <ide> 'start' => $start, <ide> 'end' => $end, <ide> 'prevPage' => $page > 1, <del> 'nextPage' => $count > ($page * $limit), <add> 'nextPage' => $count === null ? true : ($count > ($page * $limit)), <ide> 'pageCount' => $pageCount, <ide> 'sort' => $data['options']['sort'], <ide> 'direction' => isset($data['options']['sort']) ? current($order) : null, <ide><path>src/Datasource/SimplePaginator.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @since 3.9.0 <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Datasource; <add> <add>use Cake\Datasource\Exception\PageOutOfBoundsException; <add> <add>/** <add> * Simplified paginator which avoids query to get total count of records. <add> */ <add>class SimplePaginator extends Paginator <add>{ <add> /** <add> * Simple pagination does not perform any count query, so this method returns `null`. <add> * <add> * @param \Cake\Datasource\QueryInterface $query Query instance. <add> * @param array $data Pagination data. <add> * @return int|null <add> */ <add> protected function getCount(QueryInterface $query, array $data) <add> { <add> return null; <add> } <add>} <ide><path>tests/TestCase/Datasource/PaginatorTest.php <ide> public function testPaginateCustomFinder() <ide> { <ide> $settings = [ <ide> 'PaginatorPosts' => [ <del> 'finder' => 'popular', <add> 'finder' => 'published', <ide> 'fields' => ['id', 'title'], <ide> 'maxLimit' => 10, <ide> ] <ide> ]; <ide> <del> $table = $this->_getMockPosts(['findPopular']); <del> $query = $this->_getMockFindQuery(); <del> <del> $table->expects($this->any()) <del> ->method('findPopular') <del> ->will($this->returnValue($query)); <add> $this->loadFixtures('Posts'); <add> $table = $this->getTableLocator()->get('PaginatorPosts'); <add> $table->updateAll(['published' => 'N'], ['id' => 2]); <ide> <ide> $this->Paginator->paginate($table, [], $settings); <ide> $pagingParams = $this->Paginator->getPagingParams(); <del> $this->assertSame('popular', $pagingParams['PaginatorPosts']['finder']); <add> $this->assertSame('published', $pagingParams['PaginatorPosts']['finder']); <ide> <ide> $this->assertSame(1, $pagingParams['PaginatorPosts']['start']); <ide> $this->assertSame(2, $pagingParams['PaginatorPosts']['end']); <add> $this->assertFalse($pagingParams['PaginatorPosts']['nextPage']); <ide> } <ide> <ide> /** <ide> protected function _getMockFindQuery($table = null) <ide> $results = $this->getMockBuilder('Cake\ORM\ResultSet') <ide> ->disableOriginalConstructor() <ide> ->getMock(); <add> <ide> $query->expects($this->any()) <ide> ->method('count') <ide> ->will($this->returnValue(2)); <ide> protected function _getMockFindQuery($table = null) <ide> ->method('all') <ide> ->will($this->returnValue($results)); <ide> <del> $query->expects($this->any()) <del> ->method('count') <del> ->will($this->returnValue(2)); <del> <ide> if ($table) { <ide> $query->repository($table); <ide> } <ide><path>tests/TestCase/Datasource/SimplePaginatorTest.php <add><?php <add>/** <add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <add> * @link http://cakephp.org CakePHP(tm) Project <add> * @since 3.5.0 <add> * @license http://www.opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Test\TestCase\Datasource; <add> <add>use Cake\Core\Configure; <add>use Cake\Datasource\SimplePaginator; <add>use Cake\ORM\Entity; <add> <add>class SimplePaginatorTest extends PaginatorTest <add>{ <add> public function setUp() <add> { <add> parent::setUp(); <add> <add> Configure::write('App.namespace', 'TestApp'); <add> <add> $this->Paginator = new SimplePaginator(); <add> <add> $this->Post = $this->getMockRepository(); <add> } <add> <add> /** <add> * test paginate() and custom find, to make sure the correct count is returned. <add> * <add> * @return void <add> */ <add> public function testPaginateCustomFind() <add> { <add> $this->loadFixtures('Posts'); <add> $titleExtractor = function ($result) { <add> $ids = []; <add> foreach ($result as $record) { <add> $ids[] = $record->title; <add> } <add> <add> return $ids; <add> }; <add> <add> $table = $this->getTableLocator()->get('PaginatorPosts'); <add> $data = ['author_id' => 3, 'title' => 'Fourth Post', 'body' => 'Article Body, unpublished', 'published' => 'N']; <add> $result = $table->save(new Entity($data)); <add> $this->assertNotEmpty($result); <add> <add> $result = $this->Paginator->paginate($table); <add> $this->assertCount(4, $result, '4 rows should come back'); <add> $this->assertEquals(['First Post', 'Second Post', 'Third Post', 'Fourth Post'], $titleExtractor($result)); <add> <add> $pagingParams = $this->Paginator->getPagingParams(); <add> $this->assertEquals(4, $pagingParams['PaginatorPosts']['current']); <add> $this->assertNull($pagingParams['PaginatorPosts']['count']); <add> <add> $settings = ['finder' => 'published']; <add> $result = $this->Paginator->paginate($table, [], $settings); <add> $this->assertCount(3, $result, '3 rows should come back'); <add> $this->assertEquals(['First Post', 'Second Post', 'Third Post'], $titleExtractor($result)); <add> <add> $pagingParams = $this->Paginator->getPagingParams(); <add> $this->assertEquals(3, $pagingParams['PaginatorPosts']['current']); <add> $this->assertNull($pagingParams['PaginatorPosts']['count']); <add> <add> $settings = ['finder' => 'published', 'limit' => 2, 'page' => 2]; <add> $result = $this->Paginator->paginate($table, [], $settings); <add> $this->assertCount(1, $result, '1 rows should come back'); <add> $this->assertEquals(['Third Post'], $titleExtractor($result)); <add> <add> $pagingParams = $this->Paginator->getPagingParams(); <add> $this->assertEquals(1, $pagingParams['PaginatorPosts']['current']); <add> $this->assertNull($pagingParams['PaginatorPosts']['count']); <add> $this->assertSame(0, $pagingParams['PaginatorPosts']['pageCount']); <add> <add> $settings = ['finder' => 'published', 'limit' => 2]; <add> $result = $this->Paginator->paginate($table, [], $settings); <add> $this->assertCount(2, $result, '2 rows should come back'); <add> $this->assertEquals(['First Post', 'Second Post'], $titleExtractor($result)); <add> <add> $pagingParams = $this->Paginator->getPagingParams(); <add> $this->assertEquals(2, $pagingParams['PaginatorPosts']['current']); <add> $this->assertNull($pagingParams['PaginatorPosts']['count']); <add> $this->assertEquals(0, $pagingParams['PaginatorPosts']['pageCount']); <add> $this->assertTrue($pagingParams['PaginatorPosts']['nextPage']); <add> $this->assertFalse($pagingParams['PaginatorPosts']['prevPage']); <add> $this->assertEquals(2, $pagingParams['PaginatorPosts']['perPage']); <add> $this->assertNull($pagingParams['PaginatorPosts']['limit']); <add> } <add> <add> /** <add> * test paginate() and custom find with fields array, to make sure the correct count is returned. <add> * <add> * @return void <add> */ <add> public function testPaginateCustomFindFieldsArray() <add> { <add> $this->loadFixtures('Posts'); <add> $table = $this->getTableLocator()->get('PaginatorPosts'); <add> $data = ['author_id' => 3, 'title' => 'Fourth Article', 'body' => 'Article Body, unpublished', 'published' => 'N']; <add> $table->save(new Entity($data)); <add> <add> $settings = [ <add> 'finder' => 'list', <add> 'conditions' => ['PaginatorPosts.published' => 'Y'], <add> 'limit' => 2 <add> ]; <add> $results = $this->Paginator->paginate($table, [], $settings); <add> <add> $result = $results->toArray(); <add> $expected = [ <add> 1 => 'First Post', <add> 2 => 'Second Post', <add> ]; <add> $this->assertEquals($expected, $result); <add> <add> $result = $this->Paginator->getPagingParams()['PaginatorPosts']; <add> $this->assertEquals(2, $result['current']); <add> $this->assertNull($result['count']); <add> $this->assertEquals(0, $result['pageCount']); <add> $this->assertTrue($result['nextPage']); <add> $this->assertFalse($result['prevPage']); <add> } <add> <add> /** <add> * Test that special paginate types are called and that the type param doesn't leak out into defaults or options. <add> * <add> * @return void <add> */ <add> public function testPaginateCustomFinder() <add> { <add> $settings = [ <add> 'PaginatorPosts' => [ <add> 'finder' => 'published', <add> 'fields' => ['id', 'title'], <add> 'maxLimit' => 10, <add> ] <add> ]; <add> <add> $this->loadFixtures('Posts'); <add> $table = $this->getTableLocator()->get('PaginatorPosts'); <add> $table->updateAll(['published' => 'N'], ['id' => 2]); <add> <add> $this->Paginator->paginate($table, [], $settings); <add> $pagingParams = $this->Paginator->getPagingParams(); <add> $this->assertSame('published', $pagingParams['PaginatorPosts']['finder']); <add> <add> $this->assertSame(1, $pagingParams['PaginatorPosts']['start']); <add> $this->assertSame(2, $pagingParams['PaginatorPosts']['end']); <add> // nextPage will be always true for SimplePaginator <add> $this->assertTrue($pagingParams['PaginatorPosts']['nextPage']); <add> } <add>}
4
Ruby
Ruby
remove unneeded requires
bf7b8c193ffe2d6a05272a6ed763d87cfe743bb4
<ide><path>actionmailer/lib/action_mailer/message_delivery.rb <ide> require 'delegate' <del>require 'active_support/core_ext/string/filters' <ide> <ide> module ActionMailer <ide> <ide><path>actionpack/lib/action_dispatch/http/response.rb <ide> require 'active_support/core_ext/module/attribute_accessors' <del>require 'active_support/core_ext/string/filters' <ide> require 'action_dispatch/http/filter_redirect' <ide> require 'monitor' <ide> <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb <ide> require 'active_support/core_ext/enumerable' <ide> require 'active_support/core_ext/array/extract_options' <ide> require 'active_support/core_ext/module/remove_method' <del>require 'active_support/core_ext/string/filters' <ide> require 'active_support/inflector' <ide> require 'action_dispatch/routing/redirection' <ide> require 'action_dispatch/routing/endpoint' <ide><path>actionpack/lib/action_dispatch/routing/route_set.rb <ide> require 'active_support/core_ext/hash/slice' <ide> require 'active_support/core_ext/module/remove_method' <ide> require 'active_support/core_ext/array/extract_options' <del>require 'active_support/core_ext/string/filters' <ide> require 'action_controller/metal/exceptions' <ide> require 'action_dispatch/http/request' <ide> require 'action_dispatch/routing/endpoint' <ide><path>actionview/lib/action_view/template/resolver.rb <ide> require "pathname" <ide> require "active_support/core_ext/class" <ide> require "active_support/core_ext/module/attribute_accessors" <del>require 'active_support/core_ext/string/filters' <ide> require "action_view/template" <ide> require "thread" <ide> require "thread_safe" <ide><path>activemodel/lib/active_model/dirty.rb <ide> require 'active_support/hash_with_indifferent_access' <ide> require 'active_support/core_ext/object/duplicable' <del>require 'active_support/core_ext/string/filters' <ide> <ide> module ActiveModel <ide> # == Active \Model \Dirty <ide><path>activerecord/lib/active_record/associations/has_many_through_association.rb <del>require 'active_support/core_ext/string/filters' <del> <ide> module ActiveRecord <ide> # = Active Record Has Many Through Association <ide> module Associations <ide><path>activerecord/lib/active_record/attribute_methods/serialization.rb <del>require 'active_support/core_ext/string/filters' <del> <ide> module ActiveRecord <ide> module AttributeMethods <ide> module Serialization <ide><path>activerecord/lib/active_record/relation/predicate_builder/array_handler.rb <del>require 'active_support/core_ext/string/filters' <del> <ide> module ActiveRecord <ide> class PredicateBuilder <ide> class ArrayHandler # :nodoc:
9
Python
Python
fix imports for all namespace packages
9016fe192fdd3121b6cb20eafeed2dd9154848eb
<ide><path>ciphers/affine_cipher.py <ide> import random <ide> import sys <ide> <del>import cryptomath_module as cryptomath <add>from . import cryptomath_module as cryptomath <ide> <ide> SYMBOLS = ( <ide> r""" !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`""" <ide><path>ciphers/elgamal_key_generator.py <ide> import random <ide> import sys <ide> <del>import cryptomath_module as cryptoMath <del>import rabin_miller as rabinMiller <add>from . import cryptomath_module as cryptoMath <add>from . import rabin_miller as rabinMiller <ide> <ide> min_primitive_root = 3 <ide> <ide><path>ciphers/rsa_cipher.py <ide> import os <ide> import sys <ide> <del>import rsa_key_generator as rkg <add>from . import rsa_key_generator as rkg <ide> <ide> DEFAULT_BLOCK_SIZE = 128 <ide> BYTE_SIZE = 256 <ide><path>ciphers/rsa_key_generator.py <ide> import random <ide> import sys <ide> <del>import cryptomath_module as cryptoMath <del>import rabin_miller as rabinMiller <add>from . import cryptomath_module as cryptoMath <add>from . import rabin_miller as rabinMiller <ide> <ide> <ide> def main(): <ide><path>ciphers/transposition_cipher_encrypt_decrypt_file.py <ide> import sys <ide> import time <ide> <del>import transposition_cipher as transCipher <add>from . import transposition_cipher as transCipher <ide> <ide> <ide> def main(): <ide><path>data_structures/hashing/double_hash.py <ide> #!/usr/bin/env python3 <del>from hash_table import HashTable <del>from number_theory.prime_numbers import check_prime, next_prime <add>from .hash_table import HashTable <add>from .number_theory.prime_numbers import check_prime, next_prime <ide> <ide> <ide> class DoubleHash(HashTable): <ide><path>data_structures/hashing/hash_table.py <ide> #!/usr/bin/env python3 <del>from number_theory.prime_numbers import next_prime <add>from .number_theory.prime_numbers import next_prime <ide> <ide> <ide> class HashTable: <ide><path>data_structures/hashing/hash_table_with_linked_list.py <ide> from collections import deque <ide> <del>from hash_table import HashTable <add>from .hash_table import HashTable <ide> <ide> <ide> class HashTableWithLinkedList(HashTable): <ide><path>data_structures/hashing/quadratic_probing.py <ide> #!/usr/bin/env python3 <ide> <del>from hash_table import HashTable <add>from .hash_table import HashTable <ide> <ide> <ide> class QuadraticProbing(HashTable): <ide><path>data_structures/linked_list/deque_doubly.py <ide> def remove_first(self): <ide> ... <ide> IndexError: remove_first from empty list <ide> >>> d.add_first('A') # doctest: +ELLIPSIS <del> <linked_list.deque_doubly.LinkedDeque object at ... <add> <data_structures.linked_list.deque_doubly.LinkedDeque object at ... <ide> >>> d.remove_first() <ide> 'A' <ide> >>> d.is_empty() <ide> def remove_last(self): <ide> ... <ide> IndexError: remove_first from empty list <ide> >>> d.add_first('A') # doctest: +ELLIPSIS <del> <linked_list.deque_doubly.LinkedDeque object at ... <add> <data_structures.linked_list.deque_doubly.LinkedDeque object at ... <ide> >>> d.remove_last() <ide> 'A' <ide> >>> d.is_empty() <ide><path>data_structures/queue/circular_queue.py <ide> def __len__(self) -> int: <ide> >>> len(cq) <ide> 0 <ide> >>> cq.enqueue("A") # doctest: +ELLIPSIS <del> <circular_queue.CircularQueue object at ... <add> <data_structures.queue.circular_queue.CircularQueue object at ... <ide> >>> len(cq) <ide> 1 <ide> """ <ide> def enqueue(self, data): <ide> This function insert an element in the queue using self.rear value as an index <ide> >>> cq = CircularQueue(5) <ide> >>> cq.enqueue("A") # doctest: +ELLIPSIS <del> <circular_queue.CircularQueue object at ... <add> <data_structures.queue.circular_queue.CircularQueue object at ... <ide> >>> (cq.size, cq.first()) <ide> (1, 'A') <ide> >>> cq.enqueue("B") # doctest: +ELLIPSIS <del> <circular_queue.CircularQueue object at ... <add> <data_structures.queue.circular_queue.CircularQueue object at ... <ide> >>> (cq.size, cq.first()) <ide> (2, 'A') <ide> """ <ide><path>data_structures/queue/priority_queue_using_list.py <ide> class FixedPriorityQueue: <ide> >>> fpq.dequeue() <ide> Traceback (most recent call last): <ide> ... <del> priority_queue_using_list.UnderFlowError: All queues are empty <add> data_structures.queue.priority_queue_using_list.UnderFlowError: All queues are empty <ide> >>> print(fpq) <ide> Priority 0: [] <ide> Priority 1: [] <ide> class ElementPriorityQueue: <ide> >>> epq.dequeue() <ide> Traceback (most recent call last): <ide> ... <del> priority_queue_using_list.UnderFlowError: The queue is empty <add> data_structures.queue.priority_queue_using_list.UnderFlowError: The queue is empty <ide> >>> print(epq) <ide> [] <ide> """ <ide><path>geodesy/lamberts_ellipsoidal_distance.py <ide> from math import atan, cos, radians, sin, tan <ide> <del>from haversine_distance import haversine_distance <add>from .haversine_distance import haversine_distance <ide> <ide> <ide> def lamberts_ellipsoidal_distance( <ide><path>greedy_method/test_knapsack.py <ide> import unittest <ide> <del>import greedy_knapsack as kp <add>from . import greedy_knapsack as kp <ide> <ide> <ide> class TestClass(unittest.TestCase): <ide><path>linear_algebra/src/test_linear_algebra.py <ide> """ <ide> import unittest <ide> <del>from lib import Matrix, Vector, axpy, squareZeroMatrix, unitBasisVector, zeroVector <add>from .lib import Matrix, Vector, axpy, squareZeroMatrix, unitBasisVector, zeroVector <ide> <ide> <ide> class Test(unittest.TestCase): <ide><path>scripts/validate_filenames.py <ide> #!/usr/bin/env python3 <ide> import os <ide> <del>from build_directory_md import good_file_paths <add>try: <add> from .build_directory_md import good_file_paths <add>except ImportError: <add> from build_directory_md import good_file_paths <ide> <ide> filepaths = list(good_file_paths()) <ide> assert filepaths, "good_file_paths() failed!" <ide><path>searches/simulated_annealing.py <ide> import math <ide> import random <ide> <del>from hill_climbing import SearchProblem <add>from .hill_climbing import SearchProblem <ide> <ide> <ide> def simulated_annealing(
17
Javascript
Javascript
add a build step to hoist warning conditions
1c2876d5b558b8591feb335d8d7204bc46f7da8a
<add><path>scripts/babel/__tests__/wrap-warning-with-env-check-test.js <del><path>scripts/rollup/plugins/__tests__/wrap-warning-with-env-check-test.js <ide> describe('wrap-warning-with-env-check', () => { <ide> it('should wrap warning calls', () => { <ide> compare( <ide> "warning(condition, 'a %s b', 'c');", <del> "__DEV__ ? warning(condition, 'a %s b', 'c') : void 0;" <add> "__DEV__ ? !condition ? warning(false, 'a %s b', 'c') : void 0 : void 0;" <ide> ); <ide> }); <ide> <add><path>scripts/babel/wrap-warning-with-env-check.js <del><path>scripts/rollup/plugins/wrap-warning-with-env-check.js <ide> module.exports = function(babel, options) { <ide> } <ide> <ide> if (path.get('callee').isIdentifier({name: 'warning'})) { <del> node[SEEN_SYMBOL] = true; <del> <ide> // Turns this code: <ide> // <ide> // warning(condition, argument, argument); <ide> // <ide> // into this: <ide> // <ide> // if (__DEV__) { <del> // warning(condition, argument, argument); <add> // if (!condition) { <add> // warning(false, argument, argument); <add> // } <ide> // } <ide> // <del> // The goal is to strip out warning calls entirely in production. <add> // The goal is to strip out warning calls entirely in production <add> // and to avoid evaluating the arguments in development. <add> const condition = node.arguments[0]; <add> const newNode = t.callExpression( <add> node.callee, <add> [t.booleanLiteral(false)].concat(node.arguments.slice(1)) <add> ); <add> newNode[SEEN_SYMBOL] = true; <ide> path.replaceWith( <ide> t.ifStatement( <ide> DEV_EXPRESSION, <del> t.blockStatement([t.expressionStatement(node)]) <add> t.blockStatement([ <add> t.ifStatement( <add> t.unaryExpression('!', condition), <add> t.expressionStatement(newNode) <add> ), <add> ]) <ide> ) <ide> ); <ide> } <ide><path>scripts/jest/preprocessor.js <ide> const pathToBabel = path.join( <ide> const pathToBabelPluginDevWithCode = require.resolve( <ide> '../error-codes/replace-invariant-error-codes' <ide> ); <add>const pathToBabelPluginWrapWarning = require.resolve( <add> '../babel/wrap-warning-with-env-check' <add>); <ide> const pathToBabelPluginAsyncToGenerator = require.resolve( <ide> 'babel-plugin-transform-async-to-generator' <ide> ); <ide> const babelOptions = { <ide> require.resolve('babel-plugin-transform-es2015-modules-commonjs'), <ide> <ide> pathToBabelPluginDevWithCode, <add> pathToBabelPluginWrapWarning, <add> <ide> // Keep stacks detailed in tests. <ide> // Don't put this in .babelrc so that we don't embed filenames <ide> // into ReactART builds that include JSX. <ide> module.exports = { <ide> pathToBabel, <ide> pathToBabelrc, <ide> pathToBabelPluginDevWithCode, <add> pathToBabelPluginWrapWarning, <ide> pathToErrorCodes, <ide> ]), <ide> }; <ide><path>scripts/rollup/build.js <ide> function getBabelConfig(updateBabelOptions, bundleType, filename) { <ide> return Object.assign({}, options, { <ide> plugins: options.plugins.concat([ <ide> // Wrap warning() calls in a __DEV__ check so they are stripped from production. <del> require('./plugins/wrap-warning-with-env-check'), <add> require('../babel/wrap-warning-with-env-check'), <ide> ]), <ide> }); <ide> case UMD_DEV: <ide> function getBabelConfig(updateBabelOptions, bundleType, filename) { <ide> // Minify invariant messages <ide> require('../error-codes/replace-invariant-error-codes'), <ide> // Wrap warning() calls in a __DEV__ check so they are stripped from production. <del> require('./plugins/wrap-warning-with-env-check'), <add> require('../babel/wrap-warning-with-env-check'), <ide> ]), <ide> }); <ide> default:
4
PHP
PHP
check ob_get_level() before ob_flush()
1f4402cd4c448571af68b9b694729f29f9ba45f0
<ide><path>lib/Cake/Network/CakeResponse.php <ide> protected function _clearBuffer() { <ide> protected function _flushBuffer() { <ide> //@codingStandardsIgnoreStart <ide> @flush(); <del> @ob_flush(); <add> if (ob_get_level()) { <add> @ob_flush(); <add> } <ide> //@codingStandardsIgnoreEnd <ide> } <ide>
1
Go
Go
ensure run instruction to run without healthcheck
44e08d8a7d1249a1956018c6c3d3655642a4f273
<ide><path>builder/dockerfile/dispatchers.go <ide> func dispatchRun(d dispatchRequest, c *instructions.RunCommand) error { <ide> runConfig := copyRunConfig(stateRunConfig, <ide> withCmd(cmdFromArgs), <ide> withEnv(append(stateRunConfig.Env, buildArgs...)), <del> withEntrypointOverride(saveCmd, strslice.StrSlice{""})) <add> withEntrypointOverride(saveCmd, strslice.StrSlice{""}), <add> withoutHealthcheck()) <ide> <ide> // set config as already being escaped, this prevents double escaping on windows <ide> runConfig.ArgsEscaped = true <ide><path>builder/dockerfile/dispatchers_test.go <ide> func TestRunWithBuildArgs(t *testing.T) { <ide> // Check that runConfig.Cmd has not been modified by run <ide> assert.Check(t, is.DeepEqual(origCmd, sb.state.runConfig.Cmd)) <ide> } <add> <add>func TestRunIgnoresHealthcheck(t *testing.T) { <add> b := newBuilderWithMockBackend() <add> args := NewBuildArgs(make(map[string]*string)) <add> sb := newDispatchRequest(b, '`', nil, args, newStagesBuildResults()) <add> b.disableCommit = false <add> <add> origCmd := strslice.StrSlice([]string{"cmd", "in", "from", "image"}) <add> <add> imageCache := &mockImageCache{ <add> getCacheFunc: func(parentID string, cfg *container.Config) (string, error) { <add> return "", nil <add> }, <add> } <add> <add> mockBackend := b.docker.(*MockBackend) <add> mockBackend.makeImageCacheFunc = func(_ []string) builder.ImageCache { <add> return imageCache <add> } <add> b.imageProber = newImageProber(mockBackend, nil, false) <add> mockBackend.getImageFunc = func(_ string) (builder.Image, builder.ROLayer, error) { <add> return &mockImage{ <add> id: "abcdef", <add> config: &container.Config{Cmd: origCmd}, <add> }, nil, nil <add> } <add> mockBackend.containerCreateFunc = func(config types.ContainerCreateConfig) (container.ContainerCreateCreatedBody, error) { <add> return container.ContainerCreateCreatedBody{ID: "12345"}, nil <add> } <add> mockBackend.commitFunc = func(cfg backend.CommitConfig) (image.ID, error) { <add> return "", nil <add> } <add> from := &instructions.Stage{BaseName: "abcdef"} <add> err := initializeStage(sb, from) <add> assert.NilError(t, err) <add> <add> expectedTest := []string{"CMD-SHELL", "curl -f http://localhost/ || exit 1"} <add> cmd := &instructions.HealthCheckCommand{ <add> Health: &container.HealthConfig{ <add> Test: expectedTest, <add> }, <add> } <add> assert.NilError(t, dispatch(sb, cmd)) <add> assert.Assert(t, sb.state.runConfig.Healthcheck != nil) <add> <add> mockBackend.containerCreateFunc = func(config types.ContainerCreateConfig) (container.ContainerCreateCreatedBody, error) { <add> // Check the Healthcheck is disabled. <add> assert.Check(t, is.DeepEqual([]string{"NONE"}, config.Config.Healthcheck.Test)) <add> return container.ContainerCreateCreatedBody{ID: "123456"}, nil <add> } <add> <add> sb.state.buildArgs.AddArg("one", strPtr("two")) <add> run := &instructions.RunCommand{ <add> ShellDependantCmdLine: instructions.ShellDependantCmdLine{ <add> CmdLine: strslice.StrSlice{"echo foo"}, <add> PrependShell: true, <add> }, <add> } <add> assert.NilError(t, dispatch(sb, run)) <add> assert.Check(t, is.DeepEqual(expectedTest, sb.state.runConfig.Healthcheck.Test)) <add>} <ide><path>builder/dockerfile/internals.go <ide> func withEntrypointOverride(cmd []string, entrypoint []string) runConfigModifier <ide> } <ide> } <ide> <add>// withoutHealthcheck disables healthcheck. <add>// <add>// The dockerfile RUN instruction expect to run without healthcheck <add>// so the runConfig Healthcheck needs to be disabled. <add>func withoutHealthcheck() runConfigModifier { <add> return func(runConfig *container.Config) { <add> runConfig.Healthcheck = &container.HealthConfig{ <add> Test: []string{"NONE"}, <add> } <add> } <add>} <add> <ide> func copyRunConfig(runConfig *container.Config, modifiers ...runConfigModifier) *container.Config { <ide> copy := *runConfig <ide> copy.Cmd = copyStringSlice(runConfig.Cmd)
3
PHP
PHP
add starts with validation
5f6d9a431c4fcedcbae969ba95d266604be54060
<ide><path>src/Illuminate/Validation/Concerns/ValidatesAttributes.php <ide> public function validateSometimes() <ide> return true; <ide> } <ide> <add> /** <add> * Validate the attribute starts with a given substring. <add> * <add> * @param string $attribute <add> * @param mixed $value <add> * @param array $parameters <add> * @return bool <add> */ <add> public function validateStartsWith($attribute, $value, $parameters) <add> { <add> return Str::startsWith($value, $parameters); <add> } <add> <ide> /** <ide> * Validate that an attribute is a string. <ide> * <ide><path>tests/Validation/ValidationValidatorTest.php <ide> public function testValidateAccepted() <ide> $this->assertTrue($v->passes()); <ide> } <ide> <add> public function testValidateStartsWith() <add> { <add> $trans = $this->getIlluminateArrayTranslator(); <add> $v = new Validator($trans, ['x' => 'hello world'], ['x' => 'starts_with:hello']); <add> $this->assertTrue($v->passes()); <add> <add> $trans = $this->getIlluminateArrayTranslator(); <add> $v = new Validator($trans, ['x' => 'hello world'], ['x' => 'starts_with:world']); <add> $this->assertFalse($v->passes()); <add> <add> $trans = $this->getIlluminateArrayTranslator(); <add> $v = new Validator($trans, ['x' => 'hello world'], ['x' => 'starts_with:world,hello']); <add> $this->assertTrue($v->passes()); <add> } <add> <ide> public function testValidateString() <ide> { <ide> $trans = $this->getIlluminateArrayTranslator();
2
Python
Python
fix compatibility for newer tensorflow and python3
cbd8136fb3e55373581651d350a8b7c724cff42f
<ide><path>research/adversarial_text/data/data_utils.py <ide> def sort_vocab_by_frequency(vocab_freq_map): <ide> def write_vocab_and_frequency(ordered_vocab_freqs, output_dir): <ide> """Writes ordered_vocab_freqs into vocab.txt and vocab_freq.txt.""" <ide> tf.gfile.MakeDirs(output_dir) <del> with open(os.path.join(output_dir, 'vocab.txt'), 'w') as vocab_f: <del> with open(os.path.join(output_dir, 'vocab_freq.txt'), 'w') as freq_f: <add> with open(os.path.join(output_dir, 'vocab.txt'), 'w', encoding='utf-8') as vocab_f: <add> with open(os.path.join(output_dir, 'vocab_freq.txt'), 'w', encoding='utf-8') as freq_f: <ide> for word, freq in ordered_vocab_freqs: <ide> vocab_f.write('{}\n'.format(word)) <ide> freq_f.write('{}\n'.format(freq)) <ide><path>research/adversarial_text/data/document_generators.py <ide> def check_is_validation(filename, class_label): <ide> if is_validation and not include_validation: <ide> continue <ide> <del> with open(os.path.join(FLAGS.imdb_input_dir, d, filename)) as imdb_f: <add> with open(os.path.join(FLAGS.imdb_input_dir, d, filename), encoding='utf-8') as imdb_f: <ide> content = imdb_f.read() <ide> yield Document( <ide> content=content, <ide> def check_is_validation(filename, class_label): <ide> add_tokens=True) <ide> <ide> if FLAGS.amazon_unlabeled_input_file and include_unlabeled: <del> with open(FLAGS.amazon_unlabeled_input_file) as rt_f: <add> with open(FLAGS.amazon_unlabeled_input_file, encoding='utf-8') as rt_f: <ide> for content in rt_f: <ide> yield Document( <ide> content=content, <ide><path>research/adversarial_text/gen_data.py <ide> def make_vocab_ids(vocab_filename): <ide> ret[data.EOS_TOKEN] = len(string.printable) <ide> return ret <ide> else: <del> with open(vocab_filename) as vocab_f: <add> with open(vocab_filename, encoding='utf-8') as vocab_f: <ide> return dict([(line.strip(), i) for i, line in enumerate(vocab_f)]) <ide> <ide> <ide><path>research/adversarial_text/layers.py <ide> def build(self, input_shape): <ide> self.var = self.add_weight( <ide> shape=(self.vocab_size, self.embedding_dim), <ide> initializer=tf.random_uniform_initializer(-1., 1.), <del> name='embedding') <add> name='embedding', <add> dtype=tf.float32) <ide> <ide> if self.normalized: <ide> self.var = self._normalize(self.var) <ide> def __init__(self, <ide> self.multiclass_dense_layer = K.layers.Dense(self.vocab_size) <ide> <ide> def build(self, input_shape): <del> input_shape = input_shape[0] <add> input_shape = input_shape[0].as_list() <ide> with tf.device('/cpu:0'): <ide> self.lin_w = self.add_weight( <ide> shape=(input_shape[-1], self.vocab_size), <ide> def optimize(loss, <ide> ne_grads, _ = tf.clip_by_global_norm(ne_grads, max_grad_norm) <ide> non_embedding_grads_and_vars = zip(ne_grads, ne_vars) <ide> <del> grads_and_vars = embedding_grads_and_vars + non_embedding_grads_and_vars <add> grads_and_vars = embedding_grads_and_vars + list(non_embedding_grads_and_vars) <ide> <ide> # Summarize <ide> _summarize_vars_and_grads(grads_and_vars)
4
Text
Text
transform comma into period
be304ec688e080ae6fe4c58bcc7d0f662bb240dc
<ide><path>CONTRIBUTING.md <ide> The Docker maintainers take security seriously. If you discover a security <ide> issue, please bring it to their attention right away! <ide> <ide> Please **DO NOT** file a public issue, instead send your report privately to <del>[[email protected]](mailto:[email protected]), <add>[[email protected]](mailto:[email protected]). <ide> <ide> Security reports are greatly appreciated and we will publicly thank you for it. <ide> We also like to send gifts&mdash;if you're into Docker schwag, make sure to let
1
Text
Text
change the "degree" to degree sign(°)
3c925cf2a6ab04c2754e4878eb03a88e8852b8c7
<ide><path>guide/english/mathematics/area-of-a-triangle/index.md <ide> Sin - The sine trigonometric expression. <ide> <ide> 2. If two sides of a triangle are known to be 3 and 6, and the angle between them is 30 degrees, what is the angle of the triangle? <ide> <del> Area = 0.5 x 3 x 6 x sin(30 degrees) = 4.5 units<sup>2</sup> <add> Area = 0.5 x 3 x 6 x sin 30° = 4.5 units<sup>2</sup> <ide> <ide> #### More Information: <ide> <!-- Please add any articles you think might be helpful to read before writing the article -->
1
Python
Python
add type check to axis
8e9d1c54552ca7350ff092544d265b1bf6f1eecf
<ide><path>keras/losses.py <ide> from tensorflow.python.util import dispatch <ide> from tensorflow.python.util.tf_export import keras_export <ide> from tensorflow.tools.docs import doc_controls <del>from tensorflow.python.ops import check_ops <ide> <ide> <ide> @keras_export('keras.losses.Loss') <ide> def categorical_crossentropy(y_true, <ide> Returns: <ide> Categorical crossentropy loss value. <ide> """ <del> #axis assert <del> check_ops.assert_integer_v2(int(axis), message=('`axis` must be of type `int`.')) <add> axis = int(axis) <ide> y_pred = tf.convert_to_tensor(y_pred) <ide> y_true = tf.cast(y_true, y_pred.dtype) <ide> label_smoothing = tf.convert_to_tensor(label_smoothing, dtype=y_pred.dtype)
1
Ruby
Ruby
rescue more errors during `cask upgrade`
fbf4b0432d18e48b3b611b135e9b2e177e4e958d
<ide><path>Library/Homebrew/cask/cmd/upgrade.rb <ide> def run <ide> <ide> upgradable_casks.each do |(old_cask, new_cask)| <ide> upgrade_cask(old_cask, new_cask) <del> rescue CaskError => e <add> rescue => e <ide> caught_exceptions << e <ide> next <ide> end <ide> def upgrade_cask(old_cask, new_cask) <ide> <ide> # If successful, wipe the old Cask from staging <ide> old_cask_installer.finalize_upgrade <del> rescue CaskError => e <add> rescue => e <ide> new_cask_installer.uninstall_artifacts if new_artifacts_installed <ide> new_cask_installer.purge_versioned_files <ide> old_cask_installer.revert_upgrade if started_upgrade
1
Javascript
Javascript
remove proptypes from modal.js
6b892141cc77e87e9ed28b7ba21a63ce35d7937e
<ide><path>Libraries/Modal/Modal.js <ide> const ModalEventEmitter = <ide> : null; <ide> <ide> import type EmitterSubscription from 'EmitterSubscription'; <add>import type {ViewProps} from 'ViewPropTypes'; <add>import type {SyntheticEvent} from 'CoreEventTypes'; <ide> <ide> /** <ide> * The Modal component is a simple way to present content above an enclosing view. <ide> import type EmitterSubscription from 'EmitterSubscription'; <ide> // destroyed before the callback is fired. <ide> let uniqueModalIdentifier = 0; <ide> <del>class Modal extends React.Component<Object> { <del> static propTypes = { <del> /** <del> * The `animationType` prop controls how the modal animates. <del> * <del> * See https://facebook.github.io/react-native/docs/modal.html#animationtype <del> */ <del> animationType: PropTypes.oneOf(['none', 'slide', 'fade']), <del> /** <del> * The `presentationStyle` prop controls how the modal appears. <del> * <del> * See https://facebook.github.io/react-native/docs/modal.html#presentationstyle <del> */ <del> presentationStyle: PropTypes.oneOf([ <del> 'fullScreen', <del> 'pageSheet', <del> 'formSheet', <del> 'overFullScreen', <del> ]), <del> /** <del> * The `transparent` prop determines whether your modal will fill the <del> * entire view. <del> * <del> * See https://facebook.github.io/react-native/docs/modal.html#transparent <del> */ <del> transparent: PropTypes.bool, <del> /** <del> * The `hardwareAccelerated` prop controls whether to force hardware <del> * acceleration for the underlying window. <del> * <del> * See https://facebook.github.io/react-native/docs/modal.html#hardwareaccelerated <del> */ <del> hardwareAccelerated: PropTypes.bool, <del> /** <del> * The `visible` prop determines whether your modal is visible. <del> * <del> * See https://facebook.github.io/react-native/docs/modal.html#visible <del> */ <del> visible: PropTypes.bool, <del> /** <del> * The `onRequestClose` callback is called when the user taps the hardware <del> * back button on Android or the menu button on Apple TV. <del> * <del> * See https://facebook.github.io/react-native/docs/modal.html#onrequestclose <del> */ <del> onRequestClose: <del> Platform.isTV || Platform.OS === 'android' <del> ? PropTypes.func.isRequired <del> : PropTypes.func, <del> /** <del> * The `onShow` prop allows passing a function that will be called once the <del> * modal has been shown. <del> * <del> * See https://facebook.github.io/react-native/docs/modal.html#onshow <del> */ <del> onShow: PropTypes.func, <del> /** <del> * The `onDismiss` prop allows passing a function that will be called once <del> * the modal has been dismissed. <del> * <del> * See https://facebook.github.io/react-native/docs/modal.html#ondismiss <del> */ <del> onDismiss: PropTypes.func, <del> animated: deprecatedPropType( <del> PropTypes.bool, <del> 'Use the `animationType` prop instead.', <del> ), <del> /** <del> * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations. <del> * <del> * See https://facebook.github.io/react-native/docs/modal.html#supportedorientations <del> */ <del> supportedOrientations: PropTypes.arrayOf( <del> PropTypes.oneOf([ <del> 'portrait', <del> 'portrait-upside-down', <del> 'landscape', <del> 'landscape-left', <del> 'landscape-right', <del> ]), <del> ), <del> /** <del> * The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed. <del> * <del> * See https://facebook.github.io/react-native/docs/modal.html#onorientationchange <del> */ <del> onOrientationChange: PropTypes.func, <del> }; <add>type OrientationChangeEvent = SyntheticEvent< <add> $ReadOnly<{| <add> orientation: 'portrait' | 'landscape', <add> |}>, <add>>; <add> <add>type Props = $ReadOnly<{| <add> ...ViewProps, <add> <add> /** <add> * The `animationType` prop controls how the modal animates. <add> * <add> * See https://facebook.github.io/react-native/docs/modal.html#animationtype <add> */ <add> animationType?: ?('none' | 'slide' | 'fade'), <add> <add> /** <add> * The `presentationStyle` prop controls how the modal appears. <add> * <add> * See https://facebook.github.io/react-native/docs/modal.html#presentationstyle <add> */ <add> presentationStyle?: ?( <add> | 'fullScreen' <add> | 'pageSheet' <add> | 'formSheet' <add> | 'overFullScreen' <add> ), <add> <add> /** <add> * The `transparent` prop determines whether your modal will fill the <add> * entire view. <add> * <add> * See https://facebook.github.io/react-native/docs/modal.html#transparent <add> */ <add> transparent?: ?boolean, <add> <add> /** <add> * The `hardwareAccelerated` prop controls whether to force hardware <add> * acceleration for the underlying window. <add> * <add> * See https://facebook.github.io/react-native/docs/modal.html#hardwareaccelerated <add> */ <add> hardwareAccelerated?: ?boolean, <add> <add> /** <add> * The `visible` prop determines whether your modal is visible. <add> * <add> * See https://facebook.github.io/react-native/docs/modal.html#visible <add> */ <add> visible?: ?boolean, <add> <add> /** <add> * The `onRequestClose` callback is called when the user taps the hardware <add> * back button on Android or the menu button on Apple TV. <add> * <add> * This is required on Apple TV and Android. <add> * <add> * See https://facebook.github.io/react-native/docs/modal.html#onrequestclose <add> */ <add> onRequestClose?: ?(event?: SyntheticEvent<null>) => mixed, <add> <add> /** <add> * The `onShow` prop allows passing a function that will be called once the <add> * modal has been shown. <add> * <add> * See https://facebook.github.io/react-native/docs/modal.html#onshow <add> */ <add> onShow?: ?(event?: SyntheticEvent<null>) => mixed, <add> <add> /** <add> * The `onDismiss` prop allows passing a function that will be called once <add> * the modal has been dismissed. <add> * <add> * See https://facebook.github.io/react-native/docs/modal.html#ondismiss <add> */ <add> onDismiss?: ?() => mixed, <add> <add> /** <add> * Deprecated. Use the `animationType` prop instead. <add> */ <add> animated?: ?boolean, <add> <add> /** <add> * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations. <add> * <add> * See https://facebook.github.io/react-native/docs/modal.html#supportedorientations <add> */ <add> supportedOrientations?: ?$ReadOnlyArray< <add> | 'portrait' <add> | 'portrait-upside-down' <add> | 'landscape' <add> | 'landscape-left' <add> | 'landscape-right', <add> >, <add> <add> /** <add> * The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed. <add> * <add> * See https://facebook.github.io/react-native/docs/modal.html#onorientationchange <add> */ <add> onOrientationChange?: ?(event: OrientationChangeEvent) => mixed, <add>|}>; <ide> <add>class Modal extends React.Component<Props> { <ide> static defaultProps = { <ide> visible: true, <ide> hardwareAccelerated: false, <ide> class Modal extends React.Component<Object> { <ide> _identifier: number; <ide> _eventSubscription: ?EmitterSubscription; <ide> <del> constructor(props: Object) { <add> constructor(props: Props) { <ide> super(props); <ide> Modal._confirmProps(props); <ide> this._identifier = uniqueModalIdentifier++; <ide> class Modal extends React.Component<Object> { <ide> } <ide> } <ide> <del> UNSAFE_componentWillReceiveProps(nextProps: Object) { <add> UNSAFE_componentWillReceiveProps(nextProps: Props) { <ide> Modal._confirmProps(nextProps); <ide> } <ide> <del> static _confirmProps(props: Object) { <add> static _confirmProps(props: Props) { <ide> if ( <ide> props.presentationStyle && <ide> props.presentationStyle !== 'overFullScreen' &&
1
Javascript
Javascript
add helpful message about pooled classes
e65f17b86cdfbe04453766161d5159203e672a7f
<ide><path>src/utils/PooledClass.js <ide> <ide> var invariant = require('invariant'); <ide> <add>var ABOUT_POOLING_MESSAGE = null; <add>if (__DEV__) { <add> ABOUT_POOLING_MESSAGE = ( <add> 'This object is reused for performance reasons. If you\'re seeing this ' + <add> 'after logging an object, try logging individual properties.' <add> ); <add>} <add> <ide> /** <ide> * Static poolers. Several custom versions for each potential number of <ide> * arguments. A completely generic pooler is easy to implement, but would <ide> var invariant = require('invariant'); <ide> */ <ide> var oneArgumentPooler = function(copyFieldsFrom) { <ide> var Klass = this; <add> var instance; <ide> if (Klass.instancePool.length) { <del> var instance = Klass.instancePool.pop(); <add> instance = Klass.instancePool.pop(); <ide> Klass.call(instance, copyFieldsFrom); <del> return instance; <ide> } else { <del> return new Klass(copyFieldsFrom); <add> instance = new Klass(copyFieldsFrom); <ide> } <add> instance._ABOUT_POOLING = null; <add> return instance; <ide> }; <ide> <ide> var twoArgumentPooler = function(a1, a2) { <ide> var Klass = this; <add> var instance; <ide> if (Klass.instancePool.length) { <del> var instance = Klass.instancePool.pop(); <add> instance = Klass.instancePool.pop(); <ide> Klass.call(instance, a1, a2); <del> return instance; <ide> } else { <del> return new Klass(a1, a2); <add> instance = new Klass(a1, a2); <ide> } <add> instance._ABOUT_POOLING = null; <add> return instance; <ide> }; <ide> <ide> var threeArgumentPooler = function(a1, a2, a3) { <ide> var Klass = this; <add> var instance; <ide> if (Klass.instancePool.length) { <del> var instance = Klass.instancePool.pop(); <add> instance = Klass.instancePool.pop(); <ide> Klass.call(instance, a1, a2, a3); <del> return instance; <ide> } else { <del> return new Klass(a1, a2, a3); <add> instance = new Klass(a1, a2, a3); <ide> } <add> instance._ABOUT_POOLING = null; <add> return instance; <ide> }; <ide> <ide> var fiveArgumentPooler = function(a1, a2, a3, a4, a5) { <ide> var Klass = this; <add> var instance; <ide> if (Klass.instancePool.length) { <del> var instance = Klass.instancePool.pop(); <add> instance = Klass.instancePool.pop(); <ide> Klass.call(instance, a1, a2, a3, a4, a5); <del> return instance; <ide> } else { <del> return new Klass(a1, a2, a3, a4, a5); <add> instance = new Klass(a1, a2, a3, a4, a5); <ide> } <add> instance._ABOUT_POOLING = null; <add> return instance; <ide> }; <ide> <ide> var standardReleaser = function(instance) { <ide> var standardReleaser = function(instance) { <ide> if (instance.destructor) { <ide> instance.destructor(); <ide> } <add> instance._ABOUT_POOLING = ABOUT_POOLING_MESSAGE; <ide> if (Klass.instancePool.length < Klass.poolSize) { <ide> Klass.instancePool.push(instance); <ide> }
1
PHP
PHP
add missing docblock
ee204009891b65d03a2fcc4447033c5f88299fb5
<ide><path>lib/Cake/TestSuite/Fixture/TestFixture.php <ide> class TestFixture { <ide> */ <ide> public $fields = array(); <ide> <add>/** <add> * Configuration for importing fixture schema <add> * <add> * Accepts a `connection` and `table` key, to define <add> * which table and which connection contain the schema to be <add> * imported. <add> * <add> * @var array <add> */ <add> public $import = null; <add> <ide> /** <ide> * Fixture records to be inserted. <ide> *
1
Javascript
Javascript
support multiple classes in classed operator
927426f79f56802aa99e6620be714646bcee3b7b
<ide><path>d3.js <ide> d3_selectionPrototype.attr = function(name, value) { <ide> : (name.local ? attrConstantNS : attrConstant))); <ide> }; <ide> d3_selectionPrototype.classed = function(name, value) { <add> var names = name.split(d3_selection_classedWhitespace), <add> n = names.length; <add> if (n > 1) { <add> var i = -1; <add> if (arguments.length > 1) { <add> while (++i < n) d3_selection_classed.call(this, names[i], value); <add> return this; <add> } else { <add> value = true; <add> while (++i < n) value = value && d3_selection_classed.call(this, names[i]); <add> return value; <add> } <add> } <add> return d3_selection_classed.apply(this, arguments); <add>}; <add> <add>var d3_selection_classedWhitespace = /\s+/g; <add> <add>function d3_selection_classed(name, value) { <ide> var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g"); <ide> <ide> // If no value is specified, return the first value. <ide> d3_selectionPrototype.classed = function(name, value) { <ide> ? classedFunction : value <ide> ? classedAdd <ide> : classedRemove); <del>}; <add>} <ide> d3_selectionPrototype.style = function(name, value, priority) { <ide> if (arguments.length < 3) priority = ""; <ide> <ide><path>d3.min.js <del>(function(){function dw(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(dh[2]=a)-c[2]),e=dh[0]=b[0]-d*c[0],f=dh[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{di.apply(dk,dl)}finally{d3.event=g}g.preventDefault()}function dv(){dn&&dj===d3.event.target&&(d3.event.stopPropagation(),d3.event.preventDefault(),dn=!1,dj=null)}function du(){dd&&(dm&&dj===d3.event.target&&(dn=!0),dt(),dd=null)}function dt(){de=null,dd&&(dm=!0,dw(dh[2],d3.svg.mouse(dk),dd))}function ds(){var a=d3.svg.touches(dk);switch(a.length){case 1:var b=a[0];dw(dh[2],b,df[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=df[c.identifier],g=df[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dw(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dr(){var a=d3.svg.touches(dk),b=-1,c=a.length,d;while(++b<c)df[(d=a[b]).identifier]=dp(d);return a}function dq(){dc||(dc=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{dc.scrollTop=1e3,dc.dispatchEvent(a),b=1e3-dc.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function dp(a){return[a[0]-dh[0],a[1]-dh[1],dh[2]]}function db(){d3.event.stopPropagation(),d3.event.preventDefault()}function da(){cX&&cS===d3.event.target&&(db(),cX=!1,cS=null)}function c_(){!cT||(cY("dragend"),cT=null,cW&&cS===d3.event.target&&(cX=!0,db()))}function c$(){if(!!cT){var a=cT.parentNode;if(!a)return c_();cY("drag"),db()}}function cZ(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cY(a){var b=d3.event,c=cT.parentNode,d=0,e=0;c&&(c=cZ(c),d=c[0]-cV[0],e=c[1]-cV[1],cV=c,cW|=d|e);try{d3.event={dx:d,dy:e},cR[a].dispatch.apply(cT,cU)}finally{d3.event=b}b.preventDefault()}function cQ(a,b,c){e=[];if(c&&b.length>1){var d=bu(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cP(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cO(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cK(){return"circle"}function cJ(){return 64}function cI(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cH<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cH=!e.f&&!e.e,d.remove()}cH?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cG(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bS;return[c*Math.cos(d),c*Math.sin(d)]}}function cF(a){return[a.x,a.y]}function cE(a){return a.endAngle}function cD(a){return a.startAngle}function cC(a){return a.radius}function cB(a){return a.target}function cA(a){return a.source}function cz(a){return function(b,c){return a[c][1]}}function cy(a){return function(b,c){return a[c][0]}}function cx(a){function i(f){if(f.length<1)return null;var i=bZ(this,f,b,d),j=bZ(this,f,b===c?cy(i):c,d===e?cz(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=b$,c=b$,d=0,e=b_,f="linear",g=ca[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=ca[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cw(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bS,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cv(a){return a.length<3?cb(a):a[0]+ch(a,cu(a))}function cu(a){var b=[],c,d,e,f,g=ct(a),h=-1,i=a.length-1;while(++h<i)c=cs(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function ct(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cs(e,f);while(++b<c)d[b]=g+(g=cs(e=f,f=a[b+1]));d[b]=g;return d}function cs(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cr(a,b,c){a.push("C",cn(co,b),",",cn(co,c),",",cn(cp,b),",",cn(cp,c),",",cn(cq,b),",",cn(cq,c))}function cn(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cm(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cj(a)}function cl(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cn(cq,g),",",cn(cq,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cr(b,g,h);return b.join("")}function ck(a){if(a.length<4)return cb(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cn(cq,f)+","+cn(cq,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cr(b,f,g);return b.join("")}function cj(a){if(a.length<3)return cb(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];cr(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cr(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),cr(i,g,h);return i.join("")}function ci(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function ch(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cb(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cg(a,b,c){return a.length<3?cb(a):a[0]+ch(a,ci(a,b))}function cf(a,b){return a.length<3?cb(a):a[0]+ch((a.push(a[0]),a),ci([a[a.length-2]].concat(a,[a[1]]),b))}function ce(a,b){return a.length<4?cb(a):a[1]+ch(a.slice(1,a.length-1),ci(a,b))}function cd(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function cc(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function cb(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function b_(a){return a[1]}function b$(a){return a[0]}function bZ(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bY(a){function g(d){return d.length<1?null:"M"+e(a(bZ(this,d,b,c)),f)}var b=b$,c=b_,d="linear",e=ca[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=ca[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bX(a){return a.endAngle}function bW(a){return a.startAngle}function bV(a){return a.outerRadius}function bU(a){return a.innerRadius}function bR(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bR(a,b,c)};return g()}function bQ(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bQ(a,b)};return d()}function bL(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}var c,d,e;f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,b={t:"range",x:a};return f},f.rangePoints=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length-1+g);d=a.length<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,b={t:"rangePoints",x:c,p:g};return f},f.rangeBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length+g);d=d3.range(h+j*g,i,j),e=j*(1-g),b={t:"rangeBands",x:c,p:g};return f},f.rangeRoundBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=Math.floor((i-h)/(a.length+g)),k=i-h-(a.length-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),b={t:"rangeRoundBands",x:c,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){return bL(a,b)};return f.domain(a)}function bK(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bJ(a,b){function e(b){return a(c(b))}var c=bK(b),d=bK(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bB(e.domain(),a)},e.tickFormat=function(a){return bC(e.domain(),a)},e.nice=function(){return e.domain(bv(e.domain(),bz))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bK(b=a),d=bK(1/b);return e.domain(f)},e.copy=function(){return bJ(a.copy(),b)};return by(e,a)}function bI(a){return-Math.log(-a)/Math.LN10}function bH(a){return Math.log(a)/Math.LN10}function bF(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bI:bH,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bv(a.domain(),bw));return d},d.ticks=function(){var d=bu(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=Math.round(c(d[0])),i=Math.round(c(d[1]));if(b===bI){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=bG);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===bI?(h=-1e-15,Math.floor):(h=1e-15,Math.ceil),h;return function(a){return a/c(g(b(a)+h))<f?e(a):""}},d.copy=function(){return bF(a.copy(),b)};return by(d,a)}function bE(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bD(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bC(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bA(a,b)[2])/Math.LN10+.01))+"f")}function bB(a,b){return d3.range.apply(d3,bA(a,b))}function bA(a,b){var c=bu(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bz(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function by(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bx(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?bD:bE,i=d?L:K;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bB(a,b)},h.tickFormat=function(b){return bC(a,b)},h.nice=function(){bv(a,bz);return g()},h.copy=function(){return bx(a,b,c,d)};return g()}function bw(){return Math}function bv(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bu(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bt(){}function br(){var a=null,b=bn,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bn=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bq(){var a,b=Date.now(),c=bn;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=br()-b;d>24?(isFinite(d)&&(clearTimeout(bp),bp=setTimeout(bq,d)),bo=0):(bo=1,bs(bq))}function bm(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bh(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function bg(a,b){h(a,bi);var c={},d=d3.dispatch("start","end"),e=bl,f=Date.now();a.id=b,a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return e;e=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bm.call(a,b);d[b].add(c);return a},d3.timer(function(g){a.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,f=e(c),g=k.length;while(g>0)k[--g].call(l,f);if(c>=1){r(),bk=b,d.end.dispatch.call(l,h,i),bk=0;return 1}}function p(a){if(o.active>b)return r();o.active=b;for(var e in c)(e=c[e].call(l,h,i))&&k.push(e);d.start.dispatch.call(l,h,i),q(a)||d3.timer(q,0,f);return 1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,f)});return 1},0,f);return a}function be(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bc(a){h(a,bd);return a}function bb(a){return{__data__:a}}function ba(a){return function(){return Z(a,this)}}function _(a){return function(){return Y(a,this)}}function X(a){h(a,$);return a}function W(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return M(g(a+120),g(a),g(a-120))}function V(a,b,c){this.h=a,this.s=b,this.l=c}function U(a,b,c){return new V(a,b,c)}function R(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function Q(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return U(g,h,i)}function P(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(R(h[0]),R(h[1]),R(h[2]))}}if(i=S[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function O(a){return a<16?"0"+a.toString(16):a.toString(16)}function N(a,b,c){this.r=a,this.g=b,this.b=c}function M(a,b,c){return new N(a,b,c)}function L(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function K(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function J(a){return a in I||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function G(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function F(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function E(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function D(a){return 1-Math.sqrt(1-a*a)}function C(a){return Math.pow(2,10*(a-1))}function B(a){return 1-Math.cos(a*Math.PI/2)}function A(a){return function(b){return Math.pow(b,a)}}function z(a){return a}function y(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function x(a){return function(b){return 1-a(1-b)}}function w(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function r(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function q(a){return a+""}function n(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function l(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function k(a){return a==null}function j(a){return a.length}function i(){return this}function f(a){return Array.prototype.slice.call(a)}function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.3.0"};var d=f;try{d(document.documentElement.childNodes)[0].nodeType}catch(g){d=e}var h=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,j),c=Array(b);++a<b;)for(var d=-1,e,f=c[a]=Array(e);++d<e;)f[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,g=a.length;arguments.length<2&&(b=k);while(++f<g)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(m,"\\$&")};var m=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=n(c);return b},d3.format=function(a){var b=o.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,k=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":k=!0,h="0"}i=p[i]||q;return function(a){var b=j?a*100:+a,l=b<0&&(b=-b)?"−":d;if(k&&b%1)return"";a=i(b,h);if(e){var m=a.length+l.length;m<f&&(a=Array(f-m+1).join(c)+a),g&&(a=r(a)),a=l+a}else{g&&(a=r(a)),a=l+a;var m=a.length;m<f&&(a=Array(f-m+1).join(c)+a)}j&&(a+="%");return a}};var o=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,p={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=a?1+Math.floor(1e-15+Math.log(a)/Math.LN10):1;return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},s=A(2),t=A(3),u={linear:function(){return z},poly:A,quad:function(){return s},cubic:function(){return t},sin:function(){return B},exp:function(){return C},circle:function(){return D},elastic:E,back:F,bounce:function(){return G}},v={"in":function(a){return a},out:x,"in-out":y,"out-in":function(a){return y(x(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return w(v[d](u[c].apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;H.lastIndex=0;for(d=0;c=H.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=H.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=H.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return W(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=J(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var H=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,I={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in S||/^(#|rgb\(|hsl\()/.test(b):b instanceof N||b instanceof V)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?P(""+a,M,W):M(~~a,~~b,~~c)},N.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return M(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return M(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},N.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return M(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},N.prototype.hsl=function(){return Q(this.r,this.g,this.b)},N.prototype.toString=function(){return"#"+O(this.r)+O(this.g)+O(this.b)};var S={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var T in S)S[T]=P(S[T],M,W);d3.hsl=function(a,b,c){return arguments.length===1?P(""+a,Q,U):U(+a,+b,+c)},V.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return U(this.h,this.s,this.l/a)},V.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return U(this.h,this.s,a*this.l)},V.prototype.rgb=function(){return W(this.h,this.s,this.l)},V.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var Y=function(a,b){return b.querySelector(a)},Z=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(Y=function(a,b){return Sizzle(a,b)[0]},Z=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var $=[];d3.selection=function(){return bf},d3.selection.prototype=$,$.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=_(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return X(b)},$.selectAll=function(a){var b=[],c,e;typeof a!="function"&&(a=ba(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i])b.push(c=d(a.call(e,e.__data__,i))),c.parentNode=e;return X(b)},$.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},$.classed=function(a,b){function h(){(b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this <del>.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=l(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=l(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)},$.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},$.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},$.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},$.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},$.append=function(a){function c(){return this.appendChild(document.createElementNS(a.space,a.local))}function b(){return this.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},$.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),Y(b,this))}function c(){return this.insertBefore(document.createElement(a),Y(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},$.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},$.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bb(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bb(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bb(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=X(d);j.enter=function(){return bc(c)},j.exit=function(){return X(e)};return j};var bd=[];bd.append=$.append,bd.insert=$.insert,bd.empty=$.empty,bd.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return X(b)},$.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return X(b)},$.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},$.sort=function(a){a=be.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},$.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},$.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},$.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},$.empty=function(){return!this.node()},$.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},$.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bg(a,bk||++bj)};var bf=X([[document]]);bf[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?bf.select(a):X([[a]])},d3.selectAll=function(a){return typeof a=="string"?bf.selectAll(a):X([d(a)])};var bi=[],bj=0,bk=0,bl=d3.ease("cubic-in-out");bi.call=$.call,d3.transition=function(){return bf.transition()},d3.transition.prototype=bi,bi.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=_(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bg(b,this.id).ease(this.ease())},bi.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=ba(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a.call(d.node,d.node.__data__,h));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return bg(b,this.id).ease(this.ease())},bi.attr=function(a,b){return this.attrTween(a,bh(b))},bi.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},bi.style=function(a,b,c){arguments.length<3&&(c="");return this.styleTween(a,bh(b),c)},bi.styleTween=function(a,b,c){arguments.length<3&&(c="");return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})},bi.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bi.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bi.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bi.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},bi.transition=function(){return this.select(i)};var bn=null,bo,bp;d3.timer=function(a,b,c){var d=!1,e,f=bn;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bn={callback:a,then:c,delay:b,next:bn}),bo||(bp=clearTimeout(bp),bo=1,bs(bq))},d3.timer.flush=function(){var a,b=Date.now(),c=bn;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;br()};var bs=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bx([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bF(d3.scale.linear(),bH)};var bG=d3.format("e");bH.pow=function(a){return Math.pow(10,a)},bI.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bJ(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bL([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bM)},d3.scale.category20=function(){return d3.scale.ordinal().range(bN)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bO)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bP)};var bM=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bN=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bO=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bP=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bQ([],[])},d3.scale.quantize=function(){return bR(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bS,h=d.apply(this,arguments)+bS,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bT?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bU,b=bV,c=bW,d=bX;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bS;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bS=-Math.PI/2,bT=2*Math.PI-1e-6;d3.svg.line=function(){return bY(Object)};var ca={linear:cb,"step-before":cc,"step-after":cd,basis:cj,"basis-open":ck,"basis-closed":cl,bundle:cm,cardinal:cg,"cardinal-open":ce,"cardinal-closed":cf,monotone:cv},co=[0,2/3,1/3,0],cp=[0,1/3,2/3,0],cq=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bY(cw);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cx(Object)},d3.svg.area.radial=function(){var a=cx(cw);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bS,k=e.call(a,h,g)+bS;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cA,b=cB,c=cC,d=bW,e=bX;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cA,b=cB,c=cF;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cF,c=a.projection;a.projection=function(a){return arguments.length?c(cG(b=a)):b};return a},d3.svg.mouse=function(a){return cI(a,d3.event)};var cH=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?d(b).map(function(b){var c=cI(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cL[a.call(this,c,d)]||cL.circle)(b.call(this,c,d))}var a=cK,b=cJ;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cL={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cN)),c=b*cN;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cM),c=b*cM/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cM),c=b*cM/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cL);var cM=Math.sqrt(3),cN=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cQ(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=bu(a.range()),B=n.selectAll(".domain").data([0]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cO,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cO,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cP,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cP,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),cY("dragstart")}function c(){cR=a,cS=d3.event.target,cV=cZ((cT=this).parentNode),cW=0,cU=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",c$).on("touchmove.drag",c$).on("mouseup.drag",c_,!0).on("touchend.drag",c_,!0).on("click.drag",da,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cR,cS,cT,cU,cV,cW,cX;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dr(),c,e=Date.now();b.length===1&&e-dg<300&&dw(1+Math.floor(a[2]),c=b[0],df[c.identifier]),dg=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dk);dw(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dp(b))}function f(){d.apply(this,arguments),de||(de=dp(d3.svg.mouse(dk))),dw(dq()+a[2],d3.svg.mouse(dk),de)}function e(){d.apply(this,arguments),dd=dp(d3.svg.mouse(dk)),dm=!1,d3.event.preventDefault(),window.focus()}function d(){dh=a,di=b.zoom.dispatch,dj=d3.event.target,dk=this,dl=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",f).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dt).on("mouseup.zoom",du).on("touchmove.zoom",ds).on("touchend.zoom",dr).on("click.zoom",dv,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var dc,dd,de,df={},dg=0,dh,di,dj,dk,dl,dm,dn})() <ide>\ No newline at end of file <add>(function(){function dy(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(dj[2]=a)-c[2]),e=dj[0]=b[0]-d*c[0],f=dj[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{dk.apply(dm,dn)}finally{d3.event=g}g.preventDefault()}function dx(){dq&&dl===d3.event.target&&(d3.event.stopPropagation(),d3.event.preventDefault(),dq=!1,dl=null)}function dw(){df&&(dp&&dl===d3.event.target&&(dq=!0),dv(),df=null)}function dv(){dg=null,df&&(dp=!0,dy(dj[2],d3.svg.mouse(dm),df))}function du(){var a=d3.svg.touches(dm);switch(a.length){case 1:var b=a[0];dy(dj[2],b,dh[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=dh[c.identifier],g=dh[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dy(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dt(){var a=d3.svg.touches(dm),b=-1,c=a.length,d;while(++b<c)dh[(d=a[b]).identifier]=dr(d);return a}function ds(){de||(de=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{de.scrollTop=1e3,de.dispatchEvent(a),b=1e3-de.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function dr(a){return[a[0]-dj[0],a[1]-dj[1],dj[2]]}function dd(){d3.event.stopPropagation(),d3.event.preventDefault()}function dc(){cZ&&cU===d3.event.target&&(dd(),cZ=!1,cU=null)}function db(){!cV||(c$("dragend"),cV=null,cY&&cU===d3.event.target&&(cZ=!0,dd()))}function da(){if(!!cV){var a=cV.parentNode;if(!a)return db();c$("drag"),dd()}}function c_(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function c$(a){var b=d3.event,c=cV.parentNode,d=0,e=0;c&&(c=c_(c),d=c[0]-cX[0],e=c[1]-cX[1],cX=c,cY|=d|e);try{d3.event={dx:d,dy:e},cT[a].dispatch.apply(cV,cW)}finally{d3.event=b}b.preventDefault()}function cS(a,b,c){e=[];if(c&&b.length>1){var d=bw(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cR(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cQ(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cM(){return"circle"}function cL(){return 64}function cK(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cJ<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cJ=!e.f&&!e.e,d.remove()}cJ?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cI(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bU;return[c*Math.cos(d),c*Math.sin(d)]}}function cH(a){return[a.x,a.y]}function cG(a){return a.endAngle}function cF(a){return a.startAngle}function cE(a){return a.radius}function cD(a){return a.target}function cC(a){return a.source}function cB(a){return function(b,c){return a[c][1]}}function cA(a){return function(b,c){return a[c][0]}}function cz(a){function i(f){if(f.length<1)return null;var i=b_(this,f,b,d),j=b_(this,f,b===c?cA(i):c,d===e?cB(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=ca,c=ca,d=0,e=cb,f="linear",g=cc[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=cc[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cy(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bU,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cx(a){return a.length<3?cd(a):a[0]+cj(a,cw(a))}function cw(a){var b=[],c,d,e,f,g=cv(a),h=-1,i=a.length-1;while(++h<i)c=cu(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cv(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cu(e,f);while(++b<c)d[b]=g+(g=cu(e=f,f=a[b+1]));d[b]=g;return d}function cu(a,b){return(b[1]-a[1])/(b[0]-a[0])}function ct(a,b,c){a.push("C",cp(cq,b),",",cp(cq,c),",",cp(cr,b),",",cp(cr,c),",",cp(cs,b),",",cp(cs,c))}function cp(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function co(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cl(a)}function cn(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cp(cs,g),",",cp(cs,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),ct(b,g,h);return b.join("")}function cm(a){if(a.length<4)return cd(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cp(cs,f)+","+cp(cs,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),ct(b,f,g);return b.join("")}function cl(a){if(a.length<3)return cd(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],g=[e,e,e,(d=a[1])[0]],h=[f,f,f,d[1]],i=[e,",",f];ct(i,g,h);while(++b<c)d=a[b],g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),ct(i,g,h);b=-1;while(++b<2)g.shift(),g.push(d[0]),h.shift(),h.push(d[1]),ct(i,g,h);return i.join("")}function ck(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cj(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cd(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function ci(a,b,c){return a.length<3?cd(a):a[0]+cj(a,ck(a,b))}function ch(a,b){return a.length<3?cd(a):a[0]+cj((a.push(a[0]),a),ck([a[a.length-2]].concat(a,[a[1]]),b))}function cg(a,b){return a.length<4?cd(a):a[1]+cj(a.slice(1,a.length-1),ck(a,b))}function cf(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function ce(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function cd(a){var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];while(++b<c)e.push("L",(d=a[b])[0],",",d[1]);return e.join("")}function cb(a){return a[1]}function ca(a){return a[0]}function b_(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function b$(a){function g(d){return d.length<1?null:"M"+e(a(b_(this,d,b,c)),f)}var b=ca,c=cb,d="linear",e=cc[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=cc[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bZ(a){return a.endAngle}function bY(a){return a.startAngle}function bX(a){return a.outerRadius}function bW(a){return a.innerRadius}function bT(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bT(a,b,c)};return g()}function bS(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bS(a,b)};return d()}function bN(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}var c,d,e;f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,b={t:"range",x:a};return f},f.rangePoints=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length-1+g);d=a.length<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,b={t:"rangePoints",x:c,p:g};return f},f.rangeBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length+g);d=d3.range(h+j*g,i,j),e=j*(1-g),b={t:"rangeBands",x:c,p:g};return f},f.rangeRoundBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=Math.floor((i-h)/(a.length+g)),k=i-h-(a.length-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),b={t:"rangeRoundBands",x:c,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){return bN(a,b)};return f.domain(a)}function bM(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bL(a,b){function e(b){return a(c(b))}var c=bM(b),d=bM(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bD(e.domain(),a)},e.tickFormat=function(a){return bE(e.domain(),a)},e.nice=function(){return e.domain(bx(e.domain(),bB))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bM(b=a),d=bM(1/b);return e.domain(f)},e.copy=function(){return bL(a.copy(),b)};return bA(e,a)}function bK(a){return-Math.log(-a)/Math.LN10}function bJ(a){return Math.log(a)/Math.LN10}function bH(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bK:bJ,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bx(a.domain(),by));return d},d.ticks=function(){var d=bw(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=Math.round(c(d[0])),i=Math.round(c(d[1]));if(b===bK){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(a,e){arguments.length<2&&(e=bI);if(arguments.length<1)return e;var f=a/d.ticks().length,g=b===bK?(h=-1e-15,Math.floor):(h=1e-15,Math.ceil),h;return function(a){return a/c(g(b(a)+h))<f?e(a):""}},d.copy=function(){return bH(a.copy(),b)};return bA(d,a)}function bG(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bF(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bE(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bC(a,b)[2])/Math.LN10+.01))+"f")}function bD(a,b){return d3.range.apply(d3,bC(a,b))}function bC(a,b){var c=bw(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bB(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bA(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bz(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?bF:bG,i=d?L:K;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bD(a,b)},h.tickFormat=function(b){return bE(a,b)},h.nice=function(){bx(a,bB);return g()},h.copy=function(){return bz(a,b,c,d)};return g()}function by(){return Math}function bx(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bw(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bv(){}function bt(){var a=null,b=bp,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bp=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bs(){var a,b=Date.now(),c=bp;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bt()-b;d>24?(isFinite(d)&&(clearTimeout(br),br=setTimeout(bs,d)),bq=0):(bq=1,bu(bs))}function bo(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bj(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function bi(a,b){h(a,bk);var c={},d=d3.dispatch("start","end"),e=bn,f=Date.now();a.id=b,a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return e;e=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bo.call(a,b);d[b].add(c);return a},d3.timer(function(g){a.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==b)return r();var c=(a-m)/n,f=e(c),g=k.length;while(g>0)k[--g].call(l,f);if(c>=1){r(),bm=b,d.end.dispatch.call(l,h,i),bm=0;return 1}}function p(a){if(o.active>b)return r();o.active=b;for(var e in c)(e=c[e].call(l,h,i))&&k.push(e);d.start.dispatch.call(l,h,i),q(a)||d3.timer(q,0,f);return 1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=g?p(g):d3.timer(p,m,f)});return 1},0,f);return a}function bg(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function be(a){h(a,bf);return a}function bd(a){return{__data__:a}}function bc(a,b){function h(){(b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=l(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=l(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?h:b?f:g)}function ba(a){return function(){return Z(a,this)}}function _(a){return function(){return Y(a,this)}}function X(a){h(a,$);return a}function W(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return M(g(a+120),g(a),g(a-120))}function V(a,b,c){this.h=a,this.s=b,this.l=c}function U(a,b,c){return new V(a,b,c)}function R(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function Q(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return U(g,h,i)}function P(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(R(h[0]),R(h[1]),R(h[2]))}}if(i=S[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function O(a){return a<16?"0"+a.toString(16):a.toString(16)}function N(a,b,c){this.r=a,this.g=b,this.b=c}function M(a,b,c){return new N(a,b,c)}function L(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function K(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function J(a){return a in I||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function G(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function F(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function E(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function D(a){return 1-Math.sqrt(1-a*a)}function C(a){return Math.pow(2,10*(a-1))}function B(a){return 1-Math.cos(a*Math.PI/2)}function A(a){return function(b){return Math.pow(b,a)}}function z(a){return a}function y(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function x(a){return function(b){return 1-a(1-b)}}function w(a){return function(b){return b<=0?0:b>=1?1:a(b)}}function r(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function q(a){return a+""}function n(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function l(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function k(a){return a==null}function j(a){return a.length}function i(){return this}function f(a){return Array.prototype.slice.call(a)}function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.3.0"};var d=f;try{d(document.documentElement.childNodes)[0].nodeType}catch(g){d=e}var h=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,j),c=Array(b);++a<b;)for(var d=-1,e,f=c[a]=Array(e);++d<e;)f[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,g=a.length;arguments.length<2&&(b=k);while(++f<g)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(m,"\\$&")};var m=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=n(c);return b},d3.format=function(a){var b=o.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,k=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":k=!0,h="0"}i=p[i]||q;return function(a){var b=j?a*100:+a,l=b<0&&(b=-b)?"−":d;if(k&&b%1)return"";a=i(b,h);if(e){var m=a.length+l.length;m<f&&(a=Array(f-m+1).join(c)+a),g&&(a=r(a)),a=l+a}else{g&&(a=r(a)),a=l+a;var m=a.length;m<f&&(a=Array(f-m+1).join(c)+a)}j&&(a+="%");return a}};var o=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,p={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=a?1+Math.floor(1e-15+Math.log(a)/Math.LN10):1;return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},s=A(2),t=A(3),u={linear:function(){return z},poly:A,quad:function(){return s},cubic:function(){return t},sin:function(){return B},exp:function(){return C},circle:function(){return D},elastic:E,back:F,bounce:function(){return G}},v={"in":function(a){return a},out:x,"in-out":y,"out-in":function(a){return y(x(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return w(v[d](u[c].apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;H.lastIndex=0;for(d=0;c=H.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=H.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=H.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return W(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=J(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var H=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,I={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in S||/^(#|rgb\(|hsl\()/.test(b):b instanceof N||b instanceof V)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?P(""+a,M,W):M(~~a,~~b,~~c)},N.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return M(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return M(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},N.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return M(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},N.prototype.hsl=function(){return Q(this.r,this.g,this.b)},N.prototype.toString=function(){return"#"+O(this.r)+O(this.g)+O(this.b)};var S={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var T in S)S[T]=P(S[T],M,W);d3.hsl=function(a,b,c){return arguments.length===1?P(""+a,Q,U):U(+a,+b,+c)},V.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return U(this.h,this.s,this.l/a)},V.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return U(this.h,this.s,a*this.l)},V.prototype.rgb=function(){return W(this.h,this.s,this.l)},V.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var Y=function(a,b){return b.querySelector(a)},Z=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(Y=function(a,b){return Sizzle(a,b)[0]},Z=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var $=[];d3.selection=function(){return bh},d3.selection.prototype=$,$.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=_(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return X(b)},$.selectAll=function(a){var b=[],c,e;typeof a!="function"&&(a=ba(a));for(var f=-1,g=this.length;++f<g;)for(var h=this[f],i=-1,j=h.length;++i<j;)if(e=h[i])b.push(c=d(a.call(e,e.__data__,i))),c.parentNode=e;return X(b)},$.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null? <add>this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},$.classed=function(a,b){var c=a.split(bb),d=c.length;if(d>1){var e=-1;if(arguments.length>1){while(++e<d)bc.call(this,c[e],b);return this}b=!0;while(++e<d)b=b&&bc.call(this,c[e]);return b}return bc.apply(this,arguments)};var bb=/\s+/g;$.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},$.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},$.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},$.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},$.append=function(a){function c(){return this.appendChild(document.createElementNS(a.space,a.local))}function b(){return this.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},$.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),Y(b,this))}function c(){return this.insertBefore(document.createElement(a),Y(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},$.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},$.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bd(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bd(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bd(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=X(d);j.enter=function(){return be(c)},j.exit=function(){return X(e)};return j};var bf=[];bf.append=$.append,bf.insert=$.insert,bf.empty=$.empty,bf.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return X(b)},$.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return X(b)},$.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},$.sort=function(a){a=bg.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},$.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},$.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},$.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},$.empty=function(){return!this.node()},$.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},$.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bi(a,bm||++bl)};var bh=X([[document]]);bh[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?bh.select(a):X([[a]])},d3.selectAll=function(a){return typeof a=="string"?bh.selectAll(a):X([d(a)])};var bk=[],bl=0,bm=0,bn=d3.ease("cubic-in-out");bk.call=$.call,d3.transition=function(){return bh.transition()},d3.transition.prototype=bk,bk.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=_(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bi(b,this.id).ease(this.ease())},bk.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=ba(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a.call(d.node,d.node.__data__,h));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return bi(b,this.id).ease(this.ease())},bk.attr=function(a,b){return this.attrTween(a,bj(b))},bk.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},bk.style=function(a,b,c){arguments.length<3&&(c="");return this.styleTween(a,bj(b),c)},bk.styleTween=function(a,b,c){arguments.length<3&&(c="");return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})},bk.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bk.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bk.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},bk.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},bk.transition=function(){return this.select(i)};var bp=null,bq,br;d3.timer=function(a,b,c){var d=!1,e,f=bp;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bp={callback:a,then:c,delay:b,next:bp}),bq||(br=clearTimeout(br),bq=1,bu(bs))},d3.timer.flush=function(){var a,b=Date.now(),c=bp;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bt()};var bu=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bz([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bH(d3.scale.linear(),bJ)};var bI=d3.format("e");bJ.pow=function(a){return Math.pow(10,a)},bK.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bL(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bN([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bO)},d3.scale.category20=function(){return d3.scale.ordinal().range(bP)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bQ)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bR)};var bO=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bP=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bQ=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bR=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bS([],[])},d3.scale.quantize=function(){return bT(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bU,h=d.apply(this,arguments)+bU,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bV?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bW,b=bX,c=bY,d=bZ;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bU;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bU=-Math.PI/2,bV=2*Math.PI-1e-6;d3.svg.line=function(){return b$(Object)};var cc={linear:cd,"step-before":ce,"step-after":cf,basis:cl,"basis-open":cm,"basis-closed":cn,bundle:co,cardinal:ci,"cardinal-open":cg,"cardinal-closed":ch,monotone:cx},cq=[0,2/3,1/3,0],cr=[0,1/3,2/3,0],cs=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=b$(cy);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cz(Object)},d3.svg.area.radial=function(){var a=cz(cy);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bU,k=e.call(a,h,g)+bU;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cC,b=cD,c=cE,d=bY,e=bZ;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cC,b=cD,c=cH;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cH,c=a.projection;a.projection=function(a){return arguments.length?c(cI(b=a)):b};return a},d3.svg.mouse=function(a){return cK(a,d3.event)};var cJ=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?d(b).map(function(b){var c=cK(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cN[a.call(this,c,d)]||cN.circle)(b.call(this,c,d))}var a=cM,b=cL;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cN={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cP)),c=b*cP;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cO),c=b*cO/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cO),c=b*cO/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cN);var cO=Math.sqrt(3),cP=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cS(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=bw(a.range()),B=n.selectAll(".domain").data([0]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cQ,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cQ,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cR,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cR,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),c$("dragstart")}function c(){cT=a,cU=d3.event.target,cX=c_((cV=this).parentNode),cY=0,cW=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",da).on("touchmove.drag",da).on("mouseup.drag",db,!0).on("touchend.drag",db,!0).on("click.drag",dc,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cT,cU,cV,cW,cX,cY,cZ;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dt(),c,e=Date.now();b.length===1&&e-di<300&&dy(1+Math.floor(a[2]),c=b[0],dh[c.identifier]),di=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dm);dy(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dr(b))}function f(){d.apply(this,arguments),dg||(dg=dr(d3.svg.mouse(dm))),dy(ds()+a[2],d3.svg.mouse(dm),dg)}function e(){d.apply(this,arguments),df=dr(d3.svg.mouse(dm)),dp=!1,d3.event.preventDefault(),window.focus()}function d(){dj=a,dk=b.zoom.dispatch,dl=d3.event.target,dm=this,dn=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",f).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",dv).on("mouseup.zoom",dw).on("touchmove.zoom",du).on("touchend.zoom",dt).on("click.zoom",dx,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var de,df,dg,dh={},di=0,dj,dk,dl,dm,dn,dp,dq})() <ide>\ No newline at end of file <ide><path>src/core/selection-classed.js <ide> d3_selectionPrototype.classed = function(name, value) { <add> var names = name.split(d3_selection_classedWhitespace), <add> n = names.length; <add> if (n > 1) { <add> var i = -1; <add> if (arguments.length > 1) { <add> while (++i < n) d3_selection_classed.call(this, names[i], value); <add> return this; <add> } else { <add> value = true; <add> while (++i < n) value = value && d3_selection_classed.call(this, names[i]); <add> return value; <add> } <add> } <add> return d3_selection_classed.apply(this, arguments); <add>}; <add> <add>var d3_selection_classedWhitespace = /\s+/g; <add> <add>function d3_selection_classed(name, value) { <ide> var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g"); <ide> <ide> // If no value is specified, return the first value. <ide> d3_selectionPrototype.classed = function(name, value) { <ide> ? classedFunction : value <ide> ? classedAdd <ide> : classedRemove); <del>}; <add>} <ide><path>test/core/selection-classed-test.js <ide> suite.addBatch({ <ide> }, <ide> "returns the current selection": function(body) { <ide> assert.isTrue(body.classed("foo", true) === body); <add> }, <add> "adds missing classes as true": function(body) { <add> body.attr("class", null); <add> body.classed("foo bar", true); <add> assert.equal(document.body.className, "foo bar"); <add> }, <add> "gets existing classes": function(body) { <add> body.attr("class", " foo\tbar baz"); <add> assert.isTrue(body.classed("foo")); <add> assert.isTrue(body.classed("foo bar")); <add> assert.isTrue(body.classed("bar baz")); <add> assert.isTrue(body.classed("foo bar baz")); <add> }, <add> "does not get missing classes": function(body) { <add> body.attr("class", " foo\tbar baz"); <add> assert.isFalse(body.classed("foob")); <add> assert.isFalse(body.classed("foob bar")); <add> assert.isFalse(body.classed("bar baz blah")); <add> assert.isFalse(body.classed("foo bar baz moo")); <ide> } <ide> } <ide> });
4
Go
Go
fix flaky test testjsonformatprogress
d17bb23ae6efba6e76e7a56b856705400e26a61b
<ide><path>pkg/streamformatter/streamformatter_test.go <ide> import ( <ide> "encoding/json" <ide> "errors" <ide> "reflect" <add> "strings" <ide> "testing" <ide> <ide> "github.com/docker/docker/pkg/jsonmessage" <ide> func TestJSONFormatProgress(t *testing.T) { <ide> if msg.Status != "action" { <ide> t.Fatalf("Status must be 'action', got: %s", msg.Status) <ide> } <del> if msg.ProgressMessage != progress.String() { <del> t.Fatalf("ProgressMessage must be %s, got: %s", progress.String(), msg.ProgressMessage) <add> <add> // The progress will always be in the format of: <add> // [=========================> ] 15 B/30 B 404933h7m11s <add> // The last entry '404933h7m11s' is the timeLeftBox. <add> // However, the timeLeftBox field may change as progress.String() depends on time.Now(). <add> // Therefore, we have to strip the timeLeftBox from the strings to do the comparison. <add> <add> // Compare the progress strings before the timeLeftBox <add> expectedProgress := "[=========================> ] 15 B/30 B" <add> if !strings.HasPrefix(msg.ProgressMessage, expectedProgress) { <add> t.Fatalf("ProgressMessage without the timeLeftBox must be %s, got: %s", expectedProgress, msg.ProgressMessage) <ide> } <add> <ide> if !reflect.DeepEqual(msg.Progress, progress) { <ide> t.Fatal("Original progress not equals progress from FormatProgress") <ide> }
1
Javascript
Javascript
fix the time zone for testing
1ac0fa09a96e252ee1f0def5018b7c0f3e6686c4
<ide><path>test/load.js <add>process.env.TZ = "America/Los_Angeles"; <add> <ide> var smash = require("smash"), <ide> jsdom = require("jsdom"); <ide>
1
Ruby
Ruby
extract error handling from github.open
1d5ab3195cb9c19a349ccdcdf6c4f75d7c02460b
<ide><path>Library/Homebrew/utils.rb <ide> def open url, headers={}, &block <ide> yield Utils::JSON.load(f.read) <ide> end <ide> rescue OpenURI::HTTPError => e <add> handle_api_error(e) <add> rescue SocketError, OpenSSL::SSL::SSLError => e <add> raise Error, "Failed to connect to: #{url}\n#{e.message}", e.backtrace <add> rescue Utils::JSON::Error => e <add> raise Error, "Failed to parse JSON response\n#{e.message}", e.backtrace <add> end <add> <add> def handle_api_error(e) <ide> if e.io.meta['x-ratelimit-remaining'].to_i <= 0 <ide> raise RateLimitExceededError, <<-EOS.undent, e.backtrace <ide> GitHub #{Utils::JSON.load(e.io.read)['message']} <ide> You may want to create an API token: https://github.com/settings/applications <ide> and then set HOMEBREW_GITHUB_API_TOKEN. <ide> EOS <del> elsif e.io.status.first == "404" <add> end <add> <add> case e.io.status.first <add> when "404" <ide> raise HTTPNotFoundError, e.message, e.backtrace <ide> else <ide> raise Error, e.message, e.backtrace <ide> end <del> rescue SocketError, OpenSSL::SSL::SSLError => e <del> raise Error, "Failed to connect to: #{url}\n#{e.message}", e.backtrace <del> rescue Utils::JSON::Error => e <del> raise Error, "Failed to parse JSON response\n#{e.message}", e.backtrace <ide> end <ide> <ide> def issues_matching(query, qualifiers={})
1
Javascript
Javascript
simplify getall helper
25712d77c3bc0221b5b2b9b9492c20a9cfbe1b17
<ide><path>src/manipulation.js <ide> function cloneCopyEvent( src, dest ) { <ide> } <ide> <ide> function getAll( context, tag ) { <del> var elems, elem, <del> i = 0, <del> ret = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) : <del> typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) : <del> undefined; <del> <del> if ( !ret ) { <del> for ( ret = [], elems = context.childNodes || context; (elem = elems[ i ]) != null; i++ ) { <del> core_push.apply( ret, !tag || jQuery.nodeName( elem, tag ) ? <del> getAll( elem, tag ) : <del> elems ); <del> } <del> } <add> var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : <add> context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : <add> []; <ide> <ide> return tag === undefined || tag && jQuery.nodeName( context, tag ) ? <ide> jQuery.merge( [ context ], ret ) :
1
PHP
PHP
return 500 error on debug exceptions
475872269956f1217f180a976d27f0b79ec03cc4
<ide><path>src/Illuminate/Exception/Handler.php <ide> public function handleException($exception) <ide> <ide> $response->send(); <ide> } <add> <add> // If no response was sent by this custom exception handler, we will call the <add> // default exception displayer for the current application context and let <add> // it show the exception to the user / developer based on the situation. <ide> else <ide> { <ide> $this->displayException($exception); <ide><path>src/Illuminate/Exception/WhoopsDisplayer.php <ide> public function __construct(Run $whoops) <ide> */ <ide> public function display(Exception $exception) <ide> { <add> header('HTTP/1.1 500 Internal Server Error'); <add> <ide> $this->whoops->handleException($exception); <ide> } <ide>
2