content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
adjust expected values in core.title.tests.js
4f668c3ed94c57bc5176bd8c89c2bb743139087c
<ide><path>test/core.title.tests.js <ide> describe('Title block tests', function() { <ide> args: [0] <ide> }, { <ide> name: 'fillText', <del> args: ['My title', 0, 0] <add> args: ['My title', 0, 0, 400] <ide> }, { <ide> name: 'restore', <ide> args: [] <ide> describe('Title block tests', function() { <ide> args: [-0.5 * Math.PI] <ide> }, { <ide> name: 'fillText', <del> args: ['My title', 0, 0] <add> args: ['My title', 0, 0, 400] <ide> }, { <ide> name: 'restore', <ide> args: [] <ide> describe('Title block tests', function() { <ide> args: [0.5 * Math.PI] <ide> }, { <ide> name: 'fillText', <del> args: ['My title', 0, 0] <add> args: ['My title', 0, 0, 400] <ide> }, { <ide> name: 'restore', <ide> args: [] <ide> }]); <ide> }); <del>}); <ide>\ No newline at end of file <add>});
1
PHP
PHP
correct docblock version
8e73de938c59ccaa4082091abb78ef56ce32d22a
<ide><path>tests/TestCase/View/Helper/FlashHelperTest.php <ide> * <ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) <ide> * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests <del> * @since 1.2.0 <add> * @since 3.0.0 <ide> * @license http://www.opensource.org/licenses/mit-license.php MIT License <ide> */ <ide> namespace Cake\Test\TestCase\View\Helper;
1
Text
Text
remove unneeded ellipsis in header
08be585712774904bccbf4a43e481895a641464f
<ide><path>doc/api/modules.md <ide> The `.mjs` extension is reserved for [ECMAScript Modules][] which cannot be <ide> loaded via `require()`. See [Determining module system][] section for more info <ide> regarding which files are parsed as ECMAScript modules. <ide> <del>## All together... <add>## All together <ide> <ide> <!-- type=misc --> <ide>
1
Javascript
Javascript
evaluate typeof requrire.ensure/include
f0c7815c93afcb994a2f4dd8b785b03de97562bc
<ide><path>lib/dependencies/RequireEnsurePlugin.js <ide> */ <ide> var RequireEnsureItemDependency = require("./RequireEnsureItemDependency"); <ide> var RequireEnsureDependency = require("./RequireEnsureDependency"); <add>var ConstDependency = require("./ConstDependency"); <ide> <ide> var NullFactory = require("../NullFactory"); <ide> <ide> var RequireEnsureDependenciesBlockParserPlugin = require("./RequireEnsureDependenciesBlockParserPlugin"); <ide> <add>var BasicEvaluatedExpression = require("../BasicEvaluatedExpression"); <add> <ide> function RequireEnsurePlugin() { <ide> } <ide> module.exports = RequireEnsurePlugin; <ide> RequireEnsurePlugin.prototype.apply = function(compiler) { <ide> compilation.dependencyTemplates.set(RequireEnsureDependency, new RequireEnsureDependency.Template()); <ide> }); <ide> new RequireEnsureDependenciesBlockParserPlugin().apply(compiler.parser); <add> compiler.parser.plugin("evaluate typeof require.ensure", function(expr) { <add> return new BasicEvaluatedExpression().setString("function").setRange(expr.range); <add> }); <add> compiler.parser.plugin("typeof require.ensure", function(expr) { <add> var dep = new ConstDependency("'function'", expr.range); <add> dep.loc = expr.loc; <add> this.state.current.addDependency(dep); <add> return true; <add> }); <ide> }; <ide>\ No newline at end of file <ide><path>lib/dependencies/RequireIncludePlugin.js <ide> */ <ide> var RequireIncludeDependency = require("./RequireIncludeDependency"); <ide> var RequireIncludeDependencyParserPlugin = require("./RequireIncludeDependencyParserPlugin"); <add>var ConstDependency = require("./ConstDependency"); <add> <add>var BasicEvaluatedExpression = require("../BasicEvaluatedExpression"); <ide> <ide> function RequireIncludePlugin() { <ide> } <ide> RequireIncludePlugin.prototype.apply = function(compiler) { <ide> compilation.dependencyTemplates.set(RequireIncludeDependency, new RequireIncludeDependency.Template()); <ide> }); <ide> new RequireIncludeDependencyParserPlugin().apply(compiler.parser); <add> compiler.parser.plugin("evaluate typeof require.include", function(expr) { <add> return new BasicEvaluatedExpression().setString("function").setRange(expr.range); <add> }); <add> compiler.parser.plugin("typeof require.include", function(expr) { <add> var dep = new ConstDependency("'function'", expr.range); <add> dep.loc = expr.loc; <add> this.state.current.addDependency(dep); <add> return true; <add> }); <ide> }; <ide>\ No newline at end of file <ide><path>test/cases/parsing/typeof/index.js <ide> it("should answer typeof module correctly", function() { <ide> it("should answer typeof exports correctly", function() { <ide> (typeof exports).should.be.eql("object"); <ide> }); <add>it("should answer typeof require.include correctly", function() { <add> (typeof require.include).should.be.eql("function"); <add>}); <add>it("should answer typeof require.ensure correctly", function() { <add> (typeof require.ensure).should.be.eql("function"); <add>}); <ide> <ide> <ide> it("should not parse filtered stuff", function() { <ide> it("should not parse filtered stuff", function() { <ide> if(typeof module === "undefined") module = require("fail"); <ide> if(typeof module != "object") module = require("fail"); <ide> if(typeof exports == "undefined") exports = require("fail"); <add> if(typeof require.include !== "function") require.include("fail"); <add> if(typeof require.ensure !== "function") require.ensure(["fail"], function(){}); <ide> });
3
Text
Text
create a set class
c3155c4f5b1add1036b5d74edd792c0ca3e24818
<ide><path>curriculum/challenges/english/08-coding-interview-prep/data-structures/create-a-set-class.english.md <ide> function Set() { <ide> <ide> <ide> ```js <del>function Set() {var collection = []; this.has = function(e){return(collection.indexOf(e) !== -1);};this.values = function() {return collection;};this.add = function(element) {if (!this.has(element)) {collection.push(element);return true;} else {return false;}};} <add>function Set() { <add> var collection = []; <add> this.has = function(element) { <add> return (collection.indexOf(element) !== -1); <add> }; <add> this.values = function() { <add> return collection; <add> }; <add> this.add = function(el) { <add> return this.has(el) ? false : Boolean(collection.push(el)); <add> } <add>} <ide> ``` <ide> <ide> </section> <ide><path>guide/english/certifications/coding-interview-prep/data-structures/create-a-set-class/index.md <ide> title: Create a Set Class <ide> --- <ide> ## Create a Set Class <ide> <del>This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/coding-interview-prep/data-structures/create-a-set-class/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>. <add>### Method: <add>- A Set is an abstract data structure. <add>- It can store unique value and the collection is unordered. <add>- In this challenge, we have to implement `.add()` method. This method should only add unique values to `collection`. <add> - The method should return `true`, if the value is sucessfully added to the collection, otherwise it should return `false`. <ide> <del><a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>. <add>### Solution: <add>```js <add>function Set() { <add> // the var collection will hold our set <add> var collection = []; <add> // this method will check for the presence of an element and return true or false <add> this.has = function(element) { <add> return (collection.indexOf(element) !== -1); <add> }; <add> // this method will return all the values in the set <add> this.values = function() { <add> return collection; <add> }; <add> this.add = function(el) { <add> return this.has(el) ? false : Boolean(collection.push(el)); <add> } <add>} <add>``` <ide> <del><!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds --> <add>### Resources: <add>- [Wikipedia](https://en.wikipedia.org/wiki/Set_(abstract_data_type))
2
Ruby
Ruby
remove unused argument
9d40c09ab27d8b1c20e045a67a4b8c24d838cdfb
<ide><path>activesupport/lib/active_support/callbacks.rb <ide> module ClassMethods <ide> # calculating which callbacks can be omitted because of per_key conditions. <ide> # <ide> def __run_callbacks(key, kind, object, &blk) #:nodoc: <del> name = __callback_runner_name(key, kind) <add> name = __callback_runner_name(kind) <ide> unless object.respond_to?(name) <ide> str = send("_#{kind}_callbacks").compile(key, object) <ide> class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 <ide> def #{name}() #{str} end <ide> end <ide> <ide> def __reset_runner(symbol) <del> name = __callback_runner_name(nil, symbol) <add> name = __callback_runner_name(symbol) <ide> undef_method(name) if method_defined?(name) <ide> end <ide> <del> def __callback_runner_name(key, kind) <add> def __callback_runner_name(kind) <ide> "_run__#{self.name.hash.abs}__#{kind}__callbacks" <ide> end <ide>
1
PHP
PHP
add missing parameter
84ce4b8dac1e4bc65c98f8bde89d6ec87541eb44
<ide><path>src/Illuminate/Auth/SessionGuard.php <ide> public function id() <ide> */ <ide> public function once(array $credentials = []) <ide> { <del> $this->fireAttemptEvent($credentials); <add> $this->fireAttemptEvent($credentials, false); <ide> <ide> if ($this->validate($credentials)) { <ide> $this->setUser($this->lastAttempted);
1
Javascript
Javascript
fix strictequal assertion order on readline tests
83fa60b37b775a1ef768b504a3cbae928a0c9c92
<ide><path>test/parallel/test-readline.js <ide> const assert = require('assert'); <ide> '' <ide> ].forEach(function(expectedLine) { <ide> rl.write.apply(rl, key.xterm.metad); <del> assert.strictEqual(0, rl.cursor); <del> assert.strictEqual(expectedLine, rl.line); <add> assert.strictEqual(rl.cursor, 0); <add> assert.strictEqual(rl.line, expectedLine); <ide> }); <ide> }
1
Ruby
Ruby
apply suggestions from code review
da007134c4f6ee37643752c662165d8da475c067
<ide><path>Library/Homebrew/dev-cmd/update-license-data.rb <ide> def update_license_data_args <ide> usage_banner <<~EOS <ide> `update_license_data` <cmd> <ide> <del> Update SPDX license data in the Homebrew repository. <add> Update SPDX license data in the Homebrew repository. <ide> EOS <ide> switch "--fail-if-changed", <del> description: "Return a failing status code if current license data's version is different from"\ <del> "the upstream. This can be used to notify CI when the SPDX license data is out of date." <add> description: "Return a failing status code if current license data's version is different from " \ <add> "the upstream. This can be used to notify CI when the SPDX license data is out of date." <ide> <ide> max_named 0 <ide> end <ide> end <ide> <ide> def update_license_data <ide> update_license_data_args.parse <del> puts "Fetching newest version of SPDX License data..." <del> resp = Net::HTTP.get_response(URI.parse(SPDX_DATA_URL)) <del> <del> File.open(SPDX_FOLDER_PATH/FILE_NAME, "wb") do |file| <del> file.write(resp.body) <del> end <add> ohai "Updating SPDX license data..." <add> spdx_data = curl(SPDX_DATA_URL) <add> SPDX_PATH.write(spdx_data) <ide> <ide> return unless args.fail_if_changed? <ide> <del> system("git diff --stat --exit-code #{SPDX_FOLDER_PATH/FILE_NAME}") <add> system("git diff --stat --exit-code #{SPDX_PATH}") <ide> end <ide> end
1
Text
Text
fix doc for napi_get_value_string_utf8
82bad0b4d8b17e998b0ff15066f253f7e47c2feb
<ide><path>doc/api/n-api.md <ide> NAPI_EXTERN napi_status napi_get_value_string_latin1(napi_env env, <ide> - `[in] value`: `napi_value` representing JavaScript string. <ide> - `[in] buf`: Buffer to write the ISO-8859-1-encoded string into. If NULL is <ide> passed in, the length of the string (in bytes) is returned. <del>- `[in] bufsize`: Size of the destination buffer. <del>- `[out] result`: Number of bytes copied into the buffer including the null <del>terminator. If the buffer size is insufficient, the string will be truncated <del>including a null terminator. <add>- `[in] bufsize`: Size of the destination buffer. When this value is <add>insufficient, the returned string will be truncated. <add>- `[out] result`: Number of bytes copied into the buffer, excluding the null <add>terminator. <ide> <ide> Returns `napi_ok` if the API succeeded. If a non-String `napi_value` <ide> is passed in it returns `napi_string_expected`. <ide> napi_status napi_get_value_string_utf8(napi_env env, <ide> - `[in] env`: The environment that the API is invoked under. <ide> - `[in] value`: `napi_value` representing JavaScript string. <ide> - `[in] buf`: Buffer to write the UTF8-encoded string into. If NULL is passed <del>in, the length of the string (in bytes) is returned. <del>- `[in] bufsize`: Size of the destination buffer. <del>- `[out] result`: Number of bytes copied into the buffer including the null <del>terminator. If the buffer size is insufficient, the string will be truncated <del>including a null terminator. <add> in, the length of the string (in bytes) is returned. <add>- `[in] bufsize`: Size of the destination buffer. When this value is <add>insufficient, the returned string will be truncated. <add>- `[out] result`: Number of bytes copied into the buffer, excluding the null <add>terminator. <ide> <ide> Returns `napi_ok` if the API succeeded. If a non-String `napi_value` <ide> is passed in it returns `napi_string_expected`. <ide> napi_status napi_get_value_string_utf16(napi_env env, <ide> - `[in] value`: `napi_value` representing JavaScript string. <ide> - `[in] buf`: Buffer to write the UTF16-LE-encoded string into. If NULL is <ide> passed in, the length of the string (in 2-byte code units) is returned. <del>- `[in] bufsize`: Size of the destination buffer. <del>- `[out] result`: Number of 2-byte code units copied into the buffer including <del>the null terminator. If the buffer size is insufficient, the string will be <del>truncated including a null terminator. <add>- `[in] bufsize`: Size of the destination buffer. When this value is <add>insufficient, the returned string will be truncated. <add>- `[out] result`: Number of 2-byte code units copied into the buffer, excluding the null <add>terminator. <ide> <ide> Returns `napi_ok` if the API succeeded. If a non-String `napi_value` <ide> is passed in it returns `napi_string_expected`.
1
Javascript
Javascript
add strict equalities in src/core/fonts.js
97b3eadbc48d86d91754aee024c9f4d1dfb17908
<ide><path>src/core/fonts.js <ide> var Font = (function FontClosure() { <ide> <ide> this.toFontChar = []; <ide> <del> if (properties.type == 'Type3') { <add> if (properties.type === 'Type3') { <ide> for (charCode = 0; charCode < 256; charCode++) { <ide> this.toFontChar[charCode] = (this.differences[charCode] || <ide> properties.defaultEncoding[charCode]); <ide> var Font = (function FontClosure() { <ide> var isStandardFont = fontName in stdFontMap; <ide> fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; <ide> <del> this.bold = (fontName.search(/bold/gi) != -1); <del> this.italic = ((fontName.search(/oblique/gi) != -1) || <del> (fontName.search(/italic/gi) != -1)); <add> this.bold = (fontName.search(/bold/gi) !== -1); <add> this.italic = ((fontName.search(/oblique/gi) !== -1) || <add> (fontName.search(/italic/gi) !== -1)); <ide> <ide> // Use 'name' instead of 'fontName' here because the original <ide> // name ArialBlack for example will be replaced by Helvetica. <del> this.black = (name.search(/Black/g) != -1); <add> this.black = (name.search(/Black/g) !== -1); <ide> <ide> // if at least one width is present, remeasure all chars when exists <ide> this.remeasure = Object.keys(this.widths).length > 0; <ide> var Font = (function FontClosure() { <ide> } <ide> <ide> // Some fonts might use wrong font types for Type1C or CIDFontType0C <del> if (subtype == 'Type1C' && (type != 'Type1' && type != 'MMType1')) { <add> if (subtype === 'Type1C' && (type !== 'Type1' && type !== 'MMType1')) { <ide> // Some TrueType fonts by mistake claim Type1C <ide> if (isTrueTypeFile(file)) { <ide> subtype = 'TrueType'; <ide> } else { <ide> type = 'Type1'; <ide> } <ide> } <del> if (subtype == 'CIDFontType0C' && type != 'CIDFontType0') { <add> if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') { <ide> type = 'CIDFontType0'; <ide> } <ide> // XXX: Temporarily change the type for open type so we trigger a warning. <ide> var Font = (function FontClosure() { <ide> <ide> function createOpenTypeHeader(sfnt, file, numTables) { <ide> // Windows hates the Mac TrueType sfnt version number <del> if (sfnt == 'true') { <add> if (sfnt === 'true') { <ide> sfnt = string32(0x00010000); <ide> } <ide> <ide> var Font = (function FontClosure() { <ide> var codeIndices = [codes[n].glyphId]; <ide> ++n; <ide> var end = start; <del> while (n < length && end + 1 == codes[n].fontCharCode) { <add> while (n < length && end + 1 === codes[n].fontCharCode) { <ide> codeIndices.push(codes[n].glyphId); <ide> ++end; <ide> ++n; <ide> var Font = (function FontClosure() { <ide> var data = file.getBytes(length); <ide> file.pos = previousPosition; <ide> <del> if (tag == 'head') { <add> if (tag === 'head') { <ide> // clearing checksum adjustment <ide> data[8] = data[9] = data[10] = data[11] = 0; <ide> data[17] |= 0x20; //Set font optimized for cleartype flag <ide> var Font = (function FontClosure() { <ide> var offset = font.getInt32() >>> 0; <ide> var useTable = false; <ide> <del> if (platformId == 1 && encodingId === 0) { <add> if (platformId === 1 && encodingId === 0) { <ide> useTable = true; <ide> // Continue the loop since there still may be a higher priority <ide> // table. <ide> var Font = (function FontClosure() { <ide> offsetIndex = segment.offsetIndex; <ide> <ide> for (j = start; j <= end; j++) { <del> if (j == 0xFFFF) { <add> if (j === 0xFFFF) { <ide> continue; <ide> } <ide> <ide> var Font = (function FontClosure() { <ide> }); <ide> } <ide> } <del> } else if (format == 6) { <add> } else if (format === 6) { <ide> // Format 6 is a 2-bytes dense mapping, which means the font data <ide> // lives glue together even if they are pretty far in the unicode <ide> // table. (This looks weird, so I can have missed something), this <ide> var Font = (function FontClosure() { <ide> break; <ide> case 0x00020000: <ide> var numGlyphs = font.getUint16(); <del> if (numGlyphs != maxpNumGlyphs) { <add> if (numGlyphs !== maxpNumGlyphs) { <ide> valid = false; <ide> break; <ide> } <ide> var Font = (function FontClosure() { <ide> offset: font.getUint16() <ide> }; <ide> // using only Macintosh and Windows platform/encoding names <del> if ((r.platform == 1 && r.encoding === 0 && r.language === 0) || <del> (r.platform == 3 && r.encoding == 1 && r.language == 0x409)) { <add> if ((r.platform === 1 && r.encoding === 0 && r.language === 0) || <add> (r.platform === 3 && r.encoding === 1 && r.language === 0x409)) { <ide> records.push(r); <ide> } <ide> } <ide> var Font = (function FontClosure() { <ide> } <ide> <ide> var dupFirstEntry = false; <del> if (properties.type == 'CIDFontType2' && properties.toUnicode && <add> if (properties.type === 'CIDFontType2' && properties.toUnicode && <ide> properties.toUnicode[0] > '\u0000') { <ide> // oracle's defect (see 3427), duplicating first entry <ide> dupFirstEntry = true; <ide> var Font = (function FontClosure() { <ide> charcode = chars.charCodeAt(i); <ide> glyph = this.charToGlyph(charcode); <ide> glyphs.push(glyph); <del> if (charcode == 0x20) { <add> if (charcode === 0x20) { <ide> glyphs.push(null); <ide> } <ide> } <ide> var Type1Font = function Type1Font(name, file, properties) { <ide> var headerBlockLength = properties.length1; <ide> var eexecBlockLength = properties.length2; <ide> var pfbHeader = file.peekBytes(PFB_HEADER_SIZE); <del> var pfbHeaderPresent = pfbHeader[0] == 0x80 && pfbHeader[1] == 0x01; <add> var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01; <ide> if (pfbHeaderPresent) { <ide> file.skip(PFB_HEADER_SIZE); <ide> headerBlockLength = (pfbHeader[5] << 24) | (pfbHeader[4] << 16) | <ide> Type1Font.prototype = { <ide> // thought mapping names that aren't in the standard strings to .notdef <ide> // was fine, however in issue818 when mapping them all to .notdef the <ide> // adieresis glyph no longer worked. <del> if (index == -1) { <add> if (index === -1) { <ide> index = 0; <ide> } <ide> charsetArray.push((index >> 8) & 0xff, index & 0xff); <ide> var CFFParser = (function CFFParserClosure() { <ide> var b1 = b >> 4; <ide> var b2 = b & 15; <ide> <del> if (b1 == eof) { <add> if (b1 === eof) { <ide> break; <ide> } <ide> str += lookup[b1]; <ide> <del> if (b2 == eof) { <add> if (b2 === eof) { <ide> break; <ide> } <ide> str += lookup[b2]; <ide> var CFFParser = (function CFFParserClosure() { <ide> for (var j = 0; j < length;) { <ide> var value = data[j++]; <ide> var validationCommand = null; <del> if (value == 12) { <add> if (value === 12) { <ide> var q = data[j++]; <ide> if (q === 0) { <ide> // The CFF specification state that the 'dotsection' command <ide> var CFFParser = (function CFFParserClosure() { <ide> stack[stackSize] = ((data[j] << 24) | (data[j + 1] << 16)) >> 16; <ide> j += 2; <ide> stackSize++; <del> } else if (value == 14) { <add> } else if (value === 14) { <ide> if (stackSize >= 4) { <ide> stackSize -= 4; <ide> if (SEAC_ANALYSIS_ENABLED) { <ide> var CFFParser = (function CFFParserClosure() { <ide> -((value - 251) << 8) - data[j] - 108); <ide> j++; <ide> stackSize++; <del> } else if (value == 255) { // number (32 bit) <add> } else if (value === 255) { // number (32 bit) <ide> stack[stackSize] = ((data[j] << 24) | (data[j + 1] << 16) | <ide> (data[j + 2] << 8) | data[j + 3]) / 65536; <ide> j += 4; <ide> stackSize++; <del> } else if (value == 19 || value == 20) { <add> } else if (value === 19 || value === 20) { <ide> hints += stackSize >> 1; <ide> j += (hints + 7) >> 3; // skipping right amount of hints flag data <ide> stackSize = 0; <ide> var CFFParser = (function CFFParserClosure() { <ide> if (pos === 0) { <ide> return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, <ide> ISOAdobeCharset); <del> } else if (pos == 1) { <add> } else if (pos === 1) { <ide> return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, <ide> ExpertCharset); <del> } else if (pos == 2) { <add> } else if (pos === 2) { <ide> return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, <ide> ExpertSubsetCharset); <ide> } <ide> var CFFParser = (function CFFParserClosure() { <ide> } <ide> } <ide> <del> if (pos === 0 || pos == 1) { <add> if (pos === 0 || pos === 1) { <ide> predefined = true; <ide> format = pos; <ide> var baseEncoding = pos ? Encodings.ExpertEncoding : <ide> Encodings.StandardEncoding; <ide> for (i = 0, ii = charset.length; i < ii; i++) { <ide> var index = baseEncoding.indexOf(charset[i]); <del> if (index != -1) { <add> if (index !== -1) { <ide> encoding[index] = i; <ide> } <ide> } <ide> var CFFCompiler = (function CFFCompilerClosure() { <ide> return output.data; <ide> }, <ide> encodeNumber: function CFFCompiler_encodeNumber(value) { <del> if (parseFloat(value) == parseInt(value, 10) && !isNaN(value)) { // isInt <add> if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) { // isInt <ide> return this.encodeInteger(value); <ide> } else { <ide> return this.encodeFloat(value);
1
Javascript
Javascript
duplicate short map into private use area
09dfde69a285b547886c12539420673357726cb6
<ide><path>src/fonts.js <ide> var Font = (function FontClosure() { <ide> <ide> if (hasShortCmap && this.hasEncoding && !this.isSymbolicFont) { <ide> // Re-encode short map encoding to unicode -- that simplifies the <del> // resolution of MacRoman encoded glyphs logic for TrueType fonts. <add> // resolution of MacRoman encoded glyphs logic for TrueType fonts: <add> // copying all characters to private use area, all mapping all known <add> // glyphs to the unicodes. The glyphs and ids arrays will grow. <add> var usedUnicodes = []; <ide> for (var i = 0, ii = glyphs.length; i < ii; i++) { <ide> var code = glyphs[i].unicode; <add> glyphs[i].unicode += kCmapGlyphOffset; <add> <ide> var glyphName = properties.baseEncoding[code]; <del> if (!glyphName) <del> continue; <del> if (!(glyphName in GlyphsUnicode)) <del> continue; <del> glyphs[i].unicode = GlyphsUnicode[glyphName]; <add> if (glyphName in GlyphsUnicode) { <add> var unicode = GlyphsUnicode[glyphName]; <add> if (unicode in usedUnicodes) <add> continue; <add> <add> usedUnicodes[unicode] = true; <add> glyphs.push({ <add> unicode: unicode, <add> code: glyphs[i].code <add> }); <add> ids.push(ids[i]); <add> } <ide> } <ide> } <ide>
1
Javascript
Javascript
fix exporting globals in scope-hoisted modules
9315ce29aa41d05252a43036cc9f2ff15cad59ef
<ide><path>lib/optimize/ConcatenatedModule.js <ide> const getFinalName = ( <ide> } else if (!info.module.isUsed(exportName)) { <ide> return "/* unused export */ undefined"; <ide> } <add> if (info.globalExports.has(directExport)) { <add> return directExport; <add> } <ide> const name = info.internalNames.get(directExport); <ide> if (!name) { <ide> throw new Error( <ide> class ConcatenatedModule extends Module { <ide> globalScope: undefined, <ide> moduleScope: undefined, <ide> internalNames: new Map(), <add> globalExports: new Set(), <ide> exportMap: exportMap, <ide> reexportMap: reexportMap, <ide> hasNamespaceObject: false, <ide> class ConcatenatedModule extends Module { <ide> } <ide> } <ide> } <add> <add> // add exported globals <add> if (info.type === "concatenated") { <add> const variables = new Set(); <add> for (const variable of info.moduleScope.variables) { <add> variables.add(variable.name); <add> } <add> for (const [, variable] of info.exportMap) { <add> if (!variables.has(variable)) { <add> info.globalExports.add(variable); <add> } <add> } <add> } <ide> } <ide> <ide> // generate names for symbols <ide><path>test/configCases/scope-hoisting/export-global/index.js <add>import { process as p } from "./module"; <add>import { process as p2 } from "./module2"; <add> <add>it("should export globals correctly", () => { <add> expect(p).toBe(42); <add> expect(p2).toBe(process); <add>}); <ide><path>test/configCases/scope-hoisting/export-global/module.js <add>const process = 42; <add>export { process }; <ide><path>test/configCases/scope-hoisting/export-global/module2.js <add>export { process }; <ide><path>test/configCases/scope-hoisting/export-global/webpack.config.js <add>module.exports = { <add> optimization: { <add> concatenateModules: true <add> } <add>};
5
Go
Go
add support for reading journal extras and in utc
0da0a8f9dae35e6a9cb63b9e4a3285e24c001af3
<ide><path>daemon/logger/journald/read.go <ide> package journald <ide> // } <ide> // return rc; <ide> //} <add>//static int is_attribute_field(const char *msg, size_t length) <add>//{ <add>// const struct known_field { <add>// const char *name; <add>// size_t length; <add>// } fields[] = { <add>// {"MESSAGE", sizeof("MESSAGE") - 1}, <add>// {"MESSAGE_ID", sizeof("MESSAGE_ID") - 1}, <add>// {"PRIORITY", sizeof("PRIORITY") - 1}, <add>// {"CODE_FILE", sizeof("CODE_FILE") - 1}, <add>// {"CODE_LINE", sizeof("CODE_LINE") - 1}, <add>// {"CODE_FUNC", sizeof("CODE_FUNC") - 1}, <add>// {"ERRNO", sizeof("ERRNO") - 1}, <add>// {"SYSLOG_FACILITY", sizeof("SYSLOG_FACILITY") - 1}, <add>// {"SYSLOG_IDENTIFIER", sizeof("SYSLOG_IDENTIFIER") - 1}, <add>// {"SYSLOG_PID", sizeof("SYSLOG_PID") - 1}, <add>// {"CONTAINER_NAME", sizeof("CONTAINER_NAME") - 1}, <add>// {"CONTAINER_ID", sizeof("CONTAINER_ID") - 1}, <add>// {"CONTAINER_ID_FULL", sizeof("CONTAINER_ID_FULL") - 1}, <add>// {"CONTAINER_TAG", sizeof("CONTAINER_TAG") - 1}, <add>// }; <add>// unsigned int i; <add>// void *p; <add>// if ((length < 1) || (msg[0] == '_') || ((p = memchr(msg, '=', length)) == NULL)) { <add>// return -1; <add>// } <add>// length = ((const char *) p) - msg; <add>// for (i = 0; i < sizeof(fields) / sizeof(fields[0]); i++) { <add>// if ((fields[i].length == length) && (memcmp(fields[i].name, msg, length) == 0)) { <add>// return -1; <add>// } <add>// } <add>// return 0; <add>//} <add>//static int get_attribute_field(sd_journal *j, const char **msg, size_t *length) <add>//{ <add>// int rc; <add>// *msg = NULL; <add>// *length = 0; <add>// while ((rc = sd_journal_enumerate_data(j, (const void **) msg, length)) > 0) { <add>// if (is_attribute_field(*msg, *length) == 0) { <add>// break; <add>// } <add>// rc = -ENOENT; <add>// } <add>// return rc; <add>//} <ide> //static int wait_for_data_or_close(sd_journal *j, int pipefd) <ide> //{ <ide> // struct pollfd fds[2]; <ide> import "C" <ide> <ide> import ( <ide> "fmt" <add> "strings" <ide> "time" <ide> "unsafe" <ide> <ide> func (s *journald) Close() error { <ide> } <ide> <ide> func (s *journald) drainJournal(logWatcher *logger.LogWatcher, config logger.ReadConfig, j *C.sd_journal, oldCursor string) string { <del> var msg, cursor *C.char <add> var msg, data, cursor *C.char <ide> var length C.size_t <ide> var stamp C.uint64_t <ide> var priority C.int <ide> drain: <ide> } else if priority == C.int(journal.PriInfo) { <ide> source = "stdout" <ide> } <add> // Retrieve the values of any variables we're adding to the journal. <add> attrs := make(map[string]string) <add> C.sd_journal_restart_data(j) <add> for C.get_attribute_field(j, &data, &length) > C.int(0) { <add> kv := strings.SplitN(C.GoStringN(data, C.int(length)), "=", 2) <add> attrs[kv[0]] = kv[1] <add> } <add> if len(attrs) == 0 { <add> attrs = nil <add> } <ide> // Send the log message. <del> logWatcher.Msg <- &logger.Message{Line: line, Source: source, Timestamp: timestamp} <add> logWatcher.Msg <- &logger.Message{ <add> Line: line, <add> Source: source, <add> Timestamp: timestamp.In(time.UTC), <add> Attrs: attrs, <add> } <ide> } <ide> // If we're at the end of the journal, we're done (for now). <ide> if C.sd_journal_next(j) <= 0 {
1
PHP
PHP
use arrow functions for database
6cc602456ff3652a9b6178c4347e7f113965607b
<ide><path>src/Illuminate/Database/Connectors/ConnectionFactory.php <ide> protected function createPdoResolver(array $config) <ide> protected function createPdoResolverWithHosts(array $config) <ide> { <ide> return function () use ($config) { <del> foreach (Arr::shuffle($hosts = $this->parseHosts($config)) as $key => $host) { <add> foreach (Arr::shuffle($this->parseHosts($config)) as $host) { <ide> $config['host'] = $host; <ide> <ide> try { <ide> protected function parseHosts(array $config) <ide> */ <ide> protected function createPdoResolverWithoutHosts(array $config) <ide> { <del> return function () use ($config) { <del> return $this->createConnector($config)->connect($config); <del> }; <add> return fn () => $this->createConnector($config)->connect($config); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Database/DatabaseTransactionsManager.php <ide> public function begin($connection, $level) <ide> */ <ide> public function rollback($connection, $level) <ide> { <del> $this->transactions = $this->transactions->reject(function ($transaction) use ($connection, $level) { <del> return $transaction->connection == $connection && <del> $transaction->level > $level; <del> })->values(); <add> $this->transactions = $this->transactions->reject( <add> fn ($transaction) => $transaction->connection == $connection && $transaction->level > $level <add> )->values(); <ide> } <ide> <ide> /** <ide> public function rollback($connection, $level) <ide> public function commit($connection) <ide> { <ide> [$forThisConnection, $forOtherConnections] = $this->transactions->partition( <del> function ($transaction) use ($connection) { <del> return $transaction->connection == $connection; <del> } <add> fn ($transaction) => $transaction->connection == $connection <ide> ); <ide> <ide> $this->transactions = $forOtherConnections->values();
2
Python
Python
fix compiler flags, addressing
2e449c1fbfd1fdb948da6056c3694a23de1bdf46
<ide><path>setup.py <ide> <ide> COMPILE_OPTIONS = { <ide> 'msvc': ['/Ox', '/EHsc'], <del> 'mingw32' : ['-O3', '-Wno-strict-prototypes', '-Wno-unused-function'], <del> 'other' : ['-O3', '-Wno-strict-prototypes', '-Wno-unused-function', <del> '-march=native'] <add> 'mingw32' : ['-O2', '-Wno-strict-prototypes', '-Wno-unused-function'], <add> 'other' : ['-O2', '-Wno-strict-prototypes', '-Wno-unused-function'] <ide> } <ide> <ide>
1
Javascript
Javascript
add hyphen on drawerlockmode values
20cd7ac339cd01f19ed3d74b6a4ce87b584be9aa
<ide><path>Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js <ide> var DrawerLayoutAndroid = React.createClass({ <ide> /** <ide> * Specifies the lock mode of the drawer. The drawer can be locked in 3 states: <ide> * - unlocked (default), meaning that the drawer will respond (open/close) to touch gestures. <del> * - locked closed, meaning that the drawer will stay closed and not respond to gestures. <del> * - locked open, meaning that the drawer will stay opened and not respond to gestures. <add> * - locked-closed, meaning that the drawer will stay closed and not respond to gestures. <add> * - locked-open, meaning that the drawer will stay opened and not respond to gestures. <ide> * The drawer may still be opened and closed programmatically (`openDrawer`/`closeDrawer`). <ide> */ <ide> drawerLockMode: ReactPropTypes.oneOf([
1
Text
Text
update discussion template
a6e27c3f5593971dea7c350b52bae6f893dfdffd
<ide><path>.github/ISSUE_TEMPLATE/discussion.md <ide> --- <ide> name: 🗣 Start a Discussion <del>about: Use https://discuss.reactjs.org/ to propose changes or discuss feature requests. <add>about: Use https://github.com/react-native-community/discussions-and-proposals to propose changes or discuss feature requests. <ide> --- <ide> <del>Please use https://discuss.reactjs.org/ to propose changes or discuss feature requests. <add>Please use https://github.com/react-native-community/discussions-and-proposals to propose changes or discuss feature requests. <ide> <del>If you feel strongly about starting a discussion as a GitHub Issue instead of using the discussion forum, you may follow this template. <add>We kindly ask that issues of this type are kept in that dedicated repo, to ensure bug reports and regressions are given the priority they require. <ide> <del>We kindly ask that issues of this type are kept to a minimum to ensure bug reports and regressions are given the priority they require. <del> <del>Maintainers may flag an issue for Stack Overflow or kindly ask you to move the discussion to https://discuss.reactjs.org at their own discretion. <add>Maintainers may flag an issue for Stack Overflow or kindly ask you to move the discussion to https://github.com/react-native-community/discussions-and-proposals at their own discretion. <ide> <ide> --- <ide>
1
Ruby
Ruby
use the file watcher defined by the app config
ea3b6ac6ca8d2d60e393ed983a5d436bb135e503
<ide><path>activesupport/lib/active_support/i18n_railtie.rb <ide> def self.initialize_i18n(app) <ide> I18n.enforce_available_locales = enforce_available_locales <ide> <ide> directories = watched_dirs_with_extensions(reloadable_paths) <del> reloader = ActiveSupport::FileUpdateChecker.new(I18n.load_path.dup, directories) do <add> reloader = app.config.file_watcher.new(I18n.load_path.dup, directories) do <ide> I18n.load_path.keep_if { |p| File.exist?(p) } <ide> I18n.load_path |= reloadable_paths.map(&:existent).flatten <ide>
1
Javascript
Javascript
remove timermixin from touchablewithoutfeedback
6c2001715246c5e92c1b08edb9df352c863575a3
<ide><path>Libraries/Components/Touchable/TouchableWithoutFeedback.js <ide> const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); <ide> const React = require('React'); <ide> const PropTypes = require('prop-types'); <del>const TimerMixin = require('react-timer-mixin'); <ide> const Touchable = require('Touchable'); <ide> const View = require('View'); <ide> <ide> export type Props = $ReadOnly<{| <ide> */ <ide> const TouchableWithoutFeedback = ((createReactClass({ <ide> displayName: 'TouchableWithoutFeedback', <del> mixins: [TimerMixin, Touchable.Mixin], <add> mixins: [Touchable.Mixin], <ide> <ide> propTypes: { <ide> accessible: PropTypes.bool, <ide><path>RNTester/js/TouchableExample.js <ide> var { <ide> TouchableOpacity, <ide> Platform, <ide> TouchableNativeFeedback, <add> TouchableWithoutFeedback, <ide> View, <ide> } = ReactNative; <ide> <ide> exports.examples = [ <ide> ); <ide> }, <ide> }, <add> { <add> title: '<TouchableWithoutFeedback>', <add> render: function() { <add> return <TouchableWithoutFeedbackBox />; <add> }, <add> }, <ide> { <ide> title: 'TouchableNativeFeedback with Animated child', <ide> description: <ide> exports.examples = [ <ide> }, <ide> ]; <ide> <add>class TouchableWithoutFeedbackBox extends React.Component<{}, $FlowFixMeState> { <add> state = { <add> timesPressed: 0, <add> }; <add> <add> textOnPress = () => { <add> this.setState({ <add> timesPressed: this.state.timesPressed + 1, <add> }); <add> }; <add> <add> render() { <add> var textLog = ''; <add> if (this.state.timesPressed > 1) { <add> textLog = this.state.timesPressed + 'x TouchableWithoutFeedback onPress'; <add> } else if (this.state.timesPressed > 0) { <add> textLog = 'TouchableWithoutFeedback onPress'; <add> } <add> <add> return ( <add> <View> <add> <TouchableWithoutFeedback onPress={this.textOnPress}> <add> <View style={styles.wrapperCustom}> <add> <Text style={styles.text}>Tap Here For No Feedback!</Text> <add> </View> <add> </TouchableWithoutFeedback> <add> <View style={styles.logBox}> <add> <Text>{textLog}</Text> <add> </View> <add> </View> <add> ); <add> } <add>} <add> <ide> class TextOnPressBox extends React.Component<{}, $FlowFixMeState> { <ide> state = { <ide> timesPressed: 0, <ide> class TouchableDisabled extends React.Component<{}> { <ide> <Text style={styles.button}>Enabled TouchableHighlight</Text> <ide> </TouchableHighlight> <ide> <add> <TouchableWithoutFeedback <add> onPress={() => console.log('TWOF has been clicked')} <add> disabled={true}> <add> <View style={styles.wrapperCustom}> <add> <Text <add> style={[ <add> styles.button, <add> styles.nativeFeedbackButton, <add> styles.disabledButton, <add> ]}> <add> Disabled TouchableWithoutFeedback <add> </Text> <add> </View> <add> </TouchableWithoutFeedback> <add> <add> <TouchableWithoutFeedback <add> onPress={() => console.log('TWOF has been clicked')} <add> disabled={false}> <add> <View style={styles.wrapperCustom}> <add> <Text style={[styles.button, styles.nativeFeedbackButton]}> <add> Enabled TouchableWithoutFeedback <add> </Text> <add> </View> <add> </TouchableWithoutFeedback> <add> <ide> {Platform.OS === 'android' && ( <ide> <TouchableNativeFeedback <ide> style={[styles.row, styles.block]}
2
Javascript
Javascript
update query/hash test for safari
89e572b12ba369845fa6289535b068ceb27002a0
<ide><path>test/integration/production/test/index.test.js <ide> describe('Production Usage', () => { <ide> await browser.waitForElementByCss('.about-page') <ide> }) <ide> <del> it.each([ <del> { hash: '#hello?' }, <del> { hash: '#?' }, <del> { hash: '##' }, <del> { hash: '##?' }, <del> { hash: '##hello?' }, <del> { hash: '##hello' }, <del> { hash: '#hello?world' }, <del> { search: '?hello=world', hash: '#a', query: { hello: 'world' } }, <del> { search: '?hello', hash: '#a', query: { hello: '' } }, <del> { search: '?hello=', hash: '#a', query: { hello: '' } }, <del> ])( <del> 'should handle query/hash correctly during query updating $hash $search', <del> async ({ hash, search, query }) => { <del> const browser = await webdriver(appPort, `/${search || ''}${hash || ''}`) <add> if (process.env.BROWSER_NAME !== 'safari') { <add> it.each([ <add> { hash: '#hello?' }, <add> { hash: '#?' }, <add> { hash: '##' }, <add> { hash: '##?' }, <add> { hash: '##hello?' }, <add> { hash: '##hello' }, <add> { hash: '#hello?world' }, <add> { search: '?hello=world', hash: '#a', query: { hello: 'world' } }, <add> { search: '?hello', hash: '#a', query: { hello: '' } }, <add> { search: '?hello=', hash: '#a', query: { hello: '' } }, <add> ])( <add> 'should handle query/hash correctly during query updating $hash $search', <add> async ({ hash, search, query }) => { <add> const browser = await webdriver( <add> appPort, <add> `/${search || ''}${hash || ''}` <add> ) <ide> <del> await check( <del> () => <del> browser.eval('window.next.router.isReady ? "ready" : "not ready"'), <del> 'ready' <del> ) <del> expect(await browser.eval('window.location.pathname')).toBe('/') <del> expect(await browser.eval('window.location.hash')).toBe(hash || '') <del> expect(await browser.eval('window.location.search')).toBe(search || '') <del> expect(await browser.eval('next.router.pathname')).toBe('/') <del> expect( <del> JSON.parse(await browser.eval('JSON.stringify(next.router.query)')) <del> ).toEqual(query || {}) <del> } <del> ) <add> await check( <add> () => <add> browser.eval('window.next.router.isReady ? "ready" : "not ready"'), <add> 'ready' <add> ) <add> expect(await browser.eval('window.location.pathname')).toBe('/') <add> expect(await browser.eval('window.location.hash')).toBe(hash || '') <add> expect(await browser.eval('window.location.search')).toBe(search || '') <add> expect(await browser.eval('next.router.pathname')).toBe('/') <add> expect( <add> JSON.parse(await browser.eval('JSON.stringify(next.router.query)')) <add> ).toEqual(query || {}) <add> } <add> ) <add> } <ide> <ide> it('should not show target deprecation warning', () => { <ide> expect(output).not.toContain(
1
Javascript
Javascript
handle the empty string as a valid override
67a4a25b890fada0043c1ff98e5437d793f44d0c
<ide><path>src/ng/directive/ngPluralize.js <ide> var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp <ide> if (!isNaN(value)) { <ide> //if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise, <ide> //check it against pluralization rules in $locale service <del> if (!whens[value]) value = $locale.pluralCat(value - offset); <add> if (!(value in whens)) value = $locale.pluralCat(value - offset); <ide> return whensExpFns[value](scope, element, true); <ide> } else { <ide> return ''; <ide><path>test/ng/directive/ngPluralizeSpec.js <ide> describe('ngPluralize', function() { <ide> }); <ide> <ide> <add> describe('edge cases', function() { <add> it('should be able to handle empty strings as possible values', inject(function($rootScope, $compile) { <add> element = $compile( <add> '<ng:pluralize count="email"' + <add> "when=\"{'0': ''," + <add> "'one': 'Some text'," + <add> "'other': 'Some text'}\">" + <add> '</ng:pluralize>')($rootScope); <add> $rootScope.email = '0'; <add> $rootScope.$digest(); <add> expect(element.text()).toBe(''); <add> })); <add> }); <add> <add> <ide> describe('deal with pluralized strings with offset', function() { <ide> it('should show single/plural strings with offset', inject(function($rootScope, $compile) { <ide> element = $compile(
2
Javascript
Javascript
fix typo in lib/internal/crypto/certificate.js
6f941456370322b2aeb83585064532992b7bd8a7
<ide><path>lib/internal/crypto/certificate.js <ide> const { <ide> } = require('internal/crypto/util'); <ide> <ide> // The functions contained in this file cover the SPKAC format <del>// (also refered to as Netscape SPKI). A general description of <add>// (also referred to as Netscape SPKI). A general description of <ide> // the format can be found at https://en.wikipedia.org/wiki/SPKAC <ide> <ide> function verifySpkac(spkac, encoding) {
1
Text
Text
fix error page doc for no server import in page
6274733fcb67ad87f15a8d0d9c1fc3b9a178b491
<ide><path>errors/no-server-import-in-page.md <ide> <ide> ### Why This Error Occurred <ide> <del>`next/server` was imported in a page outside of `pages/_middleware.js` (or `pages/_middleware.tsx` if you are using TypeScript) <add>`next/server` was imported outside of `pages/**/_middleware.{js,ts}`. <ide> <ide> ### Possible Ways to Fix It <ide> <del>Only import and use `next/server` within `pages/_middleware.js` (or `pages/_middleware.tsx`) to add middlewares. <add>Only import and use `next/server` in a file located within the pages directory: `pages/**/_middleware.{js,ts}`. <ide> <del>```jsx <add>```ts <ide> // pages/_middleware.ts <ide> <ide> import type { NextFetchEvent, NextRequest } from 'next/server'
1
PHP
PHP
update method signature
79b8b701e1be8e90372aec1f34724b63204b44a4
<ide><path>src/Illuminate/Console/View/Components/Factory.php <ide> * @method void alert(string $string, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL) <ide> * @method void bulletList(array $elements, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL) <ide> * @method mixed choice(string $question, array $choices, $default = null) <del> * @method bool confirm(string $question, bool $default = true) <add> * @method bool confirm(string $question, bool $default = false) <ide> * @method void error(string $string, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL) <ide> * @method void info(string $string, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL) <ide> * @method void line(string $style, string $string, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL)
1
Javascript
Javascript
fix test-process-env-tz.js by using regexp
b35ee26f03021eb196fff0dec47291b0bb2f1c3a
<ide><path>test/parallel/test-process-env-tz.js <ide> if (date.toString().includes('(Central European Time)') || <ide> common.skip('tzdata too old'); <ide> } <ide> <del>assert.strictEqual( <del> date.toString().replace('Central European Summer Time', 'CEST'), <del> 'Sat Apr 14 2018 14:34:56 GMT+0200 (CEST)'); <add>assert.match( <add> date.toString(), <add> /^Sat Apr 14 2018 14:34:56 GMT\+0200 \(.+\)$/); <ide> <ide> process.env.TZ = 'Europe/London'; <del>assert.strictEqual( <del> date.toString().replace('British Summer Time', 'BST'), <del> 'Sat Apr 14 2018 13:34:56 GMT+0100 (BST)'); <add>assert.match( <add> date.toString(), <add> /^Sat Apr 14 2018 13:34:56 GMT\+0100 \(.+\)$/); <ide> <ide> process.env.TZ = 'Etc/UTC'; <del>assert.strictEqual( <del> date.toString().replace('Coordinated Universal Time', 'UTC'), <del> 'Sat Apr 14 2018 12:34:56 GMT+0000 (UTC)'); <add>assert.match( <add> date.toString(), <add> /^Sat Apr 14 2018 12:34:56 GMT\+0000 \(.+\)$/); <ide> <ide> // Just check that deleting the environment variable doesn't crash the process. <ide> // We can't really check the result of date.toString() because we don't know
1
PHP
PHP
add test cases
b0035ff17ea0fdd86997cc8ab4024a5b67377226
<ide><path>tests/Database/DatabaseEloquentModelTest.php <ide> public function testFindMethodCallsQueryBuilderCorrectly() <ide> $this->assertEquals('foo', $result); <ide> } <ide> <add> public function testFindMethodUseWritePdo() <add> { <add> $result = EloquentModelFindWithWritePdoStub::onWrite()->find(1); <add> } <add> <ide> /** <ide> * @expectedException Illuminate\Database\Eloquent\ModelNotFoundException <ide> */ <ide> public function newQuery() <ide> } <ide> } <ide> <add>class EloquentModelFindWithWritePdoStub extends Illuminate\Database\Eloquent\Model { <add> public function newQuery() <add> { <add> $mock = m::mock('Illuminate\Database\Eloquent\Builder'); <add> $mock->shouldReceive('useWritePdo')->once()->andReturnSelf(); <add> $mock->shouldReceive('find')->once()->with(1)->andReturn('foo'); <add> <add> return $mock; <add> } <add>} <add> <ide> class EloquentModelFindNotFoundStub extends Illuminate\Database\Eloquent\Model { <ide> public function newQuery() <ide> { <ide><path>tests/Database/DatabaseQueryBuilderTest.php <ide> public function testBasicSelect() <ide> } <ide> <ide> <add> public function testBasicSelectUseWritePdo() <add> { <add> $builder = $this->getMySqlBuilderWithProcessor(); <add> $builder->getConnection()->shouldReceive('select')->once() <add> ->with('select * from `users`', array(), false); <add> $builder->useWritePdo()->select('*')->from('users')->get(); <add> <add> $builder = $this->getMySqlBuilderWithProcessor(); <add> $builder->getConnection()->shouldReceive('select')->once() <add> ->with('select * from `users`', array()); <add> $builder->select('*')->from('users')->get(); <add> } <add> <add> <ide> public function testBasicTableWrappingProtectsQuotationMarks() <ide> { <ide> $builder = $this->getBuilder(); <ide> protected function getSqlServerBuilder() <ide> return new Builder(m::mock('Illuminate\Database\ConnectionInterface'), $grammar, $processor); <ide> } <ide> <add> protected function getMySqlBuilderWithProcessor() <add> { <add> $grammar = new Illuminate\Database\Query\Grammars\MySqlGrammar; <add> $processor = new Illuminate\Database\Query\Processors\MySqlProcessor; <add> return new Builder(m::mock('Illuminate\Database\ConnectionInterface'), $grammar, $processor); <add> } <add> <ide> }
2
Javascript
Javascript
add test for dispatch
7d018fbc41a40b8832026c0ed8b86233dcd48e57
<ide><path>test/core/dispatch-test.js <add>require("../env"); <add>require("../../d3"); <add> <add>var vows = require("vows"), <add> assert = require("assert"); <add> <add>var suite = vows.describe("d3.dispatch"); <add> <add>suite.addBatch({ <add> "dispatch": { <add> topic: function() { <add> return d3.dispatch; <add> }, <add> "returns a map of dispatchers for each event type": function(dispatch) { <add> assert.deepEqual(dispatch(), {}); <add> var d = dispatch("foo"); <add> assert.isTrue("foo" in d); <add> assert.isFalse("bar" in d); <add> var d = dispatch("foo", "bar"); <add> assert.isTrue("foo" in d); <add> assert.isTrue("bar" in d); <add> }, <add> "added listeners receive subsequent events": function(dispatch) { <add> var d = dispatch("foo"), events = 0; <add> d.foo.add(function() { ++events; }); <add> d.foo.dispatch(); <add> assert.equal(events, 1); <add> d.foo.dispatch(); <add> d.foo.dispatch(); <add> assert.equal(events, 3); <add> }, <add> "the listener is passed any arguments to dispatch": function(dispatch) { <add> var d = dispatch("foo"), a = {}, b = {}, aa, bb; <add> d.foo.add(function(a, b) { aa = a; bb = b; }); <add> d.foo.dispatch(a, b); <add> assert.equal(aa, a); <add> assert.equal(bb, b); <add> d.foo.dispatch(1, "foo"); <add> assert.equal(aa, 1); <add> assert.equal(bb, "foo"); <add> }, <add> "the listener's context is the same as dispatch's": function(dispatch) { <add> var d = dispatch("foo"), a = {}, b = {}, that; <add> d.foo.add(function() { that = this; }); <add> d.foo.dispatch.call(a); <add> assert.equal(that, a); <add> d.foo.dispatch.call(b); <add> assert.equal(that, b); <add> }, <add> "listeners are notified in the order they are first added": function(dispatch) { <add> var d = dispatch("foo"), a = {}, b = {}, those = []; <add> function A() { those.push(a); } <add> function B() { those.push(b); } <add> d.foo.add(A); <add> d.foo.add(B); <add> d.foo.dispatch(); <add> assert.deepEqual(those, [a, b]); <add> those = []; <add> d.foo.remove(A); <add> d.foo.add(A); <add> d.foo.dispatch(); <add> assert.deepEqual(those, [a, b]); <add> }, <add> "removed listeners do not receive subsequent events": function(dispatch) { <add> var d = dispatch("foo"), a = {}, b = {}, those = []; <add> function A() { those.push(a); } <add> function B() { those.push(b); } <add> d.foo.add(A); <add> d.foo.add(B); <add> d.foo.dispatch(); <add> those = []; <add> d.foo.remove(A); <add> d.foo.dispatch(); <add> assert.deepEqual(those, [b]); <add> }, <add> "adding an existing listener has no effect": function(dispatch) { <add> var d = dispatch("foo"), events = 0; <add> function A() { ++events; } <add> d.foo.add(A); <add> d.foo.dispatch(); <add> d.foo.add(A); <add> d.foo.add(A); <add> d.foo.dispatch(); <add> assert.equal(events, 2); <add> }, <add> "removing a missing listener has no effect": function(dispatch) { <add> var d = dispatch("foo"), events = 0; <add> function A() { ++events; } <add> d.foo.remove(A); <add> d.foo.add(A); <add> d.foo.remove(A); <add> d.foo.remove(A); <add> d.foo.dispatch(); <add> assert.equal(events, 0); <add> }, <add> "adding a listener does not affect the current event": function(dispatch) { <add> var d = dispatch("foo"), a = {}, b = {}, those = []; <add> function A() { d.foo.add(B); those.push(a); } <add> function B() { those.push(b); } <add> d.foo.add(A); <add> d.foo.dispatch(); <add> assert.deepEqual(those, [a]); <add> }, <add> "removing a listener does affect the current event": function(dispatch) { <add> var d = dispatch("foo"), a = {}, b = {}, those = []; <add> function A() { d.foo.remove(B); those.push(a); } <add> function B() { those.push(b); } <add> d.foo.add(A); <add> d.foo.add(B); <add> d.foo.dispatch(); <add> assert.deepEqual(those, [a]); <add> } <add> } <add>}); <add> <add>suite.export(module);
1
Python
Python
improve illustartion of unsupported args
3b27713a2c2d432a2ece6344417df93422d3f96c
<ide><path>numpy/doc/dispatch.py <ide> class to indicate that it would like to handle computations in a custom-defined <ide> calls ``numpy.sum(self)``, and the same for ``mean``. <ide> <ide> >>> @implements(np.sum) <del>... def sum(a, axis=None, out=None): <add>... def sum(a): <ide> ... "Implementation of np.sum for DiagonalArray objects" <del>... if axis is not None: <del>... raise TypeError("DiagonalArrays cannot be summed along one axis.") <ide> ... return arr._i * arr._N <ide> ... <ide> >>> @implements(np.mean) <del>... def sum(a, axis=None, out=None): <add>... def sum(a): <ide> ... "Implementation of np.mean for DiagonalArray objects" <ide> ... return arr._i / arr._N <ide> ... <ide> class to indicate that it would like to handle computations in a custom-defined <ide> >>> np.concatenate([arr, arr]) <ide> TypeError: no implementation found for 'numpy.concatenate' on types that implement __array_function__: [<class '__main__.DiagonalArray'>] <ide> <del>The user always has the option of converting to a normal <del>``numpy.ndarray`` with :func:`numpy.asarray` and using standard numpy from there. <add>Additionally, our implementations of ``sum`` and ``mean`` do not accept the <add>optional arguments that numpy's implementation does. <add> <add>>>> np.sum(arr, axis=0) <add>TypeError: sum() got an unexpected keyword argument 'axis' <add> <add>The user always has the option of converting to a normal ``numpy.ndarray`` with <add>:func:`numpy.asarray` and using standard numpy from there. <ide> <ide> >>> np.concatenate([np.asarray(arr), np.asarray(arr)]) <ide> array([[1., 0., 0., 0., 0.],
1
Text
Text
fix nodei-image in readme
6f8580a2f6675250bad8e9c8e7bc932863598614
<ide><path>README.md <ide> I'm very thankful for every dollar. If you leave your username or email, I may s <ide> [david-dev-image]: https://david-dm.org/webpack/webpack/dev-status.svg <ide> [david-peer-url]: https://david-dm.org/webpack/webpack#info=peerDependencies <ide> [david-peer-image]: https://david-dm.org/webpack/webpack/peer-status.svg <del>[nodei-image]: https://www.npmjs.com/package/webpack.png?downloads=true&downloadRank=true&stars=true <add>[nodei-image]: https://nodei.co/npm/webpack.png?downloads=true&downloadRank=true&stars=true <ide> [nodei-url]: https://www.npmjs.com/package/webpack <ide> [donate-url]: http://sokra.github.io/ <ide> [donate-image]: https://img.shields.io/badge/donate-sokra-brightgreen.svg
1
Python
Python
add a comment on why we need to use a property
e9c7e7ef10aab669bb89e5940dba2f69a85bfd1b
<ide><path>libcloud/common/base.py <ide> def response(self): <ide> <ide> @property <ide> def body(self): <add> # Note: We use property to avoid saving whole response body into RAM <add> # See https://github.com/apache/libcloud/pull/1132 for details <ide> return self.response.body <ide> <ide> @property <ide><path>libcloud/http.py <ide> def version(self): <ide> <ide> @property <ide> def body(self): <add> # NOTE: We use property to avoid saving whole response body into RAM <add> # See https://github.com/apache/libcloud/pull/1132 for details <ide> return self._response.content
2
PHP
PHP
remove translation from this test
d66ad0bc60f5614d5d6b47f3abd22e0288ea5786
<ide><path>lib/Cake/tests/cases/console/libs/help_formatter.test.php <ide> class HelpFormatterTest extends CakeTestCase { <ide> */ <ide> function testWidthFormatting() { <ide> $parser = new ConsoleOptionParser('test', false); <del> $parser->description(__d('cake', 'This is fifteen This is fifteen This is fifteen')) <add> $parser->description('This is fifteen This is fifteen This is fifteen') <ide> ->addOption('four', array('help' => 'this is help text this is help text')) <ide> ->addArgument('four', array('help' => 'this is help text this is help text')) <ide> ->addSubcommand('four', array('help' => 'this is help text this is help text')); <ide> function testXmlHelpAsObject() { <ide> $result = $formatter->xml(false); <ide> $this->assertInstanceOf('SimpleXmlElement', $result); <ide> } <del>} <add>} <ide>\ No newline at end of file
1
PHP
PHP
fix bug with check state in form builder
9acec8dcb91e6e7b0dbf774d764906345f3b1743
<ide><path>src/Illuminate/Html/FormBuilder.php <ide> public function radio($name, $value = null, $checked = null, $options = array()) <ide> */ <ide> protected function checkable($type, $name, $value, $checked, $options) <ide> { <del> if (is_null($checked)) $checked = (bool) $this->getValueAttribute($name, null); <add> if (is_null($checked)) $checked = $this->getCheckedState($type, $name, $value); <ide> <ide> if ($checked) $options['checked'] = 'checked'; <ide> <ide> return $this->input($type, $name, $value, $options); <ide> } <ide> <add> /** <add> * Get the check state for a checkable input. <add> * <add> * @param string $type <add> * @param string $name <add> * @param mixed $value <add> * @return void <add> */ <add> protected function getCheckedState($type, $name, $value) <add> { <add> if ($type == 'checkbox') return (bool) $this->getValueAttribute($name); <add> <add> return $this->getValueAttribute($name) == $value; <add> } <add> <ide> /** <ide> * Create a submit button element. <ide> * <ide> protected function getIdAttribute($name, $attributes) <ide> * @param string $value <ide> * @return string <ide> */ <del> protected function getValueAttribute($name, $value) <add> protected function getValueAttribute($name, $value = null) <ide> { <ide> if ( ! is_null($value)) return $value; <ide>
1
Text
Text
add changes for 1.2.17 and 1.3.0-beta-11
ebf59b4206afd801e3effd440e8d930063f1f8f3
<ide><path>CHANGELOG.md <add><a name="1.3.0-beta.11"></a> <add># 1.3.0-beta.11 transclusion-deforestation (2014-06-06) <add> <add> <add>## Bug Fixes <add> <add>- **$animate:** remove the need to add `display:block !important` for `ngShow`/`ngHide` <add> ([7c011e79](https://github.com/angular/angular.js/commit/7c011e79d8b3d805755181ace472883800234bf4), <add> [#3813](https://github.com/angular/angular.js/issues/3813)) <add>- **$compile:** <add> - bound transclusion to correct scope <add> ([56c60218](https://github.com/angular/angular.js/commit/56c60218d1e70e3a47e37193a4a48714eeda7d44)) <add> - set the iteration state before linking <add> ([0c8a2cd2](https://github.com/angular/angular.js/commit/0c8a2cd2da3a4a9f5d2ee9c25ea8ed56d74a93ab)) <add> - don't pass transcludes to non-transclude templateUrl directives <add> ([2ee29c5d](https://github.com/angular/angular.js/commit/2ee29c5da81ffacdc1cabb438f5d125d5e116cb9)) <add> - don't pass transclude to template of non-transclude directive <add> ([19af0397](https://github.com/angular/angular.js/commit/19af0397456eb8fc06dea47145fdee0e38e62f81)) <add> - fix nested isolated transclude directives <add> ([d414b787](https://github.com/angular/angular.js/commit/d414b787173643362c0c513a1929d8e715ca340e), <add> [#1809](https://github.com/angular/angular.js/issues/1809), [#7499](https://github.com/angular/angular.js/issues/7499)) <add> - pass transcludeFn down to nested transclude directives <add> ([1fef5fe8](https://github.com/angular/angular.js/commit/1fef5fe8230e8dc53f2c9f3f510a35cf18eeab43), <add> [#7240](https://github.com/angular/angular.js/issues/7240), [#7387](https://github.com/angular/angular.js/issues/7387)) <add>- **$parse:** fix parsing error with leading space and one time bind <add> ([24c844df](https://github.com/angular/angular.js/commit/24c844df3b6d80103b01e4847b2d55b082757feb), <add> [#7640](https://github.com/angular/angular.js/issues/7640)) <add>- **angular.copy:** support circular references in the value being copied <add> ([083f496d](https://github.com/angular/angular.js/commit/083f496d46415c01fec6dfa012da63235d0996e4), <add> [#7618](https://github.com/angular/angular.js/issues/7618)) <add>- **angular.toJson:** only strip properties beginning with `$$`, not `$` <add> ([c054288c](https://github.com/angular/angular.js/commit/c054288c9722875e3595e6e6162193e0fb67a251)) <add>- **ngAnimate:** <add> - `$animate` methods should accept native DOM elements <add> ([222d4737](https://github.com/angular/angular.js/commit/222d47370e585d9de9fa842310734ba1dd895fab)) <add> - fix property name that is used to calculate cache key <add> ([9f5c4370](https://github.com/angular/angular.js/commit/9f5c4370489043ed953c102340ce203a822c8b42), <add> [#7566](https://github.com/angular/angular.js/issues/7566)) <add>- **ngClass:** support multiple classes in key <add> ([7eaaca8e](https://github.com/angular/angular.js/commit/7eaaca8ef2b3db76b7c87e98d264d4b16d90a392)) <add>- **ngIf:** ensure that the correct (transcluded) scope is used <add> ([d71df9f8](https://github.com/angular/angular.js/commit/d71df9f83cd3882295ca01b1bb8ad7fb024165b6)) <add>- **ngLocale:** fix i18n code-generation to support `get_vf_`, `decimals_`, and `get_wt_` <add> ([cbab51ca](https://github.com/angular/angular.js/commit/cbab51cac5d6460938e4dfe0035d624df2208d6c)) <add>- **ngRepeat:** ensure that the correct (transcluded) scope is used <add> ([b87e5fc0](https://github.com/angular/angular.js/commit/b87e5fc0920915991122ba5dac87b619847b3568)) <add>- **ngShow:** ensure that the display property is never set to `block` <add> ([1d90744f](https://github.com/angular/angular.js/commit/1d90744f4095ee202616a30f5d6f060fc8e74b20), <add> [#7707](https://github.com/angular/angular.js/issues/7707)) <add> <add> <add>## Features <add> <add>- **$resource:** allow props beginning with `$` to be used on resources <add> ([d3c50c84](https://github.com/angular/angular.js/commit/d3c50c845671f0f8bcc3f7842df9e2fb1d1b1c40)) <add> <add> <add>## Breaking Changes <add> <add>- **$resource:** due to [d3c50c84](https://github.com/angular/angular.js/commit/d3c50c845671f0f8bcc3f7842df9e2fb1d1b1c40), <add> <add> If you expected `$resource` to strip these types of properties before, <add> you will have to manually do this yourself now. <add> <add>- **angular.toJson:** due to [c054288c](https://github.com/angular/angular.js/commit/c054288c9722875e3595e6e6162193e0fb67a251), <add> <add> If you expected `toJson` to strip these types of properties before, <add> you will have to manually do this yourself now. <add> <add> <add> <add><a name="1.2.17"></a> <add># 1.2.17 - quantum disentanglement (2014-06-06) <add> <add> <add>## Bug Fixes <add> <add>- **$animate:** <add> - remove the need to add `display:block!important` for `ngShow`/`ngHide` <add> ([55b2f0e8](https://github.com/angular/angular.js/commit/55b2f0e8620465559016b424967d90a86af597c0), <add> [#3813](https://github.com/angular/angular.js/issues/3813)) <add> - retain inline styles for property-specific transitions <add> ([ad08638c](https://github.com/angular/angular.js/commit/ad08638c0ae61a22ce43d0b40e1220065b867672), <add> [#7503](https://github.com/angular/angular.js/issues/7503)) <add> - ensure class-based animations always perform a DOM operation if skipped <add> ([34d07403](https://github.com/angular/angular.js/commit/34d0740350a50ff2c3a076eaad1e8122283448c3), <add> [#6957](https://github.com/angular/angular.js/issues/6957)) <add>- **$compile:** <add> - do not merge attrs that are the same for replace directives <add> ([b635903e](https://github.com/angular/angular.js/commit/b635903ec435ea355b0f3688c7372627d01e23e2), <add> [#7463](https://github.com/angular/angular.js/issues/7463)) <add> - pass `transcludeFn` down to nested transclude directives <add> ([11385060](https://github.com/angular/angular.js/commit/113850602de2f8bc396df4ffd54bb0f1be565b17), <add> [#7240](https://github.com/angular/angular.js/issues/7240), [#7387](https://github.com/angular/angular.js/issues/7387)) <add> - set `$isolateScope` correctly for sync template directives <add> ([5319621a](https://github.com/angular/angular.js/commit/5319621afd0edf60aef177a0e98dbb7c282cc418), <add> [#6942](https://github.com/angular/angular.js/issues/6942)) <add> - reference correct directive name in `ctreq` error <add> ([6bea0591](https://github.com/angular/angular.js/commit/6bea0591095c19f747c08ef24cc60b34d28b2824), <add> [#7062](https://github.com/angular/angular.js/issues/7062), [#7067](https://github.com/angular/angular.js/issues/7067)) <add> - fix regression which affected old jQuery releases <add> ([a97a172e](https://github.com/angular/angular.js/commit/a97a172ee9f9bcff4d4d84854ded0c72fa0f7e9a)) <add>- **$httpBackend:** don't error when JSONP callback is called with no parameter <add> ([a7ccb753](https://github.com/angular/angular.js/commit/a7ccb7531c92fb976c6058aef2bb18316075efb2), <add> [#7031](https://github.com/angular/angular.js/issues/7031)) <add>- **$location:** <add> - don't clobber path during parsing of path <add> ([02058bfb](https://github.com/angular/angular.js/commit/02058bfbe27296c5441fc247e5a451da83c74134), <add> [#7199](https://github.com/angular/angular.js/issues/7199)) <add> - fix and test html5Mode url-parsing algorithm for legacy browsers <add> ([24f7999b](https://github.com/angular/angular.js/commit/24f7999bc16e347208aa18c418da85489286674b)) <add> - make legacy browsers behave like modern ones in html5Mode <add> ([e0203660](https://github.com/angular/angular.js/commit/e0203660d3af56c5a94e0a9b69c10fd5dabcf577), <add> [#6162](https://github.com/angular/angular.js/issues/6162), [#6421](https://github.com/angular/angular.js/issues/6421), [#6899](https://github.com/angular/angular.js/issues/6899), [#6832](https://github.com/angular/angular.js/issues/6832), [#6834](https://github.com/angular/angular.js/issues/6834)) <add>- **angular.copy:** support circular references in the value being copied <add> ([5c997209](https://github.com/angular/angular.js/commit/5c99720934edc35dd462b1ad02c4d0205683d917), <add> [#7618](https://github.com/angular/angular.js/issues/7618)) <add>- **grunt-utils:** ensure special inline CSS works when `angular` is not a global <add> ([d4231171](https://github.com/angular/angular.js/commit/d4231171582eb41d37bbb908eed23f074ab12f3f), <add> [#7176](https://github.com/angular/angular.js/issues/7176)) <add>- **input:** <add> - fix `ReferenceError` in event listener <add> ([2d7cb14a](https://github.com/angular/angular.js/commit/2d7cb14a167560edc1356dcec6f9e100ed7ac691)) <add> - don't dirty model when input event is triggered due to a placeholder change <add> ([109e5d1d](https://github.com/angular/angular.js/commit/109e5d1d39015af8ade1dc2aff31a2355fbab0a6), <add> [#2614](https://github.com/angular/angular.js/issues/2614), [#5960](https://github.com/angular/angular.js/issues/5960)) <add>- **jqLite:** use jQuery only if `jQuery.fn.on` is present <add> ([fafcd628](https://github.com/angular/angular.js/commit/fafcd6285a6799c4e377ea33011ae3a01aac49a6)) <add>- **limitTo:** do not convert `Infinity` to `NaN` <add> ([fcdac65a](https://github.com/angular/angular.js/commit/fcdac65aedfdf48dd2e11d6e5850e03ec188f068), <add> [#6771](https://github.com/angular/angular.js/issues/6771), [#7118](https://github.com/angular/angular.js/issues/7118)) <add>- **ngAnimate:** `$animate` methods should accept native DOM elements <add> ([9227a5db](https://github.com/angular/angular.js/commit/9227a5db947a78e3dbe8b91d5dac5d67444c855c)) <add>- **ngClass:** <add> - support multiple classes in key <add> ([85ce5d0d](https://github.com/angular/angular.js/commit/85ce5d0db9fc4ee5636015fc042224785f9aa997)) <add> - handle index changes when an item is unshifted <add> ([a4cc9e19](https://github.com/angular/angular.js/commit/a4cc9e194468573bae5232f63044459d0de6638f), <add> [#7256](https://github.com/angular/angular.js/issues/7256)) <add>- **ngLocale:** fix i18n code-generation to support `get_vf_`, `decimals_`, and `get_wt_` <add> ([96a31476](https://github.com/angular/angular.js/commit/96a314766c41bbb18bcddeddd25c8e566ab76acd)) <add>- **ngSanitize:** encode surrogate pair properly <add> ([3d0b49c0](https://github.com/angular/angular.js/commit/3d0b49c07f10c0a723c91629c63705647b690d81), <add> [#5088](https://github.com/angular/angular.js/issues/5088), [#6911](https://github.com/angular/angular.js/issues/6911)) <add>- **ngSwitch:** properly support case labels with different numbers of transclude fns <add> ([32aa4915](https://github.com/angular/angular.js/commit/32aa491588fe4982d4056e89a5d0dd19cf835e72)) <add>- **numberFilter:** fix rounding error edge case <add> ([0388eed7](https://github.com/angular/angular.js/commit/0388eed7e52fdbb832a5b4ef466420a128a43800), <add> [#7453](https://github.com/angular/angular.js/issues/7453), [#7478](https://github.com/angular/angular.js/issues/7478)) <add> <add> <add>## Features <add> <add>- **injector:** "strict-DI" mode which disables "automatic" function annotation <add> ([f5a04f59](https://github.com/angular/angular.js/commit/f5a04f59cf8e8dd6d1806059e3d7fe440aa1613e), <add> [#6719](https://github.com/angular/angular.js/issues/6719), [#6717](https://github.com/angular/angular.js/issues/6717), [#4504](https://github.com/angular/angular.js/issues/4504), [#6069](https://github.com/angular/angular.js/issues/6069), [#3611](https://github.com/angular/angular.js/issues/3611)) <add>- **ngMock:** add support of mocha tdd interface <add> ([6d1c6772](https://github.com/angular/angular.js/commit/6d1c67727ab872c44addc783ef1406952142d89e), <add> [#7489](https://github.com/angular/angular.js/issues/7489)) <add> <add> <add>## Performance Improvements <add> <add>- **$interpolate:** optimize value stringification <add> ([9d4fa33e](https://github.com/angular/angular.js/commit/9d4fa33e35d73ab28a8a187e20dfbe1f77055825), <add> [#7501](https://github.com/angular/angular.js/issues/7501)) <add>- **scope:** 10x. Share the child scope class. <add> ([9ab9bf6b](https://github.com/angular/angular.js/commit/9ab9bf6b415aa216cfbfda040286e5ec99f56ee0)) <add> <add> <add> <add> <ide> <a name="1.3.0-beta.10"></a> <ide> # 1.3.0-beta.10 excessive-clarification (2014-05-23) <ide>
1
Python
Python
fix crash in browser mode with python 3
76cdd091eb24720d77341473ca86c6ea07f74183
<ide><path>glances/core/glances_client_browser.py <ide> def serve_forever(self): <ide> # Display a popup to enter password <ide> clear_password = self.screen.display_popup(_("Password needed for %s: " % v['name']), is_input=True) <ide> # Hash with SHA256 <del> encoded_password = sha256(clear_password).hexdigest() <add> encoded_password = sha256(clear_password.encode('utf-8')).hexdigest() <ide> # Store the password for the selected server <ide> self.set_in_selected('password', encoded_password) <ide>
1
PHP
PHP
remove duplicate property names & fix tests
e69a549e7ae95e4be6248b245f629fc26f31c390
<ide><path>lib/Cake/Controller/Controller.php <ide> class Controller extends Object implements EventListener { <ide> */ <ide> public $layoutPath = null; <ide> <del>/** <del> * Contains variables to be handed to the view. <del> * <del> * @var array <del> */ <del> public $viewVars = array(); <del> <ide> /** <ide> * The name of the view file to render. The name specified <ide> * is the filename in /app/View/<SubFolder> without the .ctp extension. <ide><path>lib/Cake/Test/TestCase/Console/Command/Task/TemplateTaskTest.php <ide> public function tearDown() { <ide> */ <ide> public function testSet() { <ide> $this->Task->set('one', 'two'); <del> $this->assertTrue(isset($this->Task->templateVars['one'])); <del> $this->assertEquals('two', $this->Task->templateVars['one']); <add> $this->assertTrue(isset($this->Task->viewVars['one'])); <add> $this->assertEquals('two', $this->Task->viewVars['one']); <ide> <ide> $this->Task->set(array('one' => 'three', 'four' => 'five')); <del> $this->assertTrue(isset($this->Task->templateVars['one'])); <del> $this->assertEquals('three', $this->Task->templateVars['one']); <del> $this->assertTrue(isset($this->Task->templateVars['four'])); <del> $this->assertEquals('five', $this->Task->templateVars['four']); <add> $this->assertTrue(isset($this->Task->viewVars['one'])); <add> $this->assertEquals('three', $this->Task->viewVars['one']); <add> $this->assertTrue(isset($this->Task->viewVars['four'])); <add> $this->assertEquals('five', $this->Task->viewVars['four']); <ide> <del> $this->Task->templateVars = array(); <add> $this->Task->viewVars = array(); <ide> $this->Task->set(array(3 => 'three', 4 => 'four')); <ide> $this->Task->set(array(1 => 'one', 2 => 'two')); <ide> $expected = array(3 => 'three', 4 => 'four', 1 => 'one', 2 => 'two'); <del> $this->assertEquals($expected, $this->Task->templateVars); <add> $this->assertEquals($expected, $this->Task->viewVars); <ide> } <ide> <ide> /** <ide><path>lib/Cake/Utility/ViewVarsTrait.php <ide> */ <ide> trait ViewVarsTrait { <ide> <add>/** <add> * Variables for the view <add> * <add> * @var array <add> */ <ide> public $viewVars = array(); <ide> <ide> /** <ide><path>lib/Cake/View/View.php <ide> class View extends Object { <ide> */ <ide> public $viewPath = null; <ide> <del>/** <del> * Variables for the view <del> * <del> * @var array <del> */ <del> public $viewVars = array(); <del> <ide> /** <ide> * Name of view to use with this View. <ide> *
4
Ruby
Ruby
use each instead of map
43ba72fb5768427b78d1a044488c5fce1539c419
<ide><path>Library/Homebrew/descriptions.rb <ide> def self.save_cache <ide> # save it for future use. <ide> def self.generate_cache <ide> @cache = {} <del> Formula.map do |f| <add> Formula.each do |f| <ide> @cache[f.full_name] = f.desc <ide> end <ide> self.save_cache
1
Java
Java
update javadoc to reflect changes
508be4e0facf32233287fdfa624f65654c6505e4
<ide><path>spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java <ide> * classpath:com/mycompany/**&#47;applicationContext.xml</pre> <ide> * the resolver follows a more complex but defined procedure to try to resolve <ide> * the wildcard. It produces a {@code Resource} for the path up to the last <del> * non-wildcard segment and obtains a {@code URL} from it. If this URL is <del> * not a "{@code jar:}" URL or container-specific variant (e.g. <del> * "{@code zip:}" in WebLogic, "{@code wsjar}" in WebSphere", etc.), <del> * then a {@code java.io.File} is obtained from it, and used to resolve the <del> * wildcard by walking the filesystem. In the case of a jar URL, the resolver <del> * either gets a {@code java.net.JarURLConnection} from it, or manually parses <del> * the jar URL, and then traverses the contents of the jar file, to resolve the <del> * wildcards. <add> * non-wildcard segment and obtains a {@code URL} from it. If this URL is not a <add> * "{@code jar:}" URL or container-specific variant (e.g. "{@code zip:}" in WebLogic, <add> * "{@code wsjar}" in WebSphere", etc.), then the root directory of the filesystem <add> * associated with the URL is obtained and used to resolve the wildcards by walking <add> * the filesystem. In the case of a jar URL, the resolver either gets a <add> * {@code java.net.JarURLConnection} from it, or manually parses the jar URL, and <add> * then traverses the contents of the jar file, to resolve the wildcards. <ide> * <ide> * <p><b>Implications on portability:</b> <ide> * <ide> * <ide> * <p>There is special support for retrieving multiple class path resources with <ide> * the same name, via the "{@code classpath*:}" prefix. For example, <del> * "{@code classpath*:META-INF/beans.xml}" will find all "beans.xml" <add> * "{@code classpath*:META-INF/beans.xml}" will find all "META-INF/beans.xml" <ide> * files in the class path, be it in "classes" directories or in JAR files. <ide> * This is particularly useful for autodetecting config files of the same name <ide> * at the same location within each jar file. Internally, this happens via a <ide> * {@code ClassLoader.getResources()} call is used on the last non-wildcard <ide> * path segment to get all the matching resources in the class loader hierarchy, <ide> * and then off each resource the same PathMatcher resolution strategy described <del> * above is used for the wildcard subpath. <add> * above is used for the wildcard sub pattern. <ide> * <ide> * <p><b>Other notes:</b> <ide> * <ide> private boolean hasDuplicate(String filePath, Set<Resource> result) { <ide> <ide> /** <ide> * Find all resources that match the given location pattern via the <del> * Ant-style PathMatcher. Supports resources in jar files and zip files <del> * and in the file system. <add> * Ant-style PathMatcher. Supports resources in OSGi bundles, JBoss VFS, <add> * jar files, zip files, and file systems. <ide> * @param locationPattern the location pattern to match <ide> * @return the result as Resource array <ide> * @throws IOException in case of I/O errors <ide> else if (ResourceUtils.isJarURL(rootDirUrl) || isJarResource(rootDirResource)) { <ide> <ide> /** <ide> * Determine the root directory for the given location. <del> * <p>Used for determining the starting point for file matching, <del> * resolving the root directory location to a {@code java.io.File} <del> * and passing it into {@code retrieveMatchingFiles}, with the <del> * remainder of the location as pattern. <del> * <p>Will return "/WEB-INF/" for the pattern "/WEB-INF/*.xml", <del> * for example. <add> * <p>Used for determining the starting point for file matching, resolving the <add> * root directory location to be passed into {@link #getResources(String)}, <add> * with the remainder of the location to be used as the sub pattern. <add> * <p>Will return "/WEB-INF/" for the location "/WEB-INF/*.xml", for example. <ide> * @param location the location to check <ide> * @return the part of the location that denotes the root directory <del> * @see #retrieveMatchingFiles <add> * @see #findPathMatchingResources(String) <ide> */ <ide> protected String determineRootDir(String location) { <ide> int prefixEnd = location.indexOf(':') + 1; <ide> protected JarFile getJarFile(String jarFileUrl) throws IOException { <ide> } <ide> <ide> /** <del> * Find all resources in the file system that match the given location pattern <del> * via the Ant-style PathMatcher. <add> * Find all resources in the file system of the supplied root directory that <add> * match the given location sub pattern via the Ant-style PathMatcher. <ide> * @param rootDirResource the root directory as Resource <ide> * @param subPattern the sub pattern to match (below the root directory) <ide> * @return a mutable Set of matching Resource instances <ide> * @throws IOException in case of I/O errors <del> * @see #retrieveMatchingFiles <ide> * @see org.springframework.util.PathMatcher <ide> */ <ide> protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource, String subPattern)
1
Java
Java
fix the bug that scan may request 0 when n is 1
9b503e5043932a3875558d601841ff7ae17c2500
<ide><path>src/main/java/rx/internal/operators/OperatorScan.java <ide> public void setProducer(final Producer producer) { <ide> <ide> final AtomicBoolean once = new AtomicBoolean(); <ide> <add> final AtomicBoolean excessive = new AtomicBoolean(); <add> <ide> @Override <ide> public void request(long n) { <ide> if (once.compareAndSet(false, true)) { <ide> if (initialValue == NO_INITIAL_VALUE || n == Long.MAX_VALUE) { <ide> producer.request(n); <ide> } else { <del> producer.request(n - 1); <add> if (n == Long.MAX_VALUE) { <add> producer.request(Long.MAX_VALUE); <add> } else if (n == 1) { <add> excessive.set(true); <add> producer.request(1); // request at least 1 <add> } else { <add> producer.request(n - 1); <add> } <ide> } <ide> } else { <ide> // pass-thru after first time <del> producer.request(n); <add> if (excessive.compareAndSet(true, false) && n != Long.MAX_VALUE) { <add> producer.request(n - 1); <add> } else { <add> producer.request(n); <add> } <ide> } <ide> } <ide> }); <ide><path>src/test/java/rx/internal/operators/OperatorScanTest.java <ide> public void call(List<Integer> list, Integer t2) { <ide> assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), o.toBlocking().single()); <ide> assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), o.toBlocking().single()); <ide> } <add> <add> @Test <add> public void testScanWithRequestOne() { <add> Observable<Integer> o = Observable.just(1, 2).scan(0, new Func2<Integer, Integer, Integer>() { <add> <add> @Override <add> public Integer call(Integer t1, Integer t2) { <add> return t1 + t2; <add> } <add> <add> }).take(1); <add> TestSubscriber<Integer> subscriber = new TestSubscriber<Integer>(); <add> o.subscribe(subscriber); <add> subscriber.assertReceivedOnNext(Arrays.asList(0)); <add> subscriber.assertTerminalEvent(); <add> subscriber.assertNoErrors(); <add> } <ide> }
2
PHP
PHP
use empty() instead of implicit cast
268dfa38d2d9684967785f886d5ba44e5f87e24a
<ide><path>src/View/Helper/FormHelper.php <ide> protected function _initInputField($field, $options = []) <ide> } <ide> $parts = explode('.', $field); <ide> $first = array_shift($parts); <del> $options['name'] = $first . ($parts ? '[' . implode('][', $parts) . ']' : '') . $endsWithBrackets; <add> $options['name'] = $first . (!empty($parts) ? '[' . implode('][', $parts) . ']' : '') . $endsWithBrackets; <ide> } <ide> <ide> if (isset($options['value']) && !isset($options['val'])) {
1
Text
Text
add details about rss on process.memoryusage
367db920e3b69ed9ded50cf6e652b9f581e10748
<ide><path>doc/api/process.md <ide> Will generate: <ide> <ide> `heapTotal` and `heapUsed` refer to V8's memory usage. <ide> `external` refers to the memory usage of C++ objects bound to JavaScript <del>objects managed by V8. <add>objects managed by V8. `rss`, Resident Set Size, is the amount of space <add>occupied in the main memory device (that is a subset of the total allocated <add>memory) for the process, which includes the _heap_, _code segment_ and _stack_. <add> <add>The _heap_ is where objects, strings and closures are stored. Variables are <add>stored in the _stack_ and the actual JavaScript code resides in the <add>_code segment_. <ide> <ide> ## process.nextTick(callback[, ...args]) <ide> <!-- YAML
1
Ruby
Ruby
remove code that could never be executed
de4bd472c3298f0455de8e3862c31900184f3c31
<ide><path>activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb <ide> def aliased_table_name_for(name, suffix = nil) <ide> if !@join_dependency.table_aliases[name].zero? # We need an alias <ide> name = active_record.connection.table_alias_for "#{pluralize(reflection.name)}_#{parent_table_name}#{suffix}" <ide> @join_dependency.table_aliases[name] += 1 <del> if @join_dependency.table_aliases[name] == 1 # First time we've seen this name <del> # Also need to count the aliases from the table_aliases to avoid incorrect count <del> @join_dependency.table_aliases[name] += @join_dependency.count_aliases_from_table_joins(name) <del> end <ide> table_index = @join_dependency.table_aliases[name] <ide> name = name[0..active_record.connection.table_alias_length-3] + "_#{table_index}" if table_index > 1 <ide> else
1
Ruby
Ruby
add bottle? method to tab
4057a68e6e074d9e3e42a7e94f89723804f9f998
<ide><path>Library/Homebrew/tab.rb <ide> def build_bottle? <ide> built_as_bottle && !poured_from_bottle <ide> end <ide> <add> def bottle? <add> built_as_bottle <add> end <add> <ide> def to_json <ide> attributes = { <ide> "used_options" => used_options.as_flags,
1
Go
Go
remove unused opts (moved to docker/cli)
306074572ca3025820a4a3ad98e327dd51edaf47
<ide><path>opts/mount.go <del>package opts <del> <del>import ( <del> "encoding/csv" <del> "fmt" <del> "os" <del> "strconv" <del> "strings" <del> <del> mounttypes "github.com/docker/docker/api/types/mount" <del> "github.com/docker/go-units" <del>) <del> <del>// MountOpt is a Value type for parsing mounts <del>type MountOpt struct { <del> values []mounttypes.Mount <del>} <del> <del>// Set a new mount value <del>func (m *MountOpt) Set(value string) error { <del> csvReader := csv.NewReader(strings.NewReader(value)) <del> fields, err := csvReader.Read() <del> if err != nil { <del> return err <del> } <del> <del> mount := mounttypes.Mount{} <del> <del> volumeOptions := func() *mounttypes.VolumeOptions { <del> if mount.VolumeOptions == nil { <del> mount.VolumeOptions = &mounttypes.VolumeOptions{ <del> Labels: make(map[string]string), <del> } <del> } <del> if mount.VolumeOptions.DriverConfig == nil { <del> mount.VolumeOptions.DriverConfig = &mounttypes.Driver{} <del> } <del> return mount.VolumeOptions <del> } <del> <del> bindOptions := func() *mounttypes.BindOptions { <del> if mount.BindOptions == nil { <del> mount.BindOptions = new(mounttypes.BindOptions) <del> } <del> return mount.BindOptions <del> } <del> <del> tmpfsOptions := func() *mounttypes.TmpfsOptions { <del> if mount.TmpfsOptions == nil { <del> mount.TmpfsOptions = new(mounttypes.TmpfsOptions) <del> } <del> return mount.TmpfsOptions <del> } <del> <del> setValueOnMap := func(target map[string]string, value string) { <del> parts := strings.SplitN(value, "=", 2) <del> if len(parts) == 1 { <del> target[value] = "" <del> } else { <del> target[parts[0]] = parts[1] <del> } <del> } <del> <del> mount.Type = mounttypes.TypeVolume // default to volume mounts <del> // Set writable as the default <del> for _, field := range fields { <del> parts := strings.SplitN(field, "=", 2) <del> key := strings.ToLower(parts[0]) <del> <del> if len(parts) == 1 { <del> switch key { <del> case "readonly", "ro": <del> mount.ReadOnly = true <del> continue <del> case "volume-nocopy": <del> volumeOptions().NoCopy = true <del> continue <del> } <del> } <del> <del> if len(parts) != 2 { <del> return fmt.Errorf("invalid field '%s' must be a key=value pair", field) <del> } <del> <del> value := parts[1] <del> switch key { <del> case "type": <del> mount.Type = mounttypes.Type(strings.ToLower(value)) <del> case "source", "src": <del> mount.Source = value <del> case "target", "dst", "destination": <del> mount.Target = value <del> case "readonly", "ro": <del> mount.ReadOnly, err = strconv.ParseBool(value) <del> if err != nil { <del> return fmt.Errorf("invalid value for %s: %s", key, value) <del> } <del> case "consistency": <del> mount.Consistency = mounttypes.Consistency(strings.ToLower(value)) <del> case "bind-propagation": <del> bindOptions().Propagation = mounttypes.Propagation(strings.ToLower(value)) <del> case "volume-nocopy": <del> volumeOptions().NoCopy, err = strconv.ParseBool(value) <del> if err != nil { <del> return fmt.Errorf("invalid value for volume-nocopy: %s", value) <del> } <del> case "volume-label": <del> setValueOnMap(volumeOptions().Labels, value) <del> case "volume-driver": <del> volumeOptions().DriverConfig.Name = value <del> case "volume-opt": <del> if volumeOptions().DriverConfig.Options == nil { <del> volumeOptions().DriverConfig.Options = make(map[string]string) <del> } <del> setValueOnMap(volumeOptions().DriverConfig.Options, value) <del> case "tmpfs-size": <del> sizeBytes, err := units.RAMInBytes(value) <del> if err != nil { <del> return fmt.Errorf("invalid value for %s: %s", key, value) <del> } <del> tmpfsOptions().SizeBytes = sizeBytes <del> case "tmpfs-mode": <del> ui64, err := strconv.ParseUint(value, 8, 32) <del> if err != nil { <del> return fmt.Errorf("invalid value for %s: %s", key, value) <del> } <del> tmpfsOptions().Mode = os.FileMode(ui64) <del> default: <del> return fmt.Errorf("unexpected key '%s' in '%s'", key, field) <del> } <del> } <del> <del> if mount.Type == "" { <del> return fmt.Errorf("type is required") <del> } <del> <del> if mount.Target == "" { <del> return fmt.Errorf("target is required") <del> } <del> <del> if mount.VolumeOptions != nil && mount.Type != mounttypes.TypeVolume { <del> return fmt.Errorf("cannot mix 'volume-*' options with mount type '%s'", mount.Type) <del> } <del> if mount.BindOptions != nil && mount.Type != mounttypes.TypeBind { <del> return fmt.Errorf("cannot mix 'bind-*' options with mount type '%s'", mount.Type) <del> } <del> if mount.TmpfsOptions != nil && mount.Type != mounttypes.TypeTmpfs { <del> return fmt.Errorf("cannot mix 'tmpfs-*' options with mount type '%s'", mount.Type) <del> } <del> <del> m.values = append(m.values, mount) <del> return nil <del>} <del> <del>// Type returns the type of this option <del>func (m *MountOpt) Type() string { <del> return "mount" <del>} <del> <del>// String returns a string repr of this option <del>func (m *MountOpt) String() string { <del> mounts := []string{} <del> for _, mount := range m.values { <del> repr := fmt.Sprintf("%s %s %s", mount.Type, mount.Source, mount.Target) <del> mounts = append(mounts, repr) <del> } <del> return strings.Join(mounts, ", ") <del>} <del> <del>// Value returns the mounts <del>func (m *MountOpt) Value() []mounttypes.Mount { <del> return m.values <del>} <ide><path>opts/mount_test.go <del>package opts <del> <del>import ( <del> "os" <del> "testing" <del> <del> mounttypes "github.com/docker/docker/api/types/mount" <del> "github.com/docker/docker/pkg/testutil" <del> "github.com/stretchr/testify/assert" <del> "github.com/stretchr/testify/require" <del>) <del> <del>func TestMountOptString(t *testing.T) { <del> mount := MountOpt{ <del> values: []mounttypes.Mount{ <del> { <del> Type: mounttypes.TypeBind, <del> Source: "/home/path", <del> Target: "/target", <del> }, <del> { <del> Type: mounttypes.TypeVolume, <del> Source: "foo", <del> Target: "/target/foo", <del> }, <del> }, <del> } <del> expected := "bind /home/path /target, volume foo /target/foo" <del> assert.Equal(t, expected, mount.String()) <del>} <del> <del>func TestMountOptSetBindNoErrorBind(t *testing.T) { <del> for _, testcase := range []string{ <del> // tests several aliases that should have same result. <del> "type=bind,target=/target,source=/source", <del> "type=bind,src=/source,dst=/target", <del> "type=bind,source=/source,dst=/target", <del> "type=bind,src=/source,target=/target", <del> } { <del> var mount MountOpt <del> <del> assert.NoError(t, mount.Set(testcase)) <del> <del> mounts := mount.Value() <del> require.Len(t, mounts, 1) <del> assert.Equal(t, mounttypes.Mount{ <del> Type: mounttypes.TypeBind, <del> Source: "/source", <del> Target: "/target", <del> }, mounts[0]) <del> } <del>} <del> <del>func TestMountOptSetVolumeNoError(t *testing.T) { <del> for _, testcase := range []string{ <del> // tests several aliases that should have same result. <del> "type=volume,target=/target,source=/source", <del> "type=volume,src=/source,dst=/target", <del> "type=volume,source=/source,dst=/target", <del> "type=volume,src=/source,target=/target", <del> } { <del> var mount MountOpt <del> <del> assert.NoError(t, mount.Set(testcase)) <del> <del> mounts := mount.Value() <del> require.Len(t, mounts, 1) <del> assert.Equal(t, mounttypes.Mount{ <del> Type: mounttypes.TypeVolume, <del> Source: "/source", <del> Target: "/target", <del> }, mounts[0]) <del> } <del>} <del> <del>// TestMountOptDefaultType ensures that a mount without the type defaults to a <del>// volume mount. <del>func TestMountOptDefaultType(t *testing.T) { <del> var mount MountOpt <del> assert.NoError(t, mount.Set("target=/target,source=/foo")) <del> assert.Equal(t, mounttypes.TypeVolume, mount.values[0].Type) <del>} <del> <del>func TestMountOptSetErrorNoTarget(t *testing.T) { <del> var mount MountOpt <del> assert.EqualError(t, mount.Set("type=volume,source=/foo"), "target is required") <del>} <del> <del>func TestMountOptSetErrorInvalidKey(t *testing.T) { <del> var mount MountOpt <del> assert.EqualError(t, mount.Set("type=volume,bogus=foo"), "unexpected key 'bogus' in 'bogus=foo'") <del>} <del> <del>func TestMountOptSetErrorInvalidField(t *testing.T) { <del> var mount MountOpt <del> assert.EqualError(t, mount.Set("type=volume,bogus"), "invalid field 'bogus' must be a key=value pair") <del>} <del> <del>func TestMountOptSetErrorInvalidReadOnly(t *testing.T) { <del> var mount MountOpt <del> assert.EqualError(t, mount.Set("type=volume,readonly=no"), "invalid value for readonly: no") <del> assert.EqualError(t, mount.Set("type=volume,readonly=invalid"), "invalid value for readonly: invalid") <del>} <del> <del>func TestMountOptDefaultEnableReadOnly(t *testing.T) { <del> var m MountOpt <del> assert.NoError(t, m.Set("type=bind,target=/foo,source=/foo")) <del> assert.False(t, m.values[0].ReadOnly) <del> <del> m = MountOpt{} <del> assert.NoError(t, m.Set("type=bind,target=/foo,source=/foo,readonly")) <del> assert.True(t, m.values[0].ReadOnly) <del> <del> m = MountOpt{} <del> assert.NoError(t, m.Set("type=bind,target=/foo,source=/foo,readonly=1")) <del> assert.True(t, m.values[0].ReadOnly) <del> <del> m = MountOpt{} <del> assert.NoError(t, m.Set("type=bind,target=/foo,source=/foo,readonly=true")) <del> assert.True(t, m.values[0].ReadOnly) <del> <del> m = MountOpt{} <del> assert.NoError(t, m.Set("type=bind,target=/foo,source=/foo,readonly=0")) <del> assert.False(t, m.values[0].ReadOnly) <del>} <del> <del>func TestMountOptVolumeNoCopy(t *testing.T) { <del> var m MountOpt <del> assert.NoError(t, m.Set("type=volume,target=/foo,volume-nocopy")) <del> assert.Equal(t, "", m.values[0].Source) <del> <del> m = MountOpt{} <del> assert.NoError(t, m.Set("type=volume,target=/foo,source=foo")) <del> assert.True(t, m.values[0].VolumeOptions == nil) <del> <del> m = MountOpt{} <del> assert.NoError(t, m.Set("type=volume,target=/foo,source=foo,volume-nocopy=true")) <del> assert.True(t, m.values[0].VolumeOptions != nil) <del> assert.True(t, m.values[0].VolumeOptions.NoCopy) <del> <del> m = MountOpt{} <del> assert.NoError(t, m.Set("type=volume,target=/foo,source=foo,volume-nocopy")) <del> assert.True(t, m.values[0].VolumeOptions != nil) <del> assert.True(t, m.values[0].VolumeOptions.NoCopy) <del> <del> m = MountOpt{} <del> assert.NoError(t, m.Set("type=volume,target=/foo,source=foo,volume-nocopy=1")) <del> assert.True(t, m.values[0].VolumeOptions != nil) <del> assert.True(t, m.values[0].VolumeOptions.NoCopy) <del>} <del> <del>func TestMountOptTypeConflict(t *testing.T) { <del> var m MountOpt <del> testutil.ErrorContains(t, m.Set("type=bind,target=/foo,source=/foo,volume-nocopy=true"), "cannot mix") <del> testutil.ErrorContains(t, m.Set("type=volume,target=/foo,source=/foo,bind-propagation=rprivate"), "cannot mix") <del>} <del> <del>func TestMountOptSetTmpfsNoError(t *testing.T) { <del> for _, testcase := range []string{ <del> // tests several aliases that should have same result. <del> "type=tmpfs,target=/target,tmpfs-size=1m,tmpfs-mode=0700", <del> "type=tmpfs,target=/target,tmpfs-size=1MB,tmpfs-mode=700", <del> } { <del> var mount MountOpt <del> <del> assert.NoError(t, mount.Set(testcase)) <del> <del> mounts := mount.Value() <del> require.Len(t, mounts, 1) <del> assert.Equal(t, mounttypes.Mount{ <del> Type: mounttypes.TypeTmpfs, <del> Target: "/target", <del> TmpfsOptions: &mounttypes.TmpfsOptions{ <del> SizeBytes: 1024 * 1024, // not 1000 * 1000 <del> Mode: os.FileMode(0700), <del> }, <del> }, mounts[0]) <del> } <del>} <del> <del>func TestMountOptSetTmpfsError(t *testing.T) { <del> var m MountOpt <del> testutil.ErrorContains(t, m.Set("type=tmpfs,target=/foo,tmpfs-size=foo"), "invalid value for tmpfs-size") <del> testutil.ErrorContains(t, m.Set("type=tmpfs,target=/foo,tmpfs-mode=foo"), "invalid value for tmpfs-mode") <del> testutil.ErrorContains(t, m.Set("type=tmpfs"), "target is required") <del>} <ide><path>opts/port.go <del>package opts <del> <del>import ( <del> "encoding/csv" <del> "fmt" <del> "regexp" <del> "strconv" <del> "strings" <del> <del> "github.com/docker/docker/api/types/swarm" <del> "github.com/docker/go-connections/nat" <del>) <del> <del>const ( <del> portOptTargetPort = "target" <del> portOptPublishedPort = "published" <del> portOptProtocol = "protocol" <del> portOptMode = "mode" <del>) <del> <del>// PortOpt represents a port config in swarm mode. <del>type PortOpt struct { <del> ports []swarm.PortConfig <del>} <del> <del>// Set a new port value <del>func (p *PortOpt) Set(value string) error { <del> longSyntax, err := regexp.MatchString(`\w+=\w+(,\w+=\w+)*`, value) <del> if err != nil { <del> return err <del> } <del> if longSyntax { <del> csvReader := csv.NewReader(strings.NewReader(value)) <del> fields, err := csvReader.Read() <del> if err != nil { <del> return err <del> } <del> <del> pConfig := swarm.PortConfig{} <del> for _, field := range fields { <del> parts := strings.SplitN(field, "=", 2) <del> if len(parts) != 2 { <del> return fmt.Errorf("invalid field %s", field) <del> } <del> <del> key := strings.ToLower(parts[0]) <del> value := strings.ToLower(parts[1]) <del> <del> switch key { <del> case portOptProtocol: <del> if value != string(swarm.PortConfigProtocolTCP) && value != string(swarm.PortConfigProtocolUDP) { <del> return fmt.Errorf("invalid protocol value %s", value) <del> } <del> <del> pConfig.Protocol = swarm.PortConfigProtocol(value) <del> case portOptMode: <del> if value != string(swarm.PortConfigPublishModeIngress) && value != string(swarm.PortConfigPublishModeHost) { <del> return fmt.Errorf("invalid publish mode value %s", value) <del> } <del> <del> pConfig.PublishMode = swarm.PortConfigPublishMode(value) <del> case portOptTargetPort: <del> tPort, err := strconv.ParseUint(value, 10, 16) <del> if err != nil { <del> return err <del> } <del> <del> pConfig.TargetPort = uint32(tPort) <del> case portOptPublishedPort: <del> pPort, err := strconv.ParseUint(value, 10, 16) <del> if err != nil { <del> return err <del> } <del> <del> pConfig.PublishedPort = uint32(pPort) <del> default: <del> return fmt.Errorf("invalid field key %s", key) <del> } <del> } <del> <del> if pConfig.TargetPort == 0 { <del> return fmt.Errorf("missing mandatory field %q", portOptTargetPort) <del> } <del> <del> if pConfig.PublishMode == "" { <del> pConfig.PublishMode = swarm.PortConfigPublishModeIngress <del> } <del> <del> if pConfig.Protocol == "" { <del> pConfig.Protocol = swarm.PortConfigProtocolTCP <del> } <del> <del> p.ports = append(p.ports, pConfig) <del> } else { <del> // short syntax <del> portConfigs := []swarm.PortConfig{} <del> ports, portBindingMap, err := nat.ParsePortSpecs([]string{value}) <del> if err != nil { <del> return err <del> } <del> for _, portBindings := range portBindingMap { <del> for _, portBinding := range portBindings { <del> if portBinding.HostIP != "" { <del> return fmt.Errorf("HostIP is not supported.") <del> } <del> } <del> } <del> <del> for port := range ports { <del> portConfig, err := ConvertPortToPortConfig(port, portBindingMap) <del> if err != nil { <del> return err <del> } <del> portConfigs = append(portConfigs, portConfig...) <del> } <del> p.ports = append(p.ports, portConfigs...) <del> } <del> return nil <del>} <del> <del>// Type returns the type of this option <del>func (p *PortOpt) Type() string { <del> return "port" <del>} <del> <del>// String returns a string repr of this option <del>func (p *PortOpt) String() string { <del> ports := []string{} <del> for _, port := range p.ports { <del> repr := fmt.Sprintf("%v:%v/%s/%s", port.PublishedPort, port.TargetPort, port.Protocol, port.PublishMode) <del> ports = append(ports, repr) <del> } <del> return strings.Join(ports, ", ") <del>} <del> <del>// Value returns the ports <del>func (p *PortOpt) Value() []swarm.PortConfig { <del> return p.ports <del>} <del> <del>// ConvertPortToPortConfig converts ports to the swarm type <del>func ConvertPortToPortConfig( <del> port nat.Port, <del> portBindings map[nat.Port][]nat.PortBinding, <del>) ([]swarm.PortConfig, error) { <del> ports := []swarm.PortConfig{} <del> <del> for _, binding := range portBindings[port] { <del> hostPort, err := strconv.ParseUint(binding.HostPort, 10, 16) <del> if err != nil && binding.HostPort != "" { <del> return nil, fmt.Errorf("invalid hostport binding (%s) for port (%s)", binding.HostPort, port.Port()) <del> } <del> ports = append(ports, swarm.PortConfig{ <del> //TODO Name: ? <del> Protocol: swarm.PortConfigProtocol(strings.ToLower(port.Proto())), <del> TargetPort: uint32(port.Int()), <del> PublishedPort: uint32(hostPort), <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }) <del> } <del> return ports, nil <del>} <ide><path>opts/port_test.go <del>package opts <del> <del>import ( <del> "testing" <del> <del> "github.com/docker/docker/api/types/swarm" <del> "github.com/docker/docker/pkg/testutil" <del> "github.com/stretchr/testify/assert" <del>) <del> <del>func TestPortOptValidSimpleSyntax(t *testing.T) { <del> testCases := []struct { <del> value string <del> expected []swarm.PortConfig <del> }{ <del> { <del> value: "80", <del> expected: []swarm.PortConfig{ <del> { <del> Protocol: "tcp", <del> TargetPort: 80, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> }, <del> }, <del> { <del> value: "80:8080", <del> expected: []swarm.PortConfig{ <del> { <del> Protocol: "tcp", <del> TargetPort: 8080, <del> PublishedPort: 80, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> }, <del> }, <del> { <del> value: "8080:80/tcp", <del> expected: []swarm.PortConfig{ <del> { <del> Protocol: "tcp", <del> TargetPort: 80, <del> PublishedPort: 8080, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> }, <del> }, <del> { <del> value: "80:8080/udp", <del> expected: []swarm.PortConfig{ <del> { <del> Protocol: "udp", <del> TargetPort: 8080, <del> PublishedPort: 80, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> }, <del> }, <del> { <del> value: "80-81:8080-8081/tcp", <del> expected: []swarm.PortConfig{ <del> { <del> Protocol: "tcp", <del> TargetPort: 8080, <del> PublishedPort: 80, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> { <del> Protocol: "tcp", <del> TargetPort: 8081, <del> PublishedPort: 81, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> }, <del> }, <del> { <del> value: "80-82:8080-8082/udp", <del> expected: []swarm.PortConfig{ <del> { <del> Protocol: "udp", <del> TargetPort: 8080, <del> PublishedPort: 80, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> { <del> Protocol: "udp", <del> TargetPort: 8081, <del> PublishedPort: 81, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> { <del> Protocol: "udp", <del> TargetPort: 8082, <del> PublishedPort: 82, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> }, <del> }, <del> } <del> for _, tc := range testCases { <del> var port PortOpt <del> assert.NoError(t, port.Set(tc.value)) <del> assert.Len(t, port.Value(), len(tc.expected)) <del> for _, expectedPortConfig := range tc.expected { <del> assertContains(t, port.Value(), expectedPortConfig) <del> } <del> } <del>} <del> <del>func TestPortOptValidComplexSyntax(t *testing.T) { <del> testCases := []struct { <del> value string <del> expected []swarm.PortConfig <del> }{ <del> { <del> value: "target=80", <del> expected: []swarm.PortConfig{ <del> { <del> TargetPort: 80, <del> Protocol: "tcp", <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> }, <del> }, <del> { <del> value: "target=80,protocol=tcp", <del> expected: []swarm.PortConfig{ <del> { <del> Protocol: "tcp", <del> TargetPort: 80, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> }, <del> }, <del> { <del> value: "target=80,published=8080,protocol=tcp", <del> expected: []swarm.PortConfig{ <del> { <del> Protocol: "tcp", <del> TargetPort: 80, <del> PublishedPort: 8080, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> }, <del> }, <del> { <del> value: "published=80,target=8080,protocol=tcp", <del> expected: []swarm.PortConfig{ <del> { <del> Protocol: "tcp", <del> TargetPort: 8080, <del> PublishedPort: 80, <del> PublishMode: swarm.PortConfigPublishModeIngress, <del> }, <del> }, <del> }, <del> { <del> value: "target=80,published=8080,protocol=tcp,mode=host", <del> expected: []swarm.PortConfig{ <del> { <del> Protocol: "tcp", <del> TargetPort: 80, <del> PublishedPort: 8080, <del> PublishMode: "host", <del> }, <del> }, <del> }, <del> { <del> value: "target=80,published=8080,mode=host", <del> expected: []swarm.PortConfig{ <del> { <del> TargetPort: 80, <del> PublishedPort: 8080, <del> PublishMode: "host", <del> Protocol: "tcp", <del> }, <del> }, <del> }, <del> { <del> value: "target=80,published=8080,mode=ingress", <del> expected: []swarm.PortConfig{ <del> { <del> TargetPort: 80, <del> PublishedPort: 8080, <del> PublishMode: "ingress", <del> Protocol: "tcp", <del> }, <del> }, <del> }, <del> } <del> for _, tc := range testCases { <del> var port PortOpt <del> assert.NoError(t, port.Set(tc.value)) <del> assert.Len(t, port.Value(), len(tc.expected)) <del> for _, expectedPortConfig := range tc.expected { <del> assertContains(t, port.Value(), expectedPortConfig) <del> } <del> } <del>} <del> <del>func TestPortOptInvalidComplexSyntax(t *testing.T) { <del> testCases := []struct { <del> value string <del> expectedError string <del> }{ <del> { <del> value: "invalid,target=80", <del> expectedError: "invalid field", <del> }, <del> { <del> value: "invalid=field", <del> expectedError: "invalid field", <del> }, <del> { <del> value: "protocol=invalid", <del> expectedError: "invalid protocol value", <del> }, <del> { <del> value: "target=invalid", <del> expectedError: "invalid syntax", <del> }, <del> { <del> value: "published=invalid", <del> expectedError: "invalid syntax", <del> }, <del> { <del> value: "mode=invalid", <del> expectedError: "invalid publish mode value", <del> }, <del> { <del> value: "published=8080,protocol=tcp,mode=ingress", <del> expectedError: "missing mandatory field", <del> }, <del> { <del> value: `target=80,protocol="tcp,mode=ingress"`, <del> expectedError: "non-quoted-field", <del> }, <del> { <del> value: `target=80,"protocol=tcp,mode=ingress"`, <del> expectedError: "invalid protocol value", <del> }, <del> } <del> for _, tc := range testCases { <del> var port PortOpt <del> testutil.ErrorContains(t, port.Set(tc.value), tc.expectedError) <del> } <del>} <del> <del>func TestPortOptInvalidSimpleSyntax(t *testing.T) { <del> testCases := []struct { <del> value string <del> expectedError string <del> }{ <del> { <del> value: "9999999", <del> expectedError: "Invalid containerPort: 9999999", <del> }, <del> { <del> value: "80/xyz", <del> expectedError: "Invalid proto: xyz", <del> }, <del> { <del> value: "tcp", <del> expectedError: "Invalid containerPort: tcp", <del> }, <del> { <del> value: "udp", <del> expectedError: "Invalid containerPort: udp", <del> }, <del> { <del> value: "", <del> expectedError: "No port specified: <empty>", <del> }, <del> { <del> value: "1.1.1.1:80:80", <del> expectedError: "HostIP is not supported.", <del> }, <del> } <del> for _, tc := range testCases { <del> var port PortOpt <del> assert.EqualError(t, port.Set(tc.value), tc.expectedError) <del> } <del>} <del> <del>func assertContains(t *testing.T, portConfigs []swarm.PortConfig, expected swarm.PortConfig) { <del> var contains = false <del> for _, portConfig := range portConfigs { <del> if portConfig == expected { <del> contains = true <del> break <del> } <del> } <del> if !contains { <del> t.Errorf("expected %v to contain %v, did not", portConfigs, expected) <del> } <del>} <ide><path>opts/secret.go <del>package opts <del> <del>import ( <del> "encoding/csv" <del> "fmt" <del> "os" <del> "strconv" <del> "strings" <del> <del> swarmtypes "github.com/docker/docker/api/types/swarm" <del>) <del> <del>// SecretOpt is a Value type for parsing secrets <del>type SecretOpt struct { <del> values []*swarmtypes.SecretReference <del>} <del> <del>// Set a new secret value <del>func (o *SecretOpt) Set(value string) error { <del> csvReader := csv.NewReader(strings.NewReader(value)) <del> fields, err := csvReader.Read() <del> if err != nil { <del> return err <del> } <del> <del> options := &swarmtypes.SecretReference{ <del> File: &swarmtypes.SecretReferenceFileTarget{ <del> UID: "0", <del> GID: "0", <del> Mode: 0444, <del> }, <del> } <del> <del> // support a simple syntax of --secret foo <del> if len(fields) == 1 { <del> options.File.Name = fields[0] <del> options.SecretName = fields[0] <del> o.values = append(o.values, options) <del> return nil <del> } <del> <del> for _, field := range fields { <del> parts := strings.SplitN(field, "=", 2) <del> key := strings.ToLower(parts[0]) <del> <del> if len(parts) != 2 { <del> return fmt.Errorf("invalid field '%s' must be a key=value pair", field) <del> } <del> <del> value := parts[1] <del> switch key { <del> case "source", "src": <del> options.SecretName = value <del> case "target": <del> options.File.Name = value <del> case "uid": <del> options.File.UID = value <del> case "gid": <del> options.File.GID = value <del> case "mode": <del> m, err := strconv.ParseUint(value, 0, 32) <del> if err != nil { <del> return fmt.Errorf("invalid mode specified: %v", err) <del> } <del> <del> options.File.Mode = os.FileMode(m) <del> default: <del> return fmt.Errorf("invalid field in secret request: %s", key) <del> } <del> } <del> <del> if options.SecretName == "" { <del> return fmt.Errorf("source is required") <del> } <del> <del> o.values = append(o.values, options) <del> return nil <del>} <del> <del>// Type returns the type of this option <del>func (o *SecretOpt) Type() string { <del> return "secret" <del>} <del> <del>// String returns a string repr of this option <del>func (o *SecretOpt) String() string { <del> secrets := []string{} <del> for _, secret := range o.values { <del> repr := fmt.Sprintf("%s -> %s", secret.SecretName, secret.File.Name) <del> secrets = append(secrets, repr) <del> } <del> return strings.Join(secrets, ", ") <del>} <del> <del>// Value returns the secret requests <del>func (o *SecretOpt) Value() []*swarmtypes.SecretReference { <del> return o.values <del>} <ide><path>opts/secret_test.go <del>package opts <del> <del>import ( <del> "os" <del> "testing" <del> <del> "github.com/stretchr/testify/assert" <del> "github.com/stretchr/testify/require" <del>) <del> <del>func TestSecretOptionsSimple(t *testing.T) { <del> var opt SecretOpt <del> <del> testCase := "app-secret" <del> assert.NoError(t, opt.Set(testCase)) <del> <del> reqs := opt.Value() <del> require.Len(t, reqs, 1) <del> req := reqs[0] <del> assert.Equal(t, "app-secret", req.SecretName) <del> assert.Equal(t, "app-secret", req.File.Name) <del> assert.Equal(t, "0", req.File.UID) <del> assert.Equal(t, "0", req.File.GID) <del>} <del> <del>func TestSecretOptionsSourceTarget(t *testing.T) { <del> var opt SecretOpt <del> <del> testCase := "source=foo,target=testing" <del> assert.NoError(t, opt.Set(testCase)) <del> <del> reqs := opt.Value() <del> require.Len(t, reqs, 1) <del> req := reqs[0] <del> assert.Equal(t, "foo", req.SecretName) <del> assert.Equal(t, "testing", req.File.Name) <del>} <del> <del>func TestSecretOptionsShorthand(t *testing.T) { <del> var opt SecretOpt <del> <del> testCase := "src=foo,target=testing" <del> assert.NoError(t, opt.Set(testCase)) <del> <del> reqs := opt.Value() <del> require.Len(t, reqs, 1) <del> req := reqs[0] <del> assert.Equal(t, "foo", req.SecretName) <del>} <del> <del>func TestSecretOptionsCustomUidGid(t *testing.T) { <del> var opt SecretOpt <del> <del> testCase := "source=foo,target=testing,uid=1000,gid=1001" <del> assert.NoError(t, opt.Set(testCase)) <del> <del> reqs := opt.Value() <del> require.Len(t, reqs, 1) <del> req := reqs[0] <del> assert.Equal(t, "foo", req.SecretName) <del> assert.Equal(t, "testing", req.File.Name) <del> assert.Equal(t, "1000", req.File.UID) <del> assert.Equal(t, "1001", req.File.GID) <del>} <del> <del>func TestSecretOptionsCustomMode(t *testing.T) { <del> var opt SecretOpt <del> <del> testCase := "source=foo,target=testing,uid=1000,gid=1001,mode=0444" <del> assert.NoError(t, opt.Set(testCase)) <del> <del> reqs := opt.Value() <del> require.Len(t, reqs, 1) <del> req := reqs[0] <del> assert.Equal(t, "foo", req.SecretName) <del> assert.Equal(t, "testing", req.File.Name) <del> assert.Equal(t, "1000", req.File.UID) <del> assert.Equal(t, "1001", req.File.GID) <del> assert.Equal(t, os.FileMode(0444), req.File.Mode) <del>} <ide><path>opts/weightdevice.go <del>package opts <del> <del>import ( <del> "fmt" <del> "strconv" <del> "strings" <del> <del> "github.com/docker/docker/api/types/blkiodev" <del>) <del> <del>// ValidatorWeightFctType defines a validator function that returns a validated struct and/or an error. <del>type ValidatorWeightFctType func(val string) (*blkiodev.WeightDevice, error) <del> <del>// ValidateWeightDevice validates that the specified string has a valid device-weight format. <del>func ValidateWeightDevice(val string) (*blkiodev.WeightDevice, error) { <del> split := strings.SplitN(val, ":", 2) <del> if len(split) != 2 { <del> return nil, fmt.Errorf("bad format: %s", val) <del> } <del> if !strings.HasPrefix(split[0], "/dev/") { <del> return nil, fmt.Errorf("bad format for device path: %s", val) <del> } <del> weight, err := strconv.ParseUint(split[1], 10, 0) <del> if err != nil { <del> return nil, fmt.Errorf("invalid weight for device: %s", val) <del> } <del> if weight > 0 && (weight < 10 || weight > 1000) { <del> return nil, fmt.Errorf("invalid weight for device: %s", val) <del> } <del> <del> return &blkiodev.WeightDevice{ <del> Path: split[0], <del> Weight: uint16(weight), <del> }, nil <del>} <del> <del>// WeightdeviceOpt defines a map of WeightDevices <del>type WeightdeviceOpt struct { <del> values []*blkiodev.WeightDevice <del> validator ValidatorWeightFctType <del>} <del> <del>// NewWeightdeviceOpt creates a new WeightdeviceOpt <del>func NewWeightdeviceOpt(validator ValidatorWeightFctType) WeightdeviceOpt { <del> values := []*blkiodev.WeightDevice{} <del> return WeightdeviceOpt{ <del> values: values, <del> validator: validator, <del> } <del>} <del> <del>// Set validates a WeightDevice and sets its name as a key in WeightdeviceOpt <del>func (opt *WeightdeviceOpt) Set(val string) error { <del> var value *blkiodev.WeightDevice <del> if opt.validator != nil { <del> v, err := opt.validator(val) <del> if err != nil { <del> return err <del> } <del> value = v <del> } <del> (opt.values) = append((opt.values), value) <del> return nil <del>} <del> <del>// String returns WeightdeviceOpt values as a string. <del>func (opt *WeightdeviceOpt) String() string { <del> var out []string <del> for _, v := range opt.values { <del> out = append(out, v.String()) <del> } <del> <del> return fmt.Sprintf("%v", out) <del>} <del> <del>// GetList returns a slice of pointers to WeightDevices. <del>func (opt *WeightdeviceOpt) GetList() []*blkiodev.WeightDevice { <del> var weightdevice []*blkiodev.WeightDevice <del> for _, v := range opt.values { <del> weightdevice = append(weightdevice, v) <del> } <del> <del> return weightdevice <del>} <del> <del>// Type returns the option type <del>func (opt *WeightdeviceOpt) Type() string { <del> return "list" <del>}
7
PHP
PHP
fix 2.6 merge errors
6866d3aecdcd381e0fe8e8ecd351e272a01b24a6
<ide><path>tests/TestCase/Network/RequestTest.php <ide> public function testHere() { <ide> public function testHereWithSpaceInUrl() { <ide> Configure::write('App.base', ''); <ide> $_GET = array('/admin/settings/settings/prefix/Access_Control' => ''); <del> $request = new CakeRequest('/admin/settings/settings/prefix/Access%20Control'); <add> $request = new Request('/admin/settings/settings/prefix/Access%20Control'); <ide> <ide> $result = $request->here(); <ide> $this->assertEquals('/admin/settings/settings/prefix/Access%20Control', $result);
1
Python
Python
fix potential division by zero
d045e10195126981b79743adc9ad67e0ca5a4b62
<ide><path>keras/preprocessing/image.py <ide> def standardize(self, x): <ide> if self.samplewise_center: <ide> x -= np.mean(x, keepdims=True) <ide> if self.samplewise_std_normalization: <del> x /= np.std(x, keepdims=True) + 1e-7 <add> x /= (np.std(x, keepdims=True) + K.epsilon()) <ide> <ide> if self.featurewise_center: <ide> if self.mean is not None: <ide> def standardize(self, x): <ide> 'first by calling `.fit(numpy_data)`.') <ide> if self.featurewise_std_normalization: <ide> if self.std is not None: <del> x /= (self.std + 1e-7) <add> x /= (self.std + K.epsilon()) <ide> else: <ide> warnings.warn('This ImageDataGenerator specifies ' <ide> '`featurewise_std_normalization`, but it hasn\'t '
1
Java
Java
upgrade tests to testng 7.1
745cfcb1617cda2763e6e58d88889885883b7822
<ide><path>spring-test/src/test/java/org/springframework/test/context/cache/ClassLevelDirtiesContextTestNGTests.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2020 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> import org.junit.jupiter.api.AfterAll; <ide> import org.junit.jupiter.api.BeforeAll; <ide> import org.junit.jupiter.api.Test; <del>import org.testng.ITestNGListener; <ide> import org.testng.TestNG; <ide> <ide> import org.springframework.beans.factory.annotation.Autowired; <ide> private void runTestClassAndAssertStats(Class<?> testClass, int expectedTestCoun <ide> <ide> final TrackingTestNGTestListener listener = new TrackingTestNGTestListener(); <ide> final TestNG testNG = new TestNG(); <del> testNG.addListener((ITestNGListener) listener); <add> testNG.addListener(listener); <ide> testNG.setTestClasses(new Class<?>[] { testClass }); <ide> testNG.setVerbose(0); <ide> testNG.run(); <ide><path>spring-test/src/test/java/org/springframework/test/context/junit4/FailingBeforeAndAfterMethodsTestNGTests.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2020 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> import org.junit.runner.RunWith; <ide> import org.junit.runners.Parameterized; <ide> import org.junit.runners.Parameterized.Parameters; <del>import org.testng.ITestNGListener; <ide> import org.testng.TestNG; <ide> <ide> import org.springframework.test.context.ContextConfiguration; <ide> public FailingBeforeAndAfterMethodsTestNGTests(String testClassName, int expecte <ide> public void runTestAndAssertCounters() throws Exception { <ide> TrackingTestNGTestListener listener = new TrackingTestNGTestListener(); <ide> TestNG testNG = new TestNG(); <del> testNG.addListener((ITestNGListener) listener); <add> testNG.addListener(listener); <ide> testNG.setTestClasses(new Class<?>[] {this.clazz}); <ide> testNG.setVerbose(0); <ide> testNG.run();
2
Javascript
Javascript
add support for re-entrant ssr stacks
6ebc8f3c07d8aadea127532fd33637cb091a9e66
<ide><path>packages/react-dom/src/__tests__/ReactDOM-test.js <ide> <ide> 'use strict'; <ide> <del>let React = require('react'); <del>let ReactDOM = require('react-dom'); <del>const ReactTestUtils = require('react-dom/test-utils'); <add>let React; <add>let ReactDOM; <add>let ReactDOMServer; <add>let ReactTestUtils; <ide> <ide> describe('ReactDOM', () => { <add> beforeEach(() => { <add> jest.resetModules(); <add> React = require('react'); <add> ReactDOM = require('react-dom'); <add> ReactDOMServer = require('react-dom/server'); <add> ReactTestUtils = require('react-dom/test-utils'); <add> }); <add> <ide> // TODO: uncomment this test once we can run in phantom, which <ide> // supports real submit events. <ide> /* <ide> describe('ReactDOM', () => { <ide> global.requestAnimationFrame = previousRAF; <ide> } <ide> }); <add> <add> it('reports stacks with re-entrant renderToString() calls on the client', () => { <add> function Child2(props) { <add> return <span ariaTypo3="no">{props.children}</span>; <add> } <add> <add> function App2() { <add> return ( <add> <Child2> <add> {ReactDOMServer.renderToString(<blink ariaTypo2="no" />)} <add> </Child2> <add> ); <add> } <add> <add> function Child() { <add> return ( <add> <span ariaTypo4="no">{ReactDOMServer.renderToString(<App2 />)}</span> <add> ); <add> } <add> <add> function ServerEntry() { <add> return ReactDOMServer.renderToString(<Child />); <add> } <add> <add> function App() { <add> return ( <add> <div> <add> <span ariaTypo="no" /> <add> <ServerEntry /> <add> <font ariaTypo5="no" /> <add> </div> <add> ); <add> } <add> <add> const container = document.createElement('div'); <add> expect(() => ReactDOM.render(<App />, container)).toWarnDev([ <add> // ReactDOM(App > div > span) <add> 'Invalid ARIA attribute `ariaTypo`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + <add> ' in span (at **)\n' + <add> ' in div (at **)\n' + <add> ' in App (at **)', <add> // ReactDOM(App > div > ServerEntry) >>> ReactDOMServer(Child) >>> ReactDOMServer(App2) >>> ReactDOMServer(blink) <add> 'Invalid ARIA attribute `ariaTypo2`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + <add> ' in blink (at **)', <add> // ReactDOM(App > div > ServerEntry) >>> ReactDOMServer(Child) >>> ReactDOMServer(App2 > Child2 > span) <add> 'Invalid ARIA attribute `ariaTypo3`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + <add> ' in span (at **)\n' + <add> ' in Child2 (at **)\n' + <add> ' in App2 (at **)', <add> // ReactDOM(App > div > ServerEntry) >>> ReactDOMServer(Child > span) <add> 'Invalid ARIA attribute `ariaTypo4`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + <add> ' in span (at **)\n' + <add> ' in Child (at **)', <add> // ReactDOM(App > div > font) <add> 'Invalid ARIA attribute `ariaTypo5`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + <add> ' in font (at **)\n' + <add> ' in div (at **)\n' + <add> ' in App (at **)', <add> ]); <add> }); <ide> }); <ide><path>packages/react-dom/src/__tests__/ReactServerRendering-test.js <ide> describe('ReactDOMServer', () => { <ide> ' in App (at **)', <ide> ]); <ide> }); <add> <add> it('reports stacks with re-entrant renderToString() calls', () => { <add> function Child2(props) { <add> return <span ariaTypo3="no">{props.children}</span>; <add> } <add> <add> function App2() { <add> return ( <add> <Child2> <add> {ReactDOMServer.renderToString(<blink ariaTypo2="no" />)} <add> </Child2> <add> ); <add> } <add> <add> function Child() { <add> return ( <add> <span ariaTypo4="no">{ReactDOMServer.renderToString(<App2 />)}</span> <add> ); <add> } <add> <add> function App() { <add> return ( <add> <div> <add> <span ariaTypo="no" /> <add> <Child /> <add> <font ariaTypo5="no" /> <add> </div> <add> ); <add> } <add> <add> expect(() => ReactDOMServer.renderToString(<App />)).toWarnDev([ <add> // ReactDOMServer(App > div > span) <add> 'Invalid ARIA attribute `ariaTypo`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + <add> ' in span (at **)\n' + <add> ' in div (at **)\n' + <add> ' in App (at **)', <add> // ReactDOMServer(App > div > Child) >>> ReactDOMServer(App2) >>> ReactDOMServer(blink) <add> 'Invalid ARIA attribute `ariaTypo2`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + <add> ' in blink (at **)', <add> // ReactDOMServer(App > div > Child) >>> ReactDOMServer(App2 > Child2 > span) <add> 'Invalid ARIA attribute `ariaTypo3`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + <add> ' in span (at **)\n' + <add> ' in Child2 (at **)\n' + <add> ' in App2 (at **)', <add> // ReactDOMServer(App > div > Child > span) <add> 'Invalid ARIA attribute `ariaTypo4`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + <add> ' in span (at **)\n' + <add> ' in Child (at **)\n' + <add> ' in div (at **)\n' + <add> ' in App (at **)', <add> // ReactDOMServer(App > div > font) <add> 'Invalid ARIA attribute `ariaTypo5`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + <add> ' in font (at **)\n' + <add> ' in div (at **)\n' + <add> ' in App (at **)', <add> ]); <add> }); <ide> }); <ide><path>packages/react-dom/src/server/ReactPartialRenderer.js <ide> type FlatReactChildren = Array<null | ReactNode>; <ide> type toArrayType = (children: mixed) => FlatReactChildren; <ide> const toArray = ((React.Children.toArray: any): toArrayType); <ide> <del>let currentDebugStack; <del>let currentDebugElementStack; <del> <del>let getStackAddendum = () => ''; <add>// This is only used in DEV. <add>// Each entry is `this.stack` from a currently executing renderer instance. <add>// (There may be more than one because ReactDOMServer is reentrant). <add>// Each stack is an array of frames which may contain nested stacks of elements. <add>let currentDebugStacks = []; <add> <add>let prevGetCurrentStackImpl = null; <add>let getCurrentServerStackImpl = () => ''; <ide> let describeStackFrame = element => ''; <ide> <ide> let validatePropertiesInDevelopment = (type, props) => {}; <del>let setCurrentDebugStack = (stack: Array<Frame>) => {}; <add>let pushCurrentDebugStack = (stack: Array<Frame>) => {}; <ide> let pushElementToDebugStack = (element: ReactElement) => {}; <del>let resetCurrentDebugStack = () => {}; <add>let popCurrentDebugStack = () => {}; <ide> <ide> if (__DEV__) { <ide> validatePropertiesInDevelopment = function(type, props) { <ide> if (__DEV__) { <ide> return describeComponentFrame(name, source, ownerName); <ide> }; <ide> <del> currentDebugStack = null; <del> currentDebugElementStack = null; <del> setCurrentDebugStack = function(stack: Array<Frame>) { <del> const frame: Frame = stack[stack.length - 1]; <del> currentDebugElementStack = ((frame: any): FrameDev).debugElementStack; <del> // We are about to enter a new composite stack, reset the array. <del> currentDebugElementStack.length = 0; <del> currentDebugStack = stack; <del> ReactDebugCurrentFrame.getCurrentStack = getStackAddendum; <add> pushCurrentDebugStack = function(stack: Array<Frame>) { <add> currentDebugStacks.push(stack); <add> <add> if (currentDebugStacks.length === 1) { <add> // We are entering a server renderer. <add> // Remember the previous (e.g. client) global stack implementation. <add> prevGetCurrentStackImpl = ReactDebugCurrentFrame.getCurrentStack; <add> ReactDebugCurrentFrame.getCurrentStack = getCurrentServerStackImpl; <add> } <ide> }; <add> <ide> pushElementToDebugStack = function(element: ReactElement) { <del> if (currentDebugElementStack !== null) { <del> currentDebugElementStack.push(element); <del> } <add> // For the innermost executing ReactDOMServer call, <add> const stack = currentDebugStacks[currentDebugStacks.length - 1]; <add> // Take the innermost executing frame (e.g. <Foo>), <add> const frame: Frame = stack[stack.length - 1]; <add> // and record that it has one more element associated with it. <add> ((frame: any): FrameDev).debugElementStack.push(element); <add> // We only need this because we tail-optimize single-element <add> // children and directly handle them in an inner loop instead of <add> // creating separate frames for them. <ide> }; <del> resetCurrentDebugStack = function() { <del> currentDebugElementStack = null; <del> currentDebugStack = null; <del> ReactDebugCurrentFrame.getCurrentStack = null; <add> <add> popCurrentDebugStack = function() { <add> currentDebugStacks.pop(); <add> <add> if (currentDebugStacks.length === 0) { <add> // We are exiting the server renderer. <add> // Restore the previous (e.g. client) global stack implementation. <add> ReactDebugCurrentFrame.getCurrentStack = prevGetCurrentStackImpl; <add> prevGetCurrentStackImpl = null; <add> } <ide> }; <del> getStackAddendum = function(): null | string { <del> if (currentDebugStack === null) { <add> <add> getCurrentServerStackImpl = function(): string { <add> if (currentDebugStacks.length === 0) { <add> // Nothing is currently rendering. <ide> return ''; <ide> } <add> // ReactDOMServer is reentrant so there may be multiple calls at the same time. <add> // Take the frames from the innermost call which is the last in the array. <add> let frames = currentDebugStacks[currentDebugStacks.length - 1]; <ide> let stack = ''; <del> let debugStack = currentDebugStack; <del> for (let i = debugStack.length - 1; i >= 0; i--) { <del> const frame: Frame = debugStack[i]; <add> // Go through every frame in the stack from the innermost one. <add> for (let i = frames.length - 1; i >= 0; i--) { <add> const frame: Frame = frames[i]; <add> // Every frame might have more than one debug element stack entry associated with it. <add> // This is because single-child nesting doesn't create materialized frames. <add> // Instead it would push them through `pushElementToDebugStack()`. <ide> let debugElementStack = ((frame: any): FrameDev).debugElementStack; <ide> for (let ii = debugElementStack.length - 1; ii >= 0; ii--) { <ide> stack += describeStackFrame(debugElementStack[ii]); <ide> function createMarkupForStyles(styles): string | null { <ide> const styleValue = styles[styleName]; <ide> if (__DEV__) { <ide> if (!isCustomProperty) { <del> warnValidStyle(styleName, styleValue, getStackAddendum); <add> warnValidStyle(styleName, styleValue, getCurrentServerStackImpl); <ide> } <ide> } <ide> if (styleValue != null) { <ide> function maskContext(type, context) { <ide> <ide> function checkContextTypes(typeSpecs, values, location: string) { <ide> if (__DEV__) { <del> checkPropTypes(typeSpecs, values, location, 'Component', getStackAddendum); <add> checkPropTypes( <add> typeSpecs, <add> values, <add> location, <add> 'Component', <add> getCurrentServerStackImpl, <add> ); <ide> } <ide> } <ide> <ide> class ReactDOMServerRenderer { <ide> } <ide> const child = frame.children[frame.childIndex++]; <ide> if (__DEV__) { <del> setCurrentDebugStack(this.stack); <del> } <del> out += this.render(child, frame.context, frame.domNamespace); <del> if (__DEV__) { <del> // TODO: Handle reentrant server render calls. This doesn't. <del> resetCurrentDebugStack(); <add> pushCurrentDebugStack(this.stack); <add> // We're starting work on this frame, so reset its inner stack. <add> ((frame: any): FrameDev).debugElementStack.length = 0; <add> try { <add> // Be careful! Make sure this matches the PROD path below. <add> out += this.render(child, frame.context, frame.domNamespace); <add> } finally { <add> popCurrentDebugStack(); <add> } <add> } else { <add> // Be careful! Make sure this matches the DEV path above. <add> out += this.render(child, frame.context, frame.domNamespace); <ide> } <ide> } <ide> return out; <ide> class ReactDOMServerRenderer { <ide> ReactControlledValuePropTypes.checkPropTypes( <ide> 'input', <ide> props, <del> getStackAddendum, <add> getCurrentServerStackImpl, <ide> ); <ide> <ide> if ( <ide> class ReactDOMServerRenderer { <ide> ReactControlledValuePropTypes.checkPropTypes( <ide> 'textarea', <ide> props, <del> getStackAddendum, <add> getCurrentServerStackImpl, <ide> ); <ide> if ( <ide> props.value !== undefined && <ide> class ReactDOMServerRenderer { <ide> ReactControlledValuePropTypes.checkPropTypes( <ide> 'select', <ide> props, <del> getStackAddendum, <add> getCurrentServerStackImpl, <ide> ); <ide> <ide> for (let i = 0; i < valuePropNames.length; i++) { <ide> class ReactDOMServerRenderer { <ide> validatePropertiesInDevelopment(tag, props); <ide> } <ide> <del> assertValidProps(tag, props, getStackAddendum); <add> assertValidProps(tag, props, getCurrentServerStackImpl); <ide> <ide> let out = createOpenTagMarkup( <ide> element.type,
3
Python
Python
use our yaml util in all providers
45b11d4ed1412c00ebf32a03ab5ea3a06274f208
<ide><path>airflow/providers/amazon/aws/hooks/eks.py <ide> from functools import partial <ide> from typing import Callable, Dict, Generator, List, Optional <ide> <del>import yaml <ide> from botocore.exceptions import ClientError <ide> from botocore.signers import RequestSigner <ide> <ide> from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook <add>from airflow.utils import yaml <ide> from airflow.utils.json import AirflowJsonEncoder <ide> <ide> DEFAULT_PAGINATION_TOKEN = '' <ide><path>airflow/providers/cncf/kubernetes/hooks/kubernetes.py <ide> from kubernetes.config import ConfigException <ide> <ide> from airflow.compat.functools import cached_property <del>from airflow.kubernetes.kube_client import _disable_verify_ssl, _enable_tcp_keepalive <del> <del>try: <del> import airflow.utils.yaml as yaml <del>except ImportError: <del> import yaml # type: ignore[no-redef] <del> <ide> from airflow.exceptions import AirflowException <ide> from airflow.hooks.base import BaseHook <add>from airflow.kubernetes.kube_client import _disable_verify_ssl, _enable_tcp_keepalive <add>from airflow.utils import yaml <ide> <ide> <ide> def _load_body_to_dict(body): <ide><path>airflow/providers/google/cloud/operators/cloud_build.py <ide> from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, Tuple, Union <ide> from urllib.parse import unquote, urlparse <ide> <del>import yaml <ide> from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault <ide> from google.api_core.retry import Retry <ide> from google.cloud.devtools.cloudbuild_v1.types import Build, BuildTrigger, RepoSource <ide> <ide> from airflow.exceptions import AirflowException <ide> from airflow.models import BaseOperator <ide> from airflow.providers.google.cloud.hooks.cloud_build import CloudBuildHook <add>from airflow.utils import yaml <ide> <ide> if TYPE_CHECKING: <ide> from airflow.utils.context import Context
3
Ruby
Ruby
let tip and friends handle a multiline paragraph
598eab90ffb60638a578b5b205388cb755485280
<ide><path>railties/guides/rails_guides/generator.rb <ide> def textile(body, lite_mode=false) <ide> t = RedCloth.new(body) <ide> t.hard_breaks = false <ide> t.lite_mode = lite_mode <del> t.to_html(:notestuff, :plusplus, :code, :tip) <add> t.to_html(:notestuff, :plusplus, :code) <ide> end <ide> end <ide> <ide><path>railties/guides/rails_guides/textile_extensions.rb <ide> module RailsGuides <ide> module TextileExtensions <ide> def notestuff(body) <del> body.gsub!(/^(IMPORTANT|CAUTION|WARNING|NOTE|INFO)[.:](.*)$/) do |m| <del> css_class = $1.downcase <del> css_class = 'warning' if css_class.in?(['caution', 'important']) <del> <del> result = "<div class='#{css_class}'><p>" <del> result << $2.strip <del> result << '</p></div>' <del> result <del> end <del> end <del> <del> def tip(body) <del> body.gsub!(/^TIP[.:](.*)$/) do |m| <del> result = "<div class='info'><p>" <del> result << $1.strip <del> result << '</p></div>' <del> result <add> # The following regexp detects special labels followed by a <add> # paragraph, perhaps at the end of the document. <add> # <add> # It is important that we do not eat more than one newline <add> # because formatting may be wrong otherwise. For example, <add> # if a bulleted list follows the first item is not rendered <add> # as a list item, but as a paragraph starting with a plain <add> # asterisk. <add> body.gsub!(/^(TIP|IMPORTANT|CAUTION|WARNING|NOTE|INFO)[.:](.*?)(\n(?=\n)|\Z)/m) do |m| <add> css_class = case $1 <add> when 'CAUTION', 'IMPORTANT' <add> 'warning' <add> when 'TIP' <add> 'info' <add> else <add> $1.downcase <add> end <add> %Q(<div class="#{css_class}"><p>#{$2.strip}</p></div>) <ide> end <ide> end <ide>
2
Python
Python
fix documentation for box coder
e0b082ed7c21195a95212398bb7e51004f0cdc57
<ide><path>research/object_detection/box_coders/detr_box_coder.py <ide> <ide> <ide> class DETRBoxCoder(box_coder.BoxCoder): <del> """Faster RCNN box coder.""" <add> """DETR box coder.""" <ide> <ide> def __init__(self): <del> """Constructor for DETRBoxCoder. <del> <del> Args: <del> scale_factors: List of 4 positive scalars to scale ty, tx, th and tw. <del> If set to None, does not perform scaling. For Faster RCNN, <del> the open-source implementation recommends using [10.0, 10.0, 5.0, 5.0]. <del> """ <add> """Constructor for DETRBoxCoder.""" <ide> pass <ide> <ide> @property <ide> def _encode(self, boxes, anchors): <ide> <ide> Args: <ide> boxes: BoxList holding N boxes to be encoded. <del> anchors: BoxList of anchors. <add> anchors: BoxList of anchors, ignored for DETR. <ide> <ide> Returns: <del> a tensor representing N anchor-encoded boxes of the format <add> a tensor representing N encoded boxes of the format <ide> [ty, tx, th, tw]. <ide> """ <ide> # Convert anchors to the center coordinate representation. <ide> def _decode(self, rel_codes, anchors): <ide> """Decode relative codes to boxes. <ide> <ide> Args: <del> rel_codes: a tensor representing N anchor-encoded boxes. <del> anchors: BoxList of anchors. <add> rel_codes: a tensor representing N encoded boxes. <add> anchors: BoxList of anchors, ignored for DETR. <ide> <ide> Returns: <ide> boxes: BoxList holding N bounding boxes.
1
Javascript
Javascript
support additional attribute types
63502b521e1d50e42f57f24bc5d38b82fa5e0702
<ide><path>examples/js/loaders/EXRLoader.js <ide> THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade <ide> <ide> } <ide> <add> function parseRational( dataView, offset ) { <add> <add> var x = parseUint32( dataView, offset ); <add> var y = parseUint32( dataView, offset ); <add> <add> return [ x, y ]; <add> <add> } <add> <add> function parseTimecode( dataView, offset ) { <add> <add> var x = parseUint32( dataView, offset ); <add> var y = parseUint32( dataView, offset ); <add> <add> return [ x, y ]; <add> <add> } <add> <ide> function parseUint32( dataView, offset ) { <ide> <ide> var Uint32 = dataView.getUint32( offset.value, true ); <ide> THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade <ide> <ide> return parseUint32( dataView, offset ); <ide> <add> } else if ( type === 'rational' ) { <add> <add> return parseRational( dataView, offset ); <add> <add> } else if ( type === 'timecode' ) { <add> <add> return parseTimecode( dataView, offset ); <add> <ide> } else { <ide> <ide> throw 'Cannot parse value for unsupported type: ' + type; <ide><path>examples/jsm/loaders/EXRLoader.js <ide> EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype <ide> <ide> } <ide> <add> function parseRational( dataView, offset ) { <add> <add> var x = parseUint32( dataView, offset ); <add> var y = parseUint32( dataView, offset ); <add> <add> return [ x, y ]; <add> <add> } <add> <add> function parseTimecode( dataView, offset ) { <add> <add> var x = parseUint32( dataView, offset ); <add> var y = parseUint32( dataView, offset ); <add> <add> return [ x, y ]; <add> <add> } <add> <ide> function parseUint32( dataView, offset ) { <ide> <ide> var Uint32 = dataView.getUint32( offset.value, true ); <ide> EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype <ide> <ide> return parseUint32( dataView, offset ); <ide> <add> } else if ( type === 'rational' ) { <add> <add> return parseRational( dataView, offset ); <add> <add> } else if ( type === 'timecode' ) { <add> <add> return parseTimecode( dataView, offset ); <add> <ide> } else { <ide> <ide> throw 'Cannot parse value for unsupported type: ' + type;
2
Python
Python
change id to image to contain full path
8d31503fd2f03c2b53a527fb830cf02c9ec81039
<ide><path>libcloud/compute/drivers/libvirt_driver.py <ide> def list_images(self, location=IMAGES_LOCATION): <ide> <ide> for image in output.strip().split('\n'): <ide> name, size = image.split(' ') <add> id = name <ide> name = name.replace(IMAGES_LOCATION + '/', '') <ide> size = int(size) <del> nodeimage = NodeImage(id=name, name=name, driver=self, extra={'host': self.host, 'size': size}) <add> nodeimage = NodeImage(id=id, name=name, driver=self, extra={'host': self.host, 'size': size}) <ide> images.append(nodeimage) <ide> <ide> return images
1
Python
Python
fix lookup_url_kwarg handling in viewsets
8d0dbc8092a754e1f0f7d80d93506072556f35a2
<ide><path>rest_framework/routers.py <ide> def get_lookup_regex(self, viewset, lookup_prefix=''): <ide> <ide> https://github.com/alanjds/drf-nested-routers <ide> """ <del> base_regex = '(?P<{lookup_prefix}{lookup_field}>{lookup_value})' <add> base_regex = '(?P<{lookup_prefix}{lookup_url_kwarg}>{lookup_value})' <ide> # Use `pk` as default field, unset set. Default regex should not <ide> # consume `.json` style suffixes and should break at '/' boundaries. <ide> lookup_field = getattr(viewset, 'lookup_field', 'pk') <add> lookup_url_kwarg = getattr(viewset, 'lookup_url_kwarg', None) or lookup_field <ide> lookup_value = getattr(viewset, 'lookup_value_regex', '[^/.]+') <ide> return base_regex.format( <ide> lookup_prefix=lookup_prefix, <del> lookup_field=lookup_field, <add> lookup_url_kwarg=lookup_url_kwarg, <ide> lookup_value=lookup_value <ide> ) <ide> <ide><path>tests/test_routers.py <ide> class NoteViewSet(viewsets.ModelViewSet): <ide> lookup_field = 'uuid' <ide> <ide> <add>class KWargedNoteViewSet(viewsets.ModelViewSet): <add> queryset = RouterTestModel.objects.all() <add> serializer_class = NoteSerializer <add> lookup_field = 'text__contains' <add> lookup_url_kwarg = 'text' <add> <add> <ide> class MockViewSet(viewsets.ModelViewSet): <ide> queryset = None <ide> serializer_class = None <ide> class MockViewSet(viewsets.ModelViewSet): <ide> notes_router = SimpleRouter() <ide> notes_router.register(r'notes', NoteViewSet) <ide> <add>kwarged_notes_router = SimpleRouter() <add>kwarged_notes_router.register(r'notes', KWargedNoteViewSet) <add> <ide> namespaced_router = DefaultRouter() <ide> namespaced_router.register(r'example', MockViewSet, base_name='example') <ide> <ide> urlpatterns = [ <ide> url(r'^non-namespaced/', include(namespaced_router.urls)), <ide> url(r'^namespaced/', include(namespaced_router.urls, namespace='example')), <ide> url(r'^example/', include(notes_router.urls)), <add> url(r'^example2/', include(kwarged_notes_router.urls)), <ide> ] <ide> <ide> <ide> def test_urls_limited_by_lookup_value_regex(self): <ide> self.assertEqual(expected[idx], self.urls[idx].regex.pattern) <ide> <ide> <add>class TestLookupUrlKwargs(TestCase): <add> """ <add> Ensure the router honors lookup_url_kwarg. <add> <add> Setup a deep lookup_field, but map it to a simple URL kwarg. <add> """ <add> urls = 'tests.test_routers' <add> <add> def setUp(self): <add> RouterTestModel.objects.create(uuid='123', text='foo bar') <add> <add> def test_custom_lookup_url_kwarg_route(self): <add> detail_route = kwarged_notes_router.urls[-1] <add> detail_url_pattern = detail_route.regex.pattern <add> self.assertIn('^notes/(?P<text>', detail_url_pattern) <add> <add> def test_retrieve_lookup_url_kwarg_detail_view(self): <add> response = self.client.get('/example2/notes/fo/') <add> self.assertEqual( <add> response.data, <add> { <add> "url": "http://testserver/example/notes/123/", <add> "uuid": "123", "text": "foo bar" <add> } <add> ) <add> <add> <ide> class TestTrailingSlashIncluded(TestCase): <ide> def setUp(self): <ide> class NoteViewSet(viewsets.ModelViewSet):
2
Javascript
Javascript
remove tests for qunit 1.x adapter
e8a0dba69acd454e8e830616fef751126cdcbc22
<ide><path>packages/ember-testing/tests/adapters/qunit_test.js <ide> import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; <ide> <ide> var adapter; <ide> <del>moduleFor('ember-testing QUnitAdapter: QUnit 1.x', class extends AbstractTestCase { <del> constructor() { <del> super(); <del> adapter = new QUnitAdapter(); <del> } <del> <del> teardown() { <del> run(adapter, adapter.destroy); <del> } <del> <del> ['@test asyncStart calls stop'](assert) { <del> var originalStop = QUnit.stop; <del> try { <del> QUnit.stop = function() { <del> assert.ok(true, 'stop called'); <del> }; <del> adapter.asyncStart(); <del> } finally { <del> QUnit.stop = originalStop; <del> } <del> } <del> <del> ['@test asyncEnd calls start'](assert) { <del> var originalStart = QUnit.start; <del> try { <del> QUnit.start = function() { <del> assert.ok(true, 'start called'); <del> }; <del> adapter.asyncEnd(); <del> } finally { <del> QUnit.start = originalStart; <del> } <del> } <del> <del> ['@test exception causes a failing assertion'](assert) { <del> var error = { err: 'hai' }; <del> let originalPushResult = assert.pushResult; <del> try { <del> assert.pushResult = function (resultInfo) { <del> // Inverts the result so we can test failing assertions <del> resultInfo.result = !resultInfo.result; <del> resultInfo.message = `Failed: ${resultInfo.message}`; <del> originalPushResult(resultInfo); <del> }; <del> adapter.exception(error); <del> } finally { <del> assert.pushResult = originalPushResult; <del> } <del> } <del>}); <del> <ide> moduleFor('ember-testing QUnitAdapter: QUnit 2.x', class extends AbstractTestCase { <ide> constructor() { <ide> super();
1
Javascript
Javascript
simplify opaque nested text uiexplorer example
a670ed1d3c60ccb69c5e87ed04304ea12ebb844d
<ide><path>Examples/UIExplorer/TextExample.ios.js <ide> exports.examples = [ <ide> <Text style={{fontSize: 11, color: '#527fe4'}}> <ide> (and tiny inherited bold blue) <ide> </Text> <del> ), <add> ) <ide> </Text> <ide> ) <ide> </Text> <del> <Text style={{backgroundColor:'#ffaaaa'}}> <del> (opacity 1.0 alpha 1.0 back red) <del> </Text> <del> <Text style={{backgroundColor:'#ffaaaa'}}> <del> (back red <del> <Text style={{opacity:0.5}}> <del> (opacity 0.5) <del> </Text> <del> ) <del> </Text> <del> <Text style={{backgroundColor:'#ffaaaa'}}> <del> (back red <del> <Text style={{color:'rgba(0,0,0,0.5)', backgroundColor:'rgba(255,170,170,0.5)'}}> <del> (alpha 0.5 back red) <del> </Text> <del> ) <del> </Text> <del> <Text style={{opacity:0.5, backgroundColor:'#ffaaaa'}}> <del> (opacity 0.5 back red <del> <Text style={{opacity:0.5}}> <del> (opacity 0.5) <del> </Text> <del> ) <del> </Text> <del> <Text style={{color:'rgba(0,0,0,0.5)', backgroundColor:'rgba(255,170,170,0.5)'}}> <del> (alpha 0.5 back red <del> <Text style={{color:'rgba(0,0,0,0.25)', backgroundColor:'rgba(255,170,170,0.25)'}}> <del> (alpha 0.25 back red) <del> </Text> <del> ) <del> </Text> <del> <Text style={{opacity:0.5}}> <del> (opacity 0.5 <del> <Text style={{opacity:0.5, backgroundColor:'#ffaaaa'}}> <del> (opacity 0.5 back red) <del> </Text> <del> ) <del> </Text> <del> <Text style={{opacity:0.5}}> <del> (opacity 0.5 <del> <Text style={{backgroundColor:'#ffaaaa'}}>(back red)</Text> <del> <Text style={{opacity:0.5, backgroundColor:'#ffaaaa'}}> <del> (opacity 0.5 back red) <del> </Text> <del> <Text style={{backgroundColor:'#ffaaaa'}}>(back red)</Text> <del> ) <del> </Text> <del> <Text style={{opacity:0.5}}> <del> (opacity 0.5 <del> <Text style={{backgroundColor:'#ffaaaa'}}>(back red)</Text> <del> <Text style={{color:'rgba(0,0,0,0.5)', backgroundColor:'rgba(255,170,170,0.5)'}}> <del> (alpha 0.5 back red) <del> </Text> <del> <Text style={{backgroundColor:'#ffaaaa'}}>(back red)</Text> <del> ) <del> </Text> <del> <Text style={{opacity:0.5, backgroundColor:'#ffaaaa'}}> <del> (opacity 0.5 back red <del> <Text style={{color:'rgba(0,0,0,0.5)', backgroundColor:'rgba(255,170,170,0.5)'}}> <del> (alpha 0.5 back red) <del> </Text> <del> ) <del> </Text> <del> <Text style={{opacity:0.5, backgroundColor:'#ffaaaa'}}> <del> (opacity 0.5 back red <del> <Text style={{color:'rgba(0,0,0,0.5)', backgroundColor:'rgba(170,170,255,0.5)'}}> <del> (alpha 0.5 back blue) <del> </Text> <add> <Text style={{opacity:0.7}}> <add> (opacity <add> <Text> <add> (is inherited <add> <Text style={{opacity:0.7}}> <add> (and accumulated <add> <Text style={{backgroundColor:'#ffaaaa'}}> <add> (and also applies to the background) <add> </Text> <add> ) <add> </Text> <add> ) <add> </Text> <ide> ) <ide> </Text> <ide> <Text style={{fontSize: 12}}>
1
PHP
PHP
handle the case where viewpath changes
437d68c60be0ad39a74e2f0751637f8235955795
<ide><path>lib/Cake/Error/ExceptionRenderer.php <ide> protected function _outputMessage($template) { <ide> protected function _outputMessageSafe($template) { <ide> $this->controller->layoutPath = ''; <ide> $this->controller->subDir = ''; <del> $this->controller->helpers = array('Form', 'Html', 'Session'); <add> $this->controller->viewPath = 'Errors/'; <ide> $this->controller->viewClass = 'View'; <add> $this->controller->helpers = array('Form', 'Html', 'Session'); <add> <ide> $this->controller->render($template); <ide> $this->controller->response->type('html'); <ide> $this->controller->response->send(); <ide><path>lib/Cake/Test/Case/Error/ExceptionRendererTest.php <ide> public function testMissingSubdirRenderSafe() { <ide> $this->assertEquals('', $ExceptionRenderer->controller->layoutPath); <ide> $this->assertEquals('', $ExceptionRenderer->controller->subDir); <ide> $this->assertEquals('View', $ExceptionRenderer->controller->viewClass); <add> $this->assertEquals('Errors/', $ExceptionRenderer->controller->viewPath); <ide> } <ide> <ide> /**
2
PHP
PHP
remove old php 7 workarounds
6bb9b4d992e2914a5c94787144138413411ee748
<ide><path>tests/Cache/CacheMemcachedStoreTest.php <ide> public function testSetMethodProperlyCallsMemcache() <ide> <ide> public function testIncrementMethodProperlyCallsMemcache() <ide> { <del> /* @link https://github.com/php-memcached-dev/php-memcached/pull/468 */ <del> if (version_compare(phpversion(), '8.0.0', '>=')) { <del> $this->markTestSkipped('Test broken due to parse error in PHP Memcached.'); <del> } <add> /** @link https://github.com/php-memcached-dev/php-memcached/pull/468 */ <add> $this->markTestSkipped('Test broken due to parse error in PHP Memcached.'); <ide> <ide> $memcached = m::mock(Memcached::class); <ide> $memcached->shouldReceive('increment')->with('foo', 5)->once()->andReturn(5); <ide> public function testIncrementMethodProperlyCallsMemcache() <ide> <ide> public function testDecrementMethodProperlyCallsMemcache() <ide> { <del> /* @link https://github.com/php-memcached-dev/php-memcached/pull/468 */ <del> if (version_compare(phpversion(), '8.0.0', '>=')) { <del> $this->markTestSkipped('Test broken due to parse error in PHP Memcached.'); <del> } <add> /** @link https://github.com/php-memcached-dev/php-memcached/pull/468 */ <add> $this->markTestSkipped('Test broken due to parse error in PHP Memcached.'); <ide> <ide> $memcached = m::mock(Memcached::class); <ide> $memcached->shouldReceive('decrement')->with('foo', 5)->once()->andReturn(0); <ide><path>tests/Database/DatabaseEloquentBelongsToTest.php <ide> public function testEagerConstraintsAreProperlyAdded() <ide> <ide> public function testIdsInEagerConstraintsCanBeZero() <ide> { <del> $keys = ['foreign.value', 0]; <del> <del> if (version_compare(PHP_VERSION, '8.0.0-dev', '>=')) { <del> sort($keys); <del> } <del> <ide> $relation = $this->getRelation(); <ide> $relation->getRelated()->shouldReceive('getKeyName')->andReturn('id'); <ide> $relation->getRelated()->shouldReceive('getKeyType')->andReturn('int'); <del> $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('relation.id', $keys); <add> $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('relation.id', [0, 'foreign.value']); <ide> $models = [new EloquentBelongsToModelStub, new EloquentBelongsToModelStubWithZeroId]; <ide> $relation->addEagerConstraints($models); <ide> } <ide><path>tests/Database/DatabaseEloquentMorphToTest.php <ide> protected function tearDown(): void <ide> m::close(); <ide> } <ide> <add> /** <add> * @requires PHP >= 8.1 <add> */ <ide> public function testLookupDictionaryIsProperlyConstructedForEnums() <ide> { <del> if (version_compare(PHP_VERSION, '8.1') < 0) { <del> $this->markTestSkipped('PHP 8.1 is required'); <add> $relation = $this->getRelation(); <add> $relation->addEagerConstraints([ <add> $one = (object) ['morph_type' => 'morph_type_2', 'foreign_key' => TestEnum::test], <add> ]); <add> $dictionary = $relation->getDictionary(); <add> $relation->getDictionary(); <add> $enumKey = TestEnum::test; <add> if (isset($enumKey->value)) { <add> $value = $dictionary['morph_type_2'][$enumKey->value][0]->foreign_key; <add> $this->assertEquals(TestEnum::test, $value); <ide> } else { <del> $relation = $this->getRelation(); <del> $relation->addEagerConstraints([ <del> $one = (object) ['morph_type' => 'morph_type_2', 'foreign_key' => TestEnum::test], <del> ]); <del> $dictionary = $relation->getDictionary(); <del> $relation->getDictionary(); <del> $enumKey = TestEnum::test; <del> if (isset($enumKey->value)) { <del> $value = $dictionary['morph_type_2'][$enumKey->value][0]->foreign_key; <del> $this->assertEquals(TestEnum::test, $value); <del> } else { <del> $this->fail('An enum should contain value property'); <del> } <add> $this->fail('An enum should contain value property'); <ide> } <ide> } <ide> <ide><path>tests/Integration/Database/EloquentModelEnumCastingTest.php <ide> } <ide> <ide> /** <del> * @requires PHP 8.1 <add> * @requires PHP >= 8.1 <ide> */ <ide> class EloquentModelEnumCastingTest extends DatabaseTestCase <ide> { <ide><path>tests/Integration/Foundation/DiscoverEventsTest.php <ide> class_alias(ListenerInterface::class, 'Tests\Integration\Foundation\Fixtures\Eve <ide> ], $events); <ide> } <ide> <del> /** <del> * @requires PHP >= 8 <del> */ <ide> public function testUnionEventsCanBeDiscovered() <ide> { <ide> class_alias(UnionListener::class, 'Tests\Integration\Foundation\Fixtures\EventDiscovery\UnionListeners\UnionListener'); <ide><path>tests/Integration/Queue/ModelSerializationTest.php <ide> public function testItCanUnserializeCustomCollection() <ide> $this->assertInstanceOf(ModelSerializationTestCustomUserCollection::class, $unserialized->users); <ide> } <ide> <del> /** <del> * @requires PHP >= 7.4 <del> */ <ide> public function testItSerializesTypedProperties() <ide> { <ide> require_once __DIR__.'/typed-properties.php'; <ide><path>tests/Integration/Routing/ImplicitBackedEnumRouteBindingTest.php <ide> } <ide> <ide> /** <del> * @requires PHP 8.1 <add> * @requires PHP >= 8.1 <ide> */ <ide> class ImplicitBackedEnumRouteBindingTest extends TestCase <ide> { <ide><path>tests/Routing/ImplicitRouteBindingTest.php <ide> class ImplicitRouteBindingTest extends TestCase <ide> { <ide> /** <del> * @requires PHP 8.1 <add> * @requires PHP >= 8.1 <ide> */ <ide> public function test_it_can_resolve_the_implicit_backed_enum_route_bindings_for_the_given_route() <ide> { <ide> public function test_it_can_resolve_the_implicit_backed_enum_route_bindings_for_ <ide> } <ide> <ide> /** <del> * @requires PHP 8.1 <add> * @requires PHP >= 8.1 <ide> */ <ide> public function test_it_does_not_resolve_implicit_non_backed_enum_route_bindings_for_the_given_route() <ide> { <ide> public function test_it_does_not_resolve_implicit_non_backed_enum_route_bindings <ide> } <ide> <ide> /** <del> * @requires PHP 8.1 <add> * @requires PHP >= 8.1 <ide> */ <ide> public function test_implicit_backed_enum_internal_exception() <ide> { <ide><path>tests/Support/SupportReflectorTest.php <ide> public function testParentClassName() <ide> $this->assertSame(A::class, Reflector::getParameterClassName($method->getParameters()[0])); <ide> } <ide> <del> /** <del> * @requires PHP >= 8 <del> */ <ide> public function testUnionTypeName() <ide> { <ide> $method = (new ReflectionClass(C::class))->getMethod('f'); <ide><path>tests/Support/SupportReflectsClosuresTest.php <ide> public function testItThrowsWhenNoFirstParameterType() <ide> }); <ide> } <ide> <del> /** <del> * @requires PHP >= 8 <del> */ <ide> public function testItWorksWithUnionTypes() <ide> { <ide> $types = ReflectsClosuresClass::reflectFirstAll(function (ExampleParameter $a, $b) {
10
Python
Python
fix incorrect test name. fixes #635
221e77d3575c182eb49d50546f844f392a5f7ba6
<ide><path>rest_framework/tests/serializer.py <ide> def test_create_model_not_blank_field(self): <ide> serializer = self.not_blank_model_serializer_class(data=self.data) <ide> self.assertEquals(serializer.is_valid(), False) <ide> <del> def test_create_model_null_field(self): <add> def test_create_model_empty_field(self): <ide> serializer = self.model_serializer_class(data={}) <ide> self.assertEquals(serializer.is_valid(), True) <ide>
1
Go
Go
fix godoc formatting
481185fb8a91061240de906cfd374bfc9425ec77
<ide><path>libnetwork/osl/sandbox.go <ide> const ( <ide> // Sandbox represents a network sandbox, identified by a specific key. It <ide> // holds a list of Interfaces, routes etc, and more can be added dynamically. <ide> type Sandbox interface { <del> // The path where the network namespace is mounted. <add> // Key returns the path where the network namespace is mounted. <ide> Key() string <ide> <del> // Add an existing Interface to this sandbox. The operation will rename <add> // AddInterface adds an existing Interface to this sandbox. The operation will rename <ide> // from the Interface SrcName to DstName as it moves, and reconfigure the <ide> // interface according to the specified settings. The caller is expected <ide> // to only provide a prefix for DstName. The AddInterface api will auto-generate <ide> // an appropriate suffix for the DstName to disambiguate. <ide> AddInterface(SrcName string, DstPrefix string, options ...IfaceOption) error <ide> <del> // Set default IPv4 gateway for the sandbox <add> // SetGateway sets the default IPv4 gateway for the sandbox. <ide> SetGateway(gw net.IP) error <ide> <del> // Set default IPv6 gateway for the sandbox <add> // SetGatewayIPv6 sets the default IPv6 gateway for the sandbox. <ide> SetGatewayIPv6(gw net.IP) error <ide> <del> // Unset the previously set default IPv4 gateway in the sandbox <add> // UnsetGateway the previously set default IPv4 gateway in the sandbox. <ide> UnsetGateway() error <ide> <del> // Unset the previously set default IPv6 gateway in the sandbox <add> // UnsetGatewayIPv6 unsets the previously set default IPv6 gateway in the sandbox. <ide> UnsetGatewayIPv6() error <ide> <ide> // GetLoopbackIfaceName returns the name of the loopback interface <ide> type Sandbox interface { <ide> RemoveAliasIP(ifName string, ip *net.IPNet) error <ide> <ide> // DisableARPForVIP disables ARP replies and requests for VIP addresses <del> // on a particular interface <add> // on a particular interface. <ide> DisableARPForVIP(ifName string) error <ide> <del> // Add a static route to the sandbox. <add> // AddStaticRoute adds a static route to the sandbox. <ide> AddStaticRoute(*types.StaticRoute) error <ide> <del> // Remove a static route from the sandbox. <add> // RemoveStaticRoute removes a static route from the sandbox. <ide> RemoveStaticRoute(*types.StaticRoute) error <ide> <ide> // AddNeighbor adds a neighbor entry into the sandbox. <ide> type Sandbox interface { <ide> // DeleteNeighbor deletes neighbor entry from the sandbox. <ide> DeleteNeighbor(dstIP net.IP, dstMac net.HardwareAddr, osDelete bool) error <ide> <del> // Returns an interface with methods to set neighbor options. <add> // NeighborOptions returns an interface with methods to set neighbor options. <ide> NeighborOptions() NeighborOptionSetter <ide> <del> // Returns an interface with methods to set interface options. <add> // InterfaceOptions an interface with methods to set interface options. <ide> InterfaceOptions() IfaceOptionSetter <ide> <del> //Invoke <add> // InvokeFunc invoke a function in the network namespace. <ide> InvokeFunc(func()) error <ide> <del> // Returns an interface with methods to get sandbox state. <add> // Info returns an interface with methods to get sandbox state. <ide> Info() Info <ide> <del> // Destroy the sandbox <add> // Destroy destroys the sandbox. <ide> Destroy() error <ide> <del> // restore sandbox <add> // Restore restores the sandbox. <ide> Restore(ifsopt map[string][]IfaceOption, routes []*types.StaticRoute, gw net.IP, gw6 net.IP) error <ide> <del> // ApplyOSTweaks applies operating system specific knobs on the sandbox <add> // ApplyOSTweaks applies operating system specific knobs on the sandbox. <ide> ApplyOSTweaks([]SandboxType) <ide> } <ide> <ide> type IfaceOptionSetter interface { <ide> // Address returns an option setter to set IPv4 address. <ide> Address(*net.IPNet) IfaceOption <ide> <del> // Address returns an option setter to set IPv6 address. <add> // AddressIPv6 returns an option setter to set IPv6 address. <ide> AddressIPv6(*net.IPNet) IfaceOption <ide> <ide> // LinkLocalAddresses returns an option setter to set the link-local IP addresses. <ide> type IfaceOptionSetter interface { <ide> // previously added interface of type bridge. <ide> Master(string) IfaceOption <ide> <del> // Address returns an option setter to set interface routes. <add> // Routes returns an option setter to set interface routes. <ide> Routes([]*net.IPNet) IfaceOption <ide> } <ide> <ide> // Info represents all possible information that <ide> // the driver wants to place in the sandbox which includes <ide> // interfaces, routes and gateway <ide> type Info interface { <del> // The collection of Interface previously added with the AddInterface <add> // Interfaces returns the collection of Interface previously added with the AddInterface <ide> // method. Note that this doesn't include network interfaces added in any <ide> // other way (such as the default loopback interface which is automatically <ide> // created on creation of a sandbox). <ide> Interfaces() []Interface <ide> <del> // IPv4 gateway for the sandbox. <add> // Gateway returns the IPv4 gateway for the sandbox. <ide> Gateway() net.IP <ide> <del> // IPv6 gateway for the sandbox. <add> // GatewayIPv6 returns the IPv6 gateway for the sandbox. <ide> GatewayIPv6() net.IP <ide> <del> // Additional static routes for the sandbox. (Note that directly <del> // connected routes are stored on the particular interface they refer to.) <add> // StaticRoutes returns additional static routes for the sandbox. Note that <add> // directly connected routes are stored on the particular interface they <add> // refer to. <ide> StaticRoutes() []*types.StaticRoute <ide> <ide> // TODO: Add ip tables etc. <ide> type Info interface { <ide> // namespace to DstName in a different net namespace with the appropriate <ide> // network settings. <ide> type Interface interface { <del> // The name of the interface in the origin network namespace. <add> // SrcName returns the name of the interface in the origin network namespace. <ide> SrcName() string <ide> <del> // The name that will be assigned to the interface once moves inside a <del> // network namespace. When the caller passes in a DstName, it is only <del> // expected to pass a prefix. The name will modified with an appropriately <add> // DstName returns the name that will be assigned to the interface once <add> // moved inside a network namespace. When the caller passes in a DstName, <add> // it is only expected to pass a prefix. The name will be modified with an <ide> // auto-generated suffix. <ide> DstName() string <ide> <del> // IPv4 address for the interface. <add> // Address returns the IPv4 address for the interface. <ide> Address() *net.IPNet <ide> <del> // IPv6 address for the interface. <add> // AddressIPv6 returns the IPv6 address for the interface. <ide> AddressIPv6() *net.IPNet <ide> <del> // LinkLocalAddresses returns the link-local IP addresses assigned to the interface. <add> // LinkLocalAddresses returns the link-local IP addresses assigned to the <add> // interface. <ide> LinkLocalAddresses() []*net.IPNet <ide> <del> // IP routes for the interface. <add> // Routes returns IP routes for the interface. <ide> Routes() []*net.IPNet <ide> <del> // Bridge returns true if the interface is a bridge <add> // Bridge returns true if the interface is a bridge. <ide> Bridge() bool <ide> <ide> // Master returns the srcname of the master interface for this interface.
1
PHP
PHP
remove incorrect reference to strftime
49901c59c275f882eed6778889ef5c3c0742dd42
<ide><path>src/View/Helper/TimeHelper.php <ide> public function format($date, $format = null, $invalid = false, $timezone = null <ide> * This method takes into account the default date format for the current language if an LC_TIME file is used. <ide> * <ide> * @param int|string|\DateTime $date UNIX timestamp, strtotime() valid string or DateTime object <del> * @param string $format strftime format string. <add> * @param string $format Intl compatible format string. <ide> * @param bool|string $invalid Default value to display on invalid dates <ide> * @param string|\DateTimeZone $timezone User's timezone string or DateTimeZone object <ide> * @return string Formatted and translated date string
1
Python
Python
remove references to "join" merge mode
3695bc2db5ed9aa1c1a2fe90160df83202c343e4
<ide><path>keras/engine/topology.py <ide> def __call__(self, inputs, mask=None): <ide> self.add_inbound_node(layers, node_indices, tensor_indices) <ide> <ide> outputs = self.inbound_nodes[-1].output_tensors <del> return outputs[0] # merge only returns a single tensor <add> return outputs[0] # merge only returns a single tensor <ide> else: <ide> return self.call(inputs, mask) <ide> <ide> def get_output_shape_for(self, input_shape): <ide> break <ide> output_shape[self.concat_axis] += shape[self.concat_axis] <ide> return tuple(output_shape) <del> elif self.mode == 'join': <del> return None <ide> elif self.mode == 'dot': <ide> shape1 = list(input_shapes[0]) <ide> shape2 = list(input_shapes[1]) <ide> def merge(inputs, mode='sum', concat_axis=-1, <ide> <ide> # Arguments <ide> mode: string or lambda/function. If string, must be one <del> of: 'sum', 'mul', 'concat', 'ave', 'join', 'cos', 'dot'. <add> of: 'sum', 'mul', 'concat', 'ave', 'cos', 'dot'. <ide> If lambda/function, it should take as input a list of tensors <ide> and return a single tensor. <ide> concat_axis: integer, axis to use in mode `concat`.
1
Ruby
Ruby
remove unnecessary explicit return val
2f419f5c55114122f290a692490cebd74d877026
<ide><path>Library/Homebrew/utils/update.rb <ide> def display_version_data(outdated_packages) <ide> puts "==============Formatted outdated packages============\n" <ide> <ide> outdated_packages.each do |package_name, package_details| <del> puts "" <del> puts "Formula: #{package_name}" <add> puts "\nFormula: #{package_name}" <ide> puts "Current formula version: #{package_details['homebrew_version']}" <ide> puts "Repology latest version: #{package_details['repology_version']}" <ide> puts "Livecheck latest version: #{package_details['livecheck_latest_version']}" <ide><path>scripts/helpers/brew_commands.rb <ide> require "open3" <ide> <ide> class BrewCommands <del> <add> <ide> def livecheck_check_formula(formula_name) <ide> puts "- livecheck formula : #{formula_name}" <ide> command_args = [ <ide> def parse_livecheck_response(livecheck_output) <ide> <ide> # eg: ["burp", "2.2.18", "2.2.18"] <ide> package_name, brew_version, latest_version = livecheck_output <del> <add> <ide> {'name' => package_name, 'current_brew_version' => brew_version, 'livecheck_latest_version' => latest_version} <ide> end <ide> <ide> def bump_formula_pr(formula_name, url) <ide> <ide> def parse_formula_bump_response(formula_bump_response) <ide> response, status = formula_bump_response <del> response <add> response <ide> end <ide> <ide> def check_for_open_pr(formula_name, download_url) <ide> puts "- Checking for open PRs for formula : #{formula_name}" <ide> <ide> response = bump_formula_pr(formula_name, download_url) <ide> <del> return true if !response.include? 'Error: These open pull requests may be duplicates' <del> false <del> end <add> !response.include? 'Error: These open pull requests may be duplicates' <add> end <ide> <del>end <ide>\ No newline at end of file <add>end
2
Javascript
Javascript
improve performance of nexttick
e0835c9cda8ad515e407baff0c3515d6f105fd14
<ide><path>src/node.js <ide> function _tickCallback() { <ide> var callback, threw, tock; <ide> <del> scheduleMicrotasks(); <del> <del> while (tickInfo[kIndex] < tickInfo[kLength]) { <del> tock = nextTickQueue[tickInfo[kIndex]++]; <del> callback = tock.callback; <del> threw = true; <del> try { <del> callback(); <del> threw = false; <del> } finally { <del> if (threw) <add> do { <add> while (tickInfo[kIndex] < tickInfo[kLength]) { <add> tock = nextTickQueue[tickInfo[kIndex]++]; <add> callback = tock.callback; <add> threw = true; <add> try { <add> callback(); <add> threw = false; <add> } finally { <add> if (threw) <add> tickDone(); <add> } <add> if (1e4 < tickInfo[kIndex]) <ide> tickDone(); <ide> } <del> if (1e4 < tickInfo[kIndex]) <del> tickDone(); <del> } <del> <del> tickDone(); <add> tickDone(); <add> _runMicrotasks(); <add> emitPendingUnhandledRejections(); <add> } while (tickInfo[kLength] !== 0); <ide> } <ide> <ide> function _tickDomainCallback() { <ide> var callback, domain, threw, tock; <ide> <del> scheduleMicrotasks(); <del> <del> while (tickInfo[kIndex] < tickInfo[kLength]) { <del> tock = nextTickQueue[tickInfo[kIndex]++]; <del> callback = tock.callback; <del> domain = tock.domain; <del> if (domain) <del> domain.enter(); <del> threw = true; <del> try { <del> callback(); <del> threw = false; <del> } finally { <del> if (threw) <add> do { <add> while (tickInfo[kIndex] < tickInfo[kLength]) { <add> tock = nextTickQueue[tickInfo[kIndex]++]; <add> callback = tock.callback; <add> domain = tock.domain; <add> if (domain) <add> domain.enter(); <add> threw = true; <add> try { <add> callback(); <add> threw = false; <add> } finally { <add> if (threw) <add> tickDone(); <add> } <add> if (1e4 < tickInfo[kIndex]) <ide> tickDone(); <add> if (domain) <add> domain.exit(); <ide> } <del> if (1e4 < tickInfo[kIndex]) <del> tickDone(); <del> if (domain) <del> domain.exit(); <del> } <add> tickDone(); <add> _runMicrotasks(); <add> emitPendingUnhandledRejections(); <add> } while (tickInfo[kLength] !== 0); <add> } <ide> <del> tickDone(); <add> function TickObject(c) { <add> this.callback = c; <add> this.domain = process.domain || null; <ide> } <ide> <ide> function nextTick(callback) { <ide> // on the way out, don't bother. it won't get fired anyway. <ide> if (process._exiting) <ide> return; <ide> <del> var obj = { <del> callback: callback, <del> domain: process.domain || null <del> }; <del> <del> nextTickQueue.push(obj); <add> nextTickQueue.push(new TickObject(callback)); <ide> tickInfo[kLength]++; <ide> } <ide> <ide><path>test/parallel/test-timers-first-fire.js <ide> setTimeout(function() { <ide> var ms = (hr[0] * 1e3) + (hr[1] / 1e6); <ide> var delta = ms - TIMEOUT; <ide> console.log('timer fired in', delta); <del> assert.ok(delta > 0, 'Timer fired early'); <add> assert.ok(delta > -0.5, 'Timer fired early'); <ide> }, TIMEOUT);
2
Javascript
Javascript
replace function with arrow function
8b68d48d82ff64a2af46af4ea35d2aac46cc004c
<ide><path>test/parallel/test-child-process-send-cb.js <ide> const assert = require('assert'); <ide> const fork = require('child_process').fork; <ide> <ide> if (process.argv[2] === 'child') { <del> process.send('ok', common.mustCall(function(err) { <add> process.send('ok', common.mustCall((err) => { <ide> assert.strictEqual(err, null); <ide> })); <ide> } else { <ide> const child = fork(process.argv[1], ['child']); <del> child.on('message', common.mustCall(function(message) { <add> child.on('message', common.mustCall((message) => { <ide> assert.strictEqual(message, 'ok'); <ide> })); <del> child.on('exit', common.mustCall(function(exitCode, signalCode) { <add> child.on('exit', common.mustCall((exitCode, signalCode) => { <ide> assert.strictEqual(exitCode, 0); <ide> assert.strictEqual(signalCode, null); <ide> }));
1
PHP
PHP
add method to dynamically add a deferred service
decd163efff4537ec0d2648953d8baf654901a62
<ide><path>src/Illuminate/Foundation/Application.php <ide> public function setDeferredServices(array $services) <ide> $this->deferredServices = $services; <ide> } <ide> <add> /** <add> * Add a service to the application's deferred services. <add> * <add> * @param string $service <add> * @return void <add> */ <add> public function addDeferredService($service) <add> { <add> $this->deferredServices[] = $service; <add> } <add> <ide> /** <ide> * Determine if the given service is a deferred service. <ide> *
1
Javascript
Javascript
add type test that es6 collections can be used
0ba7936d466754c441cccd73b0c022d123a26276
<ide><path>type-definitions/tests/es6-collections.js <add>/* <add> * @flow <add> */ <add> <add>import { <add> Map as ImmutableMap, <add> Set as ImmutableSet, <add>} from 'immutable' <add> <add>// Immutable.js collections <add>var mapImmutable: ImmutableMap<string, number> = ImmutableMap() <add>var setImmutable: ImmutableSet<string> = ImmutableSet() <add>var deleteResultImmutable: ImmutableMap<string, number> = mapImmutable.delete('foo'); <add> <add>// ES6 collections <add>var mapES6: Map<string, number> = new Map() <add>var setES6: Set<string> = new Set() <add>var deleteResultES6: boolean = mapES6.delete('foo');
1
Javascript
Javascript
use const in viewer.js
276631db30c3f22d4f97e2340330d4675d879c3f
<ide><path>web/viewer.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <add>/* eslint no-var: error, prefer-const: error */ <ide> <ide> 'use strict'; <ide> <ide> if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) { <ide> (function rewriteUrlClosure() { <ide> // Run this code outside DOMContentLoaded to make sure that the URL <ide> // is rewritten as soon as possible. <del> let queryString = document.location.search.slice(1); <del> let m = /(^|&)file=([^&]*)/.exec(queryString); <add> const queryString = document.location.search.slice(1); <add> const m = /(^|&)file=([^&]*)/.exec(queryString); <ide> defaultUrl = m ? decodeURIComponent(m[2]) : ''; <ide> <ide> // Example: chrome-extension://.../http://example.com/file.pdf <del> let humanReadableUrl = '/' + defaultUrl + location.hash; <add> const humanReadableUrl = '/' + defaultUrl + location.hash; <ide> history.replaceState(history.state, '', humanReadableUrl); <ide> if (top === window) { <ide> // eslint-disable-next-line no-undef <ide> function getViewerConfiguration() { <ide> } <ide> <ide> function webViewerLoad() { <del> let config = getViewerConfiguration(); <add> const config = getViewerConfiguration(); <ide> if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) { <ide> Promise.all([ <ide> SystemJS.import('pdfjs-web/app'),
1
Java
Java
use sparsearray for detached views
a6028919462b41ed5ebf24011e80f18eb0bc2143
<ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/ClippingDrawCommandManager.java <ide> // less in our case because of the large constant overhead and auto boxing of the map. <ide> private SparseIntArray mDrawViewIndexMap = StateBuilder.EMPTY_SPARSE_INT; <ide> // Map of views that are currently clipped. <del> private final Map<Integer, View> mClippedSubviews = new HashMap<>(); <add> private final SparseArray<View> mClippedSubviews = new SparseArray<>(); <ide> <ide> protected final Rect mClippingRect = new Rect(); <ide> <ide> private void unclip(int id) { <ide> } <ide> <ide> private boolean isClipped(int id) { <del> return mClippedSubviews.containsKey(id); <add> return mClippedSubviews.get(id) != null; <ide> } <ide> <ide> private boolean isNotClipped(int id) { <del> return !mClippedSubviews.containsKey(id); <add> return mClippedSubviews.get(id) == null; <ide> } <ide> <ide> @Override <ide> public void getClippingRect(Rect outClippingRect) { <ide> } <ide> <ide> @Override <del> public Collection<View> getDetachedViews() { <del> return mClippedSubviews.values(); <add> public SparseArray<View> getDetachedViews() { <add> return mClippedSubviews; <ide> } <ide> <ide> /** <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/DrawCommandManager.java <ide> <ide> import android.graphics.Canvas; <ide> import android.graphics.Rect; <add>import android.util.SparseArray; <ide> import android.util.SparseIntArray; <ide> import android.view.View; <ide> import android.view.ViewParent; <ide> abstract void mountDrawCommands( <ide> * <ide> * @return A collection of the currently detached views. <ide> */ <del> abstract Collection<View> getDetachedViews(); <add> abstract SparseArray<View> getDetachedViews(); <ide> <ide> /** <ide> * Draw the relevant items. This should do as little work as possible. <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatNativeViewHierarchyManager.java <ide> import java.util.Collection; <ide> import java.util.List; <ide> <add>import android.util.SparseArray; <ide> import android.util.SparseIntArray; <ide> import android.view.View; <ide> import android.view.View.MeasureSpec; <ide> protected void dropView(View view) { <ide> if (view instanceof FlatViewGroup) { <ide> FlatViewGroup flatViewGroup = (FlatViewGroup) view; <ide> if (flatViewGroup.getRemoveClippedSubviews()) { <del> Collection<View> detachedViews = flatViewGroup.getDetachedViews(); <del> for (View detachedChild : detachedViews) { <add> SparseArray<View> detachedViews = flatViewGroup.getDetachedViews(); <add> for (int i = 0, size = detachedViews.size(); i < size; i++) { <add> View detachedChild = detachedViews.valueAt(i); <ide> // we can do super here because removeClippedSubviews is currently not recursive. if/when <ide> // we become recursive one day, this should call vanilla dropView to be recursive as well. <ide> super.dropView(detachedChild); <ide><path>ReactAndroid/src/main/java/com/facebook/react/flat/FlatViewGroup.java <ide> import android.graphics.Paint; <ide> import android.graphics.Rect; <ide> import android.graphics.drawable.Drawable; <add>import android.util.SparseArray; <ide> import android.util.SparseIntArray; <ide> import android.view.MotionEvent; <ide> import android.view.View; <ide> public void dispatchImageLoadEvent(int reactTag, int imageLoadEvent) { <ide> private long mLastTouchDownTime; <ide> private @Nullable OnInterceptTouchEventListener mOnInterceptTouchEventListener; <ide> <del> private static final ArrayList<View> EMPTY_DETACHED_VIEWS = new ArrayList<>(0); <add> private static final SparseArray<View> EMPTY_DETACHED_VIEWS = new SparseArray<>(0); <ide> // Provides clipping, drawing and node region finding logic if subview clipping is enabled. <ide> private @Nullable DrawCommandManager mDrawCommandManager; <ide> <ide> public PointerEvents getPointerEvents() { <ide> * <ide> * @return A Collection of Views to clean up. <ide> */ <del> Collection<View> getDetachedViews() { <add> /* package */ SparseArray<View> getDetachedViews() { <ide> if (mDrawCommandManager == null) { <ide> return EMPTY_DETACHED_VIEWS; <ide> }
4
Text
Text
add header fixes[ci skip]
d36c84b42c4108ce58cd99ff1d9f4a4f251c57ca
<ide><path>guides/source/security.md <ide> Location: http://www.malicious.tld <ide> <ide> So _attack vectors for Header Injection are based on the injection of CRLF characters in a header field._ And what could an attacker do with a false redirection? They could redirect to a phishing site that looks the same as yours, but ask to login again (and sends the login credentials to the attacker). Or they could install malicious software through browser security holes on that site. Rails 2.1.2 escapes these characters for the Location field in the `redirect_to` method. _Make sure you do it yourself when you build other header fields with user input._ <ide> <del>#### DNS rebinding and Host header attacks <add>#### DNS Rebinding and Host Header Attacks <ide> <ide> DNS rebinding is a method of manipulating resolution of domain names that is commonly used as a form of computer attack. DNS rebinding circumvents the same-origin policy by abusing the Domain Name System (DNS) instead. It rebinds a domain to a different IP address and than compromises the system by executing random code against your Rails app from the changed IP address. <ide>
1
Python
Python
remove long_description from setup.py
fabfdb868eb5d6b032dcaa9f71844743e57f69ca
<ide><path>setup.py <ide> setup(name = 'Keras', <ide> version = '0.1.0', <ide> description = 'Theano-based Deep Learning library', <del> long_description = open('README.md').read(), <ide> author = 'Francois Chollet', <ide> author_email = 'francois.chollet@gmail.com', <ide> url = 'https://github.com/fchollet/keras',
1
Ruby
Ruby
eliminate warning by initializing nil formats
be664392c030a2a0241616be764725f0e66d872b
<ide><path>actionpack/lib/abstract_controller/rendering_controller.rb <ide> module RenderingController <ide> self._view_paths ||= ActionView::PathSet.new <ide> end <ide> <add> # Initialize controller with nil formats. <add> def initialize(*) #:nodoc: <add> @_formats = nil <add> super <add> end <add> <ide> # An instance of a view class. The default view class is ActionView::Base <ide> # <ide> # The view class must have the following methods:
1
Javascript
Javascript
use leniv to read the subrs section
18661debdc1e01e1c386ece52e0dfce69fb5c476
<ide><path>fonts.js <ide> var Type1Parser = function() { <ide> for (var j = 0; j < argc; j++) <ide> charstring.push('drop'); <ide> <del> // If the flex mechanishm is not used in a font program, Adobe <add> // If the flex mechanism is not used in a font program, Adobe <ide> // state that that entries 0, 1 and 2 can simply be replace by <ide> // {}, which means that we can simply ignore them. <ide> if (index < 3) { <ide> var Type1Parser = function() { <ide> var length = parseInt(getToken()); <ide> getToken(); // read in 'RD' <ide> var data = eexec.slice(i + 1, i + 1 + length); <del> var encoded = decrypt(data, kCharStringsEncryptionKey, 4); <add> var lenIV = program.properties.private['lenIV']; <add> var encoded = decrypt(data, kCharStringsEncryptionKey, lenIV); <ide> var str = decodeCharString(encoded); <ide> i = i + 1 + length; <ide> getToken(); //read in 'NP'
1
Javascript
Javascript
allow literals in isolate scope references
43072e3812e32b89b97ad03144577cba50d4b776
<ide><path>src/ng/compile.js <ide> function $CompileProvider($provide, $$sanitizeUriProvider) { <ide> optional = (match[2] == '?'), <ide> mode = match[1], // @, =, or & <ide> lastValue, <del> parentGet, parentSet; <add> parentGet, parentSet, compare; <ide> <ide> isolateScope.$$isolateBindings[scopeName] = mode + attrName; <ide> <ide> function $CompileProvider($provide, $$sanitizeUriProvider) { <ide> return; <ide> } <ide> parentGet = $parse(attrs[attrName]); <add> if (parentGet.literal) { <add> compare = equals; <add> } else { <add> compare = function(a,b) { return a === b; }; <add> } <ide> parentSet = parentGet.assign || function() { <ide> // reset the change, or we will throw this exception on every $digest <ide> lastValue = isolateScope[scopeName] = parentGet(scope); <ide> function $CompileProvider($provide, $$sanitizeUriProvider) { <ide> lastValue = isolateScope[scopeName] = parentGet(scope); <ide> isolateScope.$watch(function parentValueWatch() { <ide> var parentValue = parentGet(scope); <del> <del> if (parentValue !== isolateScope[scopeName]) { <add> if (!compare(parentValue, isolateScope[scopeName])) { <ide> // we are out of sync and need to copy <del> if (parentValue !== lastValue) { <add> if (!compare(parentValue, lastValue)) { <ide> // parent changed and it has precedence <ide> isolateScope[scopeName] = parentValue; <ide> } else { <ide> function $CompileProvider($provide, $$sanitizeUriProvider) { <ide> } <ide> } <ide> return lastValue = parentValue; <del> }); <add> }, null, parentGet.literal); <ide> break; <ide> <ide> case '&': <ide><path>test/ng/compileSpec.js <ide> describe('$compile', function() { <ide> <ide> expect(lastRefValueInParent).toBe('new'); <ide> })); <add> <add> describe('literal objects', function() { <add> it('should copy parent changes', inject(function() { <add> compile('<div><span my-component reference="{name: name}">'); <add> <add> $rootScope.name = 'a'; <add> $rootScope.$apply(); <add> expect(componentScope.reference).toEqual({name: 'a'}); <add> <add> $rootScope.name = 'b'; <add> $rootScope.$apply(); <add> expect(componentScope.reference).toEqual({name: 'b'}); <add> })); <add> <add> it('should not change the component when parent does not change', inject(function() { <add> compile('<div><span my-component reference="{name: name}">'); <add> <add> $rootScope.name = 'a'; <add> $rootScope.$apply(); <add> var lastComponentValue = componentScope.reference; <add> $rootScope.$apply(); <add> expect(componentScope.reference).toBe(lastComponentValue); <add> })); <add> <add> it('should complain when the component changes', inject(function() { <add> compile('<div><span my-component reference="{name: name}">'); <add> <add> $rootScope.name = 'a'; <add> $rootScope.$apply(); <add> componentScope.reference = {name: 'b'}; <add> expect(function() { <add> $rootScope.$apply(); <add> }).toThrowMinErr("$compile", "nonassign", "Expression '{name: name}' used with directive 'myComponent' is non-assignable!"); <add> <add> })); <add> <add> it('should work for primitive literals', inject(function() { <add> test('1', 1); <add> test('null', null); <add> test('undefined', undefined); <add> test("'someString'", 'someString'); <add> <add> <add> function test(literalString, literalValue) { <add> compile('<div><span my-component reference="'+literalString+'">'); <add> <add> $rootScope.$apply(); <add> expect(componentScope.reference).toBe(literalValue); <add> dealoc(element); <add> <add> } <add> <add> })); <add> <add> }); <add> <ide> }); <ide> <ide>
2
Go
Go
expand unshare test to include privileged test
e58161fedcb8718c3880eb1778e29468e4cb72bd
<ide><path>integration-cli/docker_cli_run_test.go <ide> func (s *DockerSuite) TestRunUnshareProc(c *check.C) { <ide> if out, _, err := runCommandWithOutput(runCmd); err == nil || !strings.Contains(out, "Permission denied") { <ide> c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err) <ide> } <add> <add> /* Ensure still fails if running privileged with the default policy */ <add> name = "crashoverride" <add> runCmd = exec.Command(dockerBinary, "run", "--privileged", "--security-opt", "apparmor:docker-default", "--name", name, "jess/unshare", "unshare", "-p", "-m", "-f", "-r", "mount", "-t", "proc", "none", "/proc") <add> if out, _, err := runCommandWithOutput(runCmd); err == nil || !strings.Contains(out, "Permission denied") { <add> c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err) <add> } <ide> } <ide> <ide> func (s *DockerSuite) TestRunPublishPort(c *check.C) {
1
Javascript
Javascript
add version property to next.js instance
010059915da401f63b56dc8e9355bb9ce7c2fc3e
<ide><path>packages/next/client/index.js <ide> if (!window.Promise) { <ide> const data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent) <ide> window.__NEXT_DATA__ = data <ide> <add>export const version = process.env.__NEXT_VERSION <add> <ide> const { <ide> props, <ide> err, <ide><path>test/integration/production/test/index.test.js <ide> describe('Production Usage', () => { <ide> expect(existsSync(join(appDir, '.next', 'profile-events.json'))).toBe(false) <ide> }) <ide> <add> it('should contain the Next.js version in window export', async () => { <add> let browser <add> try { <add> browser = await webdriver(appPort, '/about') <add> const version = await browser.eval('window.next.version') <add> expect(version).toBeTruthy() <add> expect(version).toBe(require('next/package.json').version) <add> } finally { <add> if (browser) { <add> await browser.close() <add> } <add> } <add> }) <add> <ide> dynamicImportTests(context, (p, q) => renderViaHTTP(context.appPort, p, q)) <ide> <ide> processEnv(context)
2
Javascript
Javascript
make timeout longer
c3a8b5d9f1925ddde59e32d5c8118e841e05918e
<ide><path>Gruntfile.js <ide> module.exports = function(grunt) { <ide> stderr: true, <ide> failOnError: true <ide> }, <del> command: path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js') <add> command: path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js -t 2000') <ide> } <ide> }, <ide>
1
PHP
PHP
update exception message
1a3285d360fd7debf416102ca3346b40d618755e
<ide><path>src/Mailer/AbstractTransport.php <ide> protected function checkRecipient(Message $message): void <ide> && $message->getCc() === [] <ide> && $message->getBcc() === [] <ide> ) { <del> throw new Exception('You must specify at least one recipient of to, cc or bcc.'); <add> throw new Exception('You must specify at least one recipient. Use one of `setTo`, `setCc` or `setBcc` to define a recipient.'); <ide> } <ide> } <ide> <ide><path>tests/TestCase/Mailer/Transport/MailTransportTest.php <ide> public function setUp(): void <ide> public function testSendWithoutRecipient() <ide> { <ide> $this->expectException(Exception::class); <del> $this->expectExceptionMessage('You must specify at least one recipient of to, cc or bcc.'); <add> $this->expectExceptionMessage('You must specify at least one recipient. Use one of `setTo`, `setCc` or `setBcc` to define a recipient.'); <ide> <ide> $message = new Message(); <ide> $this->MailTransport->send($message);
2
Javascript
Javascript
add websocket to eslint globals
af8ea06bb44e84ce51d4ca4e76f0d66bf34323bd
<ide><path>packages/eslint-config-react-native-community/index.js <ide> module.exports = { <ide> setImmediate: true, <ide> setInterval: false, <ide> setTimeout: false, <add> WebSocket: true, <ide> window: false, <ide> XMLHttpRequest: false, <ide> },
1
Ruby
Ruby
reduce relation allocations
fcb92882b12a4a79a5c2901062cef009ec5f2fdc
<ide><path>activerecord/lib/active_record/associations/preloader.rb <ide> class Preloader #:nodoc: <ide> def initialize(records, associations, preload_scope = nil) <ide> @records = Array.wrap(records).compact.uniq <ide> @associations = Array.wrap(associations) <del> @preload_scope = preload_scope || Relation.new(nil, nil) <add> @preload_scope = preload_scope || NULL_RELATION <ide> end <ide> <add> NULL_RELATION = Struct.new(:values).new({}) <add> <ide> def run <ide> unless records.empty? <ide> associations.each { |association| preload(association) }
1
Javascript
Javascript
use common.mustcall in test-worker-esm-exit
060a170e296e17e73715ec8728816da6530e16a6
<ide><path>test/parallel/test-worker-esm-exit.js <ide> const { Worker } = require('worker_threads'); <ide> <ide> const w = new Worker(fixtures.path('es-modules/import-process-exit.mjs')); <ide> w.on('error', common.mustNotCall()); <del>w.on('exit', (code) => assert.strictEqual(code, 42)); <add>w.on('exit', <add> common.mustCall((code) => assert.strictEqual(code, 42)) <add>);
1
Text
Text
fix typographic error in process doc
4220e86414859db697d783f0a520ea5dbaa354b9
<ide><path>doc/api/process.md <ide> emitMyWarning(); <ide> added: v0.7.7 <ide> --> <ide> <del>The `process.execArgv' property returns the set of Node.js-specific command-line <add>The `process.execArgv` property returns the set of Node.js-specific command-line <ide> options passed when the Node.js process was launched. These options do not <ide> appear in the array returned by the [`process.argv`][] property, and do not <ide> include the Node.js executable, the name of the script, or any options following
1
Python
Python
fix typo in gradient_checkpointing arg
5c673efad71026ec820c5101349aa0ae8a95b360
<ide><path>examples/research_projects/wav2vec2/run_asr.py <ide> class ModelArguments: <ide> default=True, metadata={"help": "Whether to freeze the feature extractor layers of the model."} <ide> ) <ide> gradient_checkpointing: Optional[bool] = field( <del> default=False, metadata={"help": "Whether to freeze the feature extractor layers of the model."} <add> default=False, <add> metadata={ <add> "help": "If True, use gradient checkpointing to save memory at the expense of slower backward pass." <add> }, <ide> ) <ide> verbose_logging: Optional[bool] = field( <ide> default=False, <ide><path>examples/research_projects/wav2vec2/run_pretrain.py <ide> class ModelArguments: <ide> default=True, metadata={"help": "Whether to freeze the feature extractor layers of the model."} <ide> ) <ide> gradient_checkpointing: Optional[bool] = field( <del> default=False, metadata={"help": "Whether to freeze the feature extractor layers of the model."} <add> default=False, <add> metadata={ <add> "help": "If True, use gradient checkpointing to save memory at the expense of slower backward pass." <add> }, <ide> ) <ide> verbose_logging: Optional[bool] = field( <ide> default=False,
2
PHP
PHP
add usingconnection method to databasemanager
9b652406ab4ef2ef039ebcf972abffb9a4129291
<ide><path>src/Illuminate/Database/DatabaseManager.php <ide> public function reconnect($name = null) <ide> return $this->refreshPdoConnections($name); <ide> } <ide> <add> /** <add> * Set the database connection for the callback execution. <add> * <add> * @param string $name <add> * @param callable $callback <add> * @return void <add> */ <add> public function usingConnection(string $name, callable $callback) <add> { <add> $previousName = $this->getDefaultConnection(); <add> <add> $this->setDefaultConnection($name); <add> $callback(); <add> $this->setDefaultConnection($previousName); <add> } <add> <ide> /** <ide> * Refresh the PDO connections on a given connection. <ide> *
1
Go
Go
add authorization plugins to docker info
4a1eb3f3e275e2675a4c53852e21fddcaa301be9
<ide><path>api/client/info.go <ide> package client <ide> <ide> import ( <ide> "fmt" <add> "strings" <ide> <ide> Cli "github.com/docker/docker/cli" <ide> "github.com/docker/docker/pkg/ioutils" <ide> func (cli *DockerCli) CmdInfo(args ...string) error { <ide> <ide> fmt.Fprintf(cli.out, "Plugins: \n") <ide> fmt.Fprintf(cli.out, " Volume:") <del> for _, driver := range info.Plugins.Volume { <del> fmt.Fprintf(cli.out, " %s", driver) <del> } <add> fmt.Fprintf(cli.out, " %s", strings.Join(info.Plugins.Volume, " ")) <ide> fmt.Fprintf(cli.out, "\n") <ide> fmt.Fprintf(cli.out, " Network:") <del> for _, driver := range info.Plugins.Network { <del> fmt.Fprintf(cli.out, " %s", driver) <del> } <add> fmt.Fprintf(cli.out, " %s", strings.Join(info.Plugins.Network, " ")) <ide> fmt.Fprintf(cli.out, "\n") <ide> <add> if len(info.Plugins.Authorization) != 0 { <add> fmt.Fprintf(cli.out, " Authorization:") <add> fmt.Fprintf(cli.out, " %s", strings.Join(info.Plugins.Authorization, " ")) <add> fmt.Fprintf(cli.out, "\n") <add> } <add> <ide> ioutils.FprintfIfNotEmpty(cli.out, "Kernel Version: %s\n", info.KernelVersion) <ide> ioutils.FprintfIfNotEmpty(cli.out, "Operating System: %s\n", info.OperatingSystem) <ide> ioutils.FprintfIfNotEmpty(cli.out, "OSType: %s\n", info.OSType) <ide><path>api/types/types.go <ide> type PluginsInfo struct { <ide> Volume []string <ide> // List of Network plugins registered <ide> Network []string <add> // List of Authorization plugins registered <add> Authorization []string <ide> } <ide> <ide> // ExecStartCheck is a temp struct used by execStart <ide><path>daemon/info.go <ide> func (daemon *Daemon) showPluginsInfo() types.PluginsInfo { <ide> pluginsInfo.Network = append(pluginsInfo.Network, nd) <ide> } <ide> <add> pluginsInfo.Authorization = daemon.GetAuthorizationPluginsList() <add> <ide> return pluginsInfo <ide> } <ide> <add>// GetAuthorizationPluginsList returns the list of plugins drivers <add>// registered for authorization. <add>func (daemon *Daemon) GetAuthorizationPluginsList() []string { <add> return daemon.configStore.AuthZPlugins <add>} <add> <ide> // The uppercase and the lowercase are available for the proxy settings. <ide> // See the Go specification for details on these variables. https://golang.org/pkg/net/http/ <ide> func getProxyEnv(key string) string {
3
Python
Python
create singly_linkedlist.py (#110)
75007332e4eddac6d67bcf9ad805a02972ef2caf
<ide><path>data_structures/LinkedList/singly_LinkedList.py <add>class Node:#create a Node <add> def __int__(self,data): <add> self.data=data#given data <add> self.next=None#given next to None <add>class Linked_List: <add> pass <add> def insert_tail(Head,data):#insert the data at tail <add> tamp=Head#create a tamp as a head <add> if(tamp==None):#if linkedlist is empty <add> newNod=Node()#create newNode Node type and given data and next <add> newNod.data=data <add> newNod.next=None <add> Head=newNod <add> else: <add> while tamp.next!=None:#find the last Node <add> tamp=tamp.next <add> newNod = Node()#create a new node <add> newNod.data = data <add> newNod.next = None <add> tamp.next=newNod#put the newnode into last node <add> return Head#return first node of linked list <add> def insert_head(Head,data): <add> tamp = Head <add> if (tamp == None): <add> newNod = Node()#create a new Node <add> newNod.data = data <add> newNod.next = None <add> Head = newNod#make new node to Head <add> else: <add> newNod = Node() <add> newNod.data = data <add> newNod.next = Head#put the Head at NewNode Next <add> Head=newNod#make a NewNode to Head <add> return Head <add> def Print(Head):#print every node data <add> tamp=Node() <add> tamp=Head <add> while tamp!=None: <add> print(tamp.data) <add> tamp=tamp.next <add> def delete_head(Head):#delete from head <add> if Head!=None: <add> Head=Head.next <add> return Head#return new Head <add> def delete_tail(Head):#delete from tail <add> if Head!=None: <add> tamp = Node() <add> tamp = Head <add> while (tamp.next).next!= None:#find the 2nd last element <add> tamp = tamp.next <add> tamp.next=None#delete the last element by give next None to 2nd last Element <add> return Head <add> def isEmpty(Head): <add> if(Head==None):#check Head is None or Not <add> return True#return Ture if list is empty <add> else: <add> return False#check False if it's not empty <add> <add> <add> <add>
1
PHP
PHP
fix incorrect __construct params for mock object
5b67534acc4f6d9c708676bcc16258789c4465b1
<ide><path>lib/Cake/Test/Case/Console/ShellDispatcherTest.php <ide> public function testGetShell() { <ide> */ <ide> public function testDispatchShellWithMain() { <ide> $Dispatcher = new TestShellDispatcher(); <del> $Mock = $this->getMock('Shell', array(), array(&$Dispatcher), 'MockWithMainShell'); <add> $Mock = $this->getMock('Shell', array(), array(), 'MockWithMainShell'); <ide> <ide> $Mock->expects($this->once())->method('initialize'); <ide> $Mock->expects($this->once())->method('loadTasks'); <ide> public function testDispatchShellWithMain() { <ide> */ <ide> public function testDispatchShellWithoutMain() { <ide> $Dispatcher = new TestShellDispatcher(); <del> $Shell = $this->getMock('Shell', array(), array(&$Dispatcher), 'MockWithoutMainShell'); <add> $Shell = $this->getMock('Shell', array(), array(), 'MockWithoutMainShell'); <ide> <del> $Shell = new MockWithoutMainShell($Dispatcher); <add> $Shell = new MockWithoutMainShell(); <ide> $this->mockObjects[] = $Shell; <ide> <ide> $Shell->expects($this->once())->method('initialize');
1
Text
Text
add additional link to html & forms topic page
16f5d42cbc3e966ab2d4d8dc00163942f2769e43
<ide><path>docs/api-guide/renderers.md <ide> You can use `TemplateHTMLRenderer` either to return regular HTML pages using RES <ide> <ide> If you're building websites that use `TemplateHTMLRenderer` along with other renderer classes, you should consider listing `TemplateHTMLRenderer` as the first class in the `renderer_classes` list, so that it will be prioritised first even for browsers that send poorly formed `ACCEPT:` headers. <ide> <add>See the [_HTML & Forms_ Topic Page][html-and-forms] for further examples of `TemplateHTMLRenderer` usage. <add> <ide> **.media_type**: `text/html` <ide> <ide> **.format**: `'.html'`
1
Javascript
Javascript
modularize ajax (and sub-modules)
a47b304f814458fb1f53e1fda82e7ccb7c07189d
<ide><path>grunt.js <ide> module.exports = function( grunt ) { <ide> "src/traversing.js", <ide> "src/manipulation.js", <ide> { flag: "css", src: "src/css.js" }, <del> "src/ajax.js", <del> "src/ajax/jsonp.js", <del> "src/ajax/script.js", <del> "src/ajax/xhr.js", <add> { flag: "ajax", src: "src/ajax.js" }, <add> { flag: "ajax/jsonp", src: "src/ajax/jsonp.js", needs: [ "ajax", "ajax/script" ] }, <add> { flag: "ajax/script", src: "src/ajax/script.js", needs: ["ajax"] }, <add> { flag: "ajax/xhr", src: "src/ajax/xhr.js", needs: ["ajax"] }, <ide> { flag: "effects", src: "src/effects.js", needs: ["css"] }, <ide> { flag: "offset", src: "src/offset.js", needs: ["css"] }, <ide> { flag: "dimensions", src: "src/dimensions.js", needs: ["css"] },
1
Go
Go
fix error messages
b3e1178ad0e2cee43e9958f0f3b6e720bddc4ea4
<ide><path>api/server/router/container/container_routes.go <ide> func (s *containerRouter) postContainersKill(ctx context.Context, w http.Respons <ide> // to keep backwards compatibility. <ide> version := httputils.VersionFromContext(ctx) <ide> if version.GreaterThanOrEqualTo("1.20") || !isStopped { <del> return fmt.Errorf("Cannot kill container %s: %v", name, err) <add> return fmt.Errorf("Cannot kill container %s: %v", name, utils.GetErrorMessage(err)) <ide> } <ide> } <ide> <ide> func (s *containerRouter) wsContainersAttach(ctx context.Context, w http.Respons <ide> } <ide> <ide> if err := s.backend.ContainerWsAttachWithLogs(containerName, wsAttachWithLogsConfig); err != nil { <del> logrus.Errorf("Error attaching websocket: %s", err) <add> logrus.Errorf("Error attaching websocket: %s", utils.GetErrorMessage(err)) <ide> } <ide> }) <ide> ws := websocket.Server{Handler: h, Handshake: nil} <ide><path>api/server/router/container/exec.go <ide> import ( <ide> "github.com/docker/docker/api/server/httputils" <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/pkg/stdcopy" <add> "github.com/docker/docker/utils" <ide> "golang.org/x/net/context" <ide> ) <ide> <ide> func (s *containerRouter) postContainerExecCreate(ctx context.Context, w http.Re <ide> // Register an instance of Exec in container. <ide> id, err := s.backend.ContainerExecCreate(execConfig) <ide> if err != nil { <del> logrus.Errorf("Error setting up exec command in container %s: %s", name, err) <add> logrus.Errorf("Error setting up exec command in container %s: %s", name, utils.GetErrorMessage(err)) <ide> return err <ide> } <ide> <ide> func (s *containerRouter) postContainerExecStart(ctx context.Context, w http.Res <ide> if execStartCheck.Detach { <ide> return err <ide> } <del> logrus.Errorf("Error running exec in container: %v\n", err) <add> logrus.Errorf("Error running exec in container: %v\n", utils.GetErrorMessage(err)) <ide> } <ide> return nil <ide> }
2
Javascript
Javascript
add rel attribute binding to linkto helper
a6d5f9574d32f3920f4dd738b8b90ca1667d9d58
<ide><path>packages/ember-routing/lib/helpers/link_to.js <ide> Ember.onLoad('Ember.Handlebars', function(Handlebars) { <ide> **/ <ide> title: null, <ide> <add> /** <add> Sets the `rel` attribute of the `LinkView`'s HTML element. <add> <add> @property rel <add> @default null <add> **/ <add> rel: null, <add> <ide> /** <ide> The CSS class to apply to `LinkView`'s element when its `active` <ide> property is `true`. <ide> Ember.onLoad('Ember.Handlebars', function(Handlebars) { <ide> @default false <ide> **/ <ide> replace: false, <del> attributeBindings: ['href', 'title'], <add> attributeBindings: ['href', 'title', 'rel'], <ide> classNameBindings: ['active', 'loading', 'disabled'], <ide> <ide> /** <ide><path>packages/ember/tests/helpers/link_to_test.js <ide> test("The {{linkTo}} helper moves into the named route with context", function() <ide> }); <ide> <ide> test("The {{linkTo}} helper binds some anchor html tag common attributes", function() { <del> Ember.TEMPLATES.index = Ember.Handlebars.compile("<h3>Home</h3>{{#linkTo 'index' id='self-link' title='title-attr'}}Self{{/linkTo}}"); <add> Ember.TEMPLATES.index = Ember.Handlebars.compile("<h3>Home</h3>{{#linkTo 'index' id='self-link' title='title-attr' rel='rel-attr'}}Self{{/linkTo}}"); <ide> bootApplication(); <ide> <ide> Ember.run(function() { <ide> router.handleURL("/"); <ide> }); <del> <del> equal(Ember.$('#self-link', '#qunit-fixture').attr('title'), 'title-attr', "The self-link contains title attribute"); <add> <add> var link = Ember.$('#self-link', '#qunit-fixture'); <add> equal(link.attr('title'), 'title-attr', "The self-link contains title attribute"); <add> equal(link.attr('rel'), 'rel-attr', "The self-link contains rel attribute"); <ide> }); <ide> <ide> test("The {{linkTo}} helper accepts string/numeric arguments", function() {
2
Go
Go
remove reflection on cli init
5c8950e84d2384919f45209f8cc4cbf00ff29015
<ide><path>api/client/commands.go <add>package client <add> <add>// Command returns a cli command handler if one exists <add>func (cli *DockerCli) Command(name string) func(...string) error { <add> return map[string]func(...string) error{ <add> "attach": cli.CmdAttach, <add> "build": cli.CmdBuild, <add> "commit": cli.CmdCommit, <add> "cp": cli.CmdCp, <add> "create": cli.CmdCreate, <add> "diff": cli.CmdDiff, <add> "events": cli.CmdEvents, <add> "exec": cli.CmdExec, <add> "export": cli.CmdExport, <add> "history": cli.CmdHistory, <add> "images": cli.CmdImages, <add> "import": cli.CmdImport, <add> "info": cli.CmdInfo, <add> "inspect": cli.CmdInspect, <add> "kill": cli.CmdKill, <add> "load": cli.CmdLoad, <add> "login": cli.CmdLogin, <add> "logout": cli.CmdLogout, <add> "logs": cli.CmdLogs, <add> "network": cli.CmdNetwork, <add> "network create": cli.CmdNetworkCreate, <add> "network connect": cli.CmdNetworkConnect, <add> "network disconnect": cli.CmdNetworkDisconnect, <add> "network inspect": cli.CmdNetworkInspect, <add> "network ls": cli.CmdNetworkLs, <add> "network rm": cli.CmdNetworkRm, <add> "pause": cli.CmdPause, <add> "port": cli.CmdPort, <add> "ps": cli.CmdPs, <add> "pull": cli.CmdPull, <add> "push": cli.CmdPush, <add> "rename": cli.CmdRename, <add> "restart": cli.CmdRestart, <add> "rm": cli.CmdRm, <add> "rmi": cli.CmdRmi, <add> "run": cli.CmdRun, <add> "save": cli.CmdSave, <add> "search": cli.CmdSearch, <add> "start": cli.CmdStart, <add> "stats": cli.CmdStats, <add> "stop": cli.CmdStop, <add> "tag": cli.CmdTag, <add> "top": cli.CmdTop, <add> "unpause": cli.CmdUnpause, <add> "update": cli.CmdUpdate, <add> "version": cli.CmdVersion, <add> "volume": cli.CmdVolume, <add> "volume create": cli.CmdVolumeCreate, <add> "volume inspect": cli.CmdVolumeInspect, <add> "volume ls": cli.CmdVolumeLs, <add> "volume rm": cli.CmdVolumeRm, <add> "wait": cli.CmdWait, <add> }[name] <add>} <ide><path>cli/cli.go <ide> import ( <ide> "fmt" <ide> "io" <ide> "os" <del> "reflect" <ide> "strings" <ide> <ide> flag "github.com/docker/docker/pkg/mflag" <ide> type Cli struct { <ide> // Handler holds the different commands Cli will call <ide> // It should have methods with names starting with `Cmd` like: <ide> // func (h myHandler) CmdFoo(args ...string) error <del>type Handler interface{} <add>type Handler interface { <add> Command(name string) func(...string) error <add>} <ide> <ide> // Initializer can be optionally implemented by a Handler to <ide> // initialize before each call to one of its commands. <ide> func (cli *Cli) command(args ...string) (func(...string) error, error) { <ide> if c == nil { <ide> continue <ide> } <del> camelArgs := make([]string, len(args)) <del> for i, s := range args { <del> if len(s) == 0 { <del> return nil, errors.New("empty command") <del> } <del> camelArgs[i] = strings.ToUpper(s[:1]) + strings.ToLower(s[1:]) <del> } <del> methodName := "Cmd" + strings.Join(camelArgs, "") <del> method := reflect.ValueOf(c).MethodByName(methodName) <del> if method.IsValid() { <del> if c, ok := c.(Initializer); ok { <del> if err := c.Initialize(); err != nil { <add> if cmd := c.Command(strings.Join(args, " ")); cmd != nil { <add> if ci, ok := c.(Initializer); ok { <add> if err := ci.Initialize(); err != nil { <ide> return nil, initErr{err} <ide> } <ide> } <del> return method.Interface().(func(...string) error), nil <add> return cmd, nil <ide> } <ide> } <ide> return nil, errors.New("command not found") <ide> func (cli *Cli) noSuchCommand(command string) { <ide> os.Exit(1) <ide> } <ide> <add>// Command returns a command handler, or nil if the command does not exist <add>func (cli *Cli) Command(name string) func(...string) error { <add> return map[string]func(...string) error{ <add> "help": cli.CmdHelp, <add> }[name] <add>} <add> <ide> // CmdHelp displays information on a Docker command. <ide> // <ide> // If more than one command is specified, information is only shown for the first command. <ide><path>cmd/docker/daemon.go <ide> type DaemonProxy struct{} <ide> func NewDaemonProxy() DaemonProxy { <ide> return DaemonProxy{} <ide> } <add> <add>// Command returns a cli command handler if one exists <add>func (p DaemonProxy) Command(name string) func(...string) error { <add> return map[string]func(...string) error{ <add> "daemon": p.CmdDaemon, <add> }[name] <add>}
3
Text
Text
add release date
ac95aa4162280c1d762049f3004ea33354f2409a
<ide><path>CHANGELOG-5.5.md <ide> # Release Notes for 5.5.x <ide> <del>## [Unreleased] <add>## v5.5.3 (2017-09-07) <ide> <ide> ### Added <ide> - Added `$action` parameter to `Route::getAction()` for simpler access ([#20975](https://github.com/laravel/framework/pull/20975))
1
Text
Text
remove duplicated document
5527202e41dfa48b8635dd6f274acb7f19ee3302
<ide><path>docs/reference/commandline/deploy.md <ide> advisory: "experimental" <ide> will be rejected. <ide> --> <ide> <del># stack deploy (experimental) <add># deploy (alias for stack deploy) (experimental) <ide> <ide> ```markdown <ide> Usage: docker deploy [OPTIONS] STACK
1
Ruby
Ruby
convert blacklist test to spec
7be5a6a3d2cdb68870a37bdaa2d0c5cdec20c70b
<ide><path>Library/Homebrew/test/blacklist_spec.rb <add>require "blacklist" <add> <add>RSpec::Matchers.define :be_blacklisted do <add> match do |actual| <add> blacklisted?(actual) <add> end <add>end <add> <add>describe "Blacklist" do <add> context "rubygems" do <add> %w[gem rubygem rubygems].each do |s| <add> subject { s } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> end <add> <add> context "latex" do <add> %w[latex tex tex-live texlive TexLive].each do |s| <add> subject { s } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> end <add> <add> context "pip" do <add> subject { "pip" } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> <add> context "pil" do <add> subject { "pil" } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> <add> context "macruby" do <add> subject { "MacRuby" } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> <add> context "lzma" do <add> %w[lzma liblzma].each do |s| <add> subject { s } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> end <add> <add> context "gtest" do <add> %w[gtest googletest google-test].each do |s| <add> subject { s } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> end <add> <add> context "gmock" do <add> %w[gmock googlemock google-mock].each do |s| <add> subject { s } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> end <add> <add> context "sshpass" do <add> subject { "sshpass" } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> <add> context "gsutil" do <add> subject { "gsutil" } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> <add> context "clojure" do <add> subject { "clojure" } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> <add> context "osmium" do <add> %w[osmium Osmium].each do |s| <add> subject { s } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> end <add> <add> context "gfortran" do <add> subject { "gfortran" } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> <add> context "play" do <add> subject { "play" } <add> <add> it { is_expected.to be_blacklisted } <add> end <add> <add> context "haskell_platform" do <add> subject { "haskell-platform" } <add> <add> it { is_expected.to be_blacklisted } <add> end <add>end <ide><path>Library/Homebrew/test/blacklist_test.rb <del>require "testing_env" <del>require "blacklist" <del> <del>class BlacklistTests < Homebrew::TestCase <del> def assert_blacklisted(s) <del> assert blacklisted?(s), "'#{s}' should be blacklisted" <del> end <del> <del> def test_rubygems <del> %w[gem rubygem rubygems].each { |s| assert_blacklisted s } <del> end <del> <del> def test_latex <del> %w[latex tex tex-live texlive TexLive].each { |s| assert_blacklisted s } <del> end <del> <del> def test_pip <del> assert_blacklisted "pip" <del> end <del> <del> def test_pil <del> assert_blacklisted "pil" <del> end <del> <del> def test_macruby <del> assert_blacklisted "MacRuby" <del> end <del> <del> def test_lzma <del> %w[lzma liblzma].each { |s| assert_blacklisted s } <del> end <del> <del> def test_gtest <del> %w[gtest googletest google-test].each { |s| assert_blacklisted s } <del> end <del> <del> def test_gmock <del> %w[gmock googlemock google-mock].each { |s| assert_blacklisted s } <del> end <del> <del> def test_sshpass <del> assert_blacklisted "sshpass" <del> end <del> <del> def test_gsutil <del> assert_blacklisted "gsutil" <del> end <del> <del> def test_clojure <del> assert_blacklisted "clojure" <del> end <del> <del> def test_osmium <del> %w[osmium Osmium].each { |s| assert_blacklisted s } <del> end <del> <del> def test_gfortran <del> assert_blacklisted "gfortran" <del> end <del> <del> def test_play <del> assert_blacklisted "play" <del> end <del> <del> def test_haskell_platform <del> assert_blacklisted "haskell-platform" <del> end <del>end
2
PHP
PHP
use check date in the date validator
4035bbc94ae809005d5941514b744cfc482d92da
<ide><path>src/Illuminate/Validation/Validator.php <ide> protected function validateRegex($attribute, $value, $parameters) <ide> */ <ide> protected function validateDate($attribute, $value) <ide> { <del> return strtotime($value) !== false; <add> if (strtotime($value) === false) return false; <add> <add> $date = date_parse($value); <add> <add> return checkdate($date['month'], $date['day'], $date['year']); <ide> } <ide> <ide> /**
1
Ruby
Ruby
fix bad locate reference
504152038cb591a661721b09e989f428bbc6ae0a
<ide><path>Library/Homebrew/os/mac/sdk.rb <ide> def sdk_paths <ide> # Xcode < 4.3 style <ide> sdk_prefix = "/Developer/SDKs" unless File.directory? sdk_prefix <ide> # Finally query Xcode itself (this is slow, so check it last) <del> sdk_prefix = File.join(Utils.popen_read(OS::Mac.locate("xcrun"), "--show-sdk-platform-path").chomp, "Developer", "SDKs") unless File.directory? sdk_prefix <add> sdk_prefix = File.join(Utils.popen_read(DevelopmentTools.locate("xcrun"), "--show-sdk-platform-path").chomp, "Developer", "SDKs") unless File.directory? sdk_prefix <ide> <ide> # Bail out if there is no SDK prefix at all <ide> if !File.directory? sdk_prefix
1
Python
Python
fix property name in breeze shell params
4afa8e3cecf1e4a2863715d14a45160034ad31a6
<ide><path>dev/breeze/src/airflow_breeze/params/shell_params.py <ide> def enabled_integrations(self) -> str: <ide> return enabled_integration <ide> <ide> @property <del> def the_image_type(self) -> str: <del> the_image_type = 'CI' <del> return the_image_type <add> def image_type(self) -> str: <add> return 'CI' <ide> <ide> @property <ide> def md5sum_cache_dir(self) -> Path: <del> cache_dir = Path(BUILD_CACHE_DIR, self.airflow_branch, self.python, self.the_image_type) <add> cache_dir = Path(BUILD_CACHE_DIR, self.airflow_branch, self.python, self.image_type) <ide> return cache_dir <ide> <ide> @property <ide> def sqlite_url(self) -> str: <ide> <ide> def print_badge_info(self): <ide> if self.verbose: <del> get_console().print(f'[info]Use {self.the_image_type} image[/]') <add> get_console().print(f'[info]Use {self.image_type} image[/]') <ide> get_console().print(f'[info]Branch Name: {self.airflow_branch}[/]') <ide> get_console().print(f'[info]Docker Image: {self.airflow_image_name_with_tag}[/]') <ide> get_console().print(f'[info]Airflow source version:{self.airflow_version}[/]')
1
Javascript
Javascript
clarify highlightrow usage with uiexplorer example
a26afd2d731b305ea6b051c131b4f10509b9fcb2
<ide><path>Examples/UIExplorer/ListViewExample.js <ide> var ListViewSimpleExample = React.createClass({ <ide> dataSource={this.state.dataSource} <ide> renderRow={this._renderRow} <ide> renderScrollComponent={props => <RecyclerViewBackedScrollView {...props} />} <del> renderSeparator={(sectionID, rowID) => <View key={`${sectionID}-${rowID}`} style={styles.separator} />} <add> renderSeparator={this._renderSeperator} <ide> /> <ide> </UIExplorerPage> <ide> ); <ide> }, <ide> <del> _renderRow: function(rowData: string, sectionID: number, rowID: number) { <add> _renderRow: function(rowData: string, sectionID: number, rowID: number, highlightRow: (sectionID: number, rowID: number) => void) { <ide> var rowHash = Math.abs(hashCode(rowData)); <ide> var imgSource = THUMB_URLS[rowHash % THUMB_URLS.length]; <ide> return ( <del> <TouchableHighlight onPress={() => this._pressRow(rowID)}> <add> <TouchableHighlight onPress={() => { <add> this._pressRow(rowID); <add> highlightRow(sectionID, rowID); <add> }}> <ide> <View> <ide> <View style={styles.row}> <ide> <Image style={styles.thumb} source={imgSource} /> <ide> var ListViewSimpleExample = React.createClass({ <ide> this._genRows(this._pressData) <ide> )}); <ide> }, <add> <add> _renderSeperator: function(sectionID: number, rowID: number, adjacentRowHighlighted: bool) { <add> return ( <add> <View <add> key={`${sectionID}-${rowID}`} <add> style={{ <add> height: adjacentRowHighlighted ? 4 : 1, <add> backgroundColor: adjacentRowHighlighted ? '#3B5998' : '#CCCCCC', <add> }} <add> /> <add> ); <add> } <ide> }); <ide> <ide> var THUMB_URLS = [ <ide> var styles = StyleSheet.create({ <ide> padding: 10, <ide> backgroundColor: '#F6F6F6', <ide> }, <del> separator: { <del> height: 1, <del> backgroundColor: '#CCCCCC', <del> }, <ide> thumb: { <ide> width: 64, <ide> height: 64, <ide><path>Libraries/CustomComponents/ListView/ListView.js <ide> var ListView = React.createClass({ <ide> * a renderable component to be rendered as the row. By default the data <ide> * is exactly what was put into the data source, but it's also possible to <ide> * provide custom extractors. ListView can be notified when a row is <del> * being highlighted by calling highlightRow function. The separators above and <del> * below will be hidden when a row is highlighted. The highlighted state of <del> * a row can be reset by calling highlightRow(null). <add> * being highlighted by calling `highlightRow(sectionID, rowID)`. This <add> * sets a boolean value of adjacentRowHighlighted in renderSeparator, allowing you <add> * to control the separators above and below the highlighted row. The highlighted <add> * state of a row can be reset by calling highlightRow(null). <ide> */ <ide> renderRow: PropTypes.func.isRequired, <ide> /**
2
Text
Text
add globalid link to active_job_basics.md
3ca47692e48d63634b02564620cb2070ae598b3b
<ide><path>guides/source/active_job_basics.md <ide> ActiveJob supports the following types of arguments by default: <ide> <ide> ### GlobalID <ide> <del>Active Job supports GlobalID for parameters. This makes it possible to pass live <add>Active Job supports [GlobalID](https://github.com/rails/globalid/blob/master/README.md) for parameters. This makes it possible to pass live <ide> Active Record objects to your job instead of class/id pairs, which you then have <ide> to manually deserialize. Before, jobs would look like this: <ide>
1